DepthPro2-WebGPU / README.md
byoussef's picture
Credit the horses clip to Coverr
80bce41 verified
|
Raw History Blame Contribute Delete
2.88 kB
---
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 photos, videos or the camera, 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, videos and camera frames stay on the device.
- **Photo:** pick a sample or upload your own, then drag the divider between the photo and its depth.
- **Video:** pick a sample clip, upload a video or start the camera. A video's first 10 seconds are estimated at 10 frames a second, cropped to 16:9, then play back in a loop, with a pause button and a slider.
- **Models:** 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.
- **Video model:** videos and the camera run the video file of the same size, a second download of 99 or 388 MB. In it each frame also attends to the three frames before it, as in Depth Pro 2's live video mode, so the depth flickers less from frame to frame.
- **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.
The sample videos are 8-second cuts, re-encoded at 854x480. The [horses](https://coverr.co/videos/dogs-horses-and-a-cowboy-smkbjpndal) are from Coverr. The [elephants](https://commons.wikimedia.org/wiki/File:Mum_and_baby_Elephant_walking_toward_us..webm) are by John Gowland and the [wildebeests](https://commons.wikimedia.org/wiki/File:Wildebeests_at_Grumeti_River.webm) by Bettina May, both [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/), from Wikimedia Commons.