๐ Open-Vocabulary SAM: Segment and Recognize Twenty-thousand Classes Interactively
๐ Open-Vocabulary SAM: Segment and Recognize Twenty-thousand Classes Interactively
๐ Open-Vocabulary SAM: Expanding to Recognize & Segment 20,000 Classes!
- Title: Open-Vocabulary SAM: Segment and Recognize Twenty-thousand Classes Interactively
- Conference: ECCV 2024
- Code/Checkpoints: GitHub โ OVSAM
- Keywords:
Segment Anything
,Open-Vocabulary
,CLIP
,Recognition
,Promptable Segmentation
,CLIP2SAM
,SAM2CLIP
- Summary: Extending SAMโs segmentation capability with open-vocabulary recognition โ scalability to 20,000+ classes!
๐ Key Highlights of Open-Vocabulary SAM
One-liner: โSAM doesnโt just cut objects anymore, it also names them!โ
1) Basic Structure!! : CLIP2SAM
& SAM2CLIP
- (Segmentation) Encode images with
CLIP
โ align toSAM
viaCLIP2SAM
โ segmentation results from SAM Decoder - (Recognition) Segmentation results โ
SAM2CLIP
โ object names retrieved
2) Open-Vocabulary ๐ฏ
- Recognizes 20,000+ classes without pre-defined labels.
- With a text prompt (e.g., โcatโ, โchairโ), the segmented mask is matched to the correct label.
3) Interactive Extensibility ๐ ๏ธ
- Retains SAMโs point/box/everything prompts.
- Users can provide prompts (words/sentences) for real-time recognition + segmentation.
4) General Vision Pipeline โก
- Evolving from a pure segmentation tool to an open segmentation system with recognition.
- In research and industry, obtain both โwhat + whereโ instantly with a single click.
๐ Related Work
- VLMs have advanced! Especially
CLIP
with contrastive vision-language pre-training โ strong zero-shot recognition. - Many studies in open-vocabulary detection/segmentation using CLIP.
- Prompting has evolved: from NLP into vision with point/bbox prompts.
SAM
: a large-scale model for segmentation, widely applied to tracking, generation, etc.- This work uniquely fuses CLIP and SAM!
๐งฑ Open-Vocabulary SAM Architecture
Baseline (a): Image Cropping Baseline
- Cut the image according to the SAM mask โ input to CLIP โ retrieve label
Baseline (b): Feature Cropping Baseline
- From CLIP embeddings, crop the region corresponding to the SAM mask โ retrieve label
- Problems of these baselines:
1) Using two separate backbones โ high computational cost
2) Different training paradigms (SAM: supervised, CLIP: contrastive) โ unstable knowledge transfer
3) Even with adapters, small object recognition remains weak
4) No prior exploration of how to fuse SAMโs dense visual features with CLIPโs semantic features for open-vocabulary segmentation
OVSAM: Unified Architecture
1) Two backbones = costly
- Solution: Use CLIP encoder only; keep SAMโs prompt encoder + decoder
2) Different training (SAM vs CLIP) = unstable knowledge transfer - Solution: Introduce SAM2CLIP to bridge feature spaces
3) Small object issue - Solution: Enhance CLIP2SAM with FPN + R-CNN-like MLP
4) No SAMโCLIP integration for open-vocab - This work proposes a unified solution with open-vocabulary capabilities!
- Image Encoder (CLIP + CLIP2SAM)
- Use CLIPโs visual encoder, then project features through CLIP2SAM for alignment with SAM Decoder
- Prompt Encoder (SAM)
- Same as original SAM: handles point/box/mask prompts
- Mask Decoder (SAM)
- Combines CLIP2SAM features + prompts โ outputs segmentation masks
- Recognition Head (SAM2CLIP)
- Project masks into CLIP embedding space
- Match with text embeddings via cosine similarity
- โ Final output = segmentation + labeling
- CLIP2SAM = โRecognition โ Segmentationโ bridge
- SAM2CLIP = โSegmentation โ Recognitionโ bridge
๐ง Training Recipe
- Step 1: SAM2CLIP training with SA-1B (1%) (distillation loss)
- Extract feature (F_{sam}) with SAM encoder
- Extract feature (E_I) with CLIP visual encoder
- Adapter (Transformer layers) aligns CLIP features to SAM features (distillation)
- Step 2: Joint training of CLIP2SAM + Mask Decoder with COCO/LVIS
- CLIP2SAM: transforms CLIP semantic features into SAM-compatible region features
- Pipeline:
- Image โ CLIP encoder (frozen) โ multi-scale features
- Prompt (point/box) โ Prompt Encoder (SAM)
- CLIP2SAM(+FPN): multi-scale CLIP features โ SAM-compatible region features
- Mask Decoder (SAM): predicts mask/IoU
- Recognition Head:
Q_label
vs CLIP text embedding โ label score
- Additional: Joint training with ImageNet โ expansion to 22K classes
๐งช Experimental Results
๐ฏ Open-Vocabulary Segmentation
- COCO (IoU_b=81.5 / IoU_n=84.0), LVIS (IoU_b=83.1 / IoU_n=83.6)
- Balanced performance across base/novel classes, outperforming baselines
- FLOPs (1,180G) and parameters (304M) significantly reduced โ efficiency + accuracy
- With
*
(mask center point prompt), baselines collapse in performance- Image-Crop baseline*: COCO IoU_n=26.4, LVIS IoU_n=2.3
- OVSAM*: IoU_b=63.6, IoU_n=67.9 โ robust even with weak prompts
๐ฏ Segmentation
- Mask quality nearly matches SAM-Huge while using ~half the parameters!
- With bbox prompts from an OV-detector, OVSAM achieves strong labeling performance compared to other segmentation models.
๐ Qualitative Comparisons
- Works well with both box and point prompts
- Everything mode: auto-labels dozens of masks (e.g., โcatโ, โdogโ, โsofaโ)
- Useful for interactive tools, robotics/AR, accessibility technologies
๐งช Ablation Studies
- Recognition Headโs text embedding precision is crucial โ CLIP-based learning yields stability
- Combining IoU + Text Similarity Joint Loss improves maskโtext alignment
- Scaling from 1K โ 20K classes leads to linear runtime increase โ real-time inference feasible
โ Conclusion
- Open-Vocabulary SAM = SAMโs โSegment Anythingโ + CLIPโs โRecognize Anythingโ
- Enables 20,000+ class zero-shot recognition with full prompt compatibility
- Ready for practical deployment: instantly outputs what + where
- OVSAM evolves SAM into not just a mask generator, but a naming vision system โ the new standard for segmentation + recognition!
๐ (ํ๊ตญ์ด) Open-Vocabulary SAM: 20,000๊ฐ ํด๋์ค๊น์ง ์ธ์ยท๋ถํ ํ์ฅ!
- ์ ๋ชฉ: Open-Vocabulary SAM: Segment and Recognize Twenty-thousand Classes Interactively
- ํํ: ECCV 2024
- ์ฝ๋/์ฒดํฌํฌ์ธํธ: GitHub โ OVSAM
- ํต์ฌ ํค์๋:
Segment Anything
,Open-Vocabulary
,CLIP
,Recognition
,Promptable Segmentation
,CLIP2SAM
,SAM2CLIP
- ์์ฝ: SAM์ ๋ถํ ๋ฅ๋ ฅ์ ๊ฐ๋ฐฉํ ์ดํ ์ธ์์ ์ ๋ชฉ โ 20,000๊ฐ ํด๋์ค ์์ค์ ํ์ฅ์ฑ ํ๋ณด!
๐ Open-Vocabulary SAM ํต์ฌ ์์ฝ
ํ ์ค ์์ฝ: โSAM์ผ๋ก ๊ฐ์ฒด๋ฅผ ์๋ฅด๋ ๊ฒ์์ ๋ฉ์ถ์ง ์๊ณ , ์ด๋ฆ๊น์ง ๋ถ์ฌ์ค๋ค!โ
1) ๊ฐ๋จํ ๋ณธ ๊ตฌ์กฐ!! : CLIP2SAM
& SAM2CLIP
- (segmentation) ์ด๋ฏธ์ง๋ฅผ
CLIP
์ผ๋ก ์ธ์ฝ๋ฉ โCLIP2SAM
์ผ๋กSAM
์ ์ผ๋ผ์ธ โ SAM Decoder์์ segmentation ๊ฒฐ๊ณผ์ถ์ถ - (Recognizing) ๊ทธ segmentation ๊ฒฐ๊ณผ โ
SAM2CLIP
โ ๊ฐ์ฑ ์ด๋ฆ ์ถ์ถ
2) ๊ฐ๋ฐฉํ ์ดํ(Open-Vocabulary) ๐ฏ
- 20,000๊ฐ ์ด์์ ํด๋์ค์ ๋ํด ์ฌ์ ์ ์๋ ๋ผ๋ฒจ ์์ด๋ ์ธ์ ๊ฐ๋ฅ.
- ํ ์คํธ ํ๋กฌํํธ(์: โ๊ณ ์์ดโ, โ์์โ)๋ฅผ ์ ๋ ฅํ๋ฉด, ๋ถํ ๋ ๋ง์คํฌ๋ฅผ ๋์์์ผ ๊ฐ์ฒด๋ฅผ โ์์๋ดโ.
3) ์ํธ์์ฉ ํ์ฅ์ฑ ๐ ๏ธ
- ๊ธฐ์กด SAM์ ํฌ์ธํธ/๋ฐ์ค/Everything ํ๋กฌํํธ๋ฅผ ์ ์ง.
- ์ฌ์ฉ์๊ฐ ์ง์ ํ ํ๋กฌํํธ(๋จ์ดยท๋ฌธ์ฅ)๋ก ์ค์๊ฐ ์ธ์+๋ถํ ์ํ ๊ฐ๋ฅ.
4) ๋ฒ์ฉ ๋น์ ํ์ดํ๋ผ์ธ โก
- ๋จ์ ๋ถํ ํด์์ ์ธ์ ๊ฐ๋ฅํ ์คํ ์ธ๊ทธ๋ฉํ ์ด์ ์์คํ ์ผ๋ก ์งํ.
- ์ฐ๊ตฌยท์ฐ์ ํ์ฅ์์ ํด๋ฆญ ํ ๋ฒ์ผ๋ก โ๋ฌด์์ธ์ง+์ด๋์ธ์งโ๋ฅผ ๋์์ ์ป์ ์ ์์.
๐ ๊ธฐ์กด ์ฐ๊ตฌ์ ํ๋ฆ
- VLM๋ค์ด ๋ฐ์ ํด์ด! ํนํ contrastive vision-language pre-training์
CLIP
์ผ๋ก zero-shot์ํจ!! - Open Vocabulary ์ ์ฐ๊ตฌ๊ฐ ๋ง์! CLIP์ ๊ธฐ๋ฐ์ผ๋ก object detection, segmentation ์์ญ ๋ชจ๋ OV๋ก ์ฐ๊ตฌ๋ค์ด ์งํ๋จ
- Prompting์ ๋ฐ์ . NLP์์ ์์๋ ํ๋กฌํฌํธ, Vision์๋ ์ ์ฉ๋๋ฉฐ point, bbox ํ๋กฌํฌํธ๊ฐ ๋์ด
- Segmentation!
SAM
! ์ด๋๊ท๋ชจ ๋ฐ์ดํฐ์ ๋ชจ๋ธ๋ก ๋ฑ์ฅํ segmentation ๋ชจ๋ธ. ์ญ๋์ด ์ข์ tracking, ์ด๋ฏธ์ง ์์ฑ ๋ฑ ๋ค์ํ ๋ถ์ผ์ ํ์ฉ - ์ด๋ฒ ์ฐ๊ตฌ๋ ์ด VLM(CLIP)๊ณผ SAM์ ์ตํฉํ ์ฐ๊ตฌ๋ค!
๐งฑ Open-Vocabulary SAM ๊ตฌ์กฐ (Architecture)
baseline(a): Image Cropping Baseline
- SAM์ผ๋ก ์๋ฅธ ๋ง์คํฌ๋๋ก ์ด๋ฏธ์ง๋ฅผ ์๋ผ์ CLIP์ ๋ฃ์ด์ label ์ฐพ์
baseline (b): Feature Cropping Baseline
- CLIP์๋ฒ ๋ฉ ๊ฒฐ๊ณผ์์ SAM mask ๋ถ๋ถ๋ง ์๋ผ์ label ์ฐพ์
- ์์ Baseline ๋ค์ ๋ช๊ฐ์ง ๋ฌธ์ ๊ฐ ์์!
1) 2๊ฐ์ ๋ณ๋ Backbone์ ์ฌ์ฉํ๊ธฐ์ computational costs ๊ฐ ํผ!
2) SAM and CLIP ์ ํ์ต๋ฒ์ด ๋ค๋ฆ(SAM : Supervised, CLIP : contrastive)์ ๋ฐ๋ผ ์ง์์ ์ด๊ฐ ๋ถ์์ ํจ
3) ์ด๋ํฐ๋ก ํฉ์น๋๋ผ๊ณ ์กฐ๊ทธ๋ง ๊ฐ์ฒด ์ธ์์์ ์ฐจ์ด๊ฐ ํผ
4) โSAM์ dense visual feature์ CLIP์ semantic feature๋ฅผ ์ด๋ป๊ฒ ํฉ์น ์ง์ ๋ํ ์ฐ๊ตฌโ ๋ฑ SAM๊ณผ CLIP์ open-vocabulary capability๋ก ํตํฉํ๋ ์๋๊ฐ ์์๋ค!
OVSAM : Unified Architecture
1) 2๊ฐ์ ๋ณ๋ Backbone์ ์ฌ์ฉํ๊ธฐ์ computational costs ๊ฐ ํผ!
- ํด๊ฒฐ์ฑ : CLIP encoder๋ฅผ ์ฌ์ฉํ์!! prompt encoder์ Decoder๋ SAM ์ผ๋ก ์ฐ์!! 2) SAM and CLIP ์ ํ์ต๋ฒ์ด ๋ค๋ฆ(SAM : Supervised, CLIP : contrastive)์ ๋ฐ๋ผ ์ง์์ ์ด๊ฐ ๋ถ์์ ํจ
- ํด๊ฒฐ์ฑ : SAM2CLIP ์ผ๋ก SAM๊ณผ CLIP์ ํน์ง์ ์ฐ๊ฒฐ 3) ์ด๋ํฐ๋ก ํฉ์น๋๋ผ๊ณ ์กฐ๊ทธ๋ง ๊ฐ์ฒด ์ธ์์์ ์ฐจ์ด๊ฐ ํผ
- ํด๊ฒฐ์ฑ : CLIP2SAM์ FPN์ ๋ฃ๊ณ R-CNN ๊ฐ์ MLP๋ฅผ ๋ฃ์ด์ ํด๊ฒฐ@@ 4) โSAM์ dense visual feature์ CLIP์ semantic feature๋ฅผ ์ด๋ป๊ฒ ํฉ์น ์ง์ ๋ํ ์ฐ๊ตฌโ ๋ฑ SAM๊ณผ CLIP์ open-vocabulary capability๋ก ํตํฉํ๋ ์๋๊ฐ ์์๋ค!
- ์ด๋ฒ ์ฐ๊ตฌ์์ ํตํฉํด๋ณด๋ฉด์ Open Voca๋ก ํด๊ฒฐ!!
- Image Encoder (CLIP + CLIP2SAM)
- CLIP์ ๋น์ ์ธ์ฝ๋๋ฅผ ์ฌ์ฉ, CLIP feature โ CLIP2SAM projection์ ๊ฑฐ์ณ SAM Decoder์ Align
- Prompt Encoder (SAM)
- ๊ธฐ์กด SAM๊ณผ ๋์ผ, point/box/mask ํ๋กฌํํธ ์ ๋ ฅ ์ฒ๋ฆฌ
- Mask Decoder (SAM)
- CLIP2SAM feature + ํ๋กฌํํธ ๊ฒฐํฉ โ segmentation mask ์์ฑ
- Recognition Head (SAM2CLIP)
- SAM์์ ์ป์ ๋ง์คํฌ๋ฅผ CLIP ์๋ฒ ๋ฉ ๊ณต๊ฐ์ผ๋ก ํฌ์
- ํ ์คํธ ํ๋กฌํํธ ์๋ฒ ๋ฉ๊ณผ ์ฝ์ฌ์ธ ์ ์ฌ๋ ๊ธฐ๋ฐ ๋งค์นญ
- โ ๊ฒฐ๊ณผ์ ์ผ๋ก, ๊ฐ์ฒด ๋ถํ + ๋ผ๋ฒจ๋ง ๋์ ์ํ
- CLIP2SAM์ โ์ธ์โ๋ถํ โ ์ฐ๊ฒฐ๊ณ ๋ฆฌ, SAM2CLIP์ โ๋ถํ โ์ธ์โ ์ฐ๊ฒฐ๊ณ ๋ฆฌ ์ญํ !!
๐ง ํ์ต๋ฒ(Training Recipe)
- 1๋จ๊ณ: SA-1B (1%)๋ก SAM2CLIP ํ์ต (์ง์ ์ ์ด, distillation loss)
- SAM ์ธ์ฝ๋์ ๋ฃ์ด์ feature (F_{sam}) ์ถ์ถ
- CLIP ๋น์ ์ธ์ฝ๋์ ๋ฃ์ด์ feature (E_I) ์ถ์ถ
- Transformer layer๋ก ๊ตฌ์ฑ๋ Adapter๊ฐ CLIP feature๋ฅผ SAM feature์ ๋ง์ถ์ด segmentation ์ฑ๋ฅ ๋ณด์กด (์ง์ ์ฆ๋ฅ)
- 2๋จ๊ณ: COCO/LVIS ๋ฐ์ดํฐ๋ก CLIP2SAM + Mask Decoder ๊ณต๋ ํ์ต (segmentation loss๋ค ์ฌ์ฉ)
- CLIP2SAM : CLIP์ semantic feature๋ฅผ SAM ๋์ฝ๋๊ฐ ์ฐ๊ธฐ ์ข์ ํํ๋ก ๋ณํ
- ์ด๋ฏธ์ง โ CLIP ์ธ์ฝ๋(๊ณ ์ ) โ multi-scale feature ์ถ์ถ
- ํ๋กฌํํธ(point/box) ์ ๋ ฅ โ Prompt Encoder (SAM)
- CLIP2SAM(+FPN): multi-scale CLIP feature โ SAM ํธํ region feature๋ก ๋ณ๊ฒฝ
- Mask Decoder (SAM): Prompt embedding + ๋ณํ๋ CLIP feature๋ฅผ ์ ๋ ฅ๋ฐ์ ๋ง์คํฌ/IoU ์์ธก
- Recognition Head:
Q_label
vs CLIP ํ ์คํธ ์๋ฒ ๋ฉ ์ ์ฌ๋ โ ๋ผ๋ฒจ ์ค์ฝ์ด
- CLIP2SAM : CLIP์ semantic feature๋ฅผ SAM ๋์ฝ๋๊ฐ ์ฐ๊ธฐ ์ข์ ํํ๋ก ๋ณํ
- ์ถ๊ฐ: ImageNet๊น์ง ๊ฐ์ด ํ์ต โ 22K ํด๋์ค ๋ถ๋ฅ ํ์ฅ
๐งช ์คํ ๊ฒฐ๊ณผ
๐ฏ Open-Vocabulary Segmentation
- COCO (IoU_b=81.5 / IoU_n=84.0), LVIS (IoU_b=83.1 / IoU_n=83.6)์ผ๋ก,
- ๊ธฐ์กด baseline ๋๋น base/novel ํด๋์ค ๋ชจ๋์์ ๊ท ํ์ ์ฑ๋ฅ ํฅ์.
- FLOPs(1,180G)์ ํ๋ผ๋ฏธํฐ ์(304M) ์ญ์ ํฌ๊ฒ ์ค์ด, ํจ์จ์ฑ๊ณผ ์ฑ๋ฅ์ ๋์์ ํ๋ณด.
*
๊ฐ ๋ถ์ ์กฐ๊ฑด(mask center point prompt)์์๋ ๋ชจ๋ baseline์ด ์ฑ๋ฅ ๊ธ๋ฝ.- ํนํ Image-Crop baseline*์ COCO IoU_n 26.4, LVIS IoU_n 2.3์ผ๋ก ๋งค์ฐ ์ ์กฐ.
- ๋ฐ๋ฉด Open-Vocabulary SAM*์ IoU_b=63.6, IoU_n=67.9๋ก ์ฌ์ ํ ์์ ์ ์ฑ๋ฅ.
- ์ฆ, ํ๋กฌํํธ ์ ์ฝ์ด ์ฌํด์ ธ๋ ์ ์ ๊ธฐ๋ฒ์ ๊ฒฌ๊ณ ์ฑ์ด ์ ์ฆ๋จ.
๐ฏ Segmentation
- mask Quality์์๋ SAM-H์ ๊ฑฐ์ ์ ์ฌํ๋ค!! ํ๋ผ๋ฏธํฐ๋ ๋ฐ์ธ๋ฐ!
๊ทธ ์ธ์๋ BBox-detector ํ label ๊ตฌ๋ถ๊ฒฐ๊ณผ, ๋ค๋ฅธ segmentation ๋ชจ๋ธ๊ณผ์ ๋น๊ตํด๋ ์ฑ๋ฅ์ด ์ข์๋ค!!
๐ ์ ์ฑ ๋น๊ต
- Bbox, point ์์๋ segment ๋ฐ label์ ์ํจ!
- Everything ๋ชจ๋์์ ์ถ์ถ๋ ์์ญ ๊ฐ ๋ง์คํฌ์ ์๋ ๋ผ๋ฒจ๋ง ๋ถ์ฌ ๊ฐ๋ฅ
- ์: โ๊ณ ์์ดโ, โ๊ฐ์์งโ, โ์ํโ๋ฅผ ์๋์ผ๋ก ๊ตฌ๋ถ
- ์ํธ์์ฉํ ํ์ต ๋๊ตฌ, ๋ก๋ณดํฑ์คยทAR, ์ ๊ทผ์ฑ ๊ธฐ์ ์ ์ฆ์ ํ์ฉ ๊ฐ๋ฅ
๐งช Ablation ๋ถ์
- Recognition Head์ ํ ์คํธ ์๋ฒ ๋ฉ ์ ๋ฐ๋๊ฐ ์ค์ โ CLIP ๊ธฐ๋ฐ ํ์ต์ด ๊ฐ์ฅ ์์ ์
- ๋ง์คํฌโํ ์คํธ ์ ๋ ฌ ์, IoU + Text Similarity Joint Loss๊ฐ ์ฑ๋ฅ ํฅ์์ ๊ธฐ์ฌ
- ํด๋์ค ๊ฐ์ ํ์ฅ(1์ฒ โ 2๋ง)์๋ ์ถ๋ก ์๋ ์ ํ ์ฆ๊ฐ โ ์ค์๊ฐ์ฑ ์ ์ง
โ ๊ฒฐ๋ก
- Open-Vocabulary SAM์ ๊ธฐ์กด SAM์ โSegment Anythingโ ๋ฅ๋ ฅ์ โRecognize Anythingโ์ ๋ํ ๋ชจ๋ธ!
- 20,000๊ฐ ํด๋์ค ์ด์ Zero-shot ์ธ์ ๊ฐ๋ฅํ๋ฉฐ, ํ๋กฌํํธ ์ํธ์์ฉ ํธํ์ฑ ๋๋ถ์ ์ฆ์ ์ค์ ๋ฐฐ์น ๊ฐ๋ฅ.
- ๋จ์ํ ๋ง์คํฌ๋ฅผ ์๋ฅด๋ ๋๊ตฌ๊ฐ ์๋๋ผ, ์ด๋ฆ ๋ถ์ด๋ AI ๋น์ ์์คํ ์ผ๋ก ์งํํ SAM์ ์๋ก์ด ํ์ค!
This post is licensed under CC BY 4.0 by the author.