X-Paste: Revisiting Scalable Copy-Paste for Instance Segmentation using CLIP and StableDiffusion

Hanqing Zhao, Dianmo Sheng, Jianmin Bao, Dongdong Chen, Fang Wen, Lu Yuan, Ce Liu, Wenbo Zhou, Qi Chu, Weiming Zhang, Nenghai Yu

Introduction

Instance segmentation—the task of identifying and outlining every individual object in an image—is notoriously data-hungry. To perform well, models require thousands of examples for every category. However, real-world data naturally follows a long-tail distribution: while there are millions of images of common objects like dogs and cars, rare categories like "axolotls" or "antique telescopes" are scarce.

A popular and highly effective workaround is Copy-Paste augmentation, which involves extracting an object instance and pasting it onto a new background. While simple, this strategy has historically faced a major bottleneck: sourcing the objects. Human annotation is too expensive to scale, and 3D rendering is technically complex and often lacks visual diversity. Consequently, Copy-Paste has been constrained by a lack of diverse, high-quality object masks.

To address this, researchers introduce X-Paste, a scalable data augmentation framework that breathes new life into the Copy-Paste strategy. By leveraging the power of modern generative AI (Stable Diffusion) and zero-shot recognition models (CLIP), X-Paste creates a massive, diverse library of object instances, achieving significant performance boosts—particularly for rare, long-tail object categories.

The X-Paste Methodology

X-Paste is designed as a comprehensive, four-stage pipeline to make Copy-Paste truly scalable without relying on expensive human annotations:

  1. Object Instance Acquisition: Instead of relying on human labels, the framework taps into two virtually infinite sources. First, it uses Stable Diffusion to generate images of specific categories (e.g., "a photo of a single avocado"). Second, it crawls the web for images and uses CLIP to filter out noise, retaining only the most relevant results.
  2. Instance Mask Generation: Because these acquired images lack outline annotations, the team employs class-agnostic segmentation models (such as U2Net). These models excel at isolating the primary subject in an image. They generate multiple candidate masks, and CLIP is used to select the one that best represents the target category.
  3. Instance Filtering: To ensure high quality, the pipeline discards masks that are too small, too large, or exhibit low semantic similarity to the category name, again using CLIP as the automated judge.
  4. Instance Composition: Finally, these clean instances are pasted onto existing background images. The framework uses a class-balanced sampling strategy, ensuring that rare objects are pasted just as frequently as common ones.

Key Insights

The systematic study of X-Paste reveals several fascinating insights into data augmentation and generative AI:

  • Generative Models as Data Equalizers: Stable Diffusion does not suffer from the long-tail problem. It can generate a high-quality image of a rare "sunflower seed" just as easily as a common "chair." This makes generative AI an ideal tool for rebalancing biased datasets.
  • Diversity Over Realism: Counterintuitively, the authors found that random placement of objects—even if physically impossible, like a floating toaster—yields better training results than attempting realistic placement. The model benefits more from encountering objects in diverse, challenging contexts than in perfectly logical scenes.
  • Zero-Shot Synergy: The framework demonstrates a powerful synergy between generative AI (creating the data) and discriminative AI (filtering the data with CLIP), ensuring the model learns from high-quality, diverse inputs rather than noisy "garbage" data.

Experimental Results

X-Paste was evaluated on major benchmarks, delivering impressive gains across the board, especially for the most challenging categories.

  • LVIS v1.0: On this challenging dataset featuring over 1,200 categories designed to test long-tail performance, X-Paste provided massive improvements. Using a strong CenterNet2 baseline with a Swin-L backbone, X-Paste achieved +2.6 box AP and +2.1 mask AP overall. Crucially, it boosted performance on rare, long-tail classes by an astounding +6.8 box AP and +6.5 mask AP.
  • MS-COCO: On the industry-standard COCO dataset, X-Paste achieved 57.0 box AP and 48.5 mask AP, outperforming the baseline by +1.7 and +0.9 respectively.
  • Open-Vocabulary Segmentation: In settings where the model must identify "novel" objects it never saw during base training, X-Paste significantly outperformed existing state-of-the-art methods like ViLD and RegionCLIP, all without requiring complex architectural changes.

Limitations and Future Directions

While X-Paste is highly effective, the authors note a few areas for future refinement. First, the generated images lack physical plausibility regarding scale and relative relationships (e.g., a giant bird next to a tiny house). While this currently does not hinder training, more sophisticated, context-aware pasting could unlock even higher performance. Second, the framework's quality is inherently tied to its underlying foundation models; as Stable Diffusion and CLIP improve, X-Paste will naturally become more potent. Finally, generating and filtering millions of instances requires significant computational power, though this remains a one-time offline cost compared to the perpetual expense of human annotation.

Summary updated

BibTeX
@inproceedings{zhao2023x,
  author = {Hanqing Zhao and Dianmo Sheng and Jianmin Bao and Dongdong Chen and Dong Chen and Fang Wen and Lu Yuan and Ce Liu and Wenbo Zhou and Qi Chu and Weiming Zhang and Nenghai Yu},
  title = {{X-Paste: Revisiting Scalable Copy-Paste for Instance Segmentation using CLIP and StableDiffusion}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=6h2Ydbr8SI},
}
Figure