Home ONNX YOLOv8 Instance Segmentation
Post
Cancel

Open In GithubOpen In Github

Python scripts performing instance segmentation using the YOLOv8 model in ONNX.

! ONNX YOLOv8 Instance Segmentation Original image: https://commons.wikimedia.org/wiki/File:Giraffes_at_west_midlands_safari_park.jpg

Important

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

1
2
3
git clone https://github.com/ibaiGorordo/ONNX-YOLOv8-Instance-Segmentation.git
cd ONNX-YOLOv8-Instance-Segmentation
pip install -r requirements.txt

ONNX Runtime

For Nvidia GPU computers: pip install onnxruntime-gpu

Otherwise: pip install onnxruntime

ONNX model

You can convert the Pytorch model to ONNX using the following Google Colab notebook: Open In Colab

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

Original YOLOv8 model

The original YOLOv8 Instance Segmentation model can be found in this repository: YOLOv8 Instance Segmentation

Examples

References:

This post is licensed under CC BY 4.0 by the author.