README.md
1.9 KB · 65 lines · markdown Raw
1 ---
2 license: cc-by-nc-4.0
3
4 language:
5 - en
6 pipeline_tag: depth-estimation
7 library_name: depth-anything-v2
8 tags:
9 - depth
10 - relative depth
11 ---
12
13 # Depth-Anything-V2-Large
14
15 ## Introduction
16 Depth Anything V2 is trained from 595K synthetic labeled images and 62M+ real unlabeled images, providing the most capable monocular depth estimation (MDE) model with the following features:
17 - more fine-grained details than Depth Anything V1
18 - more robust than Depth Anything V1 and SD-based models (e.g., Marigold, Geowizard)
19 - more efficient (10x faster) and more lightweight than SD-based models
20 - impressive fine-tuned performance with our pre-trained models
21
22 ## Installation
23
24 ```bash
25 git clone https://huggingface.co/spaces/depth-anything/Depth-Anything-V2
26 cd Depth-Anything-V2
27 pip install -r requirements.txt
28 ```
29
30 ## Usage
31
32 Download the [model](https://huggingface.co/depth-anything/Depth-Anything-V2-Large/resolve/main/depth_anything_v2_vitl.pth?download=true) first and put it under the `checkpoints` directory.
33
34 ```python
35 import cv2
36 import torch
37
38 from depth_anything_v2.dpt import DepthAnythingV2
39
40 model = DepthAnythingV2(encoder='vitl', features=256, out_channels=[256, 512, 1024, 1024])
41 model.load_state_dict(torch.load('checkpoints/depth_anything_v2_vitl.pth', map_location='cpu'))
42 model.eval()
43
44 raw_img = cv2.imread('your/image/path')
45 depth = model.infer_image(raw_img) # HxW raw depth map
46 ```
47
48 ## Citation
49
50 If you find this project useful, please consider citing:
51
52 ```bibtex
53 @article{depth_anything_v2,
54 title={Depth Anything V2},
55 author={Yang, Lihe and Kang, Bingyi and Huang, Zilong and Zhao, Zhen and Xu, Xiaogang and Feng, Jiashi and Zhao, Hengshuang},
56 journal={arXiv:2406.09414},
57 year={2024}
58 }
59
60 @inproceedings{depth_anything_v1,
61 title={Depth Anything: Unleashing the Power of Large-Scale Unlabeled Data},
62 author={Yang, Lihe and Kang, Bingyi and Huang, Zilong and Xu, Xiaogang and Feng, Jiashi and Zhao, Hengshuang},
63 booktitle={CVPR},
64 year={2024}
65 }