Three-dimensional hair generation method and model training method

Through multi-view image processing and feature extraction network, three-dimensional hairstyles are automatically generated, which solves the problems of low efficiency of three-dimensional hairstyle generation and large data processing in the existing technology, and realizes automated and efficient three-dimensional hairstyle generation.

CN116030185BActive Publication Date: 2025-01-14BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211542715.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-02
Publication Date
2025-01-14
Estimated Expiration
2042-12-02

AI Technical Summary

Technical Problem

The prior art requires designers to manually build hair in three-dimensional hairstyle generation, resulting in low production efficiency and large data processing volume, making it difficult to achieve automated and efficient three-dimensional hairstyle generation.

Method used

By obtaining images from multiple perspectives, generating directional maps, extracting hair style hidden vectors, and using feature extraction networks and decoders, automatically generate three-dimensional hairstyles, simplifying the data processing process and reducing the construction or growth needs of individual hairs.

Benefits of technology

Automatic three-dimensional hairstyle generation based on two-dimensional images is realized, which improves generation efficiency and simplifies data processing, and replaces the process of designers manually building hair.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116030185B_ABST
    Figure CN116030185B_ABST
Patent Text Reader

Abstract

The present disclosure provides a three-dimensional hairstyle generation method and a model training method, which relates to the field of artificial intelligence technology, specifically to the technical fields of augmented reality, virtual reality, computer vision, deep learning, etc., and can be applied to scenes such as the metaverse and virtual digital people. The implementation scheme is: obtaining multiple first images of multiple perspectives of a first object, the first object including a hairstyle region containing multiple hairs; based on the multiple first images, obtaining multiple first trend graphs corresponding to the multiple first images, each of the multiple first trend graphs indicating the direction of the hair segment corresponding to each pixel in the region corresponding to the hairstyle region of the first object in the corresponding image in the multiple images; based on the multiple first trend graphs, obtaining a first hairstyle latent vector of the hairstyle region of the first object; and obtaining a three-dimensional hairstyle corresponding to the first object based on the first hairstyle latent vector.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, specifically to the technical fields of augmented reality, virtual reality, computer vision, deep learning, etc., and can be applied to scenes such as the metaverse and virtual digital humans. Specifically, it relates to a three-dimensional hair generation method, a model training method, a device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art

[0002] Artificial intelligence is a discipline that studies how to use computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.

[0003] Three-dimensional virtual images have wide application value in user scenarios such as social networking, live broadcasting, and games. Three-dimensional virtual image generation based on artificial intelligence generates virtual images through facial images and customizes personalized virtual images for users to effectively meet the personalized needs of users and has broad application prospects.

[0004] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention

[0005] The present disclosure provides a three-dimensional hairstyle generation method, a model training method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product.

[0006] According to one aspect of the present disclosure, there is provided a method for generating a three-dimensional hairstyle, comprising: obtaining a plurality of first images of a plurality of perspectives about a first object, the first object comprising a hairstyle region including a plurality of hair strands; obtaining a plurality of first trend graphs corresponding to the plurality of first images based on the plurality of first images, each of the plurality of first trend graphs indicating a direction of a hair segment corresponding to each pixel in a region corresponding to the hairstyle region of the first object in a corresponding image among the plurality of images; obtaining a first hairstyle latent vector of the hairstyle region of the first object based on the plurality of first trend graphs; and obtaining a three-dimensional hairstyle corresponding to the first object based on the first hairstyle latent vector, the three-dimensional hairstyle comprising hair strand data for each of the plurality of hair strands, the hair strand data comprising coordinates of each of a plurality of nodes on the hair strand.

[0007] According to another aspect of the present disclosure, a training method for a three-dimensional hairstyle generation model is provided, the three-dimensional hairstyle generation model comprising a feature extraction network and a decoder, the method comprising: obtaining a three-dimensional hair dataset, the three-dimensional hair dataset comprising the coordinates of each of a plurality of nodes on each of a plurality of hairs, the plurality of hairs coming from a hairstyle region of a first head model; obtaining a plurality of training trend graphs corresponding to a plurality of viewing angles of the first head model based on the three-dimensional hair dataset, each of the plurality of training trend graphs corresponding to an image of the first head model at a corresponding viewing angle among the plurality of viewing angles, and indicating a direction of a hair segment corresponding to each pixel in the hairstyle region in the image; obtaining a training hairstyle latent vector corresponding to the three-dimensional hair dataset based on the plurality of training trend graphs using the feature extraction network; obtaining a prediction result corresponding to the three-dimensional hair dataset based on the training hairstyle latent vector using the decoder, the prediction result comprising the coordinates of each of a plurality of nodes on each of the plurality of hairs; and adjusting parameters of the three-dimensional hairstyle generation model based on the three-dimensional hair dataset and the prediction result.

[0008] According to another aspect of the present disclosure, there is provided a three-dimensional hairstyle generating apparatus, comprising: a first image acquiring unit, configured to acquire a plurality of first images of a plurality of perspectives about a first object, the first object comprising a hairstyle region including a plurality of hair strands; a first trend graph acquiring unit, configured to acquire a plurality of first trend graphs corresponding to the plurality of first images based on the plurality of first images, each of the plurality of first trend graphs indicating a direction of a hair segment corresponding to each pixel in a region corresponding to the hairstyle region of the first object in a corresponding image among the plurality of images; a first hairstyle latent vector acquiring unit, configured to acquire a first hairstyle latent vector of the hairstyle region of the first object based on the plurality of first trend graphs; and a three-dimensional hairstyle acquiring unit, configured to acquire a three-dimensional hairstyle corresponding to the first object based on the first hairstyle latent vector, the three-dimensional hairstyle comprising hair strand data corresponding to each of the plurality of hair strands, the hair strand data comprising coordinates of each of a plurality of nodes on the hair strand.

