C++ and python implementation of YOLOv9 using Openvino Backend.
- 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.
The following command will install openvino python with the ovc
api:
cd python
pip install -r requirement.txt
- 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
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
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
- OpenVINO™ 2023.3.0
- OpenCV
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