haotongl commited on
Commit
c073b2e
·
verified ·
1 Parent(s): f902894

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +63 -52
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
- from promptda.promptda import PromptDA
29
- from promptda.utils.io_wrapper import load_image, load_depth, save_depth
30
-
31
- DEVICE = 'cuda'
32
- image_path = "assets/example_images/image.jpg"
33
- prompt_depth_path = "assets/example_images/arkit_depth.png"
34
- image = load_image(image_path).to(DEVICE)
35
- prompt_depth = load_depth(prompt_depth_path).to(DEVICE) # 192x256, ARKit LiDAR depth in meters
36
-
37
- model = PromptDA.from_pretrained("depth-anything/prompt-depth-anything-vits-transparent").to(DEVICE).eval()
38
- depth = model.predict(image, prompt_depth) # HxW, depth in meters
39
-
40
- save_depth(depth, prompt_depth=prompt_depth, image=image)
41
- ```
42
-
43
- ## Citation
44
-
45
- If you find this project useful, please consider citing:
46
-
47
- ```bibtex
48
- @inproceedings{lin2024promptda,
49
- title={Prompting Depth Anything for 4K Resolution Accurate Metric Depth Estimation},
50
- 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},
51
- journal={arXiv},
52
- year={2024}
 
 
 
 
 
 
 
 
 
 
 
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
  }