diff options
author | nunzip <np.scarh@gmail.com> | 2019-03-04 21:06:27 +0000 |
---|---|---|
committer | nunzip <np.scarh@gmail.com> | 2019-03-04 21:06:27 +0000 |
commit | f00bc97bcb820d30d73fed37eb5c0d5ffddcd9ca (patch) | |
tree | 6077e8db811da655e9e94f719b9d25f7a26a4aa8 /cgan.py | |
parent | 02ad81aa8b05c86bf02f1dfb883770af6aa51e61 (diff) | |
download | e4-gan-f00bc97bcb820d30d73fed37eb5c0d5ffddcd9ca.tar.gz e4-gan-f00bc97bcb820d30d73fed37eb5c0d5ffddcd9ca.tar.bz2 e4-gan-f00bc97bcb820d30d73fed37eb5c0d5ffddcd9ca.zip |
Add One-sided smoothing
Diffstat (limited to 'cgan.py')
-rwxr-xr-x | cgan.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -107,7 +107,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=False): # Load the dataset (X_train, y_train), (_, _) = mnist.load_data() @@ -140,7 +140,10 @@ class CGAN(): gen_imgs = self.generator.predict([noise, labels]) # Train the discriminator - d_loss_real = self.discriminator.train_on_batch([imgs, labels], valid) + if smooth == True: + d_loss_real = self.discriminator.train_on_batch([imgs, labels], valid*0.9) + else: + 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 = 0.5 * np.add(d_loss_real, d_loss_fake) |