SimpleDepthEstimation
Introduction
This is an unified codebase for NN-based monocular depth estimation methods, the framework is based on detectron2 (with a lot of modifications) and supports both supervised and self-supervised monocular depth estimation methods. The main goal for developing this repository is to help understand popular depth estimation papers, I tried my best to keep the code simple.
Environment:
- clone this repo
SDE_ROOT=/path/to/SimpleDepthEstimation git clone https://github.com/zzzxxxttt/SimpleDepthEstimation $SDE_ROOT cd $SDE_ROOT
- create a new conda environment and activate it
conda create -n sde python=3.6 conda activate sde
- install torch==1.8.0 and torchvision==0.9.0 follow the official instructions. (I haven't tried other pytorch versions)
- install other requirements
pip install -r requirements.txt
Data preparation
KITTI:
Download and extract KITTI raw dataset, refined KITTI depth groundtruth, and eigen split files, then modify the data path in the config file.
Training
python path/to/project/train.py --num-gpus 2 --cfg path/to/config RUN_NAME run_name
Evaluation
python path/to/project/train.py --num-gpus 2 --cfg path/to/config --eval MODEL.WEIGHTS /path/to/checkpoint_file
Results:
KITTI:
model | type | config | abs rel err | sq rel err | rms | log rms | d1 | d2 | d3 |
---|---|---|---|---|---|---|---|---|---|
ResNet-18 | supervised | link | 0.076 | 0.306 | 3.066 | 0.116 | 0.936 | 0.990 | 0.998 |
BTSNet (ResNet-50) | supervised | link | 0.062 | 0.259 | 2.859 | 0.100 | 0.950 | 0.992 | 0.998 |
MonoDepth2 (ResNet-18) | self-supervised | link | 0.118 | 0.735 | 4.517 | 0.163 | 0.860 | 0.974 | 0.994 |
Demo:
python tools/demo.py --cfg path/to/config --input path/to/image --output path/to/output_dir MODEL.WEIGHTS /path/to/checkpoint_file
Demo results:
Todo
- add PackNet (I have added it, performance need verification)
- add Dynamic Motion Learning (I have implemented it but still buggy, help welcome!)
- support more datasets