5c18953a3da18402d3fcc9ff96d1e983d48c98cb,pix2pix/pix2pix.py,Pix2Pix,train,#Pix2Pix#Any#Any#Any#,142

Before Change


            // ------------------

            // Sample images and their conditioning counterparts
            imgs_A, imgs_B = self.data_loader.load_data(batch_size)

            // The generators want the discriminators to label the generated images as real
            valid = np.ones((batch_size,) + self.disc_patch)

After Change


        fake = np.zeros((batch_size,) + self.disc_patch)

        for epoch in range(epochs):
            for batch_i, (imgs_A, imgs_B) in enumerate(self.data_loader.load_batch(batch_size)):

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

                // Condition on B and generate a translated version
                fake_A = self.generator.predict(imgs_B)

                // Train the discriminators (original images = real / generated = Fake)
                d_loss_real = self.discriminator.train_on_batch([imgs_A, imgs_B], valid)
                d_loss_fake = self.discriminator.train_on_batch([fake_A, imgs_B], fake)
                d_loss = 0.5 * np.add(d_loss_real, d_loss_fake)

                // -----------------
                //  Train Generator
                // -----------------

                // Train the generators
                g_loss = self.combined.train_on_batch([imgs_A, imgs_B], [valid, imgs_A])

                elapsed_time = datetime.datetime.now() - start_time
                // Plot the progress
                print ("[Epoch %d/%d] [Batch %d/%d] [D loss: %f, acc: %3d%%] [G loss: %f] time: %s" % (epoch, epochs,
                                                                        batch_i, self.data_loader.n_batches,
                                                                        d_loss[0], 100*d_loss[1],
                                                                        g_loss[0],
                                                                        elapsed_time))

                // If at save interval => save generated image samples
                if batch_i % sample_interval == 0:
                    self.sample_images(epoch, batch_i)

    def sample_images(self, epoch, batch_i):
        os.makedirs("images/%s" % self.dataset_name, exist_ok=True)
        r, c = 3, 3
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: eriklindernoren/Keras-GAN
Commit Name: 5c18953a3da18402d3fcc9ff96d1e983d48c98cb
Time: 2018-04-16
Author: eriklindernoren@gmail.com
File Name: pix2pix/pix2pix.py
Class Name: Pix2Pix
Method Name: train


Project Name: eriklindernoren/Keras-GAN
Commit Name: 64a2763f3e0ff21c6de3bbbe6cbddab1857fc080
Time: 2018-04-16
Author: eriklindernoren@gmail.com
File Name: cyclegan/cyclegan.py
Class Name: CycleGAN
Method Name: train


Project Name: eriklindernoren/Keras-GAN
Commit Name: d444fdae4b30d35f3cfba98c9fa9e3169cc2cf69
Time: 2018-03-15
Author: eriklindernoren@gmail.com
File Name: discogan/discogan.py
Class Name: DiscoGAN
Method Name: train