File size: 1,394 Bytes
4fcc413
 
160e3c5
 
 
 
4fcc413
160e3c5
 
 
 
 
 
 
 
 
 
c2b6899
160e3c5
 
 
 
 
c4ec598
160e3c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
license: cc-by-nc-4.0
tags:
- mlx
- depth-estimation
- video-depth-anything
---

# Video Depth Anything Base (MLX)

MLX port of [Video Depth Anything](https://github.com/DepthAnything/Video-Depth-Anything) (ByteDance, CVPR 2025 highlight): consistent monocular depth estimation for arbitrarily long videos. Converted from the official checkpoint [`depth-anything/Video-Depth-Anything-Base`](https://huggingface.co/depth-anything/Video-Depth-Anything-Base).

Architecture: DINOv2 backbone + DPT head with AnimateDiff-style temporal motion modules. Outputs per-frame depth maps, not text.

## Usage

```python
from mlx_vlm import load
from mlx_vlm.models.video_depth_anything.generate import (
    VideoDepthPredictor,
    read_video_frames,
)

model, processor = load("mlx-community/Video-Depth-Anything-Base-MLX")
predictor = VideoDepthPredictor(model, processor)

frames, fps = read_video_frames("input.mp4", max_len=300, target_fps=15)
depths = predictor.infer(frames)  # (T, H, W) float32
```

## Notes

- Inputs are channel-last `(B, T, H, W, 3)`; H and W must be multiples of 14.
- Metric model: no. Metric models output absolute depth (meters) and skip scale/shift window alignment.
- Weights are fp32. On GPU, output matches the PyTorch reference to ~1% relative (Metal fast-math); on CPU to ~1e-5.

## License

CC-BY-NC-4.0 (same as the source checkpoint). Non-commercial use only.