Skip to main content

Image Classification — ONNX Export

ONNX is a portable, hardware-agnostic format for edge deployment. Export is done directly from the Training Monitor tab — no separate Export page is needed.

Why ONNX

BenefitDescription
PortabilityRuns on any platform with an ONNX runtime — Linux, Windows, ARM, embedded Linux
PerformanceHighly optimised inference speed and low memory use
No Python requiredLoadable by C++, Java, JavaScript, and others

Converting best.pt to ONNX

  1. Go to the Training Monitor tab
  2. In the ".pt to ONNX" panel, click "Convert best.pt → ONNX"
  3. The tool locates best.pt automatically in runs_yolo/train/weights/
  4. When conversion succeeds, best.onnx is saved alongside best.pt

Output location: <project>/runs_yolo/train/weights/best.onnx

DetailValue
Export methodUltralytics built-in ONNX export
ONNX opsetVersion 11 — broadly compatible
Input shapeDynamic batch size; fixed image width/height from training Image Size
OutputDetection tensor with class scores, bounding boxes, and confidence values
IMPORTANT

ONNX export requires onnx and onnxruntime packages — installed automatically with the Image (YOLO) environment. If export fails, verify both packages are present.

Deployment Targets

Target PlatformRecommended Runtime
Edge device (Linux, ARM)pip install onnxruntime or onnxruntime-gpu
Web / JavaScriptONNX Runtime Web (ort-web) for browser-based inference
TIP

Compare best.pt vs best.onnx inference results to confirm export preserved accuracy. mAP scores should be identical or within 0.1%.