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
- CPU:
- 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
- API - Python API documentation (onnxruntime.ai)
- CUDA Optimization: NVIDIA - CUDA | onnxruntime
- Model Quantization with ONNX
- ONNX Model Visualizer: Netron
- Processing Segmentation YOLOV8 ONNX
- Python Packaging
Inference Benchmarks
- CPU (Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz 6 cores, 12 virtual):
- Object Detection
0.35 secs
per image
- Object Detection
- GPU (NVIDIA Quadro T2000 with Max-Q Design):
- Object Detection:
4 - 5 secs
for first image.0.068
for rest of images
- Object Detection:
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
File details
Details for the file yolo2onnx_extended-0.0.2.tar.gz
.
File metadata
- Download URL: yolo2onnx_extended-0.0.2.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3254c8e0662890e515d391e62e3aedfb2beeb04b94d8c2bd7b7e3b4b76de9ef |
|
MD5 | 1a2c061f43df8ecd9734446e75c2f28b |
|
BLAKE2b-256 | c00f0e14532b28a7479e67bddfa2c8dfe56b3bd4c82a0929f44cf89d28d6c63e |
File details
Details for the file yolo2onnx_extended-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: yolo2onnx_extended-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00057bbfc4fc26db2dcd7ef04d8328c630b9fb4b033647f326644d12b20e4317 |
|
MD5 | affd1f824171f692dc587b6254a16a83 |
|
BLAKE2b-256 | 3924ed4793bbfbdbdd1802cc7449c5fa72e6dff9d4d108569b682e454804a3e6 |