[0009] According to another aspect of the present disclosure, a training device for a three-dimensional hairstyle generation model is provided, the three-dimensional hairstyle generation model comprising a feature extraction network and a decoder, the device comprising: a three-dimensional hair data set acquisition unit, configured to obtain a three-dimensional hair data set, the three-dimensional hair data set comprising the coordinates of each of a plurality of nodes on each of a plurality of hairs, the plurality of hairs coming from a hairstyle region of a first head model; a training trend graph acquisition unit, configured to obtain, based on the three-dimensional hair data set, a plurality of training trend graphs corresponding to a plurality of viewing angles of the first head model, each of the plurality of training trend graphs corresponding to an image of the first head model at a corresponding viewing angle among the plurality of viewing angles , and indicates the direction of the hair line segment corresponding to each pixel in the hairstyle area in the image; a training hairstyle latent vector acquisition unit is configured to use the feature extraction network to obtain the training hairstyle latent vector corresponding to the three-dimensional hair data set based on the multiple training trend graphs; a prediction result acquisition unit is configured to use the decoder to obtain the prediction result corresponding to the three-dimensional hair data set based on the training hairstyle latent vector, the prediction result including the coordinates of each of the multiple nodes on each of the multiple hairs of the first head model; and a parameter adjustment unit is configured to adjust the parameters of the three-dimensional hairstyle generation model based on the three-dimensional hair data set and the prediction result.

[0010] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to an embodiment of the present disclosure.

[0011] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method according to the embodiment of the present disclosure.

[0012] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method according to the embodiment of the present disclosure is implemented.

[0013] According to one or more embodiments of the present disclosure, a three-dimensional hairstyle can be directly and automatically generated based on a two-dimensional image, thereby improving the efficiency of generating the three-dimensional hairstyle and reducing the amount of data processing.

[0014] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0016] Figure 1 A schematic diagram showing an exemplary system in which the various methods described herein may be implemented according to an embodiment of the present disclosure;

[0017] Figure 2 A flowchart of a method for generating a three-dimensional hairstyle according to an embodiment of the present disclosure is shown;

[0018] Figure 3 A flowchart of a process of obtaining a first hairstyle latent vector based on a plurality of first trend graphs in a three-dimensional hairstyle generation method according to an embodiment of the present disclosure is shown;

[0019] Figure 4 A flowchart of a process of obtaining a three-dimensional hairstyle corresponding to a first object based on a first hairstyle latent vector in a three-dimensional hairstyle generation method according to an embodiment of the present disclosure is shown;

[0020] Figure 5 A flowchart showing a process of modifying a first hairstyle latent vector to obtain a target hairstyle latent vector in a three-dimensional hairstyle generation method according to an embodiment of the present disclosure is shown;

[0021] Figure 6 A flowchart of a method for training a three-dimensional hairstyle generation model according to an embodiment of the present disclosure is shown;

[0022] Figure 7 A schematic diagram showing a comparison between the training process and the prediction process of a three-dimensional hairstyle generation model in the training method of the three-dimensional hairstyle generation model according to the present disclosure is shown;

[0023] Figure 8 A structural block diagram of a three-dimensional hairstyle generating device according to an embodiment of the present disclosure is shown;

[0024] Fig. 9 A structural block diagram of a training device for a three-dimensional hairstyle generation model according to an embodiment of the present disclosure is shown; and

[0025] Fig.10 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0026] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0027] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, temporal relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.

[0028] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.

[0029] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0030] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.

[0031] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable the three-dimensional hairstyle generation method according to the present disclosure to be performed.

[0032] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software as a service (SaaS) model.

[0033] exist Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.

[0034] The user may use client devices 101, 102, 103, 104, 105 and / or 106 to obtain the three-dimensional hairstyle generated in the three-dimensional hairstyle generation method according to the present disclosure. The client device may provide an interface that enables the user of the client device to interact with the client device. The client device may also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure may support any number of client devices.

[0035] Client devices 101, 102, 103, 104, 105 and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. Client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and may use various communication protocols.

[0036] The network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.

[0037] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.

[0038] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.

[0039] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and / or 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and / or 106.

[0040] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.

[0041] The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. The databases 130 may reside in various locations. For example, the database used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The databases 130 may be of different types. In some embodiments, the databases used by the server 120 may be, for example, relational databases. One or more of these databases may store, update, and retrieve data to and from the databases in response to commands.

[0042] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.

[0043] Figure 1The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.

[0044] According to one aspect of the present disclosure, a method for generating a three-dimensional hairstyle is provided. Figure 2 As shown, the three-dimensional hairstyle generation method 200 includes:

[0045] Step S210: obtaining a plurality of first images of a first object at a plurality of viewing angles, wherein the first object includes a hairstyle region including a plurality of hair strands;

[0046] Step S220: Based on the multiple first images, obtaining multiple first trend graphs corresponding to the multiple first images, each of the multiple first trend graphs indicating a direction of a hairline segment corresponding to each pixel in an area corresponding to the hairstyle area of ​​the first object in a corresponding image among the multiple images;

[0047] Step S230: obtaining a first hairstyle latent vector of the hairstyle region of the first object based on the multiple first trend graphs; and

[0048] Step S240: Based on the first hairstyle latent vector, obtain a three-dimensional hairstyle corresponding to the first object, wherein the three-dimensional hairstyle includes hair data of each of the multiple hairs, and the hair data includes the coordinates of each of the multiple nodes on the hair.

[0049] In the related art, designing a three-dimensional hairstyle based on multi-view images requires a designer to manually construct hair strands and obtain a three-dimensional hairstyle based on the constructed hair strands. Manual construction of three-dimensional hair strands by designers is costly and inefficient.

