Abstract
Recent advancements in diffusion models have revolutionized text-to-image generation and editing. However, text prompts often lack the precision required to describe specific visual attributes. This paper presents "Paint by Example," a framework designed for exemplar-guided image editing. By leveraging a semantic information bottleneck and strong data augmentation, the model learns to realistically blend reference objects into target scenes, overcoming the "copy-paste" artifacts prevalent in previous methods.
Introduction
While language-guided image editing has achieved significant success, natural language remains inherently ambiguous. Describing the exact texture, pattern, or geometry of a specific object—such as a unique piece of furniture or a specific pet—is often impossible with words alone. Exemplar-guided editing, which uses a reference image to guide the modification, offers a more precise alternative.
The primary challenge in training such models is the lack of large-scale datasets containing "source image, reference image, and edited result" triplets. Furthermore, naive training often leads to a "copy-paste" solution where the model simply replicates pixels from the reference into the target without adjusting for lighting, perspective, or pose.
Methodology
To address the data scarcity, the authors employ a self-supervised training strategy. A single image is transformed into a training triplet by masking an object and using that same object as the exemplar to reconstruct the original scene. To prevent the model from learning a trivial identity mapping, three key innovations are introduced:
- Information Bottleneck: Instead of providing the diffusion model with full spatial features of the exemplar, the system utilizes only the CLIP class token. This compresses the $224 \times 224$ reference image into a 1024-dimensional vector, forcing the model to rely on high-level semantic information rather than low-level pixel data.
- Strong Augmentation: Aggressive transformations, including rotation, blurring, and elastic transforms, are applied to the exemplar during training. This breaks pixel-level correspondence, requiring the model to "re-generate" the object to fit the target context.
- Irregular Masking: The model is trained with arbitrary, randomly generated mask shapes to simulate real-world user inputs.
The architecture is built upon Stable Diffusion, fine-tuned to integrate the exemplar's semantic embedding via cross-attention layers.
Experimental Results
The model was evaluated on the newly introduced COCO Exemplar-based image Editing (COCOEE) benchmark, consisting of 3,500 manually curated source-reference pairs.
Quantitative Performance
"Paint by Example" outperformed baselines such as Blended Diffusion and text-based Stable Diffusion across multiple metrics. It achieved the lowest Fréchet Inception Distance (FID), indicating superior realism, and the highest CLIP Score, demonstrating strong semantic alignment with the reference images.
Qualitative Analysis
As shown in the results below, the model excels at semantic composition. It does not merely paste the reference; it adjusts the object's pose and lighting to match the environment. For instance, it can realistically place a tiger inside a bucket or a hot air balloon over a beach, generating appropriate shadows and reflections that previous methods failed to produce.
Discussion and Limitations
The success of "Paint by Example" highlights that restricting information through a semantic bottleneck is crucial for high-quality generative editing. By focusing on semantics rather than pixels, the model achieves "semantic harmonization" rather than simple color matching.
However, limitations remain. The model's performance is tied to its training distribution; it struggles with non-photorealistic styles (e.g., oil paintings) and rare object categories not well-represented in the OpenImages dataset. Future work will focus on expanding style diversity and improving fine-grained control over object orientation.
Summary updated