OmniPaint: Mastering Object-Oriented Editing via Disentangled Insertion-Removal Inpainting

Yongsheng Yu, Ziyun Zeng, Haitian Zheng, Jiebo Luo

TL;DR

OmniPaint is a unified image-editing framework that treats object removal and insertion as interdependent, complementary tasks rather than isolated problems. By leveraging a progressive training pipeline called CycleFlow, it learns to generate realistic physical effects (like shadows and reflections) using mostly unpaired data. Additionally, the authors introduce a novel, reference-free metric called CFD to accurately detect and penalize random object hallucinations during removal.

What Problem Does This Paper Address?

While diffusion models excel at generating images from text, applying them to precise, object-oriented editing—specifically removing or inserting objects—remains challenging.

Current approaches suffer from two main bottlenecks:

  1. The Paired Data Scarcity: To teach a model how to realistically insert an object (including its complex physical interactions like shadows, reflections, and occlusions), you ideally need pairs of identical scenes with and without the object. Collecting this data in the real world is incredibly difficult.
  2. Object Hallucination: When told to remove an object, large generative models often "hallucinate" new, unwanted objects in the erased region instead of cleanly reconstructing the background. Worse yet, standard evaluation metrics often fail to catch these realistic-looking but incorrect additions.

Methods

OmniPaint builds on the FLUX-1.dev flow-matching architecture. Instead of using text prompts, which can introduce ambiguity, it employs Prompt-Free Adaptive Control—using learnable task-specific vectors to switch between removal and insertion modes. The core technical innovations lie in its training pipeline and evaluation metric:

The Three-Phase Training Pipeline

  • Phase 1: Inpainting Pretext Training: The model learns basic image completion on the large-scale LAION dataset using random masks.
  • Phase 2: Paired Warmup: The model is fine-tuned on a small dataset of 3,000 high-quality, real-world paired samples to teach it basic shadow and reflection handling.
  • Phase 3: CycleFlow Unpaired Post-Training: To scale up without expensive paired data, OmniPaint uses a "Remove-Insert" cycle consistency mechanism on massive, unpaired segmentation datasets.
Illustration of the CycleFlow mechanism

As shown in Figure 4, the well-trained removal parameters ($\phi$) act as a preprocessing step to strip objects and their physical effects from the scene. The insertion model ($\theta$) is then forced to re-insert the object and reconstruct the original image, effectively learning how to synthesize realistic shadows and reflections from scratch.

Context-Aware Feature Deviation (CFD) Score

To solve the evaluation problem, the authors developed CFD, a reference-free metric for object removal.

The proposed CFD metric workflow

As illustrated in Figure 3, CFD uses the Segment Anything Model (SAM) to isolate the edited region. It computes a hallucination penalty by checking if new, isolated ("nested") object structures have emerged, and a context coherence term (via DINOv2 features) to ensure the filled area seamlessly blends into the surrounding background.

Datasets

The model utilizes a mix of standard and custom datasets:

  • Custom Paired Dataset: 3,300 meticulously annotated real-world triplets $\langle I, I_{removed}, M \rangle$ capturing diverse indoor/outdoor environments with complex lighting, reflections, and occlusions.
  • Unpaired Segmentation Datasets: COCO-Stuff and HQSeg are used during the CycleFlow phase to provide large-scale foreground object masks.
  • Evaluation Benchmarks: Evaluated on the authors' 300-sample removal test set, the RORD (Real-world Object Removal Dataset), and the IMPRINT test set for object insertion.

Key Insights and Ideas

  • Inversion as a Regularizer: Because object removal and insertion are mathematically inverse problems, they can regularize each other. Using a frozen removal model to guide the insertion model's training allows the framework to exploit massive, cheap segmentation datasets that completely lack shadow or reflection annotations.
  • Rethinking "Realism" in Erasing: Traditional metrics like FID or ReMOVE can be fooled by a model that replaces a deleted car with a highly realistic-looking bush or box. CFD explicitly penalizes the generation of any new object-like boundaries within the mask, forcing the model to prioritize true background reconstruction.

Key Results

OmniPaint achieves state-of-the-art performance across both editing tasks:

Object Removal

OmniPaint significantly outperforms existing tools like LaMa, PowerPaint, and FreeCompose. On the RORD dataset, it achieved an FID of 19.17 (compared to FreeCompose's 46.37 and PowerPaint's 42.65) and scored the lowest on the new CFD metric, proving it effectively suppresses hallucinations.

Qualitative comparison of object removal

As seen in Figure 6, OmniPaint cleanly handles complex scenarios like removing objects behind glass reflections and erasing harsh shadows under natural lighting.

Object Insertion

For insertion, OmniPaint leads across all object identity preservation metrics (CLIP-I, DINOv2, CUTE, DreamSim) and overall image quality metrics (MUSIQ, MANIQA), demonstrating superior geometric alignment and texture preservation.

Qualitative comparison of object insertion

Limitations and Future Work

  • Hyperparameter Sensitivity: The cycle loss weight ($\gamma$) requires careful tuning. Setting it too high ($\gamma = 3.0$) over-relaxes effect generation, which can lead to unnatural artifacts like exaggerated or muddy shadows.
  • Inference Speed: Achieving optimal visual quality requires around 28 Neural Function Evaluations (NFE). While NFE=1 can cleanly remove an object structure, lower step counts result in noticeable blurring in the edited zones. Future work may focus on accelerating this pipeline using distillation techniques.

Summary updated

BibTeX
@inproceedings{yu2025omnipaint,
  author = {Yongsheng Yu and Ziyun Zeng and Haitian Zheng and Jiebo Luo},
  title = {{OmniPaint: Mastering Object-Oriented Editing via Disentangled Insertion-Removal Inpainting}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2025},
  url = {https://openreview.net/forum?id=kPKCTNhOcx},
}
Figure