LynnHo / CycleGAN-Tensorflow-2

MIT License
384 stars 158 forks source link

Using the wgan configuration gives bad results #30

Open OriYitzhaki opened 4 years ago

OriYitzhaki commented 4 years ago

Hi, I've tried to train the model with the "wgan" options turned on, and got pretty bad results. for example (iter 240000): iter-000240000

I can see a grid-like on the first translation (the cycled image looks fine) but I'm not sure what causing it. the grid is present on every result (excluding the very begining).

the command I'm using: python3 train.py --output=output_wgan --adversarial_loss_mode=wgan --gradient_penalty_mode=wgan-gp I wonder if I should change some of the weights for better results, and if so to which value?

LynnHo commented 4 years ago

@OriYitzhaki Try to train D 5 times since WGAN need more D training. I.e., change this line https://github.com/LynnHo/CycleGAN-Tensorflow-2/blob/088263857d2fb9b8f06caa281b62bcad43eddadc/train.py#L149 to be

for _ in range(5):
    D_loss_dict = train_D(A, B, A2B, B2A)
OriYitzhaki commented 4 years ago

@OriYitzhaki Try to train D 5 times since WGAN need more D training. I.e., change this line https://github.com/LynnHo/CycleGAN-Tensorflow-2/blob/088263857d2fb9b8f06caa281b62bcad43eddadc/train.py#L149

to be

for _ in range(5):
  D_loss_dict = train_D(A, B, A2B, B2A)

An Update for whoever will read the thread: at the moment that mentaioned addition solely does not seems to work. the generator's activations seems to be too strong and around the mid of epoch 51, the pixel values are nan

LynnHo commented 4 years ago

@OriYitzhaki I will try to figure out the problem. It seems that there are some bugs in WGAN-GP with TF2.