[0050] According to the embodiments of the present disclosure, multiple first trend graphs are obtained based on multiple first images of multiple perspectives of the first object, and hairstyle latent vectors are obtained based on the multiple first trend graphs, and finally a three-dimensional hairstyle is obtained based on the hairstyle latent vectors, so that the automatic generation of a three-dimensional hairstyle based on a two-dimensional image can be realized, replacing the manual design of the hairstyle by the designer, thereby improving the generation efficiency of the three-dimensional hairstyle. At the same time, according to the method of the present disclosure, the method of obtaining a three-dimensional hairstyle by decoding the hairstyle latent vector obtained from the image does not need to construct or grow a single hair strand, which simplifies the processing flow and reduces the amount of data processing compared to the method of generating a three-dimensional hairstyle by constructing or growing a single hair strand.

[0051] In some embodiments, the first object may be a person, or any three-dimensional object with hair, such as a head model.

[0052] In some embodiments, in step S210, images of the first object are captured from multiple viewing angles by a camera device to obtain the multiple first images, wherein the multiple viewing angles may be any two or more viewing angles.

[0053] For example, the multiple first images are multiple images captured by the camera device during a 360° rotation around the plane where the head circumference of the first object is located.

[0054] In some embodiments, the multiple perspectives include at least four perspectives corresponding to the first object: front, back, left, and right.

[0055] The multiple perspectives include the front, back, left, and right perspectives of the first object, so that the multiple first images of the first object obtained include information reflecting all the hairstyle regions of the first object, so that the hairstyle latent vectors obtained based on the multiple first images can reflect all the information of the first object in three-dimensional space, so that the obtained hairstyle latent vectors are accurate, and the three-dimensional hairstyle obtained based on the hairstyle latent vectors can more accurately reflect the hairstyle of the first object. At the same time, only the first images of the four perspectives of the first object, namely, the front, back, left, and right perspectives, are processed to obtain the three-dimensional hairstyle, so that the data processing amount is minimized while obtaining the three-dimensional hairstyle that accurately reflects the hairstyle of the first object.

[0056] In some scenarios, a 3D hairstyle designer designs a hairstyle based on views of four perspectives, namely, front, back, left, and right, of a first object. According to an embodiment of the present disclosure, by obtaining multiple first images of multiple perspectives including the four perspectives, namely, front, back, left, and right, corresponding to the first object, the method according to the present disclosure can be directly applied to application scenarios in which a 3D hairstyle designer designs a 3D hairstyle.

[0057] It should be noted that the 3D hairstyle generation method according to the present disclosure is applicable to the scenario where a 3D hairstyle designer designs a 3D hairstyle, which is merely exemplary and can be applied to any scenario where a 3D hairstyle needs to be generated, and is not limited here.

[0058] In some embodiments, in step S220, Gabor filtering is performed on the hairstyle region of each first image in the plurality of first images to obtain a first trend map corresponding to the first image.

[0059] In some embodiments, in step S220, each first image is input into an image generation model to generate a first trend map corresponding to the first image, wherein the image generation model is obtained by training with a training image and a trend map corresponding to the training image. The training image is an image containing a hairstyle area of ​​a training object, and the trend map is a trend map obtained by rendering with a three-dimensional hairstyle data set.

[0060] In some embodiments, in step S220, segmentation processing is first performed on each of the multiple first images for the hairstyle area to obtain a mask image corresponding to the hairstyle area in the first image, and then a first trend map corresponding to the first image is obtained based on the mask image. For example, based on the pixel gradient in the mask image, the direction of the hair line segment corresponding to the pixel is extracted to obtain the first trend map.

[0061] The pixels of the three colors RGB in the trend map correspond to the direction vectors of the XYZ axis in the three-dimensional space. In the process of obtaining the first trend map, the direction vectors of each point in the hairstyle area in the first image in the XYZ space are normalized to a value between 0 and 255, so that each pixel in the obtained first trend map indicates the direction of the hairline segment corresponding to each pixel in the area corresponding to the hairstyle area of ​​the first object in the corresponding first image.

[0062] In some embodiments, in step S230, feature extraction is performed on each of the multiple first trend graphs to obtain image features corresponding to each first trend graph; and based on the multiple image features corresponding to the multiple first trend graphs, a hairstyle latent vector is obtained.

[0063] Since each pixel in the first direction map indicates the direction of the hair segment corresponding to each pixel in the area corresponding to the hairstyle area of ​​the first object in the corresponding first image, in the process of feature extraction for the first direction map, the direction information of each hair in the hairstyle area can be extracted based on the direction indicated by each pixel, and the hairstyle latent vector can be obtained by encoding the direction information of each hair.

[0064] In some embodiments, the hairstyle latent vector includes a hair latent vector corresponding to each hair in the hairstyle region. In some embodiments, the hairstyle latent vector is a latent vector obtained by encoding multiple hair latent vectors corresponding to multiple hairs in the hairstyle region, wherein in the process of encoding the multiple hair latent vectors, the same information of the multiple hairs in the latent vector space is extracted to generate the hairstyle latent vector.

[0065] In some embodiments, Figure 3 As shown, in step S230, based on the multiple first trend graphs, obtaining the first hairstyle latent vector includes:

[0066] Step S310: splicing the plurality of first trend images to obtain a spliced ​​image; and

[0067] Step S320: performing feature extraction on the spliced ​​image to obtain the first hairstyle latent vector.

[0068] A spliced ​​image is obtained by splicing a plurality of first trend graphs, and features are extracted from the spliced ​​image to obtain a hairstyle latent vector. This reduces the amount of data processing compared to separately processing each trend graph to obtain the hairstyle latent vector.

[0069] In some embodiments, in step S310, multiple first direction graphs are spliced ​​by stacking them in the channel direction.

[0070] In some embodiments, in step S320, feature extraction is performed on the stitched image by using a feature extraction network.

