PyTorch code and models for the DINOv2 self-supervised learning method.

★ 13,496⑂ 1,290👁 104▤ 0
Jupyter NotebookCreated 2023-03-30
13,496
stars
+0+3
1,290
forks
104
watchers
–
prs
–
issues
0
releases
–
discussions

README

:new: [2025-12-18] Added support for loading XRay-DINO backbone following Advancing human-centric AI for robust X-ray analysis through holistic self-supervised learning, more details are here

:new: [2025-12-16] Added Channel-Adaptive DINO code following Scaling Channel-Adaptive Self-Supervised Learning, more details are here

:new: [2025-12-16] Added Cell-DINO code following Cell-DINO: Self-Supervised Image-based Embeddings for Cell Fluorescent Microscopy, more details are here

[2025-08-14] Please check out the more recent DINOv3 effort continuing this line of work.

[2025-06-11] Added dino.txt inference code, following DINOv2 Meets Text: A Unified Framework for Image- and Pixel-Level Vision-Language Alignment.

[2023-10-26] Added DINOv2 backbones with registers, following Vision Transformers Need Registers.

 DINOv2: Learning Robust Visual Features without Supervision

Meta AI Research, FAIR

Maxime Oquab,
Timothée Darcet,
Théo Moutakanni,
Huy V. Vo,
Marc Szafraniec,
Vasil Khalidov,
Patrick Labatut,
Armand Joulin,
Piotr Bojanowski

[Paper 1] Paper 2] [Blog] [Demo] [BibTeX]

PyTorch implementation and pretrained models for DINOv2. For details, see the papers: DINOv2: Learning Robust Visual Features without Supervision and Vision Transformers Need Registers.

DINOv2 models produce high-performance visual features that can be directly employed with classifiers as simple as linear layers on a variety of computer vision tasks; these visual features are robust and perform well across domains without any requirement for fine-tuning. The models were pretrained on a dataset of 142 M images without using any labels or annotations.

https://github.com/facebookresearch/dinov2/assets/60359573/f168823e-7922-415a-b429-578badf5c356


  Visualization of the three first principal components of the patch features of all frames, mapped to RGB values.


 Pretrained models


  
    
      model
       ofparams
      withregisters
      ImageNetk-NN
      ImageNetlinear
      download
    
  
  
    
      ViT-S/14 distilled
      21 M
      :x:
      79.0%
      81.1%
      backbone only
    
    
      ViT-S/14 distilled
      21 M
      :white_check_mark:
      79.1%
      80.9%
      backbone only
    
    
      ViT-B/14 distilled
      86 M
      :x:
      82.1%
      84.5%
      backbone only
    
    
      ViT-B/14 distilled
      86 M
      :white_check_mark:
      82.0%
      84.6%
      backbone only
    
    
      ViT-L/14 distilled
      300 M
      :x:
      83.5%
      86.3%
      backbone only
    
    
      ViT-L/14 distilled
      300 M
      :white_check_mark:
      83.8%
      86.7%
      backbone only
    
    
      ViT-g/14
      1,100 M
      :x:
      83.5%
      86.5%
      backbone only
    
    
      ViT-g/14
      1,100 M
      :white_check_mark:
      83.7%
      87.1%
      backbone only
    
  


 Pretrained backbones (via PyTorch Hub)

Please follow the instructions here to install PyTorch (the only required dependency for loadin

Snapshot: 2026-11-04T14:00:00Z · Data license Apache-2.0 · JSON