junyanz / pytorch-CycleGAN-and-pix2pix

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

Working with High Resolution Images #1542

Open AlicanAKCA opened 1 year ago

AlicanAKCA commented 1 year ago

Hi, I want you to give some advice about the image load size as much as possible.

How will I know how much to reduce the size of the picture I will give to my model?

I don't know how this will affect my model. Is there any mathematical structure to understand this method?

Here is the section that you have mentioned in tips.md:

Training/Testing with high res images

CycleGAN is quite memory-intensive as four networks (two generators and two discriminators) need to be loaded on one GPU, so a large image cannot be entirely loaded. In this case, we recommend training with cropped images. For example, to generate 1024px results, you can train with --preprocess scale_width_and_crop --load_size 1024 --crop_size 360, and test with --preprocess scale_width --load_size 1024. This way makes sure the training and test will be at the same scale. At test time, you can afford higher resolution because you don’t need to load all networks.

Thanks in advance!

junyanz commented 1 year ago

It's more of a GPU memory constraint rather than a mathematic constraint. In practice, people just try different image resolutions until they hit the memory limit.