๐Understanding FG-CLip - FG-Clip ์์๋ณด๊ธฐ?!!
๐ง Understanding FG-CLIP (in English)
๐ A more precise and detailed evolution of CLIP!
Paper: FG-CLIP: Fine-Grained Visual and Textual Alignment
Conference: ICML 2025 (Xie, Chunyu, et al.)
Code: 360CVGroup/FG-CLIP
๐ Summary of FG-CLIP
FG-CLIP (Fine-Grained CLIP) is a model designed to overcome the coarse recognition limitations of original CLIP.
It improves visual-textual alignment through three core techniques:
1. Global Semantic Alignment with Long Captions
- 1.6 billion long image-text pairs generated using a state-of-the-art multimodal model (LMM).
- These enriched captions help the model understand more nuanced and complex visual content.
- Result: improved global semantic alignment performance.
2. High-Quality Visual Grounding Dataset Construction
- 40 million bounding boxes over 12 million images, each with detailed region-level descriptions.
- Enables learning of region-specific, context-aware visual representations.
- All of this is unified into the FineHARD dataset, which also includes hard negatives:
- Improves the modelโs fine-grained alignment capacity significantly.
3. Learning with Hard Fine-Grained Negative Samples
- Includes 10 million fine-grained hard negatives.
- These are semantically similar but visually/verbally distinct image-text pairs.
- Trains the model to detect subtle differences โ improving fine-grained discrimination skills.
๐ง Why was FG-CLIP developed?
- The original CLIP performs well on general multimodal tasks,
but relies heavily on short and vague captions, which limit fine-grained understanding. - Existing datasets (COCO, LAION, etc.) are large but lack detail.
Thatโs why they released FineHARD, a fine-grained dataset!
Challenge | Limitation | Effect on CLIP |
---|---|---|
๐งต Lack of detail | Descriptions are too general, lack object-level attributes/relations | Hard to train fine-grained alignment |
๐ฆ Limited data size | Only 1โ2M examples in FineCLIP/LongCLIP vs billions in LAION | Low generalization/performance compared to foundation models |
๐ง Label noise | Pseudo-labeling using object detectors introduces inconsistency | Reduced accuracy and misalignment risk |
โ Lack of hard negatives | Mostly easy positive examples; not enough confusing negative samples | Weakness in distinguishing subtly different concepts |
๐ Previous CLIP Extensions and Their Limitations
๐ง CLIPSelf (ICLR 2024)
Adds DINO-style self-supervised learning to CLIP
Skips the text encoder โ focuses only on visual refinement!
- Adds self-supervised pretext tasks on top of CLIPโs image encoder.
- Strength: Learn better visual representations without labels.
- Limitation: Doesnโt improve visual-language reasoning or alignment.
๐ฏ FineCLIP (NeurIPS 2024)
Improves object-text mapping at the part-level / attribute-level
- Uses an object detector to extract region-level representations.
- Learns multi-stage alignment (region, sentence, image).
- Limitation: Depends on object detector accuracy; less generalizable in abstract scenes.
๐ฅ LLaVA (NeurIPS 2023)
A โproto-versionโ of vision-language assistants like Qwen-VL or GPT-4V.
- Connects CLIP vision encoder with LLM (e.g., Vicuna).
- Enables chat-like multimodal interaction.
- Limitation: Heavily reliant on high-quality alignment data, lacks visual reasoning depth.
๐งพ LongCLIP (ECCV 2024)
Expands CLIPโs text encoder to handle long-form captions.
- Trains on millions of long image-caption pairs.
- Improves story-style image understanding and contextual reasoning.
- Limitation: Long caption noise and text encoder overload can degrade alignment quality.
๐ FG-CLIP Model Architecture
- FG-CLIP builds on CLIPโs dual encoder structure.
- Two-stage training:
- Stage 1: Align global image-text meaning
- Stage 2: Adds region-level contrast + hard negative learning
Stage 1: Global Contrastive Learning
- Aligns image and text at a global semantic level
- Uses both long and short captions per image
- Long: rich context; Short: concise concept
โ Implementation Summary:
- 1.6 billion image-text pairs
- Pretrained from original CLIP
- Vision Backbone: ViT-B and ViT-L
- Optimizer: AdamW (LR=1e-4, weight decay=0.05, ฮฒ1=0.9, ฮฒ2=0.98)
- Warmup: 200 steps
- Batch size per NPU: 384
- Precision: BFloat16
- Optimization: DeepSpeed Zero-2
- Epochs: 1
Stage 2: Regional + Hard Negative + Reuse of Stage1 Global Loss
2-1. ๐ Regional Contrastive Learning (L_regional)
- Aligns bounding box features with corresponding text phrases using RoIAlign.
- Enhances local grounding and part-level semantic understanding.
2-2. โ ๏ธ Hard Fine-Grained Negatives (L_hard)
- Generates subtle distractors by changing attributes (e.g., โblue shirtโ โ โred shirtโ).
- Trains the model to distinguish subtle semantic differences.
2-3. Repeat of Global Contrastive (L_global)
Combined loss:
1
L = L_global + ฮฑ ยท L_regional + ฮฒ ยท L_hard
- ฮฑ = 0.1, ฮฒ = 0.5
โ Implementation Summary:
- 12M images, each with:
- long + short captions
- visual grounding annotations
- hard negatives
- Optimizer: AdamW (LR=1e-6, weight decay=0.001, ฮฒ1=0.9, ฮฒ2=0.98)
- Warmup: 50 steps
- Batch size per GPU: 512
- Optimization: DeepSpeed Zero-2, CUDA TF32, BFloat16
- Epochs: 1
๐ FG-CLIP Data Summary
Two phases of data preparation:
๐ Phase 1: Recaptioning LAION-2B
Surprisingly, they used Huawei NPUs (910B) instead of NVIDIA GPUs!
- Original LAION captions are too generic (โa birdโ)
- Used CogVLM2-19B to generate context-rich recaptions
- Before:
"a bird"
โ After:"a red-winged blackbird perched on a tree branch"
- Before:
- Recaptioned 2 billion images in 30 days using 160ร910B NPU cluster
๐ฆ Phase 2: FineHARD Dataset (Visual Grounding + Hard Negatives)
Component | Amount |
---|---|
Long image-level captions | 12M images |
Bounding box region captions | 40M boxes |
Hard negatives | 10M samples |
Build time | 7 days on NPU cluster |
โ Visual Grounding
- Based on GRIT images + CogVLM2-generated captions
- Extract referring expressions with SpaCy
- Use YOLO-World for bounding boxes (Confidence โฅ 0.4)
- NMS removes overlaps โ 12M images, 40M regions with rich captions
โก Hard Negative Generation
- Keep object name, change attributes to create contrast
- Use LLaMA-3.1-70B to generate 10 distractors per positive
- Post-process to remove symbols like
;
,,
,\n
- Quality check: 98.9% valid, 1.1% noise
- Example:
- Positive:
"a man in a blue striped shirt"
- Negative:
"a man in a red checkered shirt"
- Positive:
๐ฏ Performance (Ablation Test)
Stage 1 alone already boosts performance thanks to long+short caption alignment.
As you add more components in Stage 2:
L_regional
improves bbox classificationL_hard
boosts fine-grained text-image discrimination
But โ slight drop in short retrieval was observed, perhaps due to confusion from longer and more complex negatives!
๐ฎ Final Thoughts
Preparing such a massive dataset must have taken tremendous effortโฆ
But each component clearly contributes to the model as the authors intended.
Especially impressive: the improvement in detail-level accuracy via negative samples ๐
I might try this myself somedayโฆ
And finally โ I was amazed they used Huawei NPUs! NVIDIA isnโt the only game in town! ๐ง
๐ง (ํ๊ตญ์ด) FG-CLIP ์์๋ณด๊ธฐ!
๐ ๋ ์ธ์ธํ ํ๋กฌํฌํธ๋ ๊ฐ๋ฅํ, ๋ฐ์ ๋ CLIP!!
๋ ผ๋ฌธ: FG-CLIP: Fine-Grained Visual and Textual Alignment
๋ฐํ: ICML 2025 (Xie, Chunyu, et al.)
์ฝ๋: 360CVGroup/FG-CLIP
๐ FG-CLIP์ ํน์ง ์์ฝ
FG-CLIP (Fine-Grained CLIP)์ ๊ธฐ์กด CLIP์ ์ธ๋ฐํ ์ธ์ ํ๊ณ๋ฅผ ๊ทน๋ณตํ๊ธฐ ์ํด ์ค๊ณ๋ ๋ชจ๋ธ๋ก,
๋ค์์ ์ธ ๊ฐ์ง ํต์ฌ ๊ธฐ๋ฒ์ ํตํด ์๊ฐ-์ธ์ด ์ ๋ ฌ ์ฑ๋ฅ์ ํฌ๊ฒ ํฅ์์ํต๋๋ค.
1. ์ฅ๋ฌธ ์บก์ ๊ธฐ๋ฐ์ ๊ธ๋ก๋ฒ ์๋ฏธ ์ ๋ ฌ ๊ฐํ
- ์ต์ ๋ฉํฐ๋ชจ๋ฌ ๋ชจ๋ธ(LMM)์ ํ์ฉํด 1.6์ต ๊ฐ์ ์ฅ๋ฌธ ์ด๋ฏธ์ง-ํ ์คํธ ์์ ์์ฑ.
- ๊ธฐ์กด๋ณด๋ค ํจ์ฌ ํ๋ถํ ๋ฌธ๋งฅ ์ ๋ณด๊ฐ ๋ด๊ธด ๋ฐ์ดํฐ๋ก ํ์ตํจ์ผ๋ก์จ, ๋ชจ๋ธ์ด ๋ณต์กํ๊ณ ์ธ๋ถ์ ์ธ ์๊ฐ ์ ๋ณด๋ฅผ ๋ ์ ์ดํดํ ์ ์๋๋ก ํจ.
- ๊ฒฐ๊ณผ์ ์ผ๋ก ๊ธ๋ก๋ฒ ์๋ฏธ ์ ๋ ฌ(global semantic alignment) ๋ฅ๋ ฅ์ด ํฅ์๋จ.
2. ๊ณ ํ์ง Visual Grounding ๋ฐ์ดํฐ์ ๊ตฌ์ถ
- 1,200๋ง ๊ฐ ์ด๋ฏธ์ง์ ํฌํจ๋ 4์ฒ๋ง ๊ฐ ๋ฐ์ด๋ฉ ๋ฐ์ค์ ๋ํด, ๋ฌธ๋งฅ์ด ํ๋ถํ ์ค๋ช ์ ์ ๊ณต.
- ์ด ๋ฐ์ดํฐ์ ์ ํตํด ๋ชจ๋ธ์ ์ ํํ๊ณ ์ง์ญ(region)-๊ธฐ๋ฐ์ ํํ์ ํ์ตํ ์ ์์.
์ด๋ ์ธ๋ฐํ ๊ฐ์ฒด ๊ตฌ๋ถ ๋ฐ ์์น ๊ธฐ๋ฐ ์ ๋ ฌ ์์ ์์ ํฐ ๋์์ด ๋จ.
- ์ต์ข
์ ์ผ๋ก๋ FineHARD ๋ฐ์ดํฐ์
์ผ๋ก ํตํฉ๋จ!!
- visual grounding ๋ฐ์ดํฐ์ hard negative ์ํ์ ํตํฉํ์ฌ FineHARD๋ผ๋ ๊ณ ํ์ง ๋ฐ์ดํฐ์ ๊ตฌ์ฑ.
- ์ธ๋ฐํ ์ ๋ ฌ ๋ฅ๋ ฅ ํฅ์์ ํต์ฌ์ ์ธ ์ญํ ์ ํจ.
3. Hard Negative ์ํ์ ํตํ ํ๋ณ ๋ฅ๋ ฅ ๊ฐํ
- 1์ฒ๋ง ๊ฐ์ fine-grained hard negative sample์ ํฌํจํ ๋๊ท๋ชจ ๋ง๋ญ์น(Corpus) ๋์ .
- ์๋ฏธ์ ์ผ๋ก ์ ์ฌํ์ง๋ง ์์ฑ์ด ๋ค๋ฅธ ์ด๋ฏธ์ง-ํ ์คํธ ์์ ํ์ต์์ผ, ๋ ์ ๋ฐํ ๊ตฌ๋ถ(discrimination) ๋ฅ๋ ฅ์ ๋ถ์ฌ.
- ๋ชจ๋ธ์ด ์ธ๋ฐํ ์ฐจ์ด๋ฅผ ๊ฐ์งํ๊ณ , ํผ๋ ์์ด ๊ตฌ๋ณํ ์ ์๋๋ก ์ ๋.
๐ง FG-CLIP ๋ฑ์ฅ์ ๋ฐฐ๊ฒฝ
- ๊ธฐ์กด CLIP์ ๋ฉํฐ๋ชจ๋ฌ ์์
์์๋ ๋ฐ์ด๋์ง๋ง,
์งง๊ณ ๊ฐ๋ต์ ์ธ ์บก์ ์ ์์กดํ์ฌ ์ธ๋ฐํ ์ดํด(fine-grained understanding)๊ฐ ๋ถ์กฑํจ. - ๊ธฐ์กด
์ด๋ฏธ์ง-ํ ์คํธ ๋ฐ์ดํฐ์
์ ํ๊ณ์กด์ฌ๊ทธ๋์! โFineHARDโ๋ผ๋ ๋ฐ์ดํฐ์ ์ ๊ณต๊ฐํ์ฃ !
๊ตฌ๋ถ | ํ๊ณ ๋ด์ฉ | ์ํฅ ๋ฐ ๋ฌธ์ ์ |
---|---|---|
๐งต ์ธ๋ฐํ ์ ๋ณด ๋ถ์กฑ | ์ผ๋ฐ์ ์ธ ์ฅ๋ฉด ๋ฌ์ฌ ์์ฃผ (COCO, LAION ๋ฑ), ์ธ๋ถ ๊ฐ์ฒดยท์์ฑยท์์น ์ ๋ณด๊ฐ ๋ถ์กฑ | ์ ๊ตํ ์๊ฐ-์ธ์ด ์ ๋ ฌ ํ์ต ์ด๋ ค์ |
๐ฆ ๋ฐ์ดํฐ ๊ท๋ชจ์ ํ๊ณ | FineCLIP (250๋ง์), LongCLIP (100๋ง์) โ ์ฌ์ ํ LAION ๋ฑ์ ๋นํด ์ ์ ๊ท๋ชจ | ๋๊ท๋ชจ ์ฌ์ ํ์ต ๋๋น ํํ๋ ฅ ๋ฐ ์ผ๋ฐํ ๋ฅ๋ ฅ ๋ถ์กฑ |
๐ง ์๋ ๋ผ๋ฒจ๋ง ๋ ธ์ด์ฆ | ๊ฐ์ฒด ํ์ง ๊ธฐ๋ฐ pseudo-label์ ํจ์จ์ ์ด๋ ๋ผ๋ฒจ ํ์ง ํธ์ฐจ๋ก ์ธํ ๋ ธ์ด์ฆ ๊ฐ๋ฅ์ฑ ์กด์ฌ | ํ์ต ์ ํ๋ ์ ํ, ๋ฏธ์ธ ์ ๋ ฌ ์ค๋ฅ ๋ฐ์ ๊ฐ๋ฅ |
โ Hard Negative ์ํ ๋ถ์กฑ | ๋๋ถ๋ถ ๊ตฌ๋ณ ์ฌ์ด ์์ฑ ์ํ ์ค์ฌ ๊ตฌ์ฑ, ์ด๋ ค์ด ์์ฑ ์ํ ๋ถ์กฑ | ์ ์ฌํ ์ ๊ฐ ๋ฏธ์ธํ ์ฐจ์ด ๊ตฌ๋ถ ํ์ต ์ด๋ ค์, ์ธ๋ฐํ ์ธ์ ์ฑ๋ฅ ์ ํ |
๊ธฐ์กด์ ์กด์ฌํ๋ CLIP ํ์์ ์ฐ๊ตฌ๋ค๊ณผ ๊ทธ ํ๊ณ!
๐ง 1. CLIPSelf (ICLR 2024)
CLIP์ ๊ฐ์ง๊ณ DINO ์ฒ๋ผ ์๊ธฐ์ง๋ ํ์ต!!
์กฐ๊ธ ๋ ์์ธํ๋, ํ ์คํธ์ชฝ์ ์คํตํ๊ณ ์ด๋ฏธ์ง์ ๋ํ ํํ๋ ฅ์ ๊ฐํ!
๋น์ทํ ์ด๋ฏธ์ง๋ ๋น์ทํ ์๋ฒ ๋ฉ์ ๊ฐ๋๋ก!!
- ๋ชฉํ: CLIP์ ์ด๋ฏธ์ง ํํ์ ์๊ธฐ์ง๋ ํ์ต(self-supervised)์ ์ถ๊ฐํ์ฌ ์ฑ๋ฅ ํฅ์.
- ํต์ฌ ๊ธฐ๋ฒ:
- ๊ธฐ์กด CLIP์ ๊ตฌ์กฐ ์ ์ง.
- ์ด๋ฏธ์ง ํน์ง์์ ์๊ธฐ ์์ธก(pretext task)์ ํตํด ์ ์ ๋ ํํ ํ์ต.
- ์ฅ์ : ๋ผ๋ฒจ ์์ด๋ ๋ ์ ๊ตํ๊ณ ์ผ๋ฐํ๋ ์๊ฐ ํํ ํ๋ ๊ฐ๋ฅ.
- ํ๊ณ: ํ ์คํธ ์ ๋ณด๋ฅผ ํ์ฉํ์ง ์๊ธฐ ๋๋ฌธ์ ๋ฉํฐ๋ชจ๋ฌ ์ ๋ ฌ์ด๋ ์ธ์ด ๊ธฐ๋ฐ reasoning ์ฑ๋ฅ ํฅ์์๋ ํ๊ณ
๐ฏ 2. FineCLIP (NeurIPS 2024)
์ธ๋ถ ๊ฐ์ฒด-๋ฌธ์ฅ ๋์์ ๊ฐํ์์ผ์
part-level, attribute-level ํํ๋ ฅ์ ํฅ์์ํด!!
๊ธฐ์กด์๋ ๊ฐ๋ฐฉ ๊น์ง๋ง ์ดํดํ๋ค๋ฉด ์ด์ ๋ ธ๋๊ฐ๋ฐฉ! ๋ฑ ์ธ๋ถ์ ์ธ๊ฒ๋ ์ดํดํด!!
- ๋ชฉํ: CLIP์ coarseํ ํ ์คํธ์ ๊ธฐ๋ฐํ ํ๊ณ๋ฅผ ๊ทน๋ณตํ๊ณ , fine-grained ์๊ฐ-์ธ์ด ํํ ๊ฐํ.
- ํต์ฌ ๊ธฐ๋ฒ:
- ๊ฐ์ฒด ๊ฒ์ถ๊ธฐ๋ฅผ ์ด์ฉํด region-level ์ ๋ณด์ CLIP ์๋ฒ ๋ฉ ์ ๋ ฌ.
- ๋ค๋จ๊ณ ์ ๋ ฌ ํ์ต (๊ฐ์ฒด, ๋ฌธ์ฅ, ์ด๋ฏธ์ง ์์ค).
- ์ฅ์ : ์ธ๋ถ ๊ฐ์ฒด ์ธ์ ๋ฐ ์ธ๋ฐํ ํ ์คํธ ๋งคํ ์ฑ๋ฅ ๊ฐํ.
- ํ๊ณ
- ์คํ๋๋ฉ์ธ ์ฅ๋ฉด์ด๋ ๋ฏธํ์ /์ถ์์ ์ด๋ฏธ์ง์ ๋ํ ์ผ๋ฐํ๊ฐ ์ด๋ ค์.
- ๋ํ, top-down region ์ ํ์ผ๋ก ์ธํ ํํ ํธํฅ์ ๊ฐ๋ฅ์ฑ๋ ์กด์ฌํจ.
๐ฅ 3. LLaVA (Large Language and Vision Assistant) (NeurIPS 2023)
์ฐ๋ฆฌ์๊ฒ ์ด์ ์ต์ํด์ง ๋น์ ๋ชจ๋ธ(Llama-Vision, qwen2.5VL)์ ์์กฐ์ ๋๋!
- ๋ชฉํ: GPT ๊ธฐ๋ฐ LLM์ ์๊ฐ ์ ๋ณด ํด์ ๋ฅ๋ ฅ์ ๋ถ์ฌํ ๋ฉํฐ๋ชจ๋ฌ ์ด์์คํดํธ ๊ฐ๋ฐ.
- ํต์ฌ ๊ธฐ๋ฒ:
- CLIP Vision Encoder + LLM (์: Vicuna) ์ฐ๊ฒฐ.
- ์ด๋ฏธ์ง โ ์์ฐ์ด ๋ํ๊ฐ ๊ฐ๋ฅํ ๋ฉํฐ๋ชจ๋ฌ ํ๋กฌํํธ ์ฒ๋ฆฌ.
- ์ฅ์ :
- ๋ํํ ๋น์ ์ดํด ์์คํ ๊ตฌ์ถ ๊ฐ๋ฅ.
- ChatGPT ์ ์ฌํ UX ์ ๊ณต + ์ด๋ฏธ์ง ์ธ์ ๊ธฐ๋ฅ ํตํฉ.
- ํ๊ณ: ๊ณ ํ์ง ์ด๋ฏธ์ง-ํ ์คํธ alignment ๋ฐ์ดํฐ ์์กด๋๊ฐ ๋๊ณ , ์ค์ ์๊ฐ reasoning ๋ฅ๋ ฅ์ ์ ํ์ ์.
๐งพ 4. LongCLIP (ECCV 2024)
์งง์ ํ ์คํธ๋ง ๊ฐ๋ฅํ๋ CLIP์ ํ ์คํธ ์ธ์ฝ๋๋ฅผ ์ ๊ทธ๋ ์ด๋ ํ๊ณ ํ์ต์์ผ์!!
๊ธด๋ฌธ์ฅ๋ CLIP์์ ๋ฐ์๋๋ฆด ์ ์๋๋ก ํจ!
- ๋ชฉํ: CLIP์ ์งง์ ํ ์คํธ ์ค์ฌ ํ๊ณ๋ฅผ ๊ทน๋ณตํ๊ณ , ์ฅ๋ฌธ ์บก์ ๊ธฐ๋ฐ์ ์ ๊ตํ ์๊ฐ-์ธ์ด ์ ๋ ฌ ์คํ.
- ํต์ฌ ๊ธฐ๋ฒ:
- ๋๊ท๋ชจ ์ฅ๋ฌธ ์ด๋ฏธ์ง-์บก์ ์์ ํ์ฉํ ํ์ต.
- CLIP์ ํ ์คํธ ์ธ์ฝ๋๋ฅผ ์ฅ๋ฌธ ์ ํฉ ๊ตฌ์กฐ๋ก ํ์ฅ.
- ์ฅ์ :
- ์คํ ๋ฆฌ, ์ค๋ช ์ค์ฌ ์ด๋ฏธ์ง ์ดํด์์ ์ฐ์ํ ์ฑ๋ฅ ๋ฐํ.
- Zero-shot ์ธ์ ๋ฐ ๋ฌธ๋งฅ ์ดํด ๋ฅ๋ ฅ ํฅ์.
- ํ๊ณ: ์ฅ๋ฌธ noise + ์ธ์ฝ๋ ๋ถํ, ํต์ฌ ํํ ์ ๋ ฌ ์ด๋ ค์
๐ FG-CLIP ๋ชจ๋ธ ๊ตฌ์กฐ!
- FG-CLIP์ CLIP์ dual-encoder ๊ตฌ์กฐ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ์ฅ๋๋ฉฐ, ๋ ๋จ๊ณ๋ก ํ์ต๋ฉ๋๋ค!
- Stage1 ์์๋ CLIP ์ฒ๋ผ ์ด๋ฏธ์ง-ํ ์คํธ์ ์๋ฏธ์ฐ๊ฒฐ ์์ ์,
- Stage2 ์์๋ 1๋จ๊ณ์ ํจ๊ป(Stage2-3) ์ด๋ฏธ์ง ๋ด์ ์ง์ญ ์ ํ(Stage2-1) + Negative Samples Learning(Stage2-2) ๋ฅผ ์งํํฉ๋๋ค!
Stage1 : ์ด๋ฏธ์ง-ํ ์คํธ์ ์๋ฏธ์ฐ๊ฒฐ ์์ : Global Contrastive Learning
- ์ด๋ฏธ์ง์ ํ ์คํธ์ ์ ์ญ์ ์๋ฏธ ์ ๋ ฌ์ ์ํ
- ๊ธด ์บก์ (long captions)๊ณผ ์งง์ ์บก์ (short captions)์ ๋ชจ๋ ํ์ฉํ์ฌ, ๋์ ์๋ฏธ ์คํํธ๋ผ์ ํ์ต
- ๊ธด ๋ฌธ์ฅ์ ๋ณต์กํ ์๋ฏธ, ์งง์ ๋ฌธ์ฅ์ ๊ธฐ๋ณธ ๊ฐ๋ ํ์ ์ ๋์์ ์ค
โ ์ธ๋ถ ๊ตฌํ ์ฌํญ (Implementation Details)
- ๋ฐ์ดํฐ ๊ท๋ชจ: 16์ต(1.6B) ์ด๋ฏธ์ง-ํ ์คํธ ์ ์ฌ์ฉ (๊ฐ๊ฐ long + short caption ํฌํจ)
- ๋ชจ๋ธ ์ด๊ธฐํ: ๊ธฐ์กด CLIP ๊ฐ์ค์น๋ก ์์
- Vision Backbone: ViT-B / ViT-L ๋ ๊ตฌ์ฑ ์คํ
- Optimizer:
AdamW
- Learning rate:
1e-4
- Weight decay:
0.05
- ฮฒ1:
0.9
, ฮฒ2:0.98
- Learning rate:
- ํ์ต ์ค์ผ์ค: ์ด๊ธฐ 200 step warmup
- ๋ฐฐ์น ํฌ๊ธฐ: NPU ๋น 384
- ์จ๋ ํ๋ผ๋ฏธํฐ (ฯ):
0.07
(ํ์ต ๊ฐ๋ฅํ ๋ณ์) - ์ ๋ฐ๋:
BFloat16
์ฌ์ฉ - ์ต์ ํ ๊ธฐ๋ฒ: DeepSpeed์
Zero-2
์ ์ฉ - ํ์ต ํ์: ์ ์ฒด 1 epoch๋ง ์ํ (๋๊ท๋ชจ ๋ฐ์ดํฐ๋ก๋ ์ถฉ๋ถ)
Stage2 : ์ด๋ฏธ์ง ๋ด์ ์ง์ญ ์ ํ(2-1) + Negative Samples Learning(2-2) + Stage1 ๋ฐ๋ณต
2-1. ๐ Regional Contrastive Learning (L_regional)
- ์ด๋ฏธ์ง ๋ด๋ถ์ ํน์ ์์ญ์ ๋์ํ๋ ํ ์คํธ ์กฐ๊ฐ๊ณผ ์ ๋ ฌ
- ์ด๋ฏธ์ง์ bounding box๋ณ ํน์ง์ ์ถ์ถ(RoIAlign ์ฌ์ฉ), ํด๋น ๊ตฌ์ญ์ ํ ์คํธ ํํ๊ณผ ์ฐ๊ฒฐ
- ์ธ๋ฐํ ์๊ฐ-์ธ์ด์ ์๋ฏธ ๋์ ๋ฅ๋ ฅ ๊ฐํ
2-2. โ ๏ธ Hard Fine-Grained Negative Samples Learning (L_hard)
- ์๋ฏธ์ ์ผ๋ก ์ ์ฌํ์ง๋ง ์ค์ ๋ก๋ ๋ค๋ฅธ ํ๋ ๋ถ์ ์ํ(hard negatives)์ ์์ฑํด ํ์ต
- ์ ๋ต ์ค๋ช ์์ ์์ฑ์ ๋ณ๊ฒฝํด ๋ฏธ๋ฌํ ์ฐจ์ด์ ์ ๊ฐ์ง ์ํ์ ๊ตฌ์ฑ
- ๋ชจ๋ธ์ด ์ ์ฌํ์ง๋ง ๋ค๋ฅธ ์ํ์ ๊ตฌ๋ณํ ์ ์๊ฒ ๋์ fine-grained ์ธ์๋ ฅ์ ๊ทน๋ํ
2-3 Stage1์ ๋ฐ๋ณต (L_global)
- ๋ ๋ฒ์งธ ๋จ๊ณ์์๋ ๋ค์๊ณผ ๊ฐ์ ํตํฉ ์์ค ํจ์๋ฅผ ํตํด ์ธ ๊ฐ์ง ํ์ต ์์๋ฅผ ์กฐํฉํฉ๋๋ค:
1
L = L_global + ฮฑ ยท L_regional + ฮฒ ยท L_hard
- ฮฑ = 0.1 (์ง์ญ ์ ๋ ฌ ๋น์ค)
- ฮฒ = 0.5 (ํ๋ ๋ถ์ ์ํ ๋น์ค)
โ ์ธ๋ถ ๊ตฌํ ์ฌํญ (Implementation Details)
- ๋ฐ์ดํฐ ๊ท๋ชจ:
- ์ด 1,200๋ง ์ฅ ์ด๋ฏธ์ง
- ํฌํจ ์ ๋ณด:
- ์งง์ ์บก์ (short caption)
- ๊ธด ์บก์ (long caption)
- ์ ๋ฐํ ์๊ฐ์ ์ ๋ ฌ(visual grounding) ์ฃผ์
- Hard Fine grained Negative Sample
- ๋ชจ๋ธ ์ด๊ธฐํ: 1๋จ๊ณ(Global Contrastive Learning) ํ์ต ๊ฒฐ๊ณผ๋ฅผ ์ด๊ธฐ ๊ฐ์ค์น๋ก ์ฌ์ฉ
- Optimizer:
AdamW
- Learning rate:
1e-6
- Weight decay:
0.001
- ฮฒ1:
0.9
, ฮฒ2:0.98
- Learning rate:
- Warmup ๋จ๊ณ: ์ด๊ธฐ 50 step
- ๋ฐฐ์น ํฌ๊ธฐ: GPU๋น 512
- ํ์ต ์ต์ ํ ๊ธฐ๋ฒ:
DeepSpeed Zero-2
์ต์ ํCUDA TF32
์ฐ์ฐ ๊ฐ์ ์ฌ์ฉBFloat16
์ ๋ฐ๋ ์ ์ฉ
- ํ์ต ํ์: ์ ์ฒด 1 epoch ์ํ
๐ FG-CLIP์ ๋ฐ์ดํฐ
FG-CLIP์ ์ ๊ตํ ์ด๋ฏธ์ง-ํ
์คํธ ์ ๋ ฌ์ ์ํด ๋ฐฉ๋ํ ์์ ๊ณ ํ์ง ๋ฐ์ดํฐ์
์ ๊ตฌ์ฑํ๊ณ ํ์ฉํฉ๋๋ค.
๋ฐ์ดํฐ๋ ํฌ๊ฒ ๋ ๊ฐ์ง ๋จ๊ณ๋ก ๋๋๋ฉฐ, ๊ฐ๊ฐ์ ๋ชฉ์ ์ ๋ง๊ฒ ์ต์ ํ๋์ด ์์ต๋๋ค.
๐ Stage1: LAION-2B ๋ฆฌ์บก์ ๋ (Global Contrastive Pretraining)
์ ๊ธฐํ์ ์ Nvidia GPU๊ฐ ์๋๋ผ Huawei์ NPU๋ฅผ ์ฌ์ฉํ๋ค!!?
- ๊ธฐ์กด LAION-2B ๋ฐ์ดํฐ์ ์ โa birdโ์ฒ๋ผ ์ผ๋ฐ์ ์ด๊ณ ๋จ์ํ ์ค๋ช ์ด ๋ง์ ์ ๋ฐ ํ์ต์ ํ๊ณ๊ฐ ์์.
- ์ด๋ฅผ ๋ณด์ํ๊ธฐ ์ํด CogVLM2-19B ๋ํ ๋ฉํฐ๋ชจ๋ฌ ๋ชจ๋ธ์ ์ฌ์ฉ, ๋ชจ๋ ์ด๋ฏธ์ง์ ๋ํด ์ ๊ตํ๊ณ ๋ฌธ๋งฅ์ด ํ๋ถํ ์บก์ (recaptions)์ ์๋ก ์์ฑ
- ์์:
- ๊ธฐ์กด:
"a bird"
- ๊ฐ์ :
"a red-winged blackbird perched on a tree branch in a park"
- ๊ธฐ์กด:
- ์ ์ฒด 20์ต ์ด๋ฏธ์ง์ ๋ํด ๋ฆฌ์บก์ ๋์ ์ํํ๋ฉฐ, 160ร910B NPU ํด๋ฌ์คํฐ๋ก 30์ผ๊ฐ ์ฒ๋ฆฌ๋จ.
- ์๊ฑฐ ์คํ ๊ฒฐ๊ณผ, ์ด๋ฌํ ์ ์ ๋ ์ค๋ช ์ ๋ค์ํ ๋ค์ด์คํธ๋ฆผ ์์ ์์ ์ฑ๋ฅ์ ํฌ๊ฒ ํฅ์์ํด.
๐ฆ Stage2: FineHARD ๋ฐ์ดํฐ์ ๊ตฌ์ถ (Regional + Hard Negative ํ์ต)
FG-CLIP์ ํต์ฌ ํ์ต ๋ฐ์ดํฐ์ ์ธ FineHARD๋ ์ธ ๊ฐ์ง ๊ตฌ์ฑ์์๋ก ๊ตฌ์ถ!!
๊ตฌ์ฑ ์์ | ์๋ |
---|---|
์ ์ ๋ ์ด๋ฏธ์ง ์บก์ (์ ์ฒด ์ด๋ฏธ์ง ์ค๋ช ) | 12,000,000 (1,200๋ง ์ฅ) |
Region-level ์ค๋ช (bounding boxes) | 40,000,000 (4์ฒ๋ง ๊ฐ) |
Hard negative ์ํ | 10,000,000 (์ฒ๋ง ๊ฐ) |
์ ์ฒด ๊ตฌ์ถ ์์ ์๊ฐ | 7์ผ (910B NPU ํด๋ฌ์คํฐ) |
โ ์ ๋ฐ Region-Text ์ ๋ ฌ (Visual Grounding)
- GRIT ์ด๋ฏธ์ง๋ฅผ ๊ธฐ๋ฐ์ผ๋ก, CogVLM2-19B๋ก ์ ์ฒด ์ด๋ฏธ์ง ์บก์ ์์ฑ.
- SpaCy๋ฅผ ํ์ฉํ์ฌ ์บก์ ์์ ์ง์ ํํ(referring expressions) ์ถ์ถ.
- ์ด๋ฅผ YOLO-World ๊ฐ์ฒด ํ์ง ๋ชจ๋ธ์ ์ ๋ ฅํ์ฌ ํด๋นํ๋ bounding box ์ถ์ถ.
- Confidence โฅ 0.4, NMS ์ ์ฉ ํ์ฌ
- 1,200๋ง ๊ฐ ์ด๋ฏธ์ง
- 4์ฒ๋ง ๊ฐ ๋ฐ์ด๋ฉ ๋ฐ์ค
- ๊ฐ ์์ญ์ ๋ํ ์ ๋ฐ ์ค๋ช (region captions) ํ๋ณด
โก ํ๋ ๋ค๊ฑฐํฐ๋ธ ์ํ ์์ฑ (Hard Negative Mining)
- ์ ๋ต ์ค๋ช ์์ ์์ฑ๋ง ๋ณ๊ฒฝํ๊ณ ๊ฐ์ฒด๋ช ์ ๊ทธ๋๋ก ์ ์งํ๋ ๋ฐฉ์์ผ๋ก ๋ถ์ ์ํ ์์ฑ.
- LLaMA-3.1-70B ๋ชจ๋ธ์ ์ฌ์ฉํด ๊ฐ ์์ฑ ์ํ๋น 10๊ฐ์ ํ๋ ๋ค๊ฑฐํฐ๋ธ ์์ฑ.
- ํน์๊ธฐํธ(์ธ๋ฏธ์ฝ๋ก , ์ค๋ฐ๊ฟ ๋ฑ) ์ ๊ฑฐํด ๋ฌธ์ฅ ์ ์ .
- ํ์ง ์ ๊ฒ ๊ฒฐ๊ณผ:
- 98.9% ์ํ์ด ์ ํจ
- 1.1%๋ง ์ก์์ผ๋ก ํ์ธ โ ๋น์ง๋ ๋ฐฉ์ ๊ธฐ์ค ์ฐ์ํ ํ์ง
- ์์:
- Positive :
"a man in a blue striped shirt"
- Negative :
"a man in a red checkered shirt"
- Positive :
๐ฏ Stage ๋ณ๋ก์ ์ฑ๋ฅ์!?(Ablation Test)
์๋ ๋
ผ๋ฌธ์์ ์ ์๋ ablation Test ๊ฒฐ๊ณผ์
๋๋ค!
์ฐ์ ๊ธฐ๋ณธ์ ์ผ๋ก Stage1, ๊ธด ๋ฌธ์ฅ๊ณผ ์งง์ ๋ฌธ์ฅ์ ๋ชจ๋ ์ฌ์ฉํ ํ
์คํธ-์ด๋ฏธ์ง ์ฐ๊ฒฐ์์
์ผ๋ก ์ด๋ฏธ ์ ์ฒด์ ์ธ ์ฑ๋ฅ๊ฐ์ ์ด ์ด๋ฃจ์ด์ก๋๋ฐ์!,
์ดํ stage ์์ Global > Regional > hard๋ฅผ ์ถ๊ฐํ ์๋ก ๋์ฑ ์ฑ๋ฅ์ด ํฅ์๋๋ฉฐ,
ํนํ ์ฐ๊ตฌ์์ ์๋์ ๋ง๊ฒ, L_regional
์ด ์ถ๊ฐ๋๋ฉด์ bbox์ ์ ํ๋๊ฐ ์ฆ๊ฐํ๊ณ , L_hard
๊ฐ ์ถ๊ฐ๋๋ฉด์ ํ
์คํธ์ ๋ํ ์ดํด๊ฐ ์ฆ๊ฐํ๊ธฐ์ Fine-Grained Understanding
์ด ํ๊ธฐ์ ์ผ๋ก ์ฆ๊ฐํ๋ค๋ ์ ์ด ์ธ์ ๊น์์ต๋๋ค!
ํํธ, short retrieval์ ์คํ๋ ค ๊ฐ์ํ๋๋ฐ,,
์ด๊ฒ์ ๊ธด ๋ฌธ์ฅ, negative๋ฅผ ํ์ตํ๋ฉฐ ํ๊ฐ๋ฆฐ๊ฒ์ธ๊ฐ? ๋ก ์์ฌ๋์๋ค!!
๐ฎ ๋๋์
์ด๋ฐ ๋ง์ ๋ฐ์ดํฐ์
์ ์ค๋นํ๋๋ฐ ๋ง์ ๊ณต์๊ฐ ํฌ์
๋ฌ์๊ฒ ๊ฐ๊ณ ..
์ฐ๊ตฌ์์ ์๋์ ๋ง๊ฒ ๊ฐ๊ฐ์ ๋ชจ๋์ด ์ ๋์ํ๋๊ฒ ๋ฉ์ ธ๋ถ๋ ๋ค!
๊ทธ๋ฆฌ๊ณ ! negative์ ํ์ต์ผ๋ก Detail์ ๋ง์ธ ๋ ์ฑ๋ฅ์ด ์ข์์ก๋ค๋๊ฒ์ด ๊ธฐ์ต์ ๋จ๋๋ค!
๋๋ ์จ๋จน์ด๋ด์ผ์ง
๋ง์ง๋ง์ผ๋ก!! Nvidia๊ฐ ์ ๋ถ์ธ์ค ์์๋๋ฐ, NPU๋ฅผ ์ฌ์ฉํ๋ค๋!! ์ธ์ ๊น๋ค!!