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:
- YOLOv8 Classification
- YOLOv8 Object Detection
- YOLOv8 Segmentation.
- Processing of resulting box coordinates only covered. Segmentation polygon not supported yet
Python Installation
- 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: https://github.com/ibaiGorordo/ONNX-YOLOv8-Instance-Segmentation/
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.1.tar.gz
.
File metadata
- Download URL: yolo2onnx_extended-0.0.1.tar.gz
- Upload date:
- Size: 8.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 | 2d5806a985a1bc0fa88984942db9cd41794d370a9d089191fcfb994c8184c055 |
|
MD5 | 93229f31386e1806624c57f0d8a0ea6d |
|
BLAKE2b-256 | b91212874d47083389f87c3e800471c3b7dd7a9bc184ffd2523d9b08c1f31f11 |
File details
Details for the file yolo2onnx_extended-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: yolo2onnx_extended-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.2 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 | 62c2220702f6284d85df240d4f34cf3619180efbd473be4a0b32c99189b0dbac |
|
MD5 | 48bb04299c4eda64603685f102e93d76 |
|
BLAKE2b-256 | bfab05f53f9f356090b6338fd90970cef4a80c3dcfc23972d5744c6939cc17d1 |