A method and system for generating three-dimensional hair styles of virtual humans

By generating multi-view images and constructing a three-dimensional directional occupancy field, the problem of high labor costs and deep learning noise in the generation of virtual human three-dimensional hair styles is solved, and automatic generation and high-precision hair models are achieved.

CN118521699BActive Publication Date: 2024-10-29HITHINK ROYALFLUSH INFORMATION NETWORK CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410992818.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-10-29
Estimated Expiration
2044-07-23

AI Technical Summary

Technical Problem

When the existing technology generates a virtual human's three-dimensional hair style, the manual production cost is high, and the deep learning technology has a lot of noise and low accuracy. There are obvious flaws in the parts (especially the back) generated from single-view photos.

Method used

By obtaining a single-view virtual human avatar, determining the internal and external parameters of the shooting camera, generating multi-view images, performing hair segmentation processing, constructing a target three-dimensional directional occupancy field, randomly sampling hair initial points in the scene, and iteratively predicting hair growth paths. Generate hair hairstyles for virtual human avatars.

Benefits of technology

It achieves fully automated generation from single-view photos to three-dimensional hair styles, saving labor costs and time, making full use of image information, and reducing defects caused by insufficient information in single-view photos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118521699B_ABST
    Figure CN118521699B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method and system for generating a three-dimensional hair hairstyle of a virtual person, the method comprising: obtaining an image to be processed, wherein the image to be processed includes a single-view virtual person avatar; determining internal and external parameters of a camera shooting the virtual person avatar, and generating a multi-view image of the virtual person avatar according to the image to be processed and the internal and external parameters of the camera shooting; performing hair segmentation processing on the multi-view image to obtain a multi-view hair segmentation image; generating a target three-dimensional directional occupancy field of the hair of the virtual person avatar according to the multi-view hair segmentation image; deforming and attaching the target three-dimensional directional occupancy field to a scalp grid to obtain a deformed target three-dimensional directional occupancy field; randomly sampling a plurality of hair initial points in the target three-dimensional directional occupancy field, obtaining a tangent direction according to the plurality of hair initial points, and iteratively predicting all other hair points to generate a hair hairstyle of the virtual person avatar.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to a method and system for generating a three-dimensional hair style of a virtual person. Background Art

[0002] With the rapid development of computer vision and graphics technology, algorithms related to virtual human generation have been gradually applied to various fields, such as film and television, video conferencing, intelligent customer service, virtual anchors, etc. As one of the applications, inputting a single-view face photo to generate a three-dimensional hairstyle with hair strands still faces many severe technical challenges.

[0003] At present, there are usually two methods to generate a three-dimensional hairstyle model of the hair version. One method is to manually create a three-dimensional hairstyle model through 3D modeling software, but it often takes a lot of manpower to make a high-quality hairstyle that is very similar to the input single-view photo. The other method is to use deep learning technology to extract hair information from single-view photos. In the process of using filters to extract the growth direction of hair in the photo, there are problems such as high noise and low precision; and the hair hairstyle is generated only through single-view photos. Due to the problem of insufficient hair information, the invisible parts (especially the back) will have obvious defects. Summary of the invention

[0004] The present disclosure provides a method and system for generating a three-dimensional hair style of a virtual person, so as to at least solve the above technical problems existing in the prior art.

[0005] According to a first aspect of the present disclosure, a method for generating a three-dimensional hair style of a virtual person is provided, wherein the method comprises:

[0006] Acquire an image to be processed, wherein the image to be processed includes a single-view virtual human portrait;

[0007] Determining internal and external parameters of a camera used to shoot the virtual human avatar, and generating a multi-view image of the virtual human avatar according to the image to be processed and the internal and external parameters of the camera used to shoot the virtual human avatar;

[0008] Performing hair segmentation processing on the multi-view image to obtain a multi-view hair segmentation image;

[0009] Generating a target three-dimensional directional occupancy field of the hair of the avatar according to the multi-view hair segmentation image;

[0010] Deforming and attaching the target three-dimensional directional occupancy field to the scalp mesh to obtain a deformed target three-dimensional directional occupancy field;

[0011] A plurality of hair initial points are randomly sampled in the target three-dimensional direction occupied field, and all other hair points are iteratively predicted in the tangent direction according to the plurality of hair initial points to generate the hair style of the virtual human avatar.

[0012] In one possible implementation, determining the internal and external parameters of the camera used to shoot the avatar and generating a multi-view image of the avatar according to the image to be processed and the internal and external parameters of the camera used to shoot the avatar includes:

[0013] Using a camera parameter fitting algorithm, extracting internal and external parameters of the camera used to shoot the virtual human avatar from the image to be processed;

[0014] Performing Gaussian distribution random sampling on the image to be processed to obtain a first latent code;

[0015] Inputting the internal and external parameters of the shooting camera and the first potential code into a generative adversarial network model to generate a target rendered image;

[0016] Calculating a first loss value between the target rendered image and a real image corresponding to the image to be processed, and optimizing the first latent code according to the first loss value to obtain a second latent code;

[0017] The second latent code and the internal and external parameters of the shooting camera of the target perspective are input into the generative adversarial network model, and the target perspective image is generated by neural rendering; the target perspective images corresponding to all target perspectives are obtained to obtain the multi-perspective image of the virtual human avatar.

[0018] In one possible implementation, obtaining the generative adversarial network model includes:

[0019] Acquire a sample data set, wherein the sample data set includes sample images of multi-view faces;

[0020] Constructing the generative adversarial network model, wherein the generative adversarial network model includes a generator, a discriminator, a neural renderer and a mapping network;

[0021] Performing Gaussian distribution random sampling on the sample image to obtain a first sample potential code;

[0022] Inputting the sample shooting camera internal and external parameters of the sample image and the first sample potential code into the mapping network to obtain a second sample potential code;

[0023] Inputting the second sample potential code into the generator to obtain a generated image;

[0024] Inputting the generated image and rendering camera parameters into the neural renderer to obtain a sample rendered image;

[0025] Using the discriminator to determine a second loss value between the generated image and a real image corresponding to the sample image, and calculating a third loss value of the generator;

[0026] According to the second loss value and the third loss value, the parameters of the generator and the discriminator are iteratively optimized until the model converges to obtain a generative adversarial network model.

[0027] In one possible implementation, obtaining the internal and external parameters of a sample shooting camera of the sample image includes:

[0028] Perform face detection on each sample image in the sample data set to obtain the corresponding face area;

[0029] scaling the face regions in all sample images in which faces are detected to a target size, and performing a two-stage alignment process on the face regions of the sample images;

