Instructions to use jarjoura/video-depth-anything-small-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use jarjoura/video-depth-anything-small-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir video-depth-anything-small-mlx jarjoura/video-depth-anything-small-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Upload folder using huggingface_hub
Browse files- README.md +38 -0
- config.json +14 -0
- model.safetensors +3 -0
- preprocessor_config.json +3 -0
README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- mlx
|
| 5 |
+
- depth-estimation
|
| 6 |
+
- video
|
| 7 |
+
- video-depth-anything
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Video Depth Anything Small (MLX)
|
| 11 |
+
|
| 12 |
+
MLX conversion of [depth-anything/Video-Depth-Anything-Small](https://huggingface.co/depth-anything/Video-Depth-Anything-Small) (ByteDance, CVPR 2025 highlight). Consistent monocular video depth estimation: DINOv2-vits backbone + temporal DPT head.
|
| 13 |
+
|
| 14 |
+
Converted with `python -m mlx_vlm.models.video_depth_anything.convert --variant small`.
|
| 15 |
+
|
| 16 |
+
## Usage
|
| 17 |
+
|
| 18 |
+
```python
|
| 19 |
+
from pathlib import Path
|
| 20 |
+
from mlx_vlm.utils import load_model, get_model_path
|
| 21 |
+
from mlx_vlm.models.video_depth_anything.processing_video_depth_anything import (
|
| 22 |
+
VideoDepthProcessor,
|
| 23 |
+
)
|
| 24 |
+
from mlx_vlm.models.video_depth_anything.generate import (
|
| 25 |
+
VideoDepthPredictor,
|
| 26 |
+
read_video_frames,
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
path = get_model_path("jarjoura/video-depth-anything-small-mlx")
|
| 30 |
+
model = load_model(path)
|
| 31 |
+
processor = VideoDepthProcessor.from_pretrained(path)
|
| 32 |
+
predictor = VideoDepthPredictor(model, processor)
|
| 33 |
+
|
| 34 |
+
frames, fps = read_video_frames("input.mp4", max_len=300, target_fps=15)
|
| 35 |
+
depths = predictor.infer(frames) # (T, H, W) float32 depth maps
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
Validated against the PyTorch reference: ~1e-5 max relative error on CPU, ~1% on GPU (Metal fast-math).
|
config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "video_depth_anything",
|
| 3 |
+
"encoder": "vits",
|
| 4 |
+
"metric": false,
|
| 5 |
+
"features": 64,
|
| 6 |
+
"out_channels": [
|
| 7 |
+
48,
|
| 8 |
+
96,
|
| 9 |
+
192,
|
| 10 |
+
384
|
| 11 |
+
],
|
| 12 |
+
"num_frames": 32,
|
| 13 |
+
"pe": "ape"
|
| 14 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b5e5d669740f1f3031fbef66302aee61c50db27fe4035f9599e2b9eb09f7fea1
|
| 3 |
+
size 116362301
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"input_size": 518
|
| 3 |
+
}
|