{"id":48153,"plugin_id":"plugins_6ac51f0691748191b2d31e8c84d99c62","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-10-24T13:35:34.306Z","digest":"0b9b6a66022aea3f6922851a51f91a850a250e24c7372b31d018ef5ee21f5ac8","against":null,"payload":{"description":"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, Xilinx), FP16/INT8 quantization, benchmarking, and non-Python runtimes. For inference with .pt weights or Platform endpoints, see yolo-inference.\n","included_files":[{"relative_path":"agents/openai.yaml","size_in_bytes":284},{"relative_path":"format-matrix.md","size_in_bytes":5669}],"name":"yolo-export","skill_md_contents":"---\nname: yolo-export\ndescription: >\n  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, Xilinx), FP16/INT8 quantization, benchmarking, and non-Python runtimes. For inference with .pt weights or Platform endpoints, see yolo-inference.\n---\n\n# Export, quantization & deployment\n\n## Fastest route: export in Platform\n\nOpen a completed model's **Export** tab, select a format, 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. For TensorRT, select the deployment device's GPU family or Jetson target; if its TensorRT/CUDA versions differ from the device's, export locally on that device instead.\n\nUse 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](https://docs.ultralytics.com/platform/train/models#export-model).\n\n## Quickstart\n\n```python\nfrom ultralytics import YOLO\n\nmodel = YOLO(\"runs/detect/train/weights/best.pt\")\npath = model.export(format=\"onnx\")  # returns the exported file/dir path\n```\n\n```bash\nyolo export model=best.pt format=onnx\n```\n\nExports load straight back into `YOLO()` for predict/val — same API:\n\n```python\nmodel = YOLO(\"best.onnx\")  # or best.engine, best_openvino_model/, ...\n```\n\n## Choose format by target hardware\n\n| Target                                                       | `format=`                                                                    | Why                                                                                                        |\n| ------------------------------------------------------------ | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |\n| NVIDIA GPU / Jetson                                          | `engine` (TensorRT)                                                          | fastest on NVIDIA; **build on the deployment device** — engines are not portable across GPUs/TRT versions  |\n| Intel CPU/iGPU/NPU                                           | `openvino`                                                                   | up to 3× CPU speedup on Intel                                                                              |\n| Apple iOS/macOS                                              | `coreml`                                                                     | broad OS coverage, Vision/iOS/Flutter support                                                              |\n| Apple iOS 27+/macOS 27+                                      | `coreai`                                                                     | native `.aimodel`; iOS/Flutter SDKs default to `coreml`; export on Apple silicon macOS 26+ or x86_64 Linux |\n| Android                                                      | `litert` (renamed from `tflite`) or `ncnn`                                   | NCNN strong on ARM                                                                                         |\n| Raspberry Pi                                                 | `ncnn`                                                                       | best ARM CPU latency                                                                                       |\n| PyTorch Edge                                                 | `executorch`                                                                 |                                                                                                            |\n| Cross-platform / unsure                                      | `onnx`                                                                       | runs everywhere; start here, specialize when latency demands                                               |\n| NPUs (Rockchip/Qualcomm/Hailo/Huawei/Sony/Axelera/DeepX/AMD) | `rknn` / `qnn` / `hailo` / `ascend` / `imx` / `axelera` / `deepx` / `xilinx` | `name=` selects the exact chip for rknn/qnn/hailo/ascend/xilinx                                            |\n\nFull 22-target local export matrix with per-format supported args: `format-matrix.md` (this folder).\n\n## Key arguments\n\n| Arg         | Default | Notes                                                                                                                                                                                           |\n| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `imgsz`     | model   | inherited from the loaded model; set explicitly to the deployment shape                                                                                                                         |\n| `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 |\n| `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        |\n| `dynamic`   | False   | variable input shape/batch where supported; check `format-matrix.md` and benchmark the target                                                                                                   |\n| `batch`     | 1       | max batch baked into the export                                                                                                                                                                 |\n| `simplify`  | True    | simplify ONNX graph                                                                                                                                                                             |\n| `opset`     | None    | compatible ONNX opset selected automatically when unset; pin lower if the consumer runtime complains                                                                                            |\n| `nms`       | None    | `None` exports raw outputs for external NMS (YOLO26 too); `True` embeds NMS where `format-matrix.md` lists `nms`; `False` selects the YOLO26/YOLOv10 NMS-free head, else raw outputs            |\n| `workspace` | None    | TensorRT builder GiB — lower if the build OOMs                                                                                                                                                  |\n| `device`    | None    | TensorRT needs a GPU (auto-set to `device=0` when unset); a GPU also speeds INT8 calibration                                                                                                    |\n| `fraction`  | 1.0     | fraction of calibration data used                                                                                                                                                               |\n\n## Verify parity after export (always)\n\n```bash\nyolo val model=best.pt data=data.yaml   # baseline\nyolo val model=best.onnx data=data.yaml # compare the same task metric with the baseline\n```\n\nAcceptable 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`.\n\n## Benchmark all formats empirically\n\n```bash\nyolo benchmark model=best.pt data=data.yaml imgsz=640                                    # all formats at default precision\nyolo benchmark model=best.pt data=data.yaml format=engine quantize=16 device=0 imgsz=640 # targeted FP16\n```\n\nProduces the task metric + latency per exportable format **on this machine**. Repeat for each supported precision and benchmark on deployment hardware, not your dev box.\n\n## Consuming exports outside Python\n\n- In raw runtimes (C++, mobile, JS) **you** own preprocessing (letterbox resize, BGR→RGB, /255) and output decoding.\n- Detect output layout follows `nms`: the default `nms=None` emits raw `[4+nc, anchors]` heads (xywh boxes + class scores) for every model, YOLO26 included, so you run NMS (`imx` instead always embeds NMS). `nms=False` on YOLO26/YOLOv10 emits NMS-free `[max_det, 6]` rows `[x1,y1,x2,y2,conf,cls]`, and `nms=True` embeds NMS with the same row layout where supported; some formats fall back to raw heads (`format-matrix.md`). Segment, pose, and OBB add task-specific outputs. Check export warnings and shapes.\n- Class names travel in export metadata where supported; otherwise ship the `names` map alongside the model.\n- Serving: `ultralytics.utils.triton.TritonRemoteModel` for Triton; `examples/` in the ultralytics repo has ONNXRuntime C++/Rust/Python references.\n\n## Troubleshooting\n\n| Symptom                                                   | Fix                                                                                                                                                                                                                                         |\n| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Export crashes on missing package                         | most backends auto-install on first export; rerun. On Linux, TensorRT auto-installs as `tensorrt-cu<torch CUDA major>`; elsewhere install it per NVIDIA docs. Hailo (Dataflow Compiler) and Ascend (CANN `atc`) need their vendor SDK first |\n| `Unsupported ONNX opset` downstream                       | export with lower `opset=`, or upgrade the runtime                                                                                                                                                                                          |\n| TensorRT build OOM/slow                                   | lower `workspace`, `batch=1`, `dynamic=False`                                                                                                                                                                                               |\n| Export much less accurate                                 | imgsz mismatch; too little/unrepresentative calibration data; wrong custom pre/post-processing; use a supported higher precision or backend                                                                                                 |\n| Engine fails on another machine                           | TensorRT engines are device+version specific — rebuild on target                                                                                                                                                                            |\n| CoreML export fails on Windows                            | export on macOS or Linux                                                                                                                                                                                                                    |\n| Core AI export is unavailable                             | requires macOS 26+ on Apple silicon or x86_64 Linux (glibc 2.34+), torch>=2.8, and Python 3.11–3.14; use CoreML for broader production support                                                                                              |\n| Deprecation warnings for `half`/`int8`/`end2end`/`tflite` | auto-forwarded (`half→quantize=16`, `int8→quantize=8`, `end2end=True→nms=False`, `end2end=False→nms=None` unless `nms=True` is also passed, `tflite→litert`) — switch to the new names                                                      |\n\n## Related pages\n\n- `format-matrix.md` — all 22 local export targets, artifacts produced, and supported args. Read when using any format beyond onnx/engine/openvino/coreml.\n\nIf the installed version rejects an argument, trust the error text (format and quantize errors list valid values) and `yolo cfg` over this file.\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}