depthpro2 on Tenstorrent p150

Derived from Apple's Depth Pro 2 (apple/DepthPro2-S, -B, -L, -H and the shared focal-length estimator apple/DepthPro2-focal), with unmodified weights downloaded from Apple's repositories. Official code: apple-aiml-research/ml-depth-pro-2. This is a third-party port (a model derivative), not an Apple product, and is not affiliated with or endorsed by Apple. Apple Machine Learning Research Model is licensed under the Apple Machine Learning Research Model License Agreement. See the original model card for training details.

Depth Pro 2 estimates metric depth (metres) and the camera's focal length from a single RGB image or from the frames of a video. Four sizes are served from one image, as the serve profiles s, b, l (default) and h: S (24M parameters), B (97M), L (334M) and H+ (872M). Each is a DINOv3 vision transformer with 16 x 16 patches and class / register tokens, in which some blocks attend across all frames of a clip, followed by a DPT decoder and head that output the focal-normalized inverse depth at the input resolution. A shared DINOv3 ViT-S with an attention head estimates the field of view, from which the focal length in pixels follows (median over a clip); metric depth is f_px / (width * inverse_depth), infinite for sky. Inputs run at resolution buckets fixed when the server starts (480 x 640 and 640 x 480 by default; up to 8 buckets from presets such as 720p or 1080p, or any size); an input of another size is resized to the bucket of the nearest aspect ratio and the outputs are resized back. Videos run as overlapping clips of 16 frames (4 shared), cross-faded, as Apple's buffered streaming does, or frame by frame with a key-value cache of the previous frames (Apple's unbuffered streaming). The package includes the pre- and post-processing (EXIF orientation and 35 mm focal length, normalization, padding, the FOV resize, the focal-length median). Decoding, resizing and post-processing run on the host CPU; the network runs on the device as three persistent megakernels, the encoder, the decoder and the focal-length estimator's trunk (one program each per input shape, replayed from traces).

Runs on Tenstorrent p150 β€” see the serving profiles below.

Packaged and published with tt-model-manager 0.1.0 (manifest schema 5.1).

At a glance

Hardware p150
License Apple AMLR

Intended use

Non-commercial scientific research with Depth Pro 2's metric depth and focal-length estimates on images and video, for example studying the model's outputs, comparing implementations, or offline experiments, one request at a time. Apple's licence limits every use of the weights and of models derived from them to research purposes.

Prerequisites

  • The Tenstorrent CLI, tt: uv tool install tenstorrent (or use tt-model alone, see the Quickstart)
  • Docker
  • Tenstorrent hardware: p150
  • Read and accept the Apple Machine Learning Research Model License Agreement (research purposes only) before downloading the weights
  • About 5.4 GB of free disk for the weights of all four sizes and the focal-length estimator (fetched once into the Hugging Face cache, whichever profile is served), plus the container image

Quickstart

tt serve changh95/DepthPro2

tt serve downloads the Docker image and all 5 required checkpoints: apple/DepthPro2-focal at 622659d44a2002cf9ae4333f2569afa938290d9a, apple/DepthPro2-S at 903a1c1ade918831d138adcc4aedbcc8f4da0078, apple/DepthPro2-B at 85e67fdfb7f5b36a6f6c4495e6789d331b1d8a04, apple/DepthPro2-L at 849dc5461267e0bc006ec63ab46920ea1ed98702, apple/DepthPro2-H at 68426c789f75a7c760273e857222625b4fe69576 (into your HF cache; they are not in the image), then starts the model's own HTTP server on port 20000 (or the next free port, if that one is busy). The first start compiles kernels for your device, which takes several minutes; the server is ready when it logs Application startup complete.

Without tt-cli: tt-model serve changh95/DepthPro2.

Send the sample image shipped in this repo (a 640 x 480 CC0 street photo) to /predict (JSON) and to /predict_png (raw file in, 16-bit depth PNG out), on the port tt serve reported:

curl -sLO https://huggingface.co/changh95/DepthPro2/resolve/main/code/tt_depthpro2/samples/kropa_street/image.jpg
python3 -c "import base64, json; json.dump({'image': base64.b64encode(open('image.jpg', 'rb').read()).decode()}, open('req.json', 'w'))"
curl -s localhost:20000/predict -H 'Content-Type: application/json' -d @req.json -o resp.json
curl -s localhost:20000/predict_png --data-binary @image.jpg -o depth16.png    # uint16 = round(depth_m * 1000)
python3 -c "import base64, io, json, numpy as np; r = json.load(open('resp.json')); d = np.load(io.BytesIO(base64.b64decode(r['depth']['data']))); print(d.shape, r['focallength_px'], r['stats_m'])"

Serving profiles

Select a different serving profile using --profile.

profile hardware mesh description
s p150 P150 Depth Pro 2 S (24M parameters): the fastest
b p150 P150 Depth Pro 2 B (97M parameters)
l (default) p150 P150 Depth Pro 2 L (334M parameters): the default
h p150 P150 Depth Pro 2 H+ (872M parameters): the most accurate

Capabilities

This package exposes the model's own HTTP server on port 20000, not an OpenAI-compatible chat API β€” its request and response shapes are the model's own. See the author's notes for the payload it expects.

POST /predict takes one base64 image and returns its depth map; POST /predict_png takes the raw image file and returns a 16-bit depth PNG; POST /predict_video takes the frames of a clip or video and returns one depth map per frame. GET /health reports readiness, GET /info the weights and their commits, the device, the engines, the configuration and the limits, GET /config the configuration only; GET /v1/models is a stub, not a chat API.

request field (POST /predict) meaning
image base64 image file (PNG, JPEG or any format Pillow reads), 16 to 8192 px per side, at most 50 megapixels; turned upright per its EXIF orientation
f_px (optional) the focal length in pixels of the image; default: the image's EXIF 35 mm-equivalent focal length, else the model's estimate
use_exif (optional) true (default): use the EXIF focal length when f_px is not given
output_format (optional) npy16 (default: base64 float16 .npy), npy32 (float32), png16 (base64 16-bit PNG, uint16 = round(depth_m * png_scale), 0 = infinite) or none (statistics only)
include_inverse_depth (optional) also return the focal-normalized inverse depth
png_scale (optional) png16: units per metre, default 1000 (millimetres; 65.535 m saturates)

POST /predict_png takes the image file as the body and the query parameters f_px, png_scale and use_exif; the focal length, the statistics and the timing come back in X-Focal-Length-Px, X-Stats-M, X-Timing-Ms and further X-* headers.

request field (POST /predict_video) meaning
frames or clip base64 image files in order, or one base64 uint8 (T, H, W, 3) .npy / .npz; one size per video; at most 64 frames per request
mode (optional) buffered (default: clips of 16 frames overlapping by 4, cross-faded; one focal length per video, from the first 16 frames), unbuffered (each frame attends a key-value cache of the previous 15 frames and is returned at once), clip (the frames as one clip that attends to itself, 1 to 16 frames)
stream (optional) {"id": "<any>", "end": false} keeps a buffered or unbuffered stream open across requests for long or live videos; each request returns the frames it finishes, end: true returns the rest and closes it; one unbuffered stream at a time by default
f_px, window, overlap, output_format, include_inverse_depth (optional) as above; window / overlap at most the server's

Response of /predict for the sample image as served on the p150 (depth data elided, values rounded, profile l):

{"model": "depthpro2", "size": "L", "frames": 1, "input_size": [480, 640], "bucket": [480, 640],
 "device_size": [480, 640], "resized": false, "focallength_px": 490.04, "focal_source": "fov",
 "fov_deg": [[65.85, 52.19]],
 "depth": {"format": "npy", "dtype": "float16", "shape": [480, 640], "data": "...", "units": "m"},
 "stats_m": {"pixels": 307200, "infinite_pixels": 32160, "min": 1.43, "p05": 1.68, "median": 6.96,
             "p95": 29.6, "max": 44182.7},
 "timing_ms": {"decode": "...", "preprocess": "...", "device": "...", "fov": "...", "postprocess": "...",
               "encode": "...", "total": "..."}}
  • depth is metres along the optical axis at the input size; inf (infinite_pixels) marks sky, where the network's inverse depth is 0. Decode with np.load(io.BytesIO(base64.b64decode(depth["data"]))); values above 65504 m read as inf in the float16 encoding (npy32 keeps them).
  • focallength_px is in input pixels; focal_source is request, exif or fov. fov_deg is the estimated horizontal and vertical field of view per frame.
  • An input of exactly a bucket's size runs natively (resized: false); any other size is resized to the bucket of the nearest aspect ratio and back (resized: true). /info lists the buckets.
  • timing_ms is measured in the server: decoding, pre-processing, the device run, the focal-length estimate, post-processing and response encoding.
  • Errors: HTTP 400 with the reason for an image that cannot be decoded or is out of the size range, a non-positive f_px, frames of different sizes, a clip length the device programs were not built for, or a disabled video mode; 422 for an unknown field or a value of the wrong type; 429 when too many video streams are open; 503 while the server starts; 500 with the exception text on a device failure.
  • A Python API with the same outputs (tt_depthpro2.DepthPro2: infer, infer_clip, infer_video, stream) is described in code/PYTHON.md; it needs a tt-metal build with the two patches in patches/.

Configuration

The server builds its device programs for one configuration when it starts; change it with environment variables in the container's launch command (tt-model serve --print prints it) and start it again. GET /config reports it.

item environment variable values default
model size DEPTHPRO2_SIZE (the serve profiles set it) S, B, L, H L (profile l)
resolution buckets DEPTHPRO2_RESOLUTIONS up to 8 of HxW (32 to 4096 px per side) or qvga, vga, square, 720p, 1080p and their _portrait forms vga,vga_portrait
video clip length DEPTHPRO2_WINDOW 1 to 16 16
buffered overlap DEPTHPRO2_OVERLAP 0 to window - 1 4
further clip lengths DEPTHPRO2_CLIP_LENGTHS auto (1 and the window), all, or a list auto
focal-length estimator DEPTHPRO2_FOV 1 / 0 1
video modes DEPTHPRO2_VIDEO_MODES buffered, unbuffered, both, or auto auto: both when the key-value caches fit 4 GiB of device memory
unbuffered streams open at once DEPTHPRO2_KV_STREAMS 1 to 8 (one cache per bucket each) 1
device engines DEPTHPRO2_ENGINE per stage mk (megakernel) or ttnn (tt-nn operations), e.g. dec=ttnn; stages not named keep the default enc=mk,dec=mk,fov=mk
encoder precision DEPTHPRO2_ENC_PRECISION high: on L, float32 LayerNorm output into the attention and MLP input matmuls and two-part (hi / lo) prefix keys; fast: the plain bfloat16 encoder on L too (high costs L 5-18 % more encoder time); S, B, H+ and the focal-length estimator run the same either way high

Every bucket adds device programs and their start-up time; any clip length up to the window runs on the window's program. The unbuffered key-value caches take device memory per bucket and stream (window 16):

size per 480 x 640 bucket default (2 buckets, 1 stream) per 1080 x 1920 bucket
S 108 MiB 217 MiB 720 MiB
B 217 MiB 434 MiB 1.41 GiB
L 578 MiB 1.13 GiB 3.75 GiB
H+ 993 MiB 1.94 GiB 6.45 GiB (above the auto budget: buffered only)

Example output

Depth Pro 2 L on a Tenstorrent p150: a walk down a street in Ljubljana and its inverse depth, served by /predict_video in buffered mode

92 frames (7.4 s at 12.5 frames/s) of a walk down Trubarjeva street in Ljubljana, resized to the 480 x 640 bucket and sent to this package's container (profile l) as one buffered /predict_video stream (16-frame clips overlapping by 4). Left: the input; right: the inverse depth it returned, on one logarithmic colour scale for the whole clip (near = red, far = blue, sky = black). Also as MP4 (1280 x 512, H.264). Source video: "Walking down the Trubarjeva street" by Sounds of Changes, Wikimedia Commons, CC BY 3.0, trimmed, cropped, resized and shown with the model's output; its author does not endorse this work. Attributions for every file in media/: media/ATTRIBUTION.md.

Depth Pro 2 L on a Tenstorrent p150: the shipped sample image and its inverse depth from /predict

The shipped sample image (CC0) and the inverse depth /predict returned for it on profile l (the response shown above), with the focal length and the depth range in the caption.

Expected performance

Agreement with Apple's own float32 code on the CPU (same weights and inputs) of the shipped engines (encoder, decoder and focal-estimator megakernels), per size, with Apple's own bfloat16 run (its default on GPUs) in parentheses:

eval S B L H+ frames
Inverse depth PCC, a 480 x 640 image 0.999996 0.999997 0.999999 0.999999 1
Depth AbsRel, a 480 x 640 image 0.0035 (0.0039) 0.0025 (0.0021) 0.0014 (0.0035) 0.0024 (0.0016) 1
Inverse depth PCC / depth AbsRel, a 4-frame 240 x 320 clip (frames attending each other) 0.999998 / 0.0062 (0.0055) 0.999998 / 0.0037 (0.0032) 0.999999 / 0.0018 (0.0042) 0.999998 / 0.0019 (0.0020) 4
Inverse depth PCC / depth AbsRel, a 375 x 500 image (padded to 384 x 512) 0.99961 / 0.0179 (0.0133) 0.99992 / 0.0094 (0.0079) 0.9913 [1] / 0.0049 (0.0052) 0.99993 / 0.0057 (0.0050) 1
Focal length error: 480 x 640 image / 4-frame clip / 375 x 500 image 0.05 % / 0.16 % / 1.0 % (0.12 % / 0.13 % / 1.45 %) same estimator same estimator same estimator 6
Inverse depth PCC, every frame of a 16-frame 480 x 640 clip, a 5-frame clip and a 20-frame buffered video (lowest frame, vs this package's float32 CPU reference) 0.99998 0.999996 0.999997 0.999998 41
Unbuffered video, every frame (key-value cache; 6 frames of 480 x 640, vs this package's float32 CPU reference) 0.999988 0.999995 0.999997 0.999998 6

AbsRel is the mean relative depth error over the pixels within 100 times the nearest distance, with Apple's focal length. Apple's float32 output exists for every case except the 375 x 500 image at L and H+, which is compared with this package's float32 CPU reference (equal to Apple's float32 code to a relative error of 1e-5, this image included); the numbers in parentheses are Apple's own code run in bfloat16 on the same inputs. The focal-length estimator is shared by every size. [1] L's prediction for this image is nearly flat (its inverse depth varies by about 6 % across the image, against 33-42 % for the other sizes), so its PCC is low (0.991 here, against 0.9995 for Apple's own bfloat16 run), but its depth AbsRel (0.0049) is within Apple's own bfloat16 AbsRel (0.0052).

Determinism: the encoder megakernel gave bit-identical outputs over 1000 trace replays (after 10 to 21 launches) at each soaked configuration (S at 480 x 640 with 1 and 16 frames, B with 1, L with 1, 4 and 16, H+ with 1 and 4 and at 736 x 1280), as did the focal-estimator trunk, with no hang; the decoder megakernel over 22 launches and 1000 trace replays at each of 15 configurations (every size at 640 x 480 with 1 and 16 frames; 480 x 640 with 16 frames for S, L and H+, with 4 frames for B and H+, with 1 frame for H+; 736 x 1280 for L), with no hang, and over 500 trace replays at each of 20 (every size at 480 x 640 with 1, 4 and 16 frames, 736 x 1280 and 1088 x 1920).

speed (batch 1, warm) input S B L H+
Device time, encoder megakernel: 1 frame / 16-frame clip 480 x 640 4.2 / 158 ms 8.2 / 325 ms 23.2 / 947 ms 42.2 / 1933 ms
Device time, decoder megakernel: 1 frame / 16 frames 480 x 640 1.5 / 11.3 ms 3.3 / 22.3 ms 8.1 / 62.2 ms 8.3 / 63.8 ms
Device time, focal-estimator megakernel: 1 / 4 frames 480 x 640 5.7 / 18.3 ms same same same
Device time per image (encoder + decoder) 480 x 640 5.7 ms 11.5 ms 31.4 ms 51.8 ms
Device time per 16-frame clip (frames/s) 16 x 480 x 640 170 ms (94) 347 ms (46) 1.01 s (15.9) 2.00 s (8.0)
Served POST /predict, server timing_ms.total (focal estimated) the sample, 640 x 480 JPEG 40 ms 44 ms 67 ms 84 ms
Served POST /predict, client round trip on loopback the sample 57 ms 62 ms 85 ms 102 ms
Served POST /predict_video, one 16-frame clip, client round trip 16 frames of 480 x 640 1.63 s 1.69 s 2.32 s 3.34 s
Served POST /predict_video, a 5-frame clip (runs on the 16-frame program), client round trip 5 frames of 480 x 640 0.73 s 0.78 s 1.12 s 1.65 s
Served POST /predict_video, buffered video of 20 frames (two 16-frame clips), client round trip 20 frames of 480 x 640 2.26 s 2.53 s 3.89 s 5.73 s
Served unbuffered stream, one frame per request (tt-nn encoder step, decoder megakernel, 16-frame cache), client round trip 480 x 640 frames 87-101 ms 115-130 ms 200-228 ms 305-347 ms
Server start-up in the container (compile and capture every program): a restart with the kernel cache of an earlier start / the first start (empty kernel cache) default configuration 20 s / 169 s 27 s / 172 s 38 s / 186 s 58 s / 211 s

Device times: traced replays back to back on one p150, 20 per configuration, with the default encoder precision high (the decoder rows from the decoder megakernel's release benchmark; per image and per clip: encoder and decoder replayed together). Served rows: requests to the HTTP server of this package with its default configuration (buckets 480 x 640 and 640 x 480, window 16, unbuffered video on) on the same p150 in an 8-vCPU AMD EPYC-Rome host (code/scripts/device_server_smoke.py: 10 requests of the sample, one of each video request; the video requests returned float32 depth and inverse depth for every frame, which is part of their time). A served request adds image decoding, resizing, the focal estimate when no f_px is sent and the response encoding on the host CPU. Start-up: the server's own "ready in" time in the container started by tt serve, per profile; the first start compiles the device kernels into the container's kernel cache, which tt serve keeps for later starts.

Limitations

  • Research use only: Apple's licence allows the weights, and models derived from them such as this package, to be used exclusively for non-commercial scientific research; no commercial use, product development or use in a commercial product or service. Not for safety-critical uses (driving, robot control, medical or industrial measurement): the depth is an estimate from one camera, unvalidated for such uses, on the device and on Apple's code alike.
  • Inputs of a size that is not a configured bucket are resized to the bucket of the nearest aspect ratio and the outputs are resized back, so their results approximate what the network gives at the input's own size (an aspect ratio far from every bucket is stretched, and a small image upscaled to a larger bucket changes the focal-length estimate). Configure your camera's native resolution as a bucket (DEPTHPRO2_RESOLUTIONS) for the most faithful results.
  • Accuracy outside the gate images: on an independent held-out set (10 inputs: outdoor, indoor, portrait, telephoto and near-flat images plus a 4- and an 8-frame clip; 40 cases over the four sizes, scored against Apple's float32 output with the same gates), 38 of 40 pass (S 10, B 9, L 10, H+ 9). The two misses: B on a sky-and-water landscape, depth AbsRel 0.013 against a budget of 0.010 (Apple's own bfloat16: 0.004), a uniform 1.5 % depth scale offset; H+ on a 4-frame close-up clip, inverse-depth PCC 0.993 against 0.999, where Apple's own bfloat16 run reaches only 0.995 (its depth AbsRel, 0.014, is lower than that run's 0.017). The closest passes are S on the 8-frame clip (AbsRel 0.024 within 0.026) and L on a bright-background beach portrait (0.025 within 0.035; Apple's bfloat16 0.018). On four further inputs, used to tune L's encoder precision and so not held out, L reaches an inverse-depth PCC of 0.99957 on Apple's images.jpg at 480 x 640, while S's depth AbsRel on that photo is 0.027, 2.05 times Apple's own bfloat16 error (0.0133), just over the 2x target.
  • The resolution buckets and the video window are fixed when the server starts. A clip shorter than the window runs on the window's device program and takes as long as a full window.
  • Buffered video returns a frame only once its clip is predicted, so it lags the input by up to a window; unbuffered video returns each frame at once but sees only earlier frames, and one unbuffered stream is open at a time by default (more need DEPTHPRO2_KV_STREAMS; a stream beyond it is refused with HTTP 429). The unbuffered frame-by-frame steps run the encoder in tt-nn operations (the encoder megakernel has no key-value cache path), so they are slower per frame than an image.
  • The tt-nn decoder remains selectable (DEPTHPRO2_ENGINE=dec=ttnn), as does each stage's tt-nn implementation.
  • The tt-nn encoder (the unbuffered steps, and enc=ttnn) uses tt-nn's scaled-dot-product attention, which returned wrong rows when its batch x heads exceeded 24 (tt-nn encoder clips of 16 frames at 480 x 640 or of 4 frames for H+); the package runs those attentions in tt-nn's windowed mode, which is correct and gives the same results.
  • Batch 1; requests are served one at a time. One p150 only: the image runs device dispatch on the chip's Ethernet cores, so multi-chip meshes are not supported.
  • Precision: bfloat16 weights and activations on the device with float32 accumulation, residual streams, normalisation statistics and positional rotations, against Apple's float32 reference (Apple evaluates in bfloat16 on GPUs); Expected performance gives the measured agreement.
  • All four sizes' weights are downloaded whichever profile is served. The focal length comes from the image's EXIF data when present (35 mm-equivalent focal length), which can be wrong for cropped or digitally zoomed images: pass f_px or use_exif: false then.

Licensing

  • Weights (not redistributed here; tt serve downloads them from Apple's repositories at these commits): apple/DepthPro2-focal 622659d4, apple/DepthPro2-S 903a1c1a, apple/DepthPro2-B 85e67fdf, apple/DepthPro2-L 849dc546, apple/DepthPro2-H 68426c78, under the Apple Machine Learning Research Model License Agreement: research purposes only. Apple Machine Learning Research Model is licensed under the Apple Machine Learning Research Model License Agreement. A copy of the agreement and the notices are in code/tt_depthpro2/licenses/.
  • This package is a model derivative of Depth Pro 2 and is identified as such. Its modifications: the inference code is re-implemented (the network and the pre- and post-processing written anew; the video streaming logic follows the structure of Apple's streaming.py, see below); on the device the network runs in bfloat16 in tt-nn operations and custom device kernels; inputs are resized to fixed resolution buckets. The weights are loaded unmodified. Apple's name is used only to identify the original model; Apple does not endorse this package.
  • The video streaming logic (code/tt_depthpro2/streaming.py) follows the structure of Apple's streaming.py from apple-aiml-research/ml-depth-pro-2 (Copyright (C) 2026 Apple Inc.), used under Apple's software licence, a copy of which is code/tt_depthpro2/licenses/APPLE_SOFTWARE_LICENSE.txt.
  • Port, server and scripts (code/, except as noted above) and the tt-metal patches in patches/: Apache-2.0.
  • Sample code/tt_depthpro2/samples/kropa_street/image.jpg: "Kropa, cobblestone side street 01" by Ajznponar, Wikimedia Commons, CC0 1.0 (public domain dedication), resized to 640 x 480 without its EXIF data; the reference.* files next to it hold this package's float32 CPU outputs for it.
  • Demo media: media/demo_tt.gif and media/demo_tt.mp4 are rendered from "Walking down the Trubarjeva street" by Sounds of Changes (Wikimedia Commons, CC BY 3.0), trimmed, cropped, resized and shown with the model's output, and are distributed under CC BY 3.0; the author does not endorse this work. media/demo_sample.png shows the CC0 sample above with its output. Attributions: media/ATTRIBUTION.md.

Related packages

Feedback

Questions or problems with this package: open a discussion at https://huggingface.co/changh95/DepthPro2/discussions β€” that is what reaches its author. A problem with the tt tooling itself: tt report issue (collects your environment and opens a prefilled issue against tenstorrent/tt-cli). Product feedback: support@tenstorrent.com.

Provenance

The exact sources the image was built from β€” code/ in this repo is byte-identical to the model code inside the image:

component built from
tt-metal 44d66500520fda9f2c7060c0f6b41ec48f7ab37e (dirty tree β€” the image includes uncommitted changes)
code/ digest a2e9acdc6e000466 (sha256, first 16 hex digits)
built 2026-11-30T01:25:57+00:00 by tt-model 0.1.0
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for changh95/DepthPro2

Finetuned
(4)
this model

Collection including changh95/DepthPro2