Foundations to Frontier
Tests
G. Computer Vision and Remote Sensing › G3 Modern Vision Architectures

DINOv2 and DINOv3: self-supervised visual foundation features

DINOv2 (Oquab and colleagues, 2023) and DINOv3 (Siméoni and colleagues, 2025) turned self-distillation into general-purpose visual features that work frozen: a linear layer on top gives strong classification, segmentation, depth and retrieval, with no labels or captions in pre-training. The DINO page explains the self-distillation mechanics; this page covers what made the scaled versions work. They combine an image-level DINO loss with iBOT's masked patch loss, Sinkhorn-Knopp centring and the KoLeo spreading term. Data is curated automatically (142M images for DINOv2, 1.7B balanced with hierarchical k-means for DINOv3). Register tokens remove attention artefacts, and DINOv3's Gram anchoring keeps patch features clean during long training of a 7B model, which is then distilled into smaller ones. In the exercises you implement KoLeo, Sinkhorn-Knopp centring, artefact-token detection and the Gram anchoring loss. You then pre-train linear self-supervised features on a long-tailed pool in which 4 of 40 concepts hold 73% of the images. With 1000 images, k-means-balanced curation lifted a frozen 5-shot probe from 0.777 (random subset) to 0.875, as good as the full pool of 8000 (0.868). It removed only part of the imbalance, and a naive two-level variant did not help reliably.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Features you can use without retraining

DINOv2 and DINOv3 learn to see from billions of unlabelled photos by playing a matching game with themselves: two crops of the same picture should get the same description. The result is a network whose outputs you can use as they are: put a small classifier or a simple decoder on top and it can find objects, separate regions or estimate depth. A surprising amount of the success comes from choosing the training photos carefully. The internet has endless photos of a few things and few photos of most things, and a model trained on that skew learns the common things well and the rare ones badly. The demo shows how balancing a long-tailed collection changes what the model sees.

Vision architecture lab
6000 images over 40 concepts (light blue bars); the 4 most common concepts hold 59% of the pool. Capping at 50 per concept (orange bars) cuts their share to 12%. Real pipelines cap per k-means cluster because concepts are unknown.
Why engineers care

DINOv3 includes a model trained on 493 million satellite images; frozen DINO features already drive canopy-height mapping, crop segmentation and robot navigation with only small trained heads.

📝 Quick check (Level 0)
0/3 answered
  1. 1. DINOv2 and DINOv3 are pre-trained with…
  2. 2. Their features are typically used…
  3. 3. Data curation tries to fix…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

What made DINO scale (2023–2025)

  • Objectives (DINOv2): the DINO image-level self-distillation loss on class tokens of global and local crops; iBOT’s masked-image loss, where the student predicts the teacher’s prototype assignments for masked patch tokens; Sinkhorn-Knopp centring of the teacher instead of a running mean; the KoLeo regulariser, which spreads features by penalising small nearest-neighbour distances.
  • Data (DINOv2): LVD-142M, built from 1.2B web images by deduplication and retrieval of images close to curated seed datasets; ViT-g/14 (1.1B parameters) trained on it and distilled into ViT-S, B and L; a short final phase at 518 px.
  • Registers (Darcet et al., ICLR 2024): large, long-trained ViTs repurpose low-information background patches as global scratch space; those tokens get very high norms and spoil attention maps. Adding a few learnable register tokens gives them a place to go and cleans the patch features.
  • DINOv3 (Siméoni et al., 2025): ViT-7B/16 with RoPE trained on LVD-1689M, 1.7B images selected from about 17B by hierarchical k-means balancing plus retrieval; Gram anchoring keeps the patch-similarity (Gram) matrix close to that of an earlier checkpoint, because dense features degrade over very long training; high-resolution adaptation; distillation into ViT-S to ViT-H+ and ConvNeXt models; a satellite model trained on 493M Maxar images.
  • Curation algorithm: Vo et al. (2024) showed that k-means centroids follow data density, so frequent concepts get most clusters; hierarchical k-means with resampling and balanced sampling across the hierarchy gives a more uniform concept distribution.
  • Use: frozen backbone plus a linear head (classification uses the class token concatenated with the mean patch token), a linear or DPT head for depth, k-NN retrieval, patch-level correspondence; Web-SSL (Fan et al., 2025) showed that language-free SSL also scales to match CLIP on visual question answering.
