junyanz / pytorch-CycleGAN-and-pix2pix

Image-to-Image Translation in PyTorch
Other
22.8k stars 6.29k forks source link

What is the difference between preprocess scale_width_and_crop and resize_and_crop? #1667

Open bclaw524 opened 2 months ago

bclaw524 commented 2 months ago

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)

Jiwno commented 5 days ago

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.