Method for establishing face generation model and face generation method

By extracting the three-dimensional vertex matrix and posture information from the side face image from a single perspective, a frontal face image with artifacts is generated, and the generation network is used to remove the artifacts, which solves the problem of unrealistic frontal face generation in the existing technology. problem, achieving more realistic and high-quality image generation.

CN112613460BActive Publication Date: 2024-08-23SHENZHEN WEIFU CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011604398.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-30
Publication Date
2024-08-23
Estimated Expiration
2040-12-30

AI Technical Summary

Technical Problem

Existing frontal face image generation methods based on deep learning rely on multi-view image data sets, causing the generation results to be limited by the scale and scope of the data source, and it is difficult to consider the posture information of the person in the image, resulting in the generated frontal face being unrealistic.

Method used

By obtaining the original side face image from a single perspective, extracting the three-dimensional vertex matrix and posture information, mapping it to a two-dimensional space, generating a frontal face image with artifacts, using the generation network and the discriminant network for training, removing artifacts, and generating Frontal face images without artifacts, and the quality of side faces is used to indirectly judge the generation effect of frontal faces.

Benefits of technology

It solves the problem that frontal face image generation is limited by data sources, takes into account the posture information of the person in the image, ensures the authenticity of the generated image, and improves the image generation effect through the quality of side faces.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112613460B
    Figure CN112613460B
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method for establishing a face generation model and a face generation method, and the method for establishing a face generation model includes: obtaining an original side face image of a single perspective, obtaining a three-dimensional vertex matrix and first posture information of the face from the original side face image; obtaining first texture information through the three-dimensional vertex matrix and the first posture information; obtaining a front face and a side face with artifacts based on the three-dimensional vertex matrix, the first posture information and the first texture information; then inputting the two images into a generation network to obtain a front face and a side face without artifacts; by inputting the original side face and the side face without artifacts into a discrimination network, a loss function value is obtained to update the generation network and the discrimination network, and a face generation model is obtained. The technical solution disclosed by the present invention solves the problem that the current front face image generation is limited by the scale and range of the data source, and can generate faces with higher accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image generation, and in particular to a method for establishing a face generation model and a face generation method. Background Art

[0002] Frontal face images are widely used in face recognition, video surveillance, and identity verification. Due to the boom in machine learning and deep learning technologies, the application and accuracy of face recognition have increased significantly. Therefore, generating frontal images from non-frontal face images has gradually attracted attention.

[0003] However, the frontal face image generation method based on deep learning is heavily dependent on datasets with multi-view images of the same person. The generation results are limited by the scale and scope of the data source, and it is difficult to consider the posture information of the person in the image, resulting in the generated frontal face not being realistic enough. Summary of the invention

[0004] In view of the above situation that the generation of the frontal image is limited by the data source and the generated result is not realistic, the present invention proposes a method for establishing a face generation model and a face generation method.

[0005] In a first aspect, a first embodiment of the present invention provides a method for establishing a face generation model, comprising:

[0006] Obtain the original side face image of a single perspective in the training set;

[0007] Acquire a three-dimensional vertex matrix and first posture information of the face according to the original side face image;

[0008] Mapping the three-dimensional vertex matrix and the first posture information to a two-dimensional space to obtain first texture information;

[0009] Obtaining a front face image with artifacts and a side face image with artifacts through the three-dimensional vertex matrix, the first posture information, and the first texture information;

[0010] Inputting the front face image with artifacts and the side face image with artifacts into the generation network to generate the front face image without artifacts and the side face image without artifacts;

[0011] Input the original side face image and the side face image without artifacts into the identification network to obtain the loss function value;

[0012] With the goal of minimizing the loss function value, the generation network and the identification network are trained to obtain a face generation model.

[0013] Furthermore, the method for establishing the above face generation model further includes:

[0014] Inputting the three-dimensional vertex matrix, the first posture information, and the first texture information into a neural network renderer to obtain a rendered side face image;

[0015] Performing image erosion on the rendered side face image, and extracting second texture information of the image-eroded front face image;

[0016] Performing a preset first rotation operation on the first posture information to obtain second posture information;

[0017] The three-dimensional vertex matrix, the second posture information and the second texture information are input into a neural network renderer to obtain a front face image with artifacts, and a side face image with artifacts is obtained through the front face image with artifacts.

[0018] Furthermore, the method for establishing the above face generation model further includes:

[0019] Performing image erosion on the front face image with artifacts, and extracting third texture information of the image eroded front face image with artifacts;

[0020] Performing a preset second rotation operation on the second posture information to obtain third posture information;

[0021] The three-dimensional vertex matrix, the third posture information and the third texture information are input into the neural network renderer to obtain a side face image with artifacts.

[0022] Furthermore, the method for establishing the above face generation model further includes:

[0023] Inputting the front face image with artifacts and the side face image with artifacts into the downsampling layer and the feature extraction layer connected in sequence in the generation network to obtain a first feature vector and a second feature vector;