📝 Quick check (Level 1)
0/3 answered
  1. 1. iBOT's loss in DINOv2 works on…
  2. 2. Register tokens remove…
  3. 3. Gram anchoring constrains…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Using DINO features

Exercise 1.

  • KoLeo, the nearest-neighbour spreading loss.
  • Sinkhorn-Knopp centring of teacher scores.
  • Finding high-norm artefact tokens.
  • DINOv3’s Gram anchoring loss.

Practice.

  • Load a model with registers (dinov2_vitl14_reg) or DINOv3; use patch features at the highest resolution you can afford (multiples of the patch size).
  • Start frozen: linear probe on class plus mean patch tokens, linear segmentation head on patch tokens, k-NN for retrieval; fine-tune only if a frozen head falls short.
  • For your own SSL pre-training on domain data (satellite, medical, industrial), curate first: embed with an existing model, cluster hierarchically, sample evenly across clusters, deduplicate.
  • Check the licence: DINOv2 is Apache 2.0; DINOv3 uses its own licence.
  • Visualise PCA of patch features: clean, object-aligned colours are a quick sanity check of the backbone at your resolution.
import torch
from transformers import AutoImageProcessor, AutoModel
from PIL import Image
proc = AutoImageProcessor.from_pretrained("facebook/dinov2-with-registers-large")
model = AutoModel.from_pretrained("facebook/dinov2-with-registers-large").eval()
x = proc(images=Image.open("scene.png"), return_tensors="pt")
with torch.no_grad():
    h = model(**x).last_hidden_state            # [CLS, 4 registers, patches...]
cls, patches = h[:, 0], h[:, 5:]
feat = torch.cat([cls, patches.mean(1)], -1)    # input to a linear probe
🐍 Exercise 1: DINOv2/v3 building blocks
Implement KoLeo, Sinkhorn-Knopp centring, artefact-token detection and the Gram anchoring loss.
📝 Quick check (Level 2)
0/3 answered
  1. 1. The standard DINOv2 linear-probe input is…
  2. 2. Before SSL pre-training on your own image archive you should…
  3. 3. A quick check of patch features is…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

KoLeo. For normalised features z₁…z_n in a batch, L = −(1/n) Σᵢ log minⱼ≠ᵢ ‖zᵢ − zⱼ‖. It derives from the Kozachenko–Leonenko differential-entropy estimator: maximising entropy spreads the features uniformly, which helps nearest-neighbour retrieval.

Sinkhorn-Knopp centring. Teacher scores S (B samples × K prototypes) are turned into an assignment matrix whose rows sum to 1 and columns to B/K by alternately normalising rows and columns. Every prototype is used equally across the batch, which prevents collapse more directly than subtracting a running mean (DINO’s centring).

Gram anchoring. With normalised patch features X (n × d), the Gram matrix XXᵀ holds all patch-to-patch cosine similarities. The loss ‖XₛXₛᵀ − X_gX_gᵀ‖²_F is invariant to rotations of feature space, so global features remain free to improve while the local similarity structure, which dense tasks rely on, is held to an earlier, cleaner checkpoint.

Why curation matters. A self-supervised objective spends capacity on whatever dominates its data. In the linear case of the exercise the learned features are the top eigenvectors of the cross-view covariance, which is a frequency-weighted sum over concepts: frequent concepts claim the leading directions, and rare ones are left to the remainder. Balancing the data re-weights that sum. Without labels, balancing must use clusters, and k-means places centroids in proportion to density, so one level of clustering removes only part of the imbalance.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Sinkhorn-Knopp makes each prototype receive about…
  2. 2. The Gram anchoring loss is invariant to…
  3. 3. Flat k-means balances only partly because centroids…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

How much does automatic data curation help self-supervised features learned from a long-tailed pool?

