What is DINO in self-supervised computer vision?
DINO (self-DIstillation with NO labels) is a self-supervised image-learning method in which a student network learns to predict a teacher network's probability distribution for a different view of the same unlabeled image. It combines multi-crop training, a slowly updated teacher, output centering, and sharpening—without requiring explicit negative-image pairs.
How does DINO work?
- Create multiple crops: From an unlabeled image, generate two large global views and several smaller local views.
- Student processes every crop: A student backbone (often a Vision Transformer, ViT) and output head produce logits for global and local views.
- Teacher processes only global crops: A teacher with the same network architecture outputs logits for the two global views; it has different parameters from the student.
- Produce probability distributions: Apply softmax to student logits. For the teacher, subtract a running center from logits, then divide by its temperature and apply softmax. A low teacher temperature sharpens its probabilities.
- Learn across different views: Minimize cross-entropy between the teacher's stopped-gradient distribution from a global view and a student's prediction from another view. Do not compare teacher and student outputs from the exact same crop.
- Update student and teacher differently: The loss gradient updates only the student. Update teacher parameters by an exponential moving average (EMA) of student weights, and update the teacher-output center with a running mean.
Training flow:
Global + local crops → student ViT + head → student probabilitiesGlobal crops only → teacher ViT + head → center subtraction + sharpening → teacher probabilities (stop-gradient)Cross-view cross-entropy → student update → EMA teacher update
The distributions represent the network's learned output dimensions, not human-labeled object categories.
Beginner-friendly practical example: A dog photo
Imagine a dog photographed in a park, without any label.
- Create 2 global crops:
G1andG2show most of the dog and scene. - Create 4 local crops:
L1, L2, L3, L4show smaller image regions, such as the dog's head or another part. - Student views:
G1, G2, L1, L2, L3, L4—6 total. - Teacher views: Only
G1andG2—2 total. - Teacher G1 comparisons: Student
G2, L1, L2, L3, L4—5. StudentG1is excluded because that is the same view. - Teacher G2 comparisons: Student
G1, L1, L2, L3, L4—5 more. - Total:
2 × (6 − 1) = 10valid teacher–student comparisons for this image. Their cross-entropies contribute to the averaged training loss.
The local-to-global objective encourages the student to recognize information that persists between a small crop and the larger scene. However, an excessively small crop can remove the meaningful object, so choosing useful transformations matters.
Numerical example: From teacher logits to cross-entropy loss
For illustration, suppose the outputs have only two dimensions. Real DINO models usually have many more. These values are invented to make each operation easy to follow.
Step 1 — Center the teacher's raw logits.
- Teacher logits:
t = [1 + ln(2), 1] ≈ [1.6931, 1.0000]. - Running center:
c = [1, 1]. - Centered logits:
t − c = [ln(2), 0] ≈ [0.6931, 0].
The center is a moving average of teacher outputs across the batch, not a class label. Subtracting it reduces the tendency for a particular output dimension to dominate.
Step 2 — Sharpen the teacher distribution.
Take an illustrative teacher temperature `τ_t = 0.5`:
- Scaled logits:
[ln(2)/0.5, 0] = [ln(4), 0]. - Exponentials:
[4, 1]. - Teacher probabilities:
P_t = [4/5, 1/5] = [0.8, 0.2].
For the *same centered logits* at temperature 1, the probabilities would be [2/3, 1/3]. The lower temperature makes the teacher's prediction more concentrated.
Step 3 — Calculate student probabilities.
Suppose the student output logits, after scaling by its own temperature, are [ln(1.5), 0]. Here the illustrative student temperature is 1.
- Exponentials:
[1.5, 1]. - Student probabilities:
P_s = [1.5/2.5, 1/2.5] = [0.6, 0.4].
Step 4 — Measure teacher-to-student cross-entropy for this view pair.
H(P_t,P_s) = −Σ_i P_t(i) ln P_s(i)
H = −[0.8 ln(0.6) + 0.2 ln(0.4)]
H ≈ 0.4087 + 0.1833 = 0.5919
Result: 0.5919 for one allowed cross-view pair, not the full multi-crop average. The teacher distribution is stop-gradient: backpropagation updates student parameters, not teacher parameters.
Numerical example: EMA teacher update
After the student optimizer step, update the teacher's corresponding parameters:
θ_teacher,new = m × θ_teacher,old + (1 − m) × θ_student,new
Suppose one teacher weight was 2.0 and the updated student weight is 4.0.
- If `m = 0.9`:
0.9×2 + 0.1×4 = 2.2. - If `m = 0.99`:
0.99×2 + 0.01×4 = 2.02.
A larger momentum makes the teacher change more slowly. Center updates are separate moving averages over teacher logits, not over the network parameters.
How does DINO avoid collapse without negatives?
- Cross-view self-distillation: Student probabilities match a teacher target for different views instead of contrasting against unrelated images. No negative-pair dictionary or contrastive denominator is used.
- Centering: Subtracting a running teacher-output mean discourages one output dimension from dominating across the dataset.
- Sharpening: Lower teacher temperature discourages completely uniform probability vectors. Centering without adequate sharpening may favor uniform output; sharpening alone can favor one dominant dimension.
- EMA teacher and stop-gradient: Provide a slowly moving learning target while gradients train the student, supporting stable asymmetric learning.
These mechanisms work together and are not universal standalone guarantees against collapse. For the general problem, see “What is representation collapse in self-supervised learning?” (Question 270).
Why is DINO useful for Vision Transformers?
- Transferable visual representations: The original work reported strong k-nearest-neighbor and linear-probe classification performance without labels during pretraining.
- Interesting attention maps: Some DINO-trained ViT attention heads naturally highlight foreground objects and approximate their spatial boundaries. These maps are qualitative emergent properties, not guaranteed accurate segmentation masks or faithful explanations of decisions.
- Downstream applications: Reuse the learned backbone for image classification, visual retrieval, and adaptation to detection or segmentation pipelines.
Benefits, limitations and practical considerations
- Benefits: Avoids labeled pretraining data and explicit negative-pair mining; local-to-global matching helps learn useful visual structure.
- Cost: Several crops per image and two network branches increase compute and memory.
- Stability: Teacher temperature, center updates, EMA momentum, output-head normalization and augmentations must be chosen carefully to avoid unstable or collapsed predictions.
- Domain sensitivity: Small image regions may be uninformative; medical imaging, document processing or remote sensing may require different crops and augmentations.
- Evaluation: Monitor teacher prediction entropy and output diversity, plus held-out linear classification and retrieval, rather than trusting a falling training loss or attractive attention maps.
Curriculum boundaries: BYOL (Question 271) matches normalized prediction vectors, whereas DINO matches centered/sharpened probability distributions with cross-entropy and multi-crop learning. Question 270 covers collapse generally. Upcoming masked image modeling and masked autoencoder (MAE) lessons cover different objectives.
Key takeaway: DINO learns useful ViT representations by making a student match the sharpened, centered predictions of a slow-moving teacher on other crops of the same unlabeled image—with no explicit negative pairs.
Research: Caron et al., *Emerging Properties in Self-Supervised Vision Transformers* (ICCV 2021); paper on arXiv; DINO reference implementation.
Sources & Research References
Learning Sequence
Deep Learning Curriculum
Explore Related Questions
Deepen your understanding across related Deep Learning topics.