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
- Paper UniK3D: Universal Camera Monocular 3D Estimation CVPR 2025 · first released 20 Mar 2025
Checkpoint unik3d-vitl
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("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.
| Backend | dtype | Time per call (ms) | vs original fp32 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 134 | – | 3,307 MiB/3,570 MiB | 3.0 | 0.14 |
| Original fp16torch.autocast(fp16) around the forward | fp16 | 134 | 1.00× | 3,307 MiB/3,570 MiB | 7.3 | 0.57 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 108 | 1.2× | 1,219 MiB/1,492 MiB | 4.2 | 0.14 |
| Kernels | fp16 | 62.9 | 2.1× | 1,166 MiB/1,266 MiB | 0.8 | 0.07 |
| Portable + torch.compile | 94.4 | 1.4× | 1,258 MiB/1,312 MiB | 33 (build) | – | |
| TensorRT fp16 | fp16 | 58.0 | 2.3× | 846 MiBenginenot comparable | 105 (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
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14 | Original | fp32 | 1333 | 5,316 MiB process | matches | 994x1482 |
| Portable | fp16 | 1294 | 4,038 MiB process | matches | 994x1482 | |
| Portable | fp32 | 1217 | 4,001 MiB process | matches | 994x1482 | |
| Kernels | fp16 | not implemented | – | 994x1482 | ||
| NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 117 | 1,141 MiB/1,212 MiB | – | 994x1482 |
| Kernels | fp16 | 88.9 | 1,087 MiB/1,126 MiB | – | 994x1482 | |
| NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 31.2 | 1,141 MiB/1,192 MiB | – | 994x1482 |
| Kernels | fp16 | 27.7 | 1,087 MiB/1,126 MiB | – | 994x1482 | |
| NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 90.9 | 1,141 MiB/1,212 MiB | – | 994x1482 |
| Kernels | fp16 | 78.4 | 1,087 MiB/1,126 MiB | – | 994x1482 | |
| NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 35.8 | 1,141 MiB/1,212 MiB | – | 994x1482 |
| Kernels | fp16 | 29.8 | 1,087 MiB/1,126 MiB | – | 994x1482 | |
| NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 20.3 | 1,165 MiB/1,232 MiB | – | 994x1482 |
| Kernels | fp16 | 19.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 Facefastforks 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
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0346 | 0.9843 | reference | 654 | 123 |
| Original fp16 | fp16 | 0.0346 | 0.9843 | ±0.0000 | 654 | 123 |
| Portable fp32 | fp32 | 0.0346 | 0.9843 | ±0.0000 | 654 | 364 |
| Portable | fp16 | 0.0346 | 0.9843 | ±0.0000 | 654 | 99.0 |
| Kernels | fp16 | 0.0346 | 0.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
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0277 | 0.9866 | reference | 100 | 124 |
| Original fp16 | fp16 | 0.0277 | 0.9866 | ±0.0000 | 100 | 124 |
| Portable fp32 | fp32 | 0.0277 | 0.9866 | ±0.0000 | 100 | 364 |
| Portable | fp16 | 0.0277 | 0.9866 | ±0.0000 | 100 | 99.0 |
| Kernels | fp16 | 0.0277 | 0.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
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0630 | 0.9624 | reference | 27 | 123 |
| Original fp16 | fp16 | 0.0630 | 0.9624 | ±0.0000 | 27 | 123 |
| Portable fp32 | not measured | |||||
| Portable | fp16 | 0.0630 | 0.9626 | ±0.0000 | 27 | 99.0 |
| Kernels | fp16 | 0.0630 | 0.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
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0210 | 0.9966 | reference | 15 | 134 |
| Original fp16 | fp16 | 0.0210 | 0.9966 | ±0.0000 | 15 | 134 |
| Portable fp32 | not measured | |||||
| Portable | fp16 | 0.0210 | 0.9966 | ±0.0000 | 15 | 107 |
| Kernels | fp16 | 0.0210 | 0.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).
| Check | Tolerance | Measured |
|---|---|---|
| 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) 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 (ViT patch 14); tested up to 3000x4000 (2,271 MiB allocated)
- Options
resolution_level=90 to 9· changes the outputconfidence=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 backbonesdpt_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)).
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
unik3d-vitl | Middlebury 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-vitl3000x4000 (2.2 GiB peak allocated, 2.4 reserved) unik3d-vitl994x1482, first call: portable + torch.compile 33 s (cold Inductor cache), TensorRT fp16 105 s (ONNX + engine).unik3d-vitloriginal 994x1482: torch.autocast(fp16) around the forwardunik3d-vitlload / 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.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
unik3d-vitl | NYUv2 test, AbsRel / delta1 | 0.0346 / 0.9843 | 0.0346 / 0.9843 | 0.0346 / 0.9843 | 0.0346 / 0.9843 | 0.0346 / 0.9843 | |
unik3d-vitl | iBims-1, AbsRel / delta1 | 0.0277 / 0.9866 | 0.0277 / 0.9866 | 0.0277 / 0.9866 | 0.0277 / 0.9866 | 0.0277 / 0.9866 | |
unik3d-vitl | ETH3D two-view train left, AbsRel / delta1 | 0.0630 / 0.9624 | 0.0630 / 0.9624 | 0.0630 / 0.9626 | 0.0630 / 0.9628 | possibly in the training data | |
unik3d-vitl | Middlebury 2014 trainingH left, AbsRel / delta1 | 0.0210 / 0.9966 | 0.0210 / 0.9966 | 0.0210 / 0.9966 | 0.0210 / 0.9966 | 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 |
|---|---|---|---|
unik3d-vitl | 0.00257 / 0.00355 | RTX 5060 Ti, torch 2.14.1+cu130 | dpt_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: A cup of coffee, Rachel Michetti (CC0).