[0030] After aligning the face region, a camera parameter fitting algorithm is used to estimate the posture of the face region in the sample image to obtain the internal and external parameters of the sample shooting camera.

[0031] In one possible implementation, performing hair segmentation processing on the multi-view image to obtain a multi-view hair segmentation image includes:

[0032] The hair region of the virtual human avatar in the multi-view image is segmented by using an image segmentation network to obtain the multi-view hair segmentation image.

[0033] In one possible implementation, generating a target three-dimensional directional occupancy field of the hair of the avatar according to the multi-view hair segmentation image includes:

[0034] Use ray tracing technology to render the hair model to obtain multi-view hair segmentation data;

[0035] The hair model is converted into an initial three-dimensional directional occupancy field, and a three-dimensional directional occupancy field neural network is trained using the multi-view hair segmentation data and the initial three-dimensional directional occupancy field;

[0036] Inputting the multi-view hair segmentation image into a trained three-dimensional directional occupancy field neural network to obtain the target three-dimensional directional occupancy field;

[0037] The target three-dimensional directional occupancy field is composed of voxels divided by a grid from each point of the hair model, and each voxel occupied by a hair contains tangent direction vector information of each point on the hair.

[0038] In one possible implementation, deforming and attaching the target three-dimensional directional occupancy field to the scalp mesh to obtain the deformed target three-dimensional directional occupancy field includes:

[0039] Converting all voxels occupied by hair in the target three-dimensional directional occupancy field into an initial hair patch mesh;

[0040] Initially align the initial hair patch mesh with the scalp mesh in the hair model through the transformation matrix;

[0041] Constructing a KD tree on the vertices of the scalp mesh, and using the KD tree to match the nearest target vertex for each vertex of the scalp mesh on the initial hair patch mesh;

[0042] Using a patch deformation algorithm, the target vertex is used as a deformable vertex and deformed toward the vertex of the scalp mesh;

[0043] Fix all vertices except the target vertex in the initial hair patch mesh to obtain the target hair patch mesh;

[0044] According to the target hair patch mesh, the deformed target three-dimensional directional occupancy field is obtained.

[0045] In one possible implementation, the randomly sampling a plurality of hair initial points in the target three-dimensional direction occupied field, obtaining the tangent direction according to the plurality of hair initial points and iteratively predicting all other hair points to generate the hair style of the virtual human avatar includes:

[0046] Randomly sampling a plurality of hair initial points in the voxels occupied by the hair in the target three-dimensional occupancy field;

[0047] Performing B-spline sampling on the hair strands so that the spacing between adjacent points on each hair strand is within a preset length range;

[0048] Dividing the target three-dimensional occupancy field into a plurality of voxel blocks, each voxel block includes a plurality of voxels, and there are overlapping voxel regions between adjacent voxel blocks;

[0049] According to a plurality of voxel blocks covering the initial point of the hair, a hair growth path is predicted using a hair growth neural network to generate a hair hairstyle of the virtual human avatar.

[0050] In one possible implementation, the method of predicting the hair growth path using a hair growth neural network based on a plurality of voxel blocks covering the initial point of the hair to generate the hair style of the avatar includes:

[0051] Determine a plurality of voxel blocks covering the initial point of the hair, and extract direction field information of the voxel blocks using a hair growth neural network;

[0052] Predicting the next target point of the hair initial point according to the voxel block and the direction field information;

[0053] The target point is used as a new hair initial point, and the hair growth neural network is used to continue predicting the next target point until a hair that meets a preset length is generated.

[0054] According to a second aspect of the present disclosure, a system for generating a three-dimensional hair style of a virtual person is provided, wherein the system comprises:

[0055] An acquisition module, used for acquiring an image to be processed, wherein the image to be processed includes a single-view virtual human portrait;

[0056] An image generation module, used to determine the internal and external parameters of the camera used to shoot the virtual human avatar, and to generate a multi-view image of the virtual human avatar based on the image to be processed and the internal and external parameters of the camera used to shoot the virtual human avatar;

[0057] An image generation module, used for performing hair segmentation processing on the multi-view image to obtain a multi-view hair segmentation image;

[0058] A three-dimensional directional occupancy field generation module, used to generate a target three-dimensional directional occupancy field of the hair of the virtual human avatar according to the multi-view hair segmentation image;

[0059] The three-dimensional directional occupancy field generation module is further used to deform the target three-dimensional directional occupancy field and attach it to the scalp mesh to obtain a deformed target three-dimensional directional occupancy field;

[0060] The hair growth module is used to randomly sample multiple hair initial points in the target three-dimensional direction occupation field, obtain the tangent direction according to the multiple hair initial points, iteratively predict all other hair points, and generate the hair style of the virtual human avatar.

[0061] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0062] at least one processor; and

[0063] a memory communicatively connected to the at least one processor; wherein,

[0064] 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 described in the present disclosure.

[0065] According to a fourth 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 described in the present disclosure.

[0066] The method for generating a virtual person's three-dimensional hair hairstyle disclosed in the present invention obtains a to-be-processed image of a single-view virtual person's head portrait, determines the internal and external parameters of the shooting camera of the virtual person's head portrait, and obtains a multi-view image of the virtual person's head portrait and further obtains a multi-view hair segmentation image according to the to-be-processed image and the internal and external parameters of the shooting camera; generates a target three-dimensional directional occupancy field of the virtual person's head portrait according to the multi-view hair segmentation image; deforms and attaches the target three-dimensional directional occupancy field to the scalp grid to obtain the deformed target three-dimensional directional occupancy field; randomly samples multiple hair initial points in the target three-dimensional directional occupancy field, obtains the tangent direction according to the multiple hair initial points, and iteratively predicts all other points of the hair to generate the hair hairstyle of the virtual person's head portrait. Compared with the traditional manual 3D modeling method, the scheme disclosed in the present invention realizes the fully automated generation of three-dimensional hair hairstyles from single-view photos, which greatly saves labor costs and time. In addition, the multi-view images of the single-view virtual person's head portrait are generated, and the construction of the three-dimensional directional occupancy field makes full use of the hair information in the input image and reduces the defects caused by insufficient information in the single-view photo.

[0067] 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

[0068] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:

[0069] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.

[0070] Figure 1 A schematic diagram of the implementation process of the method for generating a three-dimensional hair style of a virtual person according to an embodiment of the present disclosure is shown;

[0071] Figure 2 A schematic diagram of a system for generating a three-dimensional hair style of a virtual person according to an embodiment of the present disclosure is shown;

