Depth Anything V2 Small for ExecuTorch WebGPU

This repository contains an ExecuTorch conversion of depth-anything/Depth-Anything-V2-Small-hf for the ExecuTorch WebGPU backend, so the model runs entirely in a web browser on the visitor's GPU. It powers the corresponding demo in the ExecuTorch WebGPU Playground (launching soon on executorch.ai).

Note: This is the Small variant, which is licensed Apache-2.0 (the larger Depth Anything V2 variants use a different license).

About the original model

The Small variant of Depth Anything V2, a monocular depth estimation model trained on about 595K synthetic labeled images and 62M+ real unlabeled images.

  • Developed by: Lihe Yang et al. (HKU and TikTok)
  • Paper: Depth Anything V2
  • 24.8M parameters
  • Predicts relative depth from a single image

For training data, evaluation results and full details, see the original model card: depth-anything/Depth-Anything-V2-Small-hf.

Intended use and limitations

Relative depth maps for photos and camera frames.

Outputs relative (not metric) depth. Accuracy drops on reflective or transparent surfaces and unusual scenes.

What changed in this conversion

  • Fixed 224x224 input (upstream processes larger images)

Inputs and outputs

  • Input [1, 3, 224, 224] float32 RGB, ImageNet-normalized: (x / 255 - mean) / std, mean 0.485/0.456/0.406, std 0.229/0.224/0.225
  • Output [1, 224, 224] float32 relative inverse depth (larger means closer)

Files

File Size SHA-256
depth_v2s_webgpu.pte 92.8 MB 285602ed3a34a26a…

Full checksums are in manifest.json. The playground verifies them after download.

Running it

These programs were exported with the ExecuTorch WebGPU backend (backends/webgpu) and validated with the WebAssembly runtime build used by the ExecuTorch WebGPU Playground (launching soon on executorch.ai). That runtime build is not published yet; until it is, the playground is the supported way to run them. It downloads these files once, caches them in the browser, and runs everything locally.

Requirements: a browser with WebGPU enabled.

Provenance

  • Weights: depth-anything/Depth-Anything-V2-Small-hf @ 5426e4f0f36572d16453bbda7a8389317b1bef99, file None, sha256 None (official)
  • Exported with: executorch 1.5.1+cpu, torch 2.14.1+cpu, torchao 0.18.0+cpu, transformers 5.19.0 (executorch git 3b6068392324)
  • Reproduce: python recipes/depth-anything-v2-small.py --out out/depth-anything-v2-small (recipe in export/)
  • Re-running the recipe produces byte-identical files.

Citation

If you use this model, please cite the original work:

@misc{yang2024depth,
  title={Depth Anything V2},
  author={Lihe Yang and Bingyi Kang and Zilong Huang and Zhen Zhao and Xiaogang Xu and Jiashi Feng and Hengshuang Zhao},
  year={2024},
  eprint={2406.09414},
  archivePrefix={arXiv},
  primaryClass={cs.CV}
}

License

This is a derivative of the upstream model and is distributed under the same terms (apache-2.0); see LICENSE. Modifications (conversion to the ExecuTorch format) by Meta Platforms, Inc.

Downloads last month
27
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for executorch-community/Depth-Anything-V2-Small-ExecuTorch-WebGPU

Quantized
(12)
this model

Collection including executorch-community/Depth-Anything-V2-Small-ExecuTorch-WebGPU

Paper for executorch-community/Depth-Anything-V2-Small-ExecuTorch-WebGPU