Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

Depth-Anything-V2

> 编程语言
Open source

[NeurIPS 2024] Depth Anything V2. A More Capable Foundation Model for Monocular Depth Estimation

8.6K stars0 likes1 views
WebsiteGitHub

About

[NeurIPS 2024] Depth Anything V2. A More Capable Foundation Model for Monocular Depth Estimation

This work presents Depth Anything V2. It significantly outperforms V1 in fine-grained details and robustness. Compared with SD-based models, it enjoys faster inference speed, fewer parameters, and higher depth accuracy.

News

  • 2025-01-22: Video Depth Anything has been released. It generates consistent depth maps for super-long videos (e.g., over 5 minutes).
  • 2024-12-22: Prompt Depth Anything has been released. It supports 4K resolution metric depth estimation when low-res LiDAR is used to prompt the DA models.
  • 2024-07-06: Depth Anything V2 is supported in Transformers. See the instructions for convenient usage.
  • 2024-06-25: Depth Anything is integrated into Apple Core ML Models. See the instructions (V1, V2) for usage.
  • 2024-06-22: We release smaller metric depth models based on Depth-Anything-V2-Small and Base.
  • 2024-06-20: Our repository and project page are flagged by GitHub and removed from the public for 6 days. Sorry for the inconvenience.
  • 2024-06-14: Paper, project page, code, models, demo, and benchmark are all released.

Pre-trained Models

We provide four models of varying scales for robust relative depth estimation:

Model Params Checkpoint
Depth-Anything-V2-Small 24.8M Download
Depth-Anything-V2-Base 97.5M Download
Depth-Anything-V2-Large 335.3M Download
Depth-Anything-V2-Giant 1.3B Coming soon

Usage

Prepraration

bash
git clone https://github.com/DepthAnything/Depth-Anything-V2
cd Depth-Anything-V2
pip install -r requirements.txt

Download the checkpoints listed here and put them under the checkpoints directory.

Use our models

…

If you do not want to clone this repository, you can also load our models through Transformers. Below is a simple code snippet. Please refer to the official page for more details.

  • Note 1: Make sure you can connect to Hugging Face and have installed the latest Transformers.
  • Note 2: Due to the upsampling difference between OpenCV (we used) and Pillow (HF used), predictions may differ slightly. So you are more recommended to use our models through the way introduced above.
python
from transformers import pipeline
from PIL import Image

pipe = pipeline(task="depth-estimation", model="depth-anything/Depth-Anything-V2-Small-hf")
image = Image.open('your/image/path')
depth = pipe(image)["depth"]

Running script on images

bash
python run.py \
  --encoder <vits | vitb | vitl | vitg> \
  --img-path <path> --outdir <outdir> \
  [--input-size <size>] [--pred-only] [--grayscale]

Options:

  • --img-path: You can either 1) point it to an image directory storing all interested images, 2) point it to a single image, or 3) point it to a text file storing all image paths.
  • --input-size (optional): By default, we use input size 518 for model inference. You can increase the size for even more fine-grained results.
  • --pred-only (optional): Only save the predicted depth map, without raw image.
  • --grayscale (optional): Save the grayscale depth map, without applying color palette.

For example:

bash
python run.py --encoder vitl --img-path assets/examples --outdir depth_vis

Running script on videos

bash
python run_video.py \
  --encoder <vits | vitb | vitl | vitg> \
  --video-path assets/examples_video --outdir video_depth_vis \
  [--input-size <size>] [--pred-only] [--grayscale]

Our larger model has better temporal consistency on videos.

Gradio demo

To use our gradio demo locally:

bash
python app.py

You can also try our online demo.

Note: Compared to V1, we have made a minor modification to the DINOv2-DPT architecture (originating from this issue). In V1, we unintentionally used features from the last four layers of DINOv2 for decoding. In V2, we use intermediate features instead. Although this modification did not improve details or accuracy, we decided to follow this common practice.

Fine-tuned to Metric Depth Estimation

Please refer to metric depth estimation.

DA-2K Evaluation Benchmark

Please refer to DA-2K benchmark.

Community Support

We sincerely appreciate all the community support for our Depth Anything series. Thank you a lot!

  • Apple Core ML:
    • https://developer.apple.com/machine-learning/models
    • https://huggingface.co/apple/coreml-depth-anything-v2-small
    • https://huggingface.co/apple/coreml-depth-anything-small
  • Transformers:
    • https://huggingface.co/docs/transformers/main/en/model_doc/depth_anything_v2
    • https://huggingface.co/docs/transformers/main/en/model_doc/depth_anything
  • TensorRT:
    • https://github.com/spacewalk01/depth-anything-tensorrt
    • https://github.com/zhujiajian98/Depth-Anythingv2-TensorRT-python
  • ONNX: https://github.com/fabio-sim/Depth-Anything-ONNX
  • ComfyUI: https://github.com/kijai/ComfyUI-DepthAnythingV2
  • Transformers.js (real-time depth in web): https://huggingface.co/spaces/Xenova/webgpu-realtime-depth-estimation
  • Android:
    • https://github.com/shubham0204/Depth-Anything-Android
    • https://github.com/FeiGeChuanShu/ncnn-android-depth_anything

Acknowledgement

We are sincerely grateful to the awesome Hugging Face team (@Pedro Cuenca, @Niels Rogge, @Merve Noyan, @Amy Roberts, et al.) for their huge efforts in supporting our models in Transformers and Apple Core ML.

We also thank the DINOv2 team for contributing such impressive models to our community.

LICENSE

Depth-Anything-V2-Small model is under the Apache-2.0 license. Depth-Anything-V2-Base/Large/Giant models are under the CC-BY-NC-4.0 license.

Citation

If you find this project useful, please consider citing:

bibtex
@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}
}

Issues· 244 open

View all issuesOpen on GitHub
  • #245

    Metric depth model licences

    Updated Sep 14, 2026
  • #331

    Verify evals on Papers with Code

    Updated Sep 14, 2026
  • #313

    Depth-Anything-V2-Giant

    Updated Jun 30, 2026
  • #328

    DA-2K数据集缺失

    Updated Jun 28, 2026
  • #327

    paperbench-task-audit-agent

    Updated Jun 28, 2026
  • #326

    有人在S100P上用BPU int8部署过DA-V2吗

    Updated Jun 4, 2026
  • #281

    Cannot Reproduce Evaluation Result on ETH-3D Dataset

    Updated May 31, 2026
  • #280

    Unable to get same metric results in zero-shot relative depth estimation

    Updated May 31, 2026
  • #324

    Dino cos loss used or not when training teacher model?

    Updated May 30, 2026
  • #322

    video error after succesfully run

    Updated Apr 22, 2026

> Tags

Pythonmonocular-depth-estimation

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 30, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言