This document describes how to convert the PT file provided by YOLOV8 to ONNX format.
The prerequisite is that the development environment for Python YOLOV8 has already been set up.
1. Prepare Project File
Download from the GitHub:
git clone https://github.com/ultralytics/ultralytics.git git checkout v8.2.77
2. Write Python code
Save the file as export. py
from ultralytics import YOLO # Load a model model = YOLO("yolov8n.pt") # load a pretrained model # export the model model.export(format="onnx") # export the model to ONNX format
3. Export the ONNX
python export.sh