docs/macros/export-args.md
| Argument | Type | Default | Description |
|---|---|---|---|
format | str | 'torchscript' | Target format for the exported model, such as 'onnx', 'torchscript', 'engine' (TensorRT), or others. Each format enables compatibility with different deployment environments. |
name | str | None | Hardware target name for the formats that require one: Hailo architecture ('hailo8', 'hailo8l', 'hailo10h', 'hailo15h', 'hailo15l'; defaults to 'hailo8l'), Rockchip RKNN chip (defaults to 'rk3588'), Huawei Ascend SoC (a CANN --soc_version; defaults to 'Ascend310B4'), or Qualcomm QNN HTP target (defaults to '73'). Distinct from the project/name run-naming pair used by other modes. |
imgsz | int or tuple | 640 | Desired image size for the model input. Can be an integer for square images (e.g., 640 for 640×640) or a tuple (height, width) for specific dimensions. |
keras | bool | False | Enables export to Keras format for TensorFlow SavedModel, providing compatibility with TensorFlow serving and APIs. |
optimize | bool | False | Enables higher compiler optimization for DEEPX, reducing inference latency while increasing compilation time. |
quantize | int or str | None | Quantization precision: 16 (FP16, reduces model size and can speed up inference on supported hardware) or 8 (INT8/PTQ, further compresses the model with minimal accuracy loss, primarily for edge devices; needs calibration data/fraction); 32/unset is FP32. Export formats that support mixed weight/activation precision also accept the 'w8a8'/'w16a16'/'w8a16'/'w8a32' notation. Replaces the deprecated half/int8 flags (half=True → 16, int8=True → 8, still accepted with a deprecation warning). Only precisions supported by the target format are allowed (see below). |
dynamic | bool | False | Allows dynamic input sizes for TorchScript, ONNX, OpenVINO, TensorRT, and CoreML exports, enhancing flexibility in handling varying image dimensions. |
simplify | bool | True | Simplifies the intermediate ONNX graph with onnxslim for the exports that build one (see Export Formats), potentially improving performance and compatibility with inference engines. |
opset | int | None | Specifies the ONNX opset version for the exports that build an ONNX graph (see Export Formats), for compatibility with different ONNX parsers and runtimes. If not set, uses the latest supported version. |
workspace | float or None | None | Sets the maximum workspace size in GiB for TensorRT optimizations, balancing memory usage and performance. Use None for auto-allocation by TensorRT up to device maximum. |
nms | bool | False | Adds Non-Maximum Suppression (NMS) to the exported model when supported (see Export Formats), improving detection post-processing efficiency. Not available for end2end models. For CoreML, only supported for detection models. |
conf | float | None | Confidence threshold used wherever export-time NMS is generated: nms=True exports; Hailo's non-end-to-end detect exports; and IMX's detect, pose, and segment exports, which force nms=True internally. Defaults to 0.25 when unset, except for IMX exports, which default to 0.001. |
iou | float | 0.7 | IoU threshold used wherever export-time NMS is generated: nms=True exports; Hailo's non-end-to-end detect exports; and IMX's detect, pose, and segment exports, which force nms=True internally. |
max_det | int | 300 | Maximum number of detections kept in the exported model's output. Applies to nms=True exports on every format except CoreML, whose NMS pipeline has no detection cap, plus NMS-free end-to-end detection exports (YOLO26, YOLOv10, clamped to the number of available anchors) and IMX's detect, pose, and segment exports. |
agnostic_nms | bool | False | Enables class-agnostic NMS wherever export-time NMS is generated through the standard nms=True pipeline, including CoreML's own NMS stage, suppressing lower-scoring overlapping boxes across different classes rather than only within the same class. Not honored by Hailo's or IMX's own generated NMS configs, which have no class-agnostic option and remain class-aware regardless of this flag. Also baked into NMS-free end-to-end exports (YOLO26, YOLOv10), where it only prevents the same detection from appearing under multiple class labels (IoU=1.0 duplicates), not IoU-threshold suppression between distinct boxes. |
batch | int | 1 | Specifies export model batch inference size or the maximum number of images the exported model will process concurrently in predict mode. For Edge TPU exports, this is automatically set to 1. |
device | str | None | Specifies the device for exporting: GPU (device=0), CPU (device=cpu), MPS for Apple silicon (device=mps), Huawei Ascend NPU (device=npu or device=npu:0), or DLA for NVIDIA Jetson (device=dla:0 or device=dla:1). TensorRT exports automatically use GPU, but TensorRT 11.0 does not support DLA. |
verbose | bool | True | Raises the TensorRT builder log to VERBOSE severity during format='engine' export. Other export formats ignore it. |
data | str | None | Path to the dataset YAML, essential for INT8 quantization calibration; classification instead takes a dataset directory or a built-in dataset name. If not specified with INT8 enabled, Ultralytics selects a task-specific calibration dataset where required, or falls back to the default dataset for the model task. |
split | str | 'val' | Dataset split ('train', 'val', or 'test') used to build the INT8 quantization calibration dataloader from data. |
fraction | float | 1.0 | Specifies the fraction of the dataset to use for INT8 quantization calibration. Allows for calibrating on a subset of the full dataset, useful for experiments or when resources are limited. If not specified with INT8 enabled, the full dataset will be used. |
end2end | bool | None | Overrides the end-to-end mode in YOLO models that support NMS-free inference (YOLO26, YOLOv10). Setting it to False lets you export these models to be compatible with the traditional NMS-based postprocessing pipeline. See the End-to-End Detection guide for details. |