Face reconstruction method and device
By combining deep learning networks and average face models, realistic 3D face models are generated, solving the problem that 2D face reconstruction cannot capture depth and three-dimensional structure, and realizing end-to-end 3D face reconstruction.
Patent Information
- Application Number
- CN202410903945.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-11-01
AI Technical Summary
In existing technologies, 2D face reconstruction cannot capture the depth and three-dimensional structure of a face, and traditional 3D face reconstruction requires manual design of feature extractors, which cannot achieve end-to-end output.
A 3D model is trained using a deep learning network. The 3D spatial information is obtained by inputting a target face image. The average face model and offset are combined to generate a 3D face model. Texture and detail information are added to achieve end-to-end 3D face reconstruction.
It enables direct output from 2D face images to 3D spatial information without the need for manual feature extraction, adapts to complex data distributions, and generates realistic 3D face models.
Smart Images

Figure CN118887332A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a face reconstruction method, device, computer equipment and storage medium. Background Art
[0002] In applications such as virtual reality (VR) and augmented reality (AR), 3D reconstruction of real faces can improve user experience and interactivity. For example, by 3D reconstruction of real faces, highly realistic virtual characters can be created in virtual environments to increase immersion. At the same time, 3D face reconstruction allows the retention of real facial features (such as expressions, eyes, etc.) in virtual characters or avatars, so that virtual characters can reflect real appearance and expressions.
[0003] In the related technologies, 2D face reconstruction and traditional 3D face reconstruction are usually used to achieve this. However, 2D face reconstruction mainly starts from a plane image, only considering the performance of the face in a two-dimensional image, and does not involve deep modeling of the face, and usually cannot capture the depth and three-dimensional structure of the face; while traditional 3D face reconstruction is based on traditional graphics, requires manual design of feature extractors, and cannot achieve end-to-end output. Summary of the invention
[0004] The purpose of this application is to provide a face reconstruction method, device, computer equipment and storage medium to solve the following technical problems: In the related art, 2D face reconstruction cannot capture the depth and three-dimensional structure of the face, and traditional 3D face reconstruction requires manually designed feature extractors and cannot achieve end-to-end output.
[0005] One aspect of an embodiment of the present application provides a face reconstruction method, including: inputting a target face image into a pre-trained three-dimensional model to obtain target three-dimensional spatial information corresponding to the target face image, wherein the three-dimensional model is obtained according to deep learning network training and is used to obtain three-dimensional spatial information of the input face image, and the three-dimensional spatial information includes three-dimensional coordinates and posture parameters; obtaining a pre-constructed average face model and first three-dimensional spatial information corresponding to the average face model; determining a first offset according to the target three-dimensional spatial information and the first three-dimensional spatial information; generating a first 3D face model according to the first offset and the average face model; and generating a reconstructed first 3D face according to the first 3D face model.
[0006] Optionally, the method also includes: obtaining a sample data set, the sample data set including samples of multiple facial images and second three-dimensional spatial information corresponding to each sample; performing facial key point detection on the facial image of each sample to obtain facial key points corresponding to each sample; inputting the facial key points corresponding to each sample into the deep learning network to obtain third three-dimensional spatial information output by the deep learning network; and training the deep learning network based on the second three-dimensional spatial information and the third three-dimensional spatial information to obtain the three-dimensional model.
[0007] Optionally, the deep learning network includes a multilayer perceptron, and the output of the multilayer perceptron is the three-dimensional coordinates and the posture parameters, the three-dimensional coordinates include the three-dimensional coordinates of the facial key points, and the posture parameters include the pitch angle, yaw angle and roll angle of the face.
[0008] Optionally, generating a reconstructed first 3D face based on the first 3D face model includes: acquiring first texture information and first detail information of the target face image; and adding the first texture information and the first detail information to the first 3D face model to obtain a reconstructed first 3D face.
[0009] Optionally, after generating a reconstructed first 3D face according to the first 3D face model, the method further includes: UV unfolding the reconstructed first 3D face to obtain a face unfolded image; acquiring a stylized image; extracting style features of the stylized image, and migrating the style features to the face unfolded image to obtain a stylized face unfolded image; and UV mapping the stylized face unfolded image to obtain a stylized first 3D face.
[0010] Optionally, the extracting style features of the stylized image and migrating the style features to the unfolded face image to obtain the stylized unfolded face image includes: extracting stylized parameters of the stylized image using a pre-trained extraction model; and rendering a stylized texture in the unfolded face image using a picture style transfer algorithm according to the stylized parameters to obtain the stylized unfolded face image.
[0011] Optionally, the method further comprises: acquiring a stylized image; extracting style features of the stylized image, and migrating the style features to the target face image to obtain a stylized face image;
[0012] The stylized facial image is input into the three-dimensional model to obtain fourth three-dimensional spatial information corresponding to the stylized facial image; a second offset is determined according to the fourth three-dimensional spatial information and the first three-dimensional spatial information; a second 3D facial model is generated according to the second offset and the average face model; second texture information and second detail information of the stylized facial image are obtained, and the second texture information and second detail information are added to the second 3D facial model to obtain a reconstructed second 3D face.
[0013] One aspect of an embodiment of the present application provides a face reconstruction device, including: an input module, used to input a target face image into a pre-trained three-dimensional model to obtain target three-dimensional spatial information corresponding to the target face image, wherein the three-dimensional model is obtained according to deep learning network training and is used to obtain three-dimensional spatial information of the input face image, and the three-dimensional spatial information includes three-dimensional coordinates and posture parameters; an acquisition module, used to obtain a pre-constructed average face model and first three-dimensional spatial information corresponding to the average face model; a determination module, used to determine a first offset according to the target three-dimensional spatial information and the first three-dimensional spatial information; a first generation module, used to generate a first 3D face model according to the first offset and the average face model; a second generation module, used to generate a reconstructed first 3D face according to the first 3D face model.
[0014] One aspect of an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor is used to implement the steps of the above-mentioned face reconstruction method when executing the computer program.
[0015] One aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by at least one processor to enable the at least one processor to perform the steps of the above-mentioned face reconstruction method.
[0016] The face reconstruction method, apparatus, computer device, and storage medium provided in the embodiments of the present application have the following advantages:
[0017] By inputting a target face image into a pre-trained three-dimensional model, target three-dimensional spatial information corresponding to the target face image is obtained, a pre-constructed average face model and first three-dimensional spatial information corresponding to the average face model are obtained, a first offset is determined according to the target three-dimensional spatial information and the first three-dimensional spatial information, a first 3D face model is generated according to the first offset and the average face model, and a reconstructed first 3D face is generated according to the first 3D face model. Three-dimensional spatial information such as the depth and three-dimensional structure of the face can be obtained according to the 2D face image, and there is no need to manually design a feature extractor. End-to-end output from 2D face images to three-dimensional spatial information of the face can be achieved, so that the model can adapt well to complex data distribution and tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A flowchart of a face reconstruction method according to the first embodiment of the present application is schematically shown;
[0019] Figure 2 for Figure 1 Flowchart of the newly added steps in S1;
[0020] Figure 3 Schematic diagram of training of three-dimensional model;
[0021] Figure 4 for Figure 1 Flow chart of the sub-steps of step S150;
[0022] Figure 5 for Figure 1 A flowchart of another newly added step in ;
[0023] Figure 6 for Figure 5 Flow chart of the sub-steps of step S330;
[0024] Figure 7 Schematic diagram for stylized reconstruction;
[0025] Figure 8 for Figure 1 A flowchart with another added step;
[0026] Fig. 9 A block diagram of a face reconstruction device according to a second embodiment of the present application is schematically shown;
[0027] Fig.10 The hardware architecture diagram of the computer device of the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0029] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0030] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.
[0031] The following is an explanation of the terms involved in this application:
[0032] 3D model, in the computer field, refers to a mathematical representation of an object or scene in three-dimensional space. These models are composed of a series of vertices, edges and faces, describing the shape and surface properties of the object, which together constitute the basic concepts used in computer graphics to create and process 3D models. 3D models are widely used in game development, film production, virtual reality and other fields.
[0033] Face reconstruction refers to restoring the 3D structure of a face from a series of images or videos. This process involves the technology of inferring 3D shape and surface properties from 2D images.
[0034] Hidden space refers to the potential space, which is used to represent the low-dimensional representation of input data. In deep learning, especially in generative models, the latent space is usually a low-dimensional vector space used to represent high-dimensional input data. By learning the structure and distribution of the latent space, data can be generated, reconstructed, or transformed. The dimension of the latent space is usually lower than that of the input data, so the data can be compressed into a more compact representation while retaining the important features of the data.
[0035] 3D scanning, also known as three-dimensional scanning, is a technology that uses a three-dimensional scanner to detect and analyze objects or environments in the real world. This technology can capture data such as the shape and color of an object and simulate a three-dimensional digital model of the actual object in a computer. 3D scanning is a safe way to explore the geometric characteristics of an object without physical contact, and the collected data is often used for three-dimensional reconstruction calculations.
[0036] Multilayer Perceptron (MLP) is a feedforward artificial neural network that maps a set of input vectors to a set of output vectors. MLP can be viewed as a directed graph consisting of multiple node layers, each of which is fully connected to the next layer. In addition to the input node, each node is a neuron with a nonlinear activation function.
[0037] Texture mapping is a technique in computer graphics that maps a two-dimensional image (called texture) onto the surface of a three-dimensional model to increase the realism and details of the model. Through texture mapping, the three-dimensional model can be given surface color, pattern, lighting and other effects without increasing the geometric complexity, making it more realistic.
[0038] UV unfolding is one of the commonly used techniques in the field of computer graphics, which is used to solve the problem of texture surface unfolding in the process of modeling, mapping and animation. Simply put, UV unfolding is the process of unfolding the surface of a three-dimensional model onto a two-dimensional plane and defining texture coordinates (i.e. UV coordinates) on this plane.
[0039] UV mapping is the process of projecting a 2D image onto a 3D surface for texture mapping in 3D modeling.
[0040] In related technologies, 2D face reconstruction cannot capture the depth and three-dimensional structure of the face, and traditional 3D face reconstruction requires manual design of feature extractors and cannot achieve end-to-end output.
[0041] The face reconstruction method of the embodiment of the present application can obtain the depth and three-dimensional structure of the face without manually designing a feature extractor, and can achieve end-to-end output.
[0042] It should be noted that the executor of the face reconstruction method in the embodiment of the present application can be a client or a server, wherein the client can be but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server can be implemented by an independent server or a server cluster composed of multiple servers.
[0043] The face reconstruction solution will be introduced through several embodiments below. For ease of understanding, the following exemplary description will be given with the server as the execution subject.
[0044] Embodiment 1
[0045] Figure 1 A flowchart of the face reconstruction method of the first embodiment of the present application is schematically shown. As shown in the figure, it may include steps S110 to S150, which are specifically described as follows:
[0046] Step S110, input the target face image into a pre-trained three-dimensional model to obtain target three-dimensional spatial information corresponding to the target face image, wherein the three-dimensional model is obtained according to deep learning network training and is used to obtain the three-dimensional spatial information of the input face image, and the three-dimensional spatial information includes three-dimensional coordinates and posture parameters.
[0047] The target facial image is a facial image authorized for use by a user corresponding to the target facial image.
[0048] The deep learning network can be a convolutional neural network, a recurrent neural network, etc. The specific deep learning network can be improved on the basis of the convolutional neural network and the recurrent neural network. In an exemplary embodiment, Figure 2 As shown, the training of the three-dimensional model may include steps S210 to S240:
[0049] Step S210: Acquire a sample data set, where the sample data set includes samples of multiple face images and second three-dimensional space information corresponding to each sample.
[0050] The second three-dimensional spatial information corresponding to the sample is the three-dimensional spatial information corresponding to the face image sample, and the second three-dimensional spatial information can be obtained by combining one or more methods such as 3D scanning technology, multi-view image reconstruction, and motion capture. Among them, the face image sample is a face image authorized for use by the user corresponding to the face image.
[0051] Step S220, performing facial key point detection on the facial image of each sample to obtain the facial key points corresponding to each sample.
[0052] Facial key point detection is a technology in the field of computer vision that aims to accurately locate specific key points from facial images, such as key points at the eyes, nose, mouth, etc. The detection of these key points is crucial for many applications, such as face recognition, expression analysis, posture estimation, etc. Facial key points play an important role in the reconstruction of 3D facial models because they provide key information about the structure and shape of the face:
[0053] Locating facial structure: Facial key points can help locate the main structures of the face, such as the eyes, nose, mouth, etc. These key points provide the basis for determining the position of the facial structure in 3D space.
[0054] Providing shape information: Through the location of key points, we can obtain information about the shape and contour of the face, which is crucial for building an accurate 3D model.
[0055] Step S230: input the facial key points corresponding to each sample into the deep learning network to obtain the third three-dimensional space information output by the deep learning network.
[0056] Among them, the third three-dimensional spatial information is the three-dimensional spatial information obtained after the face image sample is learned by the deep learning network.
[0057] In an exemplary embodiment, the deep learning network includes a multilayer perceptron, the output of which is three-dimensional coordinates and posture parameters corresponding to a face image, wherein the three-dimensional coordinates include the three-dimensional coordinates of key points of the face, and the posture parameters include the pitch angle, yaw angle, and roll angle of the face.
[0058] Step S240: training a deep learning network according to the second three-dimensional spatial information and the third three-dimensional spatial information to obtain a three-dimensional model.
[0059] Specifically, the mean square error can be used as a loss function to calculate the error between the second three-dimensional spatial information and the third three-dimensional spatial information, and the network parameters can be adjusted through optimization algorithms such as back propagation and gradient descent to enable it to accurately predict the coordinates and angles of the 3D face. Then, the model can be verified using a validation set, and tuned based on the validation results, and the performance of the model can be evaluated on the test set to ensure that the model performs well in unseen data to obtain a trained three-dimensional model. Optionally, the sample can also correspond to a portrait 3D model. During the training process, the predicted 3D face can be further obtained based on the output three-dimensional spatial information, and the mean square error can be calculated based on the portrait 3D model corresponding to the sample and the predicted 3D face as another loss function to train the model.
[0060] Please refer to Figure 3 , which is a schematic diagram of the training of the three-dimensional model. As shown in the figure, the key points of the input face image are detected, and the detected face key points are input into the 3D feature extraction module composed of the deep learning network. The three-dimensional spatial information corresponding to the face image is output, and the loss function 1 is calculated by comparing with the three-dimensional spatial information of the image. The loss function 2 can also be calculated by comparing the predicted 3D face model with the face model originally corresponding to the image. Through training, tuning, verification, and testing, a trained three-dimensional model is finally obtained.
[0061] In the embodiment corresponding to steps S210 to S240, by acquiring a sample data set, facial key point detection is performed on the facial image of each sample to obtain the facial key points corresponding to each sample; the facial key points corresponding to each sample are input into a deep learning network to obtain the three-dimensional spatial information output by the deep learning network, and then the deep learning network is trained based on the three-dimensional spatial information corresponding to the sample and the output three-dimensional spatial information to obtain a trained three-dimensional model. The three-dimensional model that outputs the corresponding three-dimensional spatial information according to the facial image can be effectively trained to facilitate the reconstruction of the three-dimensional face.
[0062] Step S120: Acquire a pre-constructed average face model and first three-dimensional space information corresponding to the average face model.
[0063] Among them, the average face model can be obtained by averaging a large amount of face data, representing a typical face with average three-dimensional coordinates and posture parameters; accordingly, the first three-dimensional spatial information is the three-dimensional spatial information of the average face model, that is, the average three-dimensional coordinates and posture parameters; in addition, the face data corresponding to the average face model is the face data authorized for use by the user corresponding to the face data.
[0064] Step S130: determining a first offset according to the target three-dimensional space information and the first three-dimensional space information.
[0065] The first offset may be obtained by comparing the difference between the target three-dimensional space information and the data corresponding to the first three-dimensional space information.
[0066] Step S140: generating a first 3D face model according to the first offset and the average face model.
[0067] The parameters corresponding to the average face model can be adjusted accordingly according to the first offset, so as to obtain a first 3D face model corresponding to the target face image. Specifically, the coordinate and angle parameters of the average face model can be added to the corresponding first offset respectively, so as to generate a new face model, namely the first 3D face model.
[0068] Step S150: generating a reconstructed first 3D face according to the first 3D face model.
[0069] In an exemplary embodiment, Figure 4 As shown, step S150 may specifically include steps S151 to S152:
[0070] Step S151, obtaining first texture information and first detail information of a target face image.
[0071] The first texture information may include skin texture, hair texture (hair, eyebrows and beard, etc.), wrinkles, spots and moles, and other textures and corresponding colors, etc. The first detail information may include detail information such as eyes, mouth, lighting, shadows, etc.
[0072] Step S152: adding the first texture information and the first detail information to the first 3D face model to obtain a reconstructed first 3D face.
[0073] Specifically, the first texture information and the first detail information are added to the first 3D face model through texture mapping technology, so as to obtain a reconstructed first 3D face with a sense of reality.
[0074] In the embodiment corresponding to steps S151 to S152, by acquiring the first texture information and the first detail information of the target facial image, adding the first texture information and the first detail information to the first 3D facial model, a reconstructed first 3D face is obtained, which can effectively improve the authenticity of the reconstructed 3D face.
[0075] The face reconstruction method provided in the embodiment of the present application obtains target three-dimensional spatial information corresponding to the target face image by inputting a target face image into a pre-trained three-dimensional model, obtains a pre-built average face model and first three-dimensional spatial information corresponding to the average face model, determines a first offset according to the target three-dimensional spatial information and the first three-dimensional spatial information, generates a first 3D face model according to the first offset and the average face model, and generates a reconstructed first 3D face according to the first 3D face model. Three-dimensional spatial information such as the depth and three-dimensional structure of the face can be obtained according to the 2D face image, and there is no need to manually design a feature extractor. End-to-end output from 2D face images to three-dimensional spatial information of the face can be achieved, so that the model can adapt well to complex data distribution and tasks.
[0076] In an exemplary embodiment, after step S150, as Figure 5 As shown, the face reconstruction method of the embodiment of the present application may further include steps S310 to S340:
[0077] Step S310, UV unfolding the reconstructed first 3D face to obtain a face unfolding image.
[0078] Step S320: obtaining a stylized image.
[0079] The styles corresponding to the stylized images may include, but are not limited to, cartoons, comics, oil paintings, sculptures, watercolors, ink paintings, etc. The stylized images may be stylized templates, and the stylized features of these templates may be learned from artworks through deep learning techniques.
[0080] Step S330: extracting style features of the stylized image, and transferring the style features to the face expansion image to obtain a stylized face expansion image.
[0081] In an exemplary embodiment, if Figure 6 As shown, step S330 may include steps S331 to S332:
[0082] Step S331: extracting stylized parameters of the stylized image using a pre-trained extraction model.
[0083] Step S332: Rendering a stylized texture in the unfolded face image using a picture style transfer algorithm according to the stylized parameters to obtain a stylized unfolded face image.
[0084] Among them, the image style transfer algorithm can use AdaIN, where AdaIN is a classic image style transfer algorithm, which is mainly used to transfer the style and texture in one image (style map) to another image (content map) while retaining the main structure of the content map.
[0085] In the embodiment corresponding to steps S331 to S332, a pre-trained extraction model is used to extract stylized parameters of a stylized image, and a picture style transfer algorithm is used to render a stylized texture in the unfolded face image according to the stylized parameters to obtain a stylized unfolded face image. This can effectively transfer the style of the stylized image to the unfolded face image.
[0086] Step S340: UV mapping is performed on the stylized face unfolded image to obtain a stylized first 3D face.
[0087] Please refer to Figure 7 , which is a schematic diagram of stylized reconstruction. As shown in the figure, three-dimensional space information can be obtained according to the input face image, and a 3D face model can be generated according to the three-dimensional space information, wherein 3D face models at different angles can be obtained by adjusting corresponding posture parameters; after obtaining the 3D face model, the 3D face model is unfolded, the style of the stylized photo or template is transferred to the unfolded image, and then UV mapping is performed to obtain a stylized reconstructed image.
[0088] In the embodiment corresponding to steps S310 to S340, by unfolding the reconstructed first 3D face to obtain an unfolded face image, acquiring a stylized image, extracting style features of the stylized image, migrating the style features to the unfolded face image to obtain a stylized unfolded face image, and UV mapping the stylized unfolded face image to obtain a stylized first 3D face, stylized reconstruction of the face can be achieved, the expression of face reconstruction can be enriched, and a variety of choices can be provided to users, which helps to meet the personalized needs of users and improve user experience.
[0089] In an exemplary embodiment, if Figure 8 As shown, the face reconstruction method of the embodiment of the present application may also include steps S410 to S460:
[0090] Step S410: obtaining a stylized image.
[0091] Step S420: extracting style features of the stylized image, and transferring the style features to the target face image to obtain a stylized face image.
[0092] Step S430: input the stylized face image into the three-dimensional model to obtain fourth three-dimensional space information corresponding to the stylized face image.
[0093] Step S440: determine a second offset according to the fourth three-dimensional space information and the first three-dimensional space information.
[0094] Step S450: Generate a second 3D face model according to the second offset and the average face model.
[0095] Step S460: Acquire second texture information and second detail information of the stylized face image, add the second texture information and the second detail information to a second 3D face model, and obtain a reconstructed second 3D face.
[0096] The fourth three-dimensional spatial information is three-dimensional spatial information of a stylized face.
[0097] It can be understood that the order of this embodiment is different from that of the aforementioned stylized reconstruction embodiment. In this embodiment, the target face image is first stylized, and then a 3D face model is generated based on the stylized image, and then the texture and details of the stylized image are added to the 3D face model.
[0098] Embodiment 2
[0099] Fig. 9The block diagram of the face reconstruction device 500 according to the second embodiment of the present application is schematically shown. The face reconstruction device 500 can be divided into one or more program modules, and one or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment.
[0100] like Fig. 9 As shown, the face reconstruction apparatus 500 may include an input module 510 , an acquisition module 520 , a determination module 530 , a first generation module 540 and a second generation module 550 .
[0101] An input module 510 is used to input a target face image into a pre-trained three-dimensional model to obtain target three-dimensional spatial information corresponding to the target face image, wherein the three-dimensional model is obtained according to deep learning network training and is used to obtain the three-dimensional spatial information of the input face image, and the three-dimensional spatial information includes three-dimensional coordinates and posture parameters;
[0102] An acquisition module 520, configured to acquire a pre-constructed average face model and first three-dimensional space information corresponding to the average face model;
[0103] A determination module 530, configured to determine a first offset according to the target three-dimensional space information and the first three-dimensional space information;
[0104] A first generating module 540, configured to generate a first 3D face model according to the first offset and the average face model;
[0105] The second generating module 550 is configured to generate a reconstructed first 3D face according to the first 3D face model.
[0106] In an exemplary embodiment, the face reconstruction device 500 is also used to: obtain a sample data set, the sample data set including samples of multiple face images and second three-dimensional spatial information corresponding to each sample; perform face key point detection on the face image of each sample to obtain the face key points corresponding to each sample; input the face key points corresponding to each sample into the deep learning network to obtain the third three-dimensional spatial information output by the deep learning network; train the deep learning network according to the second three-dimensional spatial information and the third three-dimensional spatial information to obtain the three-dimensional model.
[0107] In an exemplary embodiment, the deep learning network includes a multilayer perceptron, and the output of the multilayer perceptron is the three-dimensional coordinates and the posture parameters, the three-dimensional coordinates include the three-dimensional coordinates of the facial key points, and the posture parameters include the pitch angle, yaw angle and roll angle of the face.
[0108] In an exemplary embodiment, the second generation module 550 is further used to: obtain first texture information and first detail information of the target facial image; add the first texture information and first detail information to the first 3D face model to obtain a reconstructed first 3D face.
[0109] In an exemplary embodiment, the face reconstruction device 500 is also used to: UV unfold the reconstructed first 3D face to obtain a face unfolded image; obtain a stylized image; extract style features of the stylized image, and transfer the style features to the face unfolded image to obtain a stylized face unfolded image; UV map the stylized face unfolded image to obtain a stylized first 3D face.
[0110] In an exemplary embodiment, the face reconstruction device 500 is also used to: use a pre-trained extraction model to extract stylized parameters of the stylized image; and use a picture style transfer algorithm to render a stylized texture in the face unfolded image according to the stylized parameters to obtain a stylized face unfolded image.
[0111] In an exemplary embodiment, the face reconstruction device 500 is also used to: obtain a stylized image; extract style features of the stylized image, and transfer the style features to the target face image to obtain a stylized face image; input the stylized face image into the three-dimensional model to obtain fourth three-dimensional spatial information corresponding to the stylized face image; determine a second offset based on the fourth three-dimensional spatial information and the first three-dimensional spatial information; generate a second 3D face model based on the second offset and the average face model; obtain second texture information and second detail information of the stylized face image, and add the second texture information and second detail information to the second 3D face model to obtain a reconstructed second 3D face.
[0112] Embodiment 3
[0113] Fig.10 The hardware architecture diagram of a computer device 600 suitable for the face reconstruction method according to the third embodiment of the present application is schematically shown. The computer device 600 can be a device that can automatically perform numerical calculations and / or data processing according to pre-set or stored instructions. For example, it can be a rack server, a blade server, a tower server or a cabinet server (including an independent server, or a server cluster composed of multiple servers), a gateway, etc. Fig.10 As shown, the computer device 600 includes at least but is not limited to: a memory 610, a processor 620, and a network interface 630 which can communicate with each other through a system bus. Among them:
[0114] The memory 610 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 610 can be an internal storage module of the computer device 600, such as a hard disk or memory of the computer device 600. In other embodiments, the memory 610 can also be an external storage device of the computer device 600, such as a plug-in hard disk equipped on the computer device 600, a smart memory card (Smart Media Card, referred to as SMC), a secure digital (Secure Digital, referred to as SD) card, a flash card, etc. Of course, the memory 610 can also include both the internal storage module of the computer device 600 and its external storage device. In this embodiment, the memory 610 is generally used to store the operating system and various application software installed on the computer device 600, such as the program code of the face reconstruction method, etc. In addition, the memory 610 can also be used to temporarily store various types of data that have been output or are to be output.
[0115] In some embodiments, the processor 620 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 620 is generally used to control the overall operation of the computer device 600, such as performing control and processing related to data interaction or communication with the computer device 600. In this embodiment, the processor 620 is used to run the program code stored in the memory 610 or process data.
[0116] The network interface 630 may include a wireless network interface or a wired network interface, and the network interface 630 is generally used to establish a communication link between the computer device 600 and other computer devices. For example, the network interface 630 is used to connect the computer device 600 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 600 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0117] It should be pointed out that Fig.10 Only a computer device having components 610 - 630 is shown, but it should be understood that implementing all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0118] In this embodiment, the face reconstruction method stored in the memory 610 can also be divided into one or more program modules and executed by one or more processors (processor 620 in this embodiment) to complete the embodiment of the present application.
[0119] Embodiment 4
[0120] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the face reconstruction method in the embodiment are implemented.
[0121] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, referred to as SMC), a secure digital (Secure Digital, referred to as SD) card, a flash card, etc. Of course, the computer-readable storage medium may also include both an internal storage unit of a computer device and an external storage device thereof. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on the computer device, such as the program code of the face reconstruction method in the embodiment, etc. In addition, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
[0122] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0123] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A face reconstruction method, characterized in that: include: Input the target face image into a pre-trained three-dimensional model to obtain target three-dimensional spatial information corresponding to the target face image, wherein the three-dimensional model is obtained according to deep learning network training and is used to obtain the three-dimensional spatial information of the input face image, and the three-dimensional spatial information includes three-dimensional coordinates and posture parameters; Acquire a pre-constructed average face model and first three-dimensional space information corresponding to the average face model; determining a first offset according to the target three-dimensional space information and the first three-dimensional space information; generating a first 3D face model according to the first offset and the average face model; A reconstructed first 3D human face is generated according to the first 3D human face model.
2. The face reconstruction method according to claim 1, characterized in that: The method further comprises: Acquire a sample data set, where the sample data set includes samples of multiple face images and second three-dimensional space information corresponding to each sample; Perform facial key point detection on the face image of each sample to obtain the facial key points corresponding to each sample; Inputting the facial key points corresponding to each sample into the deep learning network, and obtaining the third three-dimensional space information output by the deep learning network; The deep learning network is trained according to the second three-dimensional spatial information and the third three-dimensional spatial information to obtain the three-dimensional model.
3. The face reconstruction method according to claim 2, characterized in that: The deep learning network includes a multilayer perceptron, and the output of the multilayer perceptron is the three-dimensional coordinates and the posture parameters. The three-dimensional coordinates include the three-dimensional coordinates of the key points of the face, and the posture parameters include the pitch angle, yaw angle and roll angle of the face.
4. The face reconstruction method according to any one of claims 1 to 3, characterized in that: The step of generating a reconstructed first 3D face according to the first 3D face model comprises: Acquire first texture information and first detail information of the target face image; The first texture information and the first detail information are added to the first 3D face model to obtain a reconstructed first 3D face.
5. The face reconstruction method according to claim 4, characterized in that: After generating the reconstructed first 3D face according to the first 3D face model, the method further includes: Performing UV unfolding on the reconstructed first 3D human face to obtain a human face unfolded image; Get a stylized image; Extracting style features of the stylized image, and transferring the style features to the expanded face image to obtain a stylized expanded face image; The stylized face unfolded image is subjected to UV mapping to obtain a stylized first 3D face.
6. The face reconstruction method according to claim 5, characterized in that: The step of extracting the style features of the stylized image and transferring the style features to the expanded face image to obtain the stylized expanded face image includes: Extracting stylized parameters of the stylized image using a pre-trained extraction model; A stylized texture is rendered in the expanded face image using a picture style transfer algorithm according to the stylized parameters to obtain a stylized expanded face image.
7. The face reconstruction method according to claim 1, characterized in that: The method further comprises: Get a stylized image; Extracting style features of the stylized image, and transferring the style features to the target face image to obtain a stylized face image; Inputting the stylized face image into the three-dimensional model to obtain fourth three-dimensional space information corresponding to the stylized face image; determining a second offset according to the fourth three-dimensional spatial information and the first three-dimensional spatial information; generating a second 3D face model according to the second offset and the average face model; Acquire second texture information and second detail information of the stylized facial image, add the second texture information and the second detail information to the second 3D facial model, and obtain a reconstructed second 3D facial model.
8. A face reconstruction device, characterized in that: include: An input module, used to input a target face image into a pre-trained three-dimensional model to obtain target three-dimensional spatial information corresponding to the target face image, wherein the three-dimensional model is obtained according to deep learning network training and is used to obtain the three-dimensional spatial information of the input face image, and the three-dimensional spatial information includes three-dimensional coordinates and posture parameters; An acquisition module, used to acquire a pre-built average face model and first three-dimensional space information corresponding to the average face model; a determination module, configured to determine a first offset according to the target three-dimensional space information and the first three-dimensional space information; A first generating module, configured to generate a first 3D face model according to the first offset and the average face model; The second generating module is used to generate a reconstructed first 3D face according to the first 3D face model.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it is used to implement the steps of the face reconstruction method described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program can be executed by at least one processor to enable the at least one processor to perform the steps of the face reconstruction method according to any one of claims 1 to 7.