[0024] The downsampling layer includes at least one 7*7 convolutional layer and four 3*3 convolutional layers connected in sequence, and the feature extraction layer includes nine feature extraction blocks connected in sequence, each feature extraction block includes at least one attention layer, one 3*3 convolutional layer and one SPADE layer;

[0025] Inputting the first eigenvector and the second eigenvector into an upsampling layer in a generation network to generate a front face image without artifacts and a side face image without artifacts;

[0026] Among them, the upsampling layer includes at least four 3*3 convolutional layers and one 7*7 convolutional layer connected in sequence.

[0027] Furthermore, the method for establishing the above face generation model further includes:

[0028] Acquire first illumination data of an original side face image and second illumination data of a front face image without artifacts, and obtain a first illumination loss value through the first illumination data and the second illumination data;

[0029] With the goal of minimizing the first illumination loss value, optimizing the front face image without artifacts to obtain a first image;

[0030] The original side face image is used as an input image, the first image is used as a guide image, inputted into a guide filter, and the first image is updated to obtain a second image;

[0031] Acquire third illumination data of the second image, and obtain a second illumination loss value through the first illumination data and the third illumination data;

[0032] The second image is optimized again with the goal of minimizing the second illumination loss value.

[0033] In a second aspect, a second embodiment of the present invention provides a method for generating a human face, comprising:

[0034] Acquire a side face image from a single perspective;

[0035] Obtaining the three-dimensional vertex matrix and posture information of the face according to the side face image;

[0036] Map the three-dimensional vertex matrix and posture information to two-dimensional space to obtain the texture information of the side face image;

[0037] Through the three-dimensional vertex matrix, posture information and texture information, a frontal face image with artifacts is obtained;

[0038] The frontal face image is input into a face generation model to generate a frontal face image without artifacts, wherein the face generation model is obtained by the method in the first aspect above.

[0039] In a third aspect, a third embodiment of the present invention provides a device for establishing a face generation model, comprising:

[0040] A sample acquisition module is used to obtain the original side face images of a single perspective in the training set;

[0041] A first extraction module, used for acquiring a three-dimensional vertex matrix and first posture information of a face according to an original side face image;

[0042] A second extraction module, used for mapping the three-dimensional vertex matrix and the first posture information to a two-dimensional space to obtain first texture information;

[0043] An artifact image acquisition module, used to obtain a front face image with artifacts and a side face image with artifacts through a three-dimensional vertex matrix, the first posture information and the first texture information;

[0044] A generation module, used for inputting the front face image with artifacts and the side face image with artifacts into the generation network to generate the front face image without artifacts and the side face image without artifacts;

[0045] The identification module is used to input the original side face image and the side face image without artifacts into the identification network to obtain a loss function value;

[0046] The training module is used to train the generation network and the identification network with the goal of minimizing the loss function value to obtain a face generation model.

[0047] In a fourth aspect, a fourth embodiment of the present invention provides a face generation device, comprising:

[0048] An acquisition module, used for acquiring a side face image of a single viewing angle;

[0049] The first acquisition module is used to obtain the three-dimensional vertex matrix and posture information of the face according to the side face image;

[0050] The second acquisition module is used to map the three-dimensional vertex matrix and posture information into a two-dimensional space to obtain texture information of the side face image;

[0051] An artifact image generation module is used to obtain a frontal face image with artifacts through a three-dimensional vertex matrix, posture information, and texture information;

[0052] An artifact removal module is used to input a frontal face image into a face generation model to generate a frontal face image without artifacts, wherein the face generation model is obtained by any of the face generation model establishment methods in the first aspect described above.

[0053] In a fifth aspect, a fifth embodiment of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, it executes the method for establishing a face generation model in the first aspect or the method for generating a face in the second aspect.

[0054] In a sixth aspect, a sixth embodiment of the present invention provides a computer-readable medium, on which a computer program is stored. When the computer program runs on a processor, it executes the method for establishing a face generation model in the first aspect or the method for generating a face in the second aspect.

[0055] The method for establishing the above-mentioned face generation model obtains an original side face image of a single perspective in a training set, and then obtains a three-dimensional vertex matrix and first posture information of the face from the original side face image; maps the three-dimensional vertex matrix and the first posture information to a two-dimensional space to obtain first texture information; based on the three-dimensional vertex matrix, the first posture information and the first texture information, obtains a front face image with artifacts and a side face image with artifacts; then inputs the two images into a generation network to remove artifacts, that is, generates a front face image without artifacts and a side face image without artifacts; by inputting the original side face and the side face image without artifacts into a discrimination network, the quality of the side face image without artifacts is obtained, and the quality of the generated front face image is indirectly obtained; the loss function value is obtained through the side face image without artifacts and the original side face, and the training generation network and the discrimination network are updated based on minimizing the loss function value, thereby obtaining a trained face generation model. The method for establishing a face generation model provided by the present invention uses the original side face image under a single perspective to generate a front face with artifacts and a side face with artifacts, and uses an adversarial network to eliminate the artifacts in the two faces, and indirectly judges the generation effect of the front face by the quality of the side face. Based on the above scheme, the method for establishing a face generation model provided by the present invention solves the problem that the current front face image generation is limited by the scale and range of the data source, and also takes into account the posture information of the person in the image when generating the image, thereby ensuring the authenticity of the generated image; and then indirectly judges the quality of the front face by the quality of the side face, further improving the generation effect of the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope of protection of the present invention. In each of the drawings, similar components are numbered similarly.

