Understanding Grounding DINO!! - Grounding DINO ๋ ผ๋ฌธ ๊ณต๋ถ!
๐ Understanding Grounding DINO!!
Studying ใGrounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detectionใ (ECCV, 2024)
๐ Paper Title: Grounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detection
โ๏ธ Authors: Xinyu Chen, Xueyan Zou, Ze Liu, et al.
๐ One-line Summary: A text-prompt-based object detector!
- Today, Iโm studying the Grounding DINO paper, which I previously experimented with in practice!
๐ง Core Ideas Summary
1๏ธโฃ DINO-based Structure with Enhanced Modality Fusion
- Grounding DINO is based on the Transformer-based object detector DINO.
- Unlike Faster R-CNN, DINOโs structure naturally allows layer-level fusion between text and image.
- Grounding DINO performs cross-modality fusion in Neck (Phase A), Query Initialization (Phase B), and Head (Phase C) stages to boost text-conditioned detection performance.
2๏ธโฃ Generalization through Grounded Pretraining
- CLIP excels at global image-text alignment but struggles with region-level grounding.
- To overcome CLIP-style zero-shot limitations, Grounding DINO introduces contrastive pretraining on region-text pairs.
- It enhances GLIPโs phrase grounding approach with sub-sentence level text processing to reduce category interference.
- This allows Grounding DINO to become a true โtext โ detectionโ open-set detector, achieving new zero-shot benchmarks on COCO and ODinW.
๐ Background of the Grounding DINO Research
Grounding DINO was proposed to go beyond the limitations of fixed class object detection.
Hereโs the previous evolution of related models:
๐งฉ From DETR to DINO โ Still Bound by Fixed Classes
DETR (2020, Facebook AI)
The first Transformer-based end-to-end object detector
โ But it only detects predefined classes, like those in COCO.DINO (ICLR 2023)
Improves DETRโs training stability and accuracy
โ Great detection, but still limited to fixed class tokens
โก๏ธ DINO detects well, but only if you already know what to detect.
๐งฉ Open-Set Object Detection โ Breaking Free from Fixed Classes
๐ GLIP, OV-DETR, etc.
Traditional detectors are closed-set, trained only to recognize predefined classes via bounding box annotations.
To break that limitation, Microsoft proposed GLIP (Grounded Language-Image Pretraining):
- Open-set Object Detection
- Detecting arbitrary categories
- Using natural language generalization to understand new objects
Similarly, OV-DETR uses Transformer-based structure with language-aware object queries injected into the decoder for open-vocabulary detection.
โ ๏ธ Limitations of Prior Work
These models mostly fused image and text features at limited stages, leading to sub-optimal generalization.
๐ Multimodal Fusion Comparison
Model | Fusion Location | Description | Limitation |
---|---|---|---|
GLIP | Phase A (Feature Enhancement) | Fuses text-image in the neck module | Lacks fusion in later modules |
OV-DETR | Phase B (Decoder Input) | Injects language-aware queries into the decoder | Limited fusion with early vision |
โก๏ธ These limited fusions can lead to weaker alignment and lower performance in open-vocabulary detection.
๐ฃ๏ธ SAMโs Possibility and Limitation: Segmentation by Prompt
SAM (Segment Anything Model, 2023)
A universal segmentation model based on point, box, and mask prompts
โ Can โsegment anythingโ as the name impliesBut SAM couldnโt take natural language prompts directly
(Text prompts were only conceptually proposed โ no actual interpretation)
๐ก Enter Grounding DINO!
Grounding DINO bridges both worlds:
- Detection power of DINO + Text interpretation ability of CLIP
- โ Resulting in a text-prompt-based open-vocabulary object detector
It is then combined with SAM into Grounded-SAM, completing a full pipeline of:
โText โ Detection โ Segmentationโ
๐งช Grounding DINO Architecture
๐ Architecture Overview
Grounding DINO uses a dual-encoder + single-decoder design:
- Image Backbone: Extracts visual features
- Text Backbone: Extracts language features
- Feature Enhancer: Fuses image-text features (Sec. 3.1)
- Language-Guided Query Selection: Initializes decoder queries (Sec. 3.2)
- Cross-Modality Decoder: Refines detections (Sec. 3.3)
3.1 ๐ง Feature Extraction and Enhancer
- Image features via Swin Transformer (multi-scale)
- Text features via BERT
- Fusion includes:
- Deformable Self-Attention for image
- Vanilla Self-Attention for text
- Image-to-Text and Text-to-Image Cross-Attention
- Multiple stacked fusion layers
3.2 ๐ฏ Language-Guided Query Selection
Grounding DINO dynamically selects decoder queries based on the input text.
Unlike fixed queries in DETR, it scores the similarity between text and image patches.
๐ Process Overview:
- ๐ธ Extract image patch features
- ๐ Extract text features from the sentence
- ๐ Measure how well each image patch matches text tokens
- โญ Select top 900 image patches as detection queries
- โ Used to predict bounding boxes and labels
Query =
- Positional Part: Anchor box information
- Content Part: Learnable feature vector
3.3 ๐ Cross-Modality Decoder
Each decoder layer includes:
- Self-Attention
- Image Cross-Attention
- Text Cross-Attention (added)
- Feed-Forward Network
โค Added text cross-attention allows better text-image fusion during decoding.
3.4 โ๏ธ Sub-Sentence Level Text Feature
Existing approaches:
- Sentence-level: Encodes whole sentence โ loses fine details
- Word-level: Encodes all class names together โ unintended word interference
Grounding DINO proposes:
โก๏ธ Sub-sentence level encoding with attention masks
โ Removes interference between unrelated words
โ Preserves fine-grained per-word features
๐ฏ Loss Function Design
๐ง 3.5 Loss Function
Grounding DINO combines multiple loss components:
๐ฆ 1. Bounding Box Regression
- L1 Loss
- GIoU Loss for location accuracy
๐ท๏ธ 2. Classification (Text-based)
- Contrastive Loss: Matches text tokens with predicted boxes
- Uses:
- Dot product between queries and text features
- Focal Loss on logits for robust learning
๐ 3. Matching and Final Loss
- Bipartite matching aligns predictions with ground truth
- Final loss = Box loss + Classification loss
๐งฑ 4. Auxiliary Loss
- Added at:
- Each decoder layer
- Encoder outputs
- Helps stabilize early-stage training and convergence
๐ Ablation Study Summary
Grounding DINO evaluates the importance of each design by removing or altering modules.
Evaluated on COCO and LVIS (minival) for Zero-Shot and Fine-Tune settings.
๐ Results (Table 7)
ID | Model Variant | COCO (Zero-Shot) | COCO (Fine-Tune) | LVIS (Zero-Shot) |
---|---|---|---|---|
0 | โ Full Model | 46.7 | 56.9 | 16.1 |
1 | โ No Encoder Fusion | 45.8 | 56.1 | 13.1 |
2 | โ Static Query Selection | 46.3 | 56.6 | 13.6 |
3 | โ No Text Cross-Attention | 46.1 | 56.3 | 14.3 |
4 | โ Word-Level Prompt (vs. Sub-sentence) | 46.4 | 56.6 | 15.6 |
๐ Interpretation
- Encoder Fusion (ID #1) is most critical
- Drop of -0.9 AP (COCO) and -3.0 AP (LVIS)
- Static Query Selection (ID #2) hurts zero-shot performance
- Text Cross-Attention (ID #3) improves grounding
- Sub-sentence Prompt is more effective than word-level
โ Conclusion
- Encoder Fusion is the biggest performance booster
- Query Selection & Text Attention matter especially in open-vocabulary settings
- Sub-sentence prompts improve fine-grained alignment
๐ก Takeaways
Grounding DINO is not just a better detector โ
itโs a model that connects language and vision meaningfully.
I was especially impressed by how it finds objects not from fixed labels,
but from free-form text prompts!
๐ References
- Paper: https://arxiv.org/abs/2303.05499
- Code: https://github.com/IDEA-Research/GroundingDINO
- Thanks to ChatGPT for summarization ๐
(ํ๊ตญ์ด) ๐ Grounding DINO ์์๋ณด๊ธฐ!!
ใGrounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detectionใ(ECCV, 2024) ๊ณต๋ถ
๐ ๋
ผ๋ฌธ ์ ๋ชฉ: Grounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detection
โ๏ธ ์ ์: Xinyu Chen, Xueyan Zou, Ze Liu, et al.
๐ ํ์ค ์์ฝ: ์ ์๋ ํ
์คํธ ํ๋กฌํํธ ๊ธฐ๋ฐ ๊ฐ์ฒด ํ์ง๊ธฐ!
- ์ค๋์ ์ค์ต์ ๋จผ์ ์งํํด๋ณด์๋ Grounding DINO ๋ชจ๋ธ์ ๋ ผ๋ฌธ์ ๊ณต๋ถํด๋ณด๊ณ ์ํฉ๋๋ค!!
๐ง ํต์ฌ ์์ด๋์ด ์์ฝ
1๏ธโฃ DINO ๊ธฐ๋ฐ ๊ตฌ์กฐ์ ๋ชจ๋ฌ ์ตํฉ ๊ฐํ
- Grounding DINO๋ Transformer ๊ธฐ๋ฐ ๊ฐ์ฒด ํ์ง๊ธฐ์ธ DINO๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ์ค๊ณ๋จ.
- ๊ธฐ์กด Faster R-CNN ๊ตฌ์กฐ์ ๋ฌ๋ฆฌ, DINO๋ ํ ์คํธ์ ์ด๋ฏธ์ง ๊ฐ layer-level ์ตํฉ์ด ์์ฐ์ค๋ฝ๊ฒ ๊ฐ๋ฅํ ๊ตฌ์กฐ๋ฅผ ๊ฐ์ง.
- Neck(phase A), Query Initialization(phase B), Head(phase C) ๋จ๊ณ ๋ชจ๋์์ cross-modality fusion์ด ์ด๋ฃจ์ด์ง๋๋ก ์ค๊ณํ์ฌ, ํ ์คํธ ๊ธฐ๋ฐ ๊ฐ์ฒด ํ์ง ์ฑ๋ฅ์ ํฅ์์ํด.
2๏ธโฃ Grounded Pretraining์ ํตํ Open-Set ์ผ๋ฐํ
- CLIP์ ์ด๋ฏธ์ง ์ ์ฒด ์์ค์์๋ ๋ฐ์ด๋์ง๋ง, ์์ญ(region) ์์ค ํ ์คํธ ๋์์๋ ํ๊ณ๊ฐ ์กด์ฌ.
- ์ด๋ฐ CLIP ๊ธฐ๋ฐ zero-shot ๋ฐฉ์์ ํ๊ณ๋ฅผ ๊ทน๋ณตํ๊ธฐ ์ํด, region-text ์์ ๋ํ contrastive pretraining์ ๋์ .
- GLIP์ phrase grounding ๋ฐฉ์์ ๊ฐ์ ํ์ฌ, sub-sentence ๋จ์ ํ ์คํธ ์ฒ๋ฆฌ๋ฅผ ํตํด ํด๋์ค ๊ฐ ๊ฐ์ญ์ ์ค์.
- ์ด๋ก์จ Grounding DINO๋ โํ ์คํธ โ ํ์งโ๊ฐ ๊ฐ๋ฅํ open-set object detector๋ก์, COCO ๋ฐ ODinW ๋ฑ์์ zero-shot ์ฑ๋ฅ์ ์๋ก์ด ๊ธฐ์ค์ ์ ์ํจ.
๐ Grounding DINO ์ฐ๊ตฌ์ ๋ฐฐ๊ฒฝ
Grounding DINO๋ ๊ธฐ์กด์ ๊ฐ์ฒด ํ์ง(Object Detection) ๋ชจ๋ธ๋ค์ด ๊ฐ์ง ๊ณ ์ ๋ ํด๋์ค ์ ํ์ ๋ฐ์ด๋๊ธฐ ์ํด ์ ์๋ ๋ชจ๋ธ์
๋๋ค.
์ด์ ๊น์ง์ ํ๋ฆ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
๐งฉ DETR ์ดํ DINO, ํ์ง๋ง ์ฌ์ ํ ํด๋์ค๋ ๊ณ ์
DETR (2020, Facebook AI)
Transformer ๊ธฐ๋ฐ์ผ๋ก ๊ฐ์ฒด ํ์ง๋ฅผ ์ํํ ์ต์ด์ end-to-end ๋ชจ๋ธ
โ ํ์ง๋ง ํด๋์ค๋ COCO์ฒ๋ผ ์ฌ์ ์ ์๋ ํด๋์ค์ ์ ํ์ ๋จDINO (ICLR 2023)
DETR ๊ตฌ์กฐ๋ฅผ ๊ฐ์ ํด ํ์ต ์์ ์ฑ๊ณผ ์ ํ๋๋ฅผ ๋์ธ ๋ชจ๋ธ
โ ๋ฐ์ด๋ ์ฑ๋ฅ์ ๋ณด์์ง๋ง ์ฌ์ ํ ๊ณ ์ ๋ ํด๋์ค(class token)๋ง ํ์ง ๊ฐ๋ฅ
์ฆ, DINO๋ ํ์ง๋ ์ํ์ง๋ง โ๋ฌด์์ ํ์งํ ์งโ๋ ์ด๋ฏธ ์ ํด์ ธ ์์ด์ผ ํ์ต๋๋ค.
๐งฉ Open-Set Object Detection, ์ฆ ๊ณ ์ ๋ ๊ฐ์ฒด ํ๊ณ๋ฅผ ๋์ด์๋ ์ฐ๊ตฌ๋ค
๐ GLIP, OV-DETR* ์ฐ๊ตฌ
๊ธฐ์กด ๊ฐ์ฒด ํ์ง๋ ์ฌ์ ์ ์ ์๋ ํด๋์ค(bounding box ์ด๋
ธํ
์ด์
)์๋ง ๋ฐ์ํ๋
๊ณ ์ ํด๋์ค ๊ธฐ๋ฐ(closed-set) ํ์ง ๋ฐฉ์์ ํ์ ๋์ด ์์์ต๋๋ค.
์ด์ ๋ํด GLIP(Grounded Language-Image Pre-training, Microsoft)์ ๋ค์๊ณผ ๊ฐ์ ๋ฐฉํฅ์ ์ ์ํ์:
- ์คํ์ ๊ฐ์ฒด ํ์ง (Open-Set Object Detection)
- ์์์ ํด๋์ค (arbitrary class)์ ๋ํ ํ์ง ์ํ
- ์์ฐ์ด ๊ธฐ๋ฐ ์ผ๋ฐํ (language generalization)๋ฅผ ํตํด ์๋ก์ด ๊ฐ์ฒด๋ฅผ ์ดํดํ๊ณ ํ์ง
์ฆ, ์ ํด์ง ๋ผ๋ฒจ ์์ด๋ ํ ์คํธ ํ๋กฌํํธ ๊ธฐ๋ฐ์ผ๋ก ๊ฐ์ฒด๋ฅผ ํ์งํ ์ ์๋ ๋ฅ๋ ฅ์ ๋ชฉํ๋ก ํฉ๋๋ค.
ํํธ, OV-DETR์ Transformer ๊ตฌ์กฐ ๊ธฐ๋ฐ์ ๊ฐ์ฒด ํ์ง๊ธฐ๋ก,
์ธ์ด ์ ๋ณด๊ฐ ํฌํจ๋ ์ฟผ๋ฆฌ(query)๋ฅผ ๋์ฝ๋์ ์ง์ ์ฃผ์
ํ์ฌ open-vocabulary ํ์ง๋ฅผ ์ํํฉ๋๋ค.
โ ๏ธ ๊ธฐ์กด ์ฐ๊ตฌ๋ค์ ํ๊ณ์
์ด๋ฌํ ๋ชจ๋ธ๋ค์ ๋ชจ๋ ์ด๋ฏธ์ง์ ์ธ์ด๋ผ๋ ๋ฉํฐ๋ชจ๋ฌ ์ ๋ณด๋ฅผ
์ผ๋ถ ๋ชจ๋์๋ง ๊ตญํํ์ฌ ์ตํฉ(fusion)ํจ์ ๋ฐ๋ผ,
์ธ์ด ๊ธฐ๋ฐ ์ผ๋ฐํ ์ฑ๋ฅ์ด ์ต์ ๋ณด๋ค ๋ฎ๊ฒ(sub-optimal) ์๋ํ ๊ฐ๋ฅ์ฑ์ด ์กด์ฌํฉ๋๋ค.
๐ ์์: ๋ฉํฐ๋ชจ๋ฌ ๊ฒฐํฉ ์์น ๋น๊ต
๋ชจ๋ธ | ๋ฉํฐ๋ชจ๋ฌ ๊ฒฐํฉ ์์น | ์ค๋ช | ํ๊ณ์ |
---|---|---|---|
GLIP | Phase A (Feature Enhancement) | ๋ฐฑ๋ณธ ์ดํ neck ๋จ๊ณ์์ ์ด๋ฏธ์ง-ํ ์คํธ ํน์ง ์ตํฉ | ์ดํ ๋์ฝ๋์์ ์ฐ๊ฒฐ์ฑ ๋ถ์กฑ |
OV-DETR | Phase B (Decoder Input) | ๋์ฝ๋์ ์ธ์ด ์ฟผ๋ฆฌ(query)๋ฅผ ์ง์ ์ฝ์ | ์ด๊ธฐ ์๊ฐ ์ ๋ณด์์ ๊น์ ์ตํฉ ๋ถ์กฑ |
โก๏ธ ์ด๋ฌํ ๊ตฌ์กฐ์ ์ ์ฝ์,
ํ
์คํธ์ ์ด๋ฏธ์ง ๊ฐ์ ๊น์ด ์๋ ์ ๋ ฌ(alignment)์ด ์๊ตฌ๋๋ open-vocabulary ํ์ง์์
์ฑ๋ฅ ์ ํ ๋๋ ์ผ๋ฐํ ํ๊ณ๋ก ์ด์ด์ง ์ ์์ต๋๋ค.
๐ฃ๏ธ SAM์ด ์ ์ํํ ๊ฐ๋ฅ์ฑ๊ณผ ํ๊ณ: ํ ์คํธ ํ๋กฌํํธ ๊ธฐ๋ฐ ๋ถํ ์๋์ด๋์ด
SAM (Segment Anything Model, 2023)
ํฌ์ธํธ, ๋ฐ์ค, ๋ง์คํฌ ๊ธฐ๋ฐ์ ๋ฒ์ฉ ์ธ๊ทธ๋ฉํ ์ด์ ๋ชจ๋ธ
โ Segment Anything์ด๋ผ๋ ์ด๋ฆ์ ๊ฑธ๋ง๊ฒ ์ด๋ค ๊ฐ์ฒด๋ ์๋ผ๋ผ ์ ์์๊ทธ๋ฌ๋ SAM์ ํ ์คํธ๋ฅผ ์ง์ ์ ๋ ฅํด segmentation์ ์ํํ ์๋ ์์์
(ํ ์คํธ๋ ๊ฐ๋ ์ ์ผ๋ก ์ ์๋์์ง๋ง, ์ค์ ํ ์คํธ ์ธ์์ ํ์ง ์์)
๐ก ๊ทธ๋์ ๋ฑ์ฅํ Grounding DINO!
Grounding DINO๋ ์ด๋ฌํ ๋ ํ๋ฆ์ ์์ฐ์ค๋ฝ๊ฒ ์ฐ๊ฒฐํฉ๋๋ค:
- DINO์ ๊ฐ์ฒด ํ์ง ๋ฅ๋ ฅ + ํ ์คํธ ํ๋กฌํํธ ํด์ ๋ฅ๋ ฅ(CLIP ๊ธฐ๋ฐ)
- โ ๊ฒฐ๊ตญ โ๋ง๋ก ํ์งํ๋(open-vocabulary) ๊ฐ์ฒด ํ์ง๊ธฐโ๊ฐ ๋ ๊ฒ!!
์ดํ SAM๊ณผ ๊ฒฐํฉํ์ฌ Grounded SAM์ผ๋ก ํ์ฅ๋๋ฉฐ,
โํ
์คํธ โ ํ์ง โ ๋ถํ โ์ด๋ผ๋ ์ ์ฒด ํ์ดํ๋ผ์ธ์ด ์์ฑ๋ฉ๋๋ค.
๐งช Grounding DINO์ ๊ตฌ์ฑ
๐ ์ํคํ ์ฒ ๊ฐ์
Grounding DINO๋ dual-encoder + single-decoder ๊ตฌ์กฐ๋ฅผ ์ฑํํฉ๋๋ค.
๊ตฌ์ฑ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
- Image Backbone: ์ด๋ฏธ์ง ํน์ง ์ถ์ถ
- Text Backbone: ํ ์คํธ ํน์ง ์ถ์ถ
- Feature Enhancer: ์ด๋ฏธ์ง-ํ ์คํธ ํน์ง ์ตํฉ (Sec. 3.1)
- Language-Guided Query Selection: ์ฟผ๋ฆฌ ์ด๊ธฐํ (Sec. 3.2)
- Cross-Modality Decoder: ๋ฐ์ค refinement ์ํ (Sec. 3.3)
3.1 ๐ง Feature Extraction and Enhancer
- ์ด๋ฏธ์ง Feature: Swin Transformer์ ๊ฐ์ ๋ฐฑ๋ณธ์ ํตํด ๋ค์ค ์ค์ผ์ผ ํน์ง ์ถ์ถ
- ํ ์คํธ Feature: BERT ๊ธฐ๋ฐ์ ๋ฐฑ๋ณธ์ผ๋ก ์ถ์ถ
- ์ตํฉ ๋ฐฉ์:
- ์ด๋ฏธ์ง: Deformable self-attention
- ํ ์คํธ: Vanilla self-attention
- ํฌ๋ก์ค๋ชจ๋ฌ ์ตํฉ:
- Image-to-Text Cross-Attention
- Text-to-Image Cross-Attention
- ๋ค์์ Feature Enhancer Layer๋ก ๊ตฌ์ฑ
๐ ์๋ก ๋ค๋ฅธ ๋ชจ๋ฌ๋ฆฌํฐ์ ํน์ง ์ ๋ ฌ(alignment)์ ์ํ ํต์ฌ ๋ชจ๋
3.2 ๐ฏ Language-Guided Query Selection
Grounding DINO๋ ์
๋ ฅ ํ
์คํธ์ ๋ฐ๋ผ ํ์ง ์ฟผ๋ฆฌ๋ฅผ ๋์ ์ผ๋ก ์ ํํ๋ ๊ตฌ์กฐ๋ฅผ ๊ฐ๊ณ ์์ต๋๋ค.
๊ธฐ์กด์ DETR ๊ณ์ด ๋ชจ๋ธ๋ค์ด ๊ณ ์ ๋ ์ฟผ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ๊ฒ๊ณผ ๋ฌ๋ฆฌ,
์ด๋ฏธ์ง์ ํ
์คํธ ๊ฐ์ ์ ์ฌ๋๋ฅผ ๊ณ์ฐํ์ฌ ๊ฐ์ฅ ๊ด๋ จ ์๋ ์ฟผ๋ฆฌ๋ค์ ์ ํํฉ๋๋ค.
- ๐ ์๋ ๋ฐฉ์
- ๐ธ ์ด๋ฏธ์ง๋ฅผ ์กฐ๊ฐ์กฐ๊ฐ ๋๋ ์(=ํจ์น๋ก) ํน์ง์ ๋ฝ๊ณ ,
- ๐ ์ ๋ ฅ ๋ฌธ์ฅ(์: โa red umbrellaโ)๋ ๋จ์ด๋ณ๋ก ํน์ง์ ์ถ์ถ!
- ๐ ์ด๋ฏธ์ง์ ๊ฐ ์กฐ๊ฐ์ด ํ ์คํธ์ ์ด๋ค ๋จ์ด์ ์ ๋ง๋์ง ์ ์๋ฅผ ๊ณ์ฐํ๊ณ ,
- โญ ์ ์๊ฐ ๋์ ์ด๋ฏธ์ง ์กฐ๊ฐ 900๊ฐ๋ฅผ โํ์ง ์ฟผ๋ฆฌโ๋ก ์ ํ
- ์ด ์ฟผ๋ฆฌ๋ค์ ๋์ฝ๋์ ๋ค์ด๊ฐ์ bounding box์ ๋ ์ด๋ธ์ ์์ธก
โ์ฟผ๋ฆฌโ์ ๊ตฌ์ฑ์? : ์ฟผ๋ฆฌ๋ ๋ ๊ฐ์ง ์ ๋ณด๋ก ๊ตฌ์ฑ๋จ
- ์์น ์ ๋ณด (Positional Part): ์ฟผ๋ฆฌ๊ฐ ์ด๋ฏธ์ง ์ด๋๋ฅผ ๊ฐ๋ฆฌํค๋์ง(encoder ์ถ๋ ฅ์ผ๋ก๋ถํฐ anchor box ์ด๊ธฐํ)
- ๋ด์ฉ ์ ๋ณด (Content Part): ์ด๋ค ๊ฐ์ฒด๋ฅผ ์ฐพ์ผ๋ ค๊ณ ํ๋์ง
3.3 ๐ Cross-Modality Decoder
- ๊ฐ ๋์ฝ๋ ๋ ์ด์ด๋ ๋ค์ ๋ธ๋ก์ผ๋ก ๊ตฌ์ฑ๋จ:
- Self-Attention
- Image Cross-Attention
- Text Cross-Attention
- Feed-Forward Network (FFN)
- DINO์ ๋์ฝ๋ ๊ตฌ์กฐ์ ๋นํด Text Cross-Attention ๋ธ๋ก์ด ์ถ๊ฐ๋จ
โ ํ ์คํธ ์ ๋ณด๊ฐ ์ฟผ๋ฆฌ ์ ๋ฐ์ดํธ์ ๋ ๊ฐํ๊ฒ ๋ฐ์๋จ
3.4 โ๏ธ Sub-Sentence Level Text Feature
- ๊ธฐ์กด ํ ์คํธ ์ธ์ฝ๋ฉ ๋ฐฉ์:
- Sentence-level: ๋ฌธ์ฅ์ ํ๋์ ๋ฒกํฐ๋ก ์ฒ๋ฆฌ โ ์ ๋ฐ๋ ์์ค
Word-level: ์ฌ๋ฌ ๋จ์ด๋ฅผ ํ ๋ฒ์ ์ธ์ฝ๋ฉ โ ๋จ์ด ๊ฐ ๋ถํ์ํ ์ํธ์์ฉ ๋ฐ์
๋ฌธ์ : ํ ์คํธ๊ฐ ์ฌ๋ฌ ํด๋์ค๋ช ์ ํฌํจํ ๊ฒฝ์ฐ, ๋ฌด๊ดํ ๋จ์ด ๊ฐ ์ํธ์์ฉ(attention)์ด ์๊น
- ํด๊ฒฐ:
Sub-sentence level representation ๋์
โ ์๋ก ๋ค๋ฅธ ํด๋์ค๋ช ์ฌ์ด์ attention์ maskํ์ฌ ๋ถํ์ํ ์ํธ์์ฉ ์ ๊ฑฐ
โ ๋จ์ด ๋จ์ ์ ๋ฐ ํํ ์ ์ง + ์ํธ ๊ฐ์ญ ๋ฐฉ์ง
๐ฏ Loss์ ๊ตฌ์ฑ
๐ง 3.5 Loss Function
Grounding DINO๋ ๊ธฐ์กด์ DETR ๊ณ์ด ๋ชจ๋ธ๋ค๊ณผ ์ ์ฌํ๊ฒ,
๋ค์ ์ธ ๊ฐ์ง ์ฃผ์ ์์ค ํจ์๋ฅผ ์กฐํฉํ์ฌ ํ์ตํฉ๋๋ค:
๐ฆ 1. Bounding Box Regression
- L1 Loss
- GIoU Loss (Generalized Intersection over Union)
- โ ๋ฐ์ค ์์น ์์ธก ์ ๋ฐ๋ ํฅ์์ ์ฌ์ฉ
- ์ฐธ๊ณ : DETR, Deformable DETR ๋ฑ์์ ์ฌ์ฉ๋ ๋ฐฉ์๊ณผ ๋์ผ
๐ท๏ธ 2. Classification (ํ ์คํธ ๊ธฐ๋ฐ ๋ถ๋ฅ)
- Contrastive Loss (GLIP ๋ฐฉ์ ์ฑํ)
- ์์ธก๋ ๊ฐ์ฒด์ ํ ์คํธ ํ ํฐ ๊ฐ์ ๋์ ๊ด๊ณ ํ์ต
- ๋ฐฉ์:
- ๊ฐ ์ฟผ๋ฆฌ์ ํ ์คํธ ํน์ง ๊ฐ์ dot product โ logits ๊ณ์ฐ
- ๊ฐ ํ ์คํธ ํ ํฐ๋ณ๋ก Focal Loss ์ ์ฉํ์ฌ ๋ถ๋ฅ ํ์ต
๐ 3. ๋งค์นญ ๋ฐ ์ดํฉ ๊ณ์ฐ
- ์์ธก๊ฐ๊ณผ ์ ๋ต ๊ฐ ์ด์ค ์ด๋ถ ๋งค์นญ (bipartite matching) ์ํ
โ ๋ฐ์ค regression cost + classification cost ๊ธฐ๋ฐ - ๋งค์นญ ํ ์ต์ข
์์ค์ ๋ค์์ ํฉ์ฐํ์ฌ ๊ณ์ฐ:
- Bounding Box Loss (L1 + GIoU)
- Classification Loss (Focal + Contrastive)
๐งฑ 4. Auxiliary Loss
- DETR ๊ณ์ด ๊ตฌ์กฐ๋ฅผ ๋ฐ๋ฅด๊ธฐ ๋๋ฌธ์, ๋ค์ ๋ ์์น์ ๋ณด์กฐ ์์ค(auxiliary loss)์ ์ถ๊ฐํฉ๋๋ค:
- ๊ฐ ๋์ฝ๋ ๋ ์ด์ด ์ถ๋ ฅ
- ์ธ์ฝ๋ ์ถ๋ ฅ (encoder outputs)
โก๏ธ ์ด ๋ณด์กฐ ์์ค์ ํ์ต ์ด๊ธฐ ์์ ์ฑ๊ณผ ์๋ ด ๊ฐ์์ ๊ธฐ์ฌํฉ๋๋ค.
๐ Grounding DINO Ablation ์คํ ์ ๋ฆฌ
Grounding DINO์ ์ฃผ์ ์ค๊ณ ์์๋ค์ด ์ค์ ์ฑ๋ฅ์ ์ด๋ค ์ํฅ์ ๋ฏธ์น๋์ง๋ฅผ ๋ถ์ํ๊ธฐ ์ํด,
์ฌ๋ฌ ๊ตฌ์ฑ ์์๋ฅผ ์ ๊ฑฐํ๊ฑฐ๋ ๋ณ๊ฒฝํ Ablation ์คํ์ ์ํํ์์
์คํ ๊ฒฐ๊ณผ๋ COCO (minival)์ LVIS (minival) ๋ฐ์ดํฐ์
์์์
Zero-Shot ๋ฐ Fine-Tune ์กฐ๊ฑด์ ๊ธฐ์ค์ผ๋ก ํ๊ฐ
๐ ์คํ ๊ฒฐ๊ณผ ์์ฝ (Table 7)
ID | ๋ชจ๋ธ ๊ตฌ์ฑ | COCO (Zero-Shot) | COCO (Fine-Tune) | LVIS (Zero-Shot) |
---|---|---|---|---|
0 | โ Grounding DINO (Full Model) | 46.7 | 56.9 | 16.1 |
1 | โ w/o Encoder Fusion | 45.8 | 56.1 | 13.1 |
2 | โ Static Query Selection | 46.3 | 56.6 | 13.6 |
3 | โ w/o Text Cross-Attention | 46.1 | 56.3 | 14.3 |
4 | โ Word-Level Text Prompt (vs. Sub-sentence) | 46.4 | 56.6 | 15.6 |
๐ ํด์ ๋ฐ ๊ตฌ์ฑ ์์๋ณ ์ํฅ ๋ถ์
- Encoder Fusion ์ ๊ฑฐ (๋ชจ๋ธ #1)
- COCO: -0.9 AP
- LVIS: -3.0 AP
- โค ๊ฐ์ฅ ํฐ ์ฑ๋ฅ ์ ํ โ ํ ์คํธ-์ด๋ฏธ์ง ๊น์ ์ตํฉ์ด ํต์ฌ ์ญํ
- Static Query Selection (๋ชจ๋ธ #2)
- ์ฟผ๋ฆฌ๋ฅผ ๋์ ์ผ๋ก ์ ํํ์ง ์๊ณ ๊ณ ์ ๋ ๋ฐฉ์ ์ฌ์ฉ
- LVIS ์ฑ๋ฅ -2.5 AP ํ๋ฝ
- โค ๋์ ์ฟผ๋ฆฌ ์ ํ์ด ์ ๋ก์ท ํ์ง์ ์ ์๋ฏธํ ๊ธฐ์ฌ
- Text Cross-Attention ์ ๊ฑฐ (๋ชจ๋ธ #3)
- COCO/Fine-Tune ์ํฅ ์์ง๋ง, LVIS์์๋ -1.8 AP
- โค ํ ์คํธ ์ ๋ณด๊ฐ ๋์ฝ๋์ ์ง์ ๋ฐ์๋ ๋ ํจ๊ณผ ์กด์ฌ
- Word-level Prompt ์ฌ์ฉ (๋ชจ๋ธ #4)
- Sub-sentence ๋์ ์ ์ฒด ๋ฌธ์ฅ์ ๋จ์ด ๋จ์๋ก ์ฒ๋ฆฌ
- LVIS ์ฑ๋ฅ -0.5 AP
- โค Sub-sentence ๋ฐฉ์์ด fine-grained ํํ์ ์ ๋ฆฌ
โ ๊ฒฐ๋ก ์์ฝ
- Encoder Fusion์ด ๊ฐ์ฅ ํฐ ์ฑ๋ฅ ํฅ์์ ์ฃผ๋ ํต์ฌ ๊ตฌ์ฑ ์์์์ด ํ์ธ๋จ
- Query Selection๊ณผ Text Cross-Attention์ ํนํ LVIS์ ๊ฐ์ ์ธ๋ถํ๋ ์คํ์ ๋ฐ์ดํฐ์ ์์ ํจ๊ณผ์
- Sub-sentence ํ ์คํธ ์ฒ๋ฆฌ๋ Word-level ๋ฐฉ์๋ณด๋ค ์ ๋ฐํ ํํ๋ ฅ์ ์ ๊ณต
๐ก ๋๋์
Grounding DINO๋ ๋จ์ํ ํ์ง๋ฅผ ์ํ๋ ๊ฒ์ ๋์ด,
ํ
์คํธ์ ์๊ฐ ์ ๋ณด๋ฅผ ํจ๊ณผ์ ์ผ๋ก ์ฐ๊ฒฐํ๋ ๋ฐฉ์์ ์ ๋ณด์ฌ์ฃผ๋ ๋
ผ๋ฌธ ๊ธฐ์กด ํ์ต๋ ๊ฐ์ฑ๋ฅผ ํ
์ด ํ
์คํธ ๊ธฐ๋ฐ์ ๊ฐ์ฑ ํ์์ ํ๋ค๋ ๊ฒ์ด ์ธ์์ ์ด์๋ค!
๐ ์ฐธ๊ณ ์ฌํญ
- Grounding DINO paper: https://arxiv.org/abs/2303.05499
- Grounding DINO GitHub: https://github.com/IDEA-Research/GroundingDINO
- chatGPT์ ์์ฝ๋ฅ๋ ฅ!!