Abstract
Image editing has advanced significantly with the introduction of text-conditioned diffusion models. Despite this progress, seamlessly adding objects to images based on textual instructions without requiring user-provided input masks remains a challenge. We address this by leveraging the insight that removing objects (Inpaint) is significantly simpler than its inverse process of adding them (Paint), attributed to inpainting models that benefit from segmentation mask guidance. Capitalizing on this realization, by implementing an automated and extensive pipeline, we curate a filtered large-scale image dataset containing pairs of images and their corresponding object-removed versions. Using these pairs, we train a diffusion model to inverse the inpainting process, effectively adding objects into images. Unlike other editing datasets, ours features natural target images instead of synthetic ones while ensuring source-target consistency by construction. Additionally, we utilize a large Vision-Language Model to provide detailed descriptions of the removed objects and a Large Language Model to convert these descriptions into diverse, natural-language instructions. Our quantitative and qualitative results show that the trained model surpasses existing models in both object addition and general editing tasks.
Introduction
The ability to add specific objects to an image using only natural language instructions—such as "Add a black cat on the sofa"—represents a significant milestone in intuitive image editing. While text-to-image diffusion models have made great strides, "mask-free" object addition remains a formidable challenge. Unlike object removal, which benefits from clear boundaries provided by a mask, adding an object requires a model to autonomously determine the correct scale, perspective, lighting, and style, all while maintaining the integrity of the original background.
Current state-of-the-art methods, such as InstructPix2Pix (IP2P), often rely on synthetic training data. This can lead to a "compounding error" effect, where the lack of realism or visual consistency in training pairs limits the model's performance on real-world images. Other approaches require manual masking, which is cumbersome for users.
Methodology: The PIPE Dataset
The core innovation of this work is the Paint by Inpaint framework, which treats object addition as the inverse of object removal. The authors developed an automated pipeline to create the PIPE (Paint by InPaint Editing) dataset, consisting of approximately 1 million "before and after" image pairs.
The "Reverse" Trick
The pipeline starts with real images from high-quality segmentation datasets like COCO, Open Images, and LVIS. Using a high-end inpainting model, objects are removed from these images. The key insight is to then flip these pairs: the inpainted (empty) image becomes the source, and the original real image becomes the target. This ensures that the ground truth for the addition task is always a real, high-quality photograph.
Quality Control and Instructions
To ensure the dataset's quality, a "CLIP consensus" filtering mechanism was employed. The inpainting process was run multiple times; if the results showed high variance, indicating a failed removal or visible artifacts, the pair was discarded. Furthermore, to move beyond simple labels, the authors utilized a Vision-Language Model (CogVLM) to generate detailed descriptions of the removed objects and a Large Language Model (Mistral-7B) to convert these descriptions into natural, diverse instructions.
Results and Evaluation
The resulting model, fine-tuned on Stable Diffusion 1.5, was evaluated against several benchmarks, including MagicBrush, OPA, and EditBench.
Quantitative Performance
On the MagicBrush benchmark, Paint by Inpaint achieved a CLIP-I score of 0.900 and a DINO score of 0.852, significantly outperforming InstructPix2Pix (0.860 and 0.766, respectively). These metrics highlight the model's superior ability to follow instructions while maintaining image fidelity.
Qualitative and Human Evaluation
Qualitatively, the model demonstrates exceptional background consistency. While competing models often inadvertently alter the texture or color of the surrounding environment when adding an object, Paint by Inpaint keeps the background identical to the source. In a blind human evaluation study, participants preferred the results of Paint by Inpaint 72.6% of the time over IP2P.
Conclusion
Paint by Inpaint introduces a powerful paradigm for training image editing models by leveraging the relative ease of the inverse task (inpainting). By creating a massive dataset of real-to-inpainted pairs, the authors have addressed the critical issue of background consistency in mask-free object addition. Future work may extend this "reverse-task" strategy to other editing domains, such as texture modification or relighting, potentially revolutionizing how we train general-purpose image editors.
Summary updated