[0071] In some embodiments, in step S320, performing feature extraction on the spliced ​​image to obtain the first hairstyle latent vector includes:

[0072] The spliced ​​image is input into a trained feature extraction network to obtain the first hairstyle latent vector, wherein the trained feature extraction network is obtained by training a hairstyle generation model composed of a feature extraction network and a decoder using three-dimensional hair data. In the process of training the hairstyle generation model, a plurality of training trend graphs corresponding to the plurality of viewing angles are obtained based on the three-dimensional hair data set, and a training hairstyle latent vector is obtained by performing feature extraction on a spliced ​​image of the plurality of training trend graphs using the feature extraction network, and a prediction result is obtained by inputting the training hairstyle latent vector into a decoder, and parameters of the hairstyle generation model are adjusted based on a loss between the three-dimensional hair data set and the prediction result.

[0073] The first hairstyle latent vector is obtained by inputting the spliced ​​image into a feature extraction network obtained after training with a hairstyle generation model composed of a decoder. Since the feature extraction network is obtained by training with a three-dimensional hair data set through the hairstyle generation model composed of a decoder, during the training process, the feature extraction network can learn and extract spatial information corresponding to the three-dimensional hair data set, so that when performing feature extraction based on multiple first direction graphs of multiple perspectives, the information of the hairstyle area of ​​the first object contained in the multiple first direction graphs in the three-dimensional space can be extracted, so that the information of the hairstyle area in the three-dimensional space contained in the obtained hairstyle latent vector is consistent with the information of the hairstyle area in space reflected by the three-dimensional hair data set, thereby improving the accuracy of the obtained hairstyle latent vector.

[0074] In some embodiments, a plurality of training trend graphs are obtained by using a three-dimensional hair data set to perform rendering operations corresponding to a plurality of viewing angles.

[0075] In some embodiments, the three-dimensional hair data set includes hair data of each hair strand from a plurality of hair strands on a preset head model, and the hair data indicates the coordinates of each of a plurality of nodes on the hair strand. Furthermore, the prediction result obtained by the decoder based on the training hairstyle latent vector is a predicted hair data set including hair data of each hair strand in the plurality of hair strands, wherein the hair data of each hair strand indicates the coordinates of each of a plurality of nodes on the hair strand. By obtaining the loss between the plurality of hair strands data of the plurality of hair strands in the three-dimensional hair data set and the plurality of hair strands data of the plurality of hair strands in the prediction result, the parameters of the hairstyle generation model are adjusted.

[0076] In some embodiments, after completing steps S210-S230, in step S240, the first hairstyle latent vector is directly decoded to generate a three-dimensional hairstyle corresponding to the first object. The decoder in the above three-dimensional hairstyle generation model is used to decode the first hairstyle latent vector.

[0077] In some embodiments, Figure 4 As shown, in step S240, obtaining the three-dimensional hairstyle corresponding to the first object based on the first hairstyle latent vector includes:

[0078] Step S410: modifying the first hairstyle latent vector to obtain a target hairstyle latent vector; and

[0079] Step S420: Decode the target hairstyle latent vector to obtain the three-dimensional hairstyle.

[0080] By modifying the first hairstyle latent vector, a target hairstyle latent vector for obtaining a three-dimensional hairstyle is obtained. In a scenario where a designer designs a three-dimensional hairstyle, the designer can modify the hairstyle of the first object based on the first hairstyle latent vector, thereby improving design efficiency.

[0081] In some embodiments, the target hairstyle latent vector is obtained by manually modifying the first hairstyle latent vector.

[0082] In some embodiments, Figure 5 As shown, in step S410, modifying the first hairstyle latent vector to obtain a target hairstyle latent vector includes:

[0083] Step S510: obtaining a plurality of second images of the plurality of viewing angles with respect to a second object, wherein the second object includes a hairstyle region including a plurality of hair strands;

[0084] Step S520: Based on the plurality of second images, obtaining a plurality of second trend graphs corresponding to the plurality of second images;

[0085] Step S530: obtaining a second hairstyle latent vector of the hairstyle region of the second object based on the plurality of second trend graphs; and

[0086] Step S540: modify the first hairstyle latent vector based on the second hairstyle latent vector to obtain a target hairstyle latent vector.

[0087] By obtaining a second hairstyle latent vector different from the first hairstyle latent vector obtained from multiple second images of multiple perspectives of the second object, and modifying the first hairstyle latent vector based on the second hairstyle latent vector to obtain a target hairstyle latent vector, interpolation of latent vectors can be achieved, thereby obtaining more types of hairstyles that are different from the hairstyle of the first object and the hairstyle of the second object.

[0088] In some embodiments, the target hairstyle latent vector is obtained by obtaining weight coefficients corresponding to the first hairstyle latent vector and the second hairstyle latent vector respectively, and fusing the first hairstyle latent vector and the second hairstyle latent vector based on the weight coefficients.

[0089] According to another aspect of the present disclosure, a method for training a three-dimensional hairstyle generation model is also provided. The three-dimensional hairstyle generation model includes a feature extraction network and a decoder. Figure 6 As shown, the training method 600 of the three-dimensional hairstyle generation model includes:

[0090] Step S610: obtaining a three-dimensional hair data set, the three-dimensional hair data set including coordinates of each of a plurality of nodes on each of a plurality of hairs, the plurality of hairs being from a hairstyle region of a first head model;

[0091] Step S620: Based on the three-dimensional hair data set, a plurality of training trend graphs corresponding to the first head model and a plurality of viewing angles are obtained, wherein each of the plurality of training trend graphs corresponds to an image of the first head model at a corresponding viewing angle among the plurality of viewing angles, and indicates a direction of a hair line segment corresponding to each pixel in a hairstyle region in the image;

[0092] Step S630: using the feature extraction network to obtain a training hairstyle latent vector corresponding to the three-dimensional hair data set based on the multiple training trend graphs;

