CoolFace
Modelpublic

depth-anything/Depth-Anything-V2-Base

sourceHugging Facecc-by-nc-4.0updated 2y agoView on Hugging Face
19likes11kdownloads
README.md65 linesDownload Raw Back to root
1---2license: cc-by-nc-4.03 4language:5- en6pipeline_tag: depth-estimation7library_name: depth-anything-v28tags:9- depth10- relative depth11---12 13# Depth-Anything-V2-Base14 15## Introduction16Depth 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 V118- 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 models20- impressive fine-tuned performance with our pre-trained models21 22## Installation23 24```bash25git clone https://huggingface.co/spaces/depth-anything/Depth-Anything-V226cd Depth-Anything-V227pip install -r requirements.txt28```29 30## Usage31 32Download the [model](https://huggingface.co/depth-anything/Depth-Anything-V2-Base/resolve/main/depth_anything_v2_vitb.pth?download=true) first and put it under the `checkpoints` directory.33 34```python35import cv236import torch37 38from depth_anything_v2.dpt import DepthAnythingV239 40model = DepthAnythingV2(encoder='vitb', features=128, out_channels=[96, 192, 384, 768])41model.load_state_dict(torch.load('checkpoints/depth_anything_v2_vitb.pth', map_location='cpu'))42model.eval()43 44raw_img = cv2.imread('your/image/path')45depth = model.infer_image(raw_img) # HxW raw depth map46```47 48## Citation49 50If you find this project useful, please consider citing:51 52```bibtex53@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}