UniK3D (fastforks)
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.
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/UniK3D at 29f7862.
Author weight repos: https://huggingface.co/lpiccinelli/unik3d-vitl.
Task: depth. Tier: experimental. Outputs: depth, points, confidence. Backends: portable, kernels.
Input: one RGB image. Output: a depth or inverse-depth map. kind (a card field, result.kind) says what the numbers mean: metric = metres; scale_invariant, affine_invariant 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.
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 |
|---|---|---|---|---|
unik3d-vitl@1 |
model.safetensors | 890be79699dd |
CC-BY-NC-SA-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-SA-4.0. Files: LICENSE.
Code licence: CC-BY-NC-SA-4.0; the authors do not state a separate weights licence.
Training data: Mixture of public metric-depth datasets (pinhole, fisheye and panoramic cameras) per the UniK3D paper (arXiv 2503.16591).
Licence evidence: https://github.com/lpiccinelli-eth/UniK3D/blob/29f7862f3c3ee79c53ef0153dfc901ce511df575/LICENSE
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)
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 |
|---|---|---|---|---|---|---|---|---|---|
unik3d-vitl |
133.7 | 133.9 | 107.77 | 62.92 | 2.1x | 1.7x | 3307 / 3570 | 1219 / 1492 | 1166 / 1266 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
unik3d-vitl |
7.28 | 4.16 | 0.84β | 0.57 | 0.14 | 0.07 |
torch.compile and TensorRT
| model | input | portable ms | compile ms | compile s (cold) | TensorRT fp16 ms | ONNX + build s | kernels ms | peak MiB (alloc / reserved): portable | compile | TensorRT (device) |
|---|---|---|---|---|---|---|---|---|---|---|
unik3d-vitl |
994x1482 | 107.77 | 94.4 | 32.8 | fails: TensorRT: antialiased resize not supported | β | 62.92 | 1219 / 1492 | 1258 / 1312 | β |
Fixed-size speed and peak memory, all models
| model | mode | 640x480 | 1280x720 | 1920x1080 | 12 MP 4000x3000 |
|---|---|---|---|---|---|
unik3d-vitl |
portable | 115.1 ms / 2101 / 2474 | 124.2 ms / 2153 / 2570 | 124.8 ms / 2166 / 2582 | 128.7 ms / 2271 / 2486 |
unik3d-vitl |
kernels | 57.9 ms / 1076 / 1202 | 62.6 ms / 1101 / 1272 | 63.2 ms / 1115 / 1240 | 65.9 ms / 1226 / 1512 |
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
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| (absolute error of the output depth).
Usage
from fastforks import depth
# non-commercial weights: run with FASTFORKS_NONCOMMERCIAL=1 in the environment
model = depth.load("unik3d-vitl") # mode="auto": the preferred backend from recorded measurements
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: unik3d-vitl.
Kernels backend
depth.load("unik3d-vitl", mode="kernels") runs our CUDA kernels (fastbb, 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.