Giter Site home page Giter Site logo

yannnnnnnnnnnn / onnx-scdepth-monocular-depth-estimation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibaigorordo/onnx-scdepth-monocular-depth-estimation

0.0 1.0 0.0 13.54 MB

Python scripts for performing monocular depth estimation using the SC_Depth model in ONNX

License: MIT License

Python 100.00%

onnx-scdepth-monocular-depth-estimation's Introduction

ONNX SCDepth Monocular Depth Estimation

Python scripts for performing monocular depth estimation using the SC_Depth model in ONNX

SC_Depth monocular depth estimation ONNX Original image:https://commons.wikimedia.org/wiki/File:Cannery_District_Bozeman_Epic_Fitness_Interior_Wood_Stairs.jpg

Requirements

  • Check the requirements.txt file.
  • For ONNX, if you have a NVIDIA GPU, then install the onnxruntime-gpu, otherwise use the onnxruntime library.

Installation

git clone https://github.com/ibaiGorordo/ONNX-SCDepth-Monocular-Depth-Estimation.git
cd ONNX-YOLOv7-Object-Detection
pip install -r requirements.txt

ONNX Runtime

For Nvidia GPU computers: pip install onnxruntime-gpu

Otherwise: pip install onnxruntime

ONNX model

I don't provide the model, but you can easily convert the Pytorch model by placing the following code in the line #80 of inference.py in the original repository:

model_name = "sc_depth_v3_nyu.onnx"
torch.onnx.export(model,  # model being run
                  tensor_img,  # model input (or a tuple for multiple inputs)
                  model_name,  # where to save the model (can be a file or file-like object)
                  export_params=True,  # store the trained parameter weights inside the model file
                  opset_version=16)

Then you can simplify the ONNX model using ONNX-Simplifier:

onnxsim sc_depth_v3_nyu.onnx sc_depth_v3_nyu_sim.onnx

Finally, copy the simplified ONNX model file to the models folder.

Original Pytorch model

The Pytorch pretrained models were taken from the original repository.

Examples

  • Image inference:
python image_depth_estimation.py 
  • Video inference:
python video_depth_estimation.py
  • Webcam inference:
python webcam_depth_estimation.py

SC_Depth monocular depth estimation ONNX

Original video: https://youtu.be/e0IjlkU-pX0

References:

onnx-scdepth-monocular-depth-estimation's People

Contributors

ibaigorordo avatar

Watchers

James Cloos 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.