Depth Anything V2
Depth Anything V2는 DINOv2 인코더와 DPT 디코더를 결합하여 이미지 하나에서 조밀한 상대 역깊이 맵을 예측합니다. LibreYOLO는 깊이 작업의 예측과 제로샷 검증을 지원하지만 학습 경로는 제공하지 않습니다.
- 작업
- depth
- 크기
- s, b, l, g at 518 px
- 설치
pip install libreyolo- 지원 티어
- 추론 전용, v부터 지원. 예측, 검증, 내보내기만 지원합니다. 학습 기능은 적용되지 않습니다.
- 업스트림
- The University of Hong Kong and TikTok의 Depth Anything V2, Apache-2.0 (Small checkpoint); CC-BY-NC-4.0 (Base and Large checkpoints). 논문, 소스
- 라이선스
- 코드 Apache-2.0, 가중치 Apache-2.0 (Small checkpoint); CC-BY-NC-4.0 (Base and Large checkpoints). 상업적 사용
설치
Depth Anything V2에는 선택적 extra가 필요하지 않습니다. 가져오는 모든 항목이 기본 설치에 포함됩니다.
pip install libreyolo예측
처음 사용할 때 Hugging Face에서 가중치를 다운로드해 로컬에 캐시합니다.
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreDepthAnythingV2s-depth.pt")result = model(SAMPLE_IMAGE, save=True) depth = result.depth_mapprint(depth.min, depth.max, depth.mean)libreyolo predict model=LibreDepthAnythingV2s-depth.pt source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpg save=Truefrom libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreDepthAnythingV2s-depth.pt")result = model(SAMPLE_IMAGE) depth = result.depth_map # DepthMap: 조밀한 (H, W), 높을수록 가까움raw = depth.data # 텐서, 미터법 단위나 이미지 간 공통 스케일 없음normalized = depth.normalized() # 시각화를 위해 [0, 1]로 재조정result.depth_map은 조밀한 상대 역깊이 맵을 담습니다. 값이 높을수록 카메라에 가깝고 값에는 미터법 단위나 이미지 간 공통 스케일이 없습니다. save=True는 해당 맵의 컬러맵 시각화를 디스크에 기록합니다. Results.plot()은 표면 노멀과 엣지만을 위해 정의되어 있어 이 계열을 지원하지 않습니다. 입력 해상도는 DPT 헤드의 기반인 DINOv2 패치 그리드 크기 14로 나누어떨어져야 합니다. LibreYOLO는 실행 전에 이를 검사하고 조건을 충족하지 않으면 예외를 발생시킵니다. 소스, 스트리밍, 결과 처리는 예측을 참조합니다.
변형
ViT-S/B/L/G에 해당하는 s/b/l/g의 네 인코더 크기가 있습니다. 아래 체크포인트 표에는 s, b, l만 있으며 Giant 체크포인트는 공개되지 않았습니다. 네 가지 모두 같은 입력 해상도를 사용하므로 크기 선택은 이미지 크기가 아닌 인코더 용량을 절충합니다. 라이선스도 선택 요소입니다. Small 체크포인트는 Apache-2.0이고 Base와 Large는 CC-BY-NC-4.0입니다. 아래 라이선스를 참조합니다.
이 계열은 학습과 파인튜닝을 제공하지 않습니다. LibreDepthAnythingV2.train()은 조건 없이 NotImplementedError를 발생시킵니다. 대신 weights/convert_depth_anything_v2_weights.py로 호환되는 업스트림 체크포인트를 변환합니다.
검증
val()은 공유 깊이 검증기를 실행합니다. 이미지별 최소제곱 스케일과 시프트로 각 예측을 정답에 정렬한 다음 표준 제로샷 상대 깊이 지표인 AbsRel, RMSE, 세 가지 delta 임곗값을 보고합니다.
from libreyolo import LibreYOLO model = LibreYOLO("LibreDepthAnythingV2s-depth.pt")metrics = model.val(data="my-dataset.yaml") print(metrics["metrics/abs_rel"])print(metrics["metrics/rmse"])print(metrics["metrics/delta1"])libreyolo val model=LibreDepthAnythingV2s-depth.pt data=my-dataset.yaml내보내기
| 작업 | ONNX | TorchScript | ExecuTorch | TensorRT | OpenVINO | Paddle | MNN | RKNN | ncnn | TFLite | CoreML | Core AI |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| depth | depth to ONNX: 지원함 | depth to TorchScript: 지원함 | depth to ExecuTorch: 지원함 | depth to TensorRT: 지원함 | depth to OpenVINO: 지원함 | depth to Paddle: 지원하지 않음 | depth to MNN: 지원하지 않음 | depth to RKNN: 지원하지 않음 | depth to ncnn: 지원하지 않음 | depth to TFLite: 지원하지 않음 | depth to CoreML: 지원하지 않음 | depth to Core AI: 지원함 |
내보낸 아티팩트는 파일 접미사에 따라 LibreYOLO()로 다시 불러옵니다. 따라서 .onnx 또는 .engine 파일은 체크포인트처럼 동작하며 박스 대신 depth_map을 포함한 동일한 Results를 반환합니다. 각 형식이 받는 인수는 내보내기에 나와 있습니다.
from libreyolo import LibreYOLO model = LibreYOLO("LibreDepthAnythingV2s-depth.pt")model.export(format="onnx")model.export(format="tensorrt", half=True)libreyolo export model=LibreDepthAnythingV2s-depth.pt format=onnxlibreyolo export model=LibreDepthAnythingV2s-depth.pt format=tensorrt half=Truefrom libreyolo import LibreYOLO, SAMPLE_IMAGE # 팩토리는 파일 접미사에 따라 라우팅하므로 내보낸 아티팩트도# 다른 체크포인트처럼 불러와 동일한 Results 객체를 반환합니다.model = LibreYOLO("LibreDepthAnythingV2s-depth.onnx")result = model(SAMPLE_IMAGE) print(result.depth_map.data.shape)체크포인트
이 계열에 공개된 모든 가중치 파일입니다.
| 파일 | 입력(px) | 가중치 라이선스 |
|---|---|---|
| depth | ||
| LibreDepthAnythingV2s-depth.pt | apache-2.0 | |
| LibreDepthAnythingV2l-depth.pt | cc-by-nc-4.0 | |
| LibreDepthAnythingV2b-depth.pt | cc-by-nc-4.0 | |
위의 모든 파일은 현재 LibreYOLO 조직에 있으며 처음 사용할 때 내려받습니다.
라이선스
내려받는 특정 가중치의 Hugging Face 저장소에서 라이선스를 확인하십시오. LibreYOLO 조직의 모든 체크포인트에는 라이선스가 있으며 한 계열 안에서도 항상 같지는 않습니다. 해당 저장소가 신뢰할 수 있는 기준입니다. 아래 요약은 이 페이지를 마지막으로 검증했을 때 적용된 내용을 설명합니다.
관련 라이선스에 관한 설명이며 법률 자문이 아닙니다. 상업적으로 중요한 사안이라면 라이선스를 직접 읽고 별도의 법률 자문을 받으십시오.
- 원작
- Depth Anything V2, The University of Hong Kong and TikTok
- 업스트림 라이선스
- Apache-2.0 (Small checkpoint); CC-BY-NC-4.0 (Base and Large checkpoints)
- LibreYOLO 코드
- MIT
- 가중치
- Apache-2.0 (Small checkpoint); CC-BY-NC-4.0 (Base and Large checkpoints), huggingface.co/LibreYOLO에 다시 게시됨
- 해석
- The two licenses are not interchangeable. The Small checkpoint is Apache-2.0, a permissive license: it can be used in commercial and closed-source products, it asks you to keep its license text and attribution notices with any redistributed copy, and it grants a patent license. The Base and Large checkpoints are CC-BY-NC-4.0, which forbids commercial use outright and requires attribution on any redistribution, so treat them as research and evaluation weights unless you obtain separate terms from the authors. LibreYOLO's own code for this family is MIT throughout, and training is not offered for this family so there is no self-trained-weights exception to reach for.
인용
@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}
}github.com/DepthAnything/Depth-Anything-V2#citation에 있는 저자의 인용 블록에서 복사했습니다.