← All models

depth-estimation Β· vision Β· WebGPU (fp16) / WASM (fp32) Β· ~72–143 MB

Metric3D β€” depth in metres from one photo

Most monocular depth models give you a relative map β€” a nearer/farther ordering in arbitrary units. Metric3D is different: it predicts absolute depth in metres against a canonical camera, so the numbers are real distances you can compare across the scene. Give it one photo and read how far every pixel is. It's small enough to run on WebGPU or plain WASM, and the photo never leaves the tab.

At a glance

Modelonnx-community/metric3d-vit-small
Task / pipelinedepth-estimation β€” monocular, metric-scale (model_type metric3d)
ArchitectureMetric3D: a ViT-Small depth backbone trained with a canonical-camera transform so a single feed-forward pass predicts absolute metric depth across datasets
Outputpredicted_depth β€” a per-pixel tensor of depth in metres; plus a 0–255 normalized image for display
Quantizationfp16 (WebGPU, ~72 MB) or fp32 (WASM, ~143 MB)
BackendWebGPU when a GPU adapter exists, else WebAssembly β€” it runs either way
Download~72 MB (fp16) / ~143 MB (fp32), cached after first load
Licensecc0-1.0 (onnx-community ONNX export)
Metric caveatAbsolute metres assume the model's canonical camera intrinsics β€” exact at the reference focal length, a calibrated estimate for an arbitrary photo. The relative metric structure across the scene is the robust signal.
Web APIsWebGPU (optional), Web Workers, OffscreenCanvas, Canvas 2D, FileReader

Run it

Pick or drop a photo, then estimate depth. The colour maps distance: the legend shows the real metre range. Darker/cooler is nearer, brighter/warmer is farther. Runs on WebGPU if you have it, otherwise on WASM.

Drop a photo, or click to choose
A sunlit bedroom Two cats on a couch A riverside at golden hour

Input

Selected photo

Metric depth (metres)

nearfar

See inside

Metric3D outputs a tensor of real numbers in metres, one per pixel. That's what makes it metric rather than relative: the values are absolute distances against a canonical camera, not arbitrary units re-normalized per image. Below is the honest view β€” the raw metre range straight from the model, the mean depth, and the distribution β€” plus the camera-intrinsics caveat that keeps the claim honest.

Estimate a depth map to see the raw metric numbers.

Metric vs relative depth

Depth Anything and DPT give a relative map β€” great for parallax and background blur, but the range is arbitrary and re-normalized per image, so "3" in one photo isn't "3" in another. Metric3D commits to metres: the same scene reads the same absolute distances, which is what lets you measure. (Apple's DepthPro is also metric but a much larger, WebGPU-only model tuned for razor-sharp boundaries β€” Metric3D is the small, WASM-friendly metric option.)

Why it matters

Absolute depth in metres from a single frame β€” no stereo rig, no LiDAR β€” turns a photo into measurable geometry:

Use cases

Basics

One photo in, a colourised metric depth map out β€” read distance as colour, with a metre legend.

Practical

Tap any point to read its distance in metres, and tap two to get the depth gap.

Wild

3D parallax β€” tilt a flat photo with your pointer, driven by real metric depth.

Multi-model

Metric depth + segmentation β†’ the mean distance in metres of each labelled region.

How the API works

Depth is a one-liner with Transformers.js. The pipeline returns both a ready-to-display image and the raw metric tensor:

import { pipeline } from "@huggingface/transformers";

const estimator = await pipeline(
  "depth-estimation",
  "onnx-community/metric3d-vit-small",
  { device: "webgpu", dtype: "fp16" },   // or device:"wasm", dtype:"fp32"
);

const { depth, predicted_depth } = await estimator(imageURL);
// depth          β†’ RawImage: grayscale, min–max normalized to 0–255 (for display)
// predicted_depth β†’ Tensor:  the raw per-pixel depth in METRES (dims = [H, W])

This page colourises depth and reads predicted_depth for the real metre range + distribution, in "See inside". Both the inference AND the per-pixel colour composite run in a Web Worker (the worker transfers a ready ImageBitmap), so estimating a large photo never freezes the page. Metric3D runs on WebGPU when available and falls back to WASM otherwise.

References