[0093] Step S640: using the decoder to obtain a prediction result corresponding to the three-dimensional hair data set based on the training hairstyle latent vector, the prediction result including the coordinates of each of the multiple nodes on each of the multiple hairs; and

[0094] Step S650: adjusting parameters of the three-dimensional hairstyle generation model based on the three-dimensional hair dataset and the prediction result.

[0095] A three-dimensional hair data set is used to train a three-dimensional generation model. During the training process, multiple two-dimensional training direction images are obtained through the three-dimensional hair data set, and the hairstyle latent vector extracted based on the two-dimensional training direction image is decoded to obtain the loss between the prediction result and the three-dimensional hair data set. The three-dimensional hairstyle generation model is adjusted so that the feature extraction network in the trained three-dimensional hairstyle generation model can extract the information of the three-dimensional hairstyle data in the three-dimensional space based on the input two-dimensional trend map, and the information is consistent with the information of the hairstyle area in the space reflected by the three-dimensional hair data set, thereby improving the accuracy of the obtained hairstyle latent vector, so that the accuracy of the obtained hairstyle latent vector is high.

[0096] At the same time, according to the three-dimensional hairstyle generation model disclosed in the present invention, a training trend graph obtained from a three-dimensional hair data set is used for training during the training process, and during the prediction process, a trend graph can be obtained based on a two-dimensional image for prediction, so that during the prediction process, only two-dimensional images (instead of three-dimensional hair data) are used to realize the generation process of the three-dimensional hairstyle, simplifying the generation process of the three-dimensional hairstyle and realizing end-to-end generation from images to three-dimensional hairstyles.

[0097] In some embodiments, the multiple viewing angles include at least four viewing angles of front, back, left and right corresponding to the first head mold.

[0098] The multiple viewing angles include the front, back, left, and right viewing angles corresponding to the first head model, so that the multiple training trend graphs of the first head model obtained include information reflecting all the hairstyle areas of the first head model, so that the training hairstyle latent vectors obtained based on the multiple training trend graphs can reflect all the information of the first head model in the three-dimensional space, so that the obtained training hairstyle latent vectors are accurate. At the same time, the three-dimensional hairstyle generation model is trained using the training trend graphs of the four viewing angles of front, back, left, and right corresponding to the first head model. In the subsequent prediction process using the three-dimensional hairstyle generation model, only the trend graphs of the four viewing angles need to be obtained for prediction, so as to realize the generation of the three-dimensional hairstyle, thereby reducing the amount of data processing in the prediction process.

[0099] like Figure 7 FIG. 1 is a schematic diagram showing a comparison of the training and prediction processes of a three-dimensional hairstyle generation model according to some embodiments of the present disclosure.

[0100] During the training process, a four-view trend map 720 is obtained based on the three-dimensional hair dataset 710, and the four-view trend map 720 is input into the feature extraction network 701 to obtain a training hairstyle latent vector, and the training hairstyle latent vector is decoded by the decoder 702 to obtain a prediction result 730, and the parameters of the feature extraction network 701 and the decoder 702 are adjusted based on the loss between the prediction result 730 and the three-dimensional hair dataset 710.

[0101] During the prediction process, a four-view trend map 750 corresponding to the four-view image is obtained based on the four-view image 740 of the hairstyle area of ​​the person, and the hairstyle latent vector is obtained by inputting the four-view trend map 750 into the feature extraction network 701, and the hairstyle latent vector is decoded by the decoder 702 to obtain the three-dimensional hairstyle 760.

[0102] In the above process, the input of the training process of the 3D hairstyle generation model is a four-view trend map obtained based on the 3D hair data set, and the input of the prediction process of the 3D hairstyle generation model is a four-view trend map obtained based on the two-dimensional image of the four-view. In the prediction process, only two-dimensional images (instead of three-dimensional hair data) are used to realize the generation process of the three-dimensional hairstyle, which simplifies the generation process of the three-dimensional hairstyle and realizes end-to-end generation from images to three-dimensional hairstyles.

[0103] It should be noted that in the four-view image 740 and the three-dimensional hairstyle 760, mosaic processing is performed on the image based on the necessity of description and privacy protection, and this processing is not required in actual application. At the same time, it should be noted that the face image in the embodiment according to the present disclosure is not a face image of a specific user, and cannot reflect the personal information of a specific user, and the face image comes from a public data set.

[0104] In some embodiments, the feature extraction network can be based on a residual network (resnet).

[0105] In some embodiments, step S620, based on the three-dimensional hair data set, obtaining a plurality of training trend graphs corresponding to the first head model and a plurality of viewing angles comprises:

[0106] A rendering operation corresponding to each of the multiple perspectives is performed based on the three-dimensional hair data set to obtain a trend map corresponding to each of the multiple perspectives.

[0107] The trend map is obtained by using a rendering method, so that the obtained trend map is accurate.

[0108] In some embodiments, using the feature extraction network to obtain a training hairstyle latent vector corresponding to the three-dimensional hair data set based on the multiple training trend graphs includes:

[0109] splicing the multiple training trend graphs to obtain a spliced ​​image; and

[0110] The spliced ​​image is input into the feature extraction network to obtain the training hairstyle latent vector.

[0111] By splicing multiple training trend graphs to obtain a spliced ​​image, and performing feature extraction on the spliced ​​image to obtain a hairstyle latent vector, the amount of data processing is reduced compared to separately processing each trend graph to obtain a training hairstyle latent vector.

[0112] In some embodiments, the parameters of the 3D hairstyle generation model are adjusted by calculating the L1 loss between the prediction result and the 3D hair dataset.

