Photo-Realistic Out-of-domain GAN inversion via Invertibility Decomposition

Xin Yang, Xiaogang Xu, Yingcong Chen · DOI

TL;DR

This paper introduces a novel framework for GAN inversion that successfully handles "Out-of-Domain" (OOD) elements like jewelry, complex backgrounds, and accessories. By decomposing an image into In-Domain (face) and OOD partitions using a new spatial alignment and masking module (SAMM), the authors achieve photo-realistic face manipulation while perfectly preserving the unique details the GAN wasn't trained to generate.

The Challenge of Out-of-Domain Inversion

GAN inversion—the process of finding a latent vector that reconstructs a real image—is the gateway to high-quality image editing. However, pre-trained generators like StyleGAN2 are specialists. While they excel at reconstructing facial features, they struggle with "Out-of-Domain" (OOD) details such as specific jewelry, microphones, or complex backgrounds.

Existing methods attempt to use "invertibility masks" to blend these OOD regions back into the generated image. However, these masks are often noisy because the GAN's reconstruction of the face is slightly misaligned with the original. This misalignment leads to "ghosting" artifacts or blurriness where the face meets the background.

Identifying In-Domain (face) and Out-of-Domain (earring) regions for inversion.

Methods: Invertibility Decomposition

The authors propose Invertibility Decomposition powered by a Spatial Alignment and Masking Module (SAMM). The pipeline works as follows:

  1. Encoding: A standard encoder maps the input image to a latent vector.
  2. Feature Generation: This vector is fed into StyleGAN2 to produce intermediate feature maps.
  3. SAMM Alignment: Instead of direct comparison, SAMM uses an optical flow prediction module to iteratively align generated features with the input geometry. By warping the features to match the input's "shape," the system eliminates reconstruction errors caused by simple misalignment.
  4. Masking & Blending: Once aligned, the remaining errors clearly highlight true OOD regions. SAMM predicts a precise multi-resolution mask to seamlessly blend the GAN-generated face with the original OOD pixels.

Key Insights

  • Alignment is the Antidote to Noise: Realizing that misalignment causes mask noise is the "aha moment." Using optical flow to "warp" features before mask prediction makes OOD areas (like a hat or cigarette) much more distinguishable.
  • Multi-Resolution Awareness: SAMM operates across multiple GAN layers, capturing OOD elements of all sizes, from large accessories to fine textures.
  • Preserving Editability: This method maintains the GAN's internal logic. Users can still apply transformations (like adding a smile) to the latent vector, and the system will warp and blend the result back into the original context.

Key Results

On the CelebAMask-HQ dataset, the method achieved a PSNR of 27.24 and an SSIM of 0.900, significantly outperforming baselines like HyperStyle and FeatureStyle. Qualitative results show a striking ability to keep "impossible" details with pixel-perfect clarity.

Successful attribute manipulation (smiling) while preserving high-frequency OOD details like the earring and background slats.

Limitations and Future Work

The quality of the in-domain reconstruction still depends on the initial latent vector from the pre-trained encoder. While the authors demonstrated extensions to other domains like the Stanford Cars dataset, the bulk of the optimization is currently for human faces. Future work will focus on reducing the computational overhead of the iterative alignment process.

Summary updated

BibTeX
@inproceedings{yang2023photo,
  author = {Xin Yang and Xiaogang Xu and Yingcong Chen},
  title = {{Photo-Realistic Out-of-domain GAN inversion via Invertibility Decomposition}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
  doi = {10.1109/iccv51070.2023.00689},
}
Figure