Inst-Inpaint: Instructing to Remove Objects with Diffusion Models

Ahmet Burak Yildirim, Vedat Baday, Erkut Erdem, Aykut Erdem, Aysegul DundararXiv 2023 · DOI

Abstract

Traditional image inpainting requires manual binary masks to specify regions for removal, a process that is often tedious and error-prone. We present Inst-Inpaint, a framework that enables object removal through natural language instructions (e.g., "remove the red car"). By training on a massive new dataset, GQA-Inpaint, our model learns to simultaneously localize target objects and reconstruct backgrounds using Latent Diffusion Models (LDMs). Experimental results demonstrate that Inst-Inpaint significantly outperforms existing text-to-image editing baselines in both photorealism and removal accuracy.

Introduction

Image inpainting—the task of filling in missing or removed parts of an image—is a fundamental tool in photo editing. However, the reliance on user-provided masks limits its accessibility. While recent text-to-image models have revolutionized image generation, they often struggle with precise object removal, frequently adding or altering elements instead of cleanly erasing them. Inst-Inpaint addresses this by providing a "mask-free" interface where users specify deletions via text.

Figure 1: Examples of object removal using natural language instructions across diverse scenes.

The Inst-Inpaint Framework

Inst-Inpaint is built upon Latent Diffusion Models (LDM). Unlike standard inpainting models, it operates directly on text prompts without explicit masks. The process involves three key stages:

  1. Latent Encoding: The source image is compressed into a lower-dimensional latent space using a pre-trained Variational Autoencoder (VAE).
  2. Conditioning: The model is conditioned on the source image and the text instruction, which is processed via a Transformer and integrated through cross-attention layers.
  3. Implicit Localization: Through the cross-attention mechanism, the model learns to "attend" to the specific pixels described in the text, modifying only the relevant regions to generate a target latent where the object is removed.

The GQA-Inpaint Dataset

To facilitate training, we introduced GQA-Inpaint, a large-scale dataset of 147,165 unique images and over 41,000 removal instructions. We leveraged the GQA dataset's scene graphs to identify objects and used an automated pipeline involving instance segmentation (Detectron2 and Detic) and traditional inpainting (CR-Fill) to generate ground-truth "after" images.

A key innovation was the "bidirectional" filter, ensuring that only semantically plausible removals (e.g., removing a person from a background, not the background from a person) were included in the training set. This ensures the model learns physically and semantically realistic scene transformations.

Experimental Results

Inst-Inpaint was evaluated against baselines like InstructPix2Pix and X-Decoder. Quantitatively, it achieved a superior Frechet Inception Distance (FID) of 5.679 on the GQA-Inpaint benchmark, indicating high photorealism. In terms of removal accuracy—measured by a novel CLIP-based metric that checks for the absence of the target object—Inst-Inpaint reached 77.4%, more than doubling the performance of InstructPix2Pix (33.5%).

Figure 2: Qualitative result showing the successful removal of a complex, colorful train while maintaining background consistency.

Qualitatively, Inst-Inpaint produces cleaner backgrounds with fewer artifacts or "ghosting" effects compared to existing methods. The model successfully handles complex textures and varied object scales, blending the reconstructed regions seamlessly with the surrounding environment.

Conclusion

Inst-Inpaint demonstrates the power of diffusion models to perform complex, instruction-based image editing without manual masking. While limited by the reconstruction fidelity of the underlying VAE and the complexity of certain textures, the model sets a new standard for intuitive object removal. The release of the GQA-Inpaint dataset aims to further catalyze research in instructional image manipulation.

Summary updated

BibTeX
@misc{yildirim2023inst,
  author = {Ahmet Burak Yildirim and Vedat Baday and Erkut Erdem and Aykut Erdem and Aysegul Dundar},
  title = {{Inst-Inpaint: Instructing to Remove Objects with Diffusion Models}},
  year = {2023},
  eprint = {2304.03246},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.03246},
}
Figure