Abstract
Generative Adversarial Networks (GANs) have revolutionized image synthesis, yet their application to editing existing real-world images remains challenging due to the difficulty of GAN inversion. This paper demonstrates that the StyleGAN architecture is uniquely suited for inversion, serving as a robust "image prior" for restoration and animation. By optimizing per-layer latent codes and utilizing perceptual loss, the proposed method achieves state-of-the-art performance in image inpainting and super-resolution. Furthermore, the linearity of the resulting latent space enables unsupervised facial re-animation through simple arithmetic operations.
Introduction
While GANs excel at creating hyper-realistic images from random noise, performing GAN Inversion—finding the specific latent code ($z$) that generates a target image ($I$)—is a long-standing hurdle. Historically, GANs have struggled as image priors due to mode collapse and the non-invertibility of complex generator architectures. This work addresses these gaps by leveraging StyleGAN's unique structure to bridge the divide between synthesis and editing.
Methodology
The authors propose a refined approach to latent optimization centered on three key pillars:
- Perceptual Loss: To avoid the rigidity of pixel-wise comparisons, a VGG-based perceptual loss ($\phi$) is minimized, ensuring the generated image matches the target's high-level features.
- Per-Layer Latent Codes ($z_l$): The primary technical innovation involves optimizing a unique latent code for every layer of the StyleGAN synthesis network. This increases the degrees of freedom, allowing for the accurate reconstruction of real-world images that may fall outside the original training distribution.
- Linear Latent Arithmetic: For animation, the latent space is treated as linear. By decomposing codes into identity and pose components, facial expressions can be transferred between subjects by adding pose offsets to a target identity's code.
Key Insights: StyleGAN as a Prior
StyleGAN's architecture, which injects latent codes at every convolutional layer, creates a smoother optimization landscape compared to previous models like PGGAN. This makes it an exceptionally "sufficient" prior—capable of representing diverse faces—while remaining "compact" enough to enforce anatomical rules. Unlike "blind" priors such as Deep Image Prior (DIP), StyleGAN possesses semantic knowledge, understanding that a face requires specific features like eyes and teeth.
Experimental Results
The method was evaluated on high-resolution datasets including CelebA-HQ, FFHQ, and LSUN Cats.
Reconstruction and Super-Resolution
StyleGAN inversion achieved a perceptual error (LPIPS) of 0.345, significantly outperforming PGGAN's 0.599. In 8x super-resolution tasks (upscaling from $128^2$ to $1024^2$), the model maintained identity and fine textures, such as hair and dental structure, far better than standard interpolation or previous GAN-based methods.
Inpainting and Animation
In inpainting tests involving the removal of $64 \times 64$ pixel blocks, StyleGAN recorded an error of 0.104, compared to 0.368 for DIP. The model successfully "hallucinated" missing features that were semantically consistent with the subject. Additionally, the authors demonstrated unsupervised animation, transferring expressions from a source video to a still portrait without the need for landmark tracking.
Conclusion and Limitations
While powerful, the method is computationally intensive, requiring approximately 1,000 iterations of gradient descent per image. There is also a slight "identity drift" where reconstructions may appear subtly "beautified." Future work may focus on developing dedicated encoder networks to speed up the inversion process and further refining the training phase to enhance invertibility by design.
Summary updated