PyTorch C++ implementation of MiDaS for single-image relative depth prediction. Relative depth prediction, in general, provides more accurate depth prediction in various scene types by forgoing absolute depth scale, compared to absolute depth prediction (e.g., monodepth). For more information, please visit the original work, which is implemented in Python.
The C++ implementation is especially useful for researchers who are working on robotics problems. Tested on Ubuntu 20.04 with an Intel i7 processor and an Nvidia 1070 graphics card.
(Paper) DeepRelativeFusion: Dense Monocular SLAM using Single-Image Relative Depth Prediction
- Ubuntu 20.04
- Cmake 3.16.3
- Boost 1.71.0
- Python 3.8.5
- OpenCV 3.3.1
- cmake
- Boost
- Python3
- OpenCV
apt install cmake libboost-all-dev python3-dev
As some of you may have a different OpenCV version, we will let you (build and) install your own OpenCV.
- Clone the original repo and download the pre-trained model.
- Download PyTorch C++ (select LibTorch->C++/Java, download the zip file (Pre-cxx11 ABI), and unzip the file in your Home folder).
Please see the python folder for further instructions.
mkdir build
cd build
cmake ..
make
(Optional) Boost.Python
Uncomment the lines (Line 36 - 42) in CMakelists.txt to build a Boost.Python module. Note that you may have different Boost library version that may result in linking errors.
cd build
./midas_inference
(Optional) Boost.Python
cd python
python3 inference.py
-
Use MiDaS in a C++ project. You can import the code to your robotics project (e.g., SLAM, visual navigation, AR, etc.).
-
Use MiDaS in a Python project. We also include a Boost.Python module for allowing the model to be used in a Python script.
The authors take no credit from MiDaS, and therefore the licence(s) should remain intact. Please cite their work if you find them helpful.