🚀 深度任意模型V2基礎版
深度任意模型V2(Depth Anything V2)是用於深度估計的模型,它基於大量合成和真實圖像進行訓練,在單目深度估計任務中表現出色,具有細節豐富、性能穩健、高效輕量等優勢。
🚀 快速開始
深度任意模型V2基於595K合成標註圖像和6200萬+真實無標註圖像進行訓練,為單目深度估計(MDE)提供了強大的解決方案。
✨ 主要特性
- 相較於深度任意模型V1,具有更精細的細節。
- 比深度任意模型V1和基於穩定擴散(SD)的模型(如Marigold、Geowizard)更穩健。
- 比基於SD的模型更高效(快10倍)、更輕量。
- 使用預訓練模型進行微調,能獲得出色的性能。
📦 安裝指南
git clone https://huggingface.co/spaces/depth-anything/Depth-Anything-V2
cd Depth-Anything-V2
pip install -r requirements.txt
💻 使用示例
基礎用法
首先,下載模型並將其放在checkpoints
目錄下。
import cv2
import torch
from depth_anything_v2.dpt import DepthAnythingV2
model = DepthAnythingV2(encoder='vitb', features=128, out_channels=[96, 192, 384, 768])
model.load_state_dict(torch.load('checkpoints/depth_anything_v2_vitb.pth', map_location='cpu'))
model.eval()
raw_img = cv2.imread('your/image/path')
depth = model.infer_image(raw_img)
📄 許可證
本項目採用CC BY-NC 4.0許可證。
📚 引用說明
如果您覺得本項目有用,請考慮引用以下文獻:
@article{depth_anything_v2,
title={Depth Anything V2},
author={Yang, Lihe and Kang, Bingyi and Huang, Zilong and Zhao, Zhen and Xu, Xiaogang and Feng, Jiashi and Zhao, Hengshuang},
journal={arXiv:2406.09414},
year={2024}
}
@inproceedings{depth_anything_v1,
title={Depth Anything: Unleashing the Power of Large-Scale Unlabeled Data},
author={Yang, Lihe and Kang, Bingyi and Huang, Zilong and Xu, Xiaogang and Feng, Jiashi and Zhao, Hengshuang},
booktitle={CVPR},
year={2024}
}