Run YOLOv9 MIT model with ONNX Runtime
Project description
ONNX YOLOv9 MIT Object Detection
Python scripts performing object detection using the YOLOv9 MIT model in ONNX.
[!CAUTION] I skipped adding the pad to the input image when resizing, which might affect the accuracy of the model if the input image has a different aspect ratio compared to the input size of the model. Always try to get an input size with a ratio close to the input images you will use.
Requirements
- Check the requirements.txt file.
- For ONNX, if you have a NVIDIA GPU, then install the onnxruntime-gpu, otherwise use the onnxruntime library.
Installation
Installation
pip install yolov9-onnx
Or, clone this repository:
git clone https://github.com/ibaiGorordo/ONNX-YOLOv9-MIT-Object-Detection.git
cd ONNX-YOLOv9-MIT-Object-Detection
pip install -r requirements.txt
ONNX Runtime
For Nvidia GPU computers:
pip install onnxruntime-gpu
Otherwise:
pip install onnxruntime
ONNX model
- If the model file is not found in the models directory, it will be downloaded automatically from the release page.
- Or, for exporting the models with a different input size, use the Google Colab notebook to convert the model:
- Available models: v9-s.onnx, v9-m.onnx, v9-c.onnx
Original YOLOv9 MIT model
The original YOLOv9 MIT model can be found in this repository: YOLOv9 MIT Repository
- The License of the models is MIT license: License
Examples
- Image inference:
python image_object_detection.py
- Webcam inference:
python webcam_object_detection.py
- Video inference: https://youtu.be/X_XVkEqgCUM
python video_object_detection.py
https://github.com/user-attachments/assets/71b3ef97-92ef-4ddb-a62c-5e52922a396d
References:
- YOLOv9 MIT model: https://github.com/WongKinYiu/YOLO
- YOLOv9 model: https://github.com/WongKinYiu/yolov9
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for yolov9_onnx-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd156885b26cfcb9066a602254a4fb11205e8434fb1a05965e664f8f5630550e |
|
MD5 | 6e519c4914f9689fb3ba2804d5cbad67 |
|
BLAKE2b-256 | 8ba32fdea41f69411f5e9d8464a4bc44c97cf1b5bd7891d49b82a7b7fdb99b9e |