System and method for photorealistic image synthesis using unsupervised semantic feature disentanglement

Information

  • Patent Grant
  • 12136155
  • Patent Number
    12,136,155
  • Date Filed
    Wednesday, February 9, 2022
    2 years ago
  • Date Issued
    Tuesday, November 5, 2024
    a month ago
Abstract
Disclosed herein is a method to disentangle linear-encoded facial semantics from facial images without external supervision. The method uses linear regression and sparse representation learning concepts to make the disentangled latent representations easily interpreted and manipulated. Generated facial images are decomposed into multiple semantic features and latent representations are extracted to capture interpretable facial semantics. The semantic features may be manipulated to synthesize photorealistic facial images by sampling along vectors representing the semantic features, thereby changing the associate semantics.
Description
BACKGROUND

Generative Adversarial Networks (GANs) have realized great success in synthesizing photo-realistic images, given a set of latent codes. Despite the rapid boost in image quality, the interpretability of the generation process has become another major area of research. In general, interpretability requires latent codes to encode disentangled semantic information of the image. Further, ideally, well-disentangled semantics are supposed to be factorized to practically interpretable components and each component should be linear-encoded in the latent space as representation.


StyleGAN is a GAN for producing an unlimited number of (often convincing) portraits of fake human faces. The StyleGAN architecture provides an intermediate latent space to support the disentanglement property for face generation. Consequently, facial semantics are linear-encoded as latent representations.


Based on StyleGAN, sampling along a linear-encoded representation vector in latent space will change the associated facial semantic accordingly. This makes it possible to manipulate face generations to meet a target requirement. However, mapping particular facial semantics to a latent representation vector relies on training offline classifiers with manually labeled datasets. Thus, they require artificially defined semantics and provide the associated labels for all facial images. The disadvantages for training with labeled facial semantics include: (1) extra effort demanded on human annotations for each new attributes proposed; (2) each semantics is defined artificially, and the scope of semantics is limited to the linear combination of such definitions; and (3) by only training on each of the labeled semantics independently, insights on the connections among different semantics are unavailable.


SUMMARY

Disclosed herein is a system and method for manipulating linear-encoded facial semantics from facial images generated by StyleGAN without external supervision. The method derives from linear regression and sparse representation learning concepts to make the manipulated latent representations easily interpreted. The method starts by coupling StyleGAN with a stabilized 3D deformable facial reconstruction method to decompose single-view GAN generations into multiple semantics. Latent representations are then extracted to capture interpretable facial semantics.


The disclosed invention provides an unsupervised method to minimize the demand for human annotation. A novel unsupervised framework is specified to disentangle and manipulate facial semantics under the StyleGAN environment, while still maintaining the interpretability for semantics as in labeled datasets.



FIG. 1 shows facial manipulation results produced by sampling along latent representations in StyleGAN, learned by the unsupervised framework disclosed herein. Column 1 shows original generations. Columns 2-4 show manipulation on univariate environmental semantics. Columns 5-9 show manipulation on localized facial semantics.


The disclosed framework uses decorrelation regularization on StyleGAN to further enhance disentanglement for the latent representations. In addition, mutual reconstruction is introduced to stabilize training of an unsupervised 3D deformable face reconstruction method, such that it serves as an initial facial semantic extractor.


For univariate semantics (e.g., yaw angle, pose, lighting) a linear regression method to capture perturbations from latent space is disclosed. For pixel-level semantics (e.g., shape and texture), a localized representation learning algorithm is disclosed to capture sparse semantic perturbations from latent space.


All methods disclosed herein are based on a label-free training strategy. Only StyleGAN is trained with an in-the-wild face dataset. Therefore, a significant amount of human involvement in facial representation learning is not needed.


The goal of the facial representation disentanglement method disclosed herein is to capture linear-encoded facial semantics. With a given collection of coarsely aligned faces, a Generative Adversarial Network (GAN) is trained to mimic the overall distribution of the data. To better learn linear-encoded facial semantics, StyleGAN is re-implemented and trained. Further, the method improves the capability of the latent space trained by StyleGAN to disentangle by adding a decorrelation regularization. After training a StyleGAN model, the faces it generates are used as training data to train a 3D deformable face reconstruction method. A mutual reconstruction strategy stabilizes the training significantly. Then, a record is kept of the latent code from StyleGAN and linear regression is applied to disentangle the target semantics in the latent space.


