Export, quantization & deployment
Fastest route: export in Platform
Open a completed model's Export tab, select one of the 20 formats, configure its
arguments, and click Start Export. Platform runs CPU exports directly and asks for a
target GPU where the format requires one (notably TensorRT); download the artifact when
the job completes. Match TensorRT's selected GPU family and software environment to the
deployment target, just as with a local engine build.
Use Platform when you do not want to install each exporter toolchain locally. Use the
Python/CLI path below for custom calibration, repeatable automation, local hardware
builds, or immediate parity validation. See
Platform model export.
Quickstart
from ultralytics import YOLO
model = YOLO("runs/detect/train/weights/best.pt")
path = model.export(format="onnx") # returns the exported file/dir path
yolo export model=best.pt format=onnx
Exports load straight back into YOLO() for predict/val — same API:
model = YOLO("best.onnx") # or best.engine, best_openvino_model/, ...
Choose format by target hardware
| Target |
format= |
Why |
| NVIDIA GPU / Jetson |
engine (TensorRT) |
fastest on NVIDIA; build on the deployment device — engines are not portable across GPUs/TRT versions |
| Intel CPU/iGPU/NPU |
openvino |
~3× CPU speedup |
| Apple iOS/macOS |
coreml |
broad OS coverage, Vision/iOS/Flutter support |
| Apple iOS 27+/macOS 27+ |
coreai |
native .aimodel; use coreml for iOS/Flutter SDKs; export on Apple silicon/macOS 26+ |
| Android |
litert (renamed from tflite) or ncnn |
NCNN strong on ARM |
| Raspberry Pi |
ncnn |
best ARM CPU latency |
| PyTorch Edge |
executorch |
|
| Cross-platform / unsure |
onnx |
runs everywhere; start here, specialize when latency demands |
| NPUs (Rockchip/Qualcomm/Hailo/Huawei/Sony/Axelera/DeepX) |
rknn / qnn / hailo / ascend / imx / axelera / deepx |
name= selects the exact chip for rknn/qnn/hailo/ascend |
Full 21-target local export matrix with per-format supported args: format-matrix.md
(this folder). Platform currently offers 20 deployment formats.
Key arguments
| Arg |
Default |
Notes |
imgsz |
model |
inherited from the loaded model; set explicitly to the deployment shape |
quantize |
None |
precision request: 16/fp16, 8/int8/w8a8, w8a16, w8a32, or 32/fp32; support, speed, size, and accuracy are backend-dependent — see format-matrix.md and benchmark the target |
data |
None |
representative calibration data when required; use >300 images generally and 500+ for TensorRT. Omission selects a small task default, so pass deployment-representative data explicitly |
dynamic |
False |
variable input shape/batch where supported; check format-matrix.md and benchmark the target |
batch |
1 |
max batch baked into the export |
simplify |
True |
simplify ONNX graph |
opset |
None |
compatible ONNX opset selected automatically when unset; pin lower if the consumer runtime complains |
end2end |
None |
preserve the model setting; set False on YOLO26/YOLOv10 when the target needs raw outputs or conventional NMS |
nms |
False |
bake NMS into a raw-output pipeline where supported; for YOLO26/YOLOv10 also set end2end=False |
workspace |
None |
TensorRT builder GiB — lower if the build OOMs |
device |
None |
device=0 required for TensorRT; also speeds INT8 calibration |
fraction |
1.0 |
fraction of calibration data used |
Verify parity after export (always)
yolo val model=best.pt data=data.yaml # baseline
yolo val model=best.onnx data=data.yaml # compare the same task metric with the baseline
Acceptable differences depend on the task, model, backend, precision, and calibration
data. Investigate unexpected gaps by matching imgsz and pre/post-processing and, where
required, using representative calibration data. Also compare one prediction with .pt.
Benchmark all formats empirically
yolo benchmark model=best.pt data=data.yaml imgsz=640 # all formats at default precision
yolo benchmark model=best.pt data=data.yaml format=engine quantize=16 device=0 imgsz=640 # targeted FP16
Produces the task metric + latency per exportable format on this machine. Repeat for
each supported precision and benchmark on deployment hardware, not your dev box.
Consuming exports outside Python
- In raw runtimes (C++, mobile, JS) you own preprocessing (letterbox resize,
BGR→RGB, /255) and output decoding.
- Detect output layout differs: end-to-end YOLO26 emits final
[x1,y1,x2,y2,conf,cls] rows. If export disables end-to-end, YOLO26—like
YOLO11/v8—emits raw [4+nc, anchors] heads; where supported, nms=True wraps them.
Set end2end=False nms=True to request that path explicitly. Segment, pose, and OBB
add task-specific outputs. Check export warnings and shapes.
- Class names travel in export metadata where supported; otherwise ship the
names
map alongside the model.
- Serving:
ultralytics.utils.triton.TritonRemoteModel for Triton;
examples/ in the ultralytics repo has ONNXRuntime C++/Rust/Python references.
Troubleshooting
| Symptom |
Fix |
| Export crashes on missing package |
most backends auto-install on first export; rerun. TensorRT must match your CUDA — install per NVIDIA docs |
Unsupported ONNX opset downstream |
export with lower opset=, or upgrade the runtime |
| TensorRT build OOM/slow |
lower workspace, batch=1, dynamic=False |
| Export much less accurate |
imgsz mismatch; too little/unrepresentative calibration data; wrong custom pre/post-processing; use a supported higher precision or backend |
| Engine fails on another machine |
TensorRT engines are device+version specific — rebuild on target |
| CoreML export fails on Windows |
export on macOS or Linux |
| Core AI export is unavailable |
requires Apple silicon, macOS 26+, torch>=2.8, and Python 3.11–3.13; use Core ML for broader production support |
Deprecation warnings for half/int8/tflite |
auto-forwarded (half→quantize=16, int8→quantize=8, tflite→litert) — switch to the new names |
Related pages
format-matrix.md — all 21 local export targets, artifacts produced, and supported
args. Read when using any format beyond onnx/engine/openvino/coreml.
If the installed version rejects an argument, trust the error text (it lists valid
values) and yolo cfg over this file.
1---2name: yolo-export3description: Use when exporting or deploying Ultralytics YOLO models in Platform or code — the Platform Export tab and yolo export/model.export() for ONNX, TensorRT, CoreML, Core AI, OpenVINO, LiteRT, NCNN, ExecuTorch, and NPUs (RKNN, QNN, Hailo, Ascend, IMX, Axelera, DeepX), FP16/INT8 quantization, benchmarking, and non-Python runtimes. For inference with .pt weights or Platform endpoints, see yolo-inference.4---56# Export, quantization & deployment78## Fastest route: export in Platform910Open a completed model's **Export** tab, select one of the 20 formats, configure its11arguments, and click **Start Export**. Platform runs CPU exports directly and asks for a12target GPU where the format requires one (notably TensorRT); download the artifact when13the job completes. Match TensorRT's selected GPU family and software environment to the14deployment target, just as with a local engine build.1516Use Platform when you do not want to install each exporter toolchain locally. Use the17Python/CLI path below for custom calibration, repeatable automation, local hardware18builds, or immediate parity validation. See19[Platform model export](https://docs.ultralytics.com/platform/train/models#export-model).2021## Quickstart2223```python24from ultralytics import YOLO2526model = YOLO("runs/detect/train/weights/best.pt")27path = model.export(format="onnx") # returns the exported file/dir path28```2930```bash31yolo export model=best.pt format=onnx32```3334Exports load straight back into `YOLO()` for predict/val — same API:3536```python37model = YOLO("best.onnx") # or best.engine, best_openvino_model/, ...38```3940## Choose format by target hardware4142| Target | `format=` | Why |43| -------------------------------------------------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |44| NVIDIA GPU / Jetson | `engine` (TensorRT) | fastest on NVIDIA; **build on the deployment device** — engines are not portable across GPUs/TRT versions |45| Intel CPU/iGPU/NPU | `openvino` | ~3× CPU speedup |46| Apple iOS/macOS | `coreml` | broad OS coverage, Vision/iOS/Flutter support |47| Apple iOS 27+/macOS 27+ | `coreai` | native `.aimodel`; use `coreml` for iOS/Flutter SDKs; export on Apple silicon/macOS 26+ |48| Android | `litert` (renamed from `tflite`) or `ncnn` | NCNN strong on ARM |49| Raspberry Pi | `ncnn` | best ARM CPU latency |50| PyTorch Edge | `executorch` | |51| Cross-platform / unsure | `onnx` | runs everywhere; start here, specialize when latency demands |52| NPUs (Rockchip/Qualcomm/Hailo/Huawei/Sony/Axelera/DeepX) | `rknn` / `qnn` / `hailo` / `ascend` / `imx` / `axelera` / `deepx` | `name=` selects the exact chip for rknn/qnn/hailo/ascend |5354Full 21-target local export matrix with per-format supported args: `format-matrix.md`55(this folder). Platform currently offers 20 deployment formats.5657## Key arguments5859| Arg | Default | Notes |60| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |61| `imgsz` | model | inherited from the loaded model; set explicitly to the deployment shape |62| `quantize` | None | precision request: `16`/`fp16`, `8`/`int8`/`w8a8`, `w8a16`, `w8a32`, or `32`/`fp32`; support, speed, size, and accuracy are backend-dependent — see `format-matrix.md` and benchmark the target |63| `data` | None | representative calibration data when required; use >300 images generally and 500+ for TensorRT. Omission selects a small task default, so pass deployment-representative data explicitly |64| `dynamic` | False | variable input shape/batch where supported; check `format-matrix.md` and benchmark the target |65| `batch` | 1 | max batch baked into the export |66| `simplify` | True | simplify ONNX graph |67| `opset` | None | compatible ONNX opset selected automatically when unset; pin lower if the consumer runtime complains |68| `end2end` | None | preserve the model setting; set `False` on YOLO26/YOLOv10 when the target needs raw outputs or conventional NMS |69| `nms` | False | bake NMS into a raw-output pipeline where supported; for YOLO26/YOLOv10 also set `end2end=False` |70| `workspace` | None | TensorRT builder GiB — lower if the build OOMs |71| `device` | None | `device=0` required for TensorRT; also speeds INT8 calibration |72| `fraction` | 1.0 | fraction of calibration data used |7374## Verify parity after export (always)7576```bash77yolo val model=best.pt data=data.yaml # baseline78yolo val model=best.onnx data=data.yaml # compare the same task metric with the baseline79```8081Acceptable differences depend on the task, model, backend, precision, and calibration82data. Investigate unexpected gaps by matching `imgsz` and pre/post-processing and, where83required, using representative calibration data. Also compare one prediction with `.pt`.8485## Benchmark all formats empirically8687```bash88yolo benchmark model=best.pt data=data.yaml imgsz=640 # all formats at default precision89yolo benchmark model=best.pt data=data.yaml format=engine quantize=16 device=0 imgsz=640 # targeted FP1690```9192Produces the task metric + latency per exportable format **on this machine**. Repeat for93each supported precision and benchmark on deployment hardware, not your dev box.9495## Consuming exports outside Python9697- In raw runtimes (C++, mobile, JS) **you** own preprocessing (letterbox resize,98 BGR→RGB, /255) and output decoding.99- Detect output layout differs: end-to-end YOLO26 emits final100 `[x1,y1,x2,y2,conf,cls]` rows. If export disables end-to-end, YOLO26—like101 YOLO11/v8—emits raw `[4+nc, anchors]` heads; where supported, `nms=True` wraps them.102 Set `end2end=False nms=True` to request that path explicitly. Segment, pose, and OBB103 add task-specific outputs. Check export warnings and shapes.104- Class names travel in export metadata where supported; otherwise ship the `names`105 map alongside the model.106- Serving: `ultralytics.utils.triton.TritonRemoteModel` for Triton;107 `examples/` in the ultralytics repo has ONNXRuntime C++/Rust/Python references.108109## Troubleshooting110111| Symptom | Fix |112| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |113| Export crashes on missing package | most backends auto-install on first export; rerun. TensorRT must match your CUDA — install per NVIDIA docs |114| `Unsupported ONNX opset` downstream | export with lower `opset=`, or upgrade the runtime |115| TensorRT build OOM/slow | lower `workspace`, `batch=1`, `dynamic=False` |116| Export much less accurate | imgsz mismatch; too little/unrepresentative calibration data; wrong custom pre/post-processing; use a supported higher precision or backend |117| Engine fails on another machine | TensorRT engines are device+version specific — rebuild on target |118| CoreML export fails on Windows | export on macOS or Linux |119| Core AI export is unavailable | requires Apple silicon, macOS 26+, torch>=2.8, and Python 3.11–3.13; use Core ML for broader production support |120| Deprecation warnings for `half`/`int8`/`tflite` | auto-forwarded (`half→quantize=16`, `int8→quantize=8`, `tflite→litert`) — switch to the new names |121122## Related pages123124- `format-matrix.md` — all 21 local export targets, artifacts produced, and supported125 args. Read when using any format beyond onnx/engine/openvino/coreml.126127If the installed version rejects an argument, trust the error text (it lists valid128values) and `yolo cfg` over this file.