DINOv2
Meta's DINOv2: self-supervised image features (patch and class tokens) in four sizes, with and without register tokens. Commercially usable.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
dinov2-vits14 | synthetic (224x224) | original (fp32) original portable kernels | 3.30 4.40 2.95 0.848 | 121 / 132 160 / 166 79 / 98 112 / 148 |
dinov2-vits14-reg | synthetic (224x224) | original (fp32) original portable kernels | 4.11 5.59 2.98 0.814 | 121 / 132 160 / 168 80 / 98 112 / 142 |
dinov2-vitb14 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 6.90 4.50 2.92 1.48 2.20 1.30 | 371 / 386 530 / 548 205 / 226 237 / 290 240 / 266 198 (engine) |
dinov2-vitb14-reg | synthetic (224x224) | original (fp32) original portable kernels | 7.00 4.30 2.94 1.50 | 371 / 386 530 / 548 207 / 226 237 / 288 |
dinov2-vitl14 | synthetic (224x224) | original (fp32) original portable kernels | 22.8 9.80 6.12 4.59 | 1205 / 1224 1777 / 1784 622 / 646 655 / 714 |
dinov2-vitl14-reg | synthetic (224x224) | original (fp32) original portable kernels | 22.5 10.7 6.17 4.60 | 1205 / 1226 1777 / 1786 625 / 646 655 / 714 |
dinov2-vitg14 | synthetic (224x224) | original (fp32) original portable kernels | 86.4 33.9 18.9 13.2 | 4389 / 4406 6542 / 6548 2216 / 2230 2246 / 2318 |
dinov2-vitg14-reg | synthetic (224x224) | original (fp32) original portable kernels | 86.6 34.2 18.7 13.0 | 4389 / 4406 6542 / 6568 2217 / 2228 2222 / 4430 |
Details
- Original code: https://github.com/facebookresearch/dinov2 at
7764ea0 - Code licence: Apache-2.0 (permissive); files:
LICENSE - Weights licence: Apache-2.0
- Licence evidence: https://github.com/facebookresearch/dinov2/blob/7764ea0/README.md (License section: code and model weights under Apache 2.0)
- Training data: LVD-142M: 142M images retrieved from web crawls by similarity to curated datasets (ImageNet-22k/1k train, Google Landmarks, fine-grained sets), self-supervised (no labels), per the paper; not released
- Options:
fp16_accumulate= False (precision only) - Kernel libraries:
fastbb - Variants:
dinov2-vits14,dinov2-vits14-reg,dinov2-vitb14,dinov2-vitb14-reg,dinov2-vitl14,dinov2-vitl14-reg,dinov2-vitg14,dinov2-vitg14-reg - Outputs: last_hidden_state, pooler_output, hidden_states
- Input size: any H x W >= 1, resized or padded inside the model
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
dinov2-vits143000x4000 (0.8 GiB peak allocated, 1.2 reserved);dinov2-vits14-reg3000x4000 (0.8 GiB peak allocated, 1.2 reserved);dinov2-vitb143000x4000 (1.4 GiB peak allocated, 2.2 reserved);dinov2-vitb14-reg3000x4000 (1.4 GiB peak allocated, 2.2 reserved);dinov2-vitl143000x4000 (2.2 GiB peak allocated, 3.1 reserved);dinov2-vitl14-reg3000x4000 (2.2 GiB peak allocated, 3.1 reserved);dinov2-vitg143000x4000 (4.8 GiB peak allocated, 5.9 reserved);dinov2-vitg14-reg3000x4000 (4.8 GiB peak allocated, 5.9 reserved) dinov2-vitb14224x224, first call: portable + torch.compile 10 s (cold Inductor cache), TensorRT fp16 25 s (ONNX + engine).dinov2-vits14original 224x224: torch.autocast(fp16) around the forwarddinov2-vits14-regoriginal (fp32) 224x224, original 224x224: dinov2 forward_features CLSdinov2-vitb14original 224x224: torch.autocast(fp16) around the forwarddinov2-vitb14-regoriginal 224x224: torch.autocast(fp16) around the forwarddinov2-vitl14original 224x224: torch.autocast(fp16) around the forwarddinov2-vitl14-regoriginal (fp32) 224x224, original 224x224: dinov2 forward_features CLSdinov2-vitg14original 224x224: torch.autocast(fp16) around the forwarddinov2-vitg14-regoriginal (fp32) 224x224, original 224x224: dinov2 forward_features CLSdinov2-vits14load / first call: original 0.41 s / 0.174 s, portable 0.07 s / 0.118 s, kernels 0.07 s / 0.153 sdinov2-vits14-regload / first call: original 1.32 s / 0.107 s, portable 0.21 s / 0.126 s, kernels 0.08 s / 0.167 sdinov2-vitb14load / first call: original 1.51 s / 0.006 s, portable 0.27 s / 0.205 s, kernels 0.19 s / 0.191 sdinov2-vitb14-regload / first call: original 1.71 s / 0.035 s, portable 0.59 s / 0.042 s, kernels 0.21 s / 0.205 sdinov2-vitl14load / first call: original 7.06 s / 0.013 s, portable 0.57 s / 0.148 s, kernels 0.57 s / 0.179 sdinov2-vitl14-regload / first call: original 4.6 s / 0.068 s, portable 0.66 s / 0.113 s, kernels 0.56 s / 0.205 sdinov2-vitg14load / first call: original 19.29 s / 0.046 s, portable 4.37 s / 0.104 s, kernels 2.22 s / 0.162 sdinov2-vitg14-regload / first call: original 14.67 s / 0.089 s, portable 4.32 s / 0.033 s, kernels 2.91† s / 0.017 s- † measured in the speed sweep after the portable load (or an earlier size) in the same process: file cache and kernels are warm, so the time is lower than a fresh start.
- Protocol,
dinov2-vits14,dinov2-vits14-reg,dinov2-vitb14,dinov2-vitb14-reg,dinov2-vitl14,dinov2-vitl14-reg,dinov2-vitg14: first call, 3 warm-up, peak reset, median of 3 rounds x median of 5 - Protocol,
dinov2-vitg14-reg: median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls
Measured
Two disjoint seeded subsets of the val folders; each image shorter side 256 (bicubic), centre crop 224, the CLS / pooled feature; cosine kNN, vote weighted by similarity. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|---|---|---|---|---|---|---|
dinov2-vits14 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 59.20 | 59.22 | 59.26 | 59.16 | |
dinov2-vits14-reg | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 59.98 | 60.00 | 59.96 | 59.96 | |
dinov2-vitb14 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 67.80 | 67.76 | 67.74 | 67.78 | |
dinov2-vitb14-reg | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 69.14 | 69.18 | 69.14 | 69.18 | |
dinov2-vitl14 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 72.12 | 72.16 | 72.18 | 72.14 | |
dinov2-vitl14-reg | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 73.08 | 73.08 | 73.06 | 73.08 | |
dinov2-vitg14 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 70.64 | 70.66 | 70.64 | 70.68 | |
dinov2-vitg14-reg | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 72.60 | 72.58 | 72.60 | 72.64 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.
Parity
CPU, float32: max |diff| <= 0.0001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 2.5 % and p99 <= 12 % of the reference's median |value| (absolute error of the output last_hidden_state).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
dinov2-vits14 | 0.01036 / 0.03758 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@7d058322634d:sm_120 |
dinov2-vits14-reg | 0.00541 / 0.0198 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@7d058322634d:sm_120 |
dinov2-vitb14 | 0.01295 / 0.05042 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@7d058322634d:sm_120 |
dinov2-vitb14-reg | 0.01032 / 0.03738 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@7d058322634d:sm_120 |
dinov2-vitl14 | 0.01558 / 0.08667 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@7d058322634d:sm_120 |
dinov2-vitl14-reg | 0.01356 / 0.05036 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@7d058322634d:sm_120 |
dinov2-vitg14 | 0.00785 / 0.0449 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@7d058322634d:sm_120 |
dinov2-vitg14-reg | 0.00779 / 0.04094 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@7d058322634d:sm_120 |