Warping the Residuals for Image Editing with StyleGAN

Ahmet Burak Yildirim, Hamza Pehlivan, Aysegul Dundar

TL;DR

WarpRes introduces a novel GAN inversion pipeline that bridges the gap between high-fidelity image reconstruction and high-quality editing. By extracting high-rate residual features to capture fine details and dynamically warping them using an efficient, feature-level flow estimation module, it enables dramatic image edits (like large pose changes) without ghosting or losing identity.

What Problem Does This Paper Address?

GAN inversion—the process of mapping a real image into the latent space of a pretrained Generative Adversarial Network like StyleGAN—is a prerequisite for real-world image editing. However, existing methods suffer from a fundamental trade-off between reconstruction fidelity and editability.

Low-rate latent spaces (like StyleGAN's $W^+$ space) are highly editable but compress the image too much, losing fine details like wrinkles, earrings, or specific hair textures due to an information bottleneck. Conversely, higher-rate latent spaces can pass all these fine details to the generator for a perfect reconstruction, but they fail during editing. Because these detailed features are spatially fixed, applying an edit like a head rotation causes "ghosting" artifacts where the fine details remain anchored to their original positions instead of moving with the face. The authors tackle the challenge of making these high-rate detail features flexibly adapt and move alongside complex image transformations.

Methods

The authors propose WarpRes, a single-stage, feed-forward architecture that builds upon existing StyleGAN inversion networks.

  1. Residual Feature Extraction: A base encoder ($E_0$, such as e4e or pSp) maps the input image to a low-rate $W^+$ code. A secondary encoder ($E_1$) compares the input image features with the StyleGAN-generated mid-level features to extract high-rate residual features ($F_a$) containing the missing fine details.
  2. Feature-Level Flow Prediction: When an edit is applied to the $W^+$ code, WarpRes estimates the spatial transformation by feeding the intermediate StyleGAN features of both the original and edited codes into a lightweight Flow Prediction Network. Crucially, to remain computationally efficient, this network operates directly on intermediate feature maps (at 16x16, 32x32, and 64x64 resolutions) rather than rendering full RGB images.
  3. Warping and Refining: The predicted flow field is used to spatially warp the high-rate residual features ($F_a$), aligning the fine details with the newly edited pose or expression. A final encoder ($E_2$) refines these warped features before adding them back into the StyleGAN generator pipeline.

During training, the flow prediction network is guided by an unsupervised, pretrained flow estimation network acting as pseudo-ground truth, alongside cycle-consistency, adversarial, and reconstruction losses.

WarpRes Architecture

Datasets

  • FFHQ / CelebA-HQ: The face models are trained on the Flickr-Faces-HQ (FFHQ) dataset and evaluated on the CelebA-HQ dataset for facial attribute editing (e.g., smile, pose, age).
  • Stanford Cars: Used to evaluate the framework on an object domain, testing edits like viewpoint changes, color modifications, and background grass addition.

Key Insights and Ideas

  • Feature-Space Flow is Sufficient: Instead of rendering full RGB images to compute optical flow—which is computationally expensive—WarpRes demonstrates that StyleGAN's internal mid-level feature maps contain rich enough structural information to predict accurate dense flows.
  • Explicit Warping Beats Implicit Convolutions: Prior methods (like StyleRes) tried to use standard convolutional layers to implicitly adapt residuals to edits, which failed for large spatial transformations. Explicitly warping the features via a predicted flow field solves the ghosting problem for extreme edits like head rotations.
  • Plug-and-Play Compatibility: WarpRes is modular. It acts as a secondary stage that consistently boosts the performance of various popular base encoders, including pSp, e4e, and StyleTransformer.

Key Results

  • Quantitative Improvements: WarpRes achieves state-of-the-art results across both reconstruction and editing metrics. On CelebA-HQ face reconstruction, it achieves a Fréchet Inception Distance (FID) of 6.59 and an LPIPS of 0.08, significantly outperforming the base e4e encoder (FID 30.22).
  • Superior Identity Preservation: For challenging pose edits where identity easily degrades, WarpRes drastically improves the identity similarity (Id) score to 0.74, compared to 0.58 for StyleRes and 0.68 for HyperStyle.
  • Real-Time Efficiency: Despite adding a flow estimation module, WarpRes maintains an inference time of 0.1254 seconds per image on a single NVIDIA GeForce GTX 1080 Ti GPU, making it fully capable of interactive, real-time editing.
Qualitative comparison on CelebA-HQ

Limitations and Future Work

  • Lack of Strict 3D Consistency: Because WarpRes operates on a 2D StyleGAN backbone, it cannot guarantee strict multi-view consistency across a continuous sequence of camera rotations, unlike explicit 3D-aware GANs (such as EG3D).
  • Base Encoder Dependency: The quality of the editing latent space still relies heavily on the underlying base encoder ($E_0$). If the base encoder fails to find a clean, disentangled editing direction in the $W^+$ space, the final output quality may degrade.

Summary updated

BibTeX
@article{yildirim2025warping,
  author = {Ahmet Burak Yildirim and Hamza Pehlivan and Aysegul Dundar},
  title = {{Warping the Residuals for Image Editing with StyleGAN}},
  journal = {Int. J. Comput. Vis.},
  year = {2025},
  url = {https://openreview.net/forum?id=ySCi5uYWY7},
}
Figure