eriklindernoren / Keras-GAN

Keras implementations of Generative Adversarial Networks.
MIT License
9.18k stars 3.14k forks source link

Keras-GAN: Help understanding the model setup? #174

Open a-poor opened 5 years ago

a-poor commented 5 years ago

Hi! Sorry for the basic question but I'm a bit of a beginner and I'm trying to understand how the model is set up. I have a 2-part question:

First, what is the reason for defining a model sequentially and then using it to create a model with the functional API? (for example...) https://github.com/eriklindernoren/Keras-GAN/blob/44d3320e84ca00071de8a5c0fb4566d10486bb1d/gan/gan.py#L54-L73

Second, when creating the combined model, the discriminator is set to not trainable but how is it able to be trained individually while being frozen to train the generator? https://github.com/eriklindernoren/Keras-GAN/blob/44d3320e84ca00071de8a5c0fb4566d10486bb1d/gan/gan.py#L40-L41

Thanks for your help! Sorry if these are super basic questions or don't make any sense

TheGuywithTheHat commented 5 years ago

Regarding your second questions, see: https://github.com/eriklindernoren/Keras-GAN/issues/22#issuecomment-379553290

Essentially, it is important that trainable = false is set between discriminator.compile() and combined.compile().

a-poor commented 5 years ago

Gotcha, thanks!

hiteshnitetc commented 4 years ago

functional api is used for multi input multi output system