[0057] Figure 1 A schematic diagram of a process for establishing a face generation model of the present invention is shown;

[0058] Figure 2 A schematic diagram of a generated face with artifacts is shown;

[0059] Figure 3 A schematic diagram of a flow chart of S140 in the method for establishing a face generation model of the present invention is shown;

[0060] Figure 4 Another schematic diagram of the process of S140 in the method for establishing a face generation model of the present invention is shown;

[0061] Figure 5A schematic diagram of a process of generating a front face without artifacts from a front face with artifacts is shown;

[0062] Figure 6 Another schematic flow chart of the method for establishing a face generation model of the present invention is shown;

[0063] Figure 7 A schematic diagram of a process of the face generation method of the present invention is shown;

[0064] Figure 8 A schematic diagram of the structure of a device for establishing a face generation model of the present invention is shown;

[0065] Fig. 9 A structural schematic diagram of the face generation device of the present invention is shown. DETAILED DESCRIPTION

[0066] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0067] The components of the embodiments of the present invention generally described and shown in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0068] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present invention, are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.

[0069] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0070] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present invention belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present invention.

[0071] Example 1

[0072] In this embodiment, see Figure 1 , shows a method for establishing a face generation model, comprising the following steps:

[0073] S110, obtaining an original side face image of a single perspective in a training set.

[0074] Specifically, the training set used in the present application for training a neural network includes multiple side face images taken from different perspectives under different lighting conditions; however, during training, only side face images taken from the same perspective are extracted for training.

[0075] S120, acquiring a three-dimensional vertex matrix and first posture information of the face according to the original side face image.

[0076] Specifically, this embodiment extracts the three-dimensional vertex matrix and posture information in the original side face image through the 3DDFA-V2 (3 Dimensional Dense Face Alignment-Version 2) algorithm.

[0077] Among them, the 3DDFA-V2 algorithm is a 3D-assisted short video synthesis method that can simulate the movement of human faces in and out of the plane, thereby converting a still image into a short video, and obtaining the three-dimensional vertex coordinates of the face based on the static image, as well as estimating the character's posture.

[0078] The posture information, i.e., the orientation of the three-dimensional target object in the image, is represented in the form of a matrix. In this embodiment, the posture of a person is estimated by 3DDFA-V2 on the side face image, thereby obtaining the posture information of the person, i.e., the body orientation and sight direction of the person.

[0079] S130, mapping the three-dimensional vertex matrix and the first posture information to a two-dimensional space to obtain first texture information.

[0080] Specifically, each vertex of a face in three-dimensional space has corresponding texture information in RGB (Red-Green-Blue) space. This embodiment maps each vertex in a three-dimensional image to a two-dimensional space by orthogonal projection, thereby obtaining texture features of each vertex in the face image.

[0081] Furthermore, when the vertex mapping is completed by orthogonal projection, the result of the projection, that is, the first texture information, is independent of the coordinates of the Z axis in the three-dimensional vertex coordinates, so that when the image is rotated from the two-dimensional space to the three-dimensional space, there are multiple identical vertices, and the texture features of these vertices are the same. Therefore, this embodiment only maps the texture information in the three-dimensional space to the vertex with the largest Z axis value in the three-dimensional vertex matrix of the face. Therefore, in the subsequent steps, the rationality of the texture information is guaranteed and the quality of image generation is improved.

[0082] Exemplarily, the acquisition of the first texture information can be described by the following formula:

[0083] K j = argmax k ([0,0,1]*v k )

[0084] Among them, [0,0,1,]*v k Represents the z-axis coordinates of k vertices; argmax k ([0,0,1,]*v k ) represents selecting the vertex with the largest z coordinate from the k vertices; K j It means that among the k vertices with the same horizontal and vertical coordinates, the jth vertex has the largest z-axis coordinate.

[0085] S140, obtaining a front face image with artifacts and a side face image with artifacts through the three-dimensional vertex matrix, the first posture information and the first texture information.

[0086] Specifically, after the three-dimensional vertex matrix, the first posture information and the first texture information are rotated, rendered and eroded, a front face image and a side face image are obtained; since the extracted texture feature is the texture of the original side face image, the texture of the other side of the generated face is uncertain. Therefore, the front face image and the side face image obtained after the rotation, rendering and erosion operations have artifacts.

[0087] S150, inputting the front face image with artifacts and the side face image with artifacts into a generation network to generate a front face image without artifacts and a side face image without artifacts.

