liyunsheng13 / BDL

MIT License
222 stars 30 forks source link

fineSize (cropSize) for Cycle-Gan #47

Open Nadavc220 opened 3 years ago

Nadavc220 commented 3 years ago

Hi, I am a bit confused about the fineSize parameter for the CycleGAN training process. In your Readme file found in the cycle-gan the fineSize mentioned for training is 452, while in a previous post you say cycle-gan is trained with fineSize=1024. This is the previous post I am referring: https://github.com/liyunsheng13/BDL/issues/28

which one is the right one? and in general, what is the fineSize policy for the cycleGAN training? seems reasonable so choose the same input size used in BDL for that dataset so cycleGAN will optimize outputting images with that size and they can be used later in the BDL.py traning.

Thanks =)

liyunsheng13 commented 3 years ago

The images used to train CycleGAN should be first resized to the same scale e.g. the height or width is 1024. Then due to the GPU memory limitation, a 452x452 patch is cropped to train CycleGAN.

In general, the images used to train CycleGAN and Segmentation model should have the some size.

Nadavc220 commented 3 years ago

So did you train BDL with 452x452 inputs (scaled back to 1024) or should I use cycleGan to create images with their original size although I trained for 452x452 patches?

liyunsheng13 commented 3 years ago

No, the resolution used to train both segmentation model and cyclegan is the same. For cycelgan, I just crop the images to the size 452x452. You can check my code and you can understand the details to resize and crop images.

kw01sg commented 2 years ago

If I'm not wrong, and @liyunsheng13 can double confirm, the entire process goes like this:

  1. CycleGAN is trained using images that are first scaled to width of 1024px, before 452x452 patches are cropped from them
  2. After CycleGAN is trained, translate source training images to target images with width of 1024px while maintaining aspect ratio
  3. When training segmentation model, translated images with width of 1024px are resized back to their original resolution data module.

This probably means that we can change the width of our images during the CycleGAN training stage since resizing always happens during segmentation model training.

liyunsheng13 commented 2 years ago

The process is correct. But I do not think you can change the image resolution when CycleGAN is trained. Because resizing cannot recover the loss of resolution.