dinov3 README

The project's README from github.com/facebookresearch/dinov3. As one markdown file: README.md.

:new: [2026-06-12] :fire: Metadata-guided training code and reference recipes (FMoW satellite imagery, HPA-WholeHR fluorescence imagery) are now released on the FINO branch, accompanying Who Needs Labels? Adapting Vision Foundation Models With the Metadata You Already Have (Gardès et al., 2026).

[2026-03-10] The Canopy Height Maps v2 (CHMv2) model and inference code are now available (more details on downloading the model weights and using the code here). The model weights are also available in Hugging Face Hub and supported by the Hugging Face Transformers library. Building on our original high-resolution canopy height maps released in 2024, CHMv2 delivers substantial improvements in accuracy, detail, and global consistency by leveraging DINOv3.

[2025-11-20] Distillation code and configurations for ConvNeXt backbones are now released!

[2025-10-13] Semantic segmentation (ADE20K) and monocular depth estimation (NYUv2-Depth) linear probing code are now released!

[2025-09-17] DINOv3 backbones are now supported by the PyTorch Image Models / timm library starting with version 1.0.20

[2025-08-29] DINOv3 backbones are supported by released versions of the Hugging Face Transformers library starting with version 4.56.0

[2025-08-14] DINOv3 backbones are now available in Hugging Face Hub and supported by the development version of the Hugging Face Transformers library

DINOv3 🦖🦖🦖

Meta AI Research, FAIR

Oriane Siméoni, Huy V. Vo, Maximilian Seitzer, Federico Baldassarre, Maxime Oquab,
Cijo Jose, Vasil Khalidov, Marc Szafraniec, Seungeun Yi, Michaël Ramamonjisoa,
Francisco Massa, Daniel Haziza, Luca Wehrstedt, Jianyuan Wang,
Timothée Darcet, Théo Moutakanni, Leonel Sentana, Claire Roberts,
Andrea Vedaldi, Jamie Tolan, John Brandt, Camille Couprie,
Julien Mairal, Hervé Jégou, Patrick Labatut, Piotr Bojanowski

[ :scroll: Paper] [ :newspaper: Blog] [ :globe_with_meridians: Website] [ :book: BibTeX]

Reference PyTorch implementation and models for DINOv3. For details, see the DINOv3 paper.

Overview

market

High-resolution dense features.
We visualize the cosine similarity maps obtained with DINOv3 output features
between the patches marked with a red cross and all other patches.


An extended family of versatile vision foundation models producing high-quality dense features and achieving outstanding performance on various vision tasks including outperforming the specialized state of the art across a broad range of settings, without fine-tuning

Pretrained models

:information_source: Please follow the link provided below to get access to all the model weights: once accepted, an e-mail will be sent with the complete list of URLs pointing to all the available model weights (both backbones and adapters). These URLs can then be used to either:

See the example code snippets below.

:warning: Please use wget instead of a web browser to download the weights.

ViT models pretrained on web dataset (LVD-1689M):

Model Parameters Pretraining
Dataset
Download
ViT-S/16 distilled 21M LVD-1689M [link]
ViT-S+/16 distilled 29M LVD-1689M [link]
ViT-B/16 distilled 86M LVD-1689M [link]
ViT-L/16 distilled 300M LVD-1689M [link]
ViT-H+/16 distilled 840M LVD-1689M [link]
ViT-7B/16 6,716M LVD-1689M [link]

ConvNeXt models pretrained on web dataset (LVD-1689M):

Model Parameters Pretraining
Dataset
Download
ConvNeXt Tiny 29M LVD-1689M [link]
ConvNeXt Small 50M LVD-1689M [link]
ConvNeXt Base 89M LVD-1689M [link]
ConvNeXt Large 198M LVD-1689M [link]

ViT models pretrained on satellite dataset (SAT-493M):

Model Parameters Pretraining
Dataset
Download
ViT-L/16 distilled 300M SAT-493M [link]
ViT-7B/16 6,716M SAT-493M [link]

Pretrained backbones (via PyTorch Hub)

Please follow the instructions here to install PyTorch (the only required dependency for loading the model). Installing PyTorch with CUDA support is strongly recommended.

import torch

REPO_DIR = <PATH/TO/A/LOCAL/DIRECTORY/WHERE/THE/DINOV3/REPO/WAS/CLONED>

