pytorch-CycleGAN-and-pix2pix icon indicating copy to clipboard operation
pytorch-CycleGAN-and-pix2pix copied to clipboard

Setting "--norm" to "none"

Open lizard24 opened this issue 4 years ago • 3 comments

Hi,

I am trying to train a cycleGAN with impaired 128x128 greyscale images that I pre-processed already.

When I am setting the "--norm" parameter to "none", "idt" and "fake" images are completely empty during training, while the "real" images are fine. If I keep the default setting for "--norm", this is not a problem.

Also, setting "preprocess" to "none" doesn't work for some reason, the training doesn't start (it works if I keep it in default and set "--load_size" and "crop_size" to "128").

I noticed that the images that are put out during the training are RGB images although I changed "--input_nc" and "--output_nc" to "1". Why?

My guess is I don't completely understand what "--preprocess" and "--norm" do. Could someone please explain so that I understand what the problem is? Alternatively, can anyone point me to a resource where the parameters are explained in more detail (other than the options python scripts)?

Many thanks, Lisa

lizard24 avatar Feb 15 '21 14:02 lizard24

Very good question, I have the same problem and await guidance.

icelandno1 avatar Aug 30 '22 03:08 icelandno1

--norm refers to using instance normalization or batch normalization [instance | batch | none]. See this line. You probably don't want to touch it.

--preprocess is for data preprocessing. See this line.

--preprocess None doesn't work for every dataset. If your image comes in different sizes, you might crash the training.

junyanz avatar Aug 30 '22 20:08 junyanz

When we save images for visualization, we convert the image to a 3-channel tensor, even if --input_nc and --output_nc are 1. (link). This could be the reason?

This is a guess, but if --norm is set to "none", there is no adjustment on scaling. And CycleGAN networks are initialized with a small variance closed to zero. Therefore, the final output of the generator network may be very small (very small weights are multiplied at every layer without normalization) and it may appear "empty". Could you try setting --init_gain 1.0 and see if the outputs look less empty?

taesungp avatar Aug 30 '22 20:08 taesungp