Models · Semantic segmentation

DINOv2 linear

Meta's DINOv2 features with a linear layer on top for ADE20K scene segmentation. Commercially usable.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
dinov2-s-linear-ade20ksynthetic (1024x2048)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
55.8
24.7
18.3
12.4
20.7
40.3
1653 / 2010
1694 / 2046
642 / 696
645 / 676
1331 / 1376
1794 (engine)
dinov2-b-linear-ade20ksynthetic (1024x2048)original (fp32)
original
portable
kernels
115
40.1
33.3
22.6
1899 / 2224
2063 / 2426
765 / 884
771 / 904
dinov2-l-linear-ade20ksynthetic (1024x2048)original (fp32)
original
portable
kernels
332
95.7
83.9
56.8
2730 / 3124
3308 / 3726
1181 / 1244
1189 / 1244
Details
  • Original code: https://github.com/facebookresearch/dinov2 at 7764ea0f912e
  • Code licence: Apache-2.0 (permissive); files:
  • Weights licence: Apache-2.0
  • Licence evidence: https://github.com/facebookresearch/dinov2/blob/7764ea0f912e53c92e82eb78a2a1631e92725fc8/README.md#L660
  • Training data: LVD-142M (DINOv2's curated web-image set, not released), ADE20K (SceneParsing, 150 classes)
  • Kernel libraries: fastbb, seg_up
  • Variants: dinov2-s-linear-ade20k, dinov2-b-linear-ade20k, dinov2-l-linear-ade20k
  • Outputs: logits; label_set: ade20k-150
  • Input size: any H x W >= 1, resized or padded inside the model
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): dinov2-s-linear-ade20k 3000x4000 (7.2 GiB peak allocated, 7.9 reserved); dinov2-b-linear-ade20k 3000x4000 (7.3 GiB peak allocated, 8.1 reserved); dinov2-l-linear-ade20k 3000x4000 (7.7 GiB peak allocated, 8.5 reserved)
  • dinov2-s-linear-ade20k 1024x2048, first call: portable + torch.compile 11 s (cold Inductor cache), TensorRT fp16 36 s (ONNX + engine).
  • dinov2-s-linear-ade20k original 1024x2048: torch.autocast(fp16) around the forward
  • dinov2-b-linear-ade20k original 1024x2048: torch.autocast(fp16) around the forward
  • dinov2-l-linear-ade20k original 1024x2048: torch.autocast(fp16) around the forward
  • dinov2-s-linear-ade20k load / first call: original 4.02 s / 0.303 s (512x512), portable 0.12 s / 0.09 s, kernels 0.23† s / 0.061† s
  • dinov2-b-linear-ade20k load / first call: original 12.01 s / 0.016 s (512x512), portable 0.27 s / 0.105 s, kernels 0.4† s / 0.071† s
  • dinov2-l-linear-ade20k load / first call: original 7.86 s / 0.382 s (512x512), portable 0.81 s / 0.156 s, kernels 0.92† s / 0.103† 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, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5 (tools/speed_check.py), synthetic CUDA input (bench_inputs); peak = max over the first call and the timed calls

Measured

Each image at its own size, argmax of the logits. Original = the original code named under Details, same checkpoint and protocol.

variantdatasetoriginal fp32original fp16portablekernelsnote
dinov2-s-linear-ade20kADE20K val, every 4th image, mIoU / aAcc %42.39 / 79.4042.38 / 79.4042.38 / 79.3942.37 / 79.39
dinov2-b-linear-ade20kADE20K val, every 4th image, mIoU / aAcc %45.12 / 80.2945.12 / 80.2945.12 / 80.2845.12 / 80.28
dinov2-l-linear-ade20kADE20K val, every 4th image, mIoU / aAcc %45.08 / 80.1345.09 / 80.1345.08 / 80.1345.08 / 80.13

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

Parity

CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.05 and p99 <= 0.25 (absolute error of the output logits).

variantkernels error vs original, mean / p99GPU, torchkernels used
dinov2-s-linear-ade20k0.00642 / 0.02309RTX 5060 Ti, torch 2.14.1+cu130fastbb@7d058322634d:sm_120, seg_up@3e44e71200cd:sm_120
dinov2-b-linear-ade20k0.01485 / 0.05741RTX 5060 Ti, torch 2.14.1+cu130fastbb@7d058322634d:sm_120, seg_up@3e44e71200cd:sm_120
dinov2-l-linear-ade20k0.01132 / 0.04447RTX 5060 Ti, torch 2.14.1+cu130fastbb@7d058322634d:sm_120, seg_up@3e44e71200cd:sm_120