Home

Awesome

<h1 align="center"><span>YOLOv9-OpenVINO</span></h1> <img src="https://awesome.re/mentioned-badge-flat.svg"/>

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

<p align="center" margin: 0 auto;> <img src="result.jpg"/> </p>

🤖 Model

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

🔗 Acknowledgement

This repo is based on the following projects: