← All models

depth-estimation Β· vision Β· WebGPU (fp16) / WASM (q8) Β· ~347 MB

Depth Anything V2 Large β€” the sharp, big-encoder depth model

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.

At a glance

Modelonnx-community/depth-anything-v2-large
Task / pipelinedepth-estimation β€” monocular (single-image) relative depth
ArchitectureDINOv2 ViT-Large encoder + DPT depth head β†’ one depth value per pixel (vs the ViT-Small in the base demo)
Quantizationfp16 (WebGPU) / q8 8-bit (WASM) ONNX
BackendWebGPU (fp16); falls back to WebAssembly (q8) where WebGPU is absent
Download~347 MB (q8, WASM path) / ~669 MB (fp16, WebGPU) β€” cached after first load
LicenseCC-BY-NC-4.0 (non-commercial) β€” note this differs from the Apache-2.0 small checkpoint
Web APIsWebGPU, 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.

Run it

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.

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

Input

Selected photo

Estimated depth (ViT-Large)

farnear

See inside β€” the raw depth, and what "Large" buys you

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.

Estimate a depth map to see the raw numbers.

Large (ViT-L) vs Small (ViT-S) β€” the honest contrast

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.

Why it matters

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:

Use cases

Basics

One photo in, a colourised depth map out β€” read distance as colour with the sharp Large model.

Practical

Depth-driven background blur β€” a portrait-mode lens with the sharp Large model.

Wild

3D parallax β€” tilt a flat photo with your mouse and feel the depth.

Multi-model

Depth + SegFormer segmentation β†’ rank the scene's objects from nearest to furthest.

How the API works

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.

References