From b7e9e91d4655b568f6244494be53a391c51c7ffc Mon Sep 17 00:00:00 2001 From: Laughing <61612323+Laughing-q@users.noreply.github.com> Date: Thu, 21 Nov 2024 20:02:48 +0800 Subject: [PATCH] `ultralytics 8.3.35` enable `auto` letterbox if model is `dynamic` (#17687) Co-authored-by: Glenn Jocher --- ultralytics/__init__.py | 2 +- ultralytics/engine/predictor.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index 839ac6216c..6ca4f42393 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = "8.3.34" +__version__ = "8.3.35" import os diff --git a/ultralytics/engine/predictor.py b/ultralytics/engine/predictor.py index fbe593e065..c28e1895d0 100644 --- a/ultralytics/engine/predictor.py +++ b/ultralytics/engine/predictor.py @@ -153,7 +153,11 @@ class BasePredictor: (list): A list of transformed images. """ same_shapes = len({x.shape for x in im}) == 1 - letterbox = LetterBox(self.imgsz, auto=same_shapes and self.model.pt, stride=self.model.stride) + letterbox = LetterBox( + self.imgsz, + auto=same_shapes and (self.model.pt or getattr(self.model, "dynamic", False)), + stride=self.model.stride, + ) return [letterbox(image=x) for x in im] def postprocess(self, preds, img, orig_imgs):