Method, device, computer equipment and storage medium for generating face image

By inputting the face image and angle vector into the face image generation network, target face images from multiple angles are generated, and the discriminant network is used to correct the loss function, which solves the problem of low recognition rate of the face recognition system in the existing technology and improves the the recognition accuracy.

CN110781738BActive Publication Date: 2024-09-20MOSI WENXING (GUANGZHOU) TECHNOLOGY DEVELOPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910886618.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-09-19
Publication Date
2024-09-20
Estimated Expiration
2039-09-19

AI Technical Summary

Technical Problem

Existing face recognition neural networks can only generate one type of image and cannot generate images from multiple angles at the same time, resulting in a decrease in the recognition rate of the face recognition system.

Method used

By inputting the angle vectors of the original face image and the target face image into the pre-trained face image generation network, conversion and matching are performed to generate target face images from multiple angles, and the discriminant network is used to optimize the correction loss function. , to ensure the reliability of the generated network.

Benefits of technology

It achieves the generation of target face images from multiple angles, improves the accuracy and recognition rate of face recognition, and enhances the application capabilities of the face recognition system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110781738B
    Figure CN110781738B
Patent Text Reader

Abstract

The present application discloses a method, apparatus, computer device and storage medium for generating a facial image, wherein the method for generating a facial image comprises: inputting the angle vectors of the original facial image and the target facial image into a pre-trained facial image generation network at the same time; converting the original facial image into a first target facial image corresponding to a first angle vector according to a preset conversion method through the pre-trained facial image generation network, wherein the first angle vector is included in the angle vectors corresponding to all target facial images, and the first target facial image is included in all target facial images; evaluating whether the first angle vector matches the first target facial image through a preset discriminant network; if they match, outputting the first target facial image. By inputting the original facial image and the angle vector into the facial image generation network together, and by applying the angle vector to the original facial image, the synthesis of the target facial image corresponding to the angle is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a method, apparatus, computer equipment and storage medium for generating facial images. Background Art

[0002] Face recognition has been widely used in subjects such as robotics, and is of great significance for automatic identification and automatic differentiation of humans. However, when passing face recognition verification, each user usually only collects a front view image. The existing ordinary face recognition neural network can only generate one type of image and cannot generate images of multiple angles at the same time. This makes the application of real face recognition systems have recognition defects, resulting in a significant drop in recognition rate and affecting normal use. Summary of the invention

[0003] The main purpose of this application is to provide a method for generating facial images, aiming to solve the technical problem that existing facial recognition neural networks cannot generate images of multiple angles at the same time.

[0004] This application proposes a method for generating a face image, comprising:

[0005] Inputting the angle vectors of the original face image and the target face image into a pre-trained face image generation network at the same time, wherein the angle vector of the target face image includes at least one;

[0006] The original face image is converted into a first target face image corresponding to the first angle vector according to a preset conversion method by using a pre-trained face image generation network, wherein the first angle vector is included in the angle vectors corresponding to all target face images, and the first target face image is included in all target face images;

[0007] Evaluate whether the first angle vector matches the first target face image through a preset discriminant network;

[0008] If they match, the first target face image is output.

[0009] Preferably, the step of converting the original face image into a first target face image corresponding to the first angle vector according to a preset conversion method through a pre-trained face image generation network includes:

[0010] Crop the face head area image from the original face image;

[0011] Locating feature points corresponding to designated organs of the face according to the feature point positioning model, wherein the designated organs include at least one;

[0012] Obtaining coordinate data of feature points corresponding to each designated organ;

[0013] Mapping each coordinate data to the feature point template corresponding to the first angle vector one by one to obtain the face area corresponding to the first angle vector;

[0014] A first target face image is formed according to the face area corresponding to the first angle vector.

[0015] Preferably, the step of evaluating whether the first angle vector matches the first target face image by a preset discriminant network includes:

[0016] Inputting the inverse angle of the first angle vector and the first target face image as inputs to a pre-trained face image generation network;

[0017] generating a second target face image according to the inverse angle of the first angle vector and the first target face image;

[0018] determining whether the second target face image is the same as the original face image;

[0019] If they are the same, it is determined that the first angle vector matches the first target face image.

[0020] Preferably, after the step of determining whether the second target face image is the same as the original face image, the following steps are included:

[0021] If the second target facial image is different from the original facial image, determining difference information between the second target facial image and the original facial image;

