MosaicFusion: Diffusion Models as Data Augmenters for Large Vocabulary Instance Segmentation

Jiahao Xie, Wei Li, Xiangtai Li, Ziwei Liu, Yew Soon Ong, Chen Change Loy

TL;DR

MosaicFusion is a training-free data augmentation pipeline that leverages off-the-shelf text-to-image diffusion models to generate synthetic training data—both images and pixel-perfect masks—for instance segmentation. By cleverly partitioning the diffusion process to create multi-object scenes and mining internal cross-attention maps for mask generation, it significantly boosts model performance on rare and novel object categories without requiring any manual labeling.

What Problem Does This Paper Address?

Instance segmentation—the task of identifying and masking every individual object in an image—is notoriously "data-hungry." Manually labeling these datasets is incredibly laborious, requiring annotators to trace precise boundaries for every object.

This creates a massive bottleneck for "large vocabulary" scenarios, where a model needs to recognize hundreds or thousands of different categories. In the real world, data follows a "long-tail" distribution: a few categories are common, but most are rare. Furthermore, "open-vocabulary" tasks require models to detect novel objects never seen during training. Standard augmentation techniques like "Copy-Paste" (recycling existing masks onto new backgrounds) are limited because they can't create truly new instances or increase category diversity. MosaicFusion aims to solve this by using generative AI to "hallucinate" new, labeled training data on demand.

Methods

MosaicFusion is a training-free approach that uses a pre-trained Stable Diffusion model as a data engine. The pipeline consists of two main stages:

  1. Image Generation (Mosaic Canvas): Instead of generating one object per image, the authors divide the image canvas into a "mosaic" (typically four regions). They run the diffusion process on all regions simultaneously using a shared noise prediction model, but each region is conditioned on a different text prompt (e.g., "a photo of a single seaplane"). This allows for the efficient generation of complex, multi-object scenes. They also include a slight overlap between regions to ensure smooth transitions and a "harmonization" effect across the whole image.
  2. Mask Generation (Attention Aggregation): The most novel part of the method is how it extracts masks without extra models. During the diffusion process, the U-Net backbone uses "cross-attention" layers to relate text tokens (like "seaplane") to specific pixels. MosaicFusion aggregates these attention maps across different layers, attention heads, and diffusion time steps.
Overview of the MosaicFusion pipeline showing image and mask generation

As shown in the figure above, these aggregated maps are then thresholded and refined using a standard edge-aware algorithm (Bilateral Solver) to produce high-quality instance masks.

Datasets

The authors evaluated MosaicFusion on several challenging benchmarks:

  • LVIS (v1.0): A large-vocabulary dataset with 1203 categories, used for both long-tailed and open-vocabulary instance segmentation experiments.
  • V3Det: A vast vocabulary detection dataset containing over 13,000 categories (10x larger than LVIS) to test extreme scalability.
  • RefCOCO, RefCOCO+, and RefCOCOg: Used to demonstrate that the method can be extended to multimodal tasks like referring expression segmentation.

Key Insights and Ideas

  • Multi-object > Single-object: The authors found that generating images with multiple objects is significantly more beneficial for training than generating single-object images. It increases the task difficulty and provides more diverse spatial layouts.
  • Attention is All You Need (for Masks): The paper demonstrates that the "vision-language correspondence" already residing in a diffusion model's cross-attention maps is a rich, untapped source for high-quality segmentation masks.
  • Training-Free & Agnostic: Unlike concurrent works, MosaicFusion requires no additional training of the generative model and no extra off-the-shelf detectors or segmentors to label the synthetic data. This makes it a pure, "plug-and-play" data augmentation strategy.
  • Complementary Strengths: MosaicFusion is orthogonal to other methods. It can be combined with Copy-Paste for further gains and works alongside CLIP-based open-vocabulary detectors, suggesting that generative models and discriminative VLMs provide complementary knowledge.

Key Results

MosaicFusion achieved impressive gains across various baselines:

  • Long-tailed Segmentation (LVIS): Adding synthetic data improved a Mask R-CNN baseline by +5.6% $AP_r$ (Average Precision on rare categories).
  • Open-Vocabulary Detection (LVIS): It boosted the state-of-the-art F-VLM model by +2.6% to +3.2% $AP_{novel}$ across different backbones.
  • Efficiency: Compared to concurrent methods like X-Paste, MosaicFusion is at least 4.3x more efficient, achieving similar or better results with only 4,000 generated images compared to X-Paste's 100,000.
Visual summary of performance gains on LVIS

Limitations and Future Work

Despite its success, MosaicFusion has a few notable limitations:

  • Domain Gap: There remains an unavoidable domain gap between synthetic images from off-the-shelf diffusion models and real-world images.
  • Failure Cases: The method struggles with "entangled" objects (e.g., a spice rack full of spices), very small objects, or highly abstract concepts (e.g., a "hardback book").
  • General Scenes Only: Current diffusion models are trained on general internet data, making it difficult to apply MosaicFusion to specialized domains like medical imaging or industrial inspection without further fine-tuning.

Future work involves exploring more expressive diffusion models to generate even more complex, scene-level images and tailoring the approach for domain-specific applications.

Summary updated

BibTeX
@article{xie2025mosaicfusion,
  author = {Jiahao Xie and Wei Li and Xiangtai Li and Ziwei Liu and Yew Soon Ong and Chen Change Loy},
  title = {{MosaicFusion: Diffusion Models as Data Augmenters for Large Vocabulary Instance Segmentation}},
  journal = {Int. J. Comput. Vis.},
  year = {2025},
  doi = {10.1007/s11263-024-02223-3},
}
Figure