This folder has one main tool:
convert_to_onnx.bat
It converts a YOLO .pt model into an .onnx model.
- Windows
- Python 3 installed
- Ultralytics installed (
yolocommand works)
If you are not sure, run this once in Command Prompt:
py -3 -m pip install -U ultralytics onnx onnxruntime- Put your
.ptfile in this folder. - Double-click
convert_to_onnx.bat. - Follow the prompts to pick model, output name, and preset (or just press Enter for recommended).
- Wait for completion.
At the end, you will see a final summary card with result and file path.
convert_to_onnx.bat <input.pt> [output.onnx] [preset]Examples:
convert_to_onnx.bat "C:\models\best.pt"
convert_to_onnx.bat "C:\models\best.pt" "C:\exports\best.onnx"
convert_to_onnx.bat "C:\models\best.pt" "C:\exports\best.onnx" 21Faster speed, lower quality potential2Better quality, slower3Balanced (recommended for most users)
--dry-runchecks everything without converting--yesauto-accepts prompts--verboseextra details--debugsame as verbose
Example:
convert_to_onnx.bat "C:\models\best.pt" --dry-runRun:
py -3 -m pip install -U ultralytics onnx onnxruntime
yolo versionInstall Python 3 and make sure it is added to PATH.
- Put the
.ptfile in this folder, or - pass the full path to the
.ptfile
Each run creates a log file in:
logs\convert_to_onnx_YYYY-MM-DD_HHMMSS.log
The script also prints the log path while running.
0Success1Input file problem2YOLO/Ultralytics problem3Export failed4Python not found5Canceled or internal error