Introduction
Generative Adversarial Networks (GANs), particularly StyleGAN, have revolutionized image synthesis. However, applying these models to real-world image editing requires "GAN inversion"—the process of mapping a real image back into the generator's latent space. This process has historically been plagued by a fundamental trade-off: reconstruction fidelity versus editability. While expressive spaces like $\mathcal{W}^+$ allow for near-perfect reconstruction, they often lack the geometric constraints necessary to keep edited images on the manifold of realistic data. This paper introduces a hybrid latent space, $\mathcal{F}/\mathcal{Z}^+$, designed to bridge this gap by combining high-capacity features with a bounded hyperspherical prior.
The Challenge of Latent Space Selection
To edit a photograph, one must find a latent code that reconstructs the original image. If the inversion targets highly expressive, unbounded spaces (e.g., $\mathcal{W}$ or $\mathcal{W}^+$), the reconstruction is excellent. However, because these spaces lack defined boundaries, semantic manipulations often push the latent code into "out-of-distribution" regions. This results in visual artifacts, such as "melting" faces or lost identity, especially under high-intensity edits.
Conversely, the original prior space $\mathcal{Z}$ is a bounded hypersphere. While edits in $\mathcal{Z}$ remain realistic, the space lacks the capacity to capture the fine-grained details of a specific individual, leading to poor reconstruction fidelity. This research seeks to achieve the best of both worlds.
Methodology: The $\mathcal{F}/\mathcal{Z}^+$ Hybrid Space
The authors propose a "division of labor" within the latent space by splitting the generator's input into two distinct components:
- The $\mathcal{F}$ Space (Reconstruction): Instead of starting from the initial constant input, the method utilizes an intermediate feature map ($\mathcal{F}$) as a base code. This high-capacity spatial map handles coarse geometry and ensures the reconstructed image is faithful to the target photo.
- The $\mathcal{Z}^+$ Space (Editing): For subsequent layers of the generator, the model uses an extended version of the original prior space, $\mathcal{Z}^+$, consisting of 18 distinct 512-dimensional vectors.
Optimization with Hyperspherical Constraints
The inversion process involves an initial encoder-based guess followed by optimization using Mean Squared Error (MSE) and perceptual losses. A critical innovation is the hyperspherical retraction: after each optimization step, the $\mathcal{Z}^+$ vectors are mathematically projected back onto the surface of a hypersphere with radius $\sqrt{512}$. This constraint acts as a guardrail, ensuring the latent codes remain within the well-behaved regions of the GAN's learned distribution. During the editing phase, only the $\mathcal{Z}^+$ codes are manipulated using established semantic directions (e.g., GANSpace or InterfaceGAN).
Experimental Results
The researchers evaluated the approach using StyleGAN2 (trained on FFHQ) and StyleGAN1 (trained on LSUN Cat), with quantitative testing performed on the CelebA-HQ dataset.
Reconstruction Fidelity
The $\mathcal{F}/\mathcal{Z}^+$ space achieves reconstruction quality practically tied with the previous state-of-the-art $\mathcal{F}/\mathcal{W}^+$. On CelebA-HQ, the proposed method reached an MSE of 0.01742 and an SSIM of 0.81477, nearly identical to the benchmarks of 0.01743 and 0.81479, respectively.
Editing Stability and Quality
The primary advantage of $\mathcal{F}/\mathcal{Z}^+$ is its robustness during manipulation. In heavy semantic editing tasks (e.g., changing age or expression), the method maintained an average identity similarity of 0.373, significantly outperforming the 0.327 achieved by $\mathcal{F}/\mathcal{W}^+$. Qualitatively, while baseline methods often produced unnatural textures or distorted features at high intensities, $\mathcal{F}/\mathcal{Z}^+$ maintained photorealistic integrity and identity consistency across all tested intensities.
Discussion and Insights
The success of this method highlights that editing artifacts are often a result of a lack of geometric boundaries rather than just feature entanglement. By partitioning the latent space, the $\mathcal{F}$ space handles the heavy lifting of spatial reconstruction, allowing the $\mathcal{Z}^+$ space to function as a robust, artifact-free editing interface. Furthermore, the $\mathcal{Z}^+$ prior is "plug-and-play," meaning it can be integrated into existing inversion pipelines like PTI or SAM to immediately improve editing stability without requiring architectural changes.
Limitations and Future Work
A current limitation is that semantic directions in $\mathcal{Z}$ and $\mathcal{Z}^+$ are less explored than those in $\mathcal{W}$ or $\mathcal{S}$, which can lead to some degree of attribute entanglement. Future research into more disentangled directions for hyperspherical spaces could mitigate this. Additionally, the authors suggest that the principle of hyperspherical priors could be extended to diffusion models, particularly those using CLIP embeddings, which naturally reside on a hypersphere.
Summary updated