depth-estimation Β· vision Β· WebGPU (fp16) / WASM (q8) Β· ~347 MB
Same task as the small Depth Anything V2 demo β estimate the distance to every pixel from one ordinary photo β but this is the ViT-Large checkpoint. The bigger encoder resolves thinner structures (wires, railings, hair, foliage) and gives cleaner depth edges, at the cost of a larger download and slower inference. It runs entirely on your device; the photo never leaves the tab.
| Model | onnx-community/depth-anything-v2-large |
|---|---|
| Task / pipeline | depth-estimation β monocular (single-image) relative depth |
| Architecture | DINOv2 ViT-Large encoder + DPT depth head β one depth value per pixel (vs the ViT-Small in the base demo) |
| Quantization | fp16 (WebGPU) / q8 8-bit (WASM) ONNX |
| Backend | WebGPU (fp16); falls back to WebAssembly (q8) where WebGPU is absent |
| Download | ~347 MB (q8, WASM path) / ~669 MB (fp16, WebGPU) β cached after first load |
| License | CC-BY-NC-4.0 (non-commercial) β note this differs from the Apache-2.0 small checkpoint |
| Web APIs | WebGPU, Web Workers, OffscreenCanvas / ImageBitmap (depth colourise runs off the main thread), Canvas 2D, FileReader β WebGPU is the only non-Baseline piece, and the page says so if it's missing |
Because the Large checkpoint is licensed CC-BY-NC-4.0, it's great for research, demos, and personal projects β but reach for the Apache-2.0 small model if you need a commercial licence.
Pick or drop a photo, then estimate depth. Warmer / brighter means closer; darker means further away. Switch the colour map to read the scene differently. On a WebGPU device this runs fp16; otherwise it uses the q8 WASM build β both real inference.
The model doesn't output a picture β it outputs a tensor of real numbers, one per pixel: the raw relative depth. Bigger = nearer. The colour map above is just those numbers, minβmax normalized to 0β255. Below is the honest view: the raw range straight from the model and how the depths are distributed across the scene.
| predicted_depth shape | β |
|---|---|
| raw depth range | β |
| mean raw depth | β |
| pixels estimated | β |
Both are the same Depth Anything V2 family, differing only in encoder size. The ViT-Large here (~340M params) produces sharper depth boundaries and separates thin, overlapping objects the ViT-Small (~25M params) smears together β most visible on fences, hair, plant stems, and where a foreground object meets a busy background. The trade-off is real: Large is roughly 4Γ the download and noticeably slower per image. Pick Small for speed and Apache licensing; pick Large when edge fidelity matters. Open the same photo in the small model to compare directly.
Depth used to need special hardware β a stereo rig, a LiDAR sensor, a structured-light camera. Depth Anything estimates it from a single frame. The Large checkpoint pushes the quality end of that trade-off: when the depth map feeds a downstream effect, sharper edges mean fewer halos and cleaner masks. Once you know how far away each pixel is, a whole class of effects opens up client-side:
One photo in, a colourised depth map out β read distance as colour with the sharp Large model.
Depth-driven background blur β a portrait-mode lens with the sharp Large model.
3D parallax β tilt a flat photo with your mouse and feel the depth.
Depth + SegFormer segmentation β rank the scene's objects from nearest to furthest.
Depth is a one-liner with Transformers.js. The pipeline returns both a ready-to-display image and the raw tensor:
import { pipeline } from "@huggingface/transformers";
const estimator = await pipeline(
"depth-estimation",
"onnx-community/depth-anything-v2-large",
{ device: "webgpu", dtype: "fp16" }, // ~669 MB fp16 / ~347 MB q8, cached after first load
);
const { depth, predicted_depth } = await estimator(imageURL);
// depth β RawImage: grayscale, minβmax normalized to 0β255 (great for display)
// predicted_depth β Tensor: the raw per-pixel relative depth (dims = [H, W]); bigger = nearer
This page colourises depth on a canvas and reads predicted_depth for
the real range + distribution in "See inside". Inference runs in a Web Worker, so estimating a
large photo never freezes the page.