Abstract
Gradient Adjusting Networks (GANI) offer a novel approach to StyleGAN2 domain inversion, achieving near-perfect image reconstruction while maintaining the editability of the latent space. By employing shallow "update networks" to transform loss gradients into precise weight corrections, GANI addresses the fundamental trade-off between inversion fidelity and semantic editability. Our evaluation across diverse datasets demonstrates significant improvements in identity preservation and reconstruction error compared to existing state-of-the-art methods.
Introduction
StyleGAN2 is the current gold standard for generating realistic synthetic images, largely due to its disentangled latent space which allows for intuitive semantic editing. However, applying these edits to real-world photos requires "Domain Inversion": finding the exact latent code and generator parameters that produce a specific photo.
The primary challenge is the "Inversion-Editability Trade-off." Most real images do not exist within StyleGAN’s native latent space. While tuning generator weights ($\theta$) can achieve perfect reconstruction, aggressive tuning often destroys the latent space's structure, making semantic edits (like changing age or expression) impossible. GANI introduces a learned optimization strategy to overcome this limitation.
Methods
The authors propose a per-image optimization procedure utilizing Gradient Modification Modules (GMMs). Instead of updating generator weights directly via standard backpropagation, GANI uses these shallow networks to map loss gradients to parameter corrections.
For each layer of the generator, a GMM (comprising residual blocks) takes the gradient of the loss function with respect to the layer's parameters as input. The weights are then updated using the formula: $\theta'_i = \theta_i \odot (1 + M_i(\frac{\partial L}{\partial \theta_i}))$. This learned optimizer behavior acts as a powerful regularizer, ensuring weights do not drift into unrealistic territory.
The training process employs a multi-objective loss function:
- Pixel-wise & Perceptual losses ($L_2$, LPIPS).
- Identity loss (ArcFace/MoCo) to maintain subject identity.
- Face-Parsing Loss ($L_{FP}$): A novel addition using a segmentation network to preserve fine structural details like lip and eye shapes.
- Localization Regularizer: Prevents model drifting by ensuring the generator still produces valid images for random latent codes.
Results
GANI was evaluated across several domains, including CelebA-HQ (faces), AFHQ-Wild (animals), Stanford Cars, and LSUN (churches and horses). It significantly outperforms state-of-the-art baselines such as PTI, HyperStyle, and ReStyle.
As shown in the quantitative results for CelebA-HQ, GANI achieved a near-perfect Identity Similarity (ID) of 0.99, compared to 0.85 for PTI. Furthermore, the $L_2$ pixel-wise error was reduced to 0.003, a five-fold improvement over PTI's 0.015. Qualitatively, GANI is superior at preserving fine details like jewelry, gaze direction, and complex textures (e.g., car logos and headlights) while maintaining full editability.
Discussion and Limitations
While GANI sets a new benchmark for high-fidelity inversion, it is an optimization-based method requiring 300–800 iterations per image, making it slower than encoder-only methods. Additionally, tuning the generator results in unique weights for every inverted image, posing a challenge for model storage. Future work may focus on compressing these weight shifts and extending structural parsing losses to non-human domains.
Summary updated