Grounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detection
Fuses vision and language representations by injecting text prompt features deep into the object detector, enabling open-set detection of anything described in text.
Paper: Grounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detection
Authors: Shilong Liu, Zhaoyang Zeng, Tianhe Ren, Feng Li, Hao Zhang, Jie Yang, Chunyuan Li, Jianwei Yang, Hang Su, Jun Zhu, Lei Zhang · 2023
Read the paperThe Problem
Traditional object detection models (like YOLO or Faster R-CNN) are trained on closed-set vocabularies. If a model was trained on the 80 COCO categories, it cannot detect a "drone" or a "purple stuffed dinosaur" without being explicitly re-trained or fine-tuned on new bounding boxes for those concepts. While early vision-language models like CLIP allowed for zero-shot image classification, applying zero-shot capabilities to dense object detection (finding the box and naming it) remained difficult because bounding box data is scarce compared to image-level text captions.
The Idea
Grounding DINO solved open-set object detection by conceptually viewing detection as a "grounding" problem: given an image and a text prompt (a list of categories or a descriptive phrase), the model must ground (localize) the text in the image. They built upon the DINO object detector architecture and deeply fused language features into the vision pipeline at every stage, allowing the model to leverage massive vision-language pre-training for state-of-the-art open-set detection.
How It Works
Three-Phase Fusion Architecture Rather than extracting image features and text features separately and comparing them at the very end, Grounding DINO forces the modalities to interact throughout the network:
- Feature Extraction & Feature Enhancer: An image backbone (like Swin Transformer) extracts visual features, while a text backbone (like BERT) extracts text features. A "Feature Enhancer" module then uses cross-attention to fuse these features. The image learns what to look for based on the text, and the text context is enriched by the image.
- Language-Guided Query Selection: In typical transformer-based detectors, queries (which eventually become bounding boxes) are initialized as generic embeddings. Grounding DINO initializes its queries using the actual text features. This biases the queries to actively search for the objects mentioned in the prompt.
- Cross-Modality Decoder: The decoder processes these language-guided queries. It performs self-attention among the queries, cross-attention with the image features, and cross-attention with the text features, producing final bounding boxes and similarity scores.
Grounded Pre-Training The model is trained on a massive mixture of datasets, including standard detection datasets, grounding datasets (where text phrases are linked to specific boxes), and image-text pairs (where the model learns to propose boxes that align with nouns in the caption).
Why It Mattered
Grounding DINO achieved remarkable zero-shot performance, effectively allowing developers to build robust object detectors just by writing text prompts, with no dataset collection required. It bridged the gap between the rich semantic understanding of LLMs/CLIP and the precise spatial localization of traditional detectors.
What Came After
Grounding DINO quickly became an essential building block in complex AI workflows. It is most famously paired with the Segment Anything Model (SAM) in pipelines like "Grounded-SAM", where Grounding DINO provides the zero-shot bounding box based on a text prompt, and SAM uses that box to generate a pixel-perfect segmentation mask.