[0072] Figure 3 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0073] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0074] The present invention provides a method for generating a three-dimensional hair style of a virtual person, such as Figure 1 As shown, the method includes:

[0075] Step 101: Acquire an image to be processed, wherein the image to be processed includes a single-view virtual human portrait.

[0076] In this example, the image to be processed is a single-view, relatively frontal image of a virtual human head as input. The image to be processed should contain sufficient information to identify and reconstruct a 3D hair model.

[0077] Step 102: Determine the internal and external parameters of the camera used to shoot the virtual human avatar, and generate a multi-view image of the virtual human avatar based on the image to be processed and the internal and external parameters of the camera used to shoot the virtual human avatar.

[0078] In this example, the avatar in the image to be processed is analyzed, and its head posture is estimated to determine the internal and external parameters of the camera that shoots the avatar in the image to be processed. The internal and external parameters of the camera refer to the position and direction information of the camera that shoots the avatar in three-dimensional space.

[0079] Based on the input of the internal and external parameters of the camera used to shoot the image to be processed and the avatar, deep learning technology is used to simulate the lighting, shadows and perspective changes in the real world to generate multi-perspective images of the avatar. The multi-perspective images are images of the avatar from multiple perspectives, such as the front, side, and back.

[0080] Step 103: Perform hair segmentation processing on the multi-view image to obtain a multi-view hair segmentation image.

[0081] In this example, hair segmentation processing is performed on the avatar in the multi-view image according to the texture and color features of the avatar's hair, so as to obtain a hair segmentation image at each view, namely, a multi-view hair segmentation image.

[0082] Step 104: Generate a target three-dimensional directional occupancy field of the virtual human avatar's hair based on the multi-view hair segmentation images.

[0083] In this example, the 3D Orientation Occupancy Field (3D OOF) is a voxel field in a 3D space that records the hair occupancy and growth direction of the hair at each point in the 3D space.

[0084] Specifically, the multi-view hair segmentation images are fused and mapped in three-dimensional space to form a comprehensive three-dimensional image. In the fused three-dimensional space, a voxel grid (or voxel field) is divided to represent the hair area of ​​the virtual person. Each voxel represents a small cube in the three-dimensional space and stores information about the occupancy of the hair and the growth direction of the hair.

[0085] Step 105: deform the target three-dimensional directional occupancy field and attach it to the scalp mesh to obtain a deformed target three-dimensional directional occupancy field.

[0086] In this example, since there may be a situation where the hair patch formed by the target three-dimensional directional occupancy field does not match the scalp mesh in the hair model, after generating the target three-dimensional directional occupancy field, the target three-dimensional directional occupancy field is deformed so that it can match the scalp mesh, and the deformed target three-dimensional directional occupancy field is further obtained.

[0087] Step 106: randomly sampling multiple hair initial points in the target three-dimensional direction occupation field, obtaining the tangent direction according to the multiple hair initial points, iteratively predicting all other hair points, and generating the hair style of the virtual human avatar.

[0088] In this example, for the voxels occupied by hair in the target three-dimensional occupancy field, it is necessary to estimate the growth direction of the hair of the virtual human avatar, that is, the hair growth path. Before this, it is necessary to randomly sample multiple hair initial points from the target three-dimensional occupancy field, and the number of hair initial points is greater than the number of occupied voxels in the three-dimensional occupancy field. According to the multiple hair initial points, the tangent direction is obtained to iteratively predict all other points of the hair, and the growth path of the hair starting from the hair initial point is obtained.

[0089] The data information of the hair growth path is obtained, including the hair starting point, hair end point, key points and direction control points (tangent direction) on each hair growth path. According to the data information obtained by the analysis, a slender geometric body (such as a cylinder or a curve) is drawn on the model avatar in the three-dimensional space, and arranged and bent along the hair growth path to generate the hair hairstyle of the virtual human avatar.

[0090] In addition, to increase the realism of the hair, materials and shading effects are added to these geometries to simulate the glossiness, color gradient, reflection and refraction of real hair.

[0091] The present invention provides a method for generating a three-dimensional hair hairstyle of a virtual person, which includes obtaining a to-be-processed image of a single-view virtual person avatar, determining the internal and external parameters of a shooting camera of the virtual person avatar, and obtaining a multi-view image of the virtual person avatar and further obtaining a multi-view hair segmentation image according to the to-be-processed image and the internal and external parameters of the shooting camera; generating a target three-dimensional directional occupancy field of the virtual person avatar according to the multi-view hair segmentation image; deforming and attaching the target three-dimensional directional occupancy field to the scalp grid to obtain a deformed target three-dimensional directional occupancy field; randomly sampling multiple hair initial points in the target three-dimensional directional occupancy field, obtaining a tangent direction according to the multiple hair initial points, and iteratively predicting all other points of the hair to generate the hair hairstyle of the virtual person avatar. Compared with the traditional manual 3D modeling method, the scheme disclosed in the present invention realizes the fully automated generation of three-dimensional hair hairstyles from single-view photos, which greatly saves labor costs and time. In addition, the multi-view images of the single-view virtual person avatar are generated, and the construction of the three-dimensional directional occupancy field makes full use of the hair information in the input image and reduces the defects caused by insufficient information in the single-view photo.

[0092] In one example, determining the internal and external parameters of a camera for shooting a virtual human avatar, and generating a multi-view image of the virtual human avatar according to an image to be processed and the internal and external parameters of the camera for shooting, includes:

[0093] Step 201: using a camera parameter fitting algorithm to extract the internal and external parameters of the camera used to shoot the virtual human avatar from the image to be processed.

[0094] In this example, a camera parameter fitting algorithm is used to extract the internal and external parameters of the shooting camera from the image to be processed as a camera parameter matrix, including matrix parameters composed of position, rotation, and scaling, and a camera intrinsic parameter matrix that can project points in the camera space to the image space. In a specific example, the internal and external parameters of the shooting camera in this example are a camera parameter matrix of size 1×25, of which the first 16 are 4×4 matrix parameters and the last 9 are 3×3 camera intrinsic parameter matrices.

[0095] Step 202: Perform Gaussian distribution random sampling on the image to be processed to obtain a first latent code.

[0096] In this example, a variational autoencoder is used to map the image to be processed into a latent space, and a random sample is taken from the Gaussian distribution of the latent space to obtain a first latent code corresponding to the image to be processed.

[0097] Step 203: Input the internal and external parameters of the shooting camera and the first latent code into a generative adversarial network model to generate a target rendered image.

