Coder Social home page Coder Social logo

midas-cpp's Introduction

MiDaS-cpp

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.

Personal project that uses MiDaS

(Paper) DeepRelativeFusion: Dense Monocular SLAM using Single-Image Relative Depth Prediction

Watch the video

Tested environment

  • Ubuntu 20.04
  • Cmake 3.16.3
  • Boost 1.71.0
  • Python 3.8.5
  • OpenCV 3.3.1

Dependencies

  • 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.

Prerequisites

  1. Clone the original repo and download the pre-trained model.
  2. Download PyTorch C++ (select LibTorch->C++/Java, download the zip file (Pre-cxx11 ABI), and unzip the file in your Home folder).

Convert the pre-trained model to Torch Script

Please see the python folder for further instructions.

Build the project

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.

Run depth prediction

cd build
./midas_inference

(Optional) Boost.Python

cd python
python3 inference.py

Use cases

  1. Use MiDaS in a C++ project. You can import the code to your robotics project (e.g., SLAM, visual navigation, AR, etc.).

  2. Use MiDaS in a Python project. We also include a Boost.Python module for allowing the model to be used in a Python script.

Licence

The authors take no credit from MiDaS, and therefore the licence(s) should remain intact. Please cite their work if you find them helpful.

midas-cpp's People

Contributors

yan99033 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.