File size: 1,921 Bytes
0c0b8d6
8ddb12f
 
 
 
0c0b8d6
 
8ddb12f
 
 
 
 
 
 
 
 
 
0c0b8d6
 
8ddb12f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
title: Depth Pro 2 WebGPU
emoji: 📷
colorFrom: blue
colorTo: red
sdk: static
pinned: false
license: other
license_name: apple-amlr
license_link: https://github.com/apple-aiml-research/ml-depth-pro-2/blob/main/LICENSE_MODEL
short_description: Depth from one photo, in your browser on WebGPU
models:
  - byoussef/DepthPro2-litert
tags:
  - depth-estimation
  - webgpu
  - litert
---

# Depth Pro 2 on WebGPU

[Depth Pro 2](https://huggingface.co/apple/DepthPro2) running in the browser: the [LiteRT files](https://huggingface.co/byoussef/DepthPro2-litert) on WebGPU, with [LiteRT.js](https://ai.google.dev/edge/litert/web). Photos and camera frames stay on the device.

- Pick a sample, upload a photo or start the camera, then drag the divider between the photo and its depth.
- Model S (98 MB) or B (387 MB), in float16 or float32. float16 needs the GPU's `shader-f16` feature; without it the page stays in float32.
- "Depth in meters" adds the field-of-view model (95 MB), which estimates the focal length. Point at the picture to read a distance.

It needs WebGPU: Chrome, Edge or Firefox on a computer. Safari 27.2 runs it and returns wrong depth.

The whole demo is [`index.html`](index.html).

## License

Apple Machine Learning Research Model is licensed under the Apple Machine Learning Research Model License Agreement, which allows research use only. The demo and the converted files are unofficial, and Apple does not endorse them.

The sample photos are CC0, from Wikimedia Commons: [macaques](https://commons.wikimedia.org/wiki/File:Bonnet_Macaque_David_raju-.jpg) by Davidvraju, [kitchen](https://commons.wikimedia.org/wiki/File:Blue_white_kitchen_interior_(Unsplash).jpg) by NeONBRAND, [forest path](https://commons.wikimedia.org/wiki/File:Forest_path_surrounded_by_green_trees.jpg) by Zed Can77 and [mountain reservoir](https://commons.wikimedia.org/wiki/File:Mountain_lake_dam.jpg) by Paul Gilmore.