aboutsummaryrefslogtreecommitdiff
path: root/cgan.py
diff options
context:
space:
mode:
authorVasil Zlatanov <v@skozl.com>2019-03-05 14:32:38 +0000
committerVasil Zlatanov <v@skozl.com>2019-03-05 14:32:38 +0000
commit6b573a30a3021d259400af9751645eb1a5b4705b (patch)
tree09d68aa13d19062369f5044bf246ddd89a579fdb /cgan.py
parent740e1b0c6a02a7bec20008758373f0dd80baade4 (diff)
parent2a720c237259baa2d968286244f9e43794c7e4d9 (diff)
downloade4-gan-6b573a30a3021d259400af9751645eb1a5b4705b.tar.gz
e4-gan-6b573a30a3021d259400af9751645eb1a5b4705b.tar.bz2
e4-gan-6b573a30a3021d259400af9751645eb1a5b4705b.zip
Full featured VBN
Diffstat (limited to 'cgan.py')
-rw-r--r--cgan.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cgan.py b/cgan.py
index b9928f0..45b9bb9 100644
--- a/cgan.py
+++ b/cgan.py
@@ -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)
# ---------------------