[0113] According to another aspect of the present disclosure, a three-dimensional hairstyle generating device is also provided. Figure 8 As shown, it includes: a first image acquisition unit 810, configured to obtain a plurality of first images of a plurality of perspectives about a first object, the first object including a hairstyle region including a plurality of hairs; a first trend map acquisition unit 820, configured to obtain a plurality of first trend maps corresponding to the plurality of first images based on the plurality of first images, each of the plurality of first trend maps indicating the direction of a hair segment corresponding to each pixel in a region corresponding to the hairstyle region of the first object in a corresponding image among the plurality of images; a first hairstyle latent vector acquisition unit 830, configured to obtain a first hairstyle latent vector of the hairstyle region of the first object based on the plurality of first trend maps; and a three-dimensional hairstyle acquisition unit 840, configured to obtain a three-dimensional hairstyle corresponding to the first object based on the first hairstyle latent vector, the three-dimensional hairstyle including hair data corresponding to each of the plurality of hairs, the hair data including the coordinates of each of a plurality of nodes on the hair.

[0114] In some embodiments, the multiple perspectives include at least four perspectives corresponding to the first object: front, back, left, and right.

[0115] In some embodiments, the first hairstyle latent vector acquisition unit includes: an image stitching unit, configured to stitch the multiple first trend maps to obtain a stitched image; and a feature extraction unit, configured to extract features from the stitched image to obtain the first hairstyle latent vector.

[0116] In some embodiments, the feature extraction unit includes: an image input unit, configured to input the spliced ​​image into a trained feature extraction network to obtain the first hairstyle latent vector, wherein the trained feature extraction network is obtained by training a hairstyle generation model composed of a feature extraction network and a decoder using a three-dimensional hair dataset, and in the process of training the hairstyle generation model, a plurality of training trend graphs corresponding to the plurality of perspectives are obtained based on the three-dimensional hair dataset, and a training hairstyle latent vector is obtained by performing feature extraction on the spliced ​​image of the plurality of training trend graphs using the feature extraction network, and a prediction result is obtained by inputting the training hairstyle latent vector into a decoder, and parameters of the hairstyle generation model are adjusted based on a loss between the three-dimensional hair dataset and the prediction result.

[0117] In some embodiments, the three-dimensional hairstyle acquisition unit includes: a modification unit configured to modify the first hairstyle latent vector to obtain a target hairstyle latent vector; and a decoding unit configured to decode the target hairstyle latent vector to obtain the three-dimensional hairstyle.

[0118] In some embodiments, the modification unit includes: a second image acquisition unit, configured to obtain multiple second images of the multiple perspectives about a second object, the second object including a hairstyle area including multiple hair strands; a second trend map acquisition unit, configured to obtain multiple second trend maps corresponding to the multiple second images based on the multiple second images; a second hairstyle latent vector acquisition unit, configured to obtain a second hairstyle latent vector of the hairstyle area of ​​the second object based on the multiple second trend maps; and a modification subunit, configured to modify the first hairstyle latent vector based on the second hairstyle latent vector to obtain a target hairstyle latent vector.

[0119] According to another aspect of the present disclosure, the three-dimensional hairstyle generation model is also provided, including a feature extraction network and a decoder, such as Fig. 9As shown, the apparatus 900 includes: a three-dimensional hair data set acquisition unit 910, configured to acquire a three-dimensional hair data set, wherein the three-dimensional hair data set includes the coordinates of each of a plurality of nodes on each of a plurality of hairs, wherein the plurality of hairs are from a hairstyle region of a first head model; and a training trend graph acquisition unit 920, configured to acquire, based on the three-dimensional hair data set, a plurality of training trend graphs corresponding to a plurality of viewing angles of the first head model, wherein each of the plurality of training trend graphs corresponds to an image of the first head model at a corresponding viewing angle among the plurality of viewing angles, and indicates the coordinates of each pixel in the hairstyle region in the image to which the training trend graph corresponds. a training hairstyle latent vector acquisition unit 930, configured to use the feature extraction network to obtain a training hairstyle latent vector corresponding to the three-dimensional hair data set based on the multiple training trend graphs; a prediction result acquisition unit 940, configured to use the decoder to obtain a prediction result corresponding to the three-dimensional hair data set based on the training hairstyle latent vector, the prediction result including the coordinates of each of the multiple nodes on each of the multiple hairs; and a parameter adjustment unit 950, configured to adjust the parameters of the three-dimensional hairstyle generation model based on the three-dimensional hair data set and the prediction result.

[0120] In some embodiments, the three-dimensional hair data set acquisition unit includes: a rendering unit configured to perform a rendering operation corresponding to each of the multiple perspectives based on the three-dimensional hair data set to obtain a trend map corresponding to each of the multiple perspectives.

[0121] In some embodiments, the training hairstyle latent vector acquisition unit includes: an image stitching unit, configured to stitch the multiple training trend graphs to obtain a stitched image; and a training hairstyle latent vector acquisition subunit, configured to input the stitched image into the feature extraction network to obtain the training hairstyle latent vector.

[0122] In some embodiments, the multiple viewing angles include at least four viewing angles of front, back, left and right corresponding to the first head mold.

[0123] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0124] According to an embodiment of the present disclosure, an electronic device, a readable storage medium and a computer program product are also provided.

[0125] refer to Fig.10, a block diagram of an electronic device 1000 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0126] like Fig.10 As shown, the electronic device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0127] Multiple components in the electronic device 1000 are connected to the I / O interface 1005, including: an input unit 1006, an output unit 1007, a storage unit 1008, and a communication unit 1009. The input unit 1006 can be any type of device that can input information to the electronic device 1000. The input unit 1006 can receive input digital or character information, and generate key signal input related to user settings and / or function control of the electronic device, and can include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output unit 1007 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1008 can include but is not limited to a disk and an optical disk. The communication unit 1009 allows the electronic device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, such as a Bluetooth™ device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device and / or the like.

