--- 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}, }