Taking the reconstruction of the yaw angle as an example, the latent representation is manipulated as a data augmentation for training. Finally, a localized representation learning method to disentangle canonical semantics is disclosed.





BRIEF DESCRIPTION OF THE DRAWINGS

By way of example, a specific exemplary embodiment of the disclosed system and method will now be described, with reference to the accompanying drawings, in which:



FIG. 1 illustrates facial manipulation results by sampling along latent representations learned by the unsupervised framework disclosed herein.



FIG. 2 is an illustration showing the canonical albedo map of samples in CASIA WebFace after training.



FIG. 3 is a schematic diagram showing implementation of mutual reconstruction during training.



FIG. 4 is a schematic representation of the method for photorealistic image synthesis.





DETAILED DESCRIPTION

Decorrelating Latent Code in StyleGAN—In StyleGAN design, a latent code z∈custom characterd×1 is randomly generated from random noise, for example a Gaussian distribution. Then, a mapping network takes z as input and outputs a latent code w∈custom characterd×1. Space custom character is proven to facilitate the learning of more disentangled representations. The disentangled representation can be further enhanced by decorrelating latent codes in custom character. A more decorrelated latent space enforces more independent dimensions to encode information, and therefore encourages disentanglement in representations. To maximize the utilization of all dimensions in custom character, all Pearson correlation coefficients pij should be zero and the variance of all dimensions Var[wi] should be the same value, where i, j are the subscripts of dimensions in custom character space.


Therefore, decorrelation regularization is introduced via a loss function:











decorr

=


-




i

j



(

log

(

1
-



"\[LeftBracketingBar]"


p

i

j




"\[RightBracketingBar]"



)

)



+



i



(


Var

[

w
i

]

-



j


(

Var

[

w
j

]

)



)

2







(
1
)









    • where:

    • and pij and Var[wi] are estimated by sampling w from the mapping network custom character(z), given z˜custom character(0,I).





The overall objective for the GAN with decorrelation regularization follows:











min


,
𝒢




max
𝒟





GAN




+


decorr





(
2
)









    • where:


    • custom character and custom character are the generator and discriminator for the GAN, respectively.





Here the mapping network custom character is the only one to update with the new loss, custom characterdecorr.


