UniDepth V2 (fastforks)

UniDepth V2 (Piccinelli et al. 2025): universal metric depth from a DINOv2 ViT-L encoder and a camera-prompted decoder; predicts depth, 3-D points, a confidence map and the pinhole intrinsics, or uses given intrinsics.

This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/lpiccinelli-eth/UniDepth at 8d8cfe4.

Author weight repos: https://huggingface.co/lpiccinelli/unidepth-v2-vitl14.

Task: depth. Tier: experimental. Outputs: depth, points, intrinsics, confidence. Backends: portable, kernels.

Input: one RGB image. Output: a depth or inverse-depth map (metric for the models marked metric).

Variants

Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.

variant weights (author link) SHA-256 weights licence commercial use
unidepth-v2-vitl14@1 model.safetensors ba73d3de7353 CC-BY-NC-4.0 (assumed from code) no

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: CC-BY-NC-4.0. Files: LICENSE.

Code licence: CC-BY-NC-4.0; the authors do not state a separate weights licence.

Training data: Mixture of public metric-depth datasets (indoor, outdoor, driving, synthetic) per the UniDepthV2 paper (arXiv 2502.20110).

Licence evidence: https://github.com/lpiccinelli-eth/UniDepth/blob/8d8cfe4c7ee15297099983607febf0d4f32eb3d6/README.md#license

Input size

any H x W >= 8, resized or padded inside the model Tested up to (portable, fp16, RTX 5060 Ti 16 GB): unidepth-v2-vitl14 3000x4000 (2.6 GiB peak allocated, 3.2 reserved)

Speed and memory

Depth, Middlebury 2014 half, 994x1482

model time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
unidepth-v2-vitl14 132.4 132.0 99.85 66.37 2.0x 1.5x 3230 / 3508 1208 / 1472 1211 / 1472

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
unidepth-v2-vitl14 3.80 4.16 0.90โ€  0.38 0.15 0.07

Fixed-size speed and peak memory, all models

model mode 640x480 1280x720 1920x1080 12 MP 4000x3000
unidepth-v2-vitl14 portable 61.2 ms / 1993 / 2266 130.9 ms / 2561 / 3154 131.1 ms / 2575 / 3150 134.4 ms / 2674 / 3266
unidepth-v2-vitl14 kernels 32.5 ms / 1011 / 1110 69.1 ms / 1214 / 1378 69.4 ms / 1227 / 1430 72.6 ms / 1334 / 1706

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the authors' code at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.

Accuracy

On public datasets

AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Original = the authors' code, same checkpoint and protocol.

variant dataset portable kernels note
unidepth-v2-vitl14 NYUv2 test, AbsRel / delta1 0.0355 / 0.9843 0.0355 / 0.9843
unidepth-v2-vitl14 iBims-1, AbsRel / delta1 0.0298 / 0.9850 0.0298 / 0.9850
unidepth-v2-vitl14 ETH3D two-view train left, AbsRel / delta1 0.0586 / 0.9802 0.0586 / 0.9802 possibly in the training data
unidepth-v2-vitl14 Middlebury 2014 trainingH left, AbsRel / delta1 0.0221 / 0.9970 0.0221 / 0.9970 possibly in the training data

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-27.

Parity with the original code

Every variant is checked against golden outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 1 % and p99 <= 2 % of the reference's median |value|.

Limitations

  • The confidence head adds measurable time; the option confidence = false skips it.

Usage

from fastforks import depth

model = depth.load("unidepth-v2-vitl14")  # portable PyTorch on the GPU if there is one, else the CPU
result = model("room.jpg")
result.depth  # [H, W] float32 tensor; result.kind says what the maps mean
# models that take a camera: model("room.jpg", intrinsics=K), K [3, 3] in pixels
result.backend  # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')

Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: unidepth-v2-vitl14.

Kernels backend

depth.load("unidepth-v2-vitl14", mode="kernels") runs our CUDA kernels (fastbb, cudnn_hacc, dpt_fused). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support