History.

  • M. Oquab et al., “DINOv2: learning robust visual features without supervision” (TMLR 2024).
  • H. V. Vo et al., “Automatic data curation for self-supervised learning: a clustering-based approach” (TMLR 2024).
  • O. Siméoni et al., “DINOv3” (2025).

Exercise 2. Linear self-supervised learning on a long-tailed pool.

  • Pool: 8000 images of 40 concepts with Zipf frequencies (exponent 1.5): the 4 most frequent concepts hold 73% of the images. Each image is the concept mean plus instance detail (64 dimensions); each view adds a strong nuisance in 6 directions (lighting, season, viewing angle), drawn afresh per view.
  • Learner: linear spectral contrastive learning in closed form: the top 16 eigenvectors of the symmetrised covariance between two views.
  • Training sets: a random 1000; the full 8000; 1000 sampled evenly across 80 k-means clusters of round-1 SSL embeddings; the same with a second k-means level over the centroids (no resampling); and an oracle with 25 images per concept (about 900, since rare concepts have fewer).
  • Measure: frozen features, 5-shot nearest-centroid classifier on fresh balanced images of all 40 concepts and of the 20 rarest.
training set images top-4 share probe, all 40 probe, rarest 20
random subset 1000 0.732 0.777 0.728
full pool 8000 0.728 0.868 0.807
k-means balanced 1000 0.657 0.875 0.828
two-level k-means balanced 1000 0.576 0.851 0.818
class-balanced oracle 902 0.111 0.929 0.925
  • Curation helped: at equal size, k-means balancing beat random sampling on every seed (0.809 and 0.863 against 0.746 and 0.771 on seeds 1 and 2), most on rare concepts, and came close to the full pool of 8× the size (0.833 and 0.887).
  • Only partly balanced: the four big concepts still held 66% of the curated set, because k-means gave them most of the clusters; the oracle shows how much headroom remained.
  • Negative result: our naive two-level version (no resampling between levels) was inconsistent: 0.748 and 0.694 on seeds 1 and 2, worse than flat balancing. Vo et al. needed resampling at each level for exactly this reason.
  • Caveat: a linear learner and synthetic concepts; real curation also deduplicates and retrieves domain-relevant images.
🐍 Exercise 2 (research): how much does automatic data curation help self-supervised features learned from a long-tailed pool?
Pre-train linear self-supervised features on random, full, k-means-balanced and class-balanced subsets of a long-tailed pool and compare frozen few-shot probes.

DINO features in AI, robotics and aerospace

  • Earth observation: DINOv3’s satellite model and DINOv2-based canopy-height maps (Tolan et al., 2024) show frozen SSL features working on optical imagery at continental scale; SSL4EO and similar datasets support domain pre-training.
  • Robotics: OpenVLA fuses DINOv2 and SigLIP features; DINO patch features give correspondences for keypoint tracking, grasp transfer and visual place recognition (AnyLoc).
  • Planetary science: curated self-supervised pre-training on unlabelled Mars or lunar imagery, where labels are scarce and a few terrain types dominate.

References

  1. M. Oquab et al. (2024). “DINOv2: learning robust visual features without supervision.” TMLR.
  2. O. Siméoni et al. (2025). “DINOv3.” arXiv.
  3. T. Darcet, M. Oquab, J. Mairal and P. Bojanowski (2024). “Vision transformers need registers.” ICLR.
  4. J. Zhou et al. (2022). “iBOT: image BERT pre-training with online tokenizer.” ICLR.
  5. A. Sablayrolles, M. Douze, C. Schmid and H. Jégou (2019). “Spreading vectors for similarity search.” ICLR.
  6. H. V. Vo et al. (2024). “Automatic data curation for self-supervised learning: a clustering-based approach.” TMLR.
  7. D. Fan et al. (2025). “Scaling language-free visual representation learning.” arXiv.
  8. J. Tolan et al. (2024). “Very high resolution canopy height maps from RGB imagery using self-supervised vision transformer and convolutional decoder trained on aerial lidar.” Remote Sensing of Environment.