diff options
Diffstat (limited to 'cgan.py')
-rw-r--r-- | cgan.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -113,7 +113,7 @@ class CGAN(): return Model([img, label], validity) - def train(self, epochs, batch_size=128, sample_interval=50, graph=False): + def train(self, epochs, batch_size=128, sample_interval=50, graph=False, smooth_real=1, smooth_fake=0): # Load the dataset (X_train, y_train), (_, _) = mnist.load_data() @@ -147,8 +147,8 @@ class CGAN(): gen_imgs = self.generator.predict([noise, labels]) # Train the discriminator - d_loss_real = self.discriminator.train_on_batch([imgs, labels], valid) - d_loss_fake = self.discriminator.train_on_batch([gen_imgs, labels], fake) + d_loss_real = self.discriminator.train_on_batch([imgs, labels], valid*smooth_real) + d_loss_fake = self.discriminator.train_on_batch([gen_imgs, labels], valid*smooth_fake) d_loss = 0.5 * np.add(d_loss_real, d_loss_fake) # --------------------- |