Set `dynamic` to True only if imgsz is dynamic for ONNX (#17872)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>
pull/17719/head^2
Mohammed Yasin 1 week ago committed by GitHub
parent 5c84099a9d
commit a672bf79dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ultralytics/engine/predictor.py

@ -155,7 +155,7 @@ class BasePredictor:
same_shapes = len({x.shape for x in im}) == 1
letterbox = LetterBox(
self.imgsz,
auto=same_shapes and (self.model.pt or getattr(self.model, "dynamic", False)),
auto=same_shapes and (self.model.pt or (getattr(self.model, "dynamic", False) and not self.model.imx)),
stride=self.model.stride,
)
return [letterbox(image=x) for x in im]

Loading…
Cancel
Save