Models · Monocular depth

UniK3D

UniK3D: metric 3D from one image for any camera type, using a spherical-harmonic ray model. Non-commercial licence.

stable Fork of lpiccinelli-eth/UniK3D@29f7862 · backends: portable, kernels

Checkpoint unik3d-vitl

Paper 2025 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 62.9 ms 994x1482, fp16
vs the faster original 2.1× original fp32: 134 ms
Peak memory 1,166 MiB original: 3,307 MiB
Accuracy vs original fp32 ±0.0000 kernels AbsRel, NYUv2 test (0.0346 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("unik3d-vitl")  # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.depth  # also: points, 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 unik3d-vitl

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 fp32Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32 134–3,307 MiB/3,570 MiB3.00.14
Original fp16torch.autocast(fp16) around the forwardfp16 1341.00×3,307 MiB/3,570 MiB7.30.57
Portable fp32fp32not measured ––––
Portablefp16 1081.2×1,219 MiB/1,492 MiB4.20.14
Kernelsfp16 62.92.1×1,166 MiB/1,266 MiB0.80.07
Portable + torch.compile 94.41.4×1,258 MiB/1,312 MiB33 (build)–
TensorRT fp16fp16 58.02.3×846 MiBenginenot comparable105 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-01 to 2026-11-03. 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. 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-14Originalfp321333 5,316 MiB processmatches994x1482
Portablefp161294 4,038 MiB processmatches994x1482
Portablefp321217 4,001 MiB processmatches994x1482
Kernelsfp16not implemented–994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16117 1,141 MiB/1,212 MiB–994x1482
Kernelsfp1688.9 1,087 MiB/1,126 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1631.2 1,141 MiB/1,192 MiB–994x1482
Kernelsfp1627.7 1,087 MiB/1,126 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1690.9 1,141 MiB/1,212 MiB–994x1482
Kernelsfp1678.4 1,087 MiB/1,126 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1635.8 1,141 MiB/1,212 MiB–994x1482
Kernelsfp1629.8 1,087 MiB/1,126 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1620.3 1,165 MiB/1,232 MiB–994x1482
Kernelsfp1619.1 1,111 MiB/1,166 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-SA-4.0 LICENSE
Weights
CC-BY-NC-SA-4.0 (assumed from code)(not stated by the authors; assumed to follow the code) source
Training data
Mixture of public metric-depth datasets (pinhole, fisheye and panoramic cameras) per the UniK3D paper (arXiv 2503.16591)
  • code: CC-BY-NC-SA-4.0 (noncommercial)
  • weights: CC-BY-NC-SA-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 unik3d-vitl). 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.03460.9843 reference 654 123
Original fp16fp160.03460.9843 ±0.0000 654 123
Portable fp32fp320.03460.9843 ±0.0000 654 364
Portablefp160.03460.9843 ±0.0000 654 99.0
Kernelsfp160.03460.9843 ±0.0000 654 57.3

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.02770.9866 reference 100 124
Original fp16fp160.02770.9866 ±0.0000 100 124
Portable fp32fp320.02770.9866 ±0.0000 100 364
Portablefp160.02770.9866 ±0.0000 100 99.0
Kernelsfp160.02770.9866 ±0.0000 100 57.3

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.06300.9624 reference 27 123
Original fp16fp160.06300.9624 ±0.0000 27 123
Portable fp32not measured
Portablefp160.06300.9626 ±0.0000 27 99.0
Kernelsfp160.06300.9628 ±0.0000 27 57.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.

Middlebury 2014 trainingH left

AbsRel / delta1training data not stated: possibly seen

RundtypeAbsRel ↓δ1 ↑Δ AbsRel vs fp32 originalimagesms / image
Original fp32fp320.02100.9966 reference 15 134
Original fp16fp160.02100.9966 ±0.0000 15 134
Portable fp32not measured
Portablefp160.02100.9966 ±0.0000 15 107
Kernelsfp160.02100.9966 ±0.0000 15 62.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, 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.00257 (relative)
GPU default dtypes, p99 |diff|≤ 0.02 (relative)0.00355 (relative)

Recorded for unik3d-vitl on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-07, with these kernels: dpt_fusedfastbb

Details

UniK3D (Piccinelli et al. 2025): monocular metric 3-D for any camera model; a DINOv2 ViT-L encoder and a camera-prompted decoder predict a spherical-harmonic ray model and per-pixel radii (depth, 3-D points, confidence), or use given pinhole 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 (ViT patch 14); tested up to 3000x4000 (2,271 MiB allocated)
Options
  • resolution_level=90 to 9· changes the output
  • confidence=true· changes the output
Outputs
depth, points, confidence
CUDA kernels
  • fastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbones
  • dpt_fusedfused fp16 matrix multiplies and convolutions for DINOv2 backbones and DPT depth heads
Apple (MPS)
fp32, fp16
Full reference, generated from the repository

UniK3D: metric 3D from one image for any camera type, using a spherical-harmonic ray model. Non-commercial licence.

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

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
unik3d-vitlMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
134
134
108
62.9
94.4
58.0
3307 / 3570
3307 / 3570
1219 / 1492
1166 / 1266
1258 / 1312
1609 / 1678
Details
  • Original code: https://github.com/lpiccinelli-eth/UniK3D at 29f7862
  • Code licence: CC-BY-NC-SA-4.0 (noncommercial); files: LICENSE
  • Weights licence: CC-BY-NC-SA-4.0 (assumed from code)
  • Licence evidence: https://github.com/lpiccinelli-eth/UniK3D/blob/29f7862f3c3ee79c53ef0153dfc901ce511df575/LICENSE
  • Training data: Mixture of public metric-depth datasets (pinhole, fisheye and panoramic cameras) per the UniK3D paper (arXiv 2503.16591)
  • Options: resolution_level = 9 (0 to 9), confidence = True
  • Kernel libraries: fastbb, dpt_fused
  • Variants: unik3d-vitl
  • Outputs: depth, points, confidence; kind: metric
  • Input size: any H x W >= 8, resized or padded inside the model (ViT patch 14)
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): unik3d-vitl 3000x4000 (2.2 GiB peak allocated, 2.4 reserved)
  • unik3d-vitl 994x1482, first call: portable + torch.compile 33 s (cold Inductor cache), TensorRT fp16 105 s (ONNX + engine).
  • unik3d-vitl original 994x1482: torch.autocast(fp16) around the forward
  • unik3d-vitl load / first call: original 7.28 s / 0.575 s, portable 4.16 s / 0.136 s, kernels 3.77 s / 0.298 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
unik3d-vitlNYUv2 test, AbsRel / delta10.0346 / 0.98430.0346 / 0.98430.0346 / 0.98430.0346 / 0.98430.0346 / 0.9843
unik3d-vitliBims-1, AbsRel / delta10.0277 / 0.98660.0277 / 0.98660.0277 / 0.98660.0277 / 0.98660.0277 / 0.9866
unik3d-vitlETH3D two-view train left, AbsRel / delta10.0630 / 0.96240.0630 / 0.96240.0630 / 0.96260.0630 / 0.9628possibly in the training data
unik3d-vitlMiddlebury 2014 trainingH left, AbsRel / delta10.0210 / 0.99660.0210 / 0.99660.0210 / 0.99660.0210 / 0.9966possibly 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
unik3d-vitl0.00257 / 0.00355RTX 5060 Ti, torch 2.14.1+cu130dpt_fused@48e0065bb7cf:sm_120, fastbb@7d058322634d:sm_120

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).