Unpaired heterogeneous face image generation method and device based on generative adversarial network
Through a method based on generative adversarial networks, the normalization processing and pre-training model of heterogeneous face images are used, combined with a variety of loss functions, to achieve high-quality generation of heterogeneous face images, solving the heterogeneous problems in the existing technology. The deficiencies in face image generation enhance the diversity of generated images and the ability to maintain identity information.
Patent Information
- Application Number
- CN202010435726.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-21
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2040-05-21
AI Technical Summary
Existing technologies mainly focus on heterogeneous face image recognition, rarely involve heterogeneous face image generation, and fail to effectively utilize the complementary information between heterogeneous face images for generation.
Using a method based on generative adversarial networks, by normalizing heterogeneous face images and pre-training the model, using multiple iterations to train the generative model, combining the content encoder, style encoder, decoder and discriminator, based on multiple A loss function updates model parameters to achieve cross-domain and intra-domain image generation.
Generate high-quality, highly diverse heterogeneous face images under unsupervised, unpaired conditions, and significantly enhance the ability to maintain identity information.
Smart Images

Figure CN111797891B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a method and device for generating unpaired heterogeneous face images based on a generative adversarial network. Background Art
[0002] The continuous development of modern imaging technology provides different types and modalities of image forms, which can be called heterogeneous images. Taking facial image data as an example, the existing heterogeneous facial images can be roughly divided into visible light facial images, near-infrared facial images, sketch facial images, thermal imaging facial images, and 3D facial images, etc.
[0003] Heterogeneous facial images can give a very rich description and characterization of the same target in different expression spaces. There is both redundant information and complementary information between them. The effective use and analysis of the mutual information of heterogeneous facial images can deepen visual cognition and perceptual understanding, and has broad and important application value in the fields of public security and media entertainment.
[0004] Existing technologies mostly focus on heterogeneous face image recognition, but rarely involve heterogeneous face image generation. Summary of the invention
[0005] Purpose of the invention: The present invention aims to provide a method and device for generating unpaired heterogeneous face images based on a generative adversarial network.
[0006] Technical solution: An embodiment of the present invention provides a method for generating unpaired heterogeneous face images based on a generative adversarial network, comprising: normalizing heterogeneous face images of domain a and domain b; pre-training a heterogeneous face recognition model; training the heterogeneous face image generation model through multiple iterations, wherein each iteration comprises: inputting unpaired heterogeneous face images sampled from domain a and domain b into the generator of domain a and the generator of domain b respectively, using the decoder of domain a and the decoder of domain b to obtain cross-domain generated images respectively, using the discriminator of domain a and the discriminator of domain b to evaluate the authenticity of the cross-domain generated images respectively, and updating the model parameters based on the loss of the heterogeneous face image generation model; and using the trained heterogeneous face image generation model to generate face images.
[0007] Specifically, a homogeneous face image dataset is used to pre-train an identity feature extractor; and then a heterogeneous face image recognition model is adjusted using a heterogeneous face image dataset.
[0008] Specifically, the content encoders of the generator of domain a and the generator of domain b respectively use convolution to downsample the input face image, use residual blocks for processing, and respectively output content feature maps with image structure information; the style encoders of the generator of domain a and the generator of domain b respectively use convolution to downsample the input face image, use global average pooling and then perform full connection, and respectively output style vectors.
[0009] Specifically, the decoder of domain a and the decoder of domain b respectively decode to obtain the cross-domain generated images based on the cross-domain content feature map and style vector.
[0010] Specifically, the decoder of domain a and the decoder of domain b respectively decode to obtain the generated images in the domain based on the content feature map and style vector of the same domain.
[0011] Specifically, the cross-domain generated images are used as the input of the generator of domain a and the generator of domain b respectively, and the decoder of domain a and the decoder of domain b are used to obtain the dual cross-domain generated images respectively.
[0012] Specifically, the parameters of the heterogeneous face image generation model are updated based on the following losses: adversarial loss, content consistency loss, style consistency loss, image reconstruction loss, domain-independent perceptual loss, cycle consistency loss, identity mapping loss, and domain-independent identity feature matching loss.
[0013] Specifically, the discriminator of domain a and the discriminator of domain b evaluate the authenticity of the cross-domain generated images at multiple scales based on the corresponding input face images, assign weights to each scale, and obtain evaluation results after weighted calculation.
[0014] An embodiment of the present invention provides an unpaired heterogeneous face image generation device based on a generative adversarial network, comprising: a preprocessing unit, a fine-tuning unit, a training unit and a testing unit, wherein: the preprocessing unit is used to normalize heterogeneous face images of two domains; the fine-tuning unit is used to pretrain a heterogeneous face recognition model; the training unit is used to train the heterogeneous face image generation model through multiple iterations, wherein each iteration comprises: inputting unpaired heterogeneous face images sampled from domain a and domain b into a generator of domain a and a generator of domain b respectively, using a decoder of domain a and a decoder of domain b to obtain cross-domain generated images respectively, using a discriminator of domain a and a discriminator of domain b to evaluate the authenticity of the cross-domain generated images respectively, and updating the model parameters based on the loss of the heterogeneous face image generation model; the testing unit is used to generate face images using the trained heterogeneous face image generation model.
[0015] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: it can generate heterogeneous face images under unsupervised and unpaired conditions, enhance the quality and diversity of generated images, and greatly enhance the ability to retain identity information. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A schematic diagram of the process of generating an unpaired heterogeneous face image based on a generative adversarial network provided in an embodiment of the present invention;
[0017] Figure 2 The figure is a diagram of the overall network structure of the heterogeneous face image generation model provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.
[0019] See also Figure 1 , which is a flow chart of the unpaired heterogeneous face image generation method based on a generative adversarial network provided in an embodiment of the present invention, including specific steps.
[0020] Step S101, normalizing the heterogeneous face images of domain a and domain b.
[0021] In a specific implementation, face images in different domains refer to face images collected by different image acquisition devices, such as sketch face images, thermal infrared face images, near-infrared face images, and visible light face images.
[0022] In a specific implementation, the heterogeneous facial images in the two domains can be normalized during subsequent processing in order to improve the quality of subsequently generated images. For example, facial images in different domains may be cropped according to facial key points, uniformly converted into grayscale images to reduce the differences between facial images in different domains, resized, horizontally flipped, and angularly rotated.
[0023] Step S102, pre-training a heterogeneous face recognition model.
[0024] In an embodiment of the present invention, pre-training a heterogeneous face recognition model includes two steps: first, pre-training an identity feature extractor using a large-scale homogeneous face image dataset; and then fine-tuning the heterogeneous face image recognition model using the heterogeneous face image dataset.
[0025] In the specific implementation, the VGGFace2 network pre-trained on a large-scale homogeneous face image dataset (such as a large-scale visible light face image) is used as the identity feature extractor F; then ArcFace is used to fine-tune the network on a heterogeneous face image dataset to obtain the final "domain-independent" face image identity feature extractor F. Domain-independent features refer to features that are invariant across domains, that is, the features are not affected by changes in domains.
[0026] Step S103, training the heterogeneous face image generation model through multiple iterations, wherein each iteration includes: inputting the unpaired heterogeneous face images sampled in domain a and domain b into the generator of domain a and the generator of domain b respectively, using the decoder of domain a and the decoder of domain b to obtain cross-domain generated images respectively, using the discriminator of domain a and the discriminator of domain b to evaluate the authenticity of the cross-domain generated images respectively, and updating the model parameters based on the loss of the heterogeneous face image generation model.
[0027] In the embodiment of the present invention, the content encoders of the generator of domain a and the generator of domain b respectively use convolution to downsample the input face image, use residual blocks to process it, and respectively output content feature maps (content coding) with image structure information; the style encoders of the generator of domain a and the generator of domain b respectively use convolution to downsample the input face image, use global average pooling and then perform full connection, and respectively output style vectors (style coding).
[0028] In the embodiment of the present invention, the decoder of domain a and the decoder of domain b respectively decode and obtain the cross-domain generated image (for example, image x ab and image x ba ).
[0029] In the embodiment of the present invention, the decoder of domain a and the decoder of domain b respectively decode and obtain the generated images in the domain (e.g. Images and image).
[0030] In the embodiment of the present invention, the cross-domain generated image is used as the input of the generator of the input domain a and the generator of the input domain b, and the decoder of the domain a and the decoder of the domain b are used to obtain the dual cross-domain generated images (for example, image x aba and image x bab ).
[0031] In the embodiment of the present invention, the discriminator of domain a and the discriminator of domain b respectively evaluate the authenticity of the cross-domain generated image at multiple scales based on the corresponding input face image, assign a weight to each scale, and obtain evaluation results after weighted calculation.
[0032] See also Figure 2 , which is the overall network structure diagram of the heterogeneous face image generation model provided in an embodiment of the present invention.
[0033] In a specific implementation, the heterogeneous face image generation model includes a set of content encoders, style encoders, decoders, discriminators and domain-independent identity feature extractors corresponding to each other on two domains.
[0034] In a specific implementation, a face image can be encoded into a domain-independent content encoding and a domain-dependent style encoding. Cross-domain generation requires exchanging content encoding and style encoding. Specifically, in order to convert an image x in domain a a Generate image x for domain b across domains ab , you need to encode its content and the style encoding s of domain b b (or sampling) combination for decoding and generation. Similarly, the image x ab Generate x across domains aba . Using the identity feature extractor F to constrain (x a ,x ab ) and (x b ,x ba ) domain-independent identity feature matching. Domain a and domain b can be near infrared and visible light, or sketch and visible light, or other combinations.
[0035] In a specific implementation, the heterogeneous face image generation model includes at least two generators G a , G b A single generator belongs to the auto-encoder structure. Depending on domain a or domain b, the generator includes a content encoder or Style Encoder or DecoderDec a or Dec b The model consists of at least two discriminators D a (Domain a Discriminator), D b (Domain b discriminator).
[0036] In the specific implementation, the convolution and residual block processing of the content encoder all use instance normalization (IN); the convolution, global average pooling and full connection processing of the style encoder do not use instance normalization (IN) because instance normalization removes the mean and variance of the original features that represent important style information.
[0037] In a specific implementation, the decoder uses content coding and style coding to decode and generate images, uses residual blocks to process content coding, uses upsampling and convolution to reconstruct images, and the residual blocks use adaptive instance normalization (AdaIN). The parameters are dynamically generated by style coding through MLP, and the decoder uses instance normalization (AdaIN) to combine content coding and style coding for image generation.
[0038] In a specific implementation, the discriminator has a multi-scale discriminator structure, for example, discriminating at three different scales and averaging or weighting the results, the three scales being: the original image scale, the 1 / 2 downsampled scale of the original image, and the 1 / 4 downsampled scale of the original image.
[0039] In the specific implementation, after multiple iterations, the model parameters are updated based on the loss to train the heterogeneous face image generation model. After multiple iterations, the training of the heterogeneous face image generation model is completed. The number of iterations can be set accordingly according to the actual application scenario.
[0040] In an embodiment of the present invention, the parameters of the heterogeneous face image generation model are updated based on the following losses: adversarial loss, content consistency loss, style consistency loss, image reconstruction loss, domain-independent perceptual loss, cycle consistency loss, identity mapping loss, and domain-independent identity feature matching loss.
[0041] In the specific implementation, regarding the adversarial loss calculation, the adversarial loss is used to match the distribution of the cross-domain generated images with the target domain distribution, that is, the cross-domain generated images and the real images of the target domain cannot be distinguished in the target domain. The adversarial loss L obtained by combining domain a and domain b is GAN The formula is:
[0042]
[0043] in, is the adversarial loss for domain a, is the adversarial loss of domain b, E is the sampling, c a 、c b are the content encodings of domain a and domain b respectively, s a 、s b are the style codes of domain a and domain b respectively, p(c a )、p(c b ) are the prior distributions of the content encodings of domain a and domain b, respectively, and q(c a ),q(c a ) are the prior distributions of the style encodings of domain a and domain b, respectively, and D a , D b are the discriminators of domain a and domain b respectively, Dec a 、Dec bare the decoders for domain a and domain b respectively, x a 、x b They are face images from domain a and domain b respectively.
[0044] In the specific implementation, regarding the calculation of content consistency loss, since the decoded content space is domain-independent and invariant, the content encoding should be consistent in cross-domain generation. That is, content consistency usually means that the semantic content of the input image and the generated image is consistent. The content consistency loss obtained by combining domain a and domain b is The formula is:
[0045]
[0046] in, are the content consistency losses of domain a and domain b respectively, are the content encoders for domain a and domain b respectively.
[0047] In the specific implementation, regarding the calculation of style consistency loss, style encoding is domain-dependent, but the style should remain consistent after decoding and encoding. Different style encodings produce rich and diverse outputs, and the same style encoding remains consistent during the encoding and decoding process. The style consistency loss obtained by combining domain a and domain b is The formula is:
[0048]
[0049] in, are the style consistency losses of domain a and domain b, respectively. are the style encoders for domain a and domain b, respectively.
[0050] In the specific implementation, regarding the calculation of image reconstruction loss, for any face image input after sampling, it should be ensured that the generated image (reconstructed image) in the domain obtained after encoding and decoding is basically consistent with the input face image, and the image reconstruction loss obtained by combining domain a and domain b is The formula is:
[0051]
[0052] in, are the image reconstruction losses for domain a and domain b respectively, are the reconstructed images of domain a and domain b respectively (images generated within the domain), Same reason.
[0053] In the specific implementation, regarding the calculation of domain-independent perceptual loss, the perceptual loss compares the perceived distance of the content of two images. It is not directly calculated pixel by pixel, but more considers the relationship between pixels. The domain-independent perceptual loss considers removing the deviation of the perceptual distance between domains. The domain-independent perceptual loss obtained by combining domain a and domain b is The formula is:
[0054]
[0055] in, are the domain-independent perceptual losses for domain a and domain b, respectively, V(·) is the extraction perceptual feature network, and IN(·) represents instance normalization.
[0056] In the specific implementation, regarding the calculation of cycle consistency loss, cycle consistency means that the generated image obtained after the input image is forward mapped and reverse mapped should be as similar as possible to the original input image, that is, it should be consistent in the cycle training. Cycle consistency can increase the certainty of heterogeneous face image generation. The cycle consistency loss obtained by combining domain a and domain b is The formula is:
[0057]
[0058] in, are the cycle consistency losses of domain a and domain b respectively, and x ab =G ab (x a ), x aba =G ba (x ab ), the same applies to other ab is the image of domain b obtained by generating the image of domain a, x ba is the image of domain a obtained by generating the image of domain b, x aba is the image of domain a passing through domain b and returning to domain a, x bab It is the image of domain b that passes through domain a and then returns to domain b.
[0059] In the specific implementation, regarding the calculation of the identity mapping loss, when the image of the original domain is input to the generator, it is hoped that the generated image is of the style of the target domain. Conversely, when the image of the target domain is input to the same generator, it is hoped that the generated image will not change. That is, the generator should be an identity mapping to the target domain image. The identity mapping loss can constrain and stabilize the generation process. The identity mapping loss obtained by combining domain a and domain b is The formula is:
[0060]
[0061] in, are the identity mapping losses for domain a and domain b, respectively.
[0062] In the specific implementation, regarding the calculation of domain-independent identity feature matching loss, in heterogeneous face image generation, domain-independent identity feature matching can significantly enhance the ability to preserve identity information without causing the generation to shift to any domain distribution. The domain-independent identity feature matching loss obtained by combining domain a and domain b is The formula is:
[0063]
[0064] in, are the domain-independent identity feature matching losses for domain a and domain b, respectively, F(·) denotes the extracted identity feature network, and IN(·) denotes instance normalization.
[0065] Step S104, using the trained heterogeneous face image generation model to generate a face image.
[0066] In an embodiment of the present invention, there is also provided a device for generating unpaired heterogeneous face images based on a generative adversarial network, comprising: a preprocessing unit, a fine-tuning unit, a training unit and a testing unit, wherein:
[0067] The preprocessing unit is used to perform normalization processing on the heterogeneous face images in the two domains;
[0068] The fine-tuning unit is used to pre-train a heterogeneous face recognition model;
[0069] The training unit is used to train the heterogeneous face image generation model through multiple iterations, wherein each iteration includes: inputting unpaired heterogeneous face images sampled in domain a and domain b into the generator of domain a and the generator of domain b respectively, using the decoder of domain a and the decoder of domain b to obtain cross-domain generated images respectively, using the discriminator of domain a and the discriminator of domain b to evaluate the authenticity of the cross-domain generated images respectively, and updating the model parameters based on the loss of the heterogeneous face image generation model;
[0070] The testing unit is used to generate facial images using a trained heterogeneous facial image generation model.
[0071] In the embodiment of the present invention, the fine-tuning unit is used to pre-train the identity feature extractor using a large-scale homogeneous face image dataset; and fine-tune the heterogeneous face image recognition model using a heterogeneous face image dataset.
[0072] In the embodiment of the present invention, the training unit is used for the content encoder of the generator of domain a and the generator of domain b, respectively using convolution to downsample the input face image, using residual blocks for processing, and respectively outputting content feature maps with image structure information; the style encoder of the generator of domain a and the generator of domain b, respectively using convolution to downsample the input face image, using global average pooling and then performing full connection, and respectively outputting style vectors.
[0073] In the embodiment of the present invention, the training unit is used for the decoder of domain a and the decoder of domain b to respectively decode and obtain the cross-domain generated images based on the cross-domain content feature map and style vector.
[0074] In the embodiment of the present invention, the training unit is used for the decoder of domain a and the decoder of domain b to respectively decode and obtain the generated images in the domain based on the content feature map and style vector of the same domain.
[0075] In an embodiment of the present invention, the training unit is used to use the cross-domain generated image as the input of the generator of domain a and the generator of domain b respectively, and use the decoder of domain a and the decoder of domain b to obtain the dual cross-domain generated images respectively.
[0076] In an embodiment of the present invention, the training unit is used to update the parameters of the heterogeneous face image generation model based on the following losses: adversarial loss, content consistency loss, style consistency loss, image reconstruction loss, domain-independent perceptual loss, cycle consistency loss, identity mapping loss, and domain-independent identity feature matching loss.
[0077] In an embodiment of the present invention, the training unit, the discriminator for domain a and the discriminator for domain b, respectively evaluate the authenticity of the cross-domain generated images at multiple scales based on the corresponding input face images, assign weights to each scale, and obtain evaluation results after weighted calculation.
Claims
1. A method for generating unpaired heterogeneous face images based on a generative adversarial network, characterized in that: include: Normalize the heterogeneous face images in domain a and domain b; Pre-training heterogeneous face recognition models; The heterogeneous face image generation model is trained through multiple iterations, wherein each iteration includes: the content encoders of the generator of domain a and the generator of domain b respectively use convolution to downsample the input face image, use residual blocks to process it, and respectively output content feature maps with image structure information; the style encoders of the generator of domain a and the generator of domain b respectively use convolution to downsample the input face image, use global average pooling and then perform full connection, and respectively output style vectors; the decoders of domain a and domain b respectively decode to obtain cross-domain generated images based on the cross-domain content feature map and style vector, and cross-domain generation requires exchanging content encoding and style encoding, and the discriminator of domain a and the discriminator of domain b are used to evaluate the authenticity of the cross-domain generated images respectively, and the model parameters are updated based on the loss of the heterogeneous face image generation model; The trained heterogeneous face image generation model is used to generate face images.
2. The unpaired heterogeneous face image generation method based on generative adversarial network according to claim 1 is characterized in that: The pre-trained heterogeneous face recognition model includes: Pre-training identity feature extractor using homogeneous face image dataset; Tuning heterogeneous face image recognition models through heterogeneous face image datasets.
3. The unpaired heterogeneous face image generation method based on generative adversarial network according to claim 1, characterized in that: The method of using the decoder of domain a and the decoder of domain b to obtain the generated images in the domains respectively further includes: The decoder of domain a and the decoder of domain b respectively decode the generated images in the domain based on the content feature map and style vector of the same domain.
4. The unpaired heterogeneous face image generation method based on generative adversarial network according to claim 1, characterized in that: After the decoder of domain a and the decoder of domain b are used to obtain the cross-domain generated images respectively, the method further includes: The cross-domain generated images are used as the input of the generator of domain a and the generator of domain b respectively, and the decoder of domain a and the decoder of domain b are used to obtain the dual cross-domain generated images respectively.
5. The unpaired heterogeneous face image generation method based on generative adversarial network according to claim 1, characterized in that: The loss-based updating model parameters of the heterogeneous face image generation model includes: The parameters of the heterogeneous face image generation model are updated based on the following losses: adversarial loss, content consistency loss, style consistency loss, image reconstruction loss, domain-independent perceptual loss, cycle consistency loss, identity mapping loss, and domain-independent identity feature matching loss.
6. The unpaired heterogeneous face image generation method based on generative adversarial network according to claim 1, characterized in that: The discriminator of domain a and the discriminator of domain b are used to respectively evaluate the authenticity of the cross-domain generated image, including: The discriminator of domain a and the discriminator of domain b evaluate the authenticity of the cross-domain generated images at multiple scales based on the corresponding input face images, assign weights to each scale, and obtain evaluation results after weighted calculation.
7. A device for generating unpaired heterogeneous face images based on a generative adversarial network, characterized in that: include: Preprocessing unit, fine-tuning unit, training unit and testing unit, where: The preprocessing unit is used to perform normalization processing on the heterogeneous face images in the two domains; The fine-tuning unit is used to pre-train a heterogeneous face recognition model; The training unit is used to train the heterogeneous face image generation model through multiple iterations, wherein each iteration includes: the content encoders of the generator of domain a and the generator of domain b respectively use convolution to downsample the input face image, use residual blocks to process it, and respectively output content feature maps with image structure information; the style encoders of the generator of domain a and the generator of domain b respectively use convolution to downsample the input face image, use global average pooling and then perform full connection, and respectively output style vectors, the decoder of domain a and the decoder of domain b respectively decode to obtain cross-domain generated images based on the cross-domain content feature map and style vector, cross-domain generation requires exchanging content coding and style coding, the discriminator of domain a and the discriminator of domain b are used to respectively evaluate the authenticity of the cross-domain generated image, and the model parameters are updated based on the loss of the heterogeneous face image generation model; The testing unit is used to generate facial images using a trained heterogeneous facial image generation model.
