InterFaceGAN: Interpreting the Disentangled Face Representation Learned by GANs

Yujun Shen, Ceyuan Yang, Xiaoou Tang, Bolei Zhou

Abstract

InterFaceGAN demonstrates that unconditionally trained Generative Adversarial Networks (GANs) naturally encode complex facial attributes—such as age, gender, and pose—as linear directions within their latent space. By identifying these linear boundaries, researchers can precisely edit both synthesized and real faces. Crucially, the framework allows for the disentanglement of correlated attributes (e.g., age and eyeglasses) without retraining the underlying model.

Introduction

While state-of-the-art GANs like StyleGAN and PGGAN produce photorealistic faces, they typically function as "black boxes," offering little explicit control over specific semantic features. Traditional semantic editing often requires training conditional GANs from scratch or using complex loss functions. InterFaceGAN addresses this by investigating whether standard GANs spontaneously learn semantic concepts during unsupervised training and how these concepts are organized in the latent space.

Methodology

The InterFaceGAN framework interprets and controls GAN latent spaces through a multi-step process:

  1. Synthesis and Scoring: 500,000 images are generated from random latent codes and scored using an off-the-shelf facial attribute classifier (ResNet-50).
  2. Boundary Identification: A linear Support Vector Machine (SVM) is trained on the latent codes of high-scoring and low-scoring images to find a separating hyperplane. The normal vector to this plane represents the attribute's direction.
  3. Manipulation: Faces are edited by moving their latent codes along these identified vectors.
  4. Conditional Disentanglement: To correct for dataset biases (e.g., age being correlated with eyeglasses), the authors use subspace projection to force attribute vectors to be orthogonal, enabling independent control.
  5. Real Image Inversion: Real photos can be edited by first finding their corresponding latent codes through GAN inversion.
Figure 1: InterFaceGAN results showing (a) single attribute manipulation and (b) the effectiveness of the disentanglement technique for correlated features.

Data and Implementation

The study analyzes GANs pre-trained on CelebA-HQ and FF-HQ. The auxiliary attribute classifier was trained on the CelebA dataset, utilizing its extensive attribute annotations and facial landmarks.

Key Insights

  • Linearity of Semantics: Complex visual concepts like gender or age are surprisingly well-represented as linear subspaces, with SVMs achieving over 95% accuracy in latent space separation.
  • Bias Correction: GANs learn the biases present in their training data. InterFaceGAN's orthogonal projection successfully bypasses these learned correlations.
  • Latent Space Hierarchy: In StyleGAN, different layers control different semantic levels: early layers handle pose, middle layers manage age and expression, and late layers dictate texture and color.
  • Artifact Mitigation: "Image quality" can also be treated as an attribute, allowing for the "repair" of generated images by moving away from artifact-heavy directions.

Results

Quantitative analysis confirms that moving latent codes along attribute vectors reliably shifts the classifier's scores. The conditional manipulation successfully decorrelates attributes, such as aging a face without altering its gender. While optimization-based inversion for real images takes several minutes, it preserves identity during edits, whereas encoder-based methods offer near-instant results with a slight loss in detail.

Limitations

The linear assumption is most effective near the decision boundary; extreme manipulations can lead to unnatural distortions. Additionally, the method relies on pre-existing classifiers, limiting discovery to attributes for which labeled data is already available. Future research may explore non-linear boundaries and unsupervised semantic discovery.

Summary updated

BibTeX
@article{shen2022interfacegan,
  author = {Yujun Shen and Ceyuan Yang and Xiaoou Tang and Bolei Zhou},
  title = {{InterFaceGAN: Interpreting the Disentangled Face Representation Learned by GANs}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2022},
  url = {https://openreview.net/forum?id=ldz4_cK1wX},
}
Figure