Add warning for inference end2end models with augment arg (#13958)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Laughing 2024-06-25 17:56:26 +08:00 committed by GitHub
parent b10e0f3fa8
commit be1722b4b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -151,8 +151,8 @@ class BaseModel(nn.Module):
def _predict_augment(self, x):
"""Perform augmentations on input image x and return augmented inference."""
LOGGER.warning(
f"WARNING ⚠️ {self.__class__.__name__} does not support augmented inference yet. "
f"Reverting to single-scale inference instead."
f"WARNING ⚠️ {self.__class__.__name__} does not support 'augment=True' prediction. "
f"Reverting to single-scale prediction."
)
return self._predict_once(x)
@ -337,6 +337,12 @@ class DetectionModel(BaseModel):
def _predict_augment(self, x):
"""Perform augmentations on input image x and return augmented inference and train outputs."""
if self.end2end:
LOGGER.warning(
"WARNING ⚠️ End2End model does not support 'augment=True' prediction. "
"Reverting to single-scale prediction."
)
return self._predict_once(x)
img_size = x.shape[-2:] # height, width
s = [1, 0.83, 0.67] # scales
f = [None, 3, None] # flips (2-ud, 3-lr)