Fix _predict_augment and add warning (#16056)

Signed-off-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Laughing 2024-09-06 22:03:15 +08:00 committed by GitHub
parent d0dd2b9313
commit b00f4afefa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -341,11 +341,8 @@ class DetectionModel(BaseModel):
def _predict_augment(self, x): def _predict_augment(self, x):
"""Perform augmentations on input image x and return augmented inference and train outputs.""" """Perform augmentations on input image x and return augmented inference and train outputs."""
if getattr(self, "end2end", False): if getattr(self, "end2end", False) or self.__class__.__name__ != "DetectionModel":
LOGGER.warning( LOGGER.warning("WARNING ⚠️ Model does not support 'augment=True', reverting to single-scale prediction.")
"WARNING ⚠️ End2End model does not support 'augment=True' prediction. "
"Reverting to single-scale prediction."
)
return self._predict_once(x) return self._predict_once(x)
img_size = x.shape[-2:] # height, width img_size = x.shape[-2:] # height, width
s = [1, 0.83, 0.67] # scales s = [1, 0.83, 0.67] # scales