[0088] Exemplary, reference Figure 2 , Figure 2A schematic diagram of a human face with artifacts is shown, where 151 is the artifact.

[0089] S160, inputting the original side face image and the side face image without artifacts into the identification network to obtain a loss function value.

[0090] Specifically, this embodiment uses an adversarial network to eliminate artifacts in the frontal face image and the side face image, and then inputs the original side face image and the artifact-free side face image output by the generation network into the identification network. The identification network is used to judge the quality of the generated artifact-free side face image, thereby indirectly deriving the quality of the generated artifact-free frontal face image.

[0091] Preferably, the identification network can be a multi-level discriminator based on pix2pixHD; the loss function value includes adversarial loss, feature matching loss and perceptual loss.

[0092] Specifically, the adversarial loss is obtained by the following formula:

[0093] L Gan (G,D)=E I [lodD(I a )]+E Rd [log(1-D(G(F a ))]

[0094] Among them, G represents the generation network, D represents the identification network, and D(I a ) represents the predicted value of the real image, that is, the predicted value of the original side face image, E I represents the distribution probability of the real sample, that is, the distribution probability of the original side face image, D(G(F a )) represents the sample F obtained by generating the network G a The predicted value, E Rd represents the distribution probability of the generated samples, that is, the classification probability of the frontal face image without artifacts, L GAN (G,D) means fighting against loss.

[0095] The feature matching loss is calculated by the distance between the features of the original side face image extracted by each level of the discriminator and the features of the front face image without artifacts. The specific formula is as follows:

[0096]

[0097] Among them, N D represents the number of layers of the identification network, represents the feature information extracted by the i-th layer of the identification network from the original side face image, represents the feature information extracted by the i-th layer of the identification network from the generated side face image; L FM (G,D) is the feature matching loss.

[0098] The perceptual loss is calculated using a pre-trained VGG network. That is, the features of the original side face image and the generated side face image without artifacts are extracted by VGG, and the loss is calculated based on the features of the two images. The specific formula is as follows:

[0099]

[0100] Similarly, similar to the feature matching loss, the perceptual loss is also calculated by calculating the features of the original side face image and the generated side face image without artifacts through the network of each layer of VGG; in this embodiment, the perceptual loss is used to adjust the generated result and the generated identity.

[0101] In summary, the loss function value in this embodiment is obtained by the following formula:

[0102] L total =L GAN +λ 1 L FM +λ 2 L VGG

[0103] Among them, λ 1 and λ 2 It is a preset scale parameter and can be adjusted according to the actual scene.

[0104] Based on the method of obtaining the above loss function, the difference between the generated image and the original image is more accurate, thereby ensuring that the network update is more reasonable and improving the training speed and efficiency.

[0105] S170, with the goal of minimizing the loss function value, training the generation network and the identification network to obtain a face generation model.

[0106] The identification network obtains a loss function value based on the difference between the original side face image and the side face image without artifacts; then the generation network and the identification network are reversely updated to minimize the loss function value. When the F1 parameter (F1-score) is large enough or the loss value is stable to a minimum value, the generation network and the identification network are considered to be trained. In other words, when the image generated by the generation network is real enough and it is difficult for the identification network to judge the difference between the generated image and the real image, the face generation model of this embodiment is obtained.

[0107] Based on the above scheme, the method for establishing a face generation model provided in this embodiment solves the problem that the current generation of frontal face images is limited by the scale and range of the data source, and also takes into account the posture information of the person in the image when generating the image, thereby ensuring the authenticity of the generated image; and then indirectly judges the quality of the frontal face by the quality of the side face, thereby further improving the image generation effect.

[0108] Further, see Figure 3 , Figure 3 A schematic flow chart of S140 in the method for establishing a face generation model of the present invention is shown, that is, the above S140 includes the following steps:

[0109] S141, input the three-dimensional vertex matrix, the first posture information and the first texture information into a neural network renderer to obtain a rendered side face image.

[0110] Optionally, this embodiment uses a Neural Mesh Render model to complete image rendering.

[0111] S142, performing image erosion on the rendered side face image, and extracting second texture information of the image-eroded front face image.

[0112] Specifically, since the present embodiment obtains the three-dimensional vertex matrix and posture information through 3DDFA_V2, and then maps the three-dimensional vertex coordinate matrix and posture information to a two-dimensional plane, texture information is obtained; when 3DDFA_V2 obtains the three-dimensional vertex matrix, wrong vertices may be obtained, and the projection of the wrong vertices will appear in an abnormal position of the image, resulting in the texture information of the original image being assigned to the wrong position during rendering and rotation.

[0113] Therefore, in order to ensure the authenticity of the front image and the side image, this embodiment performs image erosion on the rendered front face image to eliminate the texture information at an abnormal position in the front face image. After eliminating the erroneous texture information, feature extraction is performed on the image after image erosion to obtain the texture information of the side face.

[0114] Optionally, the above-mentioned image erosion operation can be completed based on the average value of the texture information of the edge of the face and all vertices obtained after the three-dimensional vertices are mapped to the two-dimensional space.

[0115] S143, performing a preset first rotation operation on the first posture information to obtain second posture information;

[0116] Optionally, the first posture information, that is, the posture matrix, is multiplied by a rotation matrix, so as to rotate the posture of the person in the current direction to obtain the posture of the face in the frontal perspective.

[0117] S144, inputting the three-dimensional vertex matrix, the second posture information and the second texture information into a neural network renderer to obtain a front face image with artifacts, and obtaining a side face image with artifacts through the front face image with artifacts.

[0118] Exemplarily, the acquisition of a frontal face image with artifacts can be explained by the following formula:

[0119]

[0120] Rd(x j ,y j ) represents rendering of each vertex, T represents texture information, K j Represents the same two-dimensional vertex, that is, each (x j ,y j ), where N represents the number of vertices with the largest z-axis coordinate value.

[0121] The rendering of the entire frontal image can be understood by the following formula:

[0122] Rd=Render({V,P,T})

[0123] Among them, V represents the three-dimensional vertex matrix, P represents posture information, and T represents texture information.

[0124] Based on the above rendering formula, the three-dimensional vertex matrix, the second texture information and the second posture information are input into the neural network renderer to obtain a frontal face image with artifacts. After obtaining the frontal face image with artifacts, the frontal face image with artifacts is subjected to image processing, such as rotation, rendering and other operations, to obtain a side face image.

[0125] In one possible implementation, refer to Figure 4 , Figure 4 Another flow chart of S140 in the method for establishing a face generation model of the present invention is shown, that is, after the step of obtaining the front face image with artifacts in S144, the step of obtaining the side face image with artifacts through the front face image with artifacts includes:

[0126] S145, performing image erosion on the front face image with artifacts, and extracting third texture information of the image eroded front face image with artifacts.

[0127] Specifically, when a frontal face with artifacts is obtained and rotated and rendered, it is inevitable that the wrong texture will be assigned to the wrong vertex. Therefore, in order to further improve the quality of the generated image, the frontal face image with artifacts is eroded, and texture features, i.e., the third texture information, are extracted from the eroded face image.

[0128] S146, performing a preset second rotation operation on the second posture information to obtain third posture information.

[0129] Specifically, the second posture, ie, the frontal posture, is rotated back to the original angle to obtain third posture information, ie, posture information at the same angle as the original side face.

[0130] S147, input the three-dimensional vertex matrix, the third posture information, and the third texture information into a neural network renderer to obtain a side face image with artifacts.

[0131] Similarly, similar to obtaining a frontal face image with artifacts, the three-dimensional vertex matrix, the third texture information, and the third posture information are input into the neural network renderer to obtain a side face image with artifacts.

[0132] Further, see Figure 5 , Figure 5 A schematic diagram of a process of generating a front face without artifacts from a front face with artifacts is shown, that is, the above S150 can be performed in the following manner:

[0133] Inputting the front face image with artifacts and the side face image with artifacts into the downsampling layer 152 and the feature extraction layer 153 connected in sequence in the generation network to obtain a first feature vector and a second feature vector;

[0134] Inputting the first feature vector and the second feature vector into an upsampling layer 154 in a generation network to generate a front face image without artifacts and a side face image without artifacts;

[0135] Among them, the downsampling layer 152 includes at least one 7*7 convolutional layer and four 3*3 convolutional layers connected in sequence, the feature extraction layer 153 includes at least nine feature extraction blocks connected in sequence, each feature extraction block includes at least one attention layer, a 3*3 convolutional layer and a SPADE (Spatially-Adaptive Normalization) layer; the upsampling layer 154 includes at least four 3*3 convolutional layers and one 7*7 convolutional layer connected in sequence.

[0136] Preferably, the front face image with artifacts and the side face image with artifacts are downsampled to extract image features to obtain feature vectors, and then nine incomplete blocks, ie, nine feature extraction blocks, are used to further improve the expressiveness of the feature vectors.

[0137] Preferably, a CBAM (Convolutional Block Attention Module) module and a SPADE layer are introduced into the feature extraction block.

[0138] CBAM is an attention mechanism module that combines spatial and channel. This embodiment introduces the CBAM mechanism into the feature extraction block, and feeds the feature vector, i.e., the input feature, into the channel attention module and the spatial attention module connected in sequence in the CBAM, so that the network pays attention to the features of important areas and suppresses the features of unimportant areas in the channel and spatial dimensions, thereby effectively emphasizing or compressing the extracted intermediate features.

[0139] SPADE is a modification of the BN (Batch Normalization) layer, which changes the γ and β in BN from "obtained through network training" to "obtained through semantic image calculation". This embodiment adds a SPADE network to the feature extraction block of the generative network, so that the network can pay more attention to the semantic information of the image during training, avoids information loss, and makes the extracted feature information richer.

[0140] After the frontal face image with artifacts and the side face image with artifacts are input into the downsampling layer and the feature extraction layer in the generation network, the first feature vector and the second feature vector are obtained, wherein the first feature vector corresponds to the frontal face image with artifacts and the second feature vector corresponds to the side face image with artifacts. The first feature vector and the second feature vector are then input into the upsampling layer, thereby restoring the feature vectors to the corresponding images, thereby obtaining the frontal face image without artifacts and the side face image without artifacts.

[0141] Preferably, refer to Figure 6 , Figure 6 Another flow chart of the method for establishing a face generation model of the present invention is shown, after generating a front face image without artifacts and a side face image without artifacts, before inputting the original side face image and the side face image without artifacts into the identification network, that is, between S150 and S160, further comprising:

[0142] S170, obtaining first illumination data of an original side face image and second illumination data of a front face image without artifacts, and obtaining a first illumination loss value through the first illumination data and the second illumination data;

[0143] S171, with the goal of minimizing the first illumination loss value, optimizing the front face image without artifacts to obtain a first image.

[0144] Given that the illumination factor in the generated image and the original image is also one of the main factors affecting image quality, and the illumination factor is affected by various lighting conditions, and the lighting conditions are difficult to quantify into labels, it is difficult to learn reliable and independent illumination representations from facial images. In this embodiment, the illumination factor is directly constrained in the image space, and an illumination preservation path is added between the original side face image and the front face image without artifacts, that is, the illumination intensity, brightness and other data of the front face image without artifacts are directly adjusted, so that the front face image without artifacts maintains illumination consistency with the original side face image.

[0145] Specifically, the illumination information of the two images, such as illumination intensity, brightness and other characteristic information, is collected, and the loss value of the two images, i.e., the first illumination loss value, is calculated based on the illumination-related characteristic information. The illumination of the frontal face image without artifacts is adjusted by the first illumination loss value.

[0146] Optionally, the first illumination loss value may be calculated using an L2 loss function.

[0147] S172, using the original side face image as an input image and the first image as a guide image, inputting them into a guide filter, and updating the first image to obtain a second image;

[0148] S173, obtaining third illumination data of the second image, and obtaining a second illumination loss value through the first illumination data and the third illumination data;

[0149] S174, optimizing the second image again with the goal of minimizing the second illumination loss value.

[0150] However, since the postures of the characters in the front face image without artifacts and the original side face image are different, that is, there is a significant difference between the illumination intensity of the front face image without artifacts and the illumination intensity of the original side face image; if the posture of the face is too different in the front image and the side image, directly adjusting factors such as brightness and illumination intensity will cause the details of the generated front face to be significantly different from the original face. Therefore, in this embodiment, an illumination preservation path is also introduced, that is, a guided filter is used to transmit the illumination of the image, thereby optimizing the facial details of the front face image, so that the generated front face image is closer to the original side face image.

[0151] Specifically, in the guided filter, the radius of the filter is one quarter of the image resolution. The second illumination loss may be a pixel loss or a perceptual loss.

[0152] Since the guided filter does not have trainable parameters, adding it directly during model training may cause the model to fall into a local minimum during training. Therefore, the above-mentioned guided filter is introduced after multiple iterations to ensure that the model can be initialized stably and robustly.

[0153] Based on the above-mentioned illumination preservation path and illumination adaptation path, the generated front face image without artifacts is continuously optimized so that the generated front face maintains illumination consistency with the original side face, thereby making the generated front image more realistic.

[0154] Based on the technical solution in the above-mentioned embodiment 1, the problem that the current generation of frontal facial images is limited by the scale and range of the data source is solved, and the posture information of the person in the image is also taken into account when generating the image, thereby ensuring the authenticity of the generated image; and the quality of the frontal face is indirectly judged by the quality of the side face, thereby further improving the image generation effect.

[0155] Example 2

[0156] In this embodiment, see Figure 7 , Figure 7 A schematic flow chart of a face generation method of the present invention is shown. The face generation method provided by this embodiment includes:

[0157] S210, obtaining a side face image of a single viewing angle.

[0158] Optionally, multiple side face images at different viewing angles are obtained, and one face corresponds to only one viewing angle.

[0159] S220, acquiring a three-dimensional vertex matrix and posture information of the face according to the side face image;

[0160] S230, mapping the three-dimensional vertex matrix and the posture information to a two-dimensional space to obtain texture information of the side face image;

[0161] S240, obtaining a front face image with artifacts through the three-dimensional vertex matrix, the posture information, and the texture information;

[0162] S250, inputting the front face image into a face generation model to generate a front face image without artifacts.

[0163] Optionally, when the input images are multiple different side face images, the generated front face images correspond one-to-one to the faces in the side face images.

[0164] The face generation model is obtained by the face generation model establishment method in the above-mentioned embodiment 1.

[0165] The face generation method in the above-mentioned embodiment 2 can generate a corresponding frontal face image only through a side face image under a single perspective, thereby solving the problem that the current frontal face image generation is limited by the scale and range of the data source. When generating the image, the posture information of the person in the image is also taken into account to ensure the authenticity of the generated image. The frontal face is then generated through the trained face generation model to ensure the consistency of the input image and the generated image.

[0166] Example 3

[0167] In this embodiment, see Figure 8 , shows a device 300 for establishing a face generation model, including a sample acquisition module 310, a first extraction module 320, a second extraction module 330, an artifact image acquisition module 340, a generation module 350, an identification module 360, and a training module 370, wherein:

[0168] The sample acquisition module 310 is used to acquire the original side face image of a single perspective in the training set;

[0169] A first extraction module 320, configured to obtain a three-dimensional vertex matrix and first posture information of a face according to an original side face image;

[0170] A second extraction module 330, used to map the three-dimensional vertex matrix and the first posture information to a two-dimensional space to obtain first texture information;

[0171] An artifact image acquisition module 340 is used to obtain a front face image with artifacts and a side face image with artifacts through a three-dimensional vertex matrix, the first posture information and the first texture information;

[0172] A generating module 350, configured to input the front face image with artifacts and the side face image with artifacts into a generating network to generate a front face image without artifacts and a side face image without artifacts;

[0173] The identification module 360 ​​is used to input the original side face image and the side face image without artifacts into the identification network to obtain a loss function value;

[0174] The training module 370 is used to train the generation network and the identification network with the goal of minimizing the loss function value to obtain a face generation model.

[0175] It should be understood that the technical solution of this embodiment is used to execute the method for establishing a face generation model in the above-mentioned embodiment 1 through the synergistic effect of the above-mentioned functional modules. The implementation scheme and beneficial effects involved in embodiment 1 are also applicable to this embodiment and will not be repeated here.

[0176] Example 4

[0177] In this embodiment, see Fig. 9 , shows a face generation device 400, including an acquisition module 410, a first acquisition module 420, a second acquisition module 430, an artifact image generation module 440, and an artifact elimination module 450, wherein:

[0178] An acquisition module 410 is used to acquire a side face image of a single viewing angle;

[0179] A first acquisition module 420, configured to acquire a three-dimensional vertex matrix and posture information of a face according to a side face image;

[0180] The second acquisition module 430 is used to map the three-dimensional vertex matrix and posture information to a two-dimensional space to obtain texture information of the side face image;

[0181] An artifact image generation module 440 is used to obtain a frontal face image with artifacts through a three-dimensional vertex matrix, posture information, and texture information;

[0182] The artifact removal module 450 is used to input the frontal face image into the face generation model to generate a frontal face image without artifacts, wherein the face generation model is obtained by the face generation model establishment method as in the above-mentioned embodiment 1.

[0183] It should be understood that the technical solution of this embodiment is used to execute the face generation method of the above-mentioned embodiment 2 through the synergistic effect of the above-mentioned functional modules. The implementation scheme and beneficial effects involved in embodiment 2 are also applicable to this embodiment and will not be repeated here.

[0184] In this embodiment, a computer device is also provided, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program so that the terminal device can execute the method of the above-mentioned embodiment 1 or embodiment 2.

[0185] In this embodiment, a readable storage medium is also provided, which stores a computer program. When the computer program is run on a processor, the method of the above-mentioned embodiment 1 or embodiment 2 is executed.

[0186] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow chart, and the combination of boxes in the structure diagram and / or the flow chart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0187] In addition, the functional modules or units in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0188] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps 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 a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0189] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A method for establishing a face generation model, characterized in that: include: Obtain the original side face image of a single perspective in the training set; Acquire a three-dimensional vertex matrix and first posture information of the face according to the original side face image; Mapping the three-dimensional vertex matrix and the first posture information to a two-dimensional space to obtain first texture information; Obtaining a front face image with artifacts and a side face image with artifacts through the three-dimensional vertex matrix, the first posture information, and the first texture information; The step of obtaining a front face image with artifacts and a side face image with artifacts through the three-dimensional vertex matrix, the first posture information, and the first texture information includes: Inputting the three-dimensional vertex matrix, the first posture information, and the first texture information into a neural network renderer to obtain a rendered side face image; Performing image erosion on the rendered side face image, and extracting second texture information of the front face image after the image erosion; Performing a preset first rotation operation on the first posture information to obtain second posture information; Inputting the three-dimensional vertex matrix, the second posture information, and the second texture information into a neural network renderer to obtain a front face image with artifacts, and obtaining a side face image with artifacts through the front face image with artifacts; inputting the front face image with artifacts and the side face image with artifacts into a generation network to generate a front face image without artifacts and a side face image without artifacts; Inputting the original side face image and the side face image without artifacts into a discrimination network to obtain a loss function value; With the goal of minimizing the loss function value, the generation network and the identification network are trained to obtain a face generation model.

