pretrained-models.pytorch
pretrained-models.pytorch copied to clipboard
preserve_aspect_ratio in utils.py
https://github.com/Cadene/pretrained-models.pytorch/blob/56aa8c921819d14fb36d7248ab71e191b37cb146/pretrainedmodels/utils.py#L54-L59
I assume we keep aspect ratio when preserve_aspect_ratio is True, this way. code snippt should be
if preserve_aspect_ratio:
height = int(self.input_size[1] / self.scale)
width = int(self.input_size[2] / self.scale)
tfs.append(transforms.Resize((height, width)))
else:
tfs.append(transforms.Resize(int(math.floor(max(self.input_size)/self.scale))))