zipdepth / README.md
Flor's picture
Update model card for 0.4.0
869ffd5 verified
|
Raw History Blame Contribute Delete
9.62 kB
---
library_name: "fastforks"
pipeline_tag: "depth-estimation"
license: "other"
license_name: "see-model-card"
license_link: "https://github.com/fabiotosi92/ZipDepth/blob/91f3fd21e131641f51e8d35736d1958350180e3a/LICENSE"
tags:
- "depth"
- "mono-depth"
- "monocular-depth"
- "cuda"
- "pytorch"
- "fastforks"
- "fastforks-card"
---
# ZipDepth (fastforks)
ZipDepth (Tosi et al., ECCV 2026): lightweight zero-shot relative monocular depth from a RepVGG encoder with strip-pooling and global-context attention and a small FPN decoder with a convex x2 upsampler, distilled from Depth Anything V2 Large; the NPU variant replaces the unfold upsampler by an unfold-free blend.
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/fabiotosi92/ZipDepth> at `91f3fd2`.
Task: depth. Tier: experimental. Outputs: `inverse_depth`. 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`, `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).
## Variants
Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in [`card.toml`](https://github.com/kleinicke/fastforks/blob/main/src/fastforks/depth/models/zipdepth/card.toml).
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
| `zipdepth-base@1` | [zipdepth_base.pth](https://raw.githubusercontent.com/fabiotosi92/ZipDepth/91f3fd21e131641f51e8d35736d1958350180e3a/checkpoints/zipdepth_base.pth) | `a55910bb0b99` | MIT (assumed from code) | yes |
| `zipdepth-base-npu@1` | [zipdepth_base_npu.pth](https://raw.githubusercontent.com/fabiotosi92/ZipDepth/91f3fd21e131641f51e8d35736d1958350180e3a/checkpoints/zipdepth_base_npu.pth) | `627c04fda584` | MIT (assumed from code) | yes |
## Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Licence files: `LICENSE`.
Code licence: MIT; the authors do not state a separate weights licence.
Training data: COCO 2017 (train, instance annotations), Objects365 (train, box annotations), ADE20K (SceneParsing, 150 classes), MegaDepth (Internet photo collections with SfM / MVS depth), not stated by the authors (Distilled from Depth Anything V2 Large pseudo-depth on about 14.1M images of 17 domains (ACDC, ADE20K, BDD100K, Cityscapes, COCO, DrivingStereo, Flickr1024, Gated2Depth, GoogleLandmarks, HRWSI, HoloPix50K, Mapillary, MegaDepth, Objects365, OpenImages v7, SA-1B, Trans10K) per the README).
- Licence note: The repository carries one MIT licence for code; the checkpoints are files of the same repository and have no licence statement of their own (assumed MIT). The pseudo-labels the network was distilled from come from Depth Anything V2 Large, whose weights are CC-BY-NC-4.0: the terms for commercial use of the distilled weights are unclear (a note only).
Licence evidence: https://github.com/fabiotosi92/ZipDepth/blob/91f3fd21e131641f51e8d35736d1958350180e3a/LICENSE (the checkpoints are files of the same repository)
## Input size
any H x W >= 1, resized or padded inside the model
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `zipdepth-base` 3000x4000 (0.4 GiB peak allocated, 0.4 reserved); `zipdepth-base-npu` 3000x4000 (0.4 GiB peak allocated, 0.4 reserved)
## Speed and memory
### Depth, synthetic
| model | input | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `zipdepth-base` | 994x1482 | – | – | – | 2.69 | – | – | – | – | 93 / 114 |
| `zipdepth-base-npu` | 994x1482 | – | – | – | 2.73 | – | – | – | – | 93 / 114 |
### 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 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `zipdepth-base` | 4.44 | 7.35 | 2.99 | – | – | – | 136 / 174 | 98 / 120 | – |
| `zipdepth-base-npu` | 4.37 | 7.32 | 3.01 | – | – | – | 137 / 178 | 98 / 120 | – |
### Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
| --- | --- | --- | --- | --- | --- | --- |
| `zipdepth-base` | 0.15 | 0.27 | 0.17 (518x770) | 0.55 | 0.03 | 0.49 (518x770) |
| `zipdepth-base-npu` | 0.14 | 0.06 | 0.27 (518x770) | 0.01 | 0.00 | 0.33 (518x770) |
### torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT (fp16 unless shown) | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `zipdepth-base` | 994x1482 | 2.99 ms | 1.60 ms | 0.725 ms | 2.69 ms | 9.36 s | 23.9 s | 98 / 120 | 112 / 130 | 93 / 114 | 138 / 182 |
| `zipdepth-base-npu` | 994x1482 | 3.01 ms | 1.63 ms | 0.669 ms | 2.73 ms | 9.10 s | 16.1 s | 98 / 120 | 112 / 130 | 93 / 114 | 138 / 182 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above 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
### On public datasets
Aligned depth scores fit scale and shift by least squares, in disparity space for inverse-depth models. Metric depth scores follow each dataset's protocol. Both average over images. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | portable | portable fp32 | note |
|---|---|---|---|---|
| `zipdepth-base` | NYUv2 test, AbsRel / delta1 | 0.0765 / 0.9498 | 0.0766 / 0.9497 | |
| `zipdepth-base` | iBims-1, AbsRel / delta1 | 0.0778 / 0.9339 | 0.0779 / 0.9339 | |
| `zipdepth-base` | ETH3D two-view train left, AbsRel / delta1 | 0.1166 / 0.8524 | 0.1166 / 0.8523 | possibly in the training data |
| `zipdepth-base` | Middlebury 2014 trainingH left, AbsRel / delta1 | 0.0532 / 0.9837 | 0.0532 / 0.9836 | possibly in the training data |
| `zipdepth-base-npu` | NYUv2 test, AbsRel / delta1 | 0.0761 / 0.9509 | 0.0761 / 0.9510 | |
| `zipdepth-base-npu` | iBims-1, AbsRel / delta1 | 0.0775 / 0.9337 | 0.0774 / 0.9337 | |
| `zipdepth-base-npu` | ETH3D two-view train left, AbsRel / delta1 | 0.1162 / 0.8547 | 0.1162 / 0.8548 | possibly in the training data |
| `zipdepth-base-npu` | Middlebury 2014 trainingH left, AbsRel / delta1 | 0.0532 / 0.9825 | 0.0532 / 0.9825 | possibly in the training data |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks f0b2da70d, 2026-11-30.
### Parity with the original code
Every variant is checked against reference 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 <= 5 % of the reference's median |value| (absolute error of the output `inverse_depth`).
## Limitations
- Relative depth only: inverse depth up to an unknown scale and shift, not metric.
## Usage
```python
from fastforks import depth
model = depth.load("zipdepth-base") # mode="auto": the preferred backend from recorded measurements
result = model("room.jpg")
result.inverse_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: `zipdepth-base`, `zipdepth-base-npu`.
## Kernels backend
`depth.load("zipdepth-base", mode="kernels")` runs our CUDA kernels (`fvm_conv`). 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.
<!-- staged from fastforks 0d8c365f7 (2026-12-02) -->