[0128] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1001 performs the various methods and processes described above, such as method 200 or method 600. For example, in some embodiments, method 200 or method 600 may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of method 200 or method 600 described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to execute the method 200 or the method 600 in any other appropriate manner (eg, by means of firmware).

[0129] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0130] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0131] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0132] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0133] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0134] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0135] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0136] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.

Claims

1. A three-dimensional hairstyle generation method, comprising: Acquire a plurality of first images of a plurality of perspectives about a first object, the first object including a hairstyle region including a plurality of hair strands, wherein the plurality of first images are collected by a camera device around a plane where a head circumference of the first object is located, and wherein the plurality of perspectives include at least four perspectives corresponding to the first object, namely, front, back, left, and right perspectives; Based on the multiple first images, obtaining multiple first trend graphs corresponding to the multiple first images includes: For each first image among the plurality of first images, performing segmentation processing on the hairstyle region on the first image to obtain a mask image corresponding to the hairstyle region in the first image; Determining a pixel gradient in the mask image to obtain a first trend map corresponding to the first image based on the pixel gradient, wherein each of the plurality of first trend maps indicates a direction of a hair line segment corresponding to each pixel in an area corresponding to the hairstyle area of ​​the first object in a corresponding image among the plurality of first images; Based on the multiple first trend graphs, obtaining a first hairstyle latent vector of the hairstyle region of the first object includes: Stacking the multiple first direction maps in a channel direction to splice the multiple first direction maps to obtain a spliced ​​image; Extracting features from the spliced ​​image to obtain the first hairstyle latent vector; and obtaining a three-dimensional hairstyle corresponding to the first object based on the first hairstyle latent vector, the three-dimensional hairstyle including hair data of each of the plurality of hairs, the hair data including coordinates of each of a plurality of nodes on the hair, wherein obtaining the three-dimensional hairstyle corresponding to the first object based on the first hairstyle latent vector includes: Modifying the first hairstyle latent vector to obtain a target hairstyle latent vector includes: obtaining a plurality of second images of the plurality of viewing angles with respect to a second object, the second object comprising a hairstyle region including a plurality of hair strands; Based on the plurality of second images, obtaining a plurality of second trend graphs corresponding to the plurality of second images; Based on the plurality of second trend graphs, obtaining a second hairstyle latent vector of the hairstyle region of the second object; and Modifying the first hairstyle latent vector based on the second hairstyle latent vector to obtain a target hairstyle latent vector; and The target hairstyle latent vector is decoded to obtain the three-dimensional hairstyle.

2. The method according to claim 1, wherein: The extracting features from the spliced ​​image to obtain the first hairstyle latent vector comprises: The spliced ​​image is input into a trained feature extraction network to obtain the first hairstyle latent vector, wherein the trained feature extraction network is obtained by forming a hairstyle generation model with a feature extraction network and a decoder and then training the model using a three-dimensional hair dataset. In the process of training the hairstyle generation model, a plurality of training trend graphs corresponding to the plurality of viewing angles are obtained based on the three-dimensional hair dataset. The training hairstyle latent vector is obtained by performing feature extraction on the spliced ​​image of the plurality of training trend graphs using the feature extraction network. A prediction result is obtained by inputting the training hairstyle latent vector into a decoder, and parameters of the hairstyle generation model are adjusted based on a loss between the three-dimensional hair dataset and the prediction result.

3. A training method for a three-dimensional hairstyle generation model, the three-dimensional hairstyle generation model comprising a feature extraction network and a decoder, the method comprising: Obtaining a three-dimensional hair data set, the three-dimensional hair data set comprising coordinates of each of a plurality of nodes on each of a plurality of hairs, the plurality of hairs being from a hairstyle region of a first head model; Based on the three-dimensional hair data set, a plurality of training trend graphs corresponding to the first head model and a plurality of viewing angles are obtained, including: For an image of the first head model at each of the multiple viewing angles, segmenting the image for a hairstyle region to obtain a mask image corresponding to the hairstyle region in the image, wherein the images at the multiple viewing angles are collected by a camera device around a plane where the head circumference of the first head model is located, and wherein the multiple viewing angles include at least four viewing angles of front, back, left and right corresponding to the first head model; Determining a pixel gradient in the mask image to obtain a first trend map corresponding to the image based on the pixel gradient, wherein each of the plurality of training trend maps corresponds to an image of the first head model at a corresponding viewing angle among the plurality of viewing angles, and indicates a direction of a hair line segment corresponding to each pixel in a hairstyle region in the image; Utilizing the feature extraction network to obtain a training hairstyle latent vector corresponding to the three-dimensional hair data set based on the multiple training trend graphs includes: Stacking the multiple training trend maps in a channel direction to splice the multiple training trend maps to obtain a spliced ​​image; Inputting the spliced ​​image into the feature extraction network to obtain the training hairstyle latent vector; Using the decoder, based on the training hairstyle latent vector, obtaining a prediction result corresponding to the three-dimensional hair data set, the prediction result including the coordinates of each of the plurality of nodes on each of the plurality of hairs; and Based on the three-dimensional hair dataset and the prediction result, parameters of the three-dimensional hairstyle generation model are adjusted.

4. The method according to claim 3, wherein: The obtaining, based on the three-dimensional hair data set, a plurality of training trend graphs corresponding to the first head model and a plurality of viewing angles comprises: A rendering operation corresponding to each of the multiple perspectives is performed based on the three-dimensional hair data set to obtain a trend map corresponding to each of the multiple perspectives.

