Coder Social home page Coder Social logo

nburrus / stereodemo Goto Github PK

View Code? Open in Web Editor NEW
129.0 2.0 9.0 131 KB

Small Python utility to compare and visualize the output of various stereo depth estimation algorithms

License: MIT License

Python 99.84% Shell 0.16%
deep-learning depth-estimation stereo-matching stereo-vision stereo-depth-estimation

stereodemo's Introduction

Unit Tests Twitter Badge

stereodemo

Small Python utility to compare and visualize the output of various stereo depth estimation algorithms:

  • Make it easy to get a qualitative evaluation of several state-of-the-art models in the wild
  • Feed it left/right images or capture live from an OAK-D camera
  • Interactive colored point-cloud view since nice-looking disparity images can be misleading
  • Try different parameters on the same image

Included methods (implementation/pre-trained models taken from their respective authors):

  • OpenCV stereo block matching and Semi-global block matching baselines, with all their parameters

  • CREStereo: "Practical Stereo Matching via Cascaded Recurrent Network with Adaptive Correlation" (CVPR 2022)

  • RAFT-Stereo: "Multilevel Recurrent Field Transforms for Stereo Matching" (3DV 2021)

  • Hitnet: "Hierarchical Iterative Tile Refinement Network for Real-time Stereo Matching" (CVPR 2021)

  • STereo TRansformers: "Revisiting Stereo Depth Estimation From a Sequence-to-Sequence Perspective with Transformers" (ICCV 2021)

  • Chang et al. RealtimeStereo: "Attention-Aware Feature Aggregation for Real-time Stereo Matching on Edge Devices" (ACCV 2020)

  • DistDepth: "Toward Practical Monocular Indoor Depth Estimation" (CVPR 2022). This one is actually a monocular method, only using the left image.

See below for more details / credits to get each of these working, and check this blog post for more results, including performance numbers.

stereodemo-intro.mp4

Getting started

Installation

python3 -m pip install stereodemo

Running it

With an OAK-D camera

To capture data directly from an OAK-D camera, use:

stereodemo --oak

Then click on Next Image to capture a new one.

With image files

If you installed stereodemo from pip, then just launch stereodemo and it will show some embedded sample images captured with an OAK-D camera.

A tiny subset of some popular datasets is also included in this repository. Just provide a folder to stereodemo and it'll look for left/right pairs (either im0/im1 or left/right in the names):

# To evaluate on the oak-d images
stereodemo datasets/oak-d 

# To cycle through all images
stereodemo datasets

Then click on Next Image to cycle through the images.

Sample images included in this repository:

Dependencies

pip will install the dependencies automatically. Here is the list:

  • Open3D. For the point cloud visualization and the GUI.
  • OpenCV. For image loading and the traditional block matching baselines.
  • onnxruntime. To run pretrained models in the ONNX format.
  • pytorch. To run pretrained models exported as torch script.
  • depthai. Optional, to grab images from a Luxonis OAK camera.

Credits for each method

I did not implement any of these myself, but just collected pre-trained models or converted them to torch script / ONNX.

License

The code of stereodemo is MIT licensed, but the pre-trained models are subject to the license of their respective implementation.

The sample images have the license of their respective source, except for datasets/oak-d which is licenced under Creative Commons Attribution 4.0 International License.

stereodemo's People

Contributors

nburrus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

stereodemo's Issues

Correct version of open3d

Upon first installation, it would install open3d v0.10.0.0, but it need the latest version v0.15.2

First error after installation is the following:
import open3d.visualization.gui as gui
After manually installing v0.12.0 as recommended here, I get the following error:
AttributeError: 'open3d.cpu.pybind.visualization.gui.SceneWidget' object has no attribute 'look_at'
which is new in v0.13.0, so I go ahead and install that, and I get the following error:
AttributeError: 'open3d.cpu.pybind.visualization.gui.ListView' object has no attribute 'set_max_visible_items'
and well then I installed v0.15.2, and that finally stopped complaining.
Might be best to add more strict requirements to the setup config.

Though it still doesn't start well, window doesn't render and nothing happens. Does it download models in the background? It should probably have some indication of that before opening a GUI window. Output:

INFO: will store downloaded models in /home/user/.cache/stereodemo/models
Trying to connect to an OAK camera...
FEngine (64 bits) created at 0x7ff6390 (threading is enabled)
FEngine resolved backend: OpenGL

OV9282 doesn't support THE_480_P resolution, defaulting to THE_400_P

Thanks for the wonderful code.
I tried running the demo using OAK-D, was getting error based on resolution.

[14442C1061F35DD700] [2.4] [510.014] [MonoCamera(1)] [error] OV9282 doesn't support THE_480_P resolution, defaulting to THE_400_P
[14442C1061F35DD700] [2.4] [510.014] [MonoCamera(0)] [error] OV9282 doesn't support THE_480_P resolution, defaulting to THE_400_P

assert self.input.left_image.shape[1] == self.input.calibration.width and self.input.left_image.shape[0] == self.input.calibration.height

The demo without the OAK-D was working.

Strange results

I use my own data without calibration data, and got this map.Does the calibration is always required?
222ad2db43f777caccff35d2c20b76c

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.