Grounded SAM: Assembling Open-World Models for Diverse Visual Tasks

Tianhe Ren, Shilong Liu, Ailing Zeng, Jing Lin, Kunchang Li, He Cao, Jiayu Chen, Xinyu Huang, Yukang Chen, Feng Yan, Zhaoyang Zeng, Hao Zhang, Feng Li, Jie Yang, Hongyang Li, Qing Jiang, Lei ZhangarXiv 2024 · DOI · arXiv

TL;DR

Grounded SAM is a modular framework that marries Grounding DINO (an open-set object detector) with the Segment Anything Model (SAM) to achieve high-performance, text-prompted object segmentation. By chaining these "foundation models," the researchers created a versatile pipeline capable of everything from automatic image labeling to highly controllable image editing and 3D human motion analysis.

What Problem Does This Paper Address?

Traditional computer vision models are often "closed-set," meaning they can only recognize categories they were specifically trained on (e.g., the 80 classes in COCO). While the Segment Anything Model (SAM) revolutionized segmentation by allowing users to "cut out" any object, it has a major limitation: it cannot "find" objects based on text descriptions alone. It requires manual prompts like points or bounding boxes.

Conversely, open-vocabulary detectors like Grounding DINO can locate objects based on arbitrary text (e.g., "the left eye of the cat"), but they only provide rough bounding boxes, not precise pixel-level masks. The authors of Grounded SAM address this gap by building a pipeline that converts text into boxes, and boxes into high-fidelity masks, effectively creating a system that can segment anything described in any language.

Methods

The core philosophy of Grounded SAM is the Ensemble Foundation Models approach. Rather than training one giant, monolithic model to do everything, the authors collaboratively integrate specialized "expert" models:

  1. The Core Pipeline: A user provides a text prompt. Grounding DINO processes the image and text to generate bounding boxes. These boxes are then fed into SAM as visual prompts, which generates the final precise segmentation masks.
  2. Modular Extensions: By adding BLIP (captioning) or RAM (tagging) to the front of the pipeline, the system can look at an image, decide what's in it, and automatically generate labeled masks without any human input.

Key Insights and Ideas

  • The Power of Chaining: The paper demonstrates that "assembling" specialized models is often more efficient and flexible than trying to train a single "Unified Model." This modularity allows researchers to swap out components (e.g., using a faster version of SAM like MobileSAM) without retraining the whole system.
  • Box-to-Mask is the "Sweet Spot": Predicting a mask directly from a text prompt is difficult due to data scarcity. However, predicting a box from text (Grounding) and a mask from a box (SAM) are two tasks where high-quality data is abundant. Combining them bypasses the need for massive "text-to-mask" datasets.
  • The "Data Factory" Concept: Grounded SAM can be used to automatically generate high-quality training data for niche domains where manual annotation is too expensive.

Key Results

  • State-of-the-Art Zero-Shot Performance: Grounded SAM achieved 48.7 mean AP on the SegInW benchmark, significantly outperforming previous unified models like UNINEXT and OpenSeeD.
  • Qualitative Versatility: The paper showcases successful segmentation in "long-tail" (rare) categories, such as specific species of moths or flowers, which standard models typically fail to recognize.
Open-vocabulary segmentation of horses, mountains, and clouds in a dynamic outdoor environment.

Limitations and Future Work

  • Error Propagation: Because the models are chained, the system is only as strong as its weakest link. If Grounding DINO fails to detect the correct bounding box, SAM will segment the wrong area.
  • Inference Speed: Running multiple large foundation models in sequence can be computationally expensive. The authors suggest using "Lite" versions (like FastSAM or EfficientSAM) to mitigate this.
  • Future Direction: The authors envision a "closed-loop" system where Grounded SAM generates data to train smaller, more efficient task-specific models, and further integration with LLMs to allow for complex reasoning-based visual tasks.

Summary updated

Abstract

We introduce Grounded SAM, which uses Grounding DINO as an open-set object detector to combine with the segment anything model (SAM). This integration enables the detection and segmentation of any regions based on arbitrary text inputs and opens a door to connecting various vision models. As shown in Fig.1, a wide range of vision tasks can be achieved by using the versatile Grounded SAM pipeline. For example, an automatic annotation pipeline based solely on input images can be realized by incorporating models such as BLIP and Recognize Anything. Additionally, incorporating Stable-Diffusion allows for controllable image editing, while the integration of OSX facilitates promptable 3D human motion analysis. Grounded SAM also shows superior performance on open-vocabulary benchmarks, achieving 48.7 mean AP on SegInW (Segmentation in the wild) zero-shot benchmark with the combination of Grounding DINO-Base and SAM-Huge models.
BibTeX
@misc{ren2024grounded,
  author = {Tianhe Ren and Shilong Liu and Ailing Zeng and Jing Lin and Kunchang Li and He Cao and Jiayu Chen and Xinyu Huang and Yukang Chen and Feng Yan and Zhaoyang Zeng and Hao Zhang and Feng Li and Jie Yang and Hongyang Li and Qing Jiang and Lei Zhang},
  title = {{Grounded SAM: Assembling Open-World Models for Diverse Visual Tasks}},
  year = {2024},
  eprint = {2401.14159},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.14159},
}
Figure