You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in the file "./data/base_dataset.py", you can easily find the part to precess the image you imported.
If you use resize_and_crop option, width and height(new_h & new_w) are eqaul to a load_size.
but if you use scale_width option, height of load image change refer to the ration of the original image.
As far as I know, resize_and_crop option loads the images as square, same width and height, but scale_width_and_crop option loads the image as rectangular with aspect ration of the original data.
i found it maybe a mistake in the source code
def __scale_width(img, target_size, crop_size, method=transforms.InterpolationMode.BICUBIC):
method = __transforms2pil_resize(method)
ow, oh = img.size
if ow == target_size and oh >= crop_size:
return img
w = target_size
h = int(max(target_size * oh / ow, crop_size))
return img.resize((w, h), method)
usually the width is bigger than height, so it still result in distortion, change it into def __scale_width(img, target_size, crop_size, method=transforms.InterpolationMode.BICUBIC):
method = __transforms2pil_resize(method)
ow, oh = img.size
if ow == target_size and oh >= crop_size:
return img
h = target_size
w = int(max(target_size * ow / oh, crop_size))
return img.resize((w, h), method)
and it keeps the aspect ratio
The description seems to be the same where both resize the image to load_size and then crop the image to crop_size.
The only thing I seem to notice is that scale_width_and_crop seems to complete an epoch a bit faster than resize_and_crop.
(my images are 1024x1024 and the load size is 512)
The text was updated successfully, but these errors were encountered: