Depth Estimation
MLX
monocular-depth
metric-depth
apple-silicon
File size: 2,487 Bytes
1afa4cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f1872b8
1afa4cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f1872b8
1afa4cc
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
license: other
license_name: apple-sample-code-license
license_link: LICENSE
library_name: mlx
pipeline_tag: depth-estimation
base_model: apple/DepthPro
tags:
  - mlx
  - depth-estimation
  - monocular-depth
  - metric-depth
  - apple-silicon
---

# Depth Pro — MLX

[Apple Depth Pro](https://github.com/apple/ml-depth-pro) (sharp monocular **metric** depth from a single image) converted to [MLX](https://github.com/ml-explore/mlx) for Apple Silicon.

Code, CLI and 3D photo pipeline: **[github.com/ntoantoan/depthpro-mlx](https://github.com/ntoantoan/depthpro-mlx)**

## Usage

```bash
pip install "depthpro-mlx[inpaint]"
depthpro-mlx photo.jpg --ply     # depth.png, pointcloud.ply, 3d.mp4
```

```python
import numpy as np
from PIL import Image
from depthpro_mlx import load_model, predict

model = load_model()                      # downloads these weights
image = np.array(Image.open("photo.jpg").convert("RGB"))
out = predict(model, image)               # f_px=... if you know the focal length
out["depth"]                              # (H, W) depth in meters
out["focallength_px"]                     # estimated focal length
```

## Files

| File | Description |
|---|---|
| `depth_pro.safetensors` | All 952M parameters in float16, NHWC conv layout |

## Accuracy and speed

Parity against the official PyTorch implementation on the reference image (3024×2268):

| | Time (M4 Pro) | Peak memory | AbsRel vs. PyTorch fp32 |
|---|---|---|---|
| PyTorch MPS fp16 | 3.76 s | 7.0 GB | – |
| **MLX fp16** | **3.06 s** | 7.5 GB | 6.2e-4 |
| MLX fp32 | 4.17 s | 15.0 GB | 1.7e-6 |

## License

These weights are a format conversion of Apple's released Depth Pro weights and are redistributed under Apple's original license terms (see `LICENSE`). That license is not OSI-approved: Apple grants a personal, non-exclusive license to use, modify and redistribute, and does not explicitly address commercial use, so check the terms before shipping the weights in a product. This conversion is not affiliated with or endorsed by Apple.

```bibtex
@inproceedings{Bochkovskii2024:arxiv,
  author    = {Aleksei Bochkovskii and Ama\"{e}l Delaunoy and Hugo Germain and Marcel Santos and
               Yichao Zhou and Stephan R. Richter and Vladlen Koltun},
  title     = {Depth Pro: Sharp Monocular Metric Depth in Less Than a Second},
  booktitle = {International Conference on Learning Representations},
  year      = {2025},
  url       = {https://arxiv.org/abs/2410.02073},
}
```