🚀 深度任意模型V2(針對度量深度估計進行微調) - Transformers版本
本模型是深度任意模型V2的微調版本,用於使用合成的Hypersim數據集進行室內度量深度估計。
該模型檢查點與transformers庫兼容。
深度任意模型V2由Lihe Yang等人在同名論文中提出。它採用了與原始深度任意模型相同的架構,但使用了合成數據和更大容量的教師模型,以實現更精細、更穩健的深度預測。這個針對度量深度估計的微調版本首次發佈於此倉庫。
✨ 主要特性
- 發佈了分別適用於室內和室外場景的三個規模的六個度量深度模型,並可供使用。
- 利用DPT架構和DINOv2主幹網絡。
- 在約600K合成標註圖像和約6200萬真實未標註圖像上進行訓練,在相對和絕對深度估計方面均取得了最先進的成果。
📦 安裝指南
要求
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-Indoor-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-Indoor-Small-hf")
model = AutoModelForDepthEstimation.from_pretrained("depth-anything/Depth-Anything-V2-Metric-Indoor-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的微調版本,用於室內度量深度估計 |
訓練數據 |
約600K合成標註圖像和約6200萬真實未標註圖像 |
可用模型
基礎模型 |
參數 |
室內(Hypersim) |
室外(Virtual KITTI 2) |
Depth-Anything-V2-Small |
2480萬 |
模型卡片 |
模型卡片 |
Depth-Anything-V2-Base |
9750萬 |
模型卡片 |
模型卡片 |
Depth-Anything-V2-Large |
3.353億 |
模型卡片 |
模型卡片 |
🔧 技術細節
深度任意模型V2利用DPT架構和DINOv2主幹網絡。該模型在大量合成標註圖像和真實未標註圖像上進行訓練,從而在相對和絕對深度估計方面取得了最先進的成果。
深度任意模型概述。取自原始論文。
📄 許可證
此模型的相關引用信息如下:
@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}
}