# DINOv3 ViT models pretrained on web images
dinov3_vits16 = torch.hub.load(REPO_DIR, 'dinov3_vits16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
dinov3_vits16plus = torch.hub.load(REPO_DIR, 'dinov3_vits16plus', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
dinov3_vitb16 = torch.hub.load(REPO_DIR, 'dinov3_vitb16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
dinov3_vitl16 = torch.hub.load(REPO_DIR, 'dinov3_vitl16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
dinov3_vith16plus = torch.hub.load(REPO_DIR, 'dinov3_vith16plus', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
dinov3_vit7b16 = torch.hub.load(REPO_DIR, 'dinov3_vit7b16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)

# DINOv3 ConvNeXt models pretrained on web images
dinov3_convnext_tiny = torch.hub.load(REPO_DIR, 'dinov3_convnext_tiny', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
dinov3_convnext_small = torch.hub.load(REPO_DIR, 'dinov3_convnext_small', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
dinov3_convnext_base = torch.hub.load(REPO_DIR, 'dinov3_convnext_base', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
dinov3_convnext_large = torch.hub.load(REPO_DIR, 'dinov3_convnext_large', source='local', weights=<CHECKPOINT/URL/OR/PATH>)

# DINOv3 ViT models pretrained on satellite imagery
dinov3_vitl16 = torch.hub.load(REPO_DIR, 'dinov3_vitl16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
dinov3_vit7b16 = torch.hub.load(REPO_DIR, 'dinov3_vit7b16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)

Pretrained backbones (via Hugging Face Transformers)

All the backbones are available in the DINOv3 collection on Hugging Face Hub and supported via the Hugging Face Transformers library (with released packages from version 4.56.0). Please refer to the corresponding documentation for usage, but below is a short example that demonstrates how to obtain an image embedding with either [Pipeline] or the [AutoModel] class.

from transformers import pipeline
from transformers.image_utils import load_image

url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
image = load_image(url)

feature_extractor = pipeline(
    model="facebook/dinov3-convnext-tiny-pretrain-lvd1689m",
    task="image-feature-extraction",
)
features = feature_extractor(image)
import torch
from transformers import AutoImageProcessor, AutoModel
from transformers.image_utils import load_image

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = load_image(url)

pretrained_model_name = "facebook/dinov3-convnext-tiny-pretrain-lvd1689m"
processor = AutoImageProcessor.from_pretrained(pretrained_model_name)
model = AutoModel.from_pretrained(
    pretrained_model_name,
    device_map="auto",
)

inputs = processor(images=image, return_tensors="pt").to(model.device)
with torch.inference_mode():
    outputs = model(**inputs)

pooled_output = outputs.pooler_output
print("Pooled output shape:", pooled_output.shape)

where model and pretrained_model_name above can be one of:

Image transforms

For models using the LVD-1689M weights (pretrained on web images), please use the following transform (standard ImageNet evaluation transform):

import torchvision
from torchvision.transforms import v2

def make_transform(resize_size: int = 256):
    to_tensor = v2.ToImage()
    resize = v2.Resize((resize_size, resize_size), antialias=True)
    to_float = v2.ToDtype(torch.float32, scale=True)
    normalize = v2.Normalize(
        mean=(0.485, 0.456, 0.406),
        std=(0.229, 0.224, 0.225),
    )
    return v2.Compose([to_tensor, resize, to_float, normalize])

For models using the SAT-493M weights (pretrained on satellite imagery), please use the following transform:

import torchvision
from torchvision.transforms import v2

def make_transform(resize_size: int = 256):
    to_tensor = v2.ToImage()
    resize = v2.Resize((resize_size, resize_size), antialias=True)
    to_float = v2.ToDtype(torch.float32, scale=True)
    normalize = v2.Normalize(
        mean=(0.430, 0.411, 0.296),
        std=(0.213, 0.156, 0.143),
    )
    return v2.Compose([to_tensor, resize, to_float, normalize])

Pretrained heads - Image classification

Backbone Pretraining
Dataset
Head
Dataset
Download
ViT-7B/16 LVD-1689M ImageNet [link]

The (full) classifier models can be loaded via PyTorch Hub:

import torch

# DINOv3
dinov3_vit7b16_lc = torch.hub.load(REPO_DIR, 'dinov3_vit7b16_lc', source="local", weights=<DEPTHER/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)

Pretrained heads - Depther trained on SYNTHMIX dataset

Backbone Pretraining
Dataset
Head
Dataset
Download
ViT-7B/16 LVD-1689M SYNTHMIX [link]
depther = torch.hub.load(REPO_DIR, 'dinov3_vit7b16_dd', source="local", weights=<DEPTHER/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)

Full example code of depther on an image

from PIL import Image
import torch
from torchvision.transforms import v2
import matplotlib.pyplot as plt
from matplotlib import colormaps

def get_img():
    import requests
    url = "http://images.cocodataset.org/val2017/000000039769.jpg"
    image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
    return image

def make_transform(resize_size: int | list[int] = 768):
    to_tensor = v2.ToImage()
    resize = v2.Resize((resize_size, resize_size), antialias=True)
    to_float = v2.ToDtype(torch.float32, scale=True)
    normalize = v2.Normalize(
        mean=(0.485, 0.456, 0.406),
        std=(0.229, 0.224, 0.225),
    )
    return v2.Compose([to_tensor, resize, to_float, normalize])

depther = torch.hub.load(REPO_DIR, 'dinov3_vit7b16_dd', source="local", weights=<DEPTHER/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)

img_size = 1024
img = get_img()
transform = make_transform(img_size)
with torch.inference_mode():
    with torch.autocast('cuda', dtype=torch.bfloat16):
        batch_img = transform(img)[None]
        batch_img = batch_img
        depths = depther(batch_img)

plt.figure(figsize=(12, 6))
plt.subplot(121)
plt.imshow(img)
plt.axis("off")
plt.subplot(122)
plt.imshow(depths[0,0].cpu(), cmap=colormaps["Spectral"])
plt.axis("off")

Reproduce paper results

Make sure the NYU dataset is setup following this.

Launch the following to reproduce our paper's depth estimation results on NYUv2 with the pretrained Depther trained on SYNTHMIX:

PYTHONPATH=. python -m dinov3.run.submit dinov3/eval/depth/run.py \
config=dinov3/eval/depth/configs/config-nyu-synthmix-dpt-inference.yaml \
datasets.root=<PATH/TO/DATASET> \
load_from=dinov3_vit7b16_dd \
--output-dir <PATH/TO/OUTPUT/DIR>

Notes:

PYTHONPATH=. python dinov3/eval/depth/run.py \
config=dinov3/eval/depth/configs/config-nyu-synthmix-dpt-inference.yaml \
datasets.root=<PATH/TO/DATASET> \
load_from=dinov3_vit7b16_dd \
output_dir=<PATH/TO/OUTPUT/DIR>

Pretrained heads - Detector trained on COCO2017 dataset

Backbone Pretraining
Dataset
Head
Dataset
Download
ViT-7B/16 LVD-1689M COCO2017 [link]
detector = torch.hub.load(REPO_DIR, 'dinov3_vit7b16_de', source="local", weights=<DETECTOR/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)

Pretrained heads - Segmentor trained on ADE20K dataset

Backbone Pretraining
Dataset
Head
Dataset
Download
ViT-7B/16 LVD-1689M ADE20K [link]
segmentor = torch.hub.load(REPO_DIR, 'dinov3_vit7b16_ms', source="local", weights=<SEGMENTOR/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)

Example command to run a full inference on ADE20K with the provided segmentor (ViT-7B + M2F):

PYTHONPATH=. python -m dinov3.run.submit dinov3/eval/segmentation/run.py \
config=dinov3/eval/segmentation/configs/config-ade20k-m2f-inference.yaml  \
datasets.root=<PATH/TO/DATASET> \
load_from=dinov3_vit7b16_ms \
--output-dir <PATH/TO/OUTPUT/DIR>

Full example code of segmentator on an image

import sys
sys.path.append(REPO_DIR)

from PIL import Image
import torch
from torchvision import transforms
import matplotlib.pyplot as plt
from matplotlib import colormaps
from functools import partial
from dinov3.eval.segmentation.inference import make_inference


def get_img():
    import requests
    url = "http://images.cocodataset.org/val2017/000000039769.jpg"
    image = Image.open(requests.get(url, stream=True).raw).conver

dinov3 (facebookresearch/dinov3)

Searching Database…

11.6K ·GitHub
这是什么?这是 Meta AI Research(FAIR)发布的 DINOv3 官方 PyTorch 参考实现和模型,DINOv3 是一系列视觉基础模型,能生成高质量的密集特征,在多种视觉任务上表现出色。
那 DINOv3 是一个模型还是一整个系列?是一个系列:包括从 21M 到 6.7B 参数(ViT-7B/16)的蒸馏 ViT 骨干网络,从 29M 到 198M 的 ConvNeXt 骨干网络,另外还提供可以在旗舰骨干网络之上下载的训练好的任务头。
在 Python 里怎么加载这些模型?先通过链接的表单申请权重,然后 either 用 torch.hub.load() 指向下载好的文件(或直接传入 URL),either 通过 Hugging Face Transformers 4.56.0 及以上版本加载 'facebook/dinov3-*' 检查点;timm 库从 1.0.20 起也支持这些骨干网络。
只装 PyTorch 就够了吗,还是需要别的东西?加载模型只需要 PyTorch 这一个依赖,README 强烈建议安装支持 CUDA 的版本。除了受限的权重下载之外,不需要任何账号或 API 密钥。
获取权重有什么门槛吗?有,访问是受限的:你需要填写申请表单,然后等待包含下载链接的批准邮件。README 还提醒要用 wget 下载权重,而不要用网页浏览器。
发布的预训练任务头都覆盖哪些下游任务?这个仓库包含 ImageNet 图像分类、单目深度估计(深度模型在 SYNTHMIX 上训练,在 NYUv2 上评估)、COCO2017 目标检测、ADE20K 语义分割的任务头,另外还有用于分割和深度的线性探测(linear-probing)代码。
DINOv3 的特征有什么特别之处?它们是高质量的密集特征:patch 级别的余弦相似度图能揭示图像区域之间的语义对应关系,而且据称这些模型无需微调就能在广泛的各种场景下打败专门领域的最先进系统。
这个仓库里有和卫星影像相关的内容吗?有——除了 SAT-493M 骨干网络之外,团队还发布了基于 DINOv3 构建的 Canopy Height Maps v2(CHMv2),FINO 分支则为卫星影像(FMoW)和荧光影像(HPA)提供了基于元数据引导的训练配方。
Size
12.6 MB
Stars
11.6K
Updated
CommitJul 15
Age
1y
Commits · 90 Days