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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Adjective-Aware Object Embedding using CLIP, DINOv2, and Graph Neural Networks
|
| 2 |
+
|
| 3 |
+
## 1. Project Objective
|
| 4 |
+
|
| 5 |
+
Build a system that learns **adjectives associated with objects** (e.g.,
|
| 6 |
+
chairs) and reshapes the embedding space so objects cluster based on
|
| 7 |
+
attributes like:
|
| 8 |
+
|
| 9 |
+
- broken
|
| 10 |
+
- blue
|
| 11 |
+
- wooden
|
| 12 |
+
- plastic
|
| 13 |
+
- dirty
|
| 14 |
+
- metal
|
| 15 |
+
|
| 16 |
+
Encoders used: - CLIP Vision Encoder - DINOv2 Vision Encoder - Graph
|
| 17 |
+
Neural Network layer for attribute reasoning
|
| 18 |
+
|
| 19 |
+
------------------------------------------------------------------------
|
| 20 |
+
|
| 21 |
+
## 2. System Architecture
|
| 22 |
+
|
| 23 |
+
Image │ ├── CLIP Encoder ├── DINOv2 Encoder │ └── Feature Fusion │ ▼
|
| 24 |
+
Object Embedding │ ▼ Graph Construction │ ▼ Graph Neural Network │ ▼
|
| 25 |
+
Adjective-aware embedding │ ▼ Attribute prediction
|
| 26 |
+
|
| 27 |
+
------------------------------------------------------------------------
|
| 28 |
+
|
| 29 |
+
## 3. Encoders
|
| 30 |
+
|
| 31 |
+
### CLIP Vision Encoder
|
| 32 |
+
|
| 33 |
+
Common models: - ViT-B/32 - ViT-L/14
|
| 34 |
+
|
| 35 |
+
Output embedding size: 512--768
|
| 36 |
+
|
| 37 |
+
Benefits: - aligned with language - semantic understanding
|
| 38 |
+
|
| 39 |
+
### DINOv2 Encoder
|
| 40 |
+
|
| 41 |
+
Common models: - vit-small - vit-base - vit-large
|
| 42 |
+
|
| 43 |
+
Output embedding size: 768--1024
|
| 44 |
+
|
| 45 |
+
Benefits: - strong visual structure representation - self-supervised
|
| 46 |
+
learning
|
| 47 |
+
|
| 48 |
+
------------------------------------------------------------------------
|
| 49 |
+
|
| 50 |
+
## 4. Feature Fusion
|
| 51 |
+
|
| 52 |
+
clip_embedding = CLIP(image)\
|
| 53 |
+
dino_embedding = DINO(image)
|
| 54 |
+
|
| 55 |
+
combined_embedding = concat(clip_embedding, dino_embedding)
|
| 56 |
+
|
| 57 |
+
Typical dimension:
|
| 58 |
+
|
| 59 |
+
1536
|
| 60 |
+
|
| 61 |
+
------------------------------------------------------------------------
|
| 62 |
+
|
| 63 |
+
## 5. Graph Design
|
| 64 |
+
|
| 65 |
+
Graph nodes:
|
| 66 |
+
|
| 67 |
+
Object nodes\
|
| 68 |
+
Attribute nodes
|
| 69 |
+
|
| 70 |
+
Example:
|
| 71 |
+
|
| 72 |
+
Objects: chair_1 chair_2 chair_3
|
| 73 |
+
|
| 74 |
+
Attributes: blue broken wooden plastic dirty metal
|
| 75 |
+
|
| 76 |
+
Edges:
|
| 77 |
+
|
| 78 |
+
chair → blue\
|
| 79 |
+
chair → broken\
|
| 80 |
+
chair → plastic
|
| 81 |
+
|
| 82 |
+
Optional attribute relations:
|
| 83 |
+
|
| 84 |
+
plastic ↔ material\
|
| 85 |
+
blue ↔ color\
|
| 86 |
+
broken ↔ damage
|
| 87 |
+
|
| 88 |
+
------------------------------------------------------------------------
|
| 89 |
+
|
| 90 |
+
## 6. Node Features
|
| 91 |
+
|
| 92 |
+
### Object nodes
|
| 93 |
+
|
| 94 |
+
Feature = fused embedding
|
| 95 |
+
|
| 96 |
+
dimension = 1536
|
| 97 |
+
|
| 98 |
+
### Attribute nodes
|
| 99 |
+
|
| 100 |
+
Option 1 (recommended)
|
| 101 |
+
|
| 102 |
+
Use CLIP text embeddings:
|
| 103 |
+
|
| 104 |
+
"a blue chair"\
|
| 105 |
+
"a broken chair"\
|
| 106 |
+
"a wooden chair"
|
| 107 |
+
|
| 108 |
+
Option 2
|
| 109 |
+
|
| 110 |
+
Learn attribute embeddings (trainable vectors)
|
| 111 |
+
|
| 112 |
+
------------------------------------------------------------------------
|
| 113 |
+
|
| 114 |
+
## 7. GNN Model
|
| 115 |
+
|
| 116 |
+
Suggested architecture:
|
| 117 |
+
|
| 118 |
+
GATConv(input_dim,512)\
|
| 119 |
+
ReLU\
|
| 120 |
+
GATConv(512,256)\
|
| 121 |
+
Linear(256,1)
|
| 122 |
+
|
| 123 |
+
Prediction is computed from attribute nodes.
|
| 124 |
+
|
| 125 |
+
------------------------------------------------------------------------
|
| 126 |
+
|
| 127 |
+
## 8. Training Objectives
|
| 128 |
+
|
| 129 |
+
### Attribute Prediction
|
| 130 |
+
|
| 131 |
+
Multi‑label classification
|
| 132 |
+
|
| 133 |
+
Loss:
|
| 134 |
+
|
| 135 |
+
Binary Cross Entropy
|
| 136 |
+
|
| 137 |
+
Example label:
|
| 138 |
+
|
| 139 |
+
chair_1: broken=1\
|
| 140 |
+
blue=0\
|
| 141 |
+
plastic=1
|
| 142 |
+
|
| 143 |
+
### Contrastive Embedding Loss
|
| 144 |
+
|
| 145 |
+
Encourage clustering by adjectives.
|
| 146 |
+
|
| 147 |
+
Example:
|
| 148 |
+
|
| 149 |
+
Positive pair: blue chair A blue chair B
|
| 150 |
+
|
| 151 |
+
Negative pair: blue chair vs broken chair
|
| 152 |
+
|
| 153 |
+
Loss options: - Triplet loss - Contrastive loss - InfoNCE
|
| 154 |
+
|
| 155 |
+
------------------------------------------------------------------------
|
| 156 |
+
|
| 157 |
+
## 9. Datasets
|
| 158 |
+
|
| 159 |
+
### Visual Genome
|
| 160 |
+
|
| 161 |
+
\~108k images with objects, attributes, and relationships.
|
| 162 |
+
|
| 163 |
+
Example annotation:
|
| 164 |
+
|
| 165 |
+
chair → wooden\
|
| 166 |
+
chair → old
|
| 167 |
+
|
| 168 |
+
Download: https://visualgenome.org
|
| 169 |
+
|
| 170 |
+
------------------------------------------------------------------------
|
| 171 |
+
|
| 172 |
+
### Open Images V7
|
| 173 |
+
|
| 174 |
+
\~9M images with detection and attribute labels.
|
| 175 |
+
|
| 176 |
+
Example:
|
| 177 |
+
|
| 178 |
+
chair → plastic\
|
| 179 |
+
chair → old
|
| 180 |
+
|
| 181 |
+
Download: https://storage.googleapis.com/openimages/web/index.html
|
| 182 |
+
|
| 183 |
+
------------------------------------------------------------------------
|
| 184 |
+
|
| 185 |
+
### MIT States Dataset
|
| 186 |
+
|
| 187 |
+
Object‑state dataset.
|
| 188 |
+
|
| 189 |
+
Examples:
|
| 190 |
+
|
| 191 |
+
broken chair\
|
| 192 |
+
painted chair\
|
| 193 |
+
clean chair
|
| 194 |
+
|
| 195 |
+
------------------------------------------------------------------------
|
| 196 |
+
|
| 197 |
+
### SUN Attribute Dataset
|
| 198 |
+
|
| 199 |
+
Dataset containing \~102 visual attributes.
|
| 200 |
+
|
| 201 |
+
Examples:
|
| 202 |
+
|
| 203 |
+
rusty\
|
| 204 |
+
shiny\
|
| 205 |
+
old\
|
| 206 |
+
colorful
|
| 207 |
+
|
| 208 |
+
------------------------------------------------------------------------
|
| 209 |
+
|
| 210 |
+
### COCO Dataset
|
| 211 |
+
|
| 212 |
+
Object detection dataset (\~330k images).
|
| 213 |
+
|
| 214 |
+
Attributes must be manually annotated.
|
| 215 |
+
|
| 216 |
+
Download: https://cocodataset.org
|
| 217 |
+
|
| 218 |
+
------------------------------------------------------------------------
|
| 219 |
+
|
| 220 |
+
### LAION‑400M
|
| 221 |
+
|
| 222 |
+
Large image‑text dataset with captions.
|
| 223 |
+
|
| 224 |
+
Example captions:
|
| 225 |
+
|
| 226 |
+
"a broken plastic chair"\
|
| 227 |
+
"a blue chair"
|
| 228 |
+
|
| 229 |
+
Attributes can be extracted using NLP.
|
| 230 |
+
|
| 231 |
+
Download: https://laion.ai
|
| 232 |
+
|
| 233 |
+
------------------------------------------------------------------------
|
| 234 |
+
|
| 235 |
+
### ImageNet‑Attribute variants
|
| 236 |
+
|
| 237 |
+
Researchers often annotate ImageNet objects with attributes such as:
|
| 238 |
+
|
| 239 |
+
metal\
|
| 240 |
+
wooden\
|
| 241 |
+
colorful
|
| 242 |
+
|
| 243 |
+
Useful for transfer learning.
|
| 244 |
+
|
| 245 |
+
------------------------------------------------------------------------
|
| 246 |
+
|
| 247 |
+
## 10. Data Preparation
|
| 248 |
+
|
| 249 |
+
Dataset pipeline:
|
| 250 |
+
|
| 251 |
+
images ↓ object detection (chair) ↓ extract attributes ↓ build
|
| 252 |
+
object‑attribute graph
|
| 253 |
+
|
| 254 |
+
Example dataset:
|
| 255 |
+
|
| 256 |
+
dataset/ chair_001.jpg chair_002.jpg
|
| 257 |
+
|
| 258 |
+
labels:
|
| 259 |
+
|
| 260 |
+
chair_001.jpg → \[blue,plastic\]\
|
| 261 |
+
chair_002.jpg → \[broken,wooden\]
|
| 262 |
+
|
| 263 |
+
------------------------------------------------------------------------
|
| 264 |
+
|
| 265 |
+
## 11. Training Pipeline
|
| 266 |
+
|
| 267 |
+
Image ↓ CLIP encoder ↓ DINOv2 encoder ↓ feature fusion ↓ graph
|
| 268 |
+
construction ↓ GNN forward pass ↓ attribute prediction ↓ loss
|
| 269 |
+
computation ↓ backpropagation
|
| 270 |
+
|
| 271 |
+
------------------------------------------------------------------------
|
| 272 |
+
|
| 273 |
+
## 12. Inference Pipeline
|
| 274 |
+
|
| 275 |
+
New Image ↓ CLIP + DINO ↓ embedding fusion ↓ graph node creation ↓ GNN
|
| 276 |
+
inference ↓ attribute scores
|
| 277 |
+
|
| 278 |
+
Example output:
|
| 279 |
+
|
| 280 |
+
broken: 0.91\
|
| 281 |
+
blue: 0.12\
|
| 282 |
+
plastic: 0.87\
|
| 283 |
+
wooden: 0.04
|
| 284 |
+
|
| 285 |
+
------------------------------------------------------------------------
|
| 286 |
+
|
| 287 |
+
## 13. Evaluation
|
| 288 |
+
|
| 289 |
+
Metrics:
|
| 290 |
+
|
| 291 |
+
- mean average precision
|
| 292 |
+
- F1 score
|
| 293 |
+
- multi‑label accuracy
|
| 294 |
+
|
| 295 |
+
Embedding analysis:
|
| 296 |
+
|
| 297 |
+
- t‑SNE
|
| 298 |
+
- UMAP
|
| 299 |
+
|
| 300 |
+
Goal: observe clusters based on adjectives.
|
| 301 |
+
|
| 302 |
+
------------------------------------------------------------------------
|
| 303 |
+
|
| 304 |
+
## 14. Future Extensions
|
| 305 |
+
|
| 306 |
+
Graph Transformer instead of GNN.
|
| 307 |
+
|
| 308 |
+
Scene graph learning:
|
| 309 |
+
|
| 310 |
+
chair → broken → leg
|
| 311 |
+
|
| 312 |
+
LLM integration to generate descriptions:
|
| 313 |
+
|
| 314 |
+
"This is a broken blue plastic chair."
|
| 315 |
+
|
| 316 |
+
------------------------------------------------------------------------
|
| 317 |
+
|
| 318 |
+
## 15. Deliverables
|
| 319 |
+
|
| 320 |
+
- adjective aware embedding model
|
| 321 |
+
- attribute prediction model
|
| 322 |
+
- graph dataset
|
| 323 |
+
- clustering visualizations
|
| 324 |
+
|
| 325 |
+
------------------------------------------------------------------------
|
| 326 |
+
|
| 327 |
+
## 16. Summary
|
| 328 |
+
|
| 329 |
+
The system combines:
|
| 330 |
+
|
| 331 |
+
CLIP semantic features\
|
| 332 |
+
DINOv2 visual features\
|
| 333 |
+
Graph neural network reasoning
|
| 334 |
+
|
| 335 |
+
to produce an **embedding space structured by object adjectives**.
|