Stabilized Training for 3D Face Reconstruction—An unsupervised 3D deformable face reconstruction method takes a roughly aligned face image and decomposes the faces into multiple semantics (e.g., view, lighting, albedo, and depth (yv,yl,ya and yd. respectively). During training, it uses these decomposed semantics to reconstruct the original input image I with the reconstruction loss:

custom characterrecon=custom character(I)custom character|I−Î|   (3)

    • where:
    • Î=custom character(yv,yl,ya,yd);
    • custom character is a confidence network; and
    • custom character is a 3D face renderer.


This method is used to pre-decompose some external facial semantics (e.g., pose and lighting), from StyleGAN generations.


However, the 3D face reconstruction algorithm struggles to estimate the pose of profile or near-profile faces. Even worse, if the dataset contains a decent number of profile and near-profile faces (e.g., CASIA WebFace), the 3D reconstruction fails to learn physically sounded semantics, as shown in FIG. 2(a), and collapses into a sub-optimal state. That is, the algorithm tries to use extreme values to estimate the texture and shape of each face independently, which deviates far away from the actual texture and shape of the face.


To address this problem, a mutual reconstruction strategy is disclosed and is and is illustrated in FIG. 3. In general, human faces are very similar in shape and texture. Therefore, each face image should still be able to reconstruct itself comparatively if its shape and texture are swapped with another face. Eventually, the strategy prevents the model from using extreme values to fit individual reconstruction, and the model learns to reconstruct faces with a minimum variance of the shape and texture among all samples, even for profile faces, as shown in FIG. 2(b). Following this idea, during training, the albedo and depth map between two images are swapped with a probability ϵ to perform the reconstruction with the alternative loss:

custom characterrecon=custom character(I,I′)custom character|I−Î′|   (4)

    • where:
    • Î′=custom character(yv,yl,ya′,yd′);
    • custom character is a mutual confidence network; and
    • all terms with a prime notation (′) originate from another image I′.


The overall loss to reconstruct each image then becomes:

(1−ϵ)custom characterreconcustom characterrecon   (5)


As a result, the shape and texture of faces with deviated facial semantics can be robustly estimated. Moreover, because images are now reconstructed from two images, the confidence map in the original work should be yielded by these two images accordingly. The two images are simply concatenated channel-wise as input to the confidence network, where the top image provides environmental semantics and the bottom image provides texture and shape information.


Disentangle Semantics with Linear Regression—With the 3D face reconstruction algorithm, face images generated by StyleGAN are decomposed to pose, lighting, depth, and albedo. The ultimate goal of disentangling semantics is to find a vector v∈custom character in StyleGAN, such that it only takes control of the target semantics.


Semantic Gradient Estimation—Consider a semantics y of a generated face image custom character(w) that can be measured by a function ƒ(⋅). The linear approximation of the gradient ∇y with respect to the latent code w satisfies:

ƒ(custom character(w1))≈ƒ(custom character(w0))+∇y(w0)custom character(w1−w0)   (6)


Note that in general, the gradient at location w0, ∇y(w0), is a function of latent code w0. However, with StyleGAN, it is observed that many semantics can be linear-encoded in the disentangled latent space custom character. It can therefore be assumed that all of the semantics can be linear-encoded. In other words, the gradient is now independent of the input latent code w0. This yields:

ƒ(custom character(w1))≈ƒ(custom character(w0))+∇ycustom character(w1−w0)

simplified as:

Δy≈∇ycustom characterΔw   (7)

    • where:

      Δy=ƒ(custom character(w1))−ƒ(custom character(w0); and
      Δw=w1−w0.


Semantic Linear Regression—It is now obvious that in the ideal case, the target vector v=∇y. While in a real world scenario, the gradient ∇y is hard to estimate directly because back-propagation only captures local gradient, making it less robust to noises. Therefore, a linear regression model to capture global linearity for gradient estimation is disclosed. N pairs of (w1, w0) are randomly sampled. Images are generated with StyleGAN and their semantics are estimated. Finally, all samples of differences are concatenated, denoted as ΔY∈custom characterN×1 for semantics and ΔW∈custom characterN×d for latent codes. The objective is to minimize:










min
v






Δ

Y

-

Δ

Wv




2
2





(
8
)







There exists a closed-form solution when N>d:

v=(ΔWcustom characterΔW)−1ΔWcustom characterΔY   (9)


Image Manipulation for Data Augmentation—One useful application for guided image manipulation is to perform data augmentation. Data augmentation has proven to be efficient when dealing with unbalanced data during training. One related problem within an unsupervised framework is the inaccurate estimation of extreme yaw angle. This problem worsens when dealing with generations from CASIA StyleGAN because it contains a large number of facial images, only a small portion of which are profile faces (i.e., an unbalanced yaw distribution).


Disclosed herein is a data augmentation strategy based on self-supervised facial image manipulation. The end goal is to help the 3D face reconstruction network estimate the extreme yaw angle accurately. With the linear regression method previously discussed, manipulation vectors v for univariate semantics, including the yaw angle, denoted as vyaw, can be learned. Recall that extrapolating along v beyond its standard deviation, yields samples with more extreme values for the associated semantics. Particularly, images with an extreme yaw angle can be generated to neutralize the unbalanced yaw distribution and train the 3D face reconstruction algorithm. Therefore, by seeing more profile faces deliberately, the system can better estimate extreme yaw angles.


The data augmentation strategy is performed alongside the training of 3D face reconstruction. To be specific, v is estimated and updated with a historical moving average (e.g., momentum=0.995) every 10 iterations. Then, augmentation is achieved by extrapolating a latent vector wi(s) via:

wi(s)=wi−wicustom charactervv+s·σwv   (10)

    • where:
    • wi is a random sample drawn from custom character(z);
    • s is the scaling factor for the interpolation/extrapolation along the unit length manipulation vector v; and
    • σw is the standard deviation for wcustom characterv.


In this case v=vyaw. Finally, the 3D face reconstruction method is trained with the augmented generations custom character(wi(s)).


Localized Representation Learning—In the case where ƒ(⋅) returns canonical outputs (i.e., depth and albedo maps), the outputs consist of pixels in spatial dimensions wherein the pixel values are highly correlated as the latent code changes. However, every pixel-level gradient estimation (i.e., v from Eq. (9) is independently calculated and is thus extremely redundant. To address this problem, the goal for canonical semantics is re-formulated to find the manipulation vectors I that capture interpretable combinations of pixel value variations. Define a Jacobian matrix Jvcustom characterS×d, which is the concatenation of all canonical pixel-level v. Here, S is the overall number of spatial and RGB dimensions of a given depth and albedo map.


One trivial definition of {circumflex over (v)} is that it maximizes ∥Jv*{circumflex over (v)}∥22. Ideally, a disentangled representation to manipulate interpretable facial semantics is expected. That is, interpolation along {circumflex over (v)} should result in a significant but localized (i.e., sparse) change across the image domain (e.g., some {circumflex over (v)} only control eye variations while some only control mouth variations, etc.). However, ∥Jv*{circumflex over (v)}∥22 captures the global pixel value perturbation. Thus, the localized canonical representation learning is derived by solving:











min

U
,

V
^








J
v
*

-

U



V
ˆ







F
2


+

α




U


1


+

β





i

j




(



v
ˆ

i





v
ˆ

j


)

2







(
11
)










s
.
t
.






v
ˆ

p



2


=
1






    • where:

    • p, i, j∈{1, . . . , P}; and

    • P is the number of components to learn.





Each column in U=[u1, . . . , up]∈custom characterS×P is a sparse component of the canonical albedo and depth perturbation and {circumflex over (V)}=[{circumflex over (v)}1, . . . , {circumflex over (v)}P]∈custom characterd×P consists of the associated latent representation in custom character space. α and β are tuning parameters to control the trade-off among the reconstruction accuracy of Jv*, sparsity of perturbation in semantics and orthogonality of associated latent representations.



FIG. 4 shows one embodiment of a method 400 of the invention in which facial images may be manipulated by varying the facial semantics. In a first step, a random code 402, which, in some embodiments may be, for example, Gaussian noise, is input to generator 404 to generate a facial image 406. As described herein, the generator may be, for example, StyleGAN or StyleGAN-2, but other facial generators may also be used.


Once a facial image 406 has been generated by generator 404, semantic extractor 408 then extracts semantic features from the facial image. Semantic extractor 408 may be a network trained to extract specific semantic features from the facial image. For example, the semantic extractor 408 shown in the exemplary embodiment of FIG. 4 has been trained to extract semantic features representing pose, lighting, shape and texture.


Various semantic features 410 may be manipulated without changing the identity of the facial image. For example, semantic features representing pose and lighting can be manipulated and the identity of the facial image will not change. For identity-invariant features 412, for example, pose and lighting, the features may be extracted using a linear regression model.


Other semantic features 412 may be manipulated only to a certain extent before they become identity-variant. That is, if these features are changed too much, then the facial image 406 assumes a new identity. Such features 412 may be extracted via a localized semantics learning method. In the end, a vector of a certain length (which may be, in some embodiments, 512) for each independent semantic is acquired. By sampling along the acquired vectors, the associated semantic changes accordingly.


The overall design of the disclosed system can be sued for photo manipulation with a target demand. This is particularly useful in data augmentation for tasks that require a large number of training data but wherein only a limited number of training samples are available. The code-to-image generator to image-to-code-to-image generator can also be replaced, such that the generated images are identical to the input image. Additionally, the method may be used for image editing wherein the disentangled semantics are used to perform directed editing demands to modify the image.


An unsupervised learning framework for disentangling linear-encoded facial semantics from facial images generated by StyleGAN has been disclosed herein. The system can robustly decompose facial semantics from any single view GAN generation and disentangle facial semantics. Additionally, a method to perform guided data augmentation to counteract the problem brought by unbalanced data is disclosed.


As would be realized by one of skill in the art, the disclosed method described herein can be implemented by a system comprising a processor and memory, storing software that, when executed by the processor, performs the functions comprising the method.


As would further be realized by one of skill in the art, many variations on implementations discussed herein which fall within the scope of the invention are possible. Moreover, it is to be understood that the features of the various embodiments described herein were not mutually exclusive and can exist in various combinations and permutations, even if such combinations or permutations were not made express herein, without departing from the spirit and scope of the invention. Accordingly, the method and apparatus disclosed herein are not to be taken as limitations on the invention but as an illustration thereof. The scope of the invention is defined by the claims which follow.

Claims
  • 1. A method comprising: obtaining a random facial image;inputting the facial image to a semantic extractor trained to extract a feature vector representing one or more semantic features from the facial image;decomposing the feature vector to extract one or more vectors representing specific features of the facial image;sampling the one or more vectors representing the specific features;modifying the extracted feature vector using the sampled vectors; andgenerating a new, modified version of the facial image using the modified feature vector;wherein vectors for identity-invariant features are extracted using a linear regression model; andwherein vectors for identity-variant features are extracted using a localized semantics learning method.
  • 2. The method of claim 1 wherein the random facial image is generated by a generative adversarial network based on a random input.
  • 3. The method of claim 2 wherein the generative adversarial network is StyleGAN or StyleGAN-2.
  • 4. The method of claim 2 wherein the random input is a latent code generated from a Gaussian distribution.
  • 5. The method of claim 4 further comprising: mapping the latent code to a disentangled latent space; andperforming decorrelation regularization on the disentangled latent space.
  • 6. The method of claim 5 wherein the decorrelation regularization is implemented using a decorrelation loss function.
  • 7. The method of claim 6 wherein the mapping is implemented with a mapping network and further wherein the decorrelation loss function is applied only to the mapping network.
  • 8. The method of claim 5 further comprising: performing linear encoding of the semantic features in the disentangled latent space.
  • 9. The method of claim 8 wherein the linear encoding is performed using an estimated semantic gradient.
  • 10. The method of claim 1 wherein extracted vectors for identity-variant features capture interpretable combinations of pixel variations in the semantic feature vectors.
  • 11. The method of claim 1 further comprising: using the vectors representing specific features of the facial image as training data for the generative adversarial network to reconstruct the facial image using a reconstruction loss.
  • 12. The method of claim 11 further comprising: using facial images generated by the trained generative adversarial network to train a deformable face reconstruction method.
  • 13. A system comprising: a processor; andmemory, storing software that, when executed by the processor, performs the method of claim 1.
  • 14. A system comprising: a processor; andmemory, storing software that, when executed by the processor, performs the method of claim 12.
RELATED APPLICATIONS

This application claims the benefit of U.S. Provisional Patent Application No. 63/149,375, filed Feb. 15, 2021, the contents of which are incorporated herein in their entirety.

PCT Information
Filing Document Filing Date Country Kind
PCT/US2022/015797 2/9/2022 WO
Publishing Document Publishing Date Country Kind
WO2022/173814 8/18/2022 WO A
US Referenced Citations (9)
Number Name Date Kind
11250245 Todorov Feb 2022 B2
20180365874 Hadap Dec 2018 A1
20190295302 Fu Sep 2019 A1
20200184660 Shi Jun 2020 A1
20210150369 Karras May 2021 A1
20210398335 Hu Dec 2021 A1
20220028139 Mitra Jan 2022 A1
20220138897 Singh May 2022 A1
20240146963 Chen May 2024 A1
Foreign Referenced Citations (2)
Number Date Country
WO-2020091891 May 2020 WO
WO-2021178936 Sep 2021 WO
Non-Patent Literature Citations (8)
Entry
Heinrich (here is referred as Heinrich-2), Apr. 24, 2017, Photo Editing with Generative Adversarial Networks (Part 2) (pp. 1-30) (Year: 2017).
Heinrich (here is referred as Heinrich-1), Apr. 20, 2017, Photo Editing with Generative Adversarial Networks (Part 1) (pp. 1-19) (Year: 2017).
Karras et al., 2019, “A Style-Based Generator Architecture for Generative adversarial Networks” (pp. 1-12). (Year: 2019).
Abdal et al., 2020, “Image2StyleGAN++: How to Edit the Embedded Images?” (pp. 8296-8305) (Year: 2020).
Collins et al., 2020, “Editing in Style: Uncovering the Local Semantics of GANs” (pp. 5771-5780) (Year: 2020).
Papastraits, 2020, “Deepfakes: Face synthesis with GANs and Autoencoders” (pp. 1-10) (Year: 2020).
Zhu et al., 2020, “In-Domain Gan Inversion for Real Image Editing” (pp. 592-608). (Year: 2020).
International Search Report and Written Opinion for the International Application No. PCT/US22/15797, mailed May 23, 2022, 7 pages.
Related Publications (1)
Number Date Country
20240062441 A1 Feb 2024 US
Provisional Applications (1)
Number Date Country
63149375 Feb 2021 US