What's the meaning of this code?
hgfm opened this issue · comments
In the
def train(BATCH_SIZE):
discriminator_on_generator = \ generator_containing_discriminator(generator, discriminator)
what is discriminator_on_generator
?Is it a model?
discriminator_on_generator
is a model that combines a generator and discriminator. in other words, discriminator_on_generator
is a stacked model that is a binary classifier, capable of distinguishing between fake and real images.
ultimately, it is discriminator_on_generator
that trains the generator - the generator is never trained as a standalone model. the relevant bit of code is here:
g_loss = discriminator_on_generator.train_on_batch(
noise, [1] * BATCH_SIZE)
Since discriminator_on_generator is trains the generator, why do you need to compile the generator?
g.compile(loss='binary_crossentropy', optimizer="SGD")
Also in the paper, it seems we need to max one model and minimize the other model, but we don't seem to be doing that here. We seem to be minimizing both loss functions.