depth-anything / Depth-Anything-V2-Metric-Hypersim-Base

huggingface.co
Total runs: 0
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: June 22 2024

Introduction of Depth-Anything-V2-Metric-Hypersim-Base

Model Details of Depth-Anything-V2-Metric-Hypersim-Base

Depth Anything V2 for Metric Depth Estimation

Pre-trained Models

We provide six metric depth models of three scales for indoor and outdoor scenes, respectively.

Base Model Params Indoor (Hypersim) Outdoor (Virtual KITTI 2)
Depth-Anything-V2-Small 24.8M Download Download
Depth-Anything-V2-Base 97.5M Download Download
Depth-Anything-V2-Large 335.3M Download Download

We recommend to first try our larger models (if computational cost is affordable) and the indoor version.

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

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

Use our models
import cv2
import torch

from depth_anything_v2.dpt import DepthAnythingV2

model_configs = {
    'vits': {'encoder': 'vits', 'features': 64, 'out_channels': [48, 96, 192, 384]},
    'vitb': {'encoder': 'vitb', 'features': 128, 'out_channels': [96, 192, 384, 768]},
    'vitl': {'encoder': 'vitl', 'features': 256, 'out_channels': [256, 512, 1024, 1024]}
}

encoder = 'vitl' # or 'vits', 'vitb'
dataset = 'hypersim' # 'hypersim' for indoor model, 'vkitti' for outdoor model
max_depth = 20 # 20 for indoor model, 80 for outdoor model

model = DepthAnythingV2(**{**model_configs[encoder], 'max_depth': max_depth})
model.load_state_dict(torch.load(f'checkpoints/depth_anything_v2_metric_{dataset}_{encoder}.pth', map_location='cpu'))
model.eval()

raw_img = cv2.imread('your/image/path')
depth = model.infer_image(raw_img) # HxW depth map in meters in numpy
Running script on images

Here, we take the vitl encoder as an example. You can also use vitb or vits encoders.

# indoor scenes
python run.py \
  --encoder vitl \
  --load-from checkpoints/depth_anything_v2_metric_hypersim_vitl.pth \
  --max-depth 20 \
  --img-path <path> --outdir <outdir> [--input-size <size>] [--save-numpy]

# outdoor scenes
python run.py \
  --encoder vitl \
  --load-from checkpoints/depth_anything_v2_metric_vkitti_vitl.pth \
  --max-depth 80 \
  --img-path <path> --outdir <outdir> [--input-size <size>] [--save-numpy]
Project 2D images to point clouds:
python depth_to_pointcloud.py \
  --encoder vitl \
  --load-from checkpoints/depth_anything_v2_metric_hypersim_vitl.pth \
  --max-depth 20 \
  --img-path <path> --outdir <outdir>
Reproduce training

Please first prepare the Hypersim and Virtual KITTI 2 datasets. Then:

bash dist_train.sh
Citation

If you find this project useful, please consider citing:

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

Runs of depth-anything Depth-Anything-V2-Metric-Hypersim-Base on huggingface.co

0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About Depth-Anything-V2-Metric-Hypersim-Base huggingface.co Model

More Depth-Anything-V2-Metric-Hypersim-Base license Visit here:

https://choosealicense.com/licenses/apache-2.0

Depth-Anything-V2-Metric-Hypersim-Base huggingface.co

Depth-Anything-V2-Metric-Hypersim-Base huggingface.co is an AI model on huggingface.co that provides Depth-Anything-V2-Metric-Hypersim-Base's model effect (), which can be used instantly with this depth-anything Depth-Anything-V2-Metric-Hypersim-Base model. huggingface.co supports a free trial of the Depth-Anything-V2-Metric-Hypersim-Base model, and also provides paid use of the Depth-Anything-V2-Metric-Hypersim-Base. Support call Depth-Anything-V2-Metric-Hypersim-Base model through api, including Node.js, Python, http.

Depth-Anything-V2-Metric-Hypersim-Base huggingface.co Url

https://huggingface.co/depth-anything/Depth-Anything-V2-Metric-Hypersim-Base

depth-anything Depth-Anything-V2-Metric-Hypersim-Base online free

Depth-Anything-V2-Metric-Hypersim-Base huggingface.co is an online trial and call api platform, which integrates Depth-Anything-V2-Metric-Hypersim-Base's modeling effects, including api services, and provides a free online trial of Depth-Anything-V2-Metric-Hypersim-Base, you can try Depth-Anything-V2-Metric-Hypersim-Base online for free by clicking the link below.

depth-anything Depth-Anything-V2-Metric-Hypersim-Base online free url in huggingface.co:

https://huggingface.co/depth-anything/Depth-Anything-V2-Metric-Hypersim-Base

Depth-Anything-V2-Metric-Hypersim-Base install

Depth-Anything-V2-Metric-Hypersim-Base is an open source model from GitHub that offers a free installation service, and any user can find Depth-Anything-V2-Metric-Hypersim-Base on GitHub to install. At the same time, huggingface.co provides the effect of Depth-Anything-V2-Metric-Hypersim-Base install, users can directly use Depth-Anything-V2-Metric-Hypersim-Base installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

Depth-Anything-V2-Metric-Hypersim-Base install url in huggingface.co:

https://huggingface.co/depth-anything/Depth-Anything-V2-Metric-Hypersim-Base

Url of Depth-Anything-V2-Metric-Hypersim-Base

Depth-Anything-V2-Metric-Hypersim-Base huggingface.co Url

Provider of Depth-Anything-V2-Metric-Hypersim-Base huggingface.co

depth-anything
ORGANIZATIONS

Other API from depth-anything