Three-dimensional face reconstruction and editing method based on single image
Through pre-trained 3D perception generative adversarial network and depth estimation technology, combined with semantic segmentation network, efficient and flexible 3D face reconstruction and editing are achieved, solving the problems of high cost, low universality and inflexible editing in the existing technology. , which improves the stability and feature decoupling capabilities of the editing process.
Patent Information
- Application Number
- CN202410830409.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-09-24
AI Technical Summary
Existing 3D face reconstruction technology has high costs, low universality, and lacks customized editing capabilities. In addition, the reversal algorithm based on generative adversarial networks has problems such as over-optimization, large memory overhead, and inflexible feature editing.
The pre-trained 3D perception generative adversarial EG3D network is used for feature extraction and rendering, and the depth estimation and semantic segmentation network are combined to generate pseudo multi-view images. Efficient and flexible 3D face reconstruction and editing are achieved through latent code optimization and regularization strategies, reducing storage. Consume and enhance feature decoupling capabilities.
It achieves cost-effective and universal 3D face reconstruction and editing, improves the stability and controllability of the editing process, allows precise editing of specific facial features without affecting other features, and significantly reduces storage consumption. , maintaining the accuracy and editability of face reconstruction.
Smart Images

Figure CN118691745A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision processing, and in particular to a three-dimensional face reconstruction and editing method based on a single image. Background Art
[0002] Digital human is a virtual incarnation of human beings, which can be used as a manifestation of human identity characteristics and as a medium for interaction between users. In the fields of entertainment, education, etc., the demand for digital human beings has shown a huge growth. The application of digital human beings in entertainment fields such as live broadcast and games, as well as media fields such as news dissemination, is becoming a popular trend. The creation, editing and application of digital human beings involve technologies such as 3D modeling, graphics, and computer vision. There are generally several methods to achieve 3D face reconstruction. One is to use 3D scanning equipment such as structured light to reconstruct the head, but this method has high economic cost; the second is to ask professional designers to model 3D faces through 3D modeling software, but this method is also costly and has low universality. The third is to fit the parameters of the face parametric model based on 3DMM (3D Morphable Face Model, 3DMM), but this method is difficult to render realistic images. The fourth is to reconstruct multi-view faces based on neural radiation field 3D reconstruction technology. Although this method can render realistic images, it requires dense multi-view images and is difficult to edit. Therefore, a technical method with strong universality, low cost and the ability to achieve realistic three-dimensional face reconstruction and customized editing based on monocular or sparse views has become a striking innovation.
[0003] The reconstruction of 3D faces from a single view is a difficult problem in computer vision, because the restoration of 3D information from a single 2D information is itself an ill-posed problem. Therefore, it is often necessary to introduce appropriate prior information to reasonably supplement the unknown information. In recent years, the application of Generative Adversarial Networks (GAN) has made great progress in image generation in the field of computer vision, and the generation of 2D images has achieved high resolution, high quality, and high fidelity. Given that the rendering of high-resolution images of 3D faces often requires the participation of professional designers, and the 3D face model based on the 3DMM method is difficult to render high resolution. Therefore, researchers try to use GAN to synthesize multi-view images of 3D-aware faces, so a hybrid explicit-implicit three-plane 3D expression is introduced into GAN (EG3D), which achieves the best 3D-aware face image generation without sacrificing expressiveness. With the help of this realistic 3D-aware face image generation model containing powerful prior information, researchers apply the reversal algorithm of the generative adversarial network to this 3D-aware generative adversarial network, and reverse the single image to the latent space to achieve single-purpose 3D face reconstruction.
[0004] However, the current 3D face reconstruction based on the generative adversarial network reversal algorithm cannot achieve perfect results. It has the following shortcomings. First, the optimization goal of the reversal only stays on the image-level loss, which easily leads to over-fitting of the optimization process, resulting in a decrease in the generation effect and low editability of the latent code. Secondly, the reversal requires adjusting the parameters of the entire model. Therefore, each reconstruction of a face requires saving the parameters of the entire generative adversarial network generator model, resulting in huge memory overhead. Finally, the reconstructed face lacks personalized editing operations, and due to the coupling of the latent code space of the generative adversarial network, the existing 3D face editing methods often affect the changes of other unrelated features while editing a certain facial feature.
[0005] It should be noted that the information disclosed in the above background technology section is only used for understanding the background of the present application, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the invention
[0006] The main purpose of the present invention is to overcome the defects of the above-mentioned background technology, provide a single-image-based 3D face reconstruction and editing method, and provide more efficient, flexible and high-quality 3D face reconstruction and editing to solve the defects of the current face reconstruction technology, such as high cost, low universality, and lack of customized editing. To achieve the above-mentioned purpose, the present invention adopts the following technical solutions:
[0007] A three-dimensional face reconstruction and editing method based on a single image, comprising:
[0008] For monocular face images, the pre-trained 3D-aware face generation adversarial EG3D network is used to extract features. The EG3D network generates three orthogonal plane features through a generator with multiple convolutional modules. Combined with the camera parameters, the generated three-plane features are rendered in 3D through a neural renderer to generate a preliminary 3D face representation.
[0009] Through the inversion module, the input monocular face image is mapped to the latent code space to obtain the latent code, and the obtained latent code is used to generate a three-dimensional face image through the forward process of the EG3D network, and the difference between the generated three-dimensional face image and the original monocular face image is calculated, wherein the loss is calculated to optimize the latent code;
[0010] Based on the preliminary 3D face representation and latent code, depth estimation technology is used to generate depth information from the original monocular face image, and the depth information is used to project the monocular face image to different camera perspectives to generate pseudo multi-view images;
[0011] Based on the preliminary 3D face representation and latent code, a semantic segmentation network is used to extract the semantic features of the face, and an expression feature extraction network is used to obtain the expression features. The extracted semantic features and expression features are then fused with the features of the pseudo multi-view image to generate a comprehensive feature representation.
[0012] According to editing requirements, the latent code is optimized and regularized using the loss function through the latent code optimization network;
[0013] Based on comprehensive feature representation and optimized and regularized latent codes, the 3D face model is edited.
[0014] Based on the edited feature representation and the optimized latent code, the generator generates a final edited face image.
[0015] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the single-image-based three-dimensional face reconstruction and editing method is implemented.
[0016] The present invention has the following beneficial effects:
[0017] The present invention provides a three-dimensional face reconstruction and editing method based on a single image, which can provide more efficient, flexible and high-quality three-dimensional face reconstruction and editing, and effectively overcome the defects of current face reconstruction technology, such as high cost, low universality and lack of customized editing.
[0018] The main technical advantage of the present invention is that it provides a cost-effective and universal single-image-based three-dimensional face reconstruction and editing method, which effectively overcomes many limitations in the prior art. Compared with traditional methods, the present invention adopts a pre-trained EG3D network and an advanced GAN reversal algorithm to achieve high-efficiency and high-fidelity reconstruction from a monocular face image to a three-dimensional face model. The present invention generates pseudo-multi-view images through depth estimation technology, enriches the perspective information of the face model, and enhances the model's ability to capture semantic and expression features through semantic segmentation and expression feature extraction networks. In addition, through innovative latent code optimization and regularization strategies, the present invention not only improves the stability and controllability of the editing process, but also achieves a high degree of decoupling between features, allowing specific facial features to be accurately edited without affecting other irrelevant features, thereby enhancing the flexibility of personalized customization. In addition, the present invention further significantly reduces storage consumption through a local parameter optimization strategy, while improving the efficiency of feature decoupling during the editing process, maintaining the accuracy and editability of face reconstruction, and solving the problems of large memory overhead and lack of personalized editing capabilities in traditional methods.
[0019] Other beneficial effects of the embodiments of the present invention will be further described below. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 This is a schematic diagram of three-plane features generated by the three-dimensional perception generative adversarial network EG3D generator of an embodiment of the present invention.
[0021] Figure 2 It is a schematic diagram of neural rendering using three-plane features in EG3D according to an embodiment of the present invention.
[0022] Figure 3 It is a schematic diagram of the inversion architecture based on the EG3D generator according to an embodiment of the present invention.
[0023] Figure 4 4 is a schematic diagram of synthetic pseudo multi-view according to an embodiment of the present invention.
[0024] Figure 5 2 is a schematic diagram of the reversal process supervision according to an embodiment of the present invention.
[0025] Figure 6 It is a schematic diagram of a face semantic editing framework based on semantic segmentation mask reconstruction according to an embodiment of the present invention.
[0026] Figure 7 4 is a schematic diagram of a facial expression reconstruction editing framework according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following is a detailed description of the embodiments of the present invention. It should be emphasized that the following description is only exemplary and is not intended to limit the scope and application of the present invention.
[0028] refer to Figures 1 to 7 The embodiment of the present invention provides a single-image-based 3D face reconstruction and editing method, comprising the following steps:
[0029] S1. For monocular face images, the pre-trained 3D-aware face generation adversarial EG3D network is used to extract features. The EG3D network generates three orthogonal plane features through the generator StyleGAN2 with multiple convolution modules, and combines the camera parameters to perform 3D rendering on the generated three-plane features through the neural body renderer to generate a preliminary 3D face representation;
[0030] S2. Mapping the input monocular face image to the latent code space to obtain the latent code through the reversal module, using the obtained latent code to generate a three-dimensional face image through the forward process of the EG3D network, and calculating the difference between the generated three-dimensional face image and the original monocular face image, wherein the loss is calculated to optimize the latent code;
[0031] S3. Based on the preliminary 3D face representation and latent code, depth estimation technology is used to generate depth information from the original monocular face image, and the depth information is used to project the monocular face image to different camera perspectives to generate pseudo multi-view images;
[0032] S4. Based on the preliminary 3D face representation and latent code, the semantic features of the face are extracted using a semantic segmentation network, the expression features are obtained using an expression feature extraction network, and the extracted semantic features and expression features are fused with the features of the pseudo multi-view image to generate a comprehensive feature representation;
[0033] S5. According to the editing requirements, the latent code is optimized and regularized using the loss function through the latent code optimization network;
[0034] S6. Performing editing operations on the three-dimensional face model based on the comprehensive feature representation and the optimized, adjusted and regularized latent code;
[0035] S7. Based on the edited feature representation and the optimized latent code, the generator generates a final edited face image.
[0036] In a preferred embodiment, in step S2, the EG3D network also optimizes the details of the generated image through a super-resolution module.
[0037] In a preferred embodiment, in step S2, the loss function used for loss calculation includes pixel-level loss and perceptual loss to calculate the difference between the generated image and the supervised image; a latent code regularization loss is also introduced to calculate the bi-norm distance between the optimized latent code and the average latent code in the latent code space, thereby limiting the range of variation of the latent code and avoiding overfitting.
[0038] In a preferred embodiment, in step S2, local parameter optimization is implemented through a local parameter optimization strategy, and the network parameters are optimized and set to two synthesis modules closer to the output end in the StyleGAN2 backbone.
[0039] In a preferred embodiment, step S3 specifically includes:
[0040] Use the input monocular face image as supervision to perform preliminary optimization on the generator and latent code;
[0041] Predict the density of the image space based on the optimized generator and extract the depth information of the monocular image;
[0042] Using the extracted depth information, the monocular image is projected to different camera perspectives to generate pseudo multi-view images;
[0043] The pseudo multi-view image obtained by projection is fused with the image generated by the generator under the same viewing angle to form a pseudo supervised view;
[0044] Based on pseudo multi-view projection, a mask is generated by Gaussian blurring and normalized to between 0 and 1.
[0045] The mask after Gaussian blur is rounded up and down to generate two masks for supervision to ensure the accuracy of supervision information;
[0046] When fusing the generated image and the projected image, the mask is used to discard the inaccurate supervision information in the edge area;
[0047] The generated masks are used to supervise parts of the projection map and the generated image, and the pseudo view supervision loss is calculated.
[0048] In the pseudo multi-view generation stage, the depth information is effectively generated from the monocular image, and a pseudo multi-view image set for 3D face reconstruction is created. Meanwhile, the supervision image is optimized through mask processing, which improves the accuracy and reliability of the reconstruction process.
[0049] In a preferred embodiment, step S5 includes: using loss functions including L1, L2 loss and perceptual loss to evaluate feature differences, and using latent code and three-plane feature regularization loss, identity consistency and non-changing area loss to enhance the decoupling between editing features and irrelevant features; limiting the change of latent code through latent code regularization loss function to maintain stability during the editing process; executing an optimization algorithm to update the latent code according to the calculation result of the loss function, and continuously adjusting the latent code through an iterative process until the features of the generated image meet the editing requirements.
[0050] In a preferred embodiment, step S6 includes: using a pre-trained semantic segmentation network to analyze the face image, identify and segment different semantic regions; using an expression feature extraction network to identify the expression features of the face and convert them into editable parameters; generating a corresponding editing mask based on the results of semantic segmentation and expression feature extraction; applying the generated mask to the optimized latent code, editing the specific semantic region based on the editing mask, and adjusting the expression features of the face image based on the extracted expression parameters and the generated mask; and fusing the results of semantic editing and expression editing.
[0051] In a preferred embodiment, the method further comprises the following steps:
[0052] S9. Smooth transitions are performed between latent codes of different expressions through latent code interpolation technology to generate animations of facial expression changes.
[0053] In a more preferred embodiment, step S9 includes: performing smooth interpolation operations on latent codes in different editing states through linear interpolation; using the intermediate latent codes obtained by interpolation to generate transition animations of facial expressions or features; outputting the generated final facial image as a result of the three-dimensional face reconstruction and editing process; if a transition animation is generated, outputting the animation sequence to show the changing process of the facial expression.
[0054] The main technical advantage of the present invention is that it provides a cost-effective and universal single-image-based three-dimensional face reconstruction and editing method, which effectively overcomes many limitations in the prior art. Compared with traditional methods, the present invention adopts a pre-trained EG3D network and an advanced GAN reversal algorithm to achieve high-efficiency and high-fidelity reconstruction from a monocular face image to a three-dimensional face model. The present invention generates pseudo-multi-view images through depth estimation technology, enriches the perspective information of the face model, and enhances the model's ability to capture semantic and expression features through semantic segmentation and expression feature extraction networks. In addition, through innovative latent code optimization and regularization strategies, the present invention not only improves the stability and controllability of the editing process, but also achieves a high degree of decoupling between features, allowing specific facial features to be accurately edited without affecting other irrelevant features, thereby enhancing the flexibility of personalized customization. In addition, the present invention further significantly reduces storage consumption through a local parameter optimization strategy, while improving the efficiency of feature decoupling during the editing process, maintaining the accuracy and editability of face reconstruction, and solving the problems of large memory overhead and lack of personalized editing capabilities in traditional methods.
[0055] Feature decoupling is achieved in the three-dimensional face reconstruction and editing method of the present invention through independent feature extraction, optimization and editing operations, ensuring that other irrelevant features remain unchanged when specific facial features are adjusted. In the feature extraction and three-dimensional rendering steps, the three independent plane features generated by the EG3D network lay the foundation for decoupling. The editing feature extraction and fusion step independently extracts and integrates facial features through semantic segmentation and expression feature extraction networks, further realizing feature decoupling. In the latent code optimization step, by regularizing and adjusting the latent code, the optimization network focuses on maintaining the independence between features and reducing the impact on other features. The editing operation implementation step allows specific features to be accurately edited without affecting other areas, which directly reflects the application of feature decoupling. Finally, in the result generation and output step, the edited face image should show the modification of specific features while maintaining the original state of other features, intuitively reflecting the effect of feature decoupling. In addition, in the animation effect implementation step, the latent code interpolation technology is used to generate animations of expression changes, allowing smooth transitions between different expression states without interfering with other features of the face, further demonstrating the advantages of feature decoupling. The inversion process of the present invention abandons the traditional mapping of noise to latent code, directly uses the latent code as input to the generator, and reduces the loss between the generated image and the supervised image by optimizing the latent code. The latent code regularization loss is introduced to avoid overfitting and optimize the parameters of the latent code and generator network.
[0056] Some embodiments of the present invention are further described below.
[0057] The embodiment of the present invention is based on a single-image three-dimensional face reconstruction and feature decoupling editing method, and constructs an inversion architecture based on a pre-trained three-dimensional perception face generative adversarial network (EG3D). The inversion process mainly optimizes the parameters of the latent code and the generator to reduce the loss between the image generated by the EG3D generator and the supervision map. The monocular image is projected to a pseudo-multi-view of other perspectives through depth as the supervision map of the inversion. At the same time, the latent code regularization loss is designed in the inversion process, and the network parameter optimization is limited to some modules in the generator network. In addition, a general face editing architecture is also designed. The first half is the same as the architecture of the inversion process, and a network with prior knowledge can be introduced in the second half as supervision. The network extracts the features of the generated image and calculates the loss with the specified target features, and only optimizes the latent code to achieve the editing of the reconstructed face. In this editing process, the latent code and three-plane feature regularization loss, identity and non-changing area loss are used to improve the decoupling of the editing features and irrelevant features. In the implementation stage, the semantic segmentation network and expression feature extraction are specifically introduced to realize the mask-based semantic editing and expression editing of the reconstructed face.
[0058] In some embodiments, the present invention provides a method for editing three-dimensional face reconstruction based on a single image and its feature decoupling, comprising the following steps: the first step: constructing an inversion architecture based on a pre-trained three-dimensional perceptual face generative adversarial network (EG3D). The main process of this architecture is to abandon the mapping network from noise to latent code, and directly input the latent code into multiple series-connected convolution modules (StyleGAN2) to generate three plane features. Then, based on the camera parameters and the three orthogonal plane features reshaped in space, volume rendering is performed, and finally, the generated graph output by the super-resolution module and the supervision graph are calculated for loss, thereby optimizing the parameters of the latent code and the generator network; the second step is based on the construction of the inversion architecture, using the monocular face image and its pseudo-multi-view image set projected to other viewpoints through depth information as the supervision graph, and designing the loss function to optimize the parameters and latent code of the network to complete the three-dimensional reconstruction of the single-view face. In this process, based on the image color and perception loss, the embodiment of the present invention designs a latent code regularization loss, and designs a local reversal strategy, limiting the network parameter optimization to some modules in the StyleGAN2 network to improve the editability of the latent code and the storage consumption of reconstruction; the third step is based on the network and latent code parameters adjusted by the optimization after reversal, and the forward process of the generator given different camera parameters of the generator can synthesize a new view of the face; the fourth step is to construct the face editing architecture designed by the present invention, the first half of which is the same as the architecture of the reversal process, and the latent code input generator outputs the rendered face image. Subsequently, the output image is input into any pre-trained network module with prior knowledge, and the image features extracted by the supervision network are compared with the set features for loss calculation to optimize the latent code. In addition to the commonly used feature losses such as the one-two norm and cross entropy loss, the present invention designs latent code and three-plane feature regularization losses, identity and non-changing area losses in this editing process to improve the decoupling of editing features from irrelevant features. For this universal editing method, the present invention specifically introduces a semantic segmentation network and expression feature extraction to realize mask-based semantic editing and expression editing of reconstructed faces; in the fifth step, the latent code optimized by the editing framework is input into the generator to generate the edited face image under any viewpoint. In addition, the interpolation operation between the latent codes of different edits of the same face can realize a smooth transition animation between face edits.
[0059] In some embodiments, the first step specifically includes: constructing an image-to-latent code inversion architecture based on a pre-trained 3D-aware face generative adversarial network (EG3D). The overall inversion structure of the model, such as Figure 3As shown in , the reversal process mainly consists of the input latent code, the EG3D generator, the generated image and the supervised image, and the loss function between the two. The EG3D generator contains two main modules, a three-plane feature generator composed of multiple convolution modules, and a neural renderer based on three-plane features and camera parameters. Their structures are shown in Figure 1 and Figure 2 In this reversal process, the mapping network from noise to latent space is discarded, and the loss between the supervised image and the generated image is reduced by directly optimizing the latent code with an input dimension of 512×14 and the parameters of the network, thus achieving the mapping from monocular image to latent space.
[0060] In some embodiments, the second step specifically includes the monocular face image to be reconstructed. And the method uses a pseudo view generated from a new perspective based on the original monocular image as a supervision image. The specific steps are as follows Figure 4 As shown in Figure 1, we first use the input monocular image as supervision to optimize the generator and latent code with fewer rounds, then extract the depth of the monocular image based on the density predicted by the generator, and then project the monocular image to other camera perspectives based on the depth and optimize the generator G with fewer rounds. es Images generated at the same viewpoint are fused as pseudo-supervisory views.
[0061] The loss calculation in the second step specifically includes: L1 and L2 losses and perceptual losses on the pixel colors between the generated image and the supervised image. At the same time, in order to avoid overfitting in the process of mapping the image to the latent space, which causes the reconstructed face to produce defects such as distortion artifacts under other new perspectives, and the low editability of the latent code, this method designs a latent code regularization loss, that is, the two-norm distance between the optimized latent code and the average latent code in the latent code space is added to the loss calculation. The supervised loss calculation method for synthetic pseudo views is as follows: Figure 5 As shown in Figure 2, this method does not directly calculate the loss between the synthesized pseudo view and the generated image, but uses the mask obtained based on the pseudo multi-view projection to obtain the projection map and G respectively. es The pseudo-view supervision and latent code regularization effectively avoid the overfitting of face reconstruction.
[0062] The parameter optimization part includes: the latent code with a dimension of 512×14 and the parameters of the generator. Usually, the overall parameters of the generator are fine-tuned, but this method requires saving about 120MB of generator parameters for each reconstructed face, resulting in a large memory consumption. Therefore, this method proposes to limit the optimization parameters of the network to some convolution modules in the three-plane feature synthesis module during the reversal process, greatly reducing the storage consumption required for face reconstruction. In the specific implementation, this method sets the network parameter optimization to the StyleGAN2 backbone (see Figure 1) The two modules closer to the output end SynthBlock256 2 With SynthBlock 128 2 , successfully reducing storage consumption from 120.27MB to 12.22MB.
[0063] In some embodiments, the third step specifically includes: based on the latent code and generator parameters optimized in the first and second steps, the latent code is input into the generator in combination with camera parameters of different viewpoints to generate any new view of the reconstructed face.
[0064] In some embodiments, the fourth step specifically includes: designing a general reconstructed face editing algorithm framework, the first half of the framework is the same as the reversal framework, and in the second half, any feature extraction network with prior knowledge can be introduced as supervision, which extracts the features of the generated image and calculates the loss with the specified target features, and only optimizes the latent code, thereby realizing the editing of the reconstructed face. In the specific implementation, this method introduces a semantic segmentation prior model and a facial parameterized feature extraction model as prior supervision, and realizes the semantic editing and expression editing of the reconstructed face based on the segmentation mask. At the same time, this method also designs four losses: latent code regularization, three-plane feature regularization, identity consistency, and non-changing area to improve the decoupling between the editing features and irrelevant features.
[0065] In the design of decoupling loss, directly using the prior model to supervise the optimization of the latent code will often cause irrelevant features to change with the edited features. For this reason, this method designs four losses to improve the decoupling between features. In the latent code regularization loss, the optimized latent code and the unoptimized original latent code are calculated with the bi-norm loss to limit the change of unnecessary latent code. In the three-plane feature regularization loss, the three-plane features generated by the unoptimized original latent code and the three-plane features generated by the latent code during the optimization process are calculated with the bi-norm loss to limit the change of unnecessary features. In the identity consistency loss, the identity features extracted from the image generated by the latent code during the optimization process are calculated with the identity features of the original input monocular image to limit the change of identity information. In the non-changing area loss, the semantic segmentation model is used to segment the image into several semantic regions. When editing features, such as editing the mouth area, other regions are merged into a mask, and the color and perceptual losses of the original image and the image generated by the latent code during the optimization process are calculated based on the mask to limit the change of unnecessary areas.
[0066] In the design of the face reconstruction based on segmentation mask semantic editing framework, a face semantic segmentation model prior model is introduced and applied in the general face reconstruction editing framework. Its structure is as follows Figure 6As shown in the figure, the semantic segmentation model is used as a priori model to segment the semantics of the image generated by the generator, and the cross entropy loss is calculated with the set semantics to optimize the latent code. At the same time, the loss calculation also adds the several decoupled loss functions mentioned above.
[0067] Reconstructing the facial expression editing framework design: the structure of expression editing is as follows Figure 7 As shown, a facial expression parameter feature extractor is introduced and applied in the general reconstruction face editing framework. It is used to extract the expression parameters of the image generated by the generator, and calculate the norm loss with the expression parameters extracted from the image with the set expression, thereby optimizing the latent code. Since human expression is closely related to the mouth, this method also introduces the mouth area of the face supervised by the semantic segmentation model. At the same time, the loss calculation also adds the several decoupled loss functions mentioned above.
[0068] In some embodiments, the fifth step specifically includes: based on the editing framework, the latent code obtained by editing the face is input into the generator in combination with the camera parameters of different viewpoints to generate the edited face images under different viewpoints. Compared with other methods in reconstructing the semantic editing of faces, this method can basically keep other features of the face unchanged when editing a certain facial feature, while the IDE3D method will cause changes in other irrelevant features when editing. In addition, for the same face, linear interpolation operations are performed on the latent codes of different edits, and a series of interpolated latent codes are input into the generator, which can generate smooth transition images of two editing effects.
[0069] The details of specific embodiments of the present invention are further exemplified below.
[0070] The overall network structure of the reversal process is as follows Figure 3 As shown in the figure, the 3D-aware face generation model EG3D is used as the 3D prior model, and the target face image is mapped to w based on the optimization method. + Latent code space.
[0071] Regularization of latent code: In order to solve the problem of low editability of latent code, this method proposes a latent code regularization loss function, which is added to the optimization-based reversal process to limit the deviation between the latent code obtained by reversal and the main distribution of the latent code. In addition, since the latent code used in training has the same value on the 14 channels, the regularization term proposed by this method can also constrain the distance between each channel. The regularization term contains two terms. The first term is to limit the two-norm distance between the optimized latent code and the average latent code, and the second term is to limit the two-norm distance between the latent code of each channel in the optimized latent code w^+ and the latent code of the first channel. The regularization loss function is mathematically expressed as follows:
[0072]
[0073] where w +In w + The latent code space has a dimension of 512×14, and Mean means taking the average value. Indicates that w + The first channel of the latent code is replicated 14 times. In each reversal round, w + While getting updated Also need to be updated accordingly. λ1 and λ2 are the weight hyperparameters of the regularization term.
[0074] Pseudo multi-view supervision: Figure 5 As shown in Figure 1, the input monocular image is first used as supervision to optimize the generator and latent code with fewer rounds. Then, the density of the image space is predicted based on the generator and latent code optimized for fewer rounds, the depth of the monocular image is extracted, and then the monocular image is projected to other camera perspectives based on the depth and the generator G optimized for fewer rounds is used. es The images generated at the same viewpoint are fused as pseudo-supervisory views. This method does not directly calculate the loss between the synthesized pseudo-view and the generated image, but rather uses the mask obtained by pseudo multi-view projection to obtain the pseudo-supervisory view through Gaussian blur PM. blur After normalization to between 0 and 1, two masks are generated by rounding up and down. Then, they are applied to the projection map and G respectively. es The optimization equation is mathematically expressed as follows:
[0075]
[0076] Where, ⊙ represents the Hadamard product (also called Element-wise product), P v Represents the camera parameters at a certain viewing angle, I vp Represents the projection of the target image to the viewing angle P v Picture of PM blur represents the projection mask after Gaussian blur, L LPIPS+L2 G is the weighted sum of the LPIPS loss function and the L2 Norm loss function. p Represents an optimized generator.
[0077] Local parameter optimization: This method proposes a reverse local parameter optimization method, which effectively reduces the consumption of storage space while ensuring the accuracy of face reconstruction and the editability of the reconstructed face. This method limits the reverse parameter optimization to some parameters of the three-plane feature generation convolution module that affect the generation of facial features. In the implementation, this method sets the network parameter optimization to the StyleGAN2 backbone (see Figure 1 ) The two modules closer to the output end SynthBlock256 2With SynthBlock 128 2 , successfully reducing storage consumption from 120.27MB to 12.22MB.
[0078] Reconstructing face semantic editing based on segmentation mask:
[0079] Its structure is as Figure 6 As shown, using the same optimization method as in GAN reversal, the model parameters are fixed and the latent code is taken as the optimization object. By continuously optimizing the loss function, the latent code w is adjusted. + , so that the generated image gradually approaches the set target. The main difference between this editing method and the reversal method lies in the different loss function settings. In the reversal, the latent code is initialized to the average latent code, while the initial latent code in the editing algorithm is set to the latent code of the reconstructed face. In order to enable the model to perceive the semantic information of the generated image, this method introduces a face semantic segmentation model and splices it with the generator. Under the supervision of this model, the cross entropy loss between the semantic segmentation mask of the generated image and the target mask is calculated. In addition, this method also designs other loss functions, including face identity loss function and non-changing area loss function. Most importantly, this method proposes a regularized loss function for three-plane features and latent codes, which improves the decoupling of different features in three-dimensional face perception images.
[0080] Masked cross entropy loss:
[0081]
[0082] Mask t [j,i] represents the probability that the jth pixel position of the target mask is classified as label i, Bs represents the semantic segmentation model, and w + With G p are the optimized latent code and EG3D generator after reconstructing the face. p (w + ,P v ))[j,i] represents the probability that the mask of the generated image inferred by the semantic segmentation model is label i at the jth pixel. N is the number of labels, which is equal to 20, and HW is the number of image pixels.
[0083] Identity and non-changing region loss function:
[0084]
[0085] BMask oc =Binary(PMask o , CL)Mask pc =Binary(PMask p , CL)
[0086] BMaskuc =1-(BMask oc ∪BMask pc )#
[0087]
[0088] Where VF represents the face feature extraction model, its input is the face image, and its output is the corresponding face feature code. represents the latent code after reconstructing the face, w + The latent code is the optimization object, and · represents the dot product.
[0089] Among them PMask p With PMask o Refers to the parsing mask of the edited face and the reconstructed face respectively. Binary(PMask,L) means binarizing the parsing mask according to the CL label set. uc It is the non-changing area loss function, which includes LPIPS loss and two-norm loss.
[0090] Latent code and three-plane feature regularization loss function:
[0091]
[0092] Among them G p .B represents the three-plane feature generation module in the generator, and its output is the three-plane feature.
[0093] Total loss function:
[0094] L edit-mask =λ mask L mask +λ id L id +λ uc L uc +λ w +L w ++λ plane L plane
[0095] Reconstructing facial expressionsEdit:
[0096] Its structure is as Figure 7 As shown in the figure, this method introduces EMOCA, a facial expression parameter extractor, as a facial expression supervision model, and uses DECA, a rough facial texture image renderer of a facial parameterized model extractor, combined with a facial semantic segmentation model to supervise the mouth shape of the face. At the same time, the identity, non-changing area, latent code regularization and three-plane regularization loss functions mentioned above are used to promote the decoupling between different features.
[0097] Expression loss function:
[0098]
[0099] l em =λ exp L exp +λ av L av +λ lt L lt #
[0100] Among them, EM exp represents the expression coefficient of the monocular image extracted by the EMOCA model, EM av Represents the evocation and evaluation value of the extracted image, EM lt Represents the illumination and texture coefficients of the extracted image, I ref The face image representing the reference expression, L em is the total expression loss function.
[0101] Mask loss: To achieve better mouth shape migration, a mask loss function is introduced in expression editing to supervise the change of mouth shape, and DECA is used to render a rough face texture image with the corresponding mouth shape. The reference expression face image and the reconstructed face image are input into DECA, and the head posture of the reference face is first made consistent with the reconstructed face by replacing the head posture coefficient. Then, a rough texture image of the reference face in this posture is rendered, and the rough texture image is input into the semantic segmentation model to obtain the corresponding face semantic mask. Finally, the mouth area in the reconstructed face parsing mask is replaced with the mouth area of the semantic mask to obtain the target mask. The mask loss function is similar to the loss function in semantic editing.
[0102] Total loss function:
[0103] L edit-exp =λ mask L mask +λ id L id +λ uc L uc +λ w +L w ++λ plane L plane +λ em L em
[0105] Latent code interpolation: By utilizing the good characteristics of the latent code space of the three-dimensional prior model EG3D, on the basis of realizing face editing, this method can realize the animation effect of facial expression changes. Specifically, the latent code of the original face and the latent code of the face after expression editing are interpolated, and then the generators are output in sequence to generate the transition animation of the face between two expressions.
[0106] The method of the embodiment of the present invention can be summarized as follows:
[0107] The first step is to build an inversion architecture based on the pre-trained 3D-aware face generative adversarial network (EG3D). The main process of this architecture is to abandon the noise-to-latent code mapping network, and directly input the latent code into multiple series-connected convolution modules (StyleGAN2) to generate three plane features. Then, based on the camera parameters and the three orthogonal plane features reshaped in space, volume rendering is performed. Finally, the loss is calculated for the generated image output by the super-resolution module and the supervision image, thereby optimizing the parameters of the latent code and generator network. The second step is based on the construction of the inversion architecture, using the monocular face image and its pseudo-multi-view image set projected to other viewpoints through depth information as the supervision image, and designing the loss function to optimize the network parameters and latent code to complete the 3D reconstruction of the single-view face. In this process, based on the image color and perception loss, the present invention designs a latent code regularization loss, and designs a local reversal strategy, limiting the network parameter optimization to some modules in the StyleGAN2 network to improve the editability of the latent code and the storage consumption of reconstruction; the third step is based on the network and latent code parameters adjusted by the optimization after reversal, and the forward process of the generator given different camera parameters of the generator can synthesize a new view of the face; the fourth step is to construct the face editing architecture designed by the present invention, the first half of which is the same as the architecture of the reversal process, and the latent code input generator outputs the rendered face image. Subsequently, the output image is input into any pre-trained network module with prior knowledge, and the image features extracted by the supervision network are compared with the set features for loss calculation to optimize the latent code. In addition to the commonly used feature losses such as the one-two norm and cross entropy loss, the present invention designs latent code and three-plane feature regularization losses, identity and non-changing area losses in this editing process to improve the decoupling of editing features and irrelevant features. For this universal editing method, the present invention specifically introduces a semantic segmentation network and expression feature extraction to realize mask-based semantic editing and expression editing of reconstructed faces; in the fifth step, the latent code optimized by the editing framework is input into the generator to generate the edited face image under any viewpoint. In addition, the interpolation operation between the latent codes of different edits of the same face can realize a smooth transition animation between face edits.
[0108] Ultimately, the present invention can generate high-quality edited facial images, meet users' needs for customized editing of three-dimensional facial models, and can effectively promote the application and development of three-dimensional facial technology in entertainment, education, news communication and other fields.
[0109] An embodiment of the present invention further provides a storage medium for storing a computer program, which at least performs the above method when executed.
[0110] An embodiment of the present invention further provides a control device, comprising a processor and a storage medium for storing a computer program; wherein the processor is configured to execute at least the method described above when executing the computer program.
[0111] An embodiment of the present invention further provides a processor, wherein the processor executes a computer program and at least executes the method described above.
[0112] The storage medium can be implemented by any type of non-volatile storage device, or a combination thereof. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a ferromagnetic random access memory (Flash Memory), a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The storage medium described in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.
[0113] In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0114] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0115] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0116] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.
[0117] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0118] The methods disclosed in the several method embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments.
[0119] The features disclosed in several product embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new product embodiments.
[0120] The features disclosed in several method or device embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0121] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art of the present invention, several equivalent substitutions or obvious variations can be made without departing from the concept of the present invention, and the performance or use is the same, which should be regarded as belonging to the protection scope of the present invention.
Claims
1. A method for 3D face reconstruction and editing based on a single image, characterized in that: The following steps are involved: S1. For monocular face images, the pre-trained 3D-aware face generation adversarial EG3D network is used to extract features. The EG3D network generates three orthogonal plane features through a generator with multiple convolutional modules, and combines the camera parameters to perform 3D rendering on the generated three-plane features through a neural body renderer to generate a preliminary 3D face representation. S2. Mapping the input monocular face image to the latent code space to obtain the latent code through the reversal module, using the obtained latent code to generate a three-dimensional face image through the forward process of the EG3D network, and calculating the difference between the generated three-dimensional face image and the original monocular face image, wherein the loss is calculated to optimize the latent code; S3. Based on the preliminary 3D face representation and latent code, depth estimation technology is used to generate depth information from the original monocular face image, and the depth information is used to project the monocular face image to different camera perspectives to generate pseudo multi-view images; S4. Based on the preliminary 3D face representation and latent code, the semantic features of the face are extracted using a semantic segmentation network, the expression features are obtained using an expression feature extraction network, and the extracted semantic features and expression features are fused with the features of the pseudo multi-view image to generate a comprehensive feature representation; S5. According to the editing requirements, the latent code is optimized and regularized using the loss function through the latent code optimization network; S6. Performing editing operations on the three-dimensional face model based on the comprehensive feature representation and the optimized, adjusted and regularized latent code; S7. Based on the edited feature representation and the optimized latent code, the generator generates a final edited face image.
2. The single-image-based 3D face reconstruction and editing method according to claim 1, characterized in that: In step S2, the EG3D network also optimizes the details of the generated image through a super-resolution module.
3. The single-image-based 3D face reconstruction and editing method according to claim 1 or 2, characterized in that: In step S2, the loss functions used for loss calculation include pixel-level loss and perceptual loss to calculate the difference between the generated image and the supervised image; a latent code regularization loss is also introduced to calculate the bi-norm distance between the optimized latent code and the average latent code in the latent code space, thereby limiting the range of variation of the latent code and avoiding overfitting.
4. The single-image-based 3D face reconstruction and editing method according to any one of claims 1 to 3, characterized in that: In step S2, local parameter optimization is implemented through a local parameter optimization strategy, and the network parameter optimization is set to the two synthesis modules closer to the output end in the StyleGAN2 backbone.
5. The single-image-based 3D face reconstruction and editing method according to any one of claims 1 to 4, characterized in that: Step S3 specifically includes: Use the input monocular face image as supervision to perform preliminary optimization on the generator and latent code; Predict the density of the image space based on the optimized generator and extract the depth information of the monocular image; Using the extracted depth information, the monocular image is projected to different camera perspectives to generate pseudo multi-view images; The pseudo multi-view image obtained by projection is fused with the image generated by the generator under the same viewing angle to form a pseudo supervised view; Based on pseudo multi-view projection, a mask is generated by Gaussian blurring and normalized to between 0 and 1. The mask after Gaussian blur is rounded up and down to generate two masks for supervision to ensure the accuracy of supervision information; When fusing the generated image and the projected image, the mask is used to discard the inaccurate supervision information in the edge area; The generated masks are used to supervise parts of the projection map and the generated image, and the pseudo view supervision loss is calculated.
6. The single-image-based 3D face reconstruction and editing method according to any one of claims 1 to 5, characterized in that: Step S5 includes: using loss functions including L1, L2 loss and perceptual loss to evaluate feature differences, and using latent code and three-plane feature regularization loss, identity consistency and non-changing area loss to enhance the decoupling between edited features and irrelevant features; limiting the change of latent code through latent code regularization loss function to maintain stability during the editing process; executing the optimization algorithm, updating the latent code according to the calculation result of the loss function, and continuously adjusting the latent code through an iterative process until the features of the generated image meet the editing requirements.
7. The single-image-based 3D face reconstruction and editing method according to any one of claims 1 to 6, characterized in that: Step S6 includes: using a pre-trained semantic segmentation network to analyze the face image, identify and segment different semantic areas; using an expression feature extraction network to identify the expression features of the face and convert them into editable parameters; generating a corresponding editing mask based on the results of semantic segmentation and expression feature extraction; applying the generated mask to the optimized latent code, editing a specific semantic area based on the editing mask, and adjusting the expression features of the face image based on the extracted expression parameters and the generated mask; and fusing the results of semantic editing and expression editing.
8. The single-image-based 3D face reconstruction and editing method according to any one of claims 1 to 7, characterized in that: The following steps are also included: S9. Smooth transitions are performed between latent codes of different expressions through latent code interpolation technology to generate animations of facial expression changes.
9. The single-image-based 3D face reconstruction and editing method according to claim 8, characterized in that: Step S9 includes: performing smooth interpolation operation on latent codes in different editing states by linear interpolation; using the intermediate latent codes obtained by interpolation to generate transition animations of facial expressions or features; outputting the generated final facial image as the result of the three-dimensional face reconstruction and editing process; if a transition animation is generated, outputting the animation sequence to show the changing process of the facial expression.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the single-image-based three-dimensional face reconstruction and editing method as described in any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Single-image 3D portrait generation method and system based on mixed prior and noise resampling
CN121305004A
Single-image-based three-dimensional face reconstruction and editing method
WO2026001273A1