5. A three-dimensional hairstyle generating device, comprising: a first image acquisition unit, configured to acquire a plurality of first images of a plurality of viewing angles of a first object, wherein the first object includes a hairstyle region including a plurality of hair strands, wherein the plurality of first images are acquired by a camera device around a plane where a head circumference of the first object is located, and wherein the plurality of viewing angles at least include four viewing angles of front, back, left, and right corresponding to the first object; A first trend map acquisition unit is configured to obtain, based on the plurality of first images, a plurality of first trend maps corresponding to the plurality of first images, each of the plurality of first trend maps indicating a direction of a hairline segment corresponding to each pixel in an area corresponding to the hairstyle area of ​​the first object in a corresponding image in the plurality of first images, wherein the first trend map acquisition unit is further configured to: For each first image among the plurality of first images, performing segmentation processing on the hairstyle region on the first image to obtain a mask image corresponding to the hairstyle region in the first image; Determine a pixel gradient in the mask image to obtain a first trend map corresponding to the first image based on the pixel gradient; A first hairstyle latent vector acquisition unit is configured to obtain a first hairstyle latent vector of a hairstyle region of the first object based on the multiple first trend graphs, wherein the first hairstyle latent vector acquisition unit includes: An image stitching unit, configured to stack the multiple first direction maps in a channel direction to stitch the multiple first direction maps to obtain a stitched image; a feature extraction unit, configured to perform feature extraction on the spliced ​​image to obtain the first hairstyle latent vector; and a three-dimensional hairstyle acquisition unit, configured to obtain a three-dimensional hairstyle corresponding to the first object based on the first hairstyle latent vector, the three-dimensional hairstyle including hair data of each of the plurality of hairs, the hair data including coordinates of each of the plurality of nodes on the hair, wherein the three-dimensional hairstyle acquisition unit includes: A modification unit is configured to modify the first hairstyle latent vector to obtain a target hairstyle latent vector, wherein the modification unit includes: A second image acquisition unit configured to obtain a plurality of second images of the plurality of viewing angles with respect to a second object, the second object comprising a hairstyle region including a plurality of hair strands; A second trend map acquisition unit, configured to obtain a plurality of second trend maps corresponding to the plurality of second images based on the plurality of second images; A second hairstyle latent vector acquiring unit is configured to acquire a second hairstyle latent vector of a hairstyle region of the second object based on the plurality of second trend graphs; and a modification subunit, configured to modify the first hairstyle latent vector based on the second hairstyle latent vector to obtain a target hairstyle latent vector; and A decoding unit is configured to decode the target hairstyle latent vector to obtain the three-dimensional hairstyle.

6. The device according to claim 5, wherein: The feature extraction unit comprises: An image input unit is configured to input the spliced ​​image into a trained feature extraction network to obtain the first hairstyle latent vector, wherein the trained feature extraction network is obtained by forming a hairstyle generation model with a feature extraction network and a decoder and then training it with a three-dimensional hair data set. In the process of training the hairstyle generation model, a plurality of training trend graphs corresponding to the plurality of perspectives are obtained based on the three-dimensional hair data set, and a training hairstyle latent vector is obtained by extracting features from the spliced ​​image of the plurality of training trend graphs using the feature extraction network, and a prediction result is obtained by inputting the training hairstyle latent vector into a decoder, and parameters of the hairstyle generation model are adjusted based on a loss between the three-dimensional hair data set and the prediction result.

7. A training device for a three-dimensional hairstyle generation model, wherein: The three-dimensional hairstyle generation model includes a feature extraction network and a decoder, and the device includes: a three-dimensional hair data set acquisition unit configured to obtain a three-dimensional hair data set, the three-dimensional hair data set comprising coordinates of each of a plurality of nodes on each of a plurality of hairs, the plurality of hairs being from a hairstyle region of a first head model; A training trend map acquisition unit is configured to obtain a plurality of training trend maps corresponding to the first head model and a plurality of viewing angles based on the three-dimensional hair data set, wherein each of the plurality of training trend maps corresponds to an image of the first head model at a corresponding viewing angle among the plurality of viewing angles, and indicates a direction of a hair line segment corresponding to each pixel in a hairstyle area in the image, wherein the training trend map acquisition unit is further configured as follows: For an image of the first head model at each of the multiple viewing angles, segmenting the image for a hairstyle region to obtain a mask image corresponding to the hairstyle region in the image, wherein the images at the multiple viewing angles are collected by a camera device around a plane where the head circumference of the first head model is located, and wherein the multiple viewing angles include at least four viewing angles of front, back, left and right corresponding to the first head model; Determine a pixel gradient in the mask image to obtain a first trend map corresponding to the image based on the pixel gradient; A training hairstyle latent vector acquisition unit is configured to use the feature extraction network to obtain a training hairstyle latent vector corresponding to the three-dimensional hair data set based on the multiple training trend graphs, wherein the training hairstyle latent vector acquisition unit includes: an image stitching unit, configured to stack the multiple training trend maps in a channel direction to stitch the multiple training trend maps to obtain a stitched image; and A training hairstyle latent vector acquisition subunit is configured to input the spliced ​​image into the feature extraction network to obtain the training hairstyle latent vector; a prediction result acquisition unit configured to obtain, using the decoder and based on the training hairstyle latent vector, a prediction result corresponding to the three-dimensional hair data set, the prediction result including the coordinates of each of the plurality of nodes on each of the plurality of hairs; and A parameter adjustment unit is configured to adjust the parameters of the three-dimensional hairstyle generation model based on the three-dimensional hair data set and the prediction result.

8. The device according to claim 7, wherein: The three-dimensional hair data set acquisition unit comprises: A rendering unit is configured to perform a rendering operation corresponding to each of the multiple perspectives based on the three-dimensional hair data set to obtain a trend map corresponding to each of the multiple perspectives.

9. An electronic device, comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 4.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-4.

11. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Vivid static-state hair modeling method based on multiple direction fields

    CN105405163A

  • Deep learning network training method, virtual image generation method and device

    CN115311403A

  • Three-dimensional hair style generation method and device, electronic equipment and storage medium

    CN115409922A