A method for unpaired face image translation based on self-supervised learning
Through the combination of self-supervised learning and face component dictionary, the limitations of the unpaired face image translation task are solved, effective image translation results are achieved on unpaired data sets, and the quality of image translation and face component are improved. translation effect.
Patent Information
- Application Number
- CN202110087906.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-22
- Publication Date
- 2024-10-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
It is difficult for the existing technology to effectively learn a unified mapping function between image domains on unpaired face image data sets, resulting in limitations in the unpaired face image translation task.
Self-supervised learning is used to transform the unpaired image translation task into a paired image encoding translation task. By designing a style encoding network and a content encoding network, and using an adaptive normalization layer and face component dictionary, combined with self-reconstruction loss and loop Reconstruction loss, style contrast loss and generative adversarial network to achieve image translation.
It improves the effect and quality of unpaired face image translation, and provides an effective technical route to solve the task of unpaired image translation by enhancing the translation effect of face components.
Smart Images

Figure CN112907494B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing, and specifically relates to an unpaired face image translation method based on self-supervised learning. The present invention mainly involves using a self-supervised learning method to convert an unpaired image translation task into a paired image coding translation task, and by means of the structural commonality of facial components between face portraits and a face component dictionary, the translation effect of the face components is further enhanced, thereby achieving a better translation effect of unpaired face images. Background Art
[0002] Image-to-image translation is a type of vision and image problem, the purpose of which is to obtain content features from a given image, style features from another image, and fuse the two to obtain a fused image with their respective style and content features.
[0003] Traditional image-to-image translation tasks all use digital image processing and signal processing methods, such as brushstroke rendering, image analogy, image filtering, texture synthesis, etc. However, these models generally require a lot of manual parameter adjustment and have a weak ability to express the deep semantic information of the image. Since the introduction of neural image translation technology, the traditional digital image processing methods have been replaced by stacking convolutions, normalization and nonlinear layers, using neural networks to learn the nonlinear mapping function from the source image to the target image through iterative optimization, and using deep stacked convolutions to extract the deep semantic information of the image, making the traditional image translation task a huge success.
[0004] According to the neural image translation technology, the image translation task can be regarded as learning the affine function between two image domains, from one image domain to another. In order to better learn this affine function, most of the current image translation models use strictly one-to-one paired training images, and use a large number of repeated one-to-one paired training images to strengthen the neural network's learning of this affine function, and have achieved very successful results in this image translation task based on paired image datasets.
[0005] However, in real application scenarios, most datasets do not contain special manual annotation labels and do not have paired target images. How to robustly learn a unified mapping function between two image domains based on such unpaired datasets is the real research direction of image translation tasks, and it is also the inadequacy of current image translation technology. In particular, in the image translation task for unpaired face image datasets, current methods have great limitations. Summary of the invention
[0006] In view of the deficiencies in the prior art, the present invention provides a non-paired face image translation method based on self-supervised learning.
[0007] The unpaired image translation task is transformed into a paired image encoding translation task using a self-supervised learning method. The structural commonalities of facial components between face portraits are exploited and a facial component dictionary is used to further enhance the translation effect of facial components, thereby achieving better translation effects for unpaired face images.
[0008] The technical solution adopted by the present invention to solve the technical problem includes the following steps:
[0009] Step (1), for the unpaired face image translation dataset, adopt the domain decoupling strategy, design two independent style encoding networks encoderS and content encoding networks encoderC, encode the style image S and content image C respectively, obtain style features s and content features c, and ensure that s and c have the same feature dimension;
[0010] Step (2): construct a corresponding decoding network decoder based on the content encoding network encoderC, and replace the corresponding normalization layer in the decoder with an adaptive normalization (AdaIN) layer; the style encoding network encoderS, the content encoding network encoderC and the decoding network decoder constitute an image translation network.
[0011] Step (3) transmits the content code c through the decoding network decoder, recorded as code f i , and in each adaptive normalization layer of the decoding network, the transmitted code f is normalized by using the adaptive normalization method i And style code s feature fusion, get the new encoding feature f i-1 , i represents the depth of the upsampling layer corresponding to the current feature code f. In the encoding network, the value of i gradually increases with feature conduction, and gradually decreases in the decoding network:
[0012] f i-1 =AdaIN(f i ,s)=σ(s)(f i -μ(f i )σ(f i ))+μ(s)
[0013] where μ(·) and σ(·) represent the mean and standard deviation, respectively.
[0014] The new encoding result f is obtained by using the component constraints based on the face component dictionary i-1The facial component feature information is enhanced, and the preliminary facial image translation result is obtained through multiple feature fusion and feature decoding of the decoding network.
[0015] Step (4), for the unpaired face image translation dataset, in order to guide the network model to achieve the face image translation task under unpaired conditions, constraints need to be imposed. The specific operations are as follows:
[0016] Using the self-reconstruction loss L rec and the cycle reconstruction loss L cycrec , use the content map instead of the style map as the reconstruction style to constrain the consistency of content features during image translation:
[0017] L rec =||CG(C,C))||1
[0018] L cycrec =||CG(G(C,S),C)||1
[0019] Where G(x,y) represents the image translation network, x represents the content graph, and y represents the style graph (x and y here are just references, not actual parameters).
[0020] Using style contrast loss L stycon To constrain the independence of style features in the image translation process:
[0021]
[0022] in Represents the style features of the translation result, q + Represents the style dictionary corresponding to the target style type, Represents the style dictionary corresponding to other style types, k is the negative sample type, and τ is the temperature hyperparameter.
[0023] Constraining the perceptual quality of image translation using generative adversarial networks and adversarial losses:
[0024] L adv =logD(C)+log(1-D(C,s))
[0025] Where D represents the discriminative network in the generative adversarial network.
[0026] Furthermore, the specific operation of the style encoding network encoderS to encode the style image S is as follows:
[0027] Use data augmentation methods to expand the style image data and construct positive sample pairs between the expanded data sample S' and the source sample S;
[0028] For each image style type in the unpaired face image translation dataset, a corresponding style dictionary is constructed to store the style features of the style image of this style type obtained through the style encoding network encoderS;
[0029] The style dictionaries corresponding to other style types are used as negative samples q - , the style dictionary corresponding to the current style type is used as the positive sample q + , through the contrastive learning method in self-supervised learning to constrain the feature separation between different style domains, the style encoding network can well extract different types of style features. The loss function of contrastive learning is defined as:
[0030]
[0031] Where s is the style feature corresponding to the current source sample S, k is the negative sample type, and τ is the temperature hyperparameter.
[0032] Furthermore, image blocks are used instead of complete images as the input of the style encoding network to reduce the influence of the individual information contained in the complete style image on the encoding result. By controlling the size of the image blocks, the receptive field of the style feature and the influence of the individual information can be adjusted. The specific operations are as follows:
[0033] For each style image sample in the unpaired face image translation dataset, randomly crop N image blocks of size M*M as the corresponding image block samples (N is selected according to the scale of the dataset, and M is determined according to the size of the style image in the dataset);
[0034] Take N image blocks instead of the complete image as input, and get the corresponding style code s through the style encoding network encoderS.
[0035] Furthermore, the new encoding result f is obtained by using the component constraints based on the face component dictionary i-1 The facial component feature information in is enhanced. The specific operations are as follows:
[0036] Use dlib to detect the position L of the face component in the content image C, encode it through the content encoding network encoderC, and extract the feature map fc obtained at each downsampling layer of the encoding network i (i represents the downsampling depth corresponding to the current downsampling layer). According to the position of the face components detected by dlib, ROI Align is used to crop the feature map, and the cropped component features are scaled to a consistent size.
[0037] Use the K-Means clustering method to cluster the component feature set corresponding to each component type and construct the component dictionary Q i,j :
[0038] Q i,j =KMeans(C|L;encoderC)
[0039] Among them, i∈{1,2,3,4} represents the downsampling depth corresponding to the current feature map, and j∈{left eye, right eye, nose, mouth} represents the corresponding component type.
[0040] When using the decoding network to perform feature fusion translation reconstruction on the image, ROI Align is also used to crop the feature map obtained by each upsampling layer, and the component content loss is used to constrain the reconstructed feature map f i The component feature F in i,j With the component feature Q in the component dictionary i,j The differences:
[0041] L face =||F i,j -Q i,j ||1
[0042] The encoding result f obtained by decoding each feature layer using the component constraint based on the face component dictionary i The facial component feature information in the face image is enhanced to improve the translation quality of the facial components in the final face image translation result.
[0043] The beneficial effects of the present invention are as follows:
[0044] For the problem of unpaired image translation, the present invention proposes a method of using self-supervised learning to convert unpaired image translation tasks into paired image encoding translation tasks, and then solves the problem through a mature paired image translation method; in addition, for the problem of face image translation, the present invention proposes a method of enhancing the image translation effect of face components by building a face component dictionary based on the structural commonality of facial components between face portraits. The present invention provides an effective technical route for unpaired image translation tasks and face image translation tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 This is a schematic diagram of an image translation network based on domain decoupling;
[0046] Figure 2 This is a schematic diagram of a style encoding network based on self-supervised learning;
[0047] Implementation details
[0048] The present invention will be further described below in conjunction with the accompanying drawings.
[0049] like Figure 1 and Figure 2 As shown, a non-paired face image translation method based on self-supervised learning specifically includes the following steps:
[0050] Step (1), for the unpaired face image translation dataset, adopt the domain decoupling strategy, design two independent style encoding networks encoderS and content encoding networks encoderC, encode the style image S and content image C respectively, obtain style features s and content features c, and ensure that s and c have the same feature dimension;
[0051] Step (2): construct a corresponding decoding network decoder based on the content encoding network encoderC, and replace the corresponding normalization layer in the decoder with an adaptive normalization (AdaIN) layer; the style encoding network encoderS, the content encoding network encoderC and the decoding network decoder constitute an image translation network.
[0052] Step (3) transmits the content code c through the decoding network decoder, recorded as code f i , and in each adaptive normalization layer of the decoding network, the transmitted code f is normalized by using the adaptive normalization method i And style code s feature fusion, get the new encoding feature f i-1 , i represents the depth of the upsampling layer corresponding to the current feature code f. In the encoding network, the value of i gradually increases with feature conduction, and gradually decreases in the decoding network:
[0053] f i-1 =AdaIN(f i ,s)=σ(s)(f i -μ(f i )σ(f i ))+μ(s)
[0054] where μ(·) and σ(·) represent the mean and standard deviation, respectively.
[0055] The new encoding result f is obtained by using the component constraints based on the face component dictionary i-1 The facial component feature information is enhanced, and the preliminary facial image translation result is obtained through multiple feature fusion and feature decoding of the decoding network.
[0056] Step (4), for the unpaired face image translation dataset, in order to guide the network model to achieve the face image translation task under unpaired conditions, constraints need to be imposed. The specific operations are as follows:
[0057] Using the self-reconstruction loss L rec and the cycle reconstruction loss L cycrec , use the content map instead of the style map as the reconstruction style to constrain the consistency of content features during image translation:
[0058] L rec =||CG(C,C))||1
[0059] L cycrec =||CG(G(C,S),C)||1
[0060] Where G(x,y) represents the image translation network, x represents the content graph, and y represents the style graph (x and y here are just references, not actual parameters).
[0061] Using style contrast loss L stycon To constrain the independence of style features in the image translation process:
[0062]
[0063] in Represents the style features of the translation result, q + Represents the style dictionary corresponding to the target style type, Represents the style dictionary corresponding to other style types, k is the negative sample type, and τ is the temperature hyperparameter.
[0064] Constraining the perceptual quality of image translation using generative adversarial networks and adversarial losses:
[0065] L adv =logD(C)+log(1-D(C,s))
[0066] Where D represents the discriminative network in the generative adversarial network.
[0067] Furthermore, the specific operation of the style encoding network encoderS to encode the style image S is as follows:
[0068] The data enhancement method is used to expand the style image data and construct a positive sample pair of the expanded data sample S' and the source sample S. Data enhancement can ensure that the positive sample pairs have the same style features, so that the corresponding style image is guided to converge to the style features with the help of self-supervised learning;
[0069] For each image style type in the unpaired face image translation dataset, a corresponding style dictionary is constructed to store the style features of the style image of this style type obtained through the style encoding network encoderS;
[0070] The style dictionaries corresponding to other style types are used as negative samples q- , the style dictionary corresponding to the current style type is used as the positive sample q + , through the contrastive learning method in self-supervised learning to constrain the feature separation between different style domains, the style encoding network can well extract different types of style features. The loss function of contrastive learning is defined as:
[0071]
[0072] Where s is the style feature corresponding to the current source sample S, k is the negative sample type, and τ is the temperature hyperparameter.
[0073] Furthermore, image blocks are used instead of complete images as the input of the style encoding network to reduce the influence of the individual information contained in the complete style image on the encoding result. By controlling the size of the image blocks, the receptive field of the style feature and the influence of the individual information can be adjusted. The specific operations are as follows:
[0074] For each style image sample in the unpaired face image translation dataset, randomly crop N image blocks of size M*M as the corresponding image block samples (N is selected according to the scale of the dataset, and M is determined according to the size of the style image in the dataset);
[0075] Take N image blocks instead of the complete image as input, and get the corresponding style code s through the style encoding network encoderS.
[0076] Furthermore, the new encoding result f is obtained by using the component constraints based on the face component dictionary i-1 The facial component feature information in is enhanced. The specific operations are as follows:
[0077] Use dlib to detect the position L of the face component in the content image C, encode it through the content encoding network encoderC, and extract the feature map fc obtained at each downsampling layer of the encoding network i (i represents the downsampling depth corresponding to the current downsampling layer). According to the position of the face components detected by dlib, ROI Align is used to crop the feature map, and the cropped component features are scaled to a consistent size.
[0078] Use the K-Means clustering method to cluster the component feature set corresponding to each component type and construct the component dictionary Q i,j :
[0079] Q i,j =KMeans(C|L;encoderC)
[0080] Among them, i∈{1,2,3,4} represents the downsampling depth corresponding to the current feature map, and j∈{left eye, right eye, nose, mouth} represents the corresponding component type.
[0081] When using the decoding network to perform feature fusion translation reconstruction on the image, ROI Align is also used to crop the feature map obtained by each upsampling layer, and the component content loss is used to constrain the reconstructed feature map f i The component feature F in i,j With the component feature Q in the component dictionary i,j The differences:
[0082] L face =||F i,j -Q i,j ||1
[0083] The encoding result f obtained by decoding each feature layer using the component constraint based on the face component dictionary i The facial component feature information in the face image is enhanced to improve the translation quality of the facial components in the final face image translation result.
Claims
1. A non-paired face image translation method based on self-supervised learning, characterized in that: The steps include: Step (1): for the unpaired face image translation dataset, a domain decoupling strategy is adopted to design two independent style encoding networks encoderS and content encoding networks encoderC, which encode the style image S and content image C respectively to obtain the style code s and content code c, and ensure that s and c have the same feature dimension; Step (2): construct a corresponding decoding network decoder according to the content encoding network encoderC, and replace the corresponding normalization layer in the decoder with an adaptive normalization (AdaIN) layer; the style encoding network encoderS, the content encoding network encoderC and the decoding network decoder constitute an image translation network; Step (3), transmit the content code c through the decoding network decoder, recorded as the coding feature f i , and in each adaptive normalization layer of the decoding network, the transmitted encoding feature f is transformed using the adaptive normalization method. i And style code s feature fusion, get the new encoding feature f i-1 , i represents the depth of the upsampling layer corresponding to the current encoding feature f. In the encoding network, the value of i gradually increases with feature conduction and gradually decreases in the decoding network: f i-1 =AdaIN(f i ,s)=σ(s)(f i -μ(f i )σ(f i ))+μ(s) where μ(·) and σ(·) represent the mean and standard deviation, respectively; The new encoding feature f is obtained by using the component constraints based on the face component dictionary i-1 The facial component feature information in the image is enhanced, and the preliminary facial image translation result is obtained through multiple feature fusion and feature decoding of the decoding network. Step (4), for the unpaired face image translation dataset, in order to guide the network model to achieve the face image translation task under unpaired conditions, constraints need to be imposed. The specific operations are as follows: Using the self-reconstruction loss L rec and the cycle reconstruction loss L cycrec , use the content map instead of the style map as the reconstruction style to constrain the consistency of content features during image translation: L rec =||C-G(C,C))||1 L cycrec =||C-G(G(C,S),C)||1 Where G(x, y) represents the image translation network, x represents the content graph, and y represents the style graph; Using style contrast loss L stycon To constrain the independence of style features in the image translation process: in Represents the style features of the translation result, q + Represents the style dictionary corresponding to the target style type, Represents the style dictionary corresponding to other style types, k is the negative sample type, and τ is the temperature hyperparameter; Constraining the perceptual quality of image translation using generative adversarial networks and adversarial losses: L adv =logD(C)+log(1-D(C,s)) Where D represents the discriminative network in the generative adversarial network.
2. The unpaired face image translation method based on self-supervised learning according to claim 1, characterized in that: The specific operation of the style encoding network encoderS to encode the style image S is as follows: Use data augmentation methods to expand the style image data and construct positive sample pairs between the expanded data sample S′ and the source sample S; For each image style type in the unpaired face image translation dataset, a corresponding style dictionary is constructed to store the style features of the style image of this style type obtained through the style encoding network encoderS; The style dictionaries corresponding to other style types are used as negative samples q - , the style dictionary corresponding to the current style type is used as the positive sample q + , through the contrastive learning method in self-supervised learning to constrain the feature separation between different style domains, the style encoding network can well extract different types of style features. The loss function of contrastive learning is defined as: Where s is the style feature corresponding to the current source sample S, k is the negative sample type, and τ is the temperature hyperparameter.
3. The unpaired face image translation method based on self-supervised learning according to claim 2, characterized in that: Using image blocks instead of complete images as the input of the style encoding network can reduce the influence of the individual information contained in the complete style image on the encoding result. By controlling the size of the image blocks, the receptive field of the style feature and the influence of the individual information can be adjusted. The specific operations are as follows: For each style image sample in the unpaired face image translation dataset, randomly crop N image blocks of size M*M as the corresponding image block samples; Take N image blocks instead of the complete image as input, and get the corresponding style code s through the style encoding network encoderS.
4. The unpaired face image translation method based on self-supervised learning according to claim 1, 2 or 3, characterized in that: The new encoding feature f is obtained by using the component constraints based on the face component dictionary i-1 The facial component feature information in is enhanced. The specific operations are as follows: Use dlib to detect the position L of the face component in the content image C, encode it through the content encoding network encoderC, and extract the feature map fc obtained at each downsampling layer of the encoding network i , according to the position of the face components detected by dlib, use ROI Align to crop the feature map, and scale the cropped component features to a consistent size; Use the K-Means clustering method to cluster the component feature set corresponding to each component type and construct the component dictionary Q i,j : Q i,j =KMeans(C|L;encoderC) Where i∈{1, 2, 3, 4} represents the downsampling depth corresponding to the current feature map, and j∈{left eye, right eye, nose, mouth} represents the corresponding component type; When using the decoding network to perform feature fusion translation reconstruction on the image, ROIAlign is also used to crop the feature map obtained by each upsampling layer, and the component content loss is used to constrain the reconstructed encoding feature f i The component feature F in i,j With the component feature Q in the component dictionary i,j The differences: L face =||F i,j -Q i,j ||1 The encoded features f obtained by decoding each layer of features are obtained by using the component constraints based on the face component dictionary i The facial component feature information in the face image is enhanced to improve the translation quality of the facial components in the final face image translation result.
Citation Information
Patent Citations
Multi-domain image conversion method and system based on conditional generative adversarial network, and medium
CN110675316A
Face sketch synthesis system based on conditional enhancement generative adversarial network
CN111489405A
Face aging image synthesis method based on cyclic conditional generative adversarial network
CN111798369A
Systems and methods for image-to-image translation using variational autoencoders
US20180247201A1
