Face image generation method and device, computer device, and storage medium
By performing feature extraction and iterative processing on facial images and generating models, multiple target facial images with different facial attributes that meet preset conditions are generated. This solves the problem of insufficient facial attribute images when training a facial recognition model, improves the training accuracy of the model, and saves resources.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD
- Filing Date
- 2024-12-26
- Publication Date
- 2026-06-26
AI Technical Summary
In existing technologies, the number of facial images with different facial attributes used to train facial recognition models is limited, resulting in insufficient model training accuracy and difficulty in meeting the requirements for high-precision recognition.
By extracting features from the first face image, and using a pre-trained face image generation model and attribute prediction model, multiple target face images with different facial attributes that meet the preset loss function conditions are generated. This includes feature extraction, image generation, attribute prediction, and loss value judgment. Features are automatically updated to generate images that meet the requirements.
It enables the generation of a large number of target face images with different facial attributes based on a small number of original face images, saving manpower and resources, improving the training accuracy of face recognition models, and requiring no manual intervention.
Smart Images

Figure CN122290185A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, computer device, and storage medium for generating human face images. Background Technology
[0002] With the rapid development of artificial intelligence technology, applications such as security monitoring and identity authentication place high demands on the accuracy of facial recognition. To achieve accurate facial recognition, a high-precision facial recognition model is needed and deployed in these applications to meet their accuracy requirements. This necessitates acquiring a large number of facial images with diverse facial attributes to train a high-precision facial recognition model. However, the number of facial images with different attributes that can be collected for training is limited, thus limiting the training accuracy of the model. Therefore, acquiring a large number of facial images with different attributes is crucial for training a highly accurate model. How to acquire such a large number of facial images with diverse attributes is a pressing technical problem that needs to be solved. Summary of the Invention
[0003] This invention provides a method, apparatus, computer device, and storage medium for generating facial images, in order to solve the problem of how to acquire a large number of facial images with different facial attributes.
[0004] A method for generating a face image, comprising: The first face image is subjected to feature extraction processing to determine the first face feature corresponding to the first face image, and the first face feature is determined as the target face feature; A pre-trained face image generation model is used to perform image generation processing on the target face features to obtain a second face image; The second face image is subjected to feature extraction processing to determine the second face features corresponding to the second face image; The second face image is used to predict attributes using at least one pre-trained attribute prediction model to obtain attribute prediction results corresponding to at least one of the attribute prediction models. Based on the first facial feature, the second facial feature, at least one of the attribute prediction results, and the preset attribute label value, the target loss value corresponding to the target loss function is determined; When the target loss value does not meet the preset stop update condition, a third face feature is obtained based on the second face feature, the third face feature is updated to the target face feature, and the image generation process of the target face feature using the pre-trained face image generation model is repeated to obtain the second face image. When the target loss value meets the preset stop update condition, the second face image is determined as the target face image.
[0005] A face image generation device, comprising: The feature extraction module is used to perform feature extraction processing on the first face image, determine the first face feature corresponding to the first face image, and determine the first face feature as the target face feature; The second face image acquisition module is used to perform image generation processing on the target face features using a pre-trained face image generation model to obtain a second face image; The second face feature determination module is used to perform feature extraction processing on the second face image to determine the second face feature corresponding to the second face image; The attribute prediction result acquisition module is used to perform attribute prediction on the second face image using at least one pre-trained attribute prediction model to obtain attribute prediction results corresponding to at least one of the attribute prediction models. The target loss value determination module determines the target loss value corresponding to the target loss function based on the first face feature, the second face feature, at least one of the attribute prediction results, and a preset attribute label value. The feature update module is used to obtain a third face feature based on the second face feature when the target loss value does not meet the preset stop update condition, update the third face feature to the target face feature, and repeatedly perform the image generation processing of the target face feature using the pre-trained face image generation model to obtain the second face image. The target face image determination module is used to determine the second face image as the target face image when the target loss value meets the preset stop update condition.
[0006] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described face image generation method.
[0007] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described face image generation method.
[0008] The aforementioned face image generation method, apparatus, computer equipment, and storage medium extract features from a first face image to obtain first face features. Based on the first face features, a target face feature is determined, and image generation processing is performed on the target face feature to obtain a second face image. Based on the first face feature corresponding to the first face image, the second face feature corresponding to the second face image, the attribute prediction result, and the preset attribute label value, a target loss value is determined. Based on whether the target loss value meets a preset stop-update condition, it is determined whether the facial attributes of the second face image meet the facial attribute requirements corresponding to the preset attribute label value. If the target loss value does not meet the preset stop-update condition, the second face feature is updated, and a second face image is generated again based on the updated second face feature. If the target loss value meets the preset stop-update condition, the second face image corresponding to the target loss value is determined as the target face image. This method determines whether the facial attributes in a second face image meet the requirements of the preset attribute label value by setting preset attribute label values. When setting preset attribute label values of different sizes, it can generate target face images that meet the requirements of the facial attributes corresponding to preset attribute label values of different sizes. It can generate multiple target face images with different facial attributes based on a first face image, thereby achieving the goal of generating a large number of target face images with different facial attributes based on a small number of first face images. This method can obtain a large number of target face images with different facial attributes without human intervention, saving human and material resources and has high application value. Attached Figure Description
[0009] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a flowchart of a face image generation method according to an embodiment of the present invention; Figure 2 This is another flowchart of a face image generation method in one embodiment of the present invention; Figure 3 This is another flowchart of a face image generation method in one embodiment of the present invention; Figure 4 This is another flowchart of a face image generation method in one embodiment of the present invention; Figure 5 This is another flowchart of a face image generation method in one embodiment of the present invention; Figure 6 This is another flowchart of a face image generation method in one embodiment of the present invention; Figure 7 This is another flowchart of a face image generation method in one embodiment of the present invention; Figure 8 This is a schematic diagram of a face image generation device according to an embodiment of the present invention; Figure 9 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation
[0011] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the 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 effort are within the scope of protection of the present invention.
[0012] The face image generation method provided in this embodiment of the invention is used to obtain a large number of face images with different facial attributes.
[0013] In one embodiment, such as Figure 1 As shown, a method for generating face images is provided, which can be applied to... Figure 9 Taking a computer device as an example, the explanation includes the following steps: S101: Perform feature extraction processing on the first face image, determine the first face feature corresponding to the first face image, and determine the first face feature as the target face feature; S102: Use a pre-trained face image generation model to generate an image of the target face features to obtain a second face image; S103: Perform feature extraction processing on the second face image to determine the second face features corresponding to the second face image; S104: Use at least one pre-trained attribute prediction model to predict the attributes of the second face image, and obtain the attribute prediction results corresponding to at least one attribute prediction model. S105: Based on the first face feature, the second face feature, at least one attribute prediction result, and the preset attribute label value, determine the target loss value corresponding to the target loss function; S106: When the target loss value does not meet the preset stop update condition, based on the second face feature, the third face feature is obtained, the third face feature is updated to the target face feature, and the image generation processing of the target face feature using the pre-trained face image generation model is repeated to obtain the second face image. S107: When the target loss value meets the preset stop update condition, the second face image is determined as the target face image.
[0014] Here, the first face image refers to the face image used for image generation. The first face feature refers to the features corresponding to the facial attributes of the first face image. These facial attributes include, but are not limited to, face angle, face quality, facial expression, face age, and facial hair. Face quality refers to the quality of the generated face image. Understandably, for the first face image, during acquisition in the application scenario, factors such as different lighting intensities, different face angles, and different facial expressions will all affect the face quality of the first face image. The target face feature refers to the features used to generate the second face image. The second face image refers to the face image generated based on the first face image.
[0015] As an example, in step S101, the computer device acquires a face image from the application scenario and identifies this face image as the first face image. The computer device extracts features corresponding to facial attributes such as face angle, face quality, face expression, face age, and facial hair from the first face image to obtain the first face feature corresponding to the first face image. The first face feature is identified as the target face feature to make it feasible to generate a second face image based on the target face feature. In this example, the application scenario includes, but is not limited to, security monitoring and identity verification scenarios. Understandably, to generate face images with different facial attributes, it is necessary to acquire the first face feature corresponding to the existing first face image so that a face image with different facial attributes than the first face image can be generated based on the first face feature.
[0016] Among them, the face image generation model refers to the model used to generate face images based on facial features.
[0017] As an example, in step S102, the computer device inputs the target facial features into a pre-trained face image generation model, processes the target facial features using the pre-trained face image generation model, and outputs a second face image corresponding to the target face image. In this example, the pre-trained face image generation model includes, but is not limited to, energy-based models, diffusion models, and autoregressive models, used to generate a second face image with facial attributes different from the first face image.
[0018] The second facial feature refers to the facial features corresponding to the second facial image.
[0019] As an example, in step S103, the computer device uses a preset feature extraction model to perform feature extraction processing on the second face image, obtaining the second face features corresponding to the second face image. This allows the system to determine whether the second face image generated in step S102 matches the identity of the face in the first face image used to generate the second face image, based on the second face features. In this example, the feature extraction model includes, but is not limited to, multi-scale convolutional neural network models and deep convolutional neural network models. Understandably, during the face image generation process, to ensure the quality of the generated face image, it is necessary to control that the face in the generated target face image corresponds to the same identity as the face in the first face image used to generate the target face image. This requires obtaining the second face features corresponding to the second face image, so that the system can subsequently determine whether the first face image and the second face image correspond to the same identity based on the differences between the second face features and the first face features.
[0020] The attribute prediction model refers to the model used to generate attribute prediction results corresponding to facial attributes in the second face image. The attribute prediction result is the quantified value output by the attribute prediction model after evaluating the facial attributes in the second face image. Understandably, the second face image contains multiple facial attributes. By using an attribute prediction model corresponding to at least one facial attribute, the attribute prediction result of at least one facial attribute in the second face image is determined, realizing the quantification of at least one facial attribute. This allows for subsequent updates of the second face features based on the quantified attribute prediction result, generating a target face image different from the first face image in at least one facial attribute.
[0021] As an example, in step S104, the computer device inputs the second face image into at least one attribute prediction model, performs attribute prediction processing on the second face image using at least one pre-trained attribute prediction model, and outputs the attribute prediction results corresponding to at least one attribute prediction model. In this example, the computer device determines the type of attribute prediction model based on the pre-set categories of facial attributes that need to be changed. For example, facial attributes include face angle, face quality, face expression, face age, and facial hair, etc. If it is necessary for the acquired target face image to have different face expressions and face ages than the first face image, then the types of attribute prediction models are the attribute prediction model corresponding to face expression and the attribute prediction model corresponding to face age. The computer device uses the attribute prediction model corresponding to face expression and the attribute prediction model corresponding to face age to perform attribute prediction on the second face image, obtaining the attribute prediction results corresponding to face expression and face age in the second face image, so that a target face image different from the first face image in face expression and face age can be generated subsequently based on the attribute prediction results corresponding to face expression and face age. In this example, the attribute prediction results corresponding to at least one attribute prediction model are obtained so that a target face image that is different from the first face image in terms of facial attributes corresponding to the attribute prediction model can be generated based on the attribute prediction results.
[0022] Here, the preset attribute label value refers to the quantized value corresponding to the facial attributes of the target face image to be output, which is predetermined. The target face image refers to a face image whose facial attributes satisfy the preset attribute label value. The target loss function is a function used to judge the difference between the first face feature and the second face feature, as well as the difference between the attribute prediction result and the preset attribute label value. The target loss value is the function value determined by the target loss function.
[0023] As an example, in step S105, the computer device determines a target loss function based on the feature differences between the first face image and the second face image, and the facial attribute differences between the facial attributes corresponding to the second face image and preset facial attribute requirements. Based on the target loss function, it calculates the difference between the first and second face features to determine the feature differences between them. It then calculates at least one attribute prediction result and the preset attribute label value corresponding to each attribute prediction result to determine the facial attribute difference between each attribute prediction result and its corresponding preset attribute label value. Finally, based on the feature differences between the first and second face features, and the facial attribute differences between each attribute prediction result and its corresponding preset attribute label value, it obtains the target loss value corresponding to the target loss function. In this example, to obtain a large number of face images with different facial attributes, different preset attribute label values can be set. Different target loss values are determined using these different preset attribute label values, so that a large number of target face images with different facial attributes can be obtained based on these different target loss values.
[0024] The preset stop-update condition refers to the conditions under which updating the second facial feature is stopped. The preset stop-update condition includes, but is not limited to, the target loss value being less than a preset threshold, the target loss value being stable within a certain range, or the target loss value being calculated a preset number of times. In this example, the computer device determines that the target loss value meets the preset stop-update condition when it determines that the target loss value is less than the preset threshold, or the target loss value is stable within a certain range, or the target loss value has been calculated a preset number of times. Conversely, the computer device determines that the target loss value does not meet the preset stop-update condition when it determines that the target loss value is not less than the preset threshold, or the target loss value is not stable within a certain range, or the target loss value has not been calculated a preset number of times.
[0025] The third facial feature refers to the facial feature updated from the second facial feature.
[0026] As an example, in step S106, when the computer device determines that the target loss value does not meet the preset stop-update condition, it updates the second face feature to obtain the third face feature, updates the third face feature to the target face feature, and repeats step S102, that is, it repeatedly performs image generation processing on the target face feature using the pre-trained face image generation model to obtain the second face image. Understandably, when the target loss value does not meet the preset stop-update condition, it indicates that the attribute prediction result corresponding to the facial attributes in the second face image does not meet the requirements of the preset attribute label value. That is, the generated second face image does not meet the preset facial attribute requirements, and it is necessary to update the second face feature corresponding to the most recently generated second face image in order to obtain a second face image that meets the facial attribute requirements corresponding to the preset attribute label value.
[0027] As an example, in step S107, when the computer device determines that the target loss value meets the preset stop-update condition, it identifies the second face image as the target face image. Understandably, when the target loss value meets the preset stop-update condition, it indicates that the attribute prediction result corresponding to the facial attributes in the second face image meets the facial attribute requirements corresponding to the preset attribute label values. Therefore, a second face image can be generated that has different facial attributes from the first face image and meets the facial attribute requirements corresponding to the preset attribute label values.
[0028] In this embodiment, feature extraction is performed on the first face image to obtain the first face feature. The target face feature is determined based on the first face feature, and image generation processing is performed on the target face feature to obtain the second face image. The target loss value is determined based on the first face feature corresponding to the first face image, the second face feature corresponding to the second face image, the attribute prediction result, and the preset attribute label value. Based on whether the target loss value meets the preset stop update condition, it is determined whether the facial attributes of the second face image meet the facial attribute requirements corresponding to the preset attribute label value. If the target loss value does not meet the preset stop update condition, the second face feature is updated, and the second face image is generated again based on the updated second face feature. If the target loss value meets the preset stop update condition, the second face image corresponding to the target loss value is determined as the target face image. This method determines whether the facial attributes in a second face image meet the requirements of the preset attribute label value by setting preset attribute label values. When setting preset attribute label values of different sizes, it can generate target face images that meet the requirements of the facial attributes corresponding to preset attribute label values of different sizes. It can generate multiple target face images with different facial attributes based on a first face image, thereby achieving the goal of generating a large number of target face images with different facial attributes based on a small number of first face images. This method can obtain a large number of target face images with different facial attributes without human intervention, saving human and material resources and has high application value.
[0029] In another embodiment, such as Figure 2 As shown, before step S101, that is, before performing feature extraction processing on the first face image, the face image generation method further includes: S201: Obtain the first training feature corresponding to the original training image; S202: The first training features are processed by the feature mask autoencoder of the face image generation model to obtain the second training features corresponding to the original training image; S203: An image generator using a face image generation model processes the second training features corresponding to the original training image to generate a generated training image corresponding to the second training features; S204: An image discriminator using a face image generation model processes the original training image and the corresponding generated training image to determine the adversarial loss function value; S205: Determine the reconstruction loss function value and the identity loss function value based on the original training image and the corresponding generated training image; S206: Determine the training loss function value corresponding to the face image generation model based on the adversarial loss function value, reconstruction loss function value, and identity loss function value; S207: Based on the training loss function value, update the feature mask autoencoder, image generator, and image discriminator in the face image generation model to obtain the trained face image generation model.
[0030] Here, the original training image refers to the face image used to train the face image generation model. The first training feature refers to the facial features corresponding to the facial attributes of the original training image.
[0031] As an example, in step S201, the computer device acquires multiple original training images used to train the face image generation model in an application scenario. These application scenarios include, but are not limited to, security monitoring and identity authentication. The computer device uses a preset feature extraction model to extract face features from the multiple original training images, obtaining a first training feature corresponding to each original training image. In this example, the preset feature extraction model includes, but is not limited to, a multi-scale convolutional neural network model and a deep convolutional neural network model.
[0032] Among them, the feature mask autoencoder refers to an encoder used to mask facial features. The second training feature refers to the feature obtained after processing the first training feature.
[0033] As an example, in step S202, the computer device inputs the first training feature corresponding to each original training image in the application scenario into the feature mask autoencoder of the face image generation model. The feature mask autoencoder randomly masks a certain proportion of rows in each first training feature to obtain the masked second training feature. Understandably, the second training feature has a certain proportion of row feature loss compared to the first training feature, so that the face image generation model can capture robust and discriminative features from the second training feature with feature loss, generating a generated training image with high similarity to the original training image, thereby enabling the face image generation model to have better feature generalization ability.
[0034] Here, the image generator refers to the generator used to generate face images in the face image generation model. The generated training image refers to the face image generated by the image generator based on the second training features.
[0035] As an example, in step S203, the computer device inputs multiple second training features with feature loss into the image generator in the face image generation model, uses the image generator to perform image generation processing on the second training features, and outputs the generated training image corresponding to each second training feature, so as to determine the training loss function value corresponding to the face image generation model based on the generated training image corresponding to each second training feature.
[0036] In this context, the image discriminator refers to the discriminator in the face image generation model used to distinguish the face images generated by the image generator. The adversarial loss function value refers to the loss function value generated by the generative adversarial network, which consists of the image generator and the image discriminator, during the face image generation process.
[0037] As an example, in step S204, the computer device processes each original training image and the corresponding generated training image generated by the image generator for each original training image using the image discriminator of the face image generation model to determine the adversarial loss function value. In this example, the adversarial loss function value... for: Where G represents the image generator, D represents the image discriminator, and E() represents the expected value of the loss function of the image discriminator during the discrimination process of multiple generated training images. This represents the sample data in the original training images. This represents the sample data used to generate the training images. This represents the distribution of sample data in each original training image. This represents the distribution of the sample data in the generated training images. This refers to the generated training images produced by the image generator. This represents the probability that the sample data in the original training image is true. This represents the probability that the image discriminator determines that the sample data in the generated training images produced by the image generator is real.
[0038] The reconstruction loss function is used to determine the difference between the face images in the original training images and the face images in the generated training images. The identity loss function is used to determine the difference between the face features in the original training images and the face features in the generated training images.
[0039] As an example, in step S205, the computer device performs a difference analysis on the face image in each original training image and the face image in the corresponding generated training image to determine the reconstruction loss function value of the generated training image. A difference analysis is performed on the facial features in each original training image and the facial features in the corresponding generated training image to determine the identity loss function value. Understandably, in the process of face image generation, to ensure the quality of the generated face image, it is necessary to ensure that the identity of the face in the generated face image is consistent with that in the original face image. Therefore, during the training of the face image generation model, by constraining the differences between the face images in the original training images and the face images in the generated training images, as well as the differences between the face features in the original training images and the face features in the generated training images, the identity of the face in the generated training images is controlled to be consistent with that in the original training images, so that the face image generation model trained subsequently can generate face images with the same identity as the original face images.
[0040] The training loss function value refers to the loss function generated by the face image generation model during the training process.
[0041] As an example, in step S206, the computer device uses a preset correction coefficient. , and The adversarial loss function values are respectively Reconstruction loss function value and identity loss function value After making corrections, the training loss function value Y= is obtained. + + Understandably, since the generative adversarial loss function represents the difference between the generated training image and the original training image, the reconstruction loss function represents the difference between the face image in the original training image and the face image in the generated training image, and the identity loss function represents the difference between the face features in the original training image and the face features in the generated training image, the training loss function represents the difference between the generated training image and the original training image corresponding to each generated training image. The smaller the training loss function value, the better the training effect of the face image generation model. Obtaining the training loss function value is necessary to determine whether the face image generation model has been trained successfully.
[0042] As an example, in step S207, when the computer device determines that the training loss function value does not meet the preset convergence condition, it updates the feature mask autoencoder, image generator, and image discriminator in the face image generation model. When it determines that the training loss function value meets the preset convergence condition, it identifies the updated feature mask autoencoder, image generator, and image discriminator in the face image generation model as the trained face image generation model. In this example, the preset convergence condition includes the training loss function value being less than a preset loss function value, the training loss function value being within a stable range, or the number of calculations of the training loss function value reaching a preset number of calculations. The computer device determines that the training loss function value does not meet the preset convergence condition when it determines that the training loss function value is not less than the preset loss function value, the training loss function value is not within a stable range, or the number of calculations of the training loss function value has not reached the preset number of calculations. The computer device determines that the training loss function value meets the preset convergence condition when it determines that the training loss function value is less than the preset loss function value, the training loss function value is within a stable range, or the number of calculations of the training loss function value has reached the preset number of calculations.
[0043] In this embodiment, a training loss function value is determined based on the generative adversarial loss function value, the reconstruction loss function value, and the identity loss function value. The face image generation model is then trained. Based on the training loss function value, the feature mask autoencoder, image generator, and image discriminator in the face image generation model are trained to obtain the trained face image generation model, so as to accurately generate face images based on the trained face image generation model.
[0044] In one embodiment, such as Figure 3 As shown, step S205, which involves determining the reconstruction loss function value and the identity loss function value based on the original training image and the corresponding generated training image, includes: S301: Perform pixel value recognition on the original training image and the generated training image corresponding to the original training image, determine the first pixel value and the second pixel value corresponding to the original training image, and determine the reconstruction loss function value based on the first pixel value and the second pixel value corresponding to the original training image. The first pixel value is the pixel value of the original training image, and the second pixel value is the pixel value of the generated training image corresponding to the original training image. S302: Extract features from the generated training image, determine the extracted features as the third training features corresponding to the original training image, and determine the identity loss function value based on the first and third training features corresponding to the original training image.
[0045] Here, the first pixel value refers to the pixel value of the original training image. The second pixel value refers to the pixel value of the generated training image.
[0046] As an example, in step S301, the computer device performs pixel value recognition on each original training image and the corresponding generated training image to determine the first pixel value of each original training image. The second pixel value of the generated training image corresponding to each original training image Based on the first pixel value The second pixel value corresponding to the first pixel value Determine the reconstruction loss function value .
[0047] In this example, = ,in, This represents the value of the first pixel in the i-th original training image. This represents the second pixel value of the generated training image corresponding to the i-th original training image. This indicates the number of original training images and the number of generated training images.
[0048] The third training feature refers to the features corresponding to the facial attributes of the faces in the generated training images.
[0049] As an example, in step S302, the computer device extracts features from the generated training image corresponding to each original training image to obtain the third training feature of the generated training image corresponding to each original training image. Based on the first training feature corresponding to each original training image and the third training feature corresponding to each first training feature Determine the identity loss function value .
[0050] In this example, = .in, This represents the first training feature corresponding to the i-th original training image. Let represent the third training feature of the generated training image corresponding to the i-th original training image. This represents the first training feature corresponding to the i-th original training image. The third training feature of the generated training image corresponding to the i-th original training image. Cosine similarity between them.
[0051] In this embodiment, the reconstruction loss function value of the face image generation model is determined based on the first pixel value and the second pixel value corresponding to the original training image. The identity loss function value of the face image generation model is determined based on the first training feature and the third training feature corresponding to the original training image. By constraining the pixel value difference between the face image in the original training image and the face image in the generated training image corresponding to the original training image, as well as the feature difference between the face features in the original training image and the face features in the generated training image corresponding to the original training image, the identity of the face in the generated training image is controlled to be consistent with that in the original training image, so that the face image generation model trained subsequently can generate a target face image with the same identity as the first face image.
[0052] In one embodiment, such as Figure 4 As shown, step S101, which involves performing feature extraction processing on the first face image to determine the first face features corresponding to the first face image, includes: S401: Use a pre-trained face image feature extraction model to extract features from the first face image to obtain the face features to be processed corresponding to the first face image; S402: Based on the size of the first face image, perform projection and expansion processing on the face features to be processed to determine the first face features corresponding to the first face image.
[0053] Among them, the facial features to be processed refer to the facial features extracted directly from the first facial image.
[0054] As an example, in step S401, the computer device inputs the first face image into the trained face image feature extraction model to obtain the face features to be processed corresponding to the facial attributes in the first face image. In this example, the face image feature extraction model includes, but is not limited to, a multi-scale convolutional neural network model and a deep convolutional neural network model.
[0055] Among them, projection and expansion processing refers to the processing method that controls the size of the facial features to be processed to be consistent with the size of the first facial image.
[0056] As an example, in step S402, after acquiring the facial features to be processed, the computer device performs feature projection processing on the facial features to be processed, obtaining a feature projection result with reduced feature dimensions. For example, the feature dimension corresponding to the feature projection result with reduced dimensions is 512. Based on the size of the first facial feature, the feature projection result with reduced feature dimensions is subjected to size expansion processing to obtain the first facial feature corresponding to the first facial image.
[0057] In this embodiment, the facial features to be processed are projected to reduce the feature dimension corresponding to the facial features to be processed, resulting in a feature projection result with reduced feature dimension. This reduces the complexity of expanding the feature projection result, and the feature projection result is expanded to the size corresponding to the first facial image to obtain the first facial feature. This allows a second facial image of the same size as the first facial image to be generated based on the first facial feature of the same size as the first facial image, so that the size of the final target facial image meets the image size requirements when training a facial recognition model in the application scenario.
[0058] In one embodiment, such as Figure 5 As shown, step S102, which involves using a pre-trained face image generation model to process the target face features to obtain a second face image, includes: S501: The feature mask autoencoder in the pre-trained face image generation model is used to mask the target face features to obtain masked face features. S502: The image generator in the pre-trained face image generation model is used to perform image generation processing on the masked face features to obtain the second face image.
[0059] Masking refers to a method of randomly masking a certain proportion of rows in the target face features. Masked face features are the face features obtained after masking the target face features.
[0060] As an example, in step S501, the computer device inputs the target facial features into the feature masking autoencoder in the trained face image generation model. The feature masking autoencoder randomly masks a certain proportion of the rows in the target facial features to obtain the masked facial features. Understandably, it is desired to generate a second face image with different facial attributes than the face image corresponding to the target facial features. The target facial features are the features corresponding to facial attributes. If the image is generated directly based on the target facial features, the resulting face image will not differ significantly from the face image corresponding to the target facial features in terms of facial attributes. Therefore, a certain proportion of the target facial features is masked to obtain the masked facial features, making the masked facial features different from the target facial features, so as to facilitate the generation of a second face image with different facial attributes than the face image corresponding to the target facial features. In this example, since the target face feature can be either the first face feature corresponding to the first face image or the second face feature corresponding to the previously generated second face image, the face image corresponding to the target face feature can be either the first face image or the most recently generated second face image.
[0061] In this example, the image generator is used to generate the second face image. Understandably, as can be seen from steps S203 and S204, in this example, the pre-trained face image generation model processes facial features through the image generator and image discriminator in the generative adversarial network, and generates a face image through the image generator. Therefore, in this example, in the trained face image generation model, the image generator outputs the second face image generated after processing the masked facial features.
[0062] As an example, in step S502, the computer device inputs the masked face features into the generative adversarial network (GAN) of a pre-trained face image generation model. The image generator in the GAN processes the masked face features and outputs a second face image. Understandably, the GAN learns masked face features that are missing features, and through the image generator in the GAN, outputs a second face image that matches the masked face features.
[0063] In this embodiment, by masking the target facial features, masked facial features with missing features are obtained. This feature loss can help the face image generation model capture more robust and discriminative facial features when performing image generation processing on the masked facial features. This results in the generated second face image having diverse facial features compared to the face image corresponding to the target facial features. By using this method to perform image generation processing on the target facial features corresponding to different first face images, a large number of second face images with differentiated facial attributes can be obtained.
[0064] In one embodiment, the attribute prediction results include face angle prediction results and face quality prediction results.
[0065] Among them, the face angle prediction result refers to the face angle value predicted by the attribute prediction model used to predict the face angle in the second face image. The face quality prediction result refers to the quantitative value of the face quality of the second face image obtained after the attribute prediction model used to predict the face quality performs quality prediction on the second face image.
[0066] In one embodiment, such as Figure 6 As shown, step S105, which involves determining the target loss value corresponding to the target loss function based on the first face feature, the second face feature, at least one attribute prediction result, and a preset attribute label value, includes: S601: Based on the first face feature and the second face feature, determine the feature loss value corresponding to the feature loss function; S602: Based on the preset angle label value and the face angle prediction result, determine the angle loss value corresponding to the angle loss function; S603: Based on the preset quality label value and the face quality prediction result, determine the quality loss value corresponding to the quality loss function; S604: Determine the target loss value corresponding to the target loss function based on the feature loss value, angle loss value, and quality loss value.
[0067] The feature loss function refers to the loss function that characterizes the feature differences between the first face image and the second face image. The feature loss value is the loss value calculated based on the feature loss function for the features of the first and second faces.
[0068] As an example, in step S601, the computer device acquires the first facial features corresponding to the first facial image. Second face features corresponding to the second face image Then, based on the feature loss function For the first facial features Second facial features The feature loss value is obtained through processing. .in, Indicates the first facial features Second facial features The cosine similarity between them. Understandably, due to the first face features Characterizing facial attributes of the first face image, and second face features. The feature loss function is used to constrain the facial attributes of the first face image, representing the facial attributes of the second face image. Second facial features The differences between them should be minimized to ensure that the first face image and the second face image correspond to the same face identity and to guarantee the quality of the face image in the second face image.
[0069] Here, the preset angle label value refers to the expected angle of the face in the second face image. The angle loss function is a loss function that characterizes the difference between the face angles in the first face image and the second face image. The angle loss value is the loss value calculated based on the angle loss function, using the angle label value and the predicted face angle.
[0070] As an example, in step S602, the computer device determines the face angle prediction result corresponding to the facial attribute of the second face image. Then, the angle loss function is used. Face angle prediction results Loss calculation is performed to obtain the angle loss value. ,in, For preset angle label values, ( ) represents absolute value. Understandably, to obtain a large number of face images with different facial attributes, it is necessary to set label values for different facial attributes to guide the generation of target face images. Preset angle label values are set. To improve the face angle prediction results With preset angle label value To ensure that the face angles in the second face image meet the requirements of the preset angle label values, it is necessary to obtain a face angle that satisfies the preset angle label values. The target face image corresponding to the facial attribute requirements. In this example, the preset angle label value... It can be any angle value, based on multiple preset angle label values. It can generate multiple label values that satisfy preset angles. The goal is to generate a large number of target face images with different facial attributes, based on the corresponding facial attribute requirements.
[0071] Here, the preset quality label value refers to the quantized value corresponding to the expected face quality in the second face image. The quality loss function is a loss function that characterizes the difference between the face quality of the first face image and the face quality of the second face image. The quality loss value is the loss value calculated based on the preset quality label value and the face quality prediction result according to the quality loss function.
[0072] As an example, in step S603, the computer device determines the face quality prediction result corresponding to the facial attribute of the second face image. Then, the angle loss function is used. Prediction results of facial angle Loss calculations are performed to obtain the mass loss value. ,in, This refers to setting preset quality label values. Understandably, to obtain a large number of face images with different facial attributes, it is necessary to set label values for different facial attributes to guide the generation of target face images. Therefore, setting preset quality label values is essential. To improve the face quality prediction results Compared with preset quality label value The goal is to approximate and constrain the face quality in the second face image to meet the requirements corresponding to a preset quality label value, so as to obtain a face quality that meets the preset quality label value. The target face image corresponding to the facial attribute requirements. In this example, multiple preset quality label values can be set. Based on multiple preset quality label values It can generate multiple quality label values that satisfy multiple preset values. The goal is to generate a large number of target face images with different facial attributes, based on the corresponding facial attribute requirements.
[0073] As an example, in step S604, the computer device determines the target loss function L=a b c Using preset correction coefficients a, b, and c, the feature loss value, angle loss value, and mass loss value are corrected respectively, resulting in a. b and c , for a b and c The summation process yields the target loss function value L. Understandably, the target loss function modifies the feature loss function, angle loss function, and quality loss function, and the modified results are summed. This is because the feature loss function is used to constrain the first face features corresponding to the first face image. Second face features corresponding to the second face image The differences between the two images are minimized. An angle loss function is used to constrain the face angles in the second face image to meet the requirements corresponding to the preset angle label values, and a quality loss function is used to constrain the face quality in the second face image to meet the requirements corresponding to the preset quality label values. Therefore, this target loss function can effectively constrain the second face image to be relatively similar to the first face image, and constrain the second face image to meet the face angle requirements corresponding to the preset angle label values in the face angle attribute, and the face quality requirements corresponding to the preset quality label values in the face quality attribute, thus obtaining a target face image that meets the preset facial attribute requirements. Furthermore, this method can obtain a large number of target face images that meet the face angle requirements and face quality requirements corresponding to the preset angle label values, under the premise that the preset angle label values and different preset quality label values are different, achieving the goal of obtaining a large number of target face images with different facial attributes.
[0074] In this embodiment, based on the feature loss value corresponding to the feature loss function, the angle loss value corresponding to the angle loss function, and the quality loss value corresponding to the quality loss function, it is determined that the second face image and the first face image can be constrained to be as similar as possible, and that the facial attributes of the second face image corresponding to the face quality and face angle are constrained. This is so that a target face image that meets the face angle requirements corresponding to the preset angle label value and the face quality requirements corresponding to the preset quality label value can be obtained based on the second face image. Furthermore, when different preset angle label values and preset quality label values are set, this method can obtain multiple target face images with different facial attributes corresponding to each first face image, thereby achieving the goal of obtaining a large number of target face images with different facial attributes from a small number of first face images.
[0075] In one embodiment, such as Figure 7 As shown, step S106, which is to obtain the third facial feature based on the second facial feature, includes: S701: Based on the second face features, process the target loss function to determine the original update gradient; S702: Correct the original update gradient using a preset gradient correction coefficient to determine the target update gradient; S703: Based on the target update gradient, update the second face features to obtain the third face features.
[0076] The original update gradient refers to the gradient used to update the second face features, which is determined directly based on the target loss function.
[0077] As an example, in step S701, the computer device will use the target loss function. Second facial features The target is identified as the target to be updated, and the target loss function is applied. Compared to second facial features Perform partial derivative processing to determine the original update gradient for updating the second face features. This allows for gradient updates of the second face features based on the original update gradient.
[0078] The preset gradient correction coefficients refer to the preset coefficients used to update the original update gradient. The target update gradient refers to the gradient used to update the second face feature.
[0079] As an example, in step S702, the computer device uses a preset gradient correction coefficient. For the original update gradient Perform correction processing to determine the target update gradient. ,in, = Understandably, a preset gradient correction coefficient is used. For the original update gradient Make corrections so that the corrected target updates its gradient. It can update the second face features more accurately.
[0080] As an example, in step S703, the computer device determines the difference between the second face feature and the target update gradient as the third face feature. This enables gradient updates of the second facial features. = — .
[0081] In this embodiment, the second face feature is processed according to the target loss function to determine the original update gradient. The original update gradient is then corrected, and the second face feature is updated according to the corrected target update gradient. This ensures that the target update gradient for updating the second face feature matches the actual situation of the second face feature, reduces gradient update error, and yields a more accurate third face feature.
[0082] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0083] In one embodiment, a face image generation apparatus is provided, which corresponds one-to-one with the face image generation methods described in the above embodiments. For example... Figure 8As shown, the face image generation device includes a feature extraction module 801, a second face image acquisition module 802, a second face feature determination module 803, an attribute prediction result acquisition module 804, a target loss value determination module 805, a feature update module 806, and a target face image determination module 807. Detailed descriptions of each functional module are as follows: The feature extraction module 801 is used to perform feature extraction processing on the first face image, determine the first face feature corresponding to the first face image, and determine the first face feature as the target face feature; The second face image acquisition module 802 is used to perform image generation processing on the target face features using a pre-trained face image generation model to obtain a second face image; The second face feature determination module 803 is used to perform feature extraction processing on the second face image to determine the second face features corresponding to the second face image; The attribute prediction result acquisition module 804 is used to perform attribute prediction on the second face image using at least one pre-trained attribute prediction model to obtain attribute prediction results corresponding to at least one attribute prediction model. The target loss value determination module 805 determines the target loss value corresponding to the target loss function based on the first face feature, the second face feature, at least one of the attribute prediction results and the preset attribute label value. The feature update module 806 is used to obtain a third face feature based on the second face feature when the target loss value does not meet the preset stop update condition, update the third face feature to the target face feature, and repeatedly perform the image generation processing of the target face feature using a pre-trained face image generation model to obtain a second face image. The target face image determination module 807 is used to determine the second face image as the target face image when the target loss value meets the preset stop updating condition.
[0084] In one embodiment, the face image generation apparatus further includes Obtain the first training feature corresponding to the original training image; The second training feature determination module is used to process the first training features using the feature mask autoencoder of the face image generation model to obtain the second training features corresponding to the original training image. The training image generation module is used by the image generator of the face image generation model to process the second training features corresponding to the original training image and generate the generated training image corresponding to the second training features. The first function value determination module is used by the image discriminator of the face image generation model to process the original training image and the generated training image corresponding to the original training image to determine the adversarial loss function value. The second function value determination module determines the reconstruction loss function value and the identity loss function value based on the original training image and the generated training image corresponding to the original training image; The training loss function value determination module determines the training loss function value corresponding to the face image generation model based on the adversarial loss function value, reconstruction loss function value, and identity loss function value. The face image generation model acquisition module updates the feature mask autoencoder, image generator, and image discriminator in the face image generation model based on the training loss function value, thus obtaining the trained face image generation model.
[0085] In one embodiment, the second function value determination module includes: The reconstruction loss function value determination submodule is used to identify pixel values of the original training image and the corresponding generated training image, determine the first pixel value and the second pixel value of the original training image, and determine the reconstruction loss function value based on the first pixel value and the second pixel value of the original training image. The first pixel value is the pixel value of the original training image, and the second pixel value is the pixel value of the corresponding generated training image. The identity loss function value determination submodule is used to determine the extracted features as the third training features corresponding to the original training image, and to determine the identity loss function value based on the first and third training features corresponding to the original training image.
[0086] In one embodiment, the feature extraction module 801 includes: The submodule for obtaining face features to be processed is used to extract features from the first face image using a pre-trained face image feature extraction model to obtain the face features to be processed corresponding to the first face image. The first face feature determination submodule is used to perform projection and expansion processing on the face features to be processed based on the size of the first face image, and determine the first face features corresponding to the first face image.
[0087] In one embodiment, the second face image acquisition module 802 includes: The masked face feature acquisition submodule is used to mask the target face features using the feature mask autoencoder in the pre-trained face image generation model to obtain the masked face features. The second face image acquisition submodule is used to perform image generation processing on the masked face features using the image generator in the pre-trained face image generation model to obtain the second face image.
[0088] In one embodiment, the target loss value determination module 805 includes: The feature loss value determination submodule determines the feature loss value corresponding to the feature loss function based on the first face feature and the second face feature. The angle loss value determination submodule determines the angle loss value corresponding to the angle loss function based on the preset angle label value and the face angle prediction result. The quality loss value determination submodule determines the quality loss value corresponding to the quality loss function based on the preset quality label value and the face quality prediction result. The target loss value determination submodule determines the target loss value corresponding to the target loss function based on the feature loss value, angle loss value, and quality loss value.
[0089] In one embodiment, the feature update module 806 includes: The original update gradient determination submodule is used to process the target loss function based on the second face features to determine the original update gradient; The target update gradient determination submodule is used to correct the original update gradient using preset gradient correction coefficients to determine the target update gradient. The third facial feature acquisition submodule updates the second facial features based on the target update gradient to obtain the third facial features.
[0090] Specific limitations regarding the face image generation device can be found in the limitations of the face image generation method described above, and will not be repeated here. Each module in the aforementioned face image generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in a computer device, or stored in software in the memory of a computer device, so that the processor can call and execute the operations corresponding to each module.
[0091] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores data used or generated during the execution of the face image generation method. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a face image generation method.
[0092] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the face image generation method described in the above embodiment, for example... Figure 1 As shown in S101-S107, or Figures 2 to 7 As shown, to avoid repetition, it will not be described again here. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in this embodiment of the face image generation apparatus, for example... Figure 8 The functions of the feature extraction module 801, the second face image acquisition module 802, the second face feature determination module 803, the attribute prediction result acquisition module 804, the target loss value determination module 805, the feature update module 806, and the target face image determination module 807 shown are not described in detail here to avoid repetition.
[0093] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When executed by a processor, the computer program implements the face image generation method described in the above embodiment, for example... Figure 1 As shown in S101-S107, or Figures 2 to 7 As shown, to avoid repetition, it will not be described again here. Alternatively, when the computer program is executed by the processor, it implements the functions of each module / unit in this embodiment of the face image generation apparatus, for example... Figure 8 The functions of the feature extraction module 801, the second face image acquisition module 802, the second face feature determination module 803, the attribute prediction result acquisition module 804, the target loss value determination module 805, the feature update module 806, and the target face image determination module 807 shown are not described in detail here to avoid repetition.
[0094] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can 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 a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0095] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0096] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for generating a human face image, characterized in that, include: The first face image is subjected to feature extraction processing to determine the first face feature corresponding to the first face image, and the first face feature is determined as the target face feature; A pre-trained face image generation model is used to perform image generation processing on the target face features to obtain a second face image; The second face image is subjected to feature extraction processing to determine the second face features corresponding to the second face image; The second face image is used to predict attributes using at least one pre-trained attribute prediction model to obtain attribute prediction results corresponding to at least one of the attribute prediction models. Based on the first facial feature, the second facial feature, at least one of the attribute prediction results, and the preset attribute label value, the target loss value corresponding to the target loss function is determined; When the target loss value does not meet the preset stop update condition, a third face feature is obtained based on the second face feature, the third face feature is updated to the target face feature, and the image generation process of the target face feature using the pre-trained face image generation model is repeated to obtain the second face image. When the target loss value meets the preset stop update condition, the second face image is determined as the target face image.
2. The face image generation method according to claim 1, characterized in that, Before performing feature extraction processing on the first face image, the face image generation method further includes: Obtain the first training feature corresponding to the original training image; The first training feature is processed by a feature mask autoencoder of a face image generation model to obtain the second training feature corresponding to the original training image. An image generator using a face image generation model processes the second training features corresponding to the original training image to generate a generated training image corresponding to the second training features; An image discriminator using a face image generation model processes the original training image and the generated training image corresponding to the original training image to determine the adversarial loss function value; Based on the original training image and the corresponding generated training image, determine the reconstruction loss function value and the identity loss function value; Based on the adversarial loss function value, the reconstruction loss function value, and the identity loss function value, the training loss function value corresponding to the face image generation model is determined; Based on the training loss function value, the feature mask autoencoder, image generator, and image discriminator in the face image generation model are updated to obtain the trained face image generation model.
3. The face image generation method according to claim 2, characterized in that, The step of determining the reconstruction loss function value and the identity loss function value based on the original training image and the corresponding generated training image includes: Pixel value recognition is performed on the original training image and the generated training image corresponding to the original training image to determine the first pixel value and the second pixel value corresponding to the original training image. Based on the first pixel value and the second pixel value corresponding to the original training image, the reconstruction loss function value is determined. The first pixel value is the pixel value of the original training image, and the second pixel value is the pixel value of the generated training image corresponding to the original training image. Feature extraction is performed on the generated training image, and the extracted features are determined as the third training features corresponding to the original training image. Based on the first training features and the third training features corresponding to the original training image, the identity loss function value is determined.
4. The face image generation method according to claim 1, characterized in that, The step of performing feature extraction processing on the first face image to determine the first face features corresponding to the first face image includes: A pre-trained face image feature extraction model is used to extract features from the first face image to obtain the face features to be processed corresponding to the first face image; Based on the size of the first face image, the face features to be processed are projected and expanded to determine the first face features corresponding to the first face image.
5. The face image generation method according to claim 1, characterized in that, The step of using a pre-trained face image generation model to perform image generation processing on the target face features to obtain a second face image includes: The target face features are masked by a feature mask autoencoder in a pre-trained face image generation model to obtain masked face features. The image generator in the pre-trained face image generation model is used to perform image generation processing on the masked face features to obtain a second face image.
6. The face image generation method according to claim 1, characterized in that, The attribute prediction results include face angle prediction results and face quality prediction results; The step of determining the target loss value corresponding to the target loss function based on the first facial feature, the second facial feature, at least one of the attribute prediction results, and a preset attribute label value includes: Based on the first face feature and the second face feature, determine the feature loss value corresponding to the feature loss function; Based on the preset angle label value and the face angle prediction result, the angle loss value corresponding to the angle loss function is determined; Based on the preset quality label value and the face quality prediction result, the quality loss value corresponding to the quality loss function is determined; Based on the feature loss value, the angle loss value, and the mass loss value, the target loss value corresponding to the target loss function is determined.
7. The face image generation method according to claim 1, characterized in that, The process of obtaining the third facial feature based on the second facial feature includes: Based on the second facial features, the target loss function is processed to determine the original update gradient; The original update gradient is corrected using a preset gradient correction coefficient to determine the target update gradient; Based on the target update gradient, the second face feature is updated to obtain the third face feature.
8. A face image generation device, characterized in that, include: The feature extraction module is used to perform feature extraction processing on the first face image, determine the first face feature corresponding to the first face image, and determine the first face feature as the target face feature; The second face image acquisition module is used to perform image generation processing on the target face features using a pre-trained face image generation model to obtain a second face image; The second face feature determination module is used to perform feature extraction processing on the second face image to determine the second face feature corresponding to the second face image; The attribute prediction result acquisition module is used to perform attribute prediction on the second face image using at least one pre-trained attribute prediction model to obtain attribute prediction results corresponding to at least one of the attribute prediction models. The target loss value determination module determines the target loss value corresponding to the target loss function based on the first face feature, the second face feature, at least one of the attribute prediction results, and a preset attribute label value. The feature update module is used to obtain a third face feature based on the second face feature when the target loss value does not meet the preset stop update condition, update the third face feature to the target face feature, and repeatedly perform the image generation processing of the target face feature using the pre-trained face image generation model to obtain the second face image. The target face image determination module is used to determine the second face image as the target face image when the target loss value meets the preset stop update condition.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the face image generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the face image generation method according to any one of claims 1 to 7.