Skip to main content

YOLOv8 to ONNX Exporter with Pre and Post Processing

Project description

Exporting YOLO models to ONNX with embedded pre and post processing

This repository contains the code to export Yolo models to ONNX format using the runtime extensions to add pre and post processing to the exported ONNX.

Models supported (code examples on how to use in examples folder):

  • YOLOv8 Classification.
  • YOLOv8 Object Detection
  • YOLOv8 Segmentation.
    • Processing of resulting box coordinates only covered. Segmentation polygon not supported yet

Python Installation

YOLO2ONNX Extended package

Create a python environment and install using the wheel package file:

pip install yolo2onnx_extended-0.0.1-py3-none-any.whl

Build from raw

Clone this repo and install the main requirements:

  • PyTorch: pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
  • Ultralyics: pip install ultralytics
  • ONNX Runtime:
    • CPU: pip install onnxruntime
    • GPU (CUDA 11.8): pip install onnxruntime-gpu
  • ONNX Runtime Extensions: pip install onnxruntime-extensions

Use of exported model in other platforms (C/C#/C++/JavaScript/Android/iOS)

ONNX packages need to be installed. Check the supported versions for the platform you are using.

  • ONNX Runtime installations for other platforms can be found in the documentation.
  • ONNX Extensions installations can be found in the documentation.

[Inference install table for all languagues](Be aware of the supported versions of the extensions.)

Useful resources and Ideas

Inference Benchmarks

  • CPU (Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz 6 cores, 12 virtual):
    • Object Detection 0.35 secs per image
  • GPU (NVIDIA Quadro T2000 with Max-Q Design):
    • Object Detection: 4 - 5 secs for first image. 0.068 for rest of images

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

yolo2onnx_extended-0.2.2.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

yolo2onnx_extended-0.2.2-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file yolo2onnx_extended-0.2.2.tar.gz.

File metadata

  • Download URL: yolo2onnx_extended-0.2.2.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for yolo2onnx_extended-0.2.2.tar.gz
Algorithm Hash digest
SHA256 3c3d83fd1fe370065229b576fe763fbf71c9fab58b68054448bacfbef50e87f2
MD5 422448f4510fa802841baadf72006e2d
BLAKE2b-256 e55645fc0b32be4d02bee7dd541f12872199a979df96e31d524a4b796de6be27

See more details on using hashes here.

File details

Details for the file yolo2onnx_extended-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for yolo2onnx_extended-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 283636990dd16f2f597c95f5933276e330c8df12f7f49fcae9bd56e1f2cb46dd
MD5 86df2e8a8df7369bb427d2fecfa9f47e
BLAKE2b-256 23e348eb432e1ef9e044689b593480ed1bc3c15dedd01fe77b68224be9d1fe9b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page