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
- Paper UniDepthV2: Universal Monocular Metric Depth Estimation Made Simpler arXiv · first released 27 Feb 2025
Checkpoint unidepth-v2-vitl14
Paper 2025 Added in 0.1.0 Evaluated with 0.2.0
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.
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 132 | 1.00× | 3,230 MiB/3,508 MiB | 2.8 | 0.16 |
| Original fp16torch.autocast(fp16) around the forward | fp16 | 132 | – | 3,230 MiB/3,508 MiB | 3.8 | 0.38 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 99.8 | 1.3× | 1,208 MiB/1,472 MiB | 4.2 | 0.15 |
| Kernels | fp16 | 63.0 | 2.1× | 1,153 MiB/1,252 MiB | 2.1 | 0.06 |
| Portable + torch.compile | 96.4 | 1.4× | 1,304 MiB/1,392 MiB | 31 (build) | – | |
| TensorRT fp16 | fp16 | 64.3 | 2.1× | 1,050 MiBenginenot comparable | 119 (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
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-12 | Original | fp32 | 1356 | 5,260 MiB process | matches | 994x1482 |
| Portable | fp32 | 1252 | 6,077 MiB process | matches | 994x1482 | |
| Kernels | fp16 | not implemented | – | 994x1482 | ||
| NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 104 | 1,129 MiB/1,212 MiB | – | 994x1482 |
| Kernels | fp16 | 85.8 | 1,129 MiB/1,212 MiB | – | 994x1482 | |
| NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 27.8 | 1,129 MiB/1,212 MiB | – | 994x1482 |
| Kernels | fp16 | 25.4 | 1,129 MiB/1,212 MiB | – | 994x1482 | |
| NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 78.8 | 1,129 MiB/1,212 MiB | – | 994x1482 |
| Kernels | fp16 | 77.0 | 1,129 MiB/1,212 MiB | – | 994x1482 | |
| NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 29.0 | 1,129 MiB/1,212 MiB | – | 994x1482 |
| Kernels | fp16 | 26.6 | 1,129 MiB/1,212 MiB | – | 994x1482 | |
| NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 18.4 | 1,153 MiB/1,232 MiB | – | 994x1482 |
| Kernels | fp16 | 18.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 Facefastforks 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
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0355 | 0.9843 | reference | 654 | 57.9 |
| Original fp16 | fp16 | 0.0355 | 0.9843 | ±0.0000 | 654 | 57.9 |
| Portable fp32 | fp32 | 0.0355 | 0.9843 | ±0.0000 | 654 | 156 |
| Portable | fp16 | 0.0355 | 0.9843 | ±0.0000 | 654 | 42.0 |
| Kernels | fp16 | 0.0355 | 0.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
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0298 | 0.9850 | reference | 100 | 61.5 |
| Original fp16 | fp16 | 0.0298 | 0.9850 | ±0.0000 | 100 | 61.5 |
| Portable fp32 | fp32 | 0.0298 | 0.9850 | ±0.0000 | 100 | 172 |
| Portable | fp16 | 0.0298 | 0.9851 | ±0.0000 | 100 | 45.1 |
| Kernels | fp16 | 0.0298 | 0.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
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0586 | 0.9802 | reference | 27 | 76.1 |
| Original fp16 | fp16 | 0.0586 | 0.9802 | ±0.0000 | 27 | 75.6 |
| Portable fp32 | not measured | |||||
| Portable | fp16 | 0.0586 | 0.9802 | ±0.0000 | 27 | 56.2 |
| Kernels | fp16 | 0.0586 | 0.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
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0221 | 0.9970 | reference | 15 | 129 |
| Original fp16 | fp16 | 0.0221 | 0.9970 | ±0.0000 | 15 | 128 |
| Portable fp32 | not measured | |||||
| Portable | fp16 | 0.0221 | 0.9970 | ±0.0000 | 15 | 96.5 |
| Kernels | fp16 | 0.0221 | 0.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).
| Check | Tolerance | Measured |
|---|---|---|
| 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) andaffine_invariant_inverseare relative (unknown scale or shift, not metres). Metric models that use the focal length takemodel(image, intrinsics=K)(K[3, 3], pixels of the input):metric3d-vit-largeandda3metric-largeneed it for correct metres (da3metric-large: metres = output x focal / 300; withoutintrinsics=a 300 px focal length is assumed, wrong for a real camera).unidepth-v2-vitl14,unik3d-vitl,depth-proand MoGe estimate the camera themselves (givenintrinsics=replacefx);zoedepth-nkand the relative models (da3mono-largetoo) take none. Normals-only models (kindnone) returnresult.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 backbonescudnn_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)).
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
unidepth-v2-vitl14 | Middlebury 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-vitl143000x4000 (2.6 GiB peak allocated, 3.2 reserved) unidepth-v2-vitl14994x1482, first call: portable + torch.compile 31 s (cold Inductor cache), TensorRT fp16 119 s (ONNX + engine).unidepth-v2-vitl14original 994x1482: torch.autocast(fp16) around the forwardunidepth-v2-vitl14load / 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.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
unidepth-v2-vitl14 | NYUv2 test, AbsRel / delta1 | 0.0355 / 0.9843 | 0.0355 / 0.9843 | 0.0355 / 0.9843 | 0.0355 / 0.9843 | 0.0355 / 0.9843 | |
unidepth-v2-vitl14 | iBims-1, AbsRel / delta1 | 0.0298 / 0.9850 | 0.0298 / 0.9850 | 0.0298 / 0.9851 | 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 | 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 | 0.0221 / 0.9970 | 0.0221 / 0.9970 | possibly 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).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
unidepth-v2-vitl14 | 0.0039 / 0.00516 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_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: A cup of coffee, Rachel Michetti (CC0).