Ibraheem Alhashim and Peter Wonka
The original code is at the repo Dense Depth Original Code This version has been modified by me to
- Add support for different encoders
- Test the effect of decreasing decoder length
- Create cool visualizations by testing the model on self collected images and videos
- This code is tested with Keras 2.2.4, Tensorflow 1.13, CUDA 9.0, on a machine with an NVIDIA Titan V and 16GB+ RAM running on Windows 10 or Ubuntu 16.
- Other packages needed
keras pillow matplotlib scikit-learn scikit-image opencv-python pydot
andGraphViz
.
- NYU Depth V2 (50K) (4.1 GB): You don't need to extract the dataset since the code loads the entire zip file into memory when training.
- NYU Depth V2 (165 MB)
- Train from scratch:
python train.py --data nyu --bs 5 --full
- Train from a previous checkpoint
python train.py --data nyu --bs 5 --full --checkpoint ./models/1557344811-n10138-e20-bs5-lr0.0001-densedepth_nyu/weights.04-0.12.h5
python train.py --data nyu --bs 5 --full --dnetVersion small
python train.py --data nyu --bs 5 --name resnet50_nyu --full --resnet
- Download, but don't extract, the ground truth test data from here (1.4 GB). The call evaluate.py with your model checkpoint
python evaluate.py --model ./models/1557483797-n10138-e20-bs5-lr0.0001-densedepth_nyu/weights.06-0.12.h5
Put the images in my_examples folder
python test.py --model ./models/1557483797-n10138-e20-bs5-lr0.0001-densedepth_nyu/weights.06-0.12.h5
Pass the checkpoint to the model. The results are stored in the folder called image_results
python test_video.py --model ./models/1557395533-n10138-e20-bs5-lr0.0001-densedepth_nyu/weights.03-0.12.h5 --input test_video.MOV
Corresponding paper to cite:
@article{Alhashim2018,
author = {Ibraheem Alhashim and Peter Wonka},
title = {High Quality Monocular Depth Estimation via Transfer Learning},
journal = {arXiv e-prints},
volume = {abs/1812.11941},
year = {2018},
url = {https://arxiv.org/abs/1812.11941},
eid = {arXiv:1812.11941},
eprint = {1812.11941}
}