Skip to content

YOLOv9 with Openvino Backend (C++ and Python)

Notifications You must be signed in to change notification settings

ahsan-raazaa/yolov9-openvino

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

YOLOv9-OpenVINO

C++ and python implementation of YOLOv9 using Openvino Backend.

🤖 Model

  • Download yolov9-c openvino model: yolov9-c-converted
  • Or convert your custom yolov9 model to openvino format:
ovc yolov9-c-converted.onnx --compress_to_fp16 True --input images[1,3,640,640]

ovc is a command-line model converter that converts trained models in onnx or pytorch format to an OpenVINO model in bin, xml format.

⚙️ Build

Python

The following command will install openvino python with the ovc api:

cd python
pip install -r requirement.txt

C++

  1. Download openvino and install it following this guide
  2. Modify your openvino and opencv paths in CMakeLists.txt
  3. Run the following command to build the project
cd cpp
mkdir build
cd build
cmake ..
make

🚀 Inference

Python

Usage:

python main.py --model=<model path> --data_path=<data path> --score_thr=<score> --nms_thr=<nms>

Examples:

# infer an image
python main.py --model=yolov9-c-converted.xml --data_path=test.jpg
# infer a folder(images)
python main.py --model=yolov9-c-converted.xml --data_path=data
# infer a video
python main.py --model=yolov9-c-converted.xml --data_path=test.mp4

C++

Usage:

yolov9-openvino-cpp.exe <xml model path> <data> <confidence threshold> <nms threshold>

Examples:

# infer an image
yolov9-openvino.exe yolov9-c-converted.xml test.jpg 
# infer a folder(images)
yolov9-openvino.exe yolov9-c-converted.xml data
# infer a video
yolov9-openvino.exe yolov9-c-converted.xml test.mp4 # the video path

🖥️ Requirement

  • OpenVINO™ 2023.3.0
  • OpenCV

🔗 Acknowledgement

This repo is based on the following projects:

  • yolov5-openvino - Example of using ultralytics YOLOv5 with Openvino in C++ and Python
  • YOLOv9 - Learning What You Want to Learn Using Programmable Gradient Information

About

YOLOv9 with Openvino Backend (C++ and Python)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 55.1%
  • Python 41.0%
  • CMake 3.9%