roatienza/Deep-Learning-Experiments

Should the discriminator's parameter be frozen during training adversarial model?

germunwang opened this issue · 3 comments

Hi,
I have a question as the title when I was studying DCGAN.

I found some other DCGAN examples of keras and it seems they will set the discriminator's parameter non-trainable during training adversarial.
Then resume it to trainable once training only discriminator model again.

But it seems in your DCGAN code doesn't do the work.
(that means setting trainable=False and recompile the model)
Is that a bug or did I misunderstand the training process of DCGAN?

Thanks.

In DCGAN, both the discriminator and generator should learn together. I also see other approaches wherein the discriminator is pre-trained and re-trained together with the generator. This approach is not a good idea since we want both the discriminator and generator to have non-vanishing gradients. If the discriminator is ahead of the training, it could no longer propagate gradients down to the generator. Freezing the discriminator when training generator might also work.

I got it. Thanks for replying. :)

To follow up on this, because you're labeling generated images as "1" when training the adversarial model, I think you have to freeze the discriminator. Otherwise, the discriminator will learn to assign "1" to both real and fake images.