Video Depth Anything
Video Depth Anything (ByteDance): depth of a whole clip via `model.video(frames)` (a plain call treats frames as independent), consistent over time; relative and metric. Apache-2.0 code and weights (Small only).
experimental Fork of DepthAnything/Video-Depth-Anything@4f5ae23 · backends: portable, kernels
- Paper Video Depth Anything: Consistent Depth Estimation for Super-Long Videos CVPR 2025 · first released 21 Jan 2025
Paper 2025 Added in 0.2.0 Evaluated with 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install fastforks-core
from fastforks import depth
model = depth.load("video-depth-anything-s") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.inverse_depth # also: depth
result.backend # what ran: mode, device, dtype, kernels fastforks bench video-depth-anything-s 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 | not measured | – | – | – | – |
| Original fp16upstream infer_video_depth(input_size=518, fp32=False): uint8 numpy frames in, numpy out (its API); the authors' autocast fp16 | fp16 | 11626 | – | 8,263 MiB/11.6 GiB | 0.3 | 12.77 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portablefloat CUDA frames in [0, 1] in, depth [L, H, W] on the device out | fp16 | 202 | 58× | 1,962 MiB/2,204 MiB | 1.0 | 0.20 |
| Kernelsfloat CUDA frames in [0, 1] in, depth [L, H, W] on the device out | fp16 | 200 | 58× | 1,967 MiB/2,226 MiB | 0.4 | 0.20 |
| Portable + torch.compile | not measured here | – | – | – | – | |
| TensorRT | not measured here | – | – | – | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-12 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-14 | Original | fp32 | cannot run here | – | 480x640 | |
| Portable | fp16 | 926 | 6,506 MiB process | matches | 480x640 | |
| Portable | fp32 | 823 | 7,546 MiB process | matches | 480x640 | |
| Kernels | fp16 | not implemented | – | 480x640 | ||
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
Commercial use allowed
- Code
- Apache-2.0 LICENSE
- Weights
- Apache-2.0 source
- Training data
- Depth Anything V2 Small encoder; the temporal head on synthetic video depth and pseudo-labelled real videos and images per the paper (arXiv 2501.12375)
- Only the Small checkpoints (relative and metric) are Apache-2.0; the Base and Large checkpoints are CC-BY-NC-4.0 and not included.
- The metric model is trained on Virtual KITTI 2 (CC BY-NC-SA 3.0) and IRS per the upstream README (a note only).
Our reading of the licences, not legal advice.
Weights
video_depth_anything_vits.pth 116 MB· hosted on Hugging Facefastforks downloads and checks these files on first use (fastforks download video-depth-anything-s).
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.
TUM RGB-D video (3 sequences
first 110 frames each), AbsRel / delta1
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0549 | 0.9802 | reference | 330 | 63.3 |
| Original fp16 | fp16 | 0.0549 | 0.9802 | ±0.0000 | 330 | 47.6 |
| Portable fp32 | fp32 | 0.0549 | 0.9802 | ±0.0000 | 330 | 29.3 |
| Portable | fp16 | 0.0550 | 0.9802 | −0.0001 | 330 | 12.1 |
| Kernels | fp16 | 0.0549 | 0.9802 | ±0.0000 | 330 | 10.9 |
AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Video: one call per sequence, one scale + shift per sequence, AbsRel / delta1 over all its pixels with Kinect depth, mean over sequences. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-12; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks a49aaba7, 2026-11-12.
TUM RGB-D video (3 sequences
first 1000 frames each), AbsRel / delta1
| Run | dtype | AbsRel ↓ | δ1 ↑ | images | ms / image |
|---|---|---|---|---|---|
| Original fp32 | not measured | ||||
| Original fp16 | not measured | ||||
| Portable fp32 | not measured | ||||
| Portable | not measured | ||||
| Kernels | fp16 | 0.1120 | 0.8716 | 2938 | 10.9 |
The original code was not run on this dataset, so the table cannot show the distance to it.
AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Measured on RTX 5060 Ti, torch 2.14.1+cu130, fastforks a49aaba7, 2026-11-12.
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| <= 1.3e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.42 % and p99 <= 0.55 % of the reference's median |value| (absolute error of the output inverse_depth).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.000013 (relative) | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.0042 (relative) | 0.00042 (relative) |
| GPU default dtypes, p99 |diff| | ≤ 0.0055 (relative) | 0.00105 (relative) |
Recorded for video-depth-anything-s on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-12, with these kernels: fastbb
Details
Video Depth Anything (Chen et al., CVPR 2025): temporally consistent depth of long videos from the Depth Anything V2 encoder and a DPT head with temporal attention, run in overlapping 32-frame windows; relative (Small) and metric (Metric Small) checkpoints.
- 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 >= 1, resized or padded inside the model; tested up to 3000x4000 (1,799 MiB allocated)
- Options
short_side=518>= 14· changes the output
- Outputs
inverse_depth,depth- Checkpoint
arch="vits"- CUDA kernels
fastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbones
- Apple (MPS)
- fp32, fp16
Limitations
- `model.video(frames)` runs one video in time order (each window attends over time and is aligned to the previous one); calling the model with an image or a batch runs each image as a one-frame video.
- Every video runs at least one 32-frame window (shorter videos are padded with copies of their last frame): one image costs about as much as 32 frames in the temporal head.
- The whole video's depth is kept on the device as float32 (L x H x W); split very long videos.
Full reference, generated from the repository
Video Depth Anything (ByteDance): depth of a whole clip via model.video(frames) (a plain call treats frames as independent), consistent over time; relative and metric. Apache-2.0 code and weights (Small only).
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
video-depth-anything-s | TUM RGB-D fr1_room (1080x1920) | original portable kernels | 11626 202 200 | 8263 / 11890 1962 / 2204 1967 / 2226 |
video-depth-anything-s | TUM RGB-D fr1_room (480x640) | original portable kernels portable + torch.compile TensorRT fp16 | 3786 148 146 100 60.3 | 4780 / 6794 1461 / 1646 1465 / 1666 1143 / 1344 886 / 914 |
video-depth-anything-metric-s | TUM RGB-D fr1_room (1080x1920) | original portable kernels | 10776 202 200 | 8264 / 11916 1962 / 2224 1967 / 2226 |
video-depth-anything-metric-s | TUM RGB-D fr1_room (480x640) | original portable kernels portable + torch.compile TensorRT fp16 | 4012 148 147 101 60.2 | 4780 / 6806 1461 / 1666 1465 / 1646 1143 / 1464 886 / 914 |
Details
- Original code: https://github.com/DepthAnything/Video-Depth-Anything at
4f5ae23172ba - Code licence: Apache-2.0 (permissive); files:
LICENSE - Weights licence: Apache-2.0
- Licence evidence: https://github.com/DepthAnything/Video-Depth-Anything/blob/4f5ae23172ba60fd7bc11ef671cca678842c7072/LICENSE (Apache-2.0); https://huggingface.co/depth-anything/Video-Depth-Anything-Small/blob/256875362cff76724b920335dfb4b29dd611f66e/README.md (license: apache-2.0)
- Training data: Depth Anything V2 Small encoder; the temporal head on synthetic video depth and pseudo-labelled real videos and images per the paper (arXiv 2501.12375)
- Licence note: Only the Small checkpoints (relative and metric) are Apache-2.0; the Base and Large checkpoints are CC-BY-NC-4.0 and not included.
- Licence note: The metric model is trained on Virtual KITTI 2 (CC BY-NC-SA 3.0) and IRS per the upstream README (a note only).
- Options:
short_side= 518 (>= 14; alsoinput_size) - Kernel libraries:
fastbb - Variants:
video-depth-anything-s,video-depth-anything-metric-s - Outputs: inverse_depth, depth; kind:
affine_invariant_inverse - Input size: any H x W >= 1, resized or padded inside the model
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
video-depth-anything-s3000x4000 (1.8 GiB peak allocated, 3.5 reserved);video-depth-anything-metric-s3000x4000 (1.8 GiB peak allocated, 3.5 reserved) video-depth-anything-s480x640, first call: portable + torch.compile 35 s (cold Inductor cache), TensorRT fp16 103 s (ONNX + engine).video-depth-anything-metric-s480x640, first call: portable + torch.compile 33 s (cold Inductor cache), TensorRT fp16 82 s (ONNX + engine).video-depth-anything-soriginal 1080x1920, original 480x640: upstream infer_video_depth(input_size=518, fp32=False): uint8 numpy frames in, numpy out (its API); the authors' autocast fp16video-depth-anything-sportable 1080x1920, kernels 1080x1920, portable 480x640, kernels 480x640: float CUDA frames in [0, 1] in, depth [L, H, W] on the device outvideo-depth-anything-metric-soriginal 1080x1920, original 480x640: upstream infer_video_depth(input_size=518, fp32=False): uint8 numpy frames in, numpy out (its API); the authors' autocast fp16video-depth-anything-sload / first call: original 0.26 s / 14.043 s (1080x1920), portable 0.98 s / 0.539 s (480x640), kernels 0.38 s / 0.37 s (480x640)video-depth-anything-metric-sload / first call: original 3.85 s / 17.094 s (1080x1920), portable 0.19 s / 0.436 s (480x640), kernels 0.19 s / 0.5 s (480x640)- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
Measured
AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Video: one call per sequence, one scale + shift per sequence, AbsRel / delta1 over all its pixels with Kinect depth, mean over sequences. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
video-depth-anything-s | TUM RGB-D video (3 sequences, first 110 frames each), AbsRel / delta1 | 0.0549 / 0.9802 | 0.0549 / 0.9802 | 0.0550 / 0.9802 | 0.0549 / 0.9802 | 0.0549 / 0.9802 | |
video-depth-anything-s | TUM RGB-D video (3 sequences, first 1000 frames each), AbsRel / delta1 | 0.1120 / 0.8716 | |||||
video-depth-anything-metric-s | TUM RGB-D video (3 sequences, first 110 frames each), AbsRel / delta1 | 0.0786 / 0.9769 | 0.0785 / 0.9769 | 0.0786 / 0.9769 | 0.0786 / 0.9769 | 0.0785 / 0.9769 | |
video-depth-anything-metric-s | TUM RGB-D video (3 sequences, first 1000 frames each), AbsRel / delta1 | 0.1214 / 0.8883 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks a49aaba7, 2026-11-12.
Parity
CPU, float32: max |diff| <= 1.3e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.42 % and p99 <= 0.55 % of the reference's median |value| (absolute error of the output inverse_depth).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
video-depth-anything-s | 0.00042 / 0.00105 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@7d058322634d:sm_120 |
video-depth-anything-metric-s | 0.00273 / 0.00361 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@7d058322634d:sm_120 |
Limitations
model.video(frames)runs one video in time order (each window attends over time and is aligned to the previous one); calling the model with an image or a batch runs each image as a one-frame video.- Every video runs at least one 32-frame window (shorter videos are padded with copies of their last frame): one image costs about as much as 32 frames in the temporal head.
- The whole video's depth is kept on the device as float32 (L x H x W); split very long videos.
Example output
No example rendered for this checkpoint yet.