diff --git a/tensorflow/TensorGAN/cGAN/config.py b/tensorflow/TensorGAN/cGAN/config.py index e69de29..ab1d9fd 100644 --- a/tensorflow/TensorGAN/cGAN/config.py +++ b/tensorflow/TensorGAN/cGAN/config.py @@ -0,0 +1,7 @@ +# Data path +mnist_path = "D:/datasets/MNIST_DATA/" + +# Training hyper paramters +batch_size = 64 +input_dim = 100 +hidden_dim = 128 \ No newline at end of file diff --git a/tensorflow/TensorGAN/cGAN/main.py b/tensorflow/TensorGAN/cGAN/main.py index e69de29..a7684c6 100644 --- a/tensorflow/TensorGAN/cGAN/main.py +++ b/tensorflow/TensorGAN/cGAN/main.py @@ -0,0 +1,16 @@ +import tensorflow as tf +import numpy as np + +import config +import net + +seed = 42 +np.random.seed(seed) +tf.set_random_seed(seed) + +def main(): + cgan = net.CGAN(config) + cgan.train() + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/tensorflow/TensorGAN/cGAN/net.py b/tensorflow/TensorGAN/cGAN/net.py index 6f7305f..5037422 100644 --- a/tensorflow/TensorGAN/cGAN/net.py +++ b/tensorflow/TensorGAN/cGAN/net.py @@ -1 +1,124 @@ import tensorflow as tf +from tensorflow.examples.tutorials.mnist import input_data +import os +import matplotlib.pyplot as plt +import numpy as np + +import config +import util + +mnist = input_data.read_data_sets(config.mnist_path, one_hot=True) +x_dim = mnist.train.images.shape[1] +y_dim = mnist.train.labels.shape[1] + +def xavier_init(size): + in_dim = size[0] + xavier_stddev = 1. / tf.sqrt(in_dim / 2.) + return tf.random_normal(shape=size, stddev=xavier_stddev) + +def log(x): + ''' + Sometimes discriminator outputs can reach values close to (or even slightly less than) zero due to numerical rounding. + This just make sure that we exclude those values so that we don't up with NaNs during optimization + ''' + return tf.log(tf.maximum(x, 1e-5)) + +with tf.variable_scope('D'): + D_W1 = tf.Variable(xavier_init([x_dim + y_dim, config.hidden_dim])) + D_b1 = tf.Variable(tf.zeros(shape=[1])) + + D_W2 = tf.Variable(xavier_init([config.hidden_dim, 1])) + D_b2 = tf.Variable(tf.zeros(shape=[1])) + +def discriminator(x, y): + # Concatenate x and y + inputs = tf.concat(axis=1, values=[x, y]) + + D_h1 = tf.nn.relu(tf.matmul(inputs, D_W1) + D_b1) + D_logit = tf.matmul(D_h1, D_W2) + D_b2 + D_prob = tf.nn.sigmoid(D_logit) + + return D_prob, D_logit + +with tf.variable_scope('G'): + G_W1 = tf.Variable(xavier_init([config.input_dim + y_dim, config.hidden_dim])) + G_b1 = tf.Variable(tf.zeros(shape=[config.hidden_dim])) + + G_W2 = tf.Variable(xavier_init([config.hidden_dim, x_dim])) + G_b2 = tf.Variable(tf.zeros(shape=[x_dim])) + +def generator(z, y): + # COncatenate z and y + inputs = tf.concat(axis=1, values=[z, y]) + + G_h1 = tf.nn.relu(tf.matmul(inputs, G_W1) + G_b1) + G_log_prob = tf.matmul(G_h1, G_W2) + G_b2 + G_prob = tf.nn.sigmoid(G_log_prob) + + return G_prob + +def sample_Z(m, n): + return np.random.uniform(-1., 1., size=[m, n]) + +class CGAN(object): + def __init__(self, config): + self.config = config + + self.x = tf.placeholder(tf.float32, shape=[None, 784]) + self.y = tf.placeholder(tf.float32, shape=[None, y_dim]) + self.z = tf.placeholder(tf.float32, shape=[None, config.input_dim]) + + self.G_sample = generator(self.z, self.y) + + self.D_real, self.D_logit_real = discriminator(self.x, self.y) + self.D_fake, self.D_logit_fake = discriminator(self.G_sample, self.y) + + self.D_loss_real = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=self.D_logit_real, labels=tf.ones_like(self.D_logit_real))) + self.D_loss_fake = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=self.D_logit_fake, labels=tf.zeros_like(self.D_logit_fake))) + self.D_loss = self.D_loss_real + self.D_loss_fake + self.G_loss = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=self.D_logit_fake, labels=tf.ones_like(self.D_logit_fake))) + + vars = tf.trainable_variables() + self.d_params = [v for v in vars if v.name.startswith('D/')] + self.g_params = [v for v in vars if v.name.startswith('G/')] + + self.D_solver = tf.train.AdamOptimizer().minimize(self.D_loss, var_list=self.d_params) + self.G_solver = tf.train.AdamOptimizer().minimize(self.G_loss, var_list=self.g_params) + + def train(self): + with tf.Session() as sess: + + sess.run(tf.global_variables_initializer()) + + if not os.path.exists('./out/'): + os.makedirs('./out/') + + save_index = 0 + + for iter in range(100000): + + batch_x, batch_y = mnist.train.next_batch(config.batch_size) + batch_z = sample_Z(config.batch_size, config.input_dim) + + _, D_loss_cur = sess.run([self.D_solver, self.D_loss], feed_dict={self.x: batch_x, self.z: batch_z, self.y: batch_y}) + _, G_loss_cur = sess.run([self.G_solver, self.G_loss], feed_dict={self.z: batch_z, self.y: batch_y}) + + if iter % 1000 == 0: + print("iter: ", iter) + print("D_loss: ", D_loss_cur) + print("G_loss: ", G_loss_cur) + + samples_num = 16 + + z_sample = sample_Z(samples_num, config.input_dim) + y_sample = np.zeros(shape=[samples_num, y_dim]) + y_sample[:, 7] = 1 + + samples = sess.run(self.G_sample, feed_dict={self.z: z_sample, self.y: y_sample}) + + fig = util.plot(samples) + save_filename = './out/' + str(save_index).zfill(3) + save_index += 1 + plt.savefig(save_filename, bbox_inches='tight') + plt.close() + \ No newline at end of file diff --git a/tensorflow/TensorGAN/cGAN/out/000.png b/tensorflow/TensorGAN/cGAN/out/000.png new file mode 100644 index 0000000..f5fda1b Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/000.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/001.png b/tensorflow/TensorGAN/cGAN/out/001.png new file mode 100644 index 0000000..0471768 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/001.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/002.png b/tensorflow/TensorGAN/cGAN/out/002.png new file mode 100644 index 0000000..4a99850 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/002.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/003.png b/tensorflow/TensorGAN/cGAN/out/003.png new file mode 100644 index 0000000..2bf3648 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/003.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/004.png b/tensorflow/TensorGAN/cGAN/out/004.png new file mode 100644 index 0000000..42a7be6 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/004.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/005.png b/tensorflow/TensorGAN/cGAN/out/005.png new file mode 100644 index 0000000..af107a6 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/005.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/006.png b/tensorflow/TensorGAN/cGAN/out/006.png new file mode 100644 index 0000000..8551192 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/006.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/007.png b/tensorflow/TensorGAN/cGAN/out/007.png new file mode 100644 index 0000000..eefcfd7 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/007.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/008.png b/tensorflow/TensorGAN/cGAN/out/008.png new file mode 100644 index 0000000..ab9108e Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/008.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/009.png b/tensorflow/TensorGAN/cGAN/out/009.png new file mode 100644 index 0000000..cb7a894 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/009.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/010.png b/tensorflow/TensorGAN/cGAN/out/010.png new file mode 100644 index 0000000..1ea3fbb Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/010.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/011.png b/tensorflow/TensorGAN/cGAN/out/011.png new file mode 100644 index 0000000..500d5ee Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/011.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/012.png b/tensorflow/TensorGAN/cGAN/out/012.png new file mode 100644 index 0000000..b4dfa4e Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/012.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/013.png b/tensorflow/TensorGAN/cGAN/out/013.png new file mode 100644 index 0000000..24d6e0c Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/013.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/014.png b/tensorflow/TensorGAN/cGAN/out/014.png new file mode 100644 index 0000000..694b6bf Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/014.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/015.png b/tensorflow/TensorGAN/cGAN/out/015.png new file mode 100644 index 0000000..90df92c Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/015.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/016.png b/tensorflow/TensorGAN/cGAN/out/016.png new file mode 100644 index 0000000..f438ecc Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/016.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/017.png b/tensorflow/TensorGAN/cGAN/out/017.png new file mode 100644 index 0000000..ca5ffc1 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/017.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/018.png b/tensorflow/TensorGAN/cGAN/out/018.png new file mode 100644 index 0000000..d200f11 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/018.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/019.png b/tensorflow/TensorGAN/cGAN/out/019.png new file mode 100644 index 0000000..82ae65e Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/019.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/020.png b/tensorflow/TensorGAN/cGAN/out/020.png new file mode 100644 index 0000000..ab47eb0 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/020.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/021.png b/tensorflow/TensorGAN/cGAN/out/021.png new file mode 100644 index 0000000..6f95aed Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/021.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/022.png b/tensorflow/TensorGAN/cGAN/out/022.png new file mode 100644 index 0000000..99403c2 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/022.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/023.png b/tensorflow/TensorGAN/cGAN/out/023.png new file mode 100644 index 0000000..60e846d Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/023.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/024.png b/tensorflow/TensorGAN/cGAN/out/024.png new file mode 100644 index 0000000..d18ed5d Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/024.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/025.png b/tensorflow/TensorGAN/cGAN/out/025.png new file mode 100644 index 0000000..d79a2fa Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/025.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/026.png b/tensorflow/TensorGAN/cGAN/out/026.png new file mode 100644 index 0000000..2fab50f Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/026.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/027.png b/tensorflow/TensorGAN/cGAN/out/027.png new file mode 100644 index 0000000..4fb6ff2 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/027.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/028.png b/tensorflow/TensorGAN/cGAN/out/028.png new file mode 100644 index 0000000..2b9b476 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/028.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/029.png b/tensorflow/TensorGAN/cGAN/out/029.png new file mode 100644 index 0000000..a132941 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/029.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/030.png b/tensorflow/TensorGAN/cGAN/out/030.png new file mode 100644 index 0000000..794bde0 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/030.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/031.png b/tensorflow/TensorGAN/cGAN/out/031.png new file mode 100644 index 0000000..7381689 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/031.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/032.png b/tensorflow/TensorGAN/cGAN/out/032.png new file mode 100644 index 0000000..04cb5be Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/032.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/033.png b/tensorflow/TensorGAN/cGAN/out/033.png new file mode 100644 index 0000000..373770b Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/033.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/034.png b/tensorflow/TensorGAN/cGAN/out/034.png new file mode 100644 index 0000000..f984b67 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/034.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/035.png b/tensorflow/TensorGAN/cGAN/out/035.png new file mode 100644 index 0000000..44e1b4b Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/035.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/036.png b/tensorflow/TensorGAN/cGAN/out/036.png new file mode 100644 index 0000000..1d42853 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/036.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/037.png b/tensorflow/TensorGAN/cGAN/out/037.png new file mode 100644 index 0000000..9b1d960 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/037.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/038.png b/tensorflow/TensorGAN/cGAN/out/038.png new file mode 100644 index 0000000..1ff8ef8 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/038.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/039.png b/tensorflow/TensorGAN/cGAN/out/039.png new file mode 100644 index 0000000..5422c21 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/039.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/040.png b/tensorflow/TensorGAN/cGAN/out/040.png new file mode 100644 index 0000000..e7e4da1 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/040.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/041.png b/tensorflow/TensorGAN/cGAN/out/041.png new file mode 100644 index 0000000..99f403b Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/041.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/042.png b/tensorflow/TensorGAN/cGAN/out/042.png new file mode 100644 index 0000000..506b1e6 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/042.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/043.png b/tensorflow/TensorGAN/cGAN/out/043.png new file mode 100644 index 0000000..5fe74e5 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/043.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/044.png b/tensorflow/TensorGAN/cGAN/out/044.png new file mode 100644 index 0000000..eb2e00e Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/044.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/045.png b/tensorflow/TensorGAN/cGAN/out/045.png new file mode 100644 index 0000000..96bb2ae Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/045.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/046.png b/tensorflow/TensorGAN/cGAN/out/046.png new file mode 100644 index 0000000..269e944 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/046.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/047.png b/tensorflow/TensorGAN/cGAN/out/047.png new file mode 100644 index 0000000..de79de3 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/047.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/048.png b/tensorflow/TensorGAN/cGAN/out/048.png new file mode 100644 index 0000000..97af295 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/048.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/049.png b/tensorflow/TensorGAN/cGAN/out/049.png new file mode 100644 index 0000000..134c75b Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/049.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/050.png b/tensorflow/TensorGAN/cGAN/out/050.png new file mode 100644 index 0000000..42ae86a Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/050.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/051.png b/tensorflow/TensorGAN/cGAN/out/051.png new file mode 100644 index 0000000..d7042d4 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/051.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/052.png b/tensorflow/TensorGAN/cGAN/out/052.png new file mode 100644 index 0000000..e15091a Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/052.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/053.png b/tensorflow/TensorGAN/cGAN/out/053.png new file mode 100644 index 0000000..4512579 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/053.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/054.png b/tensorflow/TensorGAN/cGAN/out/054.png new file mode 100644 index 0000000..01f2f5f Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/054.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/055.png b/tensorflow/TensorGAN/cGAN/out/055.png new file mode 100644 index 0000000..a8f3878 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/055.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/056.png b/tensorflow/TensorGAN/cGAN/out/056.png new file mode 100644 index 0000000..e6c312f Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/056.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/057.png b/tensorflow/TensorGAN/cGAN/out/057.png new file mode 100644 index 0000000..25c304f Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/057.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/058.png b/tensorflow/TensorGAN/cGAN/out/058.png new file mode 100644 index 0000000..01e1a05 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/058.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/059.png b/tensorflow/TensorGAN/cGAN/out/059.png new file mode 100644 index 0000000..3d2d958 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/059.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/060.png b/tensorflow/TensorGAN/cGAN/out/060.png new file mode 100644 index 0000000..12e90a1 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/060.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/061.png b/tensorflow/TensorGAN/cGAN/out/061.png new file mode 100644 index 0000000..009f44d Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/061.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/062.png b/tensorflow/TensorGAN/cGAN/out/062.png new file mode 100644 index 0000000..18a1e28 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/062.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/063.png b/tensorflow/TensorGAN/cGAN/out/063.png new file mode 100644 index 0000000..19a33c5 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/063.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/064.png b/tensorflow/TensorGAN/cGAN/out/064.png new file mode 100644 index 0000000..2ccd0b9 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/064.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/065.png b/tensorflow/TensorGAN/cGAN/out/065.png new file mode 100644 index 0000000..18a1b3f Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/065.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/066.png b/tensorflow/TensorGAN/cGAN/out/066.png new file mode 100644 index 0000000..cbf6347 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/066.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/067.png b/tensorflow/TensorGAN/cGAN/out/067.png new file mode 100644 index 0000000..2612179 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/067.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/068.png b/tensorflow/TensorGAN/cGAN/out/068.png new file mode 100644 index 0000000..61d4d8b Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/068.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/069.png b/tensorflow/TensorGAN/cGAN/out/069.png new file mode 100644 index 0000000..5911dfe Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/069.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/070.png b/tensorflow/TensorGAN/cGAN/out/070.png new file mode 100644 index 0000000..b96d4a0 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/070.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/071.png b/tensorflow/TensorGAN/cGAN/out/071.png new file mode 100644 index 0000000..abaab20 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/071.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/072.png b/tensorflow/TensorGAN/cGAN/out/072.png new file mode 100644 index 0000000..699a305 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/072.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/073.png b/tensorflow/TensorGAN/cGAN/out/073.png new file mode 100644 index 0000000..0de99b5 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/073.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/074.png b/tensorflow/TensorGAN/cGAN/out/074.png new file mode 100644 index 0000000..41adae6 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/074.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/075.png b/tensorflow/TensorGAN/cGAN/out/075.png new file mode 100644 index 0000000..bab8005 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/075.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/076.png b/tensorflow/TensorGAN/cGAN/out/076.png new file mode 100644 index 0000000..fa945de Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/076.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/077.png b/tensorflow/TensorGAN/cGAN/out/077.png new file mode 100644 index 0000000..418a080 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/077.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/078.png b/tensorflow/TensorGAN/cGAN/out/078.png new file mode 100644 index 0000000..aef8ab3 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/078.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/079.png b/tensorflow/TensorGAN/cGAN/out/079.png new file mode 100644 index 0000000..76dca62 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/079.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/080.png b/tensorflow/TensorGAN/cGAN/out/080.png new file mode 100644 index 0000000..41b162b Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/080.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/081.png b/tensorflow/TensorGAN/cGAN/out/081.png new file mode 100644 index 0000000..93a282f Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/081.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/082.png b/tensorflow/TensorGAN/cGAN/out/082.png new file mode 100644 index 0000000..83edd1b Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/082.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/083.png b/tensorflow/TensorGAN/cGAN/out/083.png new file mode 100644 index 0000000..32023ea Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/083.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/084.png b/tensorflow/TensorGAN/cGAN/out/084.png new file mode 100644 index 0000000..5540f7d Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/084.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/085.png b/tensorflow/TensorGAN/cGAN/out/085.png new file mode 100644 index 0000000..333b0e2 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/085.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/086.png b/tensorflow/TensorGAN/cGAN/out/086.png new file mode 100644 index 0000000..64ae35d Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/086.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/087.png b/tensorflow/TensorGAN/cGAN/out/087.png new file mode 100644 index 0000000..0e899b2 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/087.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/088.png b/tensorflow/TensorGAN/cGAN/out/088.png new file mode 100644 index 0000000..4607cf9 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/088.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/089.png b/tensorflow/TensorGAN/cGAN/out/089.png new file mode 100644 index 0000000..24778f7 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/089.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/090.png b/tensorflow/TensorGAN/cGAN/out/090.png new file mode 100644 index 0000000..4d86561 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/090.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/091.png b/tensorflow/TensorGAN/cGAN/out/091.png new file mode 100644 index 0000000..0db9567 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/091.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/092.png b/tensorflow/TensorGAN/cGAN/out/092.png new file mode 100644 index 0000000..a33a9d7 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/092.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/093.png b/tensorflow/TensorGAN/cGAN/out/093.png new file mode 100644 index 0000000..3ff6a6f Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/093.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/094.png b/tensorflow/TensorGAN/cGAN/out/094.png new file mode 100644 index 0000000..981f490 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/094.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/095.png b/tensorflow/TensorGAN/cGAN/out/095.png new file mode 100644 index 0000000..e1d7d1b Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/095.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/096.png b/tensorflow/TensorGAN/cGAN/out/096.png new file mode 100644 index 0000000..49d64e2 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/096.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/097.png b/tensorflow/TensorGAN/cGAN/out/097.png new file mode 100644 index 0000000..b9e2102 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/097.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/098.png b/tensorflow/TensorGAN/cGAN/out/098.png new file mode 100644 index 0000000..2fd5500 Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/098.png differ diff --git a/tensorflow/TensorGAN/cGAN/out/099.png b/tensorflow/TensorGAN/cGAN/out/099.png new file mode 100644 index 0000000..67f6c2c Binary files /dev/null and b/tensorflow/TensorGAN/cGAN/out/099.png differ diff --git a/tensorflow/TensorGAN/cGAN/util.py b/tensorflow/TensorGAN/cGAN/util.py index e69de29..276c211 100644 --- a/tensorflow/TensorGAN/cGAN/util.py +++ b/tensorflow/TensorGAN/cGAN/util.py @@ -0,0 +1,20 @@ +import matplotlib.pyplot as plt +import matplotlib.gridspec as gridspec + +def plot(samples): + + plt.switch_backend('agg') + + fig = plt.figure(figsize=(4, 4)) + gs = gridspec.GridSpec(4, 4) + gs.update(wspace=0.05, hspace=0.05) + + for i, sample in enumerate(samples): + ax = plt.subplot(gs[i]) + plt.axis('off') + ax.set_xticklabels([]) + ax.set_yticklabels([]) + ax.set_aspect('equal') + plt.imshow(sample.reshape(28, 28), cmap='Greys_r') + + return fig \ No newline at end of file