Skip to content

YangMI-YM/MiDaS

 
 

Repository files navigation

Depth estimation & meshgrid generation

This repo branch contains the implementations of

  • Depth map estimation using depth-anything.
  • Meshgrid generation.

Depth map

Setup

  1. Installation:

    pip install -q opencv-python torch torchvision matplotlib timm scipy ipywidgets

If encounters any dependencies conflict, please refer to pip_freeze.txt for full list of package versions.

Usage

  1. Place one or more input images in your input folder.

  2. Run the model with

    CUDA_VISIBLE_DEVICES=$GPU_ID python run_depth-anything.py --input $INPUT --output_path $OUTPUT --model_type $model_type --grayscale

    where <model_type> is chosen from depth-anything/Depth-Anything-V2-Large-hf, depth-anything/Depth-Anything-V2-Large, depth-anything/Depth-Anything-V2-Small-hf, depth-anything/Depth-Anything-V2-Small, depth-anything/Depth-Anything-V2-Base-hf, depth-anything/Depth-Anything-V2-Base, LiheYoung/depth-anything-large-hf, LiheYoung/depth-anything-large, LiheYoung/depth-anything-small-hf, LiheYoung/depth-anything-small, LiheYoung/depth-anything-base-hf, LiheYoung/depth-anything-base, depth-anything/Depth-Anything-V2-Metric-Indoor-Large-hf.

  3. The resulting grayscale depth maps are written to the $OUTPUT folder. Please be aware that the input images will be padded and resized to 1024x1024 (or 512x512, can be adjusted at request) for the trade-off depthmap quality and processing speed.

Meshgrid

Usage

  1. Set input depth map path, e.g., $INPUT_DEPTH_MAP=$INPUT_DIR/$INPUT_FILENAME.

  2. Call create_mesh_grid($INPUT_DEPTH_MAP) in create_meshgrid.py.

  3. The resulting meshgrids are stored as .npz files under the directory of depthmaps.

About

Code for robust monocular depth estimation described in "Ranftl et. al., Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer, TPAMI 2022"

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 51.4%
  • Java 28.5%
  • Swift 14.7%
  • C++ 2.5%
  • CMake 1.7%
  • Shell 0.9%
  • Other 0.3%