File size: 8,936 Bytes
8b149c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
---
license: apache-2.0
base_model: facebook/dinov2-large
tags:
  - robotics
  - edge-deployment
  - anima
  - forge
  - int8
  - quantized
  - dinov2
  - vision
  - feature-extraction
  - self-supervised
  - ros2
  - jetson
  - real-time
library_name: transformers
pipeline_tag: feature-extraction
model-index:
  - name: dinov2-large-int8
    results:
      - task:
          type: feature-extraction
        metrics:
          - name: Model Size (MB)
            type: model_size
            value: 1461
          - name: Compression Ratio
            type: compression
            value: 1.6
          - name: Original Size (MB)
            type: original_size
            value: 2322
---

# DINOv2 ViT-Large/14 β€” INT8 Quantized

> Meta's DINOv2 self-supervised vision encoder quantized to INT8 for real-time robotic feature extraction. **1.6x smaller** β€” from 2.3 GB to 1.5 GB β€” with rich visual representations preserved for downstream robotic tasks.

This model is part of the **[RobotFlowLabs](https://huggingface.co/robotflowlabs)** model library, built for the **ANIMA** agentic robotics platform β€” a modular ROS2-native AI system that brings foundation model intelligence to real robots operating in the real world.

## Why This Model Exists

DINOv2 produces the best general-purpose visual features available β€” dense, semantic representations that transfer to any downstream task without fine-tuning. In robotics, these features power grasp prediction, place recognition, object matching, and scene similarity. But at 2.3 GB, running DINOv2-Large alongside segmentation, depth, and action models is expensive on edge GPUs.

We quantized DINOv2 to INT8 and exported to ONNX so robots get rich visual features without VRAM bottlenecks.

## Model Details

| Property | Value |
|----------|-------|
| **Architecture** | Vision Transformer (ViT-L/14) |
| **Parameters** | 304M |
| **Hidden Dimension** | 1024 |
| **Layers** | 24 transformer blocks |
| **Attention Heads** | 16 |
| **MLP Dimension** | 4096 (4x ratio) |
| **Input Resolution** | 518 Γ— 518 |
| **Patch Size** | 14 Γ— 14 |
| **Tokens** | 1,370 (37Γ—37 patches + 1 CLS) |
| **Training** | Self-supervised (no labels) on LVD-142M |
| **Original Model** | [`facebook/dinov2-large`](https://huggingface.co/facebook/dinov2-large) |
| **License** | Apache-2.0 |

## Compression Results

Quantized on an NVIDIA L4 24GB GPU using INT8 dynamic quantization with ONNX Runtime export.

| Metric | Original | INT8 Quantized | Change |
|--------|----------|----------------|--------|
| **Total Size** | 2,322 MB | 1,461 MB | **1.6x smaller** |
| **INT8 Weights** | β€” | 298 MB | Quantized linear layers |
| **ONNX Graph** | β€” | 1,163 MB | Full model with optimizations |
| **Quantization** | FP32 | INT8 Dynamic | Per-tensor symmetric |
| **Format** | PyTorch | PyTorch INT8 + ONNX | Dual format |

## Included Files

```
dinov2-large-int8/
β”œβ”€β”€ model_int8.pt              # 298 MB β€” INT8 quantized state dict
β”œβ”€β”€ model.onnx                 # 2.6 MB β€” ONNX graph structure
β”œβ”€β”€ model.onnx.data            # 1.2 GB β€” ONNX external weights
β”œβ”€β”€ config.json                # Model configuration
β”œβ”€β”€ preprocessor_config.json   # Image preprocessing config
└── README.md                  # This file
```

## Quick Start

### PyTorch (INT8 Weights)

```python
import torch
from transformers import Dinov2Model, AutoImageProcessor

# Load original architecture
model = Dinov2Model.from_pretrained("facebook/dinov2-large")

# Load INT8 quantized weights
int8_state = torch.load("model_int8.pt", map_location="cuda", weights_only=True)
model.load_state_dict(int8_state, strict=False)
model.to("cuda").eval()

# Extract features
processor = AutoImageProcessor.from_pretrained("facebook/dinov2-large")
inputs = processor(images=image, return_tensors="pt").to("cuda")
with torch.no_grad():
    outputs = model(**inputs)
features = outputs.last_hidden_state  # (1, 1370, 1024)
cls_token = outputs.last_hidden_state[:, 0]  # (1, 1024) β€” global feature
```

### ONNX Runtime (Recommended for Deployment)

```python
import onnxruntime as ort
import numpy as np

# GPU inference
session = ort.InferenceSession(
    "model.onnx",
    providers=["CUDAExecutionProvider", "CPUExecutionProvider"]
)

# Preprocess image to (1, 3, 518, 518) float32
pixel_values = preprocess(image)
outputs = session.run(None, {"pixel_values": pixel_values})
```

### With FORGE (ANIMA Integration)

```python
from forge.vision import VisionEncoderRegistry

# FORGE auto-detects INT8 weights and loads optimally
encoder = VisionEncoderRegistry.load("dinov2-large-int8")
features = encoder(image_tensor)  # (B, 1370, 1024)
```

## Use Cases in ANIMA

DINOv2 serves as the **visual representation backbone** across ANIMA modules:

- **Grasp Prediction** β€” Dense patch features for identifying graspable surfaces and grip points
- **Place Recognition** β€” CLS token matching for visual localization in mapped environments
- **Object Matching** β€” Patch-level similarity for re-identifying objects across viewpoints
- **Scene Similarity** β€” Detecting when the robot encounters familiar vs novel environments
- **Feature Conditioning** β€” Rich visual tokens fed to VLA models for action prediction
- **Affordance Detection** β€” Identifying functional properties of surfaces and objects

## About ANIMA

**ANIMA** is a modular, ROS2-native agentic robotics platform developed by [RobotFlowLabs](https://huggingface.co/robotflowlabs). It combines 58 specialized AI modules β€” from perception and planning to manipulation and safety β€” into a unified system that enables robots to understand, reason, and act in unstructured real-world environments.

### Other Collections

- **[ANIMA Vision](https://huggingface.co/collections/robotflowlabs/anima-vision-69bc77ca7ce15b06bbdd21bd)** β€” SAM2, DINOv2, CLIP, SigLIP, Depth Anything
- **[ANIMA Language](https://huggingface.co/collections/robotflowlabs/anima-language-69bc77ca29dccc3f68f8c7fd)** β€” Qwen2.5, SmolLM2
- **[ANIMA VLM](https://huggingface.co/collections/robotflowlabs/anima-vlm-69bc77ca53ae84ac21b0f012)** β€” Qwen2.5-VL
- **[ANIMA VLA](https://huggingface.co/collections/robotflowlabs/anima-vla-69bc77cbf1b8aa40002920bb)** β€” SmolVLA, RDT2-FM, FORGE students

## Intended Use

### Designed For
- Visual feature extraction for robotic manipulation and navigation
- Dense patch features for grasp prediction and affordance detection
- Scene-level representations for place recognition and mapping
- Feature backbone for downstream VLA models

### Limitations
- INT8 quantization may slightly reduce feature precision for very fine-grained tasks
- Fixed input resolution (518Γ—518) β€” images are resized/center-cropped
- Self-supervised features may not capture task-specific semantics without fine-tuning
- Inherits biases from LVD-142M training data

### Out of Scope
- Medical diagnosis without domain-specific validation
- Facial recognition or biometric identification
- Surveillance applications

## Technical Details

### Compression Pipeline

```
Original DINOv2 ViT-L/14 (FP32, 2.3 GB)
    β”‚
    β”œβ”€β†’ torchao INT8 dynamic quantization (GPU-native)
    β”‚   └─→ model_int8.pt (298 MB)
    β”‚
    └─→ torch.onnx.export (opset 18, GPU-traced)
        └─→ model.onnx + model.onnx.data (1.2 GB)
```

- **Quantization**: INT8 dynamic activation + INT8 weight via `torchao` on NVIDIA L4 GPU
- **ONNX Export**: Traced on GPU using PyTorch 2.10 dynamo-based exporter, opset 18
- **Hardware**: NVIDIA L4 24GB, CUDA 13.0, Python 3.14

## Attribution

- **Original Model**: [`facebook/dinov2-large`](https://huggingface.co/facebook/dinov2-large) by Meta AI (FAIR)
- **License**: [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) β€” free for commercial and research use
- **Paper**: [DINOv2: Learning Robust Visual Features without Supervision](https://arxiv.org/abs/2304.07193) β€” Oquab et al., 2023
- **Dataset**: LVD-142M β€” 142M curated images
- **Compressed by**: [RobotFlowLabs](https://huggingface.co/robotflowlabs) using [FORGE](https://github.com/robotflowlabs/forge)

## Citation

```bibtex
@article{oquab2023dinov2,
  title={DINOv2: Learning Robust Visual Features without Supervision},
  author={Oquab, Maxime and Darcet, Timoth{\'e}e and Moutakanni, Th{\'e}o and Vo, Huy and Szafraniec, Marc and Khalidov, Vasil and Fernandez, Pierre and Haziza, Daniel and Massa, Francisco and El-Nouby, Alaaeldin and others},
  journal={arXiv preprint arXiv:2304.07193},
  year={2023}
}
```

```bibtex
@misc{robotflowlabs2026anima,
  title={ANIMA: Agentic Networked Intelligence for Modular Autonomy},
  author={RobotFlowLabs},
  year={2026},
  url={https://huggingface.co/robotflowlabs}
}
```

---

<p align="center">
  <b>Built with FORGE by <a href="https://huggingface.co/robotflowlabs">RobotFlowLabs</a></b><br>
  Optimizing foundation models for real robots.
</p>