From 8b8c25f216de005ff5d1c22680bcb957f0a07024 Mon Sep 17 00:00:00 2001 From: inisis <46103969+inisis@users.noreply.github.com> Date: Tue, 24 Sep 2024 05:46:18 +0800 Subject: [PATCH] Default `simplify=True` (#16435) --- docs/en/macros/export-args.md | 2 +- ultralytics/cfg/default.yaml | 2 +- ultralytics/utils/benchmarks.py | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/en/macros/export-args.md b/docs/en/macros/export-args.md index e87e4bb1..acfbce3e 100644 --- a/docs/en/macros/export-args.md +++ b/docs/en/macros/export-args.md @@ -7,7 +7,7 @@ | `half` | `bool` | `False` | Enables FP16 (half-precision) quantization, reducing model size and potentially speeding up inference on supported hardware. | | `int8` | `bool` | `False` | Activates INT8 quantization, further compressing the model and speeding up inference with minimal accuracy loss, primarily for edge devices. | | `dynamic` | `bool` | `False` | Allows dynamic input sizes for ONNX, TensorRT and OpenVINO exports, enhancing flexibility in handling varying image dimensions. | -| `simplify` | `bool` | `False` | Simplifies the model graph for ONNX exports with `onnxslim`, potentially improving performance and compatibility. | +| `simplify` | `bool` | `True` | Simplifies the model graph for ONNX exports with `onnxslim`, potentially improving performance and compatibility. | | `opset` | `int` | `None` | Specifies the ONNX opset version for compatibility with different ONNX parsers and runtimes. If not set, uses the latest supported version. | | `workspace` | `float` | `4.0` | Sets the maximum workspace size in GiB for TensorRT optimizations, balancing memory usage and performance. | | `nms` | `bool` | `False` | Adds Non-Maximum Suppression (NMS) to the CoreML export, essential for accurate and efficient detection post-processing. | diff --git a/ultralytics/cfg/default.yaml b/ultralytics/cfg/default.yaml index 205dd655..a44f6094 100644 --- a/ultralytics/cfg/default.yaml +++ b/ultralytics/cfg/default.yaml @@ -81,7 +81,7 @@ keras: False # (bool) use Kera=s optimize: False # (bool) TorchScript: optimize for mobile int8: False # (bool) CoreML/TF INT8 quantization dynamic: False # (bool) ONNX/TF/TensorRT: dynamic axes -simplify: False # (bool) ONNX: simplify model using `onnxslim` +simplify: True # (bool) ONNX: simplify model using `onnxslim` opset: # (int, optional) ONNX: opset version workspace: 4 # (int) TensorRT: workspace size (GB) nms: False # (bool) CoreML: add NMS diff --git a/ultralytics/utils/benchmarks.py b/ultralytics/utils/benchmarks.py index 8d760f80..53ad62c5 100644 --- a/ultralytics/utils/benchmarks.py +++ b/ultralytics/utils/benchmarks.py @@ -365,7 +365,6 @@ class ProfileModels: onnx_file = model.export( format="onnx", imgsz=self.imgsz, - simplify=True, device=self.device, verbose=False, )