ibaiGorordo / ONNX-Object-Localization-Network

Python scripts performing class agnostic object localization using the Object Localization Network model in ONNX.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ONNX Object Localization Network

Python scripts performing class agnostic object localization using the Object Localization Network model in ONNX.

!Object-Localization-Network Original image: https://en.wikipedia.org/wiki/File:Interior_design_865875.jpg

Important

  • I added a bit of logic to the box color selection to make it look nicer. Since it performs K-Means for each box, it might be slow. If you only care about speed, you can either set all the boxes to the same color or use random colors.

Requirements

  • Check the requirements.txt file.
  • For ONNX, if you have a NVIDIA GPU, then install the onnxruntime-gpu, otherwise use the onnxruntime library.
  • Additionally, pafy and youtube-dl are required for youtube video inference.

Installation

git clone https://github.com/ibaiGorordo/ONNX-Object-Localization-Network.git
cd ONNX-Object-Localization-Network
pip install -r requirements.txt

ONNX Runtime

For Nvidia GPU computers: pip install onnxruntime-gpu

Otherwise: pip install onnxruntime

For youtube video inference

pip install youtube_dl
pip install git+https://github.com/zizo-pro/pafy@b8976f22c19e4ab5515cacbfae0a3970370c102b

ONNX model

The original model was converted to ONNX by PINTO0309, download the models from the download script in his repository and save them into the models folder.

Pytorch model

The original Pytorch model can be found in this repository: https://github.com/mcahny/object_localization_network

Examples

  • Image inference:
python image_object_localization.py
  • Webcam inference:
python webcam_object_localization.py
python video_object_localization.py

!Object-Localization-Network video

Original video: https://youtu.be/vgJUXvkdS78

References:

About

Python scripts performing class agnostic object localization using the Object Localization Network model in ONNX.

License:MIT License


Languages

Language:Python 100.0%