744353138995f1b15933be6ee2d39f7b83ee1b1f,dcgan.py,DCGAN,train,#DCGAN#Any#Any#Any#,109

Before Change



            // The discriminator wants to label the true samples as valid (ones) and
            // the generated images as fake (zeros)
            valid_y = np.array([1] * half_batch + [0] * half_batch)

            // Train the discriminator
            d_loss = self.discriminator.train_on_batch(imgs_x, valid_y)

After Change


        X_train = (X_train.astype(np.float32) - 127.5) / 127.5
        X_train = np.expand_dims(X_train, axis=3)

        half_batch = int(batch_size / 2)

        for epoch in range(epochs):

            // ---------------------
            //  Train Discriminator
            // ---------------------

            // Select a random half batch of images
            idx = np.random.randint(0, X_train.shape[0], half_batch)
            imgs = X_train[idx]

            // Sample noise and generate a half batch of new images
            noise = np.random.normal(0, 1, (half_batch, 100))
            gen_imgs = self.generator.predict(noise)

            // Train the discriminator (real classified as ones and generated as zeros)
            d_loss_real = self.discriminator.train_on_batch(imgs, np.ones((half_batch, 1)))
            d_loss_fake = self.discriminator.train_on_batch(gen_imgs, np.zeros((half_batch, 1)))
            d_loss = 0.5 * np.add(d_loss_real, d_loss_fake)

            // ---------------------
            //  Train Generator
            // ---------------------
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 16

Instances


Project Name: eriklindernoren/Keras-GAN
Commit Name: 744353138995f1b15933be6ee2d39f7b83ee1b1f
Time: 2017-07-16
Author: eriklindernoren@live.se
File Name: dcgan.py
Class Name: DCGAN
Method Name: train


Project Name: eriklindernoren/Keras-GAN
Commit Name: 3cba7783cb805459d26918be7a56b0e8b8fd3bc9
Time: 2017-07-17
Author: eriklindernoren@live.se
File Name: context_encoder.py
Class Name: ContextEncoder
Method Name: train


Project Name: eriklindernoren/Keras-GAN
Commit Name: 744353138995f1b15933be6ee2d39f7b83ee1b1f
Time: 2017-07-16
Author: eriklindernoren@live.se
File Name: dcgan.py
Class Name: DCGAN
Method Name: train


Project Name: eriklindernoren/Keras-GAN
Commit Name: 3cba7783cb805459d26918be7a56b0e8b8fd3bc9
Time: 2017-07-17
Author: eriklindernoren@live.se
File Name: gan.py
Class Name: GAN
Method Name: train