TL;DR
HyperInverter introduces a purely encoder-based, two-phase framework for StyleGAN inversion that breaks the classic trade-off between reconstruction quality, editability, and inference speed. By first encoding images into the highly editable $\mathcal{W}$-space and then using hypernetworks to predict generator weight updates in a single forward pass, it achieves near-optimization-level quality at a fraction of the computational cost—running over 1000$\times$ faster than optimization-based alternatives.
What Problem Does This Paper Address?
Real-world image manipulation using Generative Adversarial Networks (GANs) relies heavily on GAN inversion—the process of mapping a real photograph into a pre-trained GAN's latent space so it can be faithfully reconstructed and edited.
However, existing inversion methods force researchers to choose two out of three critical requirements:
- High Reconstruction Quality: Accurately capturing fine details (e.g., wrinkles, background textures).
- Editability: The ability to modify attributes (like age or expression) without introducing artifacts.
- Fast Inference: Processing images quickly enough for interactive, real-time applications.
Optimization-based methods yield excellent reconstruction and editability but take minutes per image because they iteratively update latent codes or generator weights for every single input. Conversely, encoder-based methods are lightning-fast (feed-forward) but struggle to capture fine details or sacrifice editability by mapping to less regular spaces like $\mathcal{W}^+$. HyperInverter bridges this gap, delivering high fidelity and editability at real-time speeds.
Methods
HyperInverter splits the inversion process into two sequential, purely encoder-based phases:
- Phase I (From Image to Content Code): The input image is passed through a primary encoder ($E_1$) that maps it directly into StyleGAN’s native $\mathcal{W}$-space. This space is highly regular and ideal for downstream editing, but it inherently lacks the capacity to represent every fine detail of a specific real-world image.
- Phase II (Generator Refinement via Hypernetworks): To recover the missing details without resorting to slow, per-image optimization, the authors introduce a second encoder ($E_2$). This encoder extracts and fuses features from both the original input image and the rough Phase I reconstruction to form an "appearance code." A series of hypernetworks then takes this appearance code and predicts residual weights ($\Delta\theta$) to directly update the convolutional layers of the pre-trained StyleGAN generator.
Because both phases rely entirely on feed-forward neural networks, the entire pipeline executes in a single forward pass during inference.
Datasets
The authors evaluated HyperInverter on two distinct and challenging domains:
- Human Faces: Trained on the FFHQ dataset (70,000 high-quality face images) and evaluated on the official test split of CelebA-HQ (2,824 images) at $1024 \times 1024$ resolution.
- Churches: Evaluated on the LSUN Church dataset ($126,227$ training images, $300$ test images) at $256 \times 256$ resolution to test performance on complex, unaligned outdoor scenes.
Key Insights and Ideas
- Decoupling Structure and Detail: Instead of forcing a single latent code to represent both global semantics and pixel-perfect details (which ruins editability), HyperInverter delegates semantics to the $\mathcal{W}$-space and fine-grained details to the generator's weights.
- Hypernetworks as Instant Fine-Tuning: State-of-the-art methods like PTI achieve high fidelity by fine-tuning the generator via backpropagation for every new image. HyperInverter effectively trains a meta-network to predict what those fine-tuned weights should be in milliseconds.
- Layer-Specific Sensitivity: An analysis of the predicted residual weights revealed that weight modifications are highly concentrated in the highest-resolution convolutional layers (e.g., $1024 \times 1024$). This confirms the hypernetwork successfully targets fine-grained textures and details rather than altering global geometry.
Key Results
HyperInverter achieves an excellent balance on the quality-time trade-off curve:
- Speedup: With an inference time of roughly 0.09 seconds per image on a single NVIDIA Tesla V100 GPU, HyperInverter is 3000$\times$ faster than optimization-based SG2 $\mathcal{W}^+$ and 1100$\times$ faster than PTI.
- Reconstruction Fidelity: It significantly outperforms existing encoder-based methods (pSp, e4e, ReStyle) across all standard metrics. On CelebA-HQ, HyperInverter achieved an LPIPS score of 0.1054 (lower is better), soundly beating e4e (0.1992) and approaching the quality of optimization methods.
- Editability: Quantitative tests for age and pose manipulation showed that HyperInverter produces stronger, cleaner editing effects with fewer visual artifacts (such as distorted backgrounds or ghosting) than methods operating in $\mathcal{W}^+$ space.
Limitations and Future Work
Despite its strengths, HyperInverter still exhibits a slight performance gap when compared to the absolute best optimization-based methods (like PTI) on certain strict reconstruction metrics.
To close this remaining gap, the authors suggest several promising future directions:
- Integrating iterative refinement techniques into the encoder steps.
- Employing more sophisticated loss functions, such as a multi-layer identity loss.
- Extending the architecture to support the newer, alias-free StyleGAN3 backbone.
Summary updated