Skip to content

SihabSahariar/Yolov11-ONNX-Object-Detection

Repository files navigation

! ONNX YOLOv11 Object Detection

Important

  • The input images are directly resized to match the input size of the model. I skipped adding the pad to the input image, it 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

git clone https://github.com/SihabSahariar/Yolov11-ONNX-Object-Detection.git
cd Yolov11-ONNX-Object-Detection
pip install -r requirements.txt

ONNX Runtime

For Nvidia GPU computers: pip install onnxruntime-gpu

Otherwise: pip install onnxruntime

ONNX model

Use the Google Colab notebook to convert the model: Open In Colab

You can convert the model using the following code after installing ultralytics (pip install ultralytics):

from ultralytics import YOLO

model = YOLO("yolov11n.pt") 
model.export(format="onnx", imgsz=[480,640])

Original YOLOv11 model

The original YOLOv11 model can be found in this repository: YOLOv11 Repository

  • The License of the models is GPL-3.0 license: License

Examples

  • Image inference:
python image_object_detection.py
  • Webcam inference:
python webcam_object_detection.py
  • Video inference:
python video_object_detection.py

! ONNX YOLOv11 Object Detection

References:

About

Python scripts performing object detection using the YOLOv11 model in ONNX.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages