Home Midasv2_1_small TFLite Inference
Post
Cancel

Open In Github

Python scripts to perform monocular depth estimation using Python with the Midas v2.1 small Tensorflow Lite model. Tested on Windows 10, Tensorflow 2.4.0 (Python 3.8).

!Midas v2.1 small TFLite Inference

Requirements

  • OpenCV, Numpy and tflite (or tensorflow). pafy and youtube-dl are required for youtube video inference.

Installation

1
2
pip install numpy opencv-python tflite tensorflow
pip install pafy youtube-dl

Midas v2.1 small (link)

  • Input: RGB image of size 256 x 256 pixels.
  • Output: Inverse relative depth map with 256 x256 pixels.
  • Inference speed: - 30 FPS on Iphone 11 NPU and 22 FPS on OnePlus8 GPU (Snapdragon 865).

Examples

  • Image inference:
1
 python imageDepthEstimation.py 
  • Webcam inference:
1
 python webcamDepthEstimation.py
  • Video inference:
1
 python videoDepthEstimation.py

# Inference video Example !Midas v2.1 small TFLite Inference on video

Original video: https://youtu.be/TGadVbd-C-E (by Nagasaki Biopark)

This post is licensed under CC BY 4.0 by the author.