Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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:

Code Block
git clone https://github.com/ultralytics/ultralytics.git
git checkout v8.2.77

2. Write Python code

Save the file as export. py

Code Block
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

Code Block
python export.sh

...