In-N-Out: Faithful 3D GAN Inversion with Volumetric Decomposition for Face Editing

Yiran Xu, Zhixin Shu, Cameron Smith, Seoung Wug Oh, Jia-Bin Huang

TL;DR

"In-N-Out" introduces a novel 3D GAN inversion method that elegantly solves the classic reconstruction-editability trade-off for out-of-distribution (OOD) data, such as faces with heavy makeup or large glasses. By explicitly decomposing a 3D scene into two separate neural radiance fields—one for the in-distribution face and one for the OOD elements—it achieves highly faithful image and video reconstruction while preserving full semantic editing capabilities.

What Problem Does This Paper Address?

3D-aware Generative Adversarial Networks (GANs), like EG3D, have revolutionized our ability to synthesize and edit human faces with strict 3D geometric consistency. However, to edit a real-world photo or video, you must first "invert" it—finding the specific latent code in the GAN's latent space that perfectly reconstructs the target image.

Because these models are pre-trained on datasets of clean, natural faces (such as FFHQ), they struggle immensely when encountering out-of-distribution (OOD) features like skull makeup, face masks, or bulky sunglasses. This creates a frustrating reconstruction-editability trade-off:

  • If you force the model to fit the OOD objects perfectly (e.g., by fine-tuning the generator network), you distort the latent space and lose the ability to perform clean semantic edits.
  • If you prioritize editability, the OOD objects end up severely blurred or completely erased.

Methods

The authors propose a volumetric decomposition framework that avoids squeezing complex OOD objects into a face-only latent space. Instead, they represent the scene using two independent neural radiance fields modeled via EG3D's tri-plane representation:

  1. In-Distribution (InD) Field: Captures the clean, natural face by optimizing a standard latent code ($w_t$) within EG3D's pre-trained space ($W+$).
  2. Out-of-Distribution (OOD) Field: Uses a separate, dedicated tri-plane and a newly introduced MLP decoder to capture irregular textures and rigid objects. For video inputs, a per-frame latent code ($\phi_t$) accounts for any non-static OOD movements.

These two fields are merged dynamically using composite volume rendering governed by a learned blending weight ($b$). To ensure a clean separation, the authors introduce a binary entropy loss on the blending weights. This forces the model to make a hard choice: any given spatial point must belong strictly to either the face or the OOD object, preventing them from lazily blurring together.

During the editing phase, semantic manipulations (like changing expressions or aging) are applied only to the InD face latent code, leaving the OOD radiance field completely unaltered.

Datasets

To evaluate their method on highly non-trivial data, the authors collected a dataset of 20 online videos featuring diverse and challenging appearances, including heavy Halloween makeup, facial masks, and large accessories. For single-image inversion experiments, they utilized the first frame of each video.

Key Insights and Ideas

  • Decomposition in 3D, Not 2D: The core "aha!" moment is that the reconstruction-editability trade-off is fundamentally a latent space capacity issue. Moving the decomposition to the 3D volumetric level (radiance fields) bypasses this limitation entirely.
  • Entropy as a Spatial Knife: Without the binary entropy loss, the face model tries to absorb parts of the OOD textures to minimize reconstruction error, which corrupts subsequent edits. Forcing a stark boundary keeps the face latent code "clean."
  • Plug-and-Play Editing: Because the face remains isolated within the standard EG3D latent space, any existing StyleGAN-based editing framework (such as InterfaceGAN or StyleCLIP) can be applied out-of-the-box without modification.

Key Results

The proposed method demonstrates a clear quantitative and qualitative leap over previous state-of-the-art inversion techniques like PTI, GOAE, and HFGI3D.

  • Superior Reconstruction: On the image dataset, "In-N-Out" achieved an LPIPS score of 0.1106, vastly outperforming the next best optimization baseline, PTI, which scored 0.3192. It also led across PSNR, SSIM, and ID similarity metrics for both images and videos.
  • Identity Preservation: When applying dramatic semantic edits (e.g., turning a subject into "Elsa" or adding a smile), "In-N-Out" maintained significantly higher facial identity scores (via ArcFace evaluation) because the underlying face structure wasn't warped during inversion.
  • OOD Removal: Because the OOD elements are completely isolated, setting their blending weight to zero allows for seamless object removal (e.g., wiping away heavy face paint to reveal a clean, synthesized face underneath).
Figure 1. Semantic editing for out-of-distribution data. We present a method for reconstructing and editing an out-of-distribution (OOD) image or video using a pre-trained 3D-aware generative model (EG3D [10]). Our method explicitly models and reconstructs the occluders in 3D, allowing faithful reconstruction of the input while preserving the semantic editing capability. Here we showcase the reconstruction and editing results “Less smile”, “Younger”, “Blond” [47], “Elsa”, “Surprised” [41]. Our method can also remove the OOD part. Data are from the Internet (Creative Commons).

Limitations and Future Work

Despite its strengths, the authors note several limitations:

  • Un-editable OOD Regions: The method cannot inherently edit the OOD object itself (e.g., changing the color or style of a user's glasses), as editing capabilities are tied strictly to the face prior.
  • Duplicate Object Artifacts: If a user attempts to add a semantic attribute that conflicts with an existing OOD object (like adding regular eyeglasses to someone already wearing OOD sunglasses), the model can produce duplicate object artifacts.
  • Extreme Poses & Motion: The system struggles with extreme side profiles and can introduce floating artifacts if the OOD object moves independently and rapidly relative to the face.
  • Temporal Consistency: While applicable to video, slight frame-to-frame flickering remains an issue that could be mitigated in the future by incorporating explicit temporal smoothing constraints.

Summary updated

BibTeX
@inproceedings{xu2024n,
  author = {Yiran Xu and Zhixin Shu and Cameron Smith and Seoung Wug Oh and Jia-Bin Huang},
  title = {{In-N-Out: Faithful 3D GAN Inversion with Volumetric Decomposition for Face Editing}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  doi = {10.1109/cvpr52733.2024.00690},
}
Figure