Monodepth2
This is the reference PyTorch implementation for training and testing depth estimation models using the method described in
This code is for non-commercial use; please see the license file for terms.
If you find our work useful in your research please consider citing our paper:
@article{monodepth2,
title = {Digging into Self-Supervised Monocular Depth Prediction},
author = {Cl{\'{e}}ment Godard and
Oisin {Mac Aodha} and
Michael Firman and
Gabriel J. Brostow},
booktitle = {The International Conference on Computer Vision (ICCV)},
month = {October},
year = {2019}
}
⚙️
Setup
Assuming a fresh Anaconda distribution, you can install the dependencies with:
conda install pytorch=0.4.1 torchvision=0.2.1 -c pytorch
pip install tensorboardX==1.4
conda install opencv=3.3.1 # just needed for evaluation
We ran our experiments with PyTorch 0.4.1, CUDA 9.1, Python 3.6.6 and Ubuntu 18.04. We have also successfully trained models with PyTorch 1.0, and our code is compatible with Python 2.7. You may have issues installing OpenCV version 3.3.1 if you use Python 3.7, we recommend to create a virtual environment with Python 3.6.6 conda create -n monodepth2 python=3.6.6 anaconda.
🖼️
Prediction for a single image
You can predict depth for a single image with:
python test_simple.py --image_path assets/test_image.jpg --model_name mono+stereo_640x192
On its first run this will download the mono+stereo_640x192 pretrained model (99MB) into the models/ folder. We provide the following options for --model_name:
--model_name
Training modality
Imagenet pretrained?
Model resolution
KITTI abs. rel. error
delta < 1.25
Mono
Yes
640 x 192
0.115
0.877
Stereo
Yes
640 x 192
<