Skip to content

APPLE DEPTH PRO · MONOCULAR METRIC DEPTH

Apple Depth Pro: sharp metric depth from one image

Depth Pro is Apple’s foundation model for zero-shot monocular depth. It returns absolute distances in metres, an estimated focal length and sharp boundaries—without camera metadata. Generate a depth map in your browser, then reproduce it locally.

What Depth Pro does differently

Most monocular depth models predict relative depth: the ordering is right but the scale is unknown. Depth Pro predicts metric depth with absolute scale and estimates the focal length from the image itself, so it works on photos without EXIF data. Apple reports a multi-scale vision transformer that keeps thin structures and hair-level boundaries sharp while producing a 2.25 MP map in about 0.3 seconds on a standard GPU.

Run it in your browser

The depth map generator on this site loads the ONNX port with Transformers.js and runs on your GPU through WebGPU. The q4f16 weights are about 600 MB and are cached by the browser after the first run. Your photo never leaves the device.

Transformers.js · WebGPU
import { AutoModelForDepthEstimation, AutoProcessor, RawImage } from "@huggingface/transformers";

const id = "onnx-community/DepthPro-ONNX";
const processor = await AutoProcessor.from_pretrained(id);
const model = await AutoModelForDepthEstimation.from_pretrained(id, { device: "webgpu", dtype: "q4f16" });

const image = await RawImage.read("photo.jpg");
const { predicted_depth, focallength_px } = await model(await processor(image));
// predicted_depth: metric depth (metres); resize to the input and normalise for display.

Run Depth Pro with Python

The Transformers integration returns depth in metres plus field of view and focal length after post-processing. It runs on CUDA, on Apple Silicon through MPS, or on CPU (slowly).

Python · transformers ≥ 4.48
import torch
from PIL import Image
from transformers import DepthProForDepthEstimation, DepthProImageProcessorFast

device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
processor = DepthProImageProcessorFast.from_pretrained("apple/DepthPro-hf")
model = DepthProForDepthEstimation.from_pretrained("apple/DepthPro-hf").to(device).eval()

image = Image.open("photo.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt").to(device)
with torch.no_grad():
    outputs = model(**inputs)

post = processor.post_process_depth_estimation(outputs, target_sizes=[(image.height, image.width)])[0]
depth_m = post["predicted_depth"]          # metres, shape (H, W)
focal_px = float(post["focal_length"])     # estimated focal length in pixels
print(depth_m.min().item(), depth_m.max().item(), focal_px)

Official ml-depth-pro CLI

Apple’s repository ships a small CLI that downloads the checkpoint and writes a depth map for any input image. Use it when you want the reference implementation exactly as published.

Shell · official repository
git clone https://github.com/apple/ml-depth-pro.git
cd ml-depth-pro
conda create -n depth-pro -y python=3.9
conda activate depth-pro
pip install -e .
source get_pretrained_models.sh          # downloads checkpoints/depth_pro.pt
depth-pro-run -i ./data/example.jpg      # writes a depth map next to the input

Depth Pro vs Depth Anything

Depth Anything V2 Small is roughly ten times smaller and faster, and works without WebGPU, but its depth is relative. Choose Depth Pro when you need metres, focal length or crisp edges for compositing; choose Depth Anything for quick previews and low-end devices. The generator lets you switch between both on the same image.

Questions

Does Depth Pro run on a Mac?

Yes. The PyTorch model runs on Apple Silicon through the MPS backend, and the browser tool runs on any Mac with WebGPU. Expect several seconds per image rather than Apple’s 0.3 s, which was measured on a data-centre GPU.

Is there an official Core ML or iPhone build?

The official release is PyTorch. Converting the model to Core ML or Core AI is possible but not covered by Apple’s repository; measure memory carefully, because the native 1536 × 1536 input is heavy for phones.

How accurate is the metric scale?

Apple reports state-of-the-art zero-shot metric accuracy across several datasets, but the scale still depends on the focal-length estimate. Treat single-image metres as an estimate and validate against a known object before measuring.