[0022] Generate a first correction loss function according to the difference information, where the first correction loss function is Lg=Ladv+Lfcls+Lrec, Ladv=logD(x)+log(1-D(G(x,c)), Lfcls=-logD(G(x,c)), Lrec=||xG(G(x,c),c')||, G represents the face image generation network, G(x,c) represents the input image x, and the corresponding face image when the generation angle is c, D(x) represents the domain label probability distribution calculated by D for the real image, D represents the discriminant network function, and c'=-c;

[0023] Correct the parameters in the pre-trained face image generation network according to the first correction loss function.

[0024] Preferably, after the step of outputting the first target face image, the method further comprises:

[0025] Determining whether the angle classifications corresponding to the first target face images are correct;

[0026] If not, the discriminant network is corrected by the second correction loss function, where the second correction loss function Ld = -Ladv + Lfcls, Ladv = logD(x) + log(1-D(G(x,c)), Lfcls = -logD(G(x,c)), G(x,c) represents the input image x, and the corresponding face image when the generation angle is c, D(x) represents the domain label probability distribution calculated by D for the real image, and D represents the discriminant network function.

[0027] Preferably, before the step of simultaneously inputting the angle vectors of the original face image and the target face image into the pre-trained face image generation network, the step includes:

[0028] Acquire facial images of a specified number of users, wherein the facial images of the same user include at least two angle images corresponding to specified angles;

[0029] The specified angle corresponding to the angle image is mapped to a vector value of the specified length;

[0030] Combine the angle image and the vector value of the specified length corresponding to the specified angle into a training sample;

[0031] The training samples are input into the neural network for training to obtain a classification model that can classify the image domain corresponding to the specified angle;

[0032] Use the classification model as a pre-trained face image generation network.

[0033] Preferably, the step of combining the angle image and the vector value of the specified length corresponding to the specified angle into a training sample comprises:

[0034] Obtaining a first pixel value corresponding to a facial organ in a first angle image, wherein the first angle image is included in all angle images;

[0035] Obtain a standard face image corresponding to a first specified angle;

[0036] Correcting the first pixel value according to the standard pixel value corresponding to each facial organ in the standard facial image to obtain a corrected first pixel value;

[0037] The second angle image carrying the corrected first pixel value and the first vector value corresponding to the first angle are combined into a corrected training sample.

[0038] The present application also provides a device for generating a face image, comprising:

[0039] A first input module is used to input the angle vectors of the original face image and the target face image into the pre-trained face image generation network at the same time, wherein the angle vector of the target face image includes at least one;

[0040] A conversion module, used for converting the original face image into a first target face image corresponding to the first angle vector according to a preset conversion method through a pre-trained face image generation network, wherein the first angle vector is included in the angle vectors corresponding to all target face images, and the first target face image is included in all target face images;

[0041] An evaluation module, used for evaluating whether the first angle vector matches the first target face image through a preset discriminant network;

[0042] The output module is used to output the first target face image if a match is found.

[0043] The present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0044] 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 above method are implemented.

[0045] The present application inputs the original face image and the angle vector into the face image generation network, and realizes the synthesis of the target face image corresponding to the angle by acting on the original face image with the angle vector. The face image generation network of the present application is trained by multi-user multi-angle face images, and carries generation templates corresponding to multiple angle images. It can support an original face image, and input multiple angle vectors into the face image generation network together, and generate target face images of multiple angles corresponding to the original face image at the same time. The reliability of the generation network is further verified by connecting the generation network with the discriminant network, and by classifying the face images output by the generation network by angle. If the face image corresponding to the angle is classified into the correct angle domain by the discriminant network, it indicates that the reliability of the generation network is high and the reliability of the discriminant network is also high. If the classification is incorrect, but after the analysis of the first correction loss function, the generation network is reliable, it means that the discriminant network needs to be corrected, and then it is corrected by the second correction loss function Ld. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A flowchart of a method for generating a face image according to an embodiment of the present application;

[0047] Figure 2 A schematic diagram of the structure of a device for generating a face image according to an embodiment of the present application;

[0048] Figure 3 A schematic diagram of the internal structure of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution 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 used to limit the present application.

[0050] Reference Figure 1 , a method for generating a face image according to an embodiment of the present application includes:

[0051] S1: Inputting the angle vectors of the original face image and the target face image into a pre-trained face image generation network at the same time, wherein the angle vector of the target face image includes at least one.

[0052] S2: Using a pre-trained face image generation network, convert the original face image into a first target face image corresponding to a first angle vector according to a preset conversion method, wherein the first angle vector is included in the angle vectors corresponding to all target face images, and the first target face image is included in all target face images.

[0053] S3: Evaluate whether the first angle vector matches the first target face image through a preset discriminant network.

[0054] S4: If matched, output the first target face image.

[0055] In this embodiment, the angle vectors of the original face image and the target face image are input into the face image generation network, and the angle vector is applied to the original face image to achieve synthesis of the target face image corresponding to the angle vector. The face image generation network of this embodiment is trained by multi-user multi-angle face images, carries generation templates corresponding to multiple angle images, and can support an original face image and multiple angle vectors to be input into the face image generation network, and simultaneously generates and outputs the target face images corresponding to the original face image after the angle vectors are converted.

[0056] Furthermore, step S2 of converting the original face image into a first target face image corresponding to the first angle vector by using a pre-trained face image generation network according to a preset conversion method includes:

[0057] S21: Crop the face head area image from the original face image.

[0058] S22: Locating feature points corresponding to designated organs of the face according to the feature point positioning model, wherein the designated organs include at least one.

[0059] S23: Obtaining coordinate data of feature points corresponding to each designated organ.

[0060] S24: Mapping each coordinate data one-to-one to a feature point template corresponding to the first angle vector to obtain a face region corresponding to the first angle vector.

[0061] S25: Forming a first target face image according to the face area corresponding to the first angle vector.

[0062] In the process of synthesizing the target face image corresponding to the angle in this embodiment, in order to improve the accurate matching of the generated target face image with the original face image, the face head image is first enlarged and displayed by cropping to form a face head area image, and the location of the feature points of the face organs is identified and located according to the positioning model, and the coordinate data of the feature points are mapped to the feature point template corresponding to the angle vector according to the angle vector to obtain the target face image. The feature points of the above-mentioned face include at least five, the feature points corresponding to the two eyes, the feature points corresponding to the two corners of the mouth, and the feature points corresponding to the nose. After the coordinate data of the above-mentioned five feature points in the original face image are obtained in this embodiment, each coordinate is represented by (x, y), and then according to the affine transformation of OpenCV, the coordinate data of the five feature points obtained are mapped to the feature point template corresponding to the pre-stored angle vector, and the face area corresponding to the angle vector is obtained to form the target face image. According to the face detection model (such as MTCNN), the five feature points of the face can be obtained, and the coordinate data corresponding to the five feature points can be determined.

[0063] Furthermore, step S3 of evaluating whether the first angle vector matches the first target face image through a preset discriminant network includes:

[0064] S31: Inputting the inverse angle of the first angle vector and the first target face image as input quantities into a pre-trained face image generation network.

[0065] S31: Generate a second target face image according to the inverse angle of the first angle vector and the first target face image.

[0066] S33: Determine whether the second target face image is the same as the original face image.

[0067] S34: If they are the same, it is determined that the first angle vector matches the first target face image.

[0068] This embodiment verifies the reliability of the pre-trained face image generation network by using the inverse angle of the corresponding angles of the target face image and the synthesized target face image as the input of the face image generation network to see whether the original face image is output. If the inverse angle of the corresponding angles of the target face image and the synthesized target face image is used as the input of the face image generation network and the original face image can be output, it indicates that the face image generation network is reliable. The corresponding angle of the above-mentioned synthesized target face image is c, and the inverse angle of the corresponding angle of the synthesized target face image is -c.

[0069] Further, after step S33 of determining whether the second target face image is the same as the original face image, the following steps are included:

[0070] S35: If the second target facial image is different from the original facial image, determining difference information between the second target facial image and the original facial image.

[0071] S36: Generate a first correction loss function according to the difference information, wherein the first correction loss function is Lg=Ladv+Lfcls+Lrec, Ladv=logD(x)+log(1-D(G(x,c)), Lfcls=-logD(G(x,c)), Lrec=||xG(G(x,c),c')||, G represents the face image generation network, G(x,c) represents the input image x, and the corresponding face image when the generation angle is c, D(x) represents the domain label probability distribution calculated by D for the real image, D represents the discriminant network function, and c'=-c.

[0072] S37: Correct the parameters in the pre-trained face image generation network according to the first correction loss function.

[0073] In this embodiment, if the second target face image is not the same as the original face image, or the similarity between the second target face image and the original face image is less than a preset threshold, it means that the reliability of the face image generation network cannot meet the use requirements, and the first correction loss function is Lg. The face image generation network G is corrected by the first correction loss function. G(x,c) represents the generation of a face image with an angle of c, and G(G(x,c),c') represents the generated image with an angle of c as input again to generate a face image corresponding to its original angle c', c'=-c. Lfcls is used to optimize the generation network G, that is, to allow the face image generated by the generation network G to be classified into the target angle domain c by the discrimination network D. Lrec is to ensure that the original face image x is transformed in the angle domain c and then transformed back to the face image corresponding to the original angle domain c', which is consistent with the original face image.

[0074] Further, after step S4 of outputting the first target face image, the following steps are included:

[0075] S41: Determine whether the angle classifications corresponding to the first target face images are correct.

[0076] S42: If not, the discriminant network is corrected by a second correction loss function, wherein the second correction loss function Ld=-Ladv+Lfcls, Ladv=logD(x)+log(1-D(G(x,c)), Lfcls=-logD(G(x,c)), G(x,c) represents the input image x, and the corresponding face image when the generation angle is c, D(x) represents the domain label probability distribution calculated by D for the real image, and D represents the discriminant network function.

[0077] This embodiment further verifies the reliability of the generation network by connecting the generation network with the discriminant network and classifying the angle of the face image output by the generation network. If the face image corresponding to the angle is classified into the correct angle domain by the discriminant network, it indicates that the reliability of the generation network is high and the reliability of the discriminant network is also high. If the classification is incorrect, but the generation network is reliable after analysis by the first correction loss function, it indicates that the discriminant network needs to be corrected, and then it is corrected by the second correction loss function Ld. This embodiment compares the size of the angle vector of the first target face image relative to the original face to see if it is within the corresponding angle classification range. If it is within the range, it means that the classification is correct.

[0078] Furthermore, the angle vectors of the original face image and the target face image are simultaneously input into the pre-trained face image generation network before step S1, including:

[0079] S11: Acquire facial images of a specified number of users, wherein the facial image of the same user includes at least two angle images corresponding to specified angles.

[0080] S12: The specified angle corresponding to the angle image is mapped to a vector value of a specified length.

[0081] S13: Combine the angle image and the vector value of the specified length corresponding to the specified angle into a training sample.

[0082] S14: Input the training samples into the neural network for training to obtain a classification model that can classify the image domain corresponding to the specified angle.

[0083] S15: Use the classification model as a pre-trained face image generation network.

[0084] When training the face image generation network, this embodiment adds the parameters of the angle vector at the same time to generate face image generation templates corresponding to different angle domains. According to different angles, the face images are classified, and the same angle is placed in the same category. Each angle is represented by an angle vector with a unique length. The above-mentioned specified number is greater than or equal to 1000 users, and each user corresponds to face images of multiple angles. The specified angles include, for example, -90, -60, -45, -30, 0, 30, 45, 60, 90 and other angles.

[0085] Furthermore, step S13 of combining the angle image and the vector value of the specified length corresponding to the specified angle into a training sample includes:

[0086] S131: Obtain a first pixel value corresponding to a facial organ in a first angle image, wherein the first angle image is included in all angle images.

[0087] S132: Obtain a standard face image corresponding to the first specified angle.

[0088] S133: Correcting the first pixel value according to the standard pixel value corresponding to each facial organ in the standard facial image to obtain a corrected first pixel value.

[0089] S134: Combining the second angle image carrying the corrected first pixel value and the first vector value corresponding to the first angle into a corrected training sample.

[0090] In this embodiment, the training samples are corrected by positioning to improve the accuracy of the training samples. In this embodiment, the face image is cropped to be in the center, and then the pixel values ​​of the feature points corresponding to the facial organs are corrected. For example, if the standard face image is 256*256, the standard pixel values ​​of the eyes are 58*58 and 158*58. By correcting the first pixel value corresponding to the facial organ in the first angle image of the current user to the standard pixel value of the standard face image corresponding to the first specified angle, the feature points corresponding to other facial organs are corrected according to the above process to reduce the large sample difference and the impact on the training accuracy of the face image generation network, and improve the accuracy of the generation network to synchronously output face images corresponding to multiple angles.

[0091] Reference Figure 2 , a device for generating a face image according to an embodiment of the present application includes:

[0092] The first input module 1 is used to input the angle vectors of the original face image and the target face image into the pre-trained face image generation network at the same time, wherein the angle vector of the target face image includes at least one.

[0093] Conversion module 2 is used to convert the original face image into a first target face image corresponding to the first angle vector according to a preset conversion method through a pre-trained face image generation network, wherein the first angle vector is included in the angle vectors corresponding to all target face images, and the first target face image is included in all target face images.

[0094] Evaluation module 3 is used to evaluate whether the first angle vector matches the first target face image through a preset discriminant network.

[0095] The output module 4 is used to output the first target face image if a match is found.

[0096] In this embodiment, the angle vectors of the original face image and the target face image are input into the face image generation network, and the angle vector is applied to the original face image to achieve synthesis of the target face image corresponding to the angle vector. The face image generation network of this embodiment is trained by multi-user multi-angle face images, carries generation templates corresponding to multiple angle images, and can support an original face image and multiple angle vectors to be input into the face image generation network, and simultaneously generates and outputs the target face images corresponding to the original face image after the angle vectors are converted.

[0097] Furthermore, the conversion module 2 includes:

[0098] The cropping unit is used to crop a face head area image from an original face image.

[0099] A positioning unit is used to locate feature points corresponding to designated organs of a human face according to a feature point positioning model, wherein the designated organs include at least one.

[0100] The first acquisition unit is used to acquire coordinate data of feature points corresponding to each designated organ.

[0101] The mapping unit is used to map each coordinate data one by one to the feature point template corresponding to the first angle vector to obtain the face area corresponding to the first angle vector.

[0102] The forming unit is used to form a first target face image according to the face area corresponding to the first angle vector.

[0103] In the process of synthesizing the target face image corresponding to the angle in this embodiment, in order to improve the accurate matching of the generated target face image with the original face image, the face head image is first enlarged and displayed by cropping to form a face head area image, and the location of the feature points of the face organs is identified and located according to the positioning model, and the coordinate data of the feature points are mapped to the feature point template corresponding to the angle vector according to the angle vector to obtain the target face image. The feature points of the above-mentioned face include at least five, the feature points corresponding to the two eyes, the feature points corresponding to the two corners of the mouth, and the feature points corresponding to the nose. After the coordinate data of the above-mentioned five feature points in the original face image are obtained in this embodiment, each coordinate is represented by (x, y), and then according to the affine transformation of OpenCV, the coordinate data of the five feature points obtained are mapped to the feature point template corresponding to the pre-stored angle vector, and the face area corresponding to the angle vector is obtained to form the target face image. According to the face detection model (such as MTCNN), the five feature points of the face can be obtained, and the coordinate data corresponding to the five feature points can be determined.

[0104] Furthermore, the evaluation module 3 includes:

[0105] The input unit is used to input the inverse angle of the first angle vector and the first target face image as input quantities into a pre-trained face image generation network.

[0106] The first generating unit is used to generate a second target face image according to the inverse angle of the first angle vector and the first target face image.

[0107] The judging unit is used to judge whether the second target face image is the same as the original face image.

[0108] The determination unit is used to determine whether the first angle vector matches the first target face image if they are the same.

[0109] This embodiment verifies the reliability of the pre-trained face image generation network by using the inverse angle of the corresponding angles of the target face image and the synthesized target face image as the input of the face image generation network to see whether the original face image is output. If the inverse angle of the corresponding angles of the target face image and the synthesized target face image is used as the input of the face image generation network and the original face image can be output, it indicates that the face image generation network is reliable. The corresponding angle of the above-mentioned synthesized target face image is c, and the inverse angle of the corresponding angle of the synthesized target face image is -c.

[0110] Furthermore, the evaluation module 3 includes:

[0111] The determination unit is used to determine difference information between the second target facial image and the original facial image if the second target facial image is different from the original facial image.

[0112] The second generation unit is used to generate a first correction loss function according to the difference information, wherein the first correction loss function is Lg=Ladv+Lfcls+Lrec, Ladv=logD(x)+log(1-D(G(x,c)), Lfcls=-logD(G(x,c)), Lrec=||xG(G(x,c),c')||, G represents a face image generation network, G(x,c) represents an input image x, and a face image corresponding to a generation angle of c, D(x) represents a domain label probability distribution calculated by D for a real image, D represents a discriminant network function, and c'=-c.

[0113] The correction unit is used to correct the parameters in the pre-trained face image generation network according to the first correction loss function.

[0114] In this embodiment, if the second target face image is not the same as the original face image, or the similarity between the second target face image and the original face image is less than a preset threshold, it means that the reliability of the face image generation network cannot meet the use requirements, and the first correction loss function is Lg. The face image generation network G is corrected by the first correction loss function. G(x,c) represents the generation of a face image with an angle of c, and G(G(x,c),c') represents the generated image with an angle of c as input again to generate a face image corresponding to its original angle c', c'=-c. Lfcls is used to optimize the generation network G, that is, to allow the face image generated by the generation network G to be classified into the target angle domain c by the discrimination network D. Lrec is to ensure that the original face image x is transformed in the angle domain c and then transformed back to the face image corresponding to the original angle domain c', which is consistent with the original face image.

[0115] Furthermore, the device for generating a face image includes:

[0116] The judgment module is used to judge whether the angle classification corresponding to each first target face image is correct.

[0117] A correction module is used to correct the discriminant network through a second correction loss function if no, wherein the second correction loss function Ld = -Ladv + Lfcls, Ladv = logD(x) + log(1-D(G(x,c)), Lfcls = -logD(G(x,c)), G(x,c) represents the input image x, and the corresponding face image when the generation angle is c, D(x) represents the domain label probability distribution calculated by D for the real image, and D represents the discriminant network function.

[0118] This embodiment further verifies the reliability of the generation network by connecting the generation network with the discriminant network and classifying the angle of the face image output by the generation network. If the face image corresponding to the angle is classified into the correct angle domain by the discriminant network, it indicates that the reliability of the generation network is high and the reliability of the discriminant network is also high. If the classification is incorrect, but the generation network is reliable after analysis by the first correction loss function, it indicates that the discriminant network needs to be corrected, and then it is corrected by the second correction loss function Ld. This embodiment compares the size of the angle vector of the first target face image relative to the original face to see if it is within the corresponding angle classification range. If it is within the range, it means that the classification is correct.

[0119] Furthermore, the device for generating a face image includes:

[0120] The acquisition module is used to acquire facial images of a specified number of users, wherein the facial image of the same user includes at least two angle images corresponding to specified angles.

[0121] A mapping module is used to map the specified angle corresponding to the angle image to a vector value of a specified length.

[0122] The combination module is used to combine the angle image and the vector value of the specified length corresponding to the specified angle into a training sample.

[0123] The second input module is used to input the training samples into the neural network for training, so as to obtain a classification model capable of classifying the image domain corresponding to the specified angle.

[0124] As a module, it is used to use the classification model as a pre-trained face image generation network.

[0125] When training the face image generation network, this embodiment adds the parameters of the angle vector at the same time to generate face image generation templates corresponding to different angle domains. According to different angles, the face images are classified, and the same angle is placed in the same category. Each angle is represented by an angle vector with a unique length. The above-mentioned specified number is greater than or equal to 1000 users, and each user corresponds to face images of multiple angles. The specified angles include, for example, -90, -60, -45, -30, 0, 30, 45, 60, 90 and other angles.

[0126] Furthermore, the combined module comprises:

[0127] The second acquisition unit is used to acquire a first pixel value corresponding to a facial organ in a first angle image, wherein the first angle image is included in all angle images.

[0128] The third acquisition unit is used to acquire a standard face image corresponding to the first specified angle.

[0129] The correction unit is used to correct the first pixel value according to the standard pixel value corresponding to each facial organ in the standard facial image to obtain the corrected first pixel value.

[0130] The combining unit is used to combine the second angle image carrying the corrected first pixel value and the first vector value corresponding to the first angle into a corrected training sample.

[0131] In this embodiment, the training samples are corrected by positioning to improve the accuracy of the training samples. In this embodiment, the face image is cropped to be in the center, and then the pixel values ​​of the feature points corresponding to the facial organs are corrected. For example, if the standard face image is 256*256, the standard pixel values ​​of the eyes are 58*58 and 158*58. By correcting the first pixel value corresponding to the facial organ in the first angle image of the current user to the standard pixel value of the standard face image corresponding to the first specified angle, the feature points corresponding to other facial organs are corrected according to the above process to reduce the large sample difference and the impact on the training accuracy of the face image generation network, and improve the accuracy of the generation network to synchronously output face images corresponding to multiple angles.

[0132] Reference Figure 3 In an embodiment of the present application, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store all data required for the process of generating a facial image. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for generating a facial image is implemented.

[0133] The above-mentioned processor executes the above-mentioned method for generating a facial image, including: inputting the angle vectors of the original facial image and the target facial image into a pre-trained facial image generation network at the same time, wherein the angle vector of the target facial image includes at least one; through the pre-trained facial image generation network, converting the original facial image into a first target facial image corresponding to a first angle vector according to a preset conversion method, wherein the first angle vector is included in the angle vectors corresponding to all target facial images, and the first target facial image is included in all target facial images; evaluating whether the first angle vector matches the first target facial image through a preset discriminant network; if they match, outputting the first target facial image.

[0134] The above-mentioned computer device inputs the original face image and the angle vector into the face image generation network, and realizes the synthesis of the target face image corresponding to the angle by acting on the original face image with the angle vector. The face image generation network of the present application is trained by multi-user multi-angle face images, carrying generation templates corresponding to multiple angle images, which can support an original face image, and input multiple angle vectors into the face image generation network, and generate target face images of multiple angles corresponding to the original face image at the same time. The reliability of the generation network is further verified by connecting the generation network with the discriminant network and classifying the face images output by the generation network by angle. If the face image corresponding to the angle is classified into the correct angle domain by the discriminant network, it indicates that the reliability of the generation network is high and the reliability of the discriminant network is also high. If the classification is incorrect, but after the analysis of the first correction loss function, the generation network is reliable, it means that the discriminant network needs to be corrected, and then it is corrected by the second correction loss function Ld.

[0135] In one embodiment, the processor converts the original face image into a first target face image corresponding to the first angle vector according to a preset conversion method through a pre-trained face image generation network, including: cropping a face head area image from the original face image; locating feature points corresponding to designated organs of the face according to a feature point positioning model, wherein the designated organs include at least one; obtaining coordinate data of feature points corresponding to each designated organ; mapping each coordinate data one-to-one to a feature point template corresponding to the first angle vector to obtain a face area corresponding to the first angle vector; and forming a first target face image according to the face area corresponding to the first angle vector.

[0136] In one embodiment, the processor evaluates whether the first angle vector matches the first target facial image through a preset discriminant network, comprising: inputting the inverse angle of the first angle vector and the first target facial image as input to a pre-trained facial image generation network; generating a second target facial image based on the inverse angle of the first angle vector and the first target facial image; determining whether the second target facial image is the same as the original facial image; if they are the same, determining that the first angle vector matches the first target facial image.

[0137] In one embodiment, after the step of determining whether the second target facial image is the same as the original facial image, the processor further includes: if the second target facial image is not the same as the original facial image, determining difference information between the second target facial image and the original facial image; generating a first correction loss function according to the difference information, wherein the first correction loss function is Lg=Ladv+Lfcls+Lrec, Ladv=logD(x)+log(1-D(G(x,c))Lfcls=-logD(G(x,c))

[0138] ,, Lrec=||xG(G(x,c),c')||, G represents the face image generation network, G(x,c) represents the input image x, the corresponding face image when the generation angle is c, D(x) represents the domain label probability distribution calculated by D for the real image, D represents the discriminant network function, c'=-c; the parameters in the pre-trained face image generation network are corrected according to the first correction loss function.

[0139] In one embodiment, after the step of outputting the first target face image by the processor, the process includes: determining whether the angle classification corresponding to each first target face image is correct; if not, correcting the discriminant network through a second correction loss function, wherein the second correction loss function Ld=-Ladv+Lfcls, Ladv=logD(x)+log(1-D(G(x,c)), Lfcls=-logD(G(x,c)), G(x,c) represents the input image x, and the corresponding face image when the generated angle is c, D(x) represents the domain label probability distribution calculated by D for the real image, and D represents the discriminant network function.

[0140] In one embodiment, before the processor simultaneously inputs the angle vectors of the original face image and the target face image into the pre-trained face image generation network, the process includes: obtaining face images of a specified number of users, wherein the face images of the same user include at least two angle images corresponding to specified angles; mapping the specified angles corresponding to the angle images to vector values ​​of specified lengths; combining the angle images and the vector values ​​of specified lengths corresponding to the specified angles into training samples; inputting the training samples into a neural network for training to obtain a classification model that can classify the image domain corresponding to the specified angles; and using the classification model as a pre-trained face image generation network.

[0141] In one embodiment, the processor combines the angle image and the vector value of the specified length corresponding to the specified angle into a training sample, including: obtaining a first pixel value corresponding to a facial organ in a first angle image, wherein the first angle image is included in all angle images; obtaining a standard facial image corresponding to a first specified angle; correcting the first pixel value according to the standard pixel values ​​corresponding to each facial organ in the standard facial image to obtain a corrected first pixel value; and combining the second angle image carrying the corrected first pixel value and the first vector value corresponding to the first angle into a corrected training sample.

[0142] Those skilled in the art will understand that Figure 3 The structure shown in is merely a block diagram of a portion of the structure related to the present application solution and does not constitute a limitation on the computer device to which the present application solution is applied.

[0143] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, a method for generating a facial image is implemented, including: inputting the angle vectors of an original facial image and a target facial image into a pre-trained facial image generation network at the same time, wherein the target facial image includes at least one angle vector; converting the original facial image into a first target facial image corresponding to a first angle vector according to a preset conversion method through the pre-trained facial image generation network, wherein the first angle vector is included in the angle vectors corresponding to all target facial images, and the first target facial image is included in all target facial images; evaluating whether the first angle vector matches the first target facial image through a preset discriminant network; if they match, outputting the first target facial image.

[0144] The above-mentioned computer-readable storage medium is input into the face image generation network through the original face image and the angle vector, and the angle vector is applied to the original face image to realize the synthesis of the target face image corresponding to the angle. The face image generation network of the present application is trained by multi-user multi-angle face images, carrying generation templates corresponding to multiple angle images, which can support an original face image, and input into the face image generation network together with multiple angle vectors, and generate target face images of multiple angles corresponding to the original face image at the same time. By connecting the generation network with the discriminant network, and by classifying the face images output by the generation network by angle, the reliability of the generation network is further verified. If the face image corresponding to the angle is classified into the correct angle domain by the discriminant network, it indicates that the reliability of the generation network is high and the reliability of the discriminant network is also high. If the classification is incorrect, but after the first correction loss function analysis, the generation network is reliable, it means that the discriminant network needs to be corrected, and then it is corrected by the second correction loss function Ld.

[0145] In one embodiment, the processor converts the original face image into a first target face image corresponding to the first angle vector according to a preset conversion method through a pre-trained face image generation network, including: cropping a face head area image from the original face image; locating feature points corresponding to designated organs of the face according to a feature point positioning model, wherein the designated organs include at least one; obtaining coordinate data of feature points corresponding to each designated organ; mapping each coordinate data one-to-one to a feature point template corresponding to the first angle vector to obtain a face area corresponding to the first angle vector; and forming a first target face image according to the face area corresponding to the first angle vector.

[0146] In one embodiment, the processor evaluates whether the first angle vector matches the first target facial image through a preset discriminant network, comprising: inputting the inverse angle of the first angle vector and the first target facial image as input to a pre-trained facial image generation network; generating a second target facial image based on the inverse angle of the first angle vector and the first target facial image; determining whether the second target facial image is the same as the original facial image; if they are the same, determining that the first angle vector matches the first target facial image.

[0147] In one embodiment, after the step of determining whether the second target facial image is the same as the original facial image, the processor further comprises: if the second target facial image is not the same as the original facial image, determining difference information between the second target facial image and the original facial image; generating a first correction loss function according to the difference information, wherein the first correction loss function is Lg=Ladv+Lfcls+Lrec, Ladv=logD(x)+log(1-D(G(x,c)), Lfcls=-logD(G(x,c)), Lrec=||xG(G(x,c),c')||, G represents a facial image generation network, G(x,c) represents an input image x, and a facial image corresponding to a generation angle of c, D(x) represents a domain label probability distribution calculated by D for a real image, D represents a discriminant network function, and c'=-c; and correcting parameters in the pre-trained facial image generation network according to the first correction loss function.

[0148] In one embodiment, after the step of outputting the first target face image by the processor, the process includes: determining whether the angle classification corresponding to each first target face image is correct; if not, correcting the discriminant network through a second correction loss function, wherein the second correction loss function Ld=-Ladv+Lfcls, Ladv=logD(x)+log(1-D(G(x,c)), Lfcls=-logD(G(x,c)), G(x,c) represents the input image x, and the corresponding face image when the generated angle is c, D(x) represents the domain label probability distribution calculated by D for the real image, and D represents the discriminant network function.

[0149] In one embodiment, before the processor simultaneously inputs the angle vectors of the original face image and the target face image into the pre-trained face image generation network, the process includes: obtaining face images of a specified number of users, wherein the face images of the same user include at least two angle images corresponding to specified angles; mapping the specified angles corresponding to the angle images to vector values ​​of specified lengths; combining the angle images and the vector values ​​of specified lengths corresponding to the specified angles into training samples; inputting the training samples into a neural network for training to obtain a classification model that can classify the image domain corresponding to the specified angles; and using the classification model as a pre-trained face image generation network.

[0150] In one embodiment, the processor combines the angle image and the vector value of the specified length corresponding to the specified angle into a training sample, including: obtaining a first pixel value corresponding to a facial organ in a first angle image, wherein the first angle image is included in all angle images; obtaining a standard facial image corresponding to a first specified angle; correcting the first pixel value according to the standard pixel values ​​corresponding to each facial organ in the standard facial image to obtain a corrected first pixel value; and combining the second angle image carrying the corrected first pixel value and the first vector value corresponding to the first angle into a corrected training sample.

[0151] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the above-mentioned computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0152] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.

[0153] 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 method for generating a face image, characterized in that: include: Inputting the angle vectors of the original face image and the target face image into a pre-trained face image generation network at the same time, wherein the angle vector of the target face image includes at least one; The original face image is converted into a first target face image corresponding to a first angle vector by the pre-trained face image generation network according to a preset conversion method, wherein the first angle vector is included in the angle vectors corresponding to all the target face images, and the first target face image is included in all the target face images; Evaluate whether the first angle vector matches the first target face image through a preset discriminant network; If they match, output the first target face image; The step of converting the original face image into a first target face image corresponding to the first angle vector according to a preset conversion method through the pre-trained face image generation network comprises: Cutting out a face head region image from the original face image; Locating feature points corresponding to designated organs of the face according to the feature point positioning model, wherein the designated organs include at least one; Acquire coordinate data of feature points corresponding to each of the designated organs; wherein the feature points include at least five; Mapping each of the coordinate data one by one to a feature point template corresponding to the first angle vector to obtain a face area corresponding to the first angle vector; forming the first target face image according to the face area corresponding to the first angle vector; The step of evaluating whether the first angle vector matches the first target face image through a preset discriminant network comprises: Inputting the inverse angle of the first angle vector and the first target face image as input to the pre-trained face image generation network; generating a second target face image according to the inverse angle of the first angle vector and the first target face image; Determining whether the second target facial image is the same as the original facial image; If they are the same, it is determined that the first angle vector matches the first target face image.

2. The method for generating a face image according to claim 1, characterized in that: After the step of determining whether the second target face image is the same as the original face image, the method further comprises: If the second target facial image is different from the original facial image, determining difference information between the second target facial image and the original facial image; Generate a first correction loss function according to the difference information, wherein the first correction loss function is Lg=Ladv+Lfcls+Lrec, Ladv=log D(x)+log(1-D(G(x,c)), Lfcls=-log D(G(x,c)), Lrec=||xG(G(x,c),c')||, G represents a face image generation network, G(x,c) represents an input image x, and a face image corresponding to a generation angle of c, D(x) represents a domain label probability distribution calculated by D for a real image, D represents a discriminant network function, and c'=-c; Correct parameters in the pre-trained face image generation network according to the first correction loss function.

3. The method for generating a face image according to claim 1, characterized in that: After the step of outputting the first target face image, the method further comprises: Determining whether the angle classifications respectively corresponding to the first target face images are correct; If not, the discriminant network is corrected by a second correction loss function, wherein the second correction loss function Ld=-Ladv+Lfcls, Ladv=logD(x)+log(1-D(G(x,c)), Lfcls=-logD(G(x,c)), G(x,c) represents the input image x, and the corresponding face image when the generation angle is c, D(x) represents the domain label probability distribution calculated by D for the real image, and D represents the discriminant network function.

4. The method for generating a face image according to claim 1, characterized in that: Before the step of simultaneously inputting the angle vectors of the original face image and the target face image into the pre-trained face image generation network, the method includes: Acquire facial images of a specified number of users, wherein the facial image of the same user includes at least two angle images corresponding to specified angles; The specified angle corresponding to the angle image is mapped to a vector value of a specified length; Combining the angle image and the vector value of the specified length corresponding to the specified angle into a training sample; Inputting the training samples into a neural network for training to obtain a classification model capable of classifying the image domain corresponding to the specified angle; The classification model is used as the pre-trained face image generation network.

5. The method for generating a face image according to claim 4, characterized in that: The step of combining the angle image and the vector value of the specified length corresponding to the specified angle into a training sample comprises: Obtaining a first pixel value corresponding to a facial organ in a first angle image, wherein the first angle image is included in all the angle images; Obtain a standard face image corresponding to a first specified angle; Correcting the first pixel value according to the standard pixel value corresponding to each facial organ in the standard facial image to obtain a corrected first pixel value; The second angle image carrying the corrected first pixel value and the first vector value corresponding to the first angle are combined into a corrected training sample.

6. A device for generating a face image, used to execute the method according to any one of claims 1 to 5, characterized in that: include: A first input module is used to input the angle vectors of the original face image and the target face image into the pre-trained face image generation network at the same time, wherein the angle vector of the target face image includes at least one; A conversion module, configured to convert the original face image into a first target face image corresponding to a first angle vector according to a preset conversion method through the pre-trained face image generation network, wherein the first angle vector is included in the angle vectors corresponding to all the target face images, and the first target face image is included in all the target face images; An evaluation module, used for evaluating whether the first angle vector matches the first target face image through a preset discriminant network; The output module is used to output the first target face image if there is a match.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.