2. The method according to claim 1, characterized in that The step of obtaining the side face image with artifacts through the front face image with artifacts comprises: Performing image erosion on the front face image with artifacts, and extracting third texture information of the front face image with artifacts after the image erosion; Performing a preset second rotation operation on the second posture information to obtain third posture information; The three-dimensional vertex matrix, the third posture information and the third texture information are input into the neural network renderer to obtain a side face image with artifacts.

3. The method according to claim 1, characterized in that The step of inputting the front face image with artifacts and the side face image with artifacts into a generation network to generate a front face image without artifacts and a side face image without artifacts comprises: Input the frontal face image with artifacts and the side face image with artifacts into the downsampling layer and the feature extraction layer connected in sequence in the generation network to obtain a first feature vector and a second feature vector; wherein the downsampling layer at least includes a 7*7 convolution layer and four 3*3 convolution layers connected in sequence, and the feature extraction layer includes nine feature extraction blocks connected in sequence, and each of the feature extraction blocks includes at least one attention layer, one 3*3 convolution layer and one SPADE layer; The first feature vector and the second feature vector are input into an upsampling layer in a generation network to generate a frontal face image without artifacts and a side face image without artifacts; wherein the upsampling layer includes at least four 3*3 convolutional layers and one 7*7 convolutional layer connected in sequence.

