🚀 深度任意模型V2(針對度量深度估計進行微調) - Transformers版本
深度任意模型V2是一個針對戶外度量深度估計進行微調的模型,它基於合成的虛擬KITTI數據集,是深度任意模型V2的微調版本。該模型的檢查點與transformers庫兼容。
深度任意模型V2由Lihe Yang等人在同名論文中提出。它採用了與原始深度任意模型相同的架構,但使用了合成數據和更大容量的教師模型,以實現更精細、更穩健的深度預測。這個針對度量深度估計的微調版本首次發佈於此倉庫。
✨ 主要特性
- 本模型是針對戶外度量深度估計對深度任意模型V2進行微調的版本,使用了合成的虛擬KITTI數據集。
- 模型檢查點與transformers庫兼容。
- 採用與原始深度任意模型相同的架構,結合合成數據和大容量教師模型,實現更精細、穩健的深度預測。
- 發佈了適用於室內和室外場景的三種規模的六個度量深度模型。
📦 安裝指南
要求
transformers>=4.45.0
或者,使用從源代碼安裝的transformers
最新版本:
pip install git+https://github.com/huggingface/transformers
💻 使用示例
基礎用法
以下是如何使用此模型進行零樣本深度估計的示例:
from transformers import pipeline
from PIL import Image
import requests
pipe = pipeline(task="depth-estimation", model="depth-anything/Depth-Anything-V2-Metric-Outdoor-Small-hf")
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
image = Image.open(requests.get(url, stream=True).raw)
depth = pipe(image)["depth"]
高級用法
你也可以使用模型和處理器類:
from transformers import AutoImageProcessor, AutoModelForDepthEstimation
import torch
import numpy as np
from PIL import Image
import requests
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
image_processor = AutoImageProcessor.from_pretrained("depth-anything/Depth-Anything-V2-Metric-Outdoor-Small-hf")
model = AutoModelForDepthEstimation.from_pretrained("depth-anything/Depth-Anything-V2-Metric-Outdoor-Small-hf")
inputs = image_processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
predicted_depth = outputs.predicted_depth
prediction = torch.nn.functional.interpolate(
predicted_depth.unsqueeze(1),
size=image.size[::-1],
mode="bicubic",
align_corners=False,
)
更多代碼示例,請參考文檔。
📚 詳細文檔
模型描述
深度任意模型V2利用了DPT架構,並以DINOv2為骨幹網絡。該模型在約60萬個合成標註圖像和約6200萬個真實未標註圖像上進行訓練,在相對和絕對深度估計方面都取得了最先進的成果。
深度任意模型概述。取自原始論文。
預期用途和限制
你可以使用原始模型進行零樣本深度估計等任務。請查看模型中心,以查找其他你感興趣的版本。
發佈的模型
分別發佈了適用於室內和室外場景的三種規模的六個度量深度模型,具體信息如下:
基礎模型 |
參數數量 |
室內(Hypersim) |
室外(Virtual KITTI 2) |
Depth-Anything-V2-Small |
2480萬 |
模型卡片 |
模型卡片 |
Depth-Anything-V2-Base |
9750萬 |
模型卡片 |
模型卡片 |
Depth-Anything-V2-Large |
3.353億 |
模型卡片 |
模型卡片 |
📄 許可證
引用
@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}
}