This repository contains code to compute depth from a single image. It accompanies our paper:
Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer
René Ranftl, Katrin Lasinger, David Hafner, Konrad Schindler, Vladlen Koltun
The pre-trained model corresponds to DS 4 with multi-objective optimization enabled.
- [Dec 2019] Released new version of MiDaS - the new model is significantly more accurate and robust
- [Jul 2019] Initial release of MiDaS (Link)
-
Download the model weights model.pt and place the file in the root folder.
-
Set up dependencies:
conda install pytorch torchvision opencv
The code was tested with Python 3.7, PyTorch 1.2.0, and OpenCV 3.4.2.
-
Place one or more input images in the folder
input. -
Run the model:
python run.py
-
The resulting inverse depth maps are written to the
outputfolder.
xhost local:root
docker run --rm -it -d -v ~/Github/MiDaS:/root -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY --device=/dev/video0:/dev/video0 --memory="4g" --cpus="6" --name mono torch-cv bash
Please cite our paper if you use this code or any of the models:
@article{Ranftl2019,
author = {Ren\'{e} Ranftl and Katrin Lasinger and David Hafner and Konrad Schindler and Vladlen Koltun},
title = {Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer},
journal = {arXiv:1907.01341},
year = {2019},
}
MIT License