[0098] In this example, the generative adversarial network model includes a generator, a discriminator, a neural renderer, and a mapping network. Before inputting the internal and external parameters of the shooting camera and the first latent code, the weight parameters of the generator, discriminator, neural renderer, and mapping network are fixed to prevent unexpected updates during the image generation process, thereby ensuring the consistency of the quality of the generated image. The internal and external parameters of the shooting camera and the first latent code are input into the generative adversarial network model, and forward propagation is performed according to the structure and weights of the network model (that is, at each layer, the output of the current layer is calculated based on the output of the previous layer and the weight of the current layer until the output layer is reached). At the output layer of the generator, the target rendered image of the image to be processed is obtained.

[0099] Step 204: Calculate a first loss value between the target rendered image and the real image corresponding to the image to be processed, and optimize the first latent code according to the first loss value to obtain a second latent code.

[0100] In this example, the target rendered image and the real image to be processed are respectively input into the pre-trained VGG16 network. The VGG16 network is a convolutional neural network trained on large image datasets (such as ImageNet) to extract face-perceived features in the target rendered image and the real image.

[0101] The Euclidean distance (L2Loss) between the face perception features in the target rendered image and the real image is calculated to obtain the first loss value. L2 Loss measures the degree of difference between the two face perception features. A lower L2 Loss means that the two feature vectors are more similar, so that the generated target rendered image is perceptually closer to the real photo.

[0102] Using L2 Loss as the loss function, the back propagation algorithm is used to optimize the first latent code received by the generator. The value of the first latent code is updated by an optimization algorithm such as gradient descent to minimize L2 Loss. After multiple iterations of optimization, the first latent code corresponding to the minimum value of the first loss value is used as the second latent code.

[0103] Step 205: Input the second latent code and the internal and external parameters of the camera shooting the target perspective into the generative adversarial network model, and generate the target perspective image through neural rendering; obtain the target perspective images corresponding to all target perspectives to obtain the multi-perspective images of the virtual human avatar.

[0104] In this example, the optimized second latent code and the internal and external parameters of the camera shooting at the target perspective are input into the generator of the generative adversarial network. Through forward propagation, the generator outputs a rendered image at the target perspective. For each internal and external parameters of the camera shooting at the target perspective, step 205 is repeated to generate target perspective images corresponding to multiple target perspectives, and these target perspective images together constitute the multi-perspective image of the virtual human avatar.

[0105] In one example, obtaining a generative adversarial network model includes:

[0106] Step 301: Acquire a sample data set, where the sample data set includes sample images of multi-view faces.

[0107] In this example, a sample dataset containing facial images from multiple perspectives is collected. These sample images should cover faces from different angles, lighting conditions, expressions, and identities to ensure that the trained model has generalization capabilities.

[0108] Step 302: Construct a generative adversarial network model, which includes a generator, a discriminator, a neural renderer, and a mapping network.

[0109] In this example, the constructed generative adversarial network model includes four main components: generator, discriminator, neural renderer, and mapping network. The latent code and the internal and external parameters of the shooting camera are input into the generative adversarial network model, and the rendered image is obtained after being processed by the four components.

[0110] Step 303: Perform Gaussian random sampling on the sample image to obtain a first sample latent code.

[0111] In this example, the method for obtaining the first latent code in step 202 is the same as that for obtaining the first latent code in step 202 above, in which Gaussian distribution random sampling is performed on the sample image to obtain the first sample latent code.

[0112] Step 304: Input the sample shooting camera internal and external parameters of the sample image and the first sample potential code into the mapping network to obtain a second sample potential code.

[0113] In this example, the sample camera intrinsic and extrinsic parameters (such as position, rotation, scale, etc.) and the first sample latent code of each sample image are input into the mapping network. The role of the mapping network is to map these inputs to an intermediate code (second sample latent code) that is more suitable for the generator to use, so that the generator can generate a generated image corresponding to the input camera intrinsic and extrinsic parameters.

[0114] Step 305: Input the second sample potential code into the generator to obtain a generated image.

[0115] In this example, the second sample potential code output by the mapping network is input into the generator, so that the generator generates the corresponding 3D mesh feature using the second sample potential code, that is, generates an image. The 3D mesh feature describes the geometric shape and appearance information of the face in the sample image.

[0116] Step 306: Input the generated image and rendering camera parameters into the neural renderer to obtain a sample rendered image.

[0117] In this example, the generated image and rendering camera parameters are input into the neural renderer. The rendering camera parameters are preset internal and external parameters of the shooting camera. Compared with the internal and external parameters of the shooting camera obtained from the image, the internal and external parameters of the rendering camera can be better rendered and obtain a sample rendered image with better rendering effect. The neural renderer uses the generated image and the internal and external parameters of the rendering camera to synthesize a realistic sample rendered image through a neural network structure such as a multilayer perceptron (MLP).

[0118] Step 307: Use the discriminator to determine the second loss value between the generated image and the real image corresponding to the sample image, and calculate the third loss value of the generator.

[0119] In this example, based on the real image corresponding to the sample image, the discriminator discriminates the generated image and outputs a probability value indicating the authenticity of the image. Then, based on this probability value and the real image label, the loss value of the discriminator (the second loss value) is calculated. At the same time, the loss value of the generator (the third loss value) is calculated. This loss value usually includes two parts: one is the judgment result of the discriminator on the generated image, and the other is the deviation of the internal and external parameters of the sample shooting camera.

[0120] Step 308: According to the second loss value and the third loss value, the parameters of the generator and the discriminator are iteratively optimized until the model converges to obtain a generative adversarial network model.

[0121] In this example, the back propagation algorithm is used to update the parameters of the discriminator and generator according to their loss values. Through continuous iteration, the model converges, that is, the loss value no longer decreases significantly, and the generative adversarial network model is obtained.

[0122] In one example, the process of obtaining internal and external parameters of a sample shooting camera of a sample image includes:

[0123] Step 401: Perform face detection on each sample image in the sample data set to obtain a corresponding face region.

[0124] In this example, face detection is performed on each sample image in the sample data set to identify the face area from each sample image in the sample data set. Specifically, face detection is implemented by using a face detection algorithm, such as InsightFace. InsightFace is an efficient and accurate face recognition algorithm that can quickly locate the face position in an image and give a bounding box of the face, that is, the approximate position and size of the face in the image.

[0125] Headquarter 402: scaling the face regions in all sample images in which faces are detected to a target size, and performing a two-stage alignment process on the face regions of the sample images.

