Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dcgan loss #10

Open
eyaler opened this issue Oct 28, 2017 · 3 comments
Open

dcgan loss #10

eyaler opened this issue Oct 28, 2017 · 3 comments

Comments

@eyaler
Copy link

eyaler commented Oct 28, 2017

in
https://github.com/roatienza/Deep-Learning-Experiments/blob/master/Experiments/Tensorflow/GAN/dcgan_mnist.py
you compute the generator loss as:
a_loss = self.adversarial.train_on_batch(noise, y)
but this also trains the discriminator using only the fake samples.
shouldn't you freeze the discriminator weights for this part?

@harshtikuu
Copy link

@eyaler exactly my doubt

@hmaon
Copy link

hmaon commented Oct 21, 2018

yeah... you can change self.AM.add(self.discriminato() in adversarial_model() to this:

        dc = self.discriminator()
        for layer in dc.layers:  layer.trainable = False
        self.AM.add(dc)

You'll get a warning but the discriminator will be frozen for a_loss = self.adversarial.train_on_batch(noise, y)

I verified the change with this instrumentation code:

            print("before adversarial.train " + str(keras.backend.eval(self.adversarial.layers[1].layers[0].weights[0][0][0][0][0])))
            a_loss = self.adversarial.train_on_batch(noise, y)
            print("after  adversarial.train " + str(keras.backend.eval(self.adversarial.layers[1].layers[0].weights[0][0][0][0][0])))

@elk-cloner
Copy link

in
https://github.com/roatienza/Deep-Learning-Experiments/blob/master/Experiments/Tensorflow/GAN/dcgan_mnist.py
you compute the generator loss as:
a_loss = self.adversarial.train_on_batch(noise, y)
but this also trains the discriminator using only the fake samples.
shouldn't you freeze the discriminator weights for this part?

you're right. we should freeze discriminator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants