Outline-Guided Object Inpainting with Diffusion Models

Markus Pobitzer, Filip Janicki, Mattia Rigotti, Cristiano MalossiarXiv 2024 · DOI

Introduction

Training high-performance instance segmentation models requires vast amounts of pixel-level annotations. Creating these masks is significantly more labor-intensive and costly than standard image classification labels. While generative models like Stable Diffusion offer a potential solution for data augmentation, a major hurdle remains: maintaining strict correspondence between the generated object and the pre-defined ground-truth mask. If the generated object deviates from the mask boundaries, the synthetic data becomes detrimental to training.

Researchers from ETH Zürich and IBM Research have introduced a training-free pipeline that addresses this "mask-object correspondence" problem. By using morphological erosion to create object outlines, they guide diffusion models to generate realistic variations that remain perfectly aligned with original labels.

Methodology

The core of the approach is a three-step pipeline that leverages pre-trained Latent Diffusion Models (LDMs) without requiring additional fine-tuning or specialized adapters like ControlNet.

The proposed pipeline: from original image and mask to multiple synthetic variations guided by an eroded mask outline.
  1. Morphological Erosion: Starting with an image and its corresponding mask, the mask is "eroded"—shrunk from the interior. This leaves a thin "outline" of the original object’s pixels.
  2. Outline-Guided Inpainting: The area inside the eroded mask is treated as a hole to be filled. A standard Stable Diffusion inpainting model is used to fill this region. The remaining outline acts as a critical visual anchor, providing structural, color, and textural context.
  3. Class Conditioning: The model is prompted with the object's class (e.g., "Photo of a bus"). The diffusion model naturally "completes" the object based on the partial edges provided by the outline, ensuring the new generation fits the original mask boundaries.

This "training-free" nature makes the method highly accessible and compatible with other standard augmentations like resizing or color shifting.

Experimental Results

The method was evaluated on the COCO (Common Objects in Context) dataset, specifically focusing on "few-shot" instance segmentation (COCO-20i).

Performance Gains

In 5-shot scenarios, augmenting the training set with synthetic variations generated by this method improved the mean Average Precision (mAP) by up to +0.406. This demonstrates that the generated data is not only visually plausible but also technically accurate enough to improve model robustness.

Visual Quality and Alignment

The researchers used Fréchet Inception Distance (FID) and CLIP scores to evaluate the quality of the synthetic images. Their method achieved a significantly better FID score of 4.38 compared to standard inpainting techniques (like GLIDE), indicating that the generated objects are much closer to the distribution of real-world images.

Key Insights

  • Structural Guidance: The most significant finding is that partial outlines provide a much more reliable signal for spatial tasks than text prompts alone. The diffusion model excels at "continuing" an object when given a structural starting point.
  • The Erosion Balance: The size of the erosion kernel is a critical hyperparameter. Excessive erosion removes the guiding outline, leading to "hallucinations" that ignore the mask, while insufficient erosion results in variations that are too similar to the original object.

Limitations

Despite its effectiveness, the method faces challenges with very small objects, where erosion might remove the guidance entirely. It also struggles with high-fidelity details like specific text or complex mechanical parts. Furthermore, the underlying diffusion models exhibit orientation biases; for instance, if a mask is flipped upside down, the model may still attempt to generate the object in its "natural" upright orientation.

Conclusion

Outline-guided inpainting represents a significant step forward in synthetic data generation for computer vision. By bypassing the need for expensive manual labeling or complex model training, this method provides a scalable way to "supercharge" existing datasets, particularly in data-scarce, few-shot learning environments.

Summary updated

BibTeX
@misc{pobitzer2024outline,
  author = {Markus Pobitzer and Filip Janicki and Mattia Rigotti and Cristiano Malossi},
  title = {{Outline-Guided Object Inpainting with Diffusion Models}},
  year = {2024},
  eprint = {2402.16421},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.16421},
}
Figure