A method for generating a facial expression image and related equipment
By using a feature style decoupling unit that integrates multi-task feature fusion, and leveraging a supervised style encoder and facial expression recognition task to decouple expression and identity information, the artifacts and identity loss issues during expression editing in existing technologies are resolved, thereby improving the quality and accuracy of image generation.
Patent Information
- Application Number
- CN202311114009.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-29
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-08-29
AI Technical Summary
Existing technologies struggle to effectively separate facial expression information from identity information during facial expression editing, resulting in poor quality of the generated target facial expression images. This is especially true when editing large-scale facial expressions and non-frontal face data, which can easily lead to artifacts and loss of identity information.
A feature style decoupling unit with multi-task feature fusion is adopted. It extracts expression style codes through supervised style encoder, decouples identity information using face expression recognition task, and generates target expression images by combining feature decoder, thereby enhancing the generator's feature learning and identity preservation.
It effectively separates facial expression and identity information, improving the quality and identity preservation of generated images and reducing artifacts, especially performing well in unaligned samples and large-span facial expression editing.
Smart Images

Figure CN117115290B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, system, terminal, and computer-readable storage medium for generating facial expression images. Background Technology
[0002] The importance of facial expressions in conveying human emotions is self-evident, and facial expression editing has received widespread attention from researchers. Facial expression editing refers to modifying the source expression of a facial image to a target expression while maintaining the consistency of the face's identity. Expression attributes are fine-grained facial attributes, with both expression and identity features concentrated in the facial features area, making expression editing a major challenge in facial editing. In facial expression editing, when there is a significant difference between the original expression in the input image and the target expression, artifacts often appear in the output image, significantly reducing the visual quality of the generated sample. Furthermore, in recent years, facial editing based on generative adversarial networks (GANs) has made great strides, with excellent models such as StarGAN, AttGAN, GANimation, Cascade EF-GAN, and StarGAN-v2 emerging. In image-to-image facial expression editing, the encoder-decoder framework can better preserve identity information, and therefore this framework is widely used in facial expression editing network models such as GANimation and Cascade EF-GAN. The difficulty of facial expression attribute editing lies in maintaining identity while editing the expression. Since facial expression features and identity features are concentrated in the facial features area, seemingly subtle changes in the shape of facial features can have a significant impact on the identity of an image. Therefore, facial expression synthesis is a challenging task. Furthermore, the encoder-decoder network framework can cause subtle loss of identity information during downsampling.
[0003] To accurately edit facial expressions while preserving identity information, existing technologies focus on using attention mechanisms to separate expression from identity. GANimation is a unified network framework specifically for facial expression editing. GANimation learns masks of target expression-related regions and the color and structural information of the target expression based on attention mechanisms. Using the learned masks, the generator selectively computes changes to target expression-related regions while preserving regions unrelated to the expression. Since both expression and identity features are concentrated in the facial features area, the model struggles to learn accurate target expression-related regions. Therefore, GANimation tends to produce artifacts in areas where facial features overlap with the face, and in large-scale expression editing, it not only produces artifacts but also causes the target expression to malfunction. Large-scale expression editing refers to expression editing where the target expression differs significantly from the original expression.
[0004] To address the anomaly issues in large-scale facial expression editing, existing technologies typically employ a unified model, Cascade EF-GAN, to progressively edit large-scale expressions. First, Cascade EF-GAN uses local attention mechanisms to learn regions highly relevant to expressions, such as the eyes, nose, and mouth, thereby separating regions unrelated to expressions. By combining global and local attention masks, the generator retains more identity information and significantly reduces artifacts. However, this method requires prior knowledge of local information and is only applicable to frontal face data, thus having certain limitations. To address the anomaly problem in large-scale facial expression editing, Cascade EF-GAN decomposes large-scale facial expression editing into multiple smaller-scale editing tasks, progressively achieving large-scale facial expression editing. The generator uses the output image of the previous small-scale task as input for the next small-scale task, obtaining the final output after three editing steps. This progressive strategy better preserves identity-related information and facial structure, reduces artifact generation, and stabilizes the effect of large-scale facial expression editing.
[0005] While Cascade EF-GAN offers a broad approach to facial expression editing, its performance on many difficult samples remains unsatisfactory. When input samples have large angles (side profile, tilted head, or occlusion / misalignment), existing models still tend to generate numerous artifacts in expression-related regions. Furthermore, preserving identity information is a major challenge in facial expression editing. This is because generators struggle to completely separate facial cues from identity information in the feature space. Therefore, coupling expression and identity remains a primary challenge in accurately synthesizing target expressions while maintaining identity information.
[0006] To compensate for the information loss caused by downsampling networks, some neural networks use skip connections to preserve more image structure and facial features. The AttGAN (AttGAN General Attribute Editing) neural network uses skip connections to input features from intermediate layers of the encoder into corresponding layers of the decoder, thereby supplementing image information. Subsequently, experiments with STGAN demonstrated that the more skip connection layers in the generator, the more facial features are preserved. Conversely, the accuracy of facial attribute-edited samples decreases significantly. This is because the features in the encoder include both attribute-related and attribute-independent features. Features related to the original attributes, when input into the decoder, may interfere with the correct synthesis of the target attributes, leading to artifact anomalies.
[0007] Both GANimation and Cascade EF-GAN use attention mechanisms to separate expression-related and irrelevant regions, but attention mechanisms have certain limitations in fine-grained attributes. Furthermore, existing techniques, while compensating for information loss caused by downsampling networks, cannot separate identity and facial expression information, interfering with the model's final output.
[0008] Therefore, existing technologies still need to be improved and developed. Summary of the Invention
[0009] The main objective of this invention is to provide a method, system, terminal, and computer-readable storage medium for generating facial expression images, aiming to solve the problem in the prior art that when editing facial expression images, it is impossible to separate the facial expression information and the identity information of the person, resulting in poor quality of the generated target facial expression image.
[0010] To achieve the above objectives, the present invention provides a method for generating facial expression images, the method comprising the following steps:
[0011] Obtain the original face image and the target expression label, and encode the expression features of the original face image and the target expression label to obtain the original expression style code and the target expression style code;
[0012] Based on the original expression style encoding, the original expression information and the original face information in the original face image are decoupled to obtain the target identity information of the original face image;
[0013] The target facial expression style encoding and the target identity information are used to decode facial expression features to obtain the target facial expression image.
[0014] Optionally, the method for generating facial expression images, wherein obtaining an original facial image and a target expression label, and encoding expression features of the original facial image and the target expression label to obtain an original expression style code and a target expression style code, specifically includes:
[0015] Obtain the original face image and target expression label, input the original face image into the pre-trained supervised style expression encoder, and extract the expression style of the original face image through the reference image expression extractor in the supervised style expression encoder to obtain the original expression style code;
[0016] The target expression label is input into a pre-trained supervised style expression encoder. The expression mapper in the supervised style expression encoder is used to map the target expression label to extract the expression, thereby obtaining the target expression style code.
[0017] Optionally, the method for generating facial expression images, wherein the step of acquiring an original facial image and a target expression label, and encoding expression features of the original facial image and the target expression label to obtain an original expression style code and a target expression style code, further includes:
[0018] The original expression style code and the target expression style code are input into the expression classifier in the supervised style expression encoder to obtain the first multi-dimensional vector corresponding to the original expression style code and the second multi-dimensional vector corresponding to the target expression style code, respectively.
[0019] The cross-entropy loss between the first multidimensional vector and the second multidimensional vector and the target expression label is calculated respectively, and the supervised style expression encoder and the original expression style code are made to correctly represent the target expression image by controlling the minimization of the cross-entropy loss.
[0020] Optionally, in the method for generating facial expression images, the step of decoupling the original expression information and the original facial information in the original facial image according to the original expression style encoding to obtain the target identity information of the original facial image specifically includes:
[0021] The original face image is input into the feature encoder in the expression generation model to obtain the original expression information and original face information of the original face image, and the decoupling process of the original expression information and the original face information in the original face image is supervised according to the original expression style encoding.
[0022] Calculate the covariance matrix of the original facial expression information, and multiply the covariance matrix with the original facial information to obtain the facial expression style features;
[0023] The residual between the facial expression style features and the original facial information is calculated to obtain the identity content features;
[0024] The identity content features and the expression style features are orthogonally decomposed, and after orthogonal decomposition, it is determined whether the original expression information and the original face information in the original face image are successfully decoupled.
[0025] When decoupling is successful, the target identity information of the original face image is obtained.
[0026] Optionally, the method for generating facial expression images, wherein the step of decoding the target expression style encoding and the target identity information to obtain the target expression image specifically includes:
[0027] The target identity information is input into the feature map of the feature decoder in the expression generation model, and the target expression style encoding is used as the input of the feature decoder;
[0028] The target identity information and the target expression style encoding are decoded by the feature decoder to generate the target expression image.
[0029] Optionally, the method for generating facial expression images, wherein the step of decoding the target expression style encoding and the target identity information to obtain the target expression image, further includes:
[0030] The adversarial loss and cycle consistency loss of the target facial expression image are calculated, and the adversarial loss and cycle consistency loss are used to provide feedback on the accuracy of the target facial expression image generation.
[0031] Optionally, the method for generating facial expression images further includes the following steps: performing orthogonal decomposition on the identity content features and the expression style features, and determining whether the original expression information and the original facial information in the original facial image are successfully decoupled after orthogonal decomposition;
[0032] When decoupling fails, the original face image after orthogonal decomposition is input into the feature encoder in the style decoupling unit for re-decoupling until the original face image is successfully decoupled, thus obtaining the target identity information of the original face image.
[0033] Furthermore, to achieve the above objectives, the present invention also provides a system for generating facial expression images, wherein the system for generating facial expression images includes:
[0034] The expression style encoding generation module is used to acquire the original face image and the target expression label, and to encode the expression features of the original face image and the target expression label to obtain the original expression style code and the target expression style code;
[0035] The original face image decoupling module is used to decouple the original expression information and the original face information in the original face image according to the original expression style encoding, so as to obtain the target identity information of the original face image;
[0036] The target expression image generation module is used to decode the expression features of the target expression style encoding and the target identity information to obtain the target expression image.
[0037] In addition, to achieve the above objectives, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a facial expression image generation program stored in the memory and executable on the processor, wherein when the facial expression image generation program is executed by the processor, it implements the steps of the facial expression image generation method described above.
[0038] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a program for generating facial expression images, and when the program for generating facial expression images is executed by a processor, it implements the steps of the method for generating facial expression images as described above.
[0039] In this invention, an original face image and a target expression tag are acquired, and expression feature encoding is performed on the original face image and the target expression tag to obtain an original expression style code and a target expression style code. Based on the original expression style code, the original expression information and the original face information in the original face image are decoupled to obtain the target identity information of the original face image. The target expression style code and the target identity information are then decoded to obtain the target expression image. This invention enhances the features of the target expression by using the signal obtained from the supervised expression encoder as supervision, building upon one-hot encoding, allowing the generator to learn rich feature distribution information. Simultaneously, this invention uses expression as a style feature and identity as a content feature, decoupling style and content between the input encoder and the generator, suppressing the original expression features, and enabling the generation of target face expression images with arbitrary expressions while maintaining the expression identity information. Attached Figure Description
[0040] Figure 1 This is a flowchart of a preferred embodiment of the method for generating facial expression images according to the present invention;
[0041] Figure 2 This is a schematic diagram of the feature style decoupling unit framework for multi-task feature fusion, which is a preferred embodiment of the method for generating facial expression images of the present invention.
[0042] Figure 3 This is a schematic diagram illustrating the decoupling of facial expression style information and identity content information in a preferred embodiment of the method for generating facial expression images according to the present invention;
[0043] Figure 4 This is a schematic diagram comparing the facial expression image generated by the preferred embodiment of the method for generating facial expression images of the present invention with the facial expression images generated by the prior art.
[0044] Figure 5 This is a structural diagram of a preferred embodiment of the facial expression image generation system of the present invention;
[0045] Figure 6 This is a structural diagram of a preferred embodiment of the terminal of the present invention. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0047] The importance of facial expressions in conveying human emotions is self-evident, and facial expression editing has received widespread attention from researchers. Facial expression editing refers to modifying the source expression of a facial image to a target expression (e.g., generating a sad expression from a happy one) while maintaining the consistency of the face's identity. Expression attributes are fine-grained facial attributes, with both expression and identity features concentrated in the facial features area, making expression editing a major challenge in facial editing. In facial expression editing, when there is a significant difference between the original expression in the input image and the target expression, artifacts often appear in the output image, significantly reducing the visual quality of the generated sample. On the other hand, in recent years, facial editing based on generative adversarial networks (GANs) has made great progress, with excellent models such as StarGAN, AttGAN, GANimation, Cascade EF-GAN, and StarGAN-v2 emerging. In image-to-image facial expression editing, the encoder-decoder framework can better preserve identity information; therefore, this framework is widely used in facial expression editing network models such as GANimation and Cascade EF-GAN. The challenge of facial expression attribute editing lies in maintaining identity while editing expressions. Since both facial expression features and identity features are concentrated in the facial features, seemingly minor changes in the shape of the features can significantly impact the identity of an image. Therefore, facial expression synthesis is a challenging task. Furthermore, encoder-decoder network frameworks can cause subtle loss of identity information during downsampling.
[0048] To properly edit facial expressions and preserve identity information, existing technologies focus on attention mechanisms to separate facial expressions from identity.
[0049] GANimation is a unified network framework specifically for facial expression editing. Based on an attention mechanism, GANimation learns masks of target expression-related regions and the color and structural information of the target expression. Using the learned masks, the generator selectively computes changes to target expression-related regions while preserving regions unrelated to the expression. Since expression features and identity features are concentrated in the facial features area, the model struggles to learn accurate target expression-related regions. Therefore, GANimation tends to produce artifacts in areas where facial features overlap with the face, and in large-scale expression editing, it not only produces artifacts but also causes the target expression to malfunction. Large-scale expression editing refers to expression editing where the target expression differs significantly from the original expression.
[0050] To address the anomaly issues in large-scale facial expression editing, existing technologies have proposed a unified model, Cascade EF-GAN, for progressive editing of large-scale expressions. First, Cascade EF-GAN uses a local attention mechanism to learn regions highly relevant to expressions, such as the eyes, nose, and mouth, and then separates regions unrelated to expressions. By combining global and local attention masks, the generator retains more identity information and significantly reduces artifacts. However, this method requires prior knowledge of local information and is only applicable to frontal face data, thus having certain limitations. To address the anomaly problem in large-scale facial expression editing, Cascade EF-GAN decomposes large-scale facial expression editing into multiple smaller-scale facial expression editing tasks, progressively achieving large-scale facial expression editing. The generator uses the output image of the previous small-scale task as input for the next small-scale task, and after three edits, the final output is obtained. This progressive strategy better preserves identity-related information and facial structure, reduces artifact generation, and stabilizes the effect of large-scale facial expression editing.
[0051] While Cascade EF-GAN offers a broad approach to facial expression editing, its performance on many difficult samples remains unsatisfactory. When input samples have large angles (side profile, tilted head, occlusion, misalignment), existing models still tend to generate numerous artifacts in expression-related regions. Furthermore, preserving identity information is a major challenge in facial expression editing. This is because generators struggle to completely separate facial cues from identity information in the feature space. Therefore, coupling expression and identity remains a primary challenge in accurately synthesizing target expressions while maintaining identity information.
[0052] To compensate for the information loss caused by downsampling networks, some neural networks use skip connections to preserve more image structure and facial features. The AttGAN (AttGAN General Attribute Editing) neural network uses skip connections to input features from intermediate layers of the encoder into corresponding layers of the decoder, thereby supplementing image information. Subsequently, experiments with STGAN demonstrated that the more skip connection layers in the generator, the more facial features are preserved. Conversely, the accuracy of facial attribute-edited samples decreases significantly. This is because the features in the encoder include both attribute-related and attribute-independent features. Features related to the original attributes, when input into the decoder, may interfere with the correct synthesis of the target attributes, leading to artifact anomalies.
[0053] Both GANimation and Cascade EF-GAN use attention mechanisms to separate expression-related and irrelevant regions, but attention mechanisms have certain limitations in fine-grained attributes. Furthermore, existing techniques, while compensating for information loss caused by downsampling networks, cannot separate identity and facial expression information, interfering with the model's final output.
[0054] Image-to-image generation algorithms based on generative adversarial networks (GANs) are widely used in facial expression editing. However, existing network frameworks suffer from problems such as "expression editing failure" and "loss of identity information" when processing difficult samples, such as non-frontal face data. This invention proposes to use facial expression information from facial expression recognition tasks (previous expression editing only utilized the generator for expression editing, without leveraging the information extracted from expression features by the expression recognition task) to replace the one-hot encoding (also known as one-bit valid encoding, which uses an N-bit state register to encode N states, each state having its own independent register bit, and at any given time, only one bit is valid, i.e., only one bit is 1, and the rest are zero values) or facial motion units in existing technologies. This allows the generator to correctly edit the target expression, and a feature style decoupling unit based on multi-task feature fusion is proposed. As a supervised task, facial expression recognition can provide the generator with more accurate and fine-grained expression guidance information. The feature-style decoupling unit can separate facial expression style from identity content in the feature space and input the identity information into the later layers of the network (the neural network has many convolutional layers, with the later layers being deep), compensating for the loss of identity information. The algorithm proposed in this invention can effectively improve the image quality, facial expression accuracy, and identity preservation of synthesized images. Compared with four publicly available and widely used models, the algorithm proposed in this invention has higher performance in partially misaligned samples and large-span facial expression editing.
[0055] The method for generating facial expression images according to a preferred embodiment of the present invention, such as... Figure 1 As shown, the method for generating facial expression images includes the following steps:
[0056] Step S10: Obtain the original face image and the target expression label, and encode the expression features of the original face image and the target expression label to obtain the original expression style code and the target expression style code.
[0057] like Figure 2 As shown, in order to improve the quality of image-to-image facial expression editing samples, this invention proposes a multi-task framework that can correctly synthesize target expressions while preserving facial identity content. Figure 2 This paper demonstrates a network framework for facial expression editing based on a feature-style decoupling unit. The network consists of a supervised style encoder, a style decoupling unit, and an expression generation model (feature encoder and feature decoder). The supervised style encoder can extract expression vectors from image samples and also obtain corresponding expression vectors based on the label information of the target expression (e.g., if the original image is a happy expression, and a sad reference image is input into the neural network to obtain the target sad expression image, then sadness is the label information, and the neural network generates the required sad expression image based on the label information). Both types of expression vectors are supervised by an expression prediction classifier and used as expression style encoding input to the generator of the facial expression editing model. Guided by the expression style encoding, the generator uses adaptive normalization (normalization is a way to simplify calculations, that is, transforming a dimensional expression into a dimensionless expression, becoming a scalar. This method is frequently used in various calculations. Adaptive means that the neural network can find a better normalization result from the data) to edit the original feature distribution into the feature distribution of the target expression, thereby correctly synthesizing the target expression. To compensate for the changes and loss of identity information during feature layer editing and downsampling, this invention proposes a style decoupling unit. The style decoupling unit fuses intermediate layer features from facial expression editing and facial expression recognition, and separates expression information and identity information based on the decoupling of style and content.
[0058] This invention uses the extracted identity information to assist in facial expression editing tasks, while simultaneously employing a facial expression recognition task to effectively supervise the extracted facial expression information. A supervised style encoder extractor is used to learn expression style codes, which are supervised by a facial expression recognition network. The following section details the structural design of the supervised style encoder (SSE) and the feature style decoupling unit (SDU).
[0059] Specifically, the original face image and target expression label are obtained, the original face image is input into a pre-trained supervised style expression encoder, and the expression style of the original face image is extracted by the reference image expression extractor in the supervised style expression encoder to obtain the original expression style code.
[0060] The target expression label is input into a pre-trained supervised style expression encoder. The expression mapper in the supervised style expression encoder is used to map the target expression label to extract the expression, thereby obtaining the target expression style code.
[0061] Furthermore, the original expression style code and the target expression style code are input into the expression classifier in the supervised style expression encoder to obtain the first multidimensional vector corresponding to the original expression style code and the second multidimensional vector corresponding to the target expression style code, respectively.
[0062] The cross-entropy loss between the first multidimensional vector and the second multidimensional vector and the target expression label is calculated respectively, and the supervised style expression encoder and the original expression style code are made to correctly represent the target expression image by controlling the minimization of the cross-entropy loss.
[0063] To obtain expression style codes specific to facial cues, this invention proposes a supervised style expression encoder (SSE). The supervised style encoder (which can be replaced by many neural networks) consists of a reference image expression extractor, an expression mapper, and an expression classifier. The reference image expression extractor extracts facial cues from a given reference image. The expression mapper maps expression style codes based on expression labels (label information of the target expression). The expression classifier refines the expression style codes through supervised training.
[0064] S1: Given n facial expression categories in the training dataset, select two random facial expression labels. and corresponding reference image
[0065] S2: Reference Image Expression Extractor extracts reference images. The emoji style encoding is st1, and the emoji mapper is based on the emoji tag. An expression code st2 is generated based on Gaussian noise z. This yields two expression style codes: st1 is extracted from the image, and st2 is generated based on a given expression label mapping. This design allows for the synthesis of expressions from a reference image and from a given label, respectively. Inputting st1 and st2 into an expression classifier yields an n-dimensional vector P. st,y Each element in the vector This represents the probability of an emoji category. Using the emoji classification vector and the emoji label, the cross-entropy loss is calculated. The cross-entropy loss l... CE (P st,y The formula for calculating (y) is:
[0066]
[0067] Where st is the style code, y is the true label value, and n is a multidimensional vector. It can be understood that when the number of expression categories n is 4, the classifier output p... st,y Let y be a 4-dimensional vector. If y represents the first expression class, then y = [1,0,0,0] (one-hot encoding). By minimizing the cross-entropy loss, the expression codes st1 and st2 extracted by the classifier correctly represent the target expression. The supervised style loss l... SSE The calculation formula is:
[0068]
[0069] Step S20: Decouple the original expression information and the original face information in the original face image according to the original expression style encoding to obtain the target identity information of the original face image.
[0070] like Figure 3 As shown, Figure 3 The invention demonstrates a feature-style decoupling unit, which separates facial expression style and identity content from features to correctly synthesize the target expression while maintaining good identity consistency. After obtaining the correct facial expression encoding using a style encoder, this invention proposes a style decoupling unit. This invention defines the identity features in the shallow network features of the encoder as style information and the identity features as content information. Encoding facial expression style information and identity content information involves first calculating the covariance matrix and matrix multiplication to construct their similarity. Then, a neural network unit is used to restore the identity features to the same dimension as the facial expression features. Finally, the identity content features can be separated from the facial expression style features.
[0071] Specifically, the original face image is input into the feature encoder in the expression generation model to obtain the original expression information and the original face information of the original face image, and the decoupling process of the original expression information and the original face information in the original face image is supervised according to the original expression style encoding.
[0072] Calculate the covariance matrix of the original facial expression information, and multiply the covariance matrix with the original face information to obtain the facial expression style feature; calculate the residual between the facial expression style feature and the original face information to obtain the identity content feature; perform orthogonal decomposition between the identity content feature and the facial expression style feature, and determine whether the original facial expression information and the original face information in the original face image are successfully decoupled after orthogonal decomposition.
[0073] In the style decoupling unit, there are many decoupling methods. Orthogonal decomposition, mutual information minimization, and cosine similarity minimization can be considered as innovative variations of this invention.
[0074] When decoupling is successful, the target identity information of the original face image is obtained.
[0075] Furthermore, when decoupling fails, the original face image after orthogonal decomposition is input into the feature encoder in the expression generation model for re-decoupling until the original face image is successfully decoupled, thereby obtaining the target identity information of the original face image.
[0076] like Figure 2 As shown, the steps to obtain the target identity information of the original face image are as follows:
[0077] 1. Calculate the covariance matrix cov(f) of the original facial expression. r );
[0078] 2. Transfer the original facial information f s Multiplying the covariance matrix obtained in S3-1 yields the facial expression style feature f′. s ,in,
[0079] 3. Perform residual calculation on the original facial information and expression style features to obtain the identity content feature f. co ,in,
[0080] 4. Determine the facial expression style feature f′ s With identity content features f co Perform orthogonal decomposition to obtain the target identity information of the original face image;
[0081] 5. Output the obtained target identity information to the feature generator of the facial expression editing model.
[0082] Step S30: Decode the target expression style encoding and the target identity information using expression features to obtain the target expression image.
[0083] Identity content features are inserted as feature maps into the feature decoder (generator) to enhance identity information and suppress original facial expression information.
[0084] Specifically, the target identity information is input into the feature map of the feature decoder in the expression generation model, and the target expression style encoding is used as the input of the feature decoder.
[0085] The target identity information and the target expression style encoding are decoded by the feature decoder to generate the target expression image.
[0086] Furthermore, the adversarial loss and cycle consistency loss of the target facial expression image are calculated, and the adversarial loss and cycle consistency loss are used to provide feedback on the accuracy of the target facial expression image generation.
[0087] The generation process mainly involves adversarial loss. ADV and cycle consistency loss l CYC Among them, the resistance loss l ADV The calculation formula is:
[0088] Cyclic consistency loss l CYC The calculation formula is: l CYC =||F(G(x) s ))-x s ||1, where and The image is synthesized by generator G, x s For the input image, y s The input image is labeled with an expression. D is the discriminator, which is used to identify whether the generated image is a real image (to make the generated image closer to the real image). F(·) represents encoding the generated image back into the input image, which can be understood as part of the network. The 1 in the right subscript of the double absolute value is the norm, which represents the straight-line distance between the generated image and the original encoded image.
[0089] like Figure 4 As shown, based on the input facial expression signal or reference facial expression image, this invention innovatively generates facial expression images with arbitrary expressions while maintaining identity information. Compared with traditional methods, the facial expression images generated by this invention effectively solve the problem of artifacts in key parts of the expression. Figure 4 Explanation: Figure 4 The image contains real human faces, and to avoid infringement, it has been pixelated. However, this does not affect the present invention's solution to the problem of artifacts in the generation of target facial expression images in the prior art.
[0090] Beneficial effects:
[0091] 1. This invention innovatively uses the signal obtained from the supervised facial expression encoder as supervision, which enhances the features of the target facial expression on the basis of one-hot encoding, allowing the generator to learn rich feature distribution information.
[0092] 2. This invention innovatively uses facial expression as a style feature and identity as a content feature, decoupling style and content between input and generator. This suppresses the original facial expression features and keeps only the identity information unchanged, thus solving the facial expression artifact problem in traditional methods.
[0093] Furthermore, such as Figure 5As shown, based on the above-described method for generating facial expression images, the present invention also provides a system for generating facial expression images, wherein the system for generating facial expression images includes:
[0094] The expression style encoding generation module 51 is used to acquire the original face image and the target expression label, and to encode the expression features of the original face image and the target expression label to obtain the original expression style code and the target expression style code;
[0095] The original face image decoupling module 52 is used to decouple the original expression information and the original face information in the original face image according to the original expression style encoding, so as to obtain the target identity information of the original face image;
[0096] The target expression image generation module 53 is used to decode the expression features of the target expression style encoding and the target identity information to obtain the target expression image.
[0097] Furthermore, such as Figure 6 As shown, based on the above-described method and system for generating facial expression images, the present invention also provides a terminal, which includes a processor 10, a memory 20, and a display 30. Figure 6 Only some of the terminal components are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0098] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory. In other embodiments, the memory 20 may be an external storage device of the terminal, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Further, the memory 20 may include both internal and external storage devices. The memory 20 is used to store application software and various types of data installed on the terminal, such as program code installed on the terminal. The memory 20 can also be used to temporarily store data that has been output or will be output. In one embodiment, the memory 20 stores a facial expression image generation program 40, which can be executed by the processor 10 to implement the facial expression image generation method of the present invention.
[0099] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor, or other data processing chip, used to run program code stored in the memory 20 or process data, such as executing the method for generating the facial expression image.
[0100] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display 30 is used to display information on the terminal and to display a visual user interface. The components 10-30 of the terminal communicate with each other via a system bus.
[0101] In one embodiment, when the processor 10 executes the facial expression image generation program 40 in the memory 20, the following steps are performed:
[0102] Obtain the original face image and the target expression label, and encode the expression features of the original face image and the target expression label to obtain the original expression style code and the target expression style code;
[0103] Based on the original expression style encoding, the original expression information and the original face information in the original face image are decoupled to obtain the target identity information of the original face image;
[0104] The target facial expression style encoding and the target identity information are used to decode facial expression features to obtain the target facial expression image.
[0105] The step of acquiring the original face image and the target expression label, and encoding the expression features of the original face image and the target expression label to obtain the original expression style code and the target expression style code, specifically includes:
[0106] Obtain the original face image and target expression label, input the original face image into the pre-trained supervised style expression encoder, and extract the expression style of the original face image through the reference image expression extractor in the supervised style expression encoder to obtain the original expression style code;
[0107] The target expression label is input into a pre-trained supervised style expression encoder. The expression mapper in the supervised style expression encoder is used to map the target expression label to extract the expression, thereby obtaining the target expression style code.
[0108] The process of acquiring the original face image and the target expression label, and encoding the expression features of the original face image and the target expression label to obtain the original expression style code and the target expression style code, further includes:
[0109] The original expression style code and the target expression style code are input into the expression classifier in the supervised style expression encoder to obtain the first multi-dimensional vector corresponding to the original expression style code and the second multi-dimensional vector corresponding to the target expression style code, respectively.
[0110] The cross-entropy loss between the first multidimensional vector and the second multidimensional vector and the target expression label is calculated respectively, and the supervised style expression encoder and the original expression style code are made to correctly represent the target expression image by controlling the minimization of the cross-entropy loss.
[0111] Specifically, the step of decoupling the original facial expression information and the original facial information in the original face image according to the original facial expression style encoding to obtain the target identity information of the original face image includes:
[0112] The original face image is input into the feature encoder in the expression generation model to obtain the original expression information and original face information of the original face image, and the decoupling process of the original expression information and the original face information in the original face image is supervised according to the original expression style encoding.
[0113] Calculate the covariance matrix of the original facial expression information, and multiply the covariance matrix with the original facial information to obtain the facial expression style features;
[0114] The residual between the facial expression style features and the original facial information is calculated to obtain the identity content features;
[0115] The identity content features and the expression style features are orthogonally decomposed, and after orthogonal decomposition, it is determined whether the original expression information and the original face information in the original face image are successfully decoupled.
[0116] When decoupling is successful, the target identity information of the original face image is obtained.
[0117] Specifically, the step of decoding the target expression style encoding and the target identity information to obtain the target expression image includes:
[0118] The target identity information is input into the feature map of the feature decoder in the expression generation model, and the target expression style encoding is used as the input of the feature decoder;
[0119] The target identity information and the target expression style encoding are decoded by the feature decoder to generate the target expression image.
[0120] The step of decoding the target expression style encoding and the target identity information to obtain the target expression image further includes:
[0121] The adversarial loss and cycle consistency loss of the target facial expression image are calculated, and the adversarial loss and cycle consistency loss are used to provide feedback on the accuracy of the target facial expression image generation.
[0122] The step of performing orthogonal decomposition of the identity content features and the expression style features, and determining whether the original expression information and the original face information in the original face image are successfully decoupled after orthogonal decomposition, further includes:
[0123] When decoupling fails, the original face image after orthogonal decomposition is input into the feature encoder in the style decoupling unit for re-decoupling until the original face image is successfully decoupled, thus obtaining the target identity information of the original face image.
[0124] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a program for generating facial expression images, and the program for generating facial expression images, when executed by a processor, implements the steps of the method for generating facial expression images as described above.
[0125] In summary, this invention provides a method and related equipment for generating facial expression images. The method includes: acquiring an original facial image and a target expression tag; encoding expression features in the original facial image and the target expression tag to obtain an original expression style code and a target expression style code; decoupling the original expression information and the original facial information in the original facial image based on the original expression style code to obtain the target identity information of the original facial image; and decoding the expression features of the target expression style code and the target identity information to obtain a target expression image. This invention uses the signal obtained from a supervised expression encoder as supervision, enhancing the features of the target expression based on one-hot encoding, allowing the generator to learn rich feature distribution information. Simultaneously, this invention uses expression as a style feature and identity as a content feature, decoupling style and content between the input to the generator, suppressing the original expression features, and enabling the generation of target facial expression images with arbitrary expressions while maintaining the expression identity information.
[0126] It should be noted that, in this invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal that includes that element.
[0127] Of course, those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.). The program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The computer-readable storage medium can be a memory, magnetic disk, optical disk, etc.
[0128] It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. A method for generating facial expression images, characterized in that, The method for generating facial expression images includes: Obtain the original face image and the target expression label, and encode the expression features of the original face image and the target expression label to obtain the original expression style code and the target expression style code; Based on the original expression style encoding, the original expression information and the original face information in the original face image are decoupled to obtain the target identity information of the original face image; The target facial expression style encoding and the target identity information are used to decode facial expression features to obtain the target facial expression image.
2. The method for generating facial expression images according to claim 1, characterized in that, The process of acquiring the original face image and the target expression label, and encoding the expression features of the original face image and the target expression label to obtain the original expression style code and the target expression style code, specifically includes: Obtain the original face image and target expression label, input the original face image into the pre-trained supervised style expression encoder, and extract the expression style of the original face image through the reference image expression extractor in the supervised style expression encoder to obtain the original expression style code; The target expression label is input into a pre-trained supervised style expression encoder. The expression mapper in the supervised style expression encoder is used to map the target expression label to extract the expression, thereby obtaining the target expression style code.
3. The method for generating facial expression images according to claim 2, characterized in that, The process of acquiring the original face image and the target expression label, and encoding the expression features of the original face image and the target expression label to obtain the original expression style code and the target expression style code, further includes: The original expression style code and the target expression style code are input into the expression classifier in the supervised style expression encoder to obtain the first multi-dimensional vector corresponding to the original expression style code and the second multi-dimensional vector corresponding to the target expression style code, respectively. The cross-entropy loss between the first multidimensional vector and the original expression label and the second multidimensional vector and the target expression label are calculated respectively. By controlling the minimization of the cross-entropy loss, the supervised style expression encoder and the original expression style code can correctly represent the target expression image.
4. The method for generating facial expression images according to claim 1, characterized in that, The step of decoupling the original facial expression information and the original facial information in the original face image according to the original facial expression style encoding to obtain the target identity information of the original face image specifically includes: The original face image is input into the feature encoder in the expression generation model to obtain the original expression information and original face information of the original face image, and the decoupling process of the original expression information and the original face information in the original face image is supervised according to the original expression style encoding. Calculate the covariance matrix of the original facial expression information, and multiply the covariance matrix with the original facial information to obtain the facial expression style features; The residual between the facial expression style features and the original facial information is calculated to obtain the identity content features; The identity content features and the expression style features are orthogonally decomposed, and after orthogonal decomposition, it is determined whether the original expression information and the original face information in the original face image are successfully decoupled. When decoupling is successful, the target identity information of the original face image is obtained.
5. The method for generating facial expression images according to claim 1, characterized in that, The step of decoding the target facial expression style encoding and the target identity information to obtain the target facial expression image specifically includes: The target identity information is input into the feature map of the feature decoder in the expression generation model, and the target expression style encoding is used as the input of the feature decoder; The target identity information and the target expression style encoding are decoded by the feature decoder to generate the target expression image.
6. The method for generating facial expression images according to claim 1, characterized in that, The step of decoding the target facial expression style encoding and the target identity information to obtain the target facial expression image further includes: The adversarial loss and cycle consistency loss of the target facial expression image are calculated, and the adversarial loss and cycle consistency loss are used to provide feedback on the accuracy of the target facial expression image generation.
7. The method for generating facial expression images according to claim 4, characterized in that, The step of performing orthogonal decomposition of the identity content features and the expression style features, and determining whether the original expression information and the original face information in the original face image are successfully decoupled after orthogonal decomposition, further includes: When decoupling fails, the original face image after orthogonal decomposition is input into the feature encoder in the expression generation model for decoupling again until the original face image is successfully decoupled, thus obtaining the target identity information of the original face image.
8. A system for generating facial expression images, characterized in that, The facial expression image generation system includes: The expression style encoding generation module is used to acquire the original face image and the target expression label, and to encode the expression features of the original face image and the target expression label to obtain the original expression style code and the target expression style code; The original face image decoupling module is used to decouple the original expression information and the original face information in the original face image according to the original expression style encoding, so as to obtain the target identity information of the original face image; The target expression image generation module is used to decode the expression features of the target expression style encoding and the target identity information to obtain the target expression image.
9. A terminal, characterized in that, The terminal includes: a memory, a processor, and a facial expression image generation program stored in the memory and executable on the processor. When the facial expression image generation program is executed by the processor, it implements the steps of the facial expression image generation method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program for generating facial expression images, which, when executed by a processor, implements the steps of the method for generating facial expression images as described in any one of claims 1-7.
