Depth Anything V2 Small (monocular depth)
Depth estimation model for transformers.js (fp32). Runs on WebGPU or WASM —
94.5 MB downloaded once from models.skillsafe.ai, then cached for every SkillSafe app that
uses it. Inference happens on your device; nothing you enter is uploaded to load it, and it never costs a credit.
Weights from Hugging Face · skillsafe-ai/depth-anything-v2-small, pinned at 8dd3386bcab8 — also loadable straight from Hugging Face outside SkillSafe (how).
Details
depth-anything-v2-small-fp32@4472b7368dd3386bcab83bcd8f8470d5f2fe8bf222648ab9Files
Each file is served at an immutable URL; the canonical form is the SHA-256 itself. Tokenizer and config JSON are not here by design — they ship in your app bundle.
| Path | Format | Size | SHA-256 | |
|---|---|---|---|---|
onnx/model.onnx | onnx | 94.5 MB | afb6a5c28f3b…1df10c |
Signature
Graph inputs and outputs read from the ONNX bytes at vetting — the tensor names your session.run() call feeds and reads. Symbolic dimensions are shown by name.
Inputs
pixel_valuesfloat32 [batch_size, 3, height, width]
Outputs
predicted_depthfloat32 [floor(1.0*batch_size), 14*floor(height/14), 14*floor(width/14)]
Use it in an app declaration · SDK loader · transformers.js · URLs · Hugging Face — generated from this entry
Add to the body of POST /v1/apps/{slug}/releases (or a release session). An unknown or withdrawn model is refused with a 400 naming it; the app page then shows "downloads 94.5 MB · runs on your device" and /models.txt carries the attribution.
{
"models": [
{
"id": "depth-anything-v2-small-fp32",
"revision": "4472b736"
}
]
} Streams with progress, verifies the SHA-256 against the catalogue, keeps a durable copy in the app's Cache API and reports whether the bytes came from cache or the network.
<script src="/sdk.js"></script> <!-- vendored from https://skillsafe.ai/apps-sdk/v1.js -->
const ss = SkillSafe.init({ slug: "your-app" });
const caps = await ss.models.capabilities(); // { webgpu, wasm, wasmSimd, storage }
const bytes = await ss.models.load("depth-anything-v2-small-fp32@4472b736", "onnx/model.onnx", {
onProgress: (p) => (bar.style.width = Math.round(p.ratio * 100) + "%"),
}); // ArrayBuffer — SHA-256 verified, cached
// Later visits: await ss.models.status("depth-anything-v2-small-fp32@4472b736") → { cached: [...], missing: [] }
// Background prefetch on a landing page: ss.models.warm("depth-anything-v2-small-fp32@4472b736") The runtime itself ships in your bundle as a vetted {path, sha256} reference — only the weights come from the registry. Pass the bytes in; do not re-fetch by URL.
import { env, pipeline } from "./transformers.min.js";
env.allowLocalModels = true;
env.localModelPath = "/models/"; // ship config.json + tokenizer.json at /models/depth-anything-v2-small-fp32/
env.allowRemoteModels = true; // only the weights fall through to the registry
env.remoteHost = "https://models.skillsafe.ai/";
env.remotePathTemplate = "{model}@{revision}/"; // → https://models.skillsafe.ai/depth-anything-v2-small-fp32@4472b736/onnx/model.onnx
const pipe = await pipeline("depth-estimation", "depth-anything-v2-small-fp32", {
revision: "4472b736",
dtype: "fp32",
device: "webgpu",
}); Immutable, credential-free, Access-Control-Allow-Origin: *, range requests honoured. The host refuses requests carrying a foreign Origin; a plain curl is fine.
https://models.skillsafe.ai/depth-anything-v2-small-fp32@4472b736/onnx/model.onnx curl -sSL -o model.onnx "https://models.skillsafe.ai/depth-anything-v2-small-fp32@4472b736/onnx/model.onnx"
shasum -a 256 model.onnx # afb6a5c28f3b6bf1618c6e43f02073ef9dfdc70e937502d51603e57b0a1df10c SkillSafe's copy on Hugging Face — the same bytes (the SHA-256 on each file page matches the hash above), plus manifest.json with the upstream commit, recipe and toolchain, the parity reference tensors and a model card. Use it directly for your own site or notebook. A SkillSafe app must load from the registry: its CSP allows models.skillsafe.ai only, and that copy is what the SDK verifies, the browser shares across apps and the app page discloses. SkillSafe keeps hosting its own copies and the API either way.
// Outside SkillSafe apps only: app hosts allow connect-src models.skillsafe.ai, not huggingface.co.
import { pipeline } from "@huggingface/transformers";
const pipe = await pipeline("depth-estimation", "skillsafe-ai/depth-anything-v2-small", { revision: "8dd3386bcab83bcd8f8470d5f2fe8bf222648ab9", device: "webgpu" }); https://huggingface.co/skillsafe-ai/depth-anything-v2-small/resolve/8dd3386bcab83bcd8f8470d5f2fe8bf222648ab9/onnx/model.onnx Evaluation
onnx.checker + onnxruntime CPU smoke run with zero-filled inputs at the declared shapes; per-file SHA-256 pinned to the source; ONNX output vs the PyTorch model from the same commit on real text (import.parity) — imported as published upstream, then checked. Evaluated Sep 22, 2026.
Parity against transformers DepthAnythingForDepthEstimation from depth-anything/Depth-Anything-V2-Small-hf@5426e4f0f365, fp32 · predicted_depth
| file | precision | max abs | mean abs | cosine / PSNR |
|---|---|---|---|---|
onnx/model.onnx | fp32 | 8.1e-6 | 3.7e-6 | 1.000000 |
onnx/model_fp16.onnx | fp16 | 0.028 | 0.012 | 0.999991 |
onnx/model_quantized.onnx | quantised | 0.170 | 0.063 | 0.999765 |
Runs under onnxruntime
Zero-filled inputs at the declared shapes, CPU execution provider on the converter host; the check is that the graph loads, runs, and emits the declared output shapes.
onnx/model.onnx: pixel_values[1,3,518,518] → predicted_depth[1,518,518] 121.6 msonnx/model_fp16.onnx: pixel_values[1,3,518,518] → predicted_depth[1,518,518] 157.7 msonnx/model_quantized.onnx: pixel_values[1,3,518,518] → predicted_depth[1,518,518] 106.7 ms
Toolchain: python 3.12.13 · platform Darwin 25.6.0 arm64 · torch 2.10.0 · onnx 1.23.0 · onnxruntime 1.30.0. Recipe models/recipes/depth-anything-v2-small.yaml (f243268eb921). Full manifest.json
Licence & attribution
Apache-2.0 · licence text · notice
Depth Anything V2 Small: Lihe Yang et al. (HKU / TikTok), Apache License 2.0. https://github.com/DepthAnything/Depth-Anything-V2 — ONNX export by onnx-community.
Apps that declare this model get this text in their generated /models.txt, so a licence that requires a notice always carries one.
Every file here was approved by exact SHA-256 after a structural audit of the graph, fetched from a content-pinned source, and is served credential-free at an immutable URL. The SDK re-verifies the hash on your device before it caches or returns anything. Missing a variant? Request it — or read how the registry works.