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

Yongsheng Yu, Ziyun Zeng, Haitian Zheng, Jiebo Luo

TL;DR

OmniPaint is a novel framework that unifies object removal and insertion into a single, interdependent process, overcoming limitations of previous methods that treated them as separate tasks. It leverages a progressive training pipeline, including a new CycleFlow mechanism for unpaired data refinement, to achieve highly realistic edits and introduces a new evaluation metric (CFD) for better assessment of object removal quality.

What Problem Does This Paper Address?

Editing images to remove or insert objects realistically is a long-standing challenge. While diffusion models have made significant strides, they struggle with:

  • Interplay of Physical Effects: Accurately removing or inserting objects while preserving complex effects like shadows, reflections, and occlusions is difficult.
  • Data Scarcity: Training robust models requires large datasets of paired real-world examples (e.g., an image with an object and the same image without it), which are expensive and time-consuming to create.
  • Independent Task Handling: Existing methods often treat object removal and insertion as separate, disconnected problems, leading to inefficiencies and potential conflicts when trying to combine them.
  • Evaluation Difficulties: Quantitatively evaluating the quality of object removal, especially the absence of unwanted "ghost" elements or hallucinations, is challenging with existing metrics.

OmniPaint aims to address these issues by proposing a unified framework that treats removal and insertion as complementary tasks, enabling more efficient training and better results, particularly in challenging scenarios.

Methods

OmniPaint builds upon the FLUX diffusion model, enhancing it with several key innovations:

  • Unified Framework: Instead of separate models, OmniPaint treats object removal and insertion as interdependent processes within a single architecture. This allows for knowledge transfer and more efficient training.
  • Progressive Training Pipeline:
    • Inpainting Pretext Training: A foundational step to equip the model with basic inpainting capabilities using random masks.
  • Paired Warmup: Initial fine-tuning on a small dataset of paired real-world samples (3,000 images) to learn effect-aware removal and insertion.
  • CycleFlow Unpaired Post-Training: This is a crucial novelty. It leverages large-scale unpaired datasets (like COCO-Stuff) by introducing a "Remove-Insert" cycle. The model learns to remove an object and then re-insert it, ensuring consistency. This significantly reduces reliance on large paired datasets. The CycleFlow mechanism uses a trained removal model to strip away object effects (like shadows) before insertion, improving realism.
  • Masked Image Conditioning: The model uses the masked input image as a guide for denoising, helping to reconstruct the background accurately after removal or blend the inserted object.
  • Reference Object Conditioning: For insertion, the model conditions on both the masked image and a reference object image, ensuring the inserted object's identity and appearance are preserved.
  • Prompt-Free Adaptive Control: Instead of relying on text prompts, OmniPaint uses learnable task-specific parameters for removal and insertion, making it more robust to image-specific nuances.
  • Parameter-Efficient Fine-Tuning (PEFT): OmniPaint uses LoRA (Low-Rank Adaptation) to efficiently fine-tune the large FLUX model, making training more manageable.
  • Context-Aware Feature Deviation (CFD) Score: A novel, reference-free metric for evaluating object removal. It quantifies:
  • Hallucination Penalty: Detects unwanted object-like structures in the removed region.
  • Context Coherence: Assesses how well the inpainted region blends with the surrounding background.

Datasets

  • Training:
    • A custom dataset of 3,300 real-world paired samples captured across diverse environments.
  • Large-scale object segmentation datasets (COCO-Stuff, HQSeg) for unpaired training via CycleFlow.
  • Evaluation:
    • A test set of 300 real-world object removal cases.
  • The RORD dataset (1,000 paired samples).
  • A benchmark for object insertion consisting of 565 samples, combining the IMPRINT test set with real-world captured cases.

Key Insights and Ideas

  • Interdependence is Key: Treating object removal and insertion as intertwined processes, rather than isolated tasks, unlocks significant improvements in realism and efficiency.
  • CycleFlow for Data Efficiency: The CycleFlow mechanism is a clever way to leverage unpaired data by enforcing a "remove-then-reinsert" cycle, drastically reducing the need for expensive paired datasets.
  • De-emphasizing Text Prompts: For image-specific editing tasks like object removal/insertion, learnable task embeddings can be more effective and less ambiguous than text prompts.
  • A Better Metric Matters: The CFD score is a crucial contribution, providing a more nuanced and reliable way to evaluate object removal quality, especially concerning subtle hallucinations that other metrics miss.

Key Results

  • Object Removal: OmniPaint consistently outperforms state-of-the-art methods on various benchmarks, achieving the lowest FID, CMMD, LPIPS, and CFD scores while maintaining high PSNR and SSIM. It excels at removing complex effects like glass reflections and shadows, and in occlusion scenarios.
  • Object Insertion: OmniPaint achieves superior object identity preservation (measured by CLIP-I, DINOv2, CUTE, DreamSim) and overall image quality (MUSIQ, MANIQA) compared to existing methods.
  • Qualitative Improvements: Visual comparisons show OmniPaint producing more natural, seamlessly integrated objects and cleaner removals with fewer artifacts than baselines.

Limitations and Future Work

  • Hyperparameter Sensitivity: The paper notes that the cycle loss weight ($\gamma$) in CycleFlow needs careful tuning. Too low a value leads to weak physical effect synthesis, while too high a value can cause unnatural artifacts.
  • Inference Steps: While OmniPaint performs well even with few inference steps (NFE), optimal visual quality is achieved with more steps (NFE=28).
  • Future Work: The authors suggest that their framework effectively suppresses object hallucination and mitigates artifacts, and the CFD metric provides a robust assessment. Further exploration of the interplay between removal and insertion, and potentially extending to more complex editing tasks, would be natural next steps.

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