Update README.md
Browse files
README.md
CHANGED
|
@@ -17,4 +17,48 @@ Depth Anything V2 is trained from 595K synthetic labeled images and 62M+ real un
|
|
| 17 |
- more efficient (10x faster) and more lightweight than SD-based models
|
| 18 |
- impressive fine-tuned performance with our pre-trained models
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
- more efficient (10x faster) and more lightweight than SD-based models
|
| 18 |
- impressive fine-tuned performance with our pre-trained models
|
| 19 |
|
| 20 |
+
## Installation
|
| 21 |
+
|
| 22 |
+
```bash
|
| 23 |
+
git clone https://huggingface.co/spaces/depth-anything/Depth-Anything-V2
|
| 24 |
+
cd Depth-Anything-V2
|
| 25 |
+
pip install -r requirements.txt
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
## Usage
|
| 29 |
+
|
| 30 |
+
Download the [model](https://huggingface.co/depth-anything/Depth-Anything-V2-Small/resolve/main/depth_anything_v2_vits.pth?download=true) first and put it under the `checkpoints` directory.
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
import cv2
|
| 34 |
+
import torch
|
| 35 |
+
|
| 36 |
+
from depth_anything_v2.dpt import DepthAnythingV2
|
| 37 |
+
|
| 38 |
+
# take depth-anything-v2-large as an example
|
| 39 |
+
model = DepthAnythingV2(encoder='vits', features=64, out_channels=[48, 96, 192, 384])
|
| 40 |
+
model.load_state_dict(torch.load('checkpoints/depth_anything_v2_vits.pth', map_location='cpu'))
|
| 41 |
+
model.eval()
|
| 42 |
+
|
| 43 |
+
raw_img = cv2.imread('your/image/path')
|
| 44 |
+
depth = model.infer_image(raw_img) # HxW raw depth map
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Citation
|
| 48 |
+
|
| 49 |
+
If you find this project useful, please consider citing:
|
| 50 |
+
|
| 51 |
+
```bibtex
|
| 52 |
+
@article{depth_anything_v2,
|
| 53 |
+
title={Depth Anything V2},
|
| 54 |
+
author={Yang, Lihe and Kang, Bingyi and Huang, Zilong and Zhao, Zhen and Xu, Xiaogang and Feng, Jiashi and Zhao, Hengshuang},
|
| 55 |
+
journal={arXiv:2406.09414},
|
| 56 |
+
year={2024}
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
@inproceedings{depth_anything_v1,
|
| 60 |
+
title={Depth Anything: Unleashing the Power of Large-Scale Unlabeled Data},
|
| 61 |
+
author={Yang, Lihe and Kang, Bingyi and Huang, Zilong and Xu, Xiaogang and Feng, Jiashi and Zhao, Hengshuang},
|
| 62 |
+
booktitle={CVPR},
|
| 63 |
+
year={2024}
|
| 64 |
+
}
|