aboutsummaryrefslogtreecommitdiff
path: root/dcgan.py
diff options
context:
space:
mode:
Diffstat (limited to 'dcgan.py')
-rw-r--r--dcgan.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/dcgan.py b/dcgan.py
index 7844843..4317994 100644
--- a/dcgan.py
+++ b/dcgan.py
@@ -113,7 +113,7 @@ class DCGAN():
return Model(img, validity)
- def train(self, epochs, batch_size=128, save_interval=50, VBN=False):
+ def train(self, epochs, batch_size=128, save_interval=50, VBN=False, gdstep=1):
# Load the dataset
(X_train, _), (_, _) = mnist.load_data()
@@ -153,7 +153,10 @@ class DCGAN():
# ---------------------
# Train the generator (wants discriminator to mistake images as real)
- g_loss = self.combined.train_on_batch(noise, valid)
+ if epoch % gdstep == 0:
+ g_loss = self.combined.train_on_batch(noise, valid)
+ else:
+ g_loss = 0
# Plot the progress
#print ("%d [D loss: %f, acc.: %.2f%%] [G loss: %f]" % (epoch, d_loss[0], 100*d_loss[1], g_loss))