Real Image Inversion via Segments

David Futschik, Michal Lukác, Eli Shechtman, Daniel SýkoraarXiv 2021

Abstract

In this short report, we present a simple, yet effective approach to editing real images via generative adversarial networks (GAN). Unlike previous techniques, that treat all editing tasks as an operation that affects pixel values in the entire image, in our approach we cut up the image into a set of smaller segments. For those segments corresponding latent codes of a generative network can be estimated with greater accuracy due to the lower number of constraints. When codes are altered by the user the content in the image is manipulated locally while the rest of it remains unaffected. Thanks to this property the final edited image better retains the original structures and thus helps to preserve natural look.

Introduction

Generative Adversarial Networks (GANs), such as StyleGAN, have established a high standard for image synthesis. However, editing real photographs requires "inverting" the image into the GAN's latent space. This process often encounters a significant trade-off: global inversion methods that attempt to represent an entire face with a single latent code frequently struggle to maintain the subject's unique identity or result in an entangled latent space where localized edits cause global distortions. This paper introduces a "divide and conquer" approach to overcome these limitations by performing inversion on individual semantic segments.

Methodology

Segmentation and Subdivision

The core innovation of this work is the subdivision of the input image into semantic segments. By treating features like the eyes, nose, and mouth as independent regions, the system can perform GAN inversion on each part separately.

Semantic segmentation mask used to subdivide the face into independent regions.

Local Projection and Composition

Each segment is projected into the latent space independently. Because a single segment (e.g., an eye) contains fewer pixels and constraints than a full face, the GAN can find a latent code that matches the original structure with significantly higher fidelity than global methods.

Example of a localized segment (eye region) being processed independently to ensure high-fidelity inversion and localized editing.

To integrate these segments back into a cohesive image, the authors utilize Poisson image stitching to blend gradients at the boundaries. Additionally, a Level Set method is employed for automatic mask refinement, allowing the segment boundaries to adapt when new features—such as glasses—are introduced, thereby minimizing visual artifacts.

Key Insights and Results

Identity Preservation and Disentanglement

By reducing the number of constraints per latent code, the segmented approach achieves superior identity preservation compared to traditional global $W$ or $W+$ projections. Furthermore, this method provides "hard" disentanglement; since edits are physically restricted to their respective segments, changing a smile or hair color does not inadvertently affect other facial features.

Cross-Domain Robustness

Interestingly, the local approach allows GANs trained on human faces to effectively edit out-of-domain images, such as classical paintings (e.g., the Mona Lisa). The GAN can successfully handle local textures (like a painted eye) because they are sufficiently similar to real-world features at a small scale, even if the global artistic style differs from the training data.

Conclusion and Limitations

Real Image Inversion via Segments provides a robust framework for high-fidelity, localized image editing. While the method excels at preserving identity and preventing feature entanglement, it does involve higher computational overhead due to the need for multiple inversions. Future work may focus on fully automating the segmentation process and optimizing the sequential editing of segments to prevent structural inconsistencies during dramatic transformations.

Summary updated

BibTeX
@misc{futschik2021real,
  author = {David Futschik and Michal Lukác and Eli Shechtman and Daniel Sýkora},
  title = {{Real Image Inversion via Segments}},
  year = {2021},
  eprint = {2110.06269},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2110.06269},
}
Figure