E2Style: Improve the Efficiency and Effectiveness of StyleGAN Inversion

Tianyi Wei, Dongdong Chen, Wenbo Zhou, Jing Liao, Weiming Zhang, Lu Yuan, Gang Hua, Nenghai Yu

TL;DR

This paper introduces E2Style, a novel feed-forward network for StyleGAN inversion that significantly boosts both efficiency and effectiveness. By employing a shallower network, improved loss functions, and a multi-stage refinement process, E2Style achieves state-of-the-art inversion quality comparable to slow optimization-based methods, but at the speed of fast forward-based methods.

What Problem Does This Paper Address?

StyleGAN inversion is a crucial step for enabling real-world image editing using powerful pre-trained GANs like StyleGAN. The goal is to find the specific "latent code" within StyleGAN's complex latent space that, when fed into the generator, produces an image identical to a given real-world image. This task faces a trade-off: optimization-based methods can achieve high-quality reconstructions but are extremely slow, making them impractical for real-time applications. Conversely, forward-based methods (using encoders) are fast but often sacrifice reconstruction quality. E2Style aims to bridge this gap, offering both high quality and high efficiency.

Methods

E2Style introduces several key innovations:

  • Efficient Network Architecture:
    • Shallower Backbone: Instead of deep, complex backbones, E2Style uses a shallower network that is sufficient for capturing the necessary semantic information. This reduces computational overhead.
  • Hierarchical Latent Code Regression: The latent code is predicted in a hierarchical manner, allowing different parts of the network to focus on different semantic levels of detail, improving learning efficiency.
  • Efficient Prediction Heads: Simple, lightweight prediction heads (average pooling + fully connected layer) are used at each level, avoiding the heavy convolutional layers found in prior work.
  • Improved Loss Functions:
    • Multi-Layer Identity Loss: Leverages features from multiple layers of a pre-trained face recognition network (ArcFace) to enforce stronger identity consistency between the original and reconstructed images.
  • Multi-Layer Face Parsing Loss: Incorporates features from a pre-trained face parsing network to capture finer local facial details (e.g., eyes, mouth), leading to more accurate reconstructions.
  • Multi-Stage Refinement: A purely feed-forward, recursive refinement process is introduced. Subsequent stages predict the residual of the latent code from the previous stage, progressively refining the result without significant time penalty. This is a key differentiator from optimization-based refinement.

Datasets

  • Training: FFHQ dataset (70,000 faces) was used for training.
  • Evaluation (Face Domain): CelebA-HQ dataset (for both quantitative and qualitative evaluation).
  • Evaluation (Non-Face Domains): Stanford Cars, LSUN Cat, and LSUN Horse datasets were used to demonstrate the method's generality.

Key Insights and Ideas

  • Deeper is Not Always Better: The study found that excessively deep encoder backbones do not necessarily lead to better inversion quality and can even be detrimental, likely due to a mismatch in semantic levels or increased complexity.
  • Hierarchical Structure Benefits: Explicitly decoupling latent code prediction into hierarchical levels, corresponding to different semantic features, simplifies the learning problem.
  • Efficient Heads Matter: Simple average pooling and FC layers are sufficient and more efficient than complex convolutional heads for predicting latent codes, especially when combined with multi-layer losses.
  • Refinement Without Optimization: The multi-stage refinement, using only feed-forward networks to predict residuals, offers a significant speed advantage over traditional optimization-based refinement.
  • Loss Functions are Crucial: Multi-layer identity and face parsing losses are vital for improving reconstruction quality and identity preservation, acting as "free lunch" additions during training.

Key Results

  • Efficiency & Effectiveness: E2Style outperforms existing forward-based methods in quality and is comparable to state-of-the-art optimization-based methods, while being significantly faster.
  • Quantitative Improvements:
    • Achieves SSIM scores up to 0.67 and PSNR up to 23.0 on CelebA-HQ, outperforming other forward-based methods.
  • E2Style-1Stage (single-stage) is significantly faster (0.04s) and smaller (85M parameters) than pSp (262M params) and IDGI (165M params) while achieving better or comparable results.
  • Multi-stage versions (2-stage, 3-stage) further improve quality, with the 3-stage version reaching comparable performance to the slow I2S method.
  • Qualitative Improvements: Visual comparisons show better identity consistency and more accurate local details in reconstructions and edited images.
  • Generalization: E2Style demonstrates strong performance on non-face datasets (cars, cats, horses), highlighting the robustness of its architecture and loss functions.
  • Applications: The paper showcases E2Style's utility in secure deep hiding, image manipulation, restoration, and translation tasks.

Limitations and Future Work

  • Limitations:
    • While E2Style is efficient, the multi-stage refinement still adds some computational cost compared to a single-stage forward pass.
  • The paper notes that the multi-layer face parsing loss is primarily tested on face domains, though its generalization is explored.
  • Future Work: The authors suggest focusing on creating a universal approach to encode any kind of image into the latent space of a StyleGAN model pre-trained for that specific domain. This implies extending the method beyond face-specific priors.

Summary updated

BibTeX
@article{wei2022e,
  author = {Tianyi Wei and Dongdong Chen and Wenbo Zhou and Jing Liao and Weiming Zhang and Lu Yuan and Gang Hua and Nenghai Yu},
  title = {{E2Style: Improve the Efficiency and Effectiveness of StyleGAN Inversion}},
  journal = {IEEE Trans. Image Process.},
  year = {2022},
  url = {https://openreview.net/forum?id=ctWwUn0CoLe},
}
Figure