File size: 2,599 Bytes
54b5108 | 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 72 73 74 | ---
license: other
license_name: apple-sample-code-license
license_link: LICENSE
pipeline_tag: depth-estimation
tags:
- coreml
- depth
- metric-depth
- apple-silicon
- touchdesigner
---
# Depth Pro — Core ML (metric depth, 1024, 6-bit palettized)
A Core ML conversion of [Apple's Depth Pro](https://github.com/apple/ml-depth-pro)
— **metric** monocular depth: absolute metres from a single image, with no
camera intrinsics, plus an estimated focal length.
Converted for [AML (TD Apple ML)](https://github.com/mickeyvanolst), where it
runs in the CoreML TOP inside TouchDesigner, but there is nothing
TouchDesigner-specific about the package.
## What it gives you
| output | shape | meaning |
|---|---|---|
| `depth_m` | `[1, 1, 1024, 1024]` | depth in **metres** |
| `focallength_px` | `[1]` | estimated focal length in pixels |
Input: `image`, 1536×1536 RGB (the network's own size — the depth map is
resized to 1024 inside the graph, while the values are still float).
## How it was converted
1. `depth_pro.pt` from Apple's CDN (the repo's own `get_pretrained_models.sh`).
2. Traced at 1536×1536 and converted with coremltools 9 (fp16 compute).
`deg2rad` has no Core ML conversion and was replaced with a multiply.
3. The metric arithmetic from `DepthPro.infer` is baked into the graph, so
the model returns metres rather than canonical inverse depth:
`f_px = 0.5·W / tan(0.5·fov)`, `depth = 1 / (canonical · W / f_px)`.
4. The depth map is resized to 1024² in-graph.
5. Weights palettized to 6 bits (kmeans, per-tensor).
## Accuracy and cost
Measured against the PyTorch reference on the same photograph, Apple silicon
(fanless M-series):
| | size | per frame | vs PyTorch |
|---|---|---|---|
| fp16 | 1.8 GB | 4.8 s | median 0.15 % |
| **6-bit (this package)** | **682 MB** | **3.6 s** | median 1.17 %, p95 4.5 % |
First load compiles for the Neural Engine and takes a couple of minutes;
afterwards it is cached by the OS.
## Licence
Apple's licence for Depth Pro, redistributed verbatim as `LICENSE`. The
weights come from the repository's own download script; this package is a
format conversion of them.
## Citation
@inproceedings{Bochkovskii2025:depthpro,
title = {Depth Pro: Sharp Monocular Metric Depth in Less Than a Second},
author = {Aleksei Bochkovskii and Ama\"{e}l Delaunoy and Hugo Germain and
Marcel Santos and Yichao Zhou and Stephan R. Richter and
Vladlen Koltun},
booktitle = {International Conference on Learning Representations},
year = {2025},
}
|