[0126] In this example, after detecting a face from a sample image and obtaining its bounding box, the face area needs to be scaled to a uniform target size. This is to ensure that the input data for subsequent processing (such as pose estimation) is consistent and avoid errors caused by different face sizes.

[0127] Perform a two-stage alignment process on sample images of uniform size. The two-stage alignment process includes:

[0128] The first stage is rough alignment: Use a facial pose estimator (such as 3DDFA) and / or a head pose estimator (such as WHENet) to perform preliminary alignment of the face region. For sample images with detectable facial landmarks, 3DDFA can estimate the 3D shape and pose of the face region through these landmarks, thereby achieving alignment of the head center. For sample images with large angle poses, WHENet can provide a rough camera pose estimate, while combining human detectors such as YOLO to locate the center of the head and adjust the bounding box to match the head size. By combining these methods, consistent alignment of sample images can be achieved to a large extent.

[0129] Second-stage adaptive alignment: Since factors such as hairstyle and head pose may cause incomplete accuracy of the first-stage alignment, the second-stage adaptive alignment is required. This stage is usually implemented using 3D-aware GAN (generative adversarial network). GAN can synthesize head images with specific camera poses by learning the mapping relationship between images and latent codes. However, since the specific camera pose may not be completely aligned with the actual image content, a mapping network needs to be introduced to learn the mapping from <latent code, specific camera pose> to camera parameter deviation to compensate for the error of the specific camera pose. Among them, the size of the camera parameter deviation is normalized by the L2 norm. Through adversarial training, the mapping network can dynamically adjust the camera pose to achieve more accurate adaptive alignment.

[0130] Step 403: After aligning the face region, a camera parameter fitting algorithm is used to estimate the posture of the face region in the sample image to obtain the internal and external parameters of the sample shooting camera.

[0131] In this example, after the face has been subjected to a two-stage alignment process, a camera parameter fitting algorithm is used to estimate the face's pose. The purpose of pose estimation is to obtain the internal and external parameters of the sample camera shooting the face, which usually include pitch angle, yaw angle and roll angle, as well as possible camera position (translation) and orientation (rotation) information. In the present disclosure, the internal and external parameters of the sample camera shooting are the same as those of the camera shooting the image to be processed, including matrix parameters composed of position, rotation, and scaling, as well as the camera intrinsic parameter matrix that can project points in the camera space to the image space.

[0132] In one example, using a discriminator to determine a second loss value between a sample rendered image and a real image corresponding to the sample image, and calculating a third loss value of a generator, includes:

[0133] In this example, when training the generative adversarial network model, for each sample image in the sample dataset, the corresponding latent code and specific camera pose are obtained and input into the generative adversarial network model.

[0134] The third loss value of the generator is calculated using the following formula: :

[0135]

[0136] in, is the internal and external parameter deviation of the sample camera; z is the potential code of the sample image; The generated image output by the generator; is the authenticity judgment result of the discriminator on the generated image, which is achieved by minimizing the difference between the generated image and the real image. Close to 1; is the Gaussian distribution of the latent code; is the expectation of the discriminator to judge the authenticity of the generated image. The more realistic the generated image is, the smaller the expectation is. R is the regularization term of the neural renderer, which can prevent overfitting.

[0137] The second loss value of the discriminator is calculated using the following formula: :

[0138]

[0139] Among them, x is the real image corresponding to the sample image; is the discriminator's discrimination result for the real image, and the output is close to 1; is the Gaussian distribution of the real image; is the expectation of the discriminator to judge the authenticity of the real image.

[0140] This loss function can optimize the discriminator so that after receiving the generated image of the generator, the discriminator outputs a discrimination result as close to 0 as possible, and after receiving the real image, the discriminator outputs a discrimination result close to 1, thereby maximizing the discriminator's ability to identify authenticity.

[0141] In one example, hair segmentation is performed on a multi-view image to obtain a multi-view hair segmentation image, including: using an image segmentation network to segment the hair area of ​​a virtual human avatar in the multi-view image to obtain a multi-view hair segmentation image.

[0142] In this example, the Hour-Glass neural network is used to segment the hair area of ​​the virtual human avatar in the multi-view image to obtain a multi-view hair segmentation image.

[0143] The Hour-Glass network consists of an encoder and a decoder.

[0144] Specifically, the multi-view image is input into the encoder part of the Hour-Glass network. The encoder consists of multiple convolutional layers and pooling layers, which extract the features of the multi-view image layer by layer. During the downsampling process, the spatial resolution of the image gradually decreases, but the number of channels of the feature map (i.e., feature depth) gradually increases, thereby capturing higher-level semantic information. Each hourglass block in the encoder contains multiple convolutional layers and residual connections for further extraction and integration of features. At the lowest layer of the encoder, the spatial resolution of the feature map is minimized, but it contains the richest semantic information. Subsequently, these feature maps are input into the decoder after intermediate processing layers.

[0145] The decoder gradually restores the spatial resolution of the image by upsampling the feature maps layer by layer. During the upsampling process, the decoder uses skip connections to fuse the feature maps of the encoder's corresponding level with the feature maps of the decoder's current level to retain more detail information. Each hourglass module in the decoder also contains multiple convolutional layers and possible residual connections to further refine the segmentation results. Finally, the decoder outputs a multi-view hair segmentation image with the same spatial resolution as the multi-view image. Each pixel value in the multi-view hair segmentation image represents the probability that the pixel belongs to the hair area.

[0146] In one example, generating a target three-dimensional directional occupancy field of a virtual human avatar based on a multi-view hair segmentation image includes:

[0147] Step 501: Rendering the hair model using ray tracing technology to obtain multi-view hair segmentation data.

[0148] In this example, ray tracing technology is used to render the hair model to obtain multi-view hair segmentation data of realistic multi-view hair segmentation images (for example, hair segmentation images of the full front, 90-degree side face, and 180-degree full back) and use them as training data. Ray tracing is a graphics rendering technology that can simulate the propagation path of light in a scene, including optical phenomena such as reflection, refraction, and scattering, thereby generating highly realistic images. Through ray tracing technology, the hair model is rendered into a 3D image that matches the multi-view segmentation image.

[0149] Step 502: Convert the hair model into an initial three-dimensional directional occupancy field, and train the three-dimensional directional occupancy field neural network using the multi-view hair segmentation data and the initial three-dimensional directional occupancy field.

[0150] In this example, a voxel is a cubic unit in a three-dimensional space, similar to a pixel in a two-dimensional image. The three-dimensional space where the hair model is located is divided into a voxel grid, for example, 256 (up and down) × 256 (left and right) × 128 (front and back), thereby obtaining the initial three-dimensional directional occupancy field of the virtual human avatar.

