Update README.md
Browse files
README.md
CHANGED
|
@@ -1,53 +1,64 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
pipeline_tag: depth-estimation
|
| 4 |
-
---
|
| 5 |
-
|
| 6 |
-
# Prompt-Depth-Anything-Vits-Transparent
|
| 7 |
-
|
| 8 |
-
## Introduction
|
| 9 |
-
|
| 10 |
-
Prompt Depth Anything is a high-resolution and accurate metric depth estimation method, with the following highlights:
|
| 11 |
-
- using prompting to unleash the power of depth foundation models, inspired by success of prompting in VLM and LLM foundation models.
|
| 12 |
-
- The widely available iPhone LiDAR is taken as the prompt, guiding the model to produce up to 4K resolution accurate metric depth.
|
| 13 |
-
- A scalable data pipeline is introduced to train the method.
|
| 14 |
-
- Prompt Depth Anything benefits downstream applications, including 3D reconstruction and generalized robotic grasping.
|
| 15 |
-
|
| 16 |
-
## Installation
|
| 17 |
-
|
| 18 |
-
```bash
|
| 19 |
-
git clone https://github.com/DepthAnything/PromptDA.git
|
| 20 |
-
cd PromptDA
|
| 21 |
-
pip install -r requirements.txt
|
| 22 |
-
pip install -e .
|
| 23 |
-
```
|
| 24 |
-
|
| 25 |
-
## Usage
|
| 26 |
-
|
| 27 |
-
```python
|
| 28 |
-
|
| 29 |
-
from
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
model =
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
}
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: depth-estimation
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Prompt-Depth-Anything-Vits-Transparent
|
| 7 |
+
|
| 8 |
+
## Introduction
|
| 9 |
+
|
| 10 |
+
Prompt Depth Anything is a high-resolution and accurate metric depth estimation method, with the following highlights:
|
| 11 |
+
- using prompting to unleash the power of depth foundation models, inspired by success of prompting in VLM and LLM foundation models.
|
| 12 |
+
- The widely available iPhone LiDAR is taken as the prompt, guiding the model to produce up to 4K resolution accurate metric depth.
|
| 13 |
+
- A scalable data pipeline is introduced to train the method.
|
| 14 |
+
- Prompt Depth Anything benefits downstream applications, including 3D reconstruction and generalized robotic grasping.
|
| 15 |
+
|
| 16 |
+
## Installation
|
| 17 |
+
|
| 18 |
+
```bash
|
| 19 |
+
git clone https://github.com/DepthAnything/PromptDA.git
|
| 20 |
+
cd PromptDA
|
| 21 |
+
pip install -r requirements.txt
|
| 22 |
+
pip install -e .
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
## Usage
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
import requests
|
| 29 |
+
from PIL import Image
|
| 30 |
+
from transformers import PromptDepthAnythingForDepthEstimation, PromptDepthAnythingImageProcessor
|
| 31 |
+
|
| 32 |
+
url = "https://github.com/DepthAnything/PromptDA/blob/main/assets/example_images/image.jpg?raw=true"
|
| 33 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
image_processor = PromptDepthAnythingImageProcessor.from_pretrained("depth-anything/prompt-depth-anything-vits-transparent-hf")
|
| 37 |
+
model = PromptDepthAnythingForDepthEstimation.from_pretrained("depth-anything/prompt-depth-anything-vits-transparent-hf")
|
| 38 |
+
|
| 39 |
+
prompt_depth_url = "https://github.com/DepthAnything/PromptDA/blob/main/assets/example_images/arkit_depth.png?raw=true"
|
| 40 |
+
prompt_depth = Image.open(requests.get(prompt_depth_url, stream=True).raw)
|
| 41 |
+
|
| 42 |
+
inputs = image_processor(images=image, return_tensors="pt", prompt_depth=prompt_depth)
|
| 43 |
+
with torch.no_grad():
|
| 44 |
+
outputs = model(**inputs)
|
| 45 |
+
post_processed_output = image_processor.post_process_depth_estimation(
|
| 46 |
+
outputs,
|
| 47 |
+
target_sizes=[(image.height, image.width)],
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
predicted_depth = post_processed_output[0]["predicted_depth"]
|
| 51 |
+
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## Citation
|
| 55 |
+
|
| 56 |
+
If you find this project useful, please consider citing:
|
| 57 |
+
|
| 58 |
+
```bibtex
|
| 59 |
+
@inproceedings{lin2024promptda,
|
| 60 |
+
title={Prompting Depth Anything for 4K Resolution Accurate Metric Depth Estimation},
|
| 61 |
+
author={Lin, Haotong and Peng, Sida and Chen, Jingxiao and Peng, Songyou and Sun, Jiaming and Liu, Minghuan and Bao, Hujun and Feng, Jiashi and Zhou, Xiaowei and Kang, Bingyi},
|
| 62 |
+
journal={arXiv},
|
| 63 |
+
year={2024}
|
| 64 |
}
|