4. The method according to claim 1, characterized in that: After generating the artifact-free frontal face image and the artifact-free side face image, and before inputting the original side face image and the artifact-free side face image into the identification network, the method further includes: Acquire first illumination data of the original side face image and second illumination data of the front face image without artifacts, and obtain a first illumination loss value through the first illumination data and the second illumination data; With the goal of minimizing the first illumination loss value, optimizing the artifact-free frontal face image to obtain a first image; The original side face image is used as an input image, the first image is used as a guide image, inputted into a guide filter, and the first image is updated to obtain a second image; Acquire third illumination data of the second image, and obtain a second illumination loss value through the first illumination data and the third illumination data; The second image is optimized again with the goal of minimizing the second illumination loss value.

5. A face generation method, characterized in that: include: Acquire a side face image from a single perspective; Acquire a three-dimensional vertex matrix and posture information of the face according to the side face image; Mapping the three-dimensional vertex matrix and the posture information to a two-dimensional space to obtain texture information of the side face image; Obtaining a frontal face image with artifacts through the three-dimensional vertex matrix, the posture information and the texture information; The frontal face image is input into a face generation model to generate a frontal face image without artifacts, wherein the face generation model is obtained by the method for establishing a face generation module as described in any one of claims 1 to 4.

6. A device for establishing a face generation model, characterized in that: include: A sample acquisition module is used to obtain the original side face images of a single perspective in the training set; A first extraction module, used for acquiring a three-dimensional vertex matrix and first posture information of a face according to the original side face image; A second extraction module, used for mapping the three-dimensional vertex matrix and the first posture information to a two-dimensional space to obtain first texture information; An artifact image acquisition module, used to obtain a front face image with artifacts and a side face image with artifacts through the three-dimensional vertex matrix, the first posture information and the first texture information; The step of obtaining a front face image with artifacts and a side face image with artifacts through the three-dimensional vertex matrix, the first posture information, and the first texture information includes: Inputting the three-dimensional vertex matrix, the first posture information, and the first texture information into a neural network renderer to obtain a rendered side face image; Performing image erosion on the rendered side face image, and extracting second texture information of the front face image after the image erosion; Performing a preset first rotation operation on the first posture information to obtain second posture information; Inputting the three-dimensional vertex matrix, the second posture information, and the second texture information into a neural network renderer to obtain a front face image with artifacts, and obtaining a side face image with artifacts through the front face image with artifacts; A generating module, used for inputting the front face image with artifacts and the side face image with artifacts into a generating network to generate a front face image without artifacts and a side face image without artifacts; An identification module, used for inputting the original side face image and the side face image without artifacts into an identification network to obtain a loss function value; The training module is used to train the generation network and the identification network with the goal of minimizing the loss function value to obtain a face generation model.

7. A face generation device, characterized in that: include: An acquisition module, used for acquiring a side face image of a single viewing angle; A first acquisition module, used for acquiring a three-dimensional vertex matrix and posture information of a face according to the side face image; A second acquisition module, used for mapping the three-dimensional vertex matrix and the posture information into a two-dimensional space to obtain texture information of the side face image; An artifact image generation module, used to obtain a frontal face image with artifacts through the three-dimensional vertex matrix, the posture information and the texture information; The second image module is used to input the frontal face image into a face generation model to generate a frontal face image without artifacts, wherein the face generation model is obtained by the method as described in any one of claims 1-4.

8. A computer device, characterized in that: It comprises a memory and a processor, the memory stores a computer program, and when the computer program is run on the processor, it executes the method for establishing a face generation model as described in any one of claims 1 to 4 or the method for generating a face as described in claim 5.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is run on a processor, the method for establishing a face generation model according to any one of claims 1 to 4 or the method for generating a face according to claim 5 is executed.