We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 482127c commit 232ea93Copy full SHA for 232ea93
detectionmetrics/models/torch.py
@@ -190,15 +190,9 @@ def __init__(
190
self.closest_divisor = closest_divisor
191
192
def forward(self, image: Image.Image) -> Image.Image:
193
- w, h = image.size
194
- old_size = (h, w)
195
-
196
- if self.width is None:
197
- w = int((self.height / image.size[1]) * image.size[0])
198
- h = self.height
199
- if self.height is None:
200
- h = int((self.width / image.size[0]) * image.size[1])
201
- w = self.width
+ old_size = image.size
+ w = self.width or int((self.height / old_size[1]) * old_size[0])
+ h = self.height or int((self.width / old_size[0]) * old_size[1])
202
203
h = round(h / self.closest_divisor) * self.closest_divisor
204
w = round(w / self.closest_divisor) * self.closest_divisor
0 commit comments