Abstract
We introduce a user-friendly method for controllable image editing, where users simply draw an imprecise mask on the reference image to adaptively transfer its stylistic elements to the target image. Our approach, Adaptive Paste-GAN, is an optimization-based method that relies on intermediate feature maps of GANs for supervision. The method consists of two stages: ROI detection and local editing. In the ROI detection stage, deformable feature matching identifies the optimal editing region within the StyleGAN feature maps. In the editing stage, the latent code is optimized to align the target image's ROI features with those of the reference, while applying regularization to minimize changes outside the ROI. Experimental results demonstrate the precision of ROI detection and show that our method effectively balances locality and global consistency during optimization, and aligns well with user intent across various image categories.
Introduction
Traditional local image editing often requires meticulous, pixel-perfect masking on both source and target images to prevent artifacts. Furthermore, existing methods frequently lack semantic awareness, failing to adapt the transferred style to the target's underlying geometry. We propose Adaptive Paste-GAN, a framework designed to satisfy five core properties: convenience, flexibility, semantic awareness, locality, and generality. By utilizing StyleGAN's internal feature maps, our method allows for high-quality local edits with minimal user effort.
Methodology
The Adaptive Paste-GAN framework operates in two distinct stages: Region of Interest (ROI) detection and local semantically-aware editing.
Region of Interest (ROI) Detection
To eliminate the need for manual alignment, we employ Deformable Feature Matching. High-level features are extracted from the user-defined mask on the reference image and used as a convolutional kernel. This kernel is applied across the target image's feature maps, optimizing for scale and rotation to identify the region with the highest semantic correspondence.
Local Semantically-Aware Editing
Following ROI identification, the model performs optimization within StyleGAN’s $W+$ latent space. The objective is to adjust the target image's latent code such that its features within the ROI align with those of the reference. To maintain global consistency and preserve the target's original structure outside the ROI, we apply a regularization loss. Crucially, we optimize only the first six layers of the latent code $w$, which govern structural and semantic attributes, leaving the appearance-focused later layers intact.
Experimental Evaluation
We evaluated our method using pre-trained StyleGAN2 models across several high-resolution datasets, including FFHQ (human faces), LSUN Car, and AFHQCat. We also tested the system's generality on diverse animal datasets (Lion, Dog, and Elephant) at resolutions up to 1024x1024.
Key Results
Quantitative analysis of 1,000 image pairs revealed high precision in ROI detection, with an average landmark distance error of less than 2.05%. Qualitatively, Adaptive Paste-GAN outperformed baselines such as Feature Blend by producing edits that integrate naturally with the target image's geometry without "sticker-like" artifacts. The method also demonstrated robust attribute decoupling, such as modifying eye features while simultaneously removing glasses if they were absent in the reference.
Despite being an optimization-based approach, the streamlined architecture allows for interactive speeds, with ROI detection taking approximately 15 seconds and editing completing in 3 to 30 seconds on a modern GPU (RTX 4090).
Discussion and Limitations
By supervising edits via intermediate GAN feature maps rather than raw pixels, Adaptive Paste-GAN achieves a high degree of semantic adaptation. The method is zero-shot and generalizable across categories without task-specific training. However, it remains sensitive to extreme pose discrepancies between reference and target images. Additionally, the output quality is inherently bounded by the representational capacity of the underlying StyleGAN model. Future work will explore extensions to 3D GANs to improve handling of complex spatial transformations and cross-pose editing.
Summary updated