Faster batch same_shapes (#8851)

This commit is contained in:
Glenn Jocher 2024-03-11 19:53:35 +01:00 committed by GitHub
parent 2ea6b2b889
commit 617ab21523
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -151,7 +151,7 @@ class BasePredictor:
Returns:
(list): A list of transformed images.
"""
same_shapes = all(x.shape == im[0].shape for x in im)
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)
return [letterbox(image=x) for x in im]