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
- 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++
- Download openvino and install it following this guide
- Modify your openvino and opencv paths in CMakeLists.txt
- 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