Models · Monocular depth

UniDepth V2

UniDepth V2: metric depth from one image without known camera data. Non-commercial licence.

stable Fork of lpiccinelli-eth/UniDepth@8d8cfe4 · backends: portable, kernels

Checkpoint unidepth-v2-vitl14

Paper 2025 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 63.0 ms 994x1482, fp16
vs the faster original 2.1× original fp16: 132 ms
Peak memory 1,153 MiB original: 3,230 MiB
Accuracy vs original fp32 ±0.0000 kernels AbsRel, NYUv2 test (0.0355 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install "fastforks-core[nc]"

from fastforks import depth

model = depth.load("unidepth-v2-vitl14")  # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.depth  # also: points, intrinsics, confidence
result.backend  # what ran: mode, device, dtype, kernels

The weights are non-commercial: fastforks downloads them only with FASTFORKS_NONCOMMERCIAL=1 set.

fastforks bench unidepth-v2-vitl14

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.

BackenddtypeTime per call (ms)vs original fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32 1321.00×3,230 MiB/3,508 MiB2.80.16
Original fp16torch.autocast(fp16) around the forwardfp16 132–3,230 MiB/3,508 MiB3.80.38
Portable fp32fp32not measured ––––
Portablefp16 99.81.3×1,208 MiB/1,472 MiB4.20.15
Kernelsfp16 63.02.1×1,153 MiB/1,252 MiB2.10.06
Portable + torch.compile 96.41.4×1,304 MiB/1,392 MiB31 (build)–
TensorRT fp16fp16 64.32.1×1,050 MiBenginenot comparable119 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-01 to 2026-11-16. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-12Originalfp321356 5,260 MiB processmatches994x1482
Portablefp321252 6,077 MiB processmatches994x1482
Kernelsfp16not implemented–994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16104 1,129 MiB/1,212 MiB–994x1482
Kernelsfp1685.8 1,129 MiB/1,212 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1627.8 1,129 MiB/1,212 MiB–994x1482
Kernelsfp1625.4 1,129 MiB/1,212 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1678.8 1,129 MiB/1,212 MiB–994x1482
Kernelsfp1677.0 1,129 MiB/1,212 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1629.0 1,129 MiB/1,212 MiB–994x1482
Kernelsfp1626.6 1,129 MiB/1,212 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1618.4 1,153 MiB/1,232 MiB–994x1482
Kernelsfp1618.8 1,156 MiB/1,232 MiB–994x1482

CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.

Licence and weights

Non-commercial only

Code
CC-BY-NC-4.0 LICENSE
Weights
CC-BY-NC-4.0 (assumed from code)(not stated by the authors; assumed to follow the code) source
Training data
Mixture of public metric-depth datasets (indoor, outdoor, driving, synthetic) per the UniDepthV2 paper (arXiv 2502.20110)
  • code: CC-BY-NC-4.0 (noncommercial)
  • weights: CC-BY-NC-4.0 (assumed from code)
  • weights licence not stated by the original authors; assumed to be the code licence

Our reading of the licences, not legal advice.

Weights

model.safetensors 1.4 GB· hosted on Hugging Face

fastforks downloads and checks these files on first use (fastforks download unidepth-v2-vitl14). Non-commercial weights need FASTFORKS_NONCOMMERCIAL=1.

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

NYUv2 test

AbsRel / delta1

RundtypeAbsRel ↓δ1 ↑Δ AbsRel vs fp32 originalimagesms / image
Original fp32fp320.03550.9843 reference 654 57.9
Original fp16fp160.03550.9843 ±0.0000 654 57.9
Portable fp32fp320.03550.9843 ±0.0000 654 156
Portablefp160.03550.9843 ±0.0000 654 42.0
Kernelsfp160.03550.9843 ±0.0000 654 28.1

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. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6d3bab64, 2026-11-17; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

iBims-1

AbsRel / delta1

RundtypeAbsRel ↓δ1 ↑Δ AbsRel vs fp32 originalimagesms / image
Original fp32fp320.02980.9850 reference 100 61.5
Original fp16fp160.02980.9850 ±0.0000 100 61.5
Portable fp32fp320.02980.9850 ±0.0000 100 172
Portablefp160.02980.9851 ±0.0000 100 45.1
Kernelsfp160.02980.9850 ±0.0000 100 29.7

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. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6d3bab64, 2026-11-17; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

ETH3D two-view train left

AbsRel / delta1training data not stated: possibly seen

RundtypeAbsRel ↓δ1 ↑Δ AbsRel vs fp32 originalimagesms / image
Original fp32fp320.05860.9802 reference 27 76.1
Original fp16fp160.05860.9802 ±0.0000 27 75.6
Portable fp32not measured
Portablefp160.05860.9802 ±0.0000 27 56.2
Kernelsfp160.05860.9802 ±0.0000 27 37.4

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. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

Middlebury 2014 trainingH left

AbsRel / delta1training data not stated: possibly seen

RundtypeAbsRel ↓δ1 ↑Δ AbsRel vs fp32 originalimagesms / image
Original fp32fp320.02210.9970 reference 15 129
Original fp16fp160.02210.9970 ±0.0000 15 128
Portable fp32not measured
Portablefp160.02210.9970 ±0.0000 15 96.5
Kernelsfp160.02210.9970 ±0.0000 15 63.5

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. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. 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| (absolute error of the output depth).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 (relative)not recorded
GPU default dtypes, mean |diff|≤ 0.01 (relative)0.0039 (relative)
GPU default dtypes, p99 |diff|≤ 0.02 (relative)0.00516 (relative)

Recorded for unidepth-v2-vitl14 on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-12, with these kernels: cudnn_haccdpt_fusedfastbb

Details

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.

Input / output
Input: one RGB image. Output: a depth or inverse-depth map.
What the numbers mean, and which models need the camera focal length

kind (a card field, result.kind) says what the numbers mean: metric = metres; scale_invariant, affine_invariant, affine_invariant_log (log depth) and affine_invariant_inverse are relative (unknown scale or shift, not metres). Metric models that use the focal length take model(image, intrinsics=K) (K [3, 3], pixels of the input): metric3d-vit-large and da3metric-large need it for correct metres (da3metric-large: metres = output x focal / 300; without intrinsics= a 300 px focal length is assumed, wrong for a real camera). unidepth-v2-vitl14, unik3d-vitl, depth-pro and MoGe estimate the camera themselves (given intrinsics= replace fx); zoedepth-nk and the relative models (da3mono-large too) take none. Normals-only models (kind none) return result.normals [B, H, W, 3] (unit vectors, camera frame: x right, y down, z forward).

Input size
any H x W >= 8, resized or padded inside the model; tested up to 3000x4000 (2,674 MiB allocated)
Options
  • confidence=true· changes the output
Outputs
depth, points, intrinsics, confidence
CUDA kernels
  • fastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbones
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
  • dpt_fusedfused fp16 matrix multiplies and convolutions for DINOv2 backbones and DPT depth heads
Apple (MPS)
fp32

Limitations

  • The confidence head adds measurable time; the option confidence = false skips it.
Full reference, generated from the repository

UniDepth V2: metric depth from one image without known camera data. Non-commercial licence.

Commercial use: no (code: CC-BY-NC-4.0 (noncommercial); weights: CC-BY-NC-4.0 (assumed from code)).

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
unidepth-v2-vitl14Middlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
132
132
99.8
63.0
96.4
64.3
3230 / 3508
3230 / 3508
1208 / 1472
1153 / 1252
1304 / 1392
1815 / 1842
Details
  • Original code: https://github.com/lpiccinelli-eth/UniDepth at 8d8cfe4
  • Code licence: CC-BY-NC-4.0 (noncommercial); files: LICENSE
  • Weights licence: CC-BY-NC-4.0 (assumed from code)
  • Licence evidence: https://github.com/lpiccinelli-eth/UniDepth/blob/8d8cfe4c7ee15297099983607febf0d4f32eb3d6/README.md#license
  • Training data: Mixture of public metric-depth datasets (indoor, outdoor, driving, synthetic) per the UniDepthV2 paper (arXiv 2502.20110)
  • Options: confidence = True
  • Kernel libraries: fastbb, cudnn_hacc, dpt_fused
  • Variants: unidepth-v2-vitl14
  • Outputs: depth, points, intrinsics, confidence; kind: metric
  • 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)
  • unidepth-v2-vitl14 994x1482, first call: portable + torch.compile 31 s (cold Inductor cache), TensorRT fp16 119 s (ONNX + engine).
  • unidepth-v2-vitl14 original 994x1482: torch.autocast(fp16) around the forward
  • unidepth-v2-vitl14 load / first call: original 3.8 s / 0.383 s, portable 4.16 s / 0.147 s, kernels 1.9 s / 0.296 s (518x770)
  • Protocol, median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls

Measured

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

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
unidepth-v2-vitl14NYUv2 test, AbsRel / delta10.0355 / 0.98430.0355 / 0.98430.0355 / 0.98430.0355 / 0.98430.0355 / 0.9843
unidepth-v2-vitl14iBims-1, AbsRel / delta10.0298 / 0.98500.0298 / 0.98500.0298 / 0.98510.0298 / 0.98500.0298 / 0.9850
unidepth-v2-vitl14ETH3D two-view train left, AbsRel / delta10.0586 / 0.98020.0586 / 0.98020.0586 / 0.98020.0586 / 0.9802possibly in the training data
unidepth-v2-vitl14Middlebury 2014 trainingH left, AbsRel / delta10.0221 / 0.99700.0221 / 0.99700.0221 / 0.99700.0221 / 0.9970possibly in the training data

Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6d3bab64, 2026-11-17; kernels: 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| <= 1 % and p99 <= 2 % of the reference's median |value| (absolute error of the output depth).

variantkernels error vs original, mean / p99GPU, torchkernels used
unidepth-v2-vitl140.0039 / 0.00516RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, dpt_fused@48e0065bb7cf:sm_120, fastbb@7d058322634d:sm_120

Limitations

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

Example output

One fixed input through this checkpoint, the same for every model of the task (kernels · float16 · NVIDIA GeForce RTX 5060 Ti).

Input
Output
A cup of coffee, input
Input · 100%

Input: A cup of coffee, Rachel Michetti (CC0).