ObjectStitch: Generative Object Compositing

Yizhi Song, Zhifei Zhang, Zhe Lin, Scott Cohen, Brian L. Price, Jianming Zhang, Soo Ye Kim, Daniel G. AliagaarXiv 2022 · DOI

Introduction

Image compositing—the process of inserting an object from one image into another—is a fundamental task in photo editing. However, achieving a realistic result is notoriously difficult. A seamless composite requires four distinct types of harmonization: color/lighting, geometry, shadows, and viewpoint. Traditional methods often treat these as separate sub-tasks, frequently resulting in an "uncanny valley" effect where the inserted object looks like a flat, poorly lit sticker.

ObjectStitch introduces a self-supervised framework that leverages conditional diffusion models to perform "all-in-one" object compositing. By automatically adjusting an object's viewpoint, color, and shadows to fit a new scene while preserving its unique identity, ObjectStitch moves beyond the limitations of traditional pipelines without requiring manually labeled training data.

Methodology

The Content Adaptor

While pretrained diffusion models like Stable Diffusion are powerful, they are typically guided by text prompts. Words are often too imprecise to describe the specific texture and shape of a unique object. To solve this, ObjectStitch introduces a Content Adaptor. This module acts as a bridge, taking visual features from a reference object (extracted via a ViT/CLIP image encoder) and translating them into a sequence of visual tokens. This allows the diffusion model to be guided by the actual image of the object rather than a generic text description.

Overview of the ObjectStitch pipeline, showing how the input subject is processed through a content adaptor to guide the diffusion process.

Unified Generative Architecture

The framework utilizes a pretrained text-to-image diffusion model but modifies the cross-attention layers to accept the adaptive embeddings from the Content Adaptor. The generator is fine-tuned to preserve the background perfectly while only "denoising" the area inside a user-provided bounding box. This ensures that the object is integrated into the scene while the rest of the environment remains untouched.

Self-Supervised Training via Perturbation

Training deep learning models for compositing usually requires massive datasets of "before and after" pairs, which are expensive to create. ObjectStitch bypasses this by using a synthetic training pipeline. The researchers take a single real image, extract an object, and intentionally apply random rotations, perspective warps, and color shifts. The model is then tasked with reconstructing the original image within a specific bounding box. By learning to "undo" these perturbations, the model naturally learns how to harmonize geometry and color.

Experimental Results

The authors evaluated ObjectStitch against several baselines, including standard copy-paste and other diffusion-based editing methods like SDEdit.

Qualitative comparison between simple copy-paste, traditional compositing, and ObjectStitch, demonstrating superior lighting and geometric alignment.

Key Findings

  • User Preference: In side-by-side comparisons, users preferred ObjectStitch's results for realism over 55% of the time compared to other state-of-the-art diffusion baselines, and over 85% of the time compared to simple copy-paste.
  • Quantitative Metrics: ObjectStitch achieved the lowest Frechet Inception Distance (FID) scores, indicating its generated images are statistically the most similar to real photos. It also scored highest on CLIP image scores, proving it preserves the reference object's appearance better than competitors.
  • Geometric Hallucination: Unlike previous work focused solely on color, ObjectStitch demonstrates the ability to "hallucinate" new viewpoints of an object to ensure it sits correctly within the perspective of the background.

Limitations and Future Work

Despite its success, ObjectStitch faces some challenges. Very fine-grained details or specific text on an object can sometimes be slightly altered during the diffusion process. Additionally, because the model primarily operates within a bounding box, it can struggle to generate "global" effects like very long shadows or reflections that extend far beyond the immediate area of the object. Future research may involve training the visual encoder jointly with the rest of the framework to further improve the fidelity of the synthesized objects.

Summary updated

BibTeX
@misc{song2022objectstitch,
  author = {Yizhi Song and Zhifei Zhang and Zhe Lin and Scott Cohen and Brian L. Price and Jianming Zhang and Soo Ye Kim and Daniel G. Aliaga},
  title = {{ObjectStitch: Generative Object Compositing}},
  year = {2022},
  eprint = {2212.00932},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.00932},
}
Figure