Abstract
StyleGAN inversion is a critical step for real-world image editing, yet existing methods suffer from a trade-off between reconstruction quality and inference speed. We present E2Style, an efficient feed-forward encoder that achieves state-of-the-art inversion quality in milliseconds. By employing a shallower backbone, hierarchical prediction heads, and a recursive refinement strategy, E2Style bridges the gap between slow optimization-based methods and fast but lower-fidelity encoders.
Introduction
The power of StyleGAN in image synthesis and manipulation is well-documented. However, applying these capabilities to real-world photographs requires "inversion"—finding the specific latent code ($w \in W+$) that allows the generator to recreate the input image. Existing methods typically fall into three categories: optimization-based methods, which are accurate but slow; forward-based encoders, which are fast but often lose identity and detail; and hybrid methods, which remain too slow for interactive use. E2Style addresses this gap by providing an encoder-based solution that matches the precision of optimization while maintaining the speed of a single forward pass.
Methodology
E2Style introduces three primary architectural innovations to the standard encoder design:
1. Shallower Backbone and Efficient Heads
Contrary to the trend of using increasingly deep networks, the authors found that a shallower backbone (a truncated SE-ResNet50) aligns more effectively with StyleGAN’s semantic hierarchy. They replace heavy convolutional heads with Efficient Prediction Heads—combining Global Average Pooling with Fully Connected layers. This design preserves spatial information while significantly reducing the parameter count.
2. Hierarchical Latent Prediction
The model explicitly maps encoder layers to specific semantic levels of the StyleGAN latent space. Using a constrained optimization approach, the authors distribute the 18 latent codes across the encoder: 9 coarse, 5 medium, and 4 fine. This ensures that each part of the network focuses on the appropriate level of detail.
3. Multi-Stage Recursive Refinement
To further bridge the gap with optimization, E2Style employs a recursive refinement strategy. In the second stage, the encoder processes both the original image and the initial reconstruction to predict a "residual" correction. This iterative approach allows the network to fix small errors that a single pass might miss.
Experiments and Results
E2Style was trained on the FFHQ dataset and evaluated on CelebA-HQ, as well as non-face domains like Stanford Cars and LSUN.
- Efficiency: The single-stage E2Style uses only 85M parameters (compared to 262M for pSp) and runs in 0.04 seconds.
- Performance: Even without refinement, E2Style outperforms existing encoders like pSp and e4e in SSIM and Identity Similarity (IDS).
- Refinement: The 2-stage version (0.09s) achieves results comparable to optimization methods that are 500 times slower.
Applications
The high fidelity of E2Style inversion enables various downstream tasks. Beyond standard face editing, the model excels at restoration tasks such as inpainting and super-resolution.
Conclusion
E2Style demonstrates that a carefully designed, shallower encoder can outperform deeper, more complex architectures for StyleGAN inversion. By focusing on semantic alignment and recursive refinement, it provides a fast, high-quality baseline for real-time image editing and restoration. Future work will explore universal inversion models that can handle multiple domains within a single latent space.
Summary updated