Includes warning for enforced `dynamic` during INT8 exports (#15874)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
pull/15932/head
Burhan 3 months ago committed by GitHub
parent eecee8f666
commit 43c5ed9892
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      ultralytics/engine/exporter.py

@ -204,8 +204,9 @@ class Exporter:
self.args.half = False
assert not self.args.dynamic, "half=True not compatible with dynamic=True, i.e. use only one."
self.imgsz = check_imgsz(self.args.imgsz, stride=model.stride, min_dim=2) # check image size
if self.args.int8 and (engine or xml):
if self.args.int8 and not self.args.dynamic and (engine or xml):
self.args.dynamic = True # enforce dynamic to export TensorRT INT8; ensures ONNX is dynamic
LOGGER.warning("WARNING ⚠ INT8 export requires dynamic image sizes, setting dynamic=True.")
if self.args.optimize:
assert not ncnn, "optimize=True not compatible with format='ncnn', i.e. use optimize=False"
assert self.device.type == "cpu", "optimize=True not compatible with cuda devices, i.e. use device='cpu'"

Loading…
Cancel
Save