[0151] After obtaining the initial three-dimensional directional occupancy field, the multi-view hair segmentation image output by the image segmentation network is input into the three-dimensional directional occupancy field neural network. The three-dimensional directional occupancy field neural network is trained using the multi-view hair segmentation data and the initial three-dimensional directional occupancy field to obtain the target three-dimensional directional occupancy field.

[0152] The target three-dimensional directional occupancy field is composed of voxels divided by a grid from each point of the hair model, and each voxel occupied by a hair contains the tangent direction vector information of each point on the hair.

[0153] Each voxel in the three-dimensional directional occupancy field may contain part or all of the hair of the hair model, or no hair. By traversing each voxel and judging whether the voxel is occupied by hair based on the hair segmentation results in the multi-view segmentation image. If a voxel is marked as a hair area in the segmentation images of multiple views, the voxel is considered to be occupied by hair, and the hair segmentation results are mapped to the corresponding position in the three-dimensional space. For each voxel occupied by hair, the tangent direction vector of each point on the hair is calculated, and the tangent direction vector describes the local direction of the hair at that point.

[0154] In one example, the target three-dimensional directional occupancy field is deformed and attached to the scalp mesh to obtain the deformed target three-dimensional directional occupancy field, including:

[0155] Step 601: convert all voxels occupied by hair in the target three-dimensional directional occupancy field into an initial hair patch mesh.

[0156] In this example, all voxels occupied by hair in the target three-dimensional occupancy field are converted into hair meshes through the Marching Cubes algorithm. Specifically, the Marching Cubes algorithm traverses the target three-dimensional occupancy field and generates a continuous and smooth initial hair mesh based on the occupied information of the voxels. The initial hair mesh can approximately represent the shape of the hair.

[0157] Step 602: Initially align the initial hair patch mesh with the scalp mesh in the hair model through the transformation matrix.

[0158] In this example, after obtaining the initial hair patch mesh, it needs to be aligned with the scalp mesh. This is achieved by applying a 4×4 transformation matrix (including rotation, translation, and scaling). The purpose of this transformation matrix is ​​to move the hair patch mesh roughly to the position of the scalp mesh so that the two are close in spatial position.

[0159] Step 603: construct a KD tree on the vertices of the scalp mesh, and use the KD tree to match the nearest target vertex for each vertex of the scalp mesh on the initial hair patch mesh.

[0160] In this example, in order to more accurately adjust the initial hair patch mesh to fit the scalp mesh, you first need to build a KD tree (K-Dimensional Tree) on the vertices of the scalp mesh. The KD tree is a space partitioning data structure used to quickly retrieve the nearest neighbor points. Then, using this KD tree, find the nearest vertex on the initial hair patch mesh for each vertex on the scalp mesh. These nearest vertices will serve as target vertices for subsequent deformation.

[0161] Step 604: Adopting a patch deformation algorithm, taking the target vertex as a deformable vertex, and deforming it toward the vertex of the scalp mesh.

[0162] In this example, a patch deformation algorithm (such as ARAP, i.e., As-Rigid-As-Possible algorithm) is used to adjust the shape of the initial hair patch mesh. The ARAP algorithm aims to maintain the local rigidity of the mesh while allowing global deformation. Here, the target vertices found in step 603 are used as deformable vertices, and they are moved to the corresponding vertices of the scalp mesh, so that the hair patch mesh gradually fits the scalp mesh.

[0163] Step 605: Fix all vertices except the target vertex in the initial hair patch mesh to obtain the target hair patch mesh.

[0164] In this example, during the deformation process, all vertices in the initial hair patch mesh are fixed except for the target vertices (i.e., those vertices selected to move toward the scalp mesh). This is done to maintain the overall structural stability of the initial hair patch mesh while allowing the necessary local deformation to fit the scalp mesh. After the deformation is completed, the resulting mesh is the target hair patch mesh.

[0165] Step 606: Obtain a deformed target three-dimensional directional occupancy field according to the target hair patch mesh.

[0166] In this example, a new target 3D directional occupancy field is constructed based on the deformed target hair patch mesh. This new occupancy field contains not only the hair occupancy information (i.e. which voxels are occupied by hair), but also the hair tangent direction vector information. For voxels that have been occupied before deformation, their original tangent direction vector information can be used directly; for newly occupied voxels (i.e. newly occupied voxels due to deformation), the tangent direction vector information needs to be obtained through interpolation calculation.

[0167] In one example, a plurality of hair initial points are randomly sampled in the target three-dimensional direction occupation field, and the tangent direction is obtained according to the plurality of hair initial points to iteratively predict all other hair points, so as to generate the hair style of the virtual human avatar, including:

[0168] Step 701: randomly sampling a plurality of hair initial points in the voxels occupied by hair in the target three-dimensional occupancy field.

[0169] In this example, multiple hair initial points are randomly selected from the voxels occupied by hair in the target three-dimensional occupancy field as the initial growth points of the hair. The hair initial points are located inside the voxels marked as occupied by hair to ensure that the generated hair is reasonable and conforms to the law of hair distribution. By random sampling, the random initial points of natural hair at different positions can be simulated to increase the diversity and authenticity of the generated hairstyle. Preferably, the number of hair initial points is greater than 12,000.

[0170] Step 702: Perform B-spline sampling on the hair strands so that the distance between adjacent points on each hair strand is within a preset length range.

[0171] In this example, B-spline is a smooth curve in computer graphics and numerical analysis, which has the characteristics of local control, smoothness and parameterization. Sampling a B-spline curve means generating a series of hairline points within a given parameter range, which can be used to draw a hairline curve.

[0172] Using the B-spline curve to sample the hair in the hair model can ensure that the spacing between the sampled hair points is roughly equal and close to the preset length range (for example, 0.005±0.001m of the voxel side length).

[0173] Step 703: Divide the target three-dimensional directional occupancy field into a plurality of voxel blocks, each voxel block includes a plurality of voxels, and there are overlapping voxel regions between adjacent voxel blocks.

[0174] In this example, in order to process large-scale 3D occupancy field data and make full use of local and global occupancy information, the target 3D occupancy field is divided into multiple voxel blocks (patch blocks). Each voxel block contains a certain number of voxels, which together describe the occupancy of the local space.

[0175] There are overlapping voxel regions between adjacent voxel blocks, which is to aggregate more contextual information when predicting hair growth and improve the accuracy and robustness of the prediction. By dividing the voxel blocks and introducing overlapping regions, the algorithm can process large-scale data more efficiently and better capture the complexity and continuity of hair growth.

[0176] For example, the 256×256×192 three-dimensional directional occupancy field is divided into 63×63×47 patches, each of which contains 8×8×8 voxels, and every two patches overlap by 4×4×4 voxels. The purpose of dividing the patches is to aggregate voxel information, and the purpose of overlapping is to aggregate other information to maximize the information.

[0177] Step 704: Based on the multiple voxel blocks covering the initial points of the hair, a hair growth neural network is used to predict the hair growth path and generate the hair style of the virtual human avatar.

[0178] In this example, based on multiple voxel blocks covering the initial point of the hair, the trained hair growth neural network is used to predict the hair growth path and generate the hair style of the avatar. The specific generation process is described in detail in the subsequent embodiments.

[0179] In one example, based on multiple voxel blocks covering the initial point of the hair, a hair growth neural network is used to predict the hair growth path and generate the hair style of the virtual human avatar, including:

[0180] Step 801: determining a plurality of voxel blocks covering the initial point of the hair, and extracting direction field information of the voxel blocks using a hair growth neural network;

[0181] In this example, since each voxel block contains a certain number of voxels and there is overlap between adjacent voxel blocks, there may be multiple voxel blocks that contain or are close to the hair initial point. Multiple voxel blocks covering the hair initial point are determined, and these voxel blocks are selected as inputs to the hair growth neural network to extract the direction field information of the voxel blocks. The direction field information refers to the local hair direction or trend indicated by each voxel in the voxel block.

[0182] Step 802: predicting the next target point of the hair initial point according to the voxel block and the direction field information.

[0183] In this example, the voxel block and direction field information are input into the encoder module of the hair growth neural network. The encoder module encodes the voxel block to obtain its high-level feature representation. These encoded representations are then concatenated with the position information of the hair initial point and input into the decoder module. The decoder module predicts the growth direction of the hair based on the input information (including the encoding of the voxel block and the position of the hair initial point) and determines the next target point of the hair initial point. This target point is obtained after moving a certain distance along the predicted growth direction and represents the next position of the hair in the three-dimensional directional occupancy field.

[0184] Step 803: The target point is used as a new hair initial point, and the hair growth neural network is used to continue predicting the next target point until a hair that meets a preset length is generated.

[0185] In this example, after the next target point of the hair initial point is obtained, it is regarded as a new hair initial point, and the process of steps 801 and 802 is repeated. That is, the target point will again determine the voxel block covering the new hair initial point, extract the direction field information, and use the hair growth neural network to predict the next target point.

[0186] This process will be repeated over and over again, with each iteration generating a new point on the hair path until the preset hair length is met or other stop conditions are reached. In this way, the complete hair path is gradually generated, and finally the hair style of the avatar is formed.

[0187] The present disclosure also provides a system for generating a virtual human three-dimensional hair style. Figure 2 As shown, the system includes:

[0188] An acquisition module 901 is used to acquire an image to be processed, wherein the image to be processed includes a single-view virtual human avatar;

[0189] The image generation module 902 is used to determine the internal and external parameters of the camera used to shoot the virtual human avatar, and to generate a multi-view image of the virtual human avatar based on the image to be processed and the internal and external parameters of the camera used to shoot the virtual human avatar;

[0190] The image generation module 902 is further used to perform hair segmentation processing on the multi-view images to obtain multi-view hair segmentation images;

[0191] A three-dimensional directional occupation field generation module 903 is used to generate a target three-dimensional directional occupation field of the hair of the virtual human avatar according to the multi-view hair segmentation image;

[0192] The three-dimensional directional occupancy field generation module 903 is further used to deform the target three-dimensional directional occupancy field and attach it to the scalp mesh to obtain the deformed target three-dimensional directional occupancy field;

[0193] The hair growth module 904 is used to randomly sample multiple hair initial points in the target three-dimensional direction occupation field, obtain the tangent direction according to the multiple hair initial points, iteratively predict all other hair points, and generate the hair style of the virtual human avatar.

[0194] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.

[0195] Figure 3 A schematic block diagram of an example electronic device 1000 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, 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.

[0196] like Figure 3 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 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.

[0197] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0198] 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 a method for generating a virtual person's three-dimensional hair hairstyle. For example, in some embodiments, the method for generating a virtual person's three-dimensional hair hairstyle 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 device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the computing unit 1001, one or more steps of the method for generating a virtual person's three-dimensional hair hairstyle described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to execute the method for generating a three-dimensional hair hairstyle of a virtual person in any other appropriate manner (for example, by means of firmware).

[0199] 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), load 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.

[0200] 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.

[0201] 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 device, 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.

[0202] 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).

[0203] 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.

[0204] 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.

[0205] 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 recorded in this disclosure can be executed 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.

[0206] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0207] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A method for generating a three-dimensional hair style of a virtual human. It is characterized in that The method comprises: Acquire an image to be processed, wherein the image to be processed includes a single-view virtual human portrait; Determining the internal and external parameters of the camera used to shoot the virtual human avatar, and generating a multi-view image of the virtual human avatar according to the image to be processed and the internal and external parameters of the camera used to shoot the virtual human avatar, including: Using a camera parameter fitting algorithm, extracting internal and external parameters of the camera used to shoot the virtual human avatar from the image to be processed; Performing Gaussian distribution random sampling on the image to be processed to obtain a first latent code; Inputting the internal and external parameters of the shooting camera and the first potential code into a generative adversarial network model to generate a target rendered image; Calculating a first loss value between the target rendered image and a real image corresponding to the image to be processed, and optimizing the first latent code according to the first loss value to obtain a second latent code; Inputting the second latent code and the internal and external parameters of the camera shooting the target perspective into the generative adversarial network model, and generating the target perspective image through neural rendering; acquiring the target perspective images corresponding to all target perspectives, and obtaining the multi-perspective images of the virtual human avatar; Performing hair segmentation processing on the multi-view image to obtain a multi-view hair segmentation image; Generating a target three-dimensional directional occupancy field of the hair of the avatar according to the multi-view hair segmentation image; Deforming and attaching the target three-dimensional directional occupancy field to the scalp mesh to obtain a deformed target three-dimensional directional occupancy field; A plurality of hair initial points are randomly sampled in the target three-dimensional direction occupied field, a tangent direction is obtained according to the plurality of hair initial points, and all other hair points are iteratively predicted, and a hair hairstyle of the virtual human avatar is generated using a hair growth neural network.

2. The method according to claim 1, It is characterized in that Obtaining the generative adversarial network model includes: Acquire a sample data set, wherein the sample data set includes sample images of multi-view faces; Constructing the generative adversarial network model, wherein the generative adversarial network model includes a generator, a discriminator, a neural renderer and a mapping network; Performing Gaussian distribution random sampling on the sample image to obtain a first sample potential code; Inputting the sample shooting camera internal and external parameters of the sample image and the first sample potential code into the mapping network to obtain a second sample potential code; Inputting the second sample potential code into the generator to obtain a generated image; Inputting the generated image and rendering camera parameters into the neural renderer to obtain a sample rendered image; Using the discriminator to determine a second loss value between the generated image and a real image corresponding to the sample image, and calculating a third loss value of the generator; According to the second loss value and the third loss value, the parameters of the generator and the discriminator are iteratively optimized until the model converges to obtain a generative adversarial network model.

3. The method according to claim 2, It is characterized in that Obtaining internal and external parameters of a sample shooting camera of the sample image, including: Perform face detection on each sample image in the sample data set to obtain the corresponding face area; scaling the face regions in all sample images in which faces are detected to a target size, and performing a two-stage alignment process on the face regions of the sample images; After aligning the face region, a camera parameter fitting algorithm is used to estimate the posture of the face region in the sample image to obtain the internal and external parameters of the sample shooting camera.

4. The method according to claim 1, It is characterized in that Performing hair segmentation processing on the multi-view image to obtain a multi-view hair segmentation image includes: The hair region of the virtual human avatar in the multi-view image is segmented by using an image segmentation network to obtain the multi-view hair segmentation image.

5. The method according to claim 1, It is characterized in that Generating a target three-dimensional directional occupancy field of the hair of the avatar according to the multi-view hair segmentation image includes: Use ray tracing technology to render the hair model to obtain multi-view hair segmentation data; The hair model is converted into an initial three-dimensional directional occupancy field, and a three-dimensional directional occupancy field neural network is trained using the multi-view hair segmentation data and the initial three-dimensional directional occupancy field; Inputting the multi-view hair segmentation image into a trained three-dimensional directional occupancy field neural network to obtain the target three-dimensional directional occupancy field; The target three-dimensional directional occupancy field is composed of voxels divided by a grid from each point of the hair model, and each voxel occupied by a hair contains tangent direction vector information of each point on the hair.

6. The method according to claim 1, It is characterized in that The step of deforming and attaching the target three-dimensional directional occupancy field to the scalp mesh to obtain a deformed target three-dimensional directional occupancy field comprises: Converting all voxels occupied by hair in the target three-dimensional directional occupancy field into an initial hair patch mesh; Initially align the initial hair patch mesh with the scalp mesh in the hair model through the transformation matrix; Constructing a KD tree on the vertices of the scalp mesh, and using the KD tree to match the nearest target vertex for each vertex of the scalp mesh on the initial hair patch mesh; Using a patch deformation algorithm, the target vertex is used as a deformable vertex and deformed toward the vertex of the scalp mesh; Fix all vertices except the target vertex in the initial hair patch mesh to obtain the target hair patch mesh; According to the target hair patch mesh, the deformed target three-dimensional directional occupancy field is obtained.

7. The method according to claim 1, It is characterized in that The step of randomly sampling a plurality of hair initial points in the target three-dimensional direction occupied field, obtaining a tangent direction according to the plurality of hair initial points and iteratively predicting all other hair points, and generating a hair style of the virtual human avatar comprises: Randomly sampling a plurality of hair initial points in the voxels occupied by the hair in the target three-dimensional occupancy field; Performing B-spline sampling on the hair strands so that the spacing between adjacent points on each hair strand is within a preset length range; Dividing the target three-dimensional occupancy field into a plurality of voxel blocks, each voxel block includes a plurality of voxels, and there are overlapping voxel regions between adjacent voxel blocks; According to a plurality of voxel blocks covering the initial point of the hair, a hair growth path is predicted using a hair growth neural network to generate a hair hairstyle of the virtual human avatar.

8. The method according to claim 7, It is characterized in that The method of predicting the hair growth path by using a hair growth neural network according to a plurality of voxel blocks covering the initial point of the hair to generate the hair style of the virtual human avatar includes: Determine a plurality of voxel blocks covering the initial point of the hair, and extract direction field information of the voxel blocks using a hair growth neural network; Predicting the next target point of the hair initial point according to the voxel block and the direction field information; The target point is used as a new hair initial point, and the hair growth neural network is used to continue predicting the next target point until a hair that meets a preset length is generated.

9. A system for generating three-dimensional hair styles for virtual humans. It is characterized in that The system comprises: An acquisition module, used for acquiring an image to be processed, wherein the image to be processed includes a single-view virtual human portrait; An image generation module is used to determine the internal and external parameters of the camera used to shoot the virtual human avatar, and generate a multi-view image of the virtual human avatar according to the image to be processed and the internal and external parameters of the camera used to shoot the virtual human avatar, including: using a camera parameter fitting algorithm to extract the internal and external parameters of the camera used to shoot the virtual human avatar from the image to be processed; performing Gaussian distribution random sampling on the image to be processed to obtain a first latent code; inputting the internal and external parameters of the camera used to shoot the virtual human avatar and the first latent code into a generative adversarial network model to generate a target rendered image; calculating a first loss value between the target rendered image and a real image corresponding to the image to be processed, and optimizing the first latent code according to the first loss value to obtain a second latent code; inputting the second latent code and the internal and external parameters of the camera used to shoot the target perspective into the generative adversarial network model, and generating a target perspective image through neural rendering; obtaining target perspective images corresponding to all target perspectives to obtain a multi-view image of the virtual human avatar; An image generation module, used for performing hair segmentation processing on the multi-view image to obtain a multi-view hair segmentation image; A three-dimensional directional occupancy field generation module, used to generate a target three-dimensional directional occupancy field of the hair of the virtual human avatar according to the multi-view hair segmentation image; The three-dimensional directional occupancy field generation module is further used to deform the target three-dimensional directional occupancy field and attach it to the scalp mesh to obtain a deformed target three-dimensional directional occupancy field; The hair growth module is used to randomly sample multiple hair initial points in the target three-dimensional direction occupation field, obtain the tangent direction according to the multiple hair initial points, iteratively predict all other hair points, and use the hair growth neural network to generate the hair style of the virtual human avatar.

Citation Information

Patent Citations

  • Three-dimensional hairline generation method and model training method

    CN116030185A

  • Three-dimensional hair reconstruction method and system, electronic equipment and storage medium

    CN116416376A