diff --git a/tensorflow/TensorGAN/GAN/net.py b/tensorflow/TensorGAN/GAN/net.py index 6896761..1d9445e 100644 --- a/tensorflow/TensorGAN/GAN/net.py +++ b/tensorflow/TensorGAN/GAN/net.py @@ -45,7 +45,7 @@ def optimizer(loss, var_list): def log(x): ''' - Sometimes discriminator outputs can reach vakyes close to (or even slightly less than) zero due to numerical rounding. + 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)) diff --git a/tensorflow/TensorGAN/GAN_MNIST/config.py b/tensorflow/TensorGAN/GAN_MNIST/config.py new file mode 100644 index 0000000..5be7829 --- /dev/null +++ b/tensorflow/TensorGAN/GAN_MNIST/config.py @@ -0,0 +1,5 @@ +# Data path +mnist_path = "../../datasets/MNIST_DATA/" +# Training hyper paramters +batch_size = 128 +input_dim = 100 \ No newline at end of file diff --git a/tensorflow/TensorGAN/GAN_MNIST/main.py b/tensorflow/TensorGAN/GAN_MNIST/main.py new file mode 100644 index 0000000..bdb95a0 --- /dev/null +++ b/tensorflow/TensorGAN/GAN_MNIST/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(): + gan = net.GAN(config) + gan.train() + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/tensorflow/TensorGAN/GAN_MNIST/net.py b/tensorflow/TensorGAN/GAN_MNIST/net.py new file mode 100644 index 0000000..46b6481 --- /dev/null +++ b/tensorflow/TensorGAN/GAN_MNIST/net.py @@ -0,0 +1,109 @@ +import tensorflow as tf +from tensorflow.examples.tutorials.mnist import input_data +import numpy as np +import matplotlib.pyplot as plt + +import config +import util + +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)) + +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) + +with tf.variable_scope('D'): + D_W1 = tf.Variable(xavier_init([784, 128])) + D_b1 = tf.Variable(tf.zeros(shape=[128])) + + D_W2 = tf.Variable(xavier_init([128, 1])) + D_b2 = tf.Variable(tf.zeros(shape=[1])) + +with tf.variable_scope('G'): + G_W1 = tf.Variable(xavier_init([100, 128])) + G_b1 = tf.Variable(tf.zeros(shape=[128])) + + G_W2 = tf.Variable(xavier_init([128, 784])) + G_b2 = tf.Variable(tf.zeros(shape=[784])) + +def sample_Z(m, n): + return np.random.uniform(-1., 1., size=[m, n]) + +def generator(z): + G_h1 = tf.nn.relu(tf.matmul(z, 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 discriminator(x): + D_h1 = tf.nn.relu(tf.matmul(x, 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 + +class GAN(object): + def __init__(self, config): + + self.config = config + + self.Z = tf.placeholder(tf.float32, shape=[None, 100]) + self.G_sample = generator(self.Z) + + self.X = tf.placeholder(tf.float32, shape=[None, 784]) + self.D_real, self.D_logit_real = discriminator(self.X) + self.D_fake, self.D_logit_fake = discriminator(self.G_sample) + + 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_loss = -tf.reduce_mean(log(self.D_real) + log(1.-self.D_fake)) + self.G_loss = -tf.reduce_mean(log(self.D_fake)) + + self.D_optim = tf.train.AdamOptimizer().minimize(self.D_loss, var_list=self.d_params) + self.G_optim = tf.train.AdamOptimizer().minimize(self.G_loss, var_list=self.g_params) + + def train(self): + + mnist = input_data.read_data_sets(self.config.mnist_path, one_hot=True) + batch_size = self.config.batch_size + input_dim = self.config.input_dim + + with tf.Session() as sess: + + sess.run(tf.global_variables_initializer()) + sess.run(tf.local_variables_initializer()) + + save_index = 0 + + for iter in range(100000): + + batch_X, _ = mnist.train.next_batch(batch_size) + batch_Z_1 = sample_Z(batch_size, input_dim) + batch_Z_2 = sample_Z(batch_size, input_dim) + + _, D_loss_curr = sess.run([self.D_optim, self.D_loss], feed_dict={self.X: batch_X, self.Z: batch_Z_1}) + _, G_loss_curr = sess.run([self.G_optim, self.G_loss], feed_dict={self.Z: batch_Z_2}) + + if iter % 1000 == 0: + print("iter", iter) + print("D Loss: ", D_loss_curr) + print("G Loss: ", G_loss_curr) + + test_Z = sample_Z(16, input_dim) + samples = sess.run(self.G_sample, feed_dict={self.Z: test_Z}) + + 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/GAN_MNIST/out/000.png b/tensorflow/TensorGAN/GAN_MNIST/out/000.png new file mode 100644 index 0000000..fe5f01f Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/000.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/001.png b/tensorflow/TensorGAN/GAN_MNIST/out/001.png new file mode 100644 index 0000000..8999b1a Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/001.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/002.png b/tensorflow/TensorGAN/GAN_MNIST/out/002.png new file mode 100644 index 0000000..00d641c Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/002.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/003.png b/tensorflow/TensorGAN/GAN_MNIST/out/003.png new file mode 100644 index 0000000..1844577 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/003.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/004.png b/tensorflow/TensorGAN/GAN_MNIST/out/004.png new file mode 100644 index 0000000..b6837a9 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/004.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/005.png b/tensorflow/TensorGAN/GAN_MNIST/out/005.png new file mode 100644 index 0000000..22ded75 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/005.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/006.png b/tensorflow/TensorGAN/GAN_MNIST/out/006.png new file mode 100644 index 0000000..b35b2a1 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/006.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/007.png b/tensorflow/TensorGAN/GAN_MNIST/out/007.png new file mode 100644 index 0000000..5ec75a8 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/007.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/008.png b/tensorflow/TensorGAN/GAN_MNIST/out/008.png new file mode 100644 index 0000000..87ccbc8 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/008.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/009.png b/tensorflow/TensorGAN/GAN_MNIST/out/009.png new file mode 100644 index 0000000..32d2647 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/009.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/010.png b/tensorflow/TensorGAN/GAN_MNIST/out/010.png new file mode 100644 index 0000000..4743c62 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/010.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/011.png b/tensorflow/TensorGAN/GAN_MNIST/out/011.png new file mode 100644 index 0000000..9d987ab Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/011.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/012.png b/tensorflow/TensorGAN/GAN_MNIST/out/012.png new file mode 100644 index 0000000..20c3b72 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/012.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/013.png b/tensorflow/TensorGAN/GAN_MNIST/out/013.png new file mode 100644 index 0000000..9c234da Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/013.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/014.png b/tensorflow/TensorGAN/GAN_MNIST/out/014.png new file mode 100644 index 0000000..c5866a2 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/014.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/015.png b/tensorflow/TensorGAN/GAN_MNIST/out/015.png new file mode 100644 index 0000000..dfb319c Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/015.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/016.png b/tensorflow/TensorGAN/GAN_MNIST/out/016.png new file mode 100644 index 0000000..4798cd3 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/016.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/017.png b/tensorflow/TensorGAN/GAN_MNIST/out/017.png new file mode 100644 index 0000000..bc8d6e0 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/017.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/018.png b/tensorflow/TensorGAN/GAN_MNIST/out/018.png new file mode 100644 index 0000000..b8293bb Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/018.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/019.png b/tensorflow/TensorGAN/GAN_MNIST/out/019.png new file mode 100644 index 0000000..9e7c60f Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/019.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/020.png b/tensorflow/TensorGAN/GAN_MNIST/out/020.png new file mode 100644 index 0000000..ddd036c Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/020.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/021.png b/tensorflow/TensorGAN/GAN_MNIST/out/021.png new file mode 100644 index 0000000..b9fe08e Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/021.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/022.png b/tensorflow/TensorGAN/GAN_MNIST/out/022.png new file mode 100644 index 0000000..7ceaf73 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/022.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/023.png b/tensorflow/TensorGAN/GAN_MNIST/out/023.png new file mode 100644 index 0000000..29def0f Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/023.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/024.png b/tensorflow/TensorGAN/GAN_MNIST/out/024.png new file mode 100644 index 0000000..8eb21b0 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/024.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/025.png b/tensorflow/TensorGAN/GAN_MNIST/out/025.png new file mode 100644 index 0000000..be77c4a Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/025.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/026.png b/tensorflow/TensorGAN/GAN_MNIST/out/026.png new file mode 100644 index 0000000..f382838 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/026.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/027.png b/tensorflow/TensorGAN/GAN_MNIST/out/027.png new file mode 100644 index 0000000..abf5993 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/027.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/028.png b/tensorflow/TensorGAN/GAN_MNIST/out/028.png new file mode 100644 index 0000000..f64eaa2 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/028.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/029.png b/tensorflow/TensorGAN/GAN_MNIST/out/029.png new file mode 100644 index 0000000..64e44be Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/029.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/030.png b/tensorflow/TensorGAN/GAN_MNIST/out/030.png new file mode 100644 index 0000000..f89294d Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/030.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/031.png b/tensorflow/TensorGAN/GAN_MNIST/out/031.png new file mode 100644 index 0000000..e12ca23 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/031.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/032.png b/tensorflow/TensorGAN/GAN_MNIST/out/032.png new file mode 100644 index 0000000..c6b9ca0 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/032.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/033.png b/tensorflow/TensorGAN/GAN_MNIST/out/033.png new file mode 100644 index 0000000..1adca44 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/033.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/034.png b/tensorflow/TensorGAN/GAN_MNIST/out/034.png new file mode 100644 index 0000000..82e5065 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/034.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/035.png b/tensorflow/TensorGAN/GAN_MNIST/out/035.png new file mode 100644 index 0000000..cebf2fe Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/035.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/036.png b/tensorflow/TensorGAN/GAN_MNIST/out/036.png new file mode 100644 index 0000000..a4dd277 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/036.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/037.png b/tensorflow/TensorGAN/GAN_MNIST/out/037.png new file mode 100644 index 0000000..b02025a Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/037.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/038.png b/tensorflow/TensorGAN/GAN_MNIST/out/038.png new file mode 100644 index 0000000..8333974 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/038.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/039.png b/tensorflow/TensorGAN/GAN_MNIST/out/039.png new file mode 100644 index 0000000..1fb8d9f Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/039.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/040.png b/tensorflow/TensorGAN/GAN_MNIST/out/040.png new file mode 100644 index 0000000..10eeaab Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/040.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/041.png b/tensorflow/TensorGAN/GAN_MNIST/out/041.png new file mode 100644 index 0000000..b8c893b Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/041.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/042.png b/tensorflow/TensorGAN/GAN_MNIST/out/042.png new file mode 100644 index 0000000..a7c7156 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/042.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/043.png b/tensorflow/TensorGAN/GAN_MNIST/out/043.png new file mode 100644 index 0000000..413328a Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/043.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/044.png b/tensorflow/TensorGAN/GAN_MNIST/out/044.png new file mode 100644 index 0000000..c9da9d4 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/044.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/045.png b/tensorflow/TensorGAN/GAN_MNIST/out/045.png new file mode 100644 index 0000000..1d28ddc Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/045.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/046.png b/tensorflow/TensorGAN/GAN_MNIST/out/046.png new file mode 100644 index 0000000..5dabf2d Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/046.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/047.png b/tensorflow/TensorGAN/GAN_MNIST/out/047.png new file mode 100644 index 0000000..4e600b0 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/047.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/048.png b/tensorflow/TensorGAN/GAN_MNIST/out/048.png new file mode 100644 index 0000000..8d88a33 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/048.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/049.png b/tensorflow/TensorGAN/GAN_MNIST/out/049.png new file mode 100644 index 0000000..ad6dca6 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/049.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/050.png b/tensorflow/TensorGAN/GAN_MNIST/out/050.png new file mode 100644 index 0000000..7aee52b Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/050.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/051.png b/tensorflow/TensorGAN/GAN_MNIST/out/051.png new file mode 100644 index 0000000..dac812c Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/051.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/052.png b/tensorflow/TensorGAN/GAN_MNIST/out/052.png new file mode 100644 index 0000000..e905254 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/052.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/053.png b/tensorflow/TensorGAN/GAN_MNIST/out/053.png new file mode 100644 index 0000000..e0fc2a5 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/053.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/054.png b/tensorflow/TensorGAN/GAN_MNIST/out/054.png new file mode 100644 index 0000000..28a272d Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/054.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/055.png b/tensorflow/TensorGAN/GAN_MNIST/out/055.png new file mode 100644 index 0000000..7d387cd Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/055.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/056.png b/tensorflow/TensorGAN/GAN_MNIST/out/056.png new file mode 100644 index 0000000..8924629 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/056.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/057.png b/tensorflow/TensorGAN/GAN_MNIST/out/057.png new file mode 100644 index 0000000..0cf788d Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/057.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/058.png b/tensorflow/TensorGAN/GAN_MNIST/out/058.png new file mode 100644 index 0000000..b4f603c Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/058.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/059.png b/tensorflow/TensorGAN/GAN_MNIST/out/059.png new file mode 100644 index 0000000..2323341 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/059.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/060.png b/tensorflow/TensorGAN/GAN_MNIST/out/060.png new file mode 100644 index 0000000..c6a96a5 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/060.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/061.png b/tensorflow/TensorGAN/GAN_MNIST/out/061.png new file mode 100644 index 0000000..22f7586 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/061.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/062.png b/tensorflow/TensorGAN/GAN_MNIST/out/062.png new file mode 100644 index 0000000..5cb6674 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/062.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/063.png b/tensorflow/TensorGAN/GAN_MNIST/out/063.png new file mode 100644 index 0000000..a8114f7 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/063.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/064.png b/tensorflow/TensorGAN/GAN_MNIST/out/064.png new file mode 100644 index 0000000..80680df Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/064.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/065.png b/tensorflow/TensorGAN/GAN_MNIST/out/065.png new file mode 100644 index 0000000..42e0841 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/065.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/066.png b/tensorflow/TensorGAN/GAN_MNIST/out/066.png new file mode 100644 index 0000000..5683a07 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/066.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/067.png b/tensorflow/TensorGAN/GAN_MNIST/out/067.png new file mode 100644 index 0000000..4a3635b Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/067.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/068.png b/tensorflow/TensorGAN/GAN_MNIST/out/068.png new file mode 100644 index 0000000..3d0d3ae Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/068.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/069.png b/tensorflow/TensorGAN/GAN_MNIST/out/069.png new file mode 100644 index 0000000..d48998e Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/069.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/070.png b/tensorflow/TensorGAN/GAN_MNIST/out/070.png new file mode 100644 index 0000000..5085958 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/070.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/071.png b/tensorflow/TensorGAN/GAN_MNIST/out/071.png new file mode 100644 index 0000000..b109c7d Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/071.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/072.png b/tensorflow/TensorGAN/GAN_MNIST/out/072.png new file mode 100644 index 0000000..465f422 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/072.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/073.png b/tensorflow/TensorGAN/GAN_MNIST/out/073.png new file mode 100644 index 0000000..d495922 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/073.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/074.png b/tensorflow/TensorGAN/GAN_MNIST/out/074.png new file mode 100644 index 0000000..c60b8ca Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/074.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/075.png b/tensorflow/TensorGAN/GAN_MNIST/out/075.png new file mode 100644 index 0000000..f4113f0 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/075.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/076.png b/tensorflow/TensorGAN/GAN_MNIST/out/076.png new file mode 100644 index 0000000..a5a2d10 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/076.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/077.png b/tensorflow/TensorGAN/GAN_MNIST/out/077.png new file mode 100644 index 0000000..a851cdb Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/077.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/078.png b/tensorflow/TensorGAN/GAN_MNIST/out/078.png new file mode 100644 index 0000000..6b64744 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/078.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/079.png b/tensorflow/TensorGAN/GAN_MNIST/out/079.png new file mode 100644 index 0000000..d50d47d Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/079.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/080.png b/tensorflow/TensorGAN/GAN_MNIST/out/080.png new file mode 100644 index 0000000..daed29b Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/080.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/081.png b/tensorflow/TensorGAN/GAN_MNIST/out/081.png new file mode 100644 index 0000000..bc60096 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/081.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/082.png b/tensorflow/TensorGAN/GAN_MNIST/out/082.png new file mode 100644 index 0000000..89405be Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/082.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/083.png b/tensorflow/TensorGAN/GAN_MNIST/out/083.png new file mode 100644 index 0000000..51b50cd Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/083.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/084.png b/tensorflow/TensorGAN/GAN_MNIST/out/084.png new file mode 100644 index 0000000..2287ac7 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/084.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/085.png b/tensorflow/TensorGAN/GAN_MNIST/out/085.png new file mode 100644 index 0000000..c193e6d Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/085.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/086.png b/tensorflow/TensorGAN/GAN_MNIST/out/086.png new file mode 100644 index 0000000..55b6065 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/086.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/087.png b/tensorflow/TensorGAN/GAN_MNIST/out/087.png new file mode 100644 index 0000000..098d117 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/087.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/088.png b/tensorflow/TensorGAN/GAN_MNIST/out/088.png new file mode 100644 index 0000000..9d1dd94 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/088.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/089.png b/tensorflow/TensorGAN/GAN_MNIST/out/089.png new file mode 100644 index 0000000..1456e72 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/089.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/090.png b/tensorflow/TensorGAN/GAN_MNIST/out/090.png new file mode 100644 index 0000000..5b10b20 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/090.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/091.png b/tensorflow/TensorGAN/GAN_MNIST/out/091.png new file mode 100644 index 0000000..fba6bd5 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/091.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/092.png b/tensorflow/TensorGAN/GAN_MNIST/out/092.png new file mode 100644 index 0000000..ed88a2e Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/092.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/093.png b/tensorflow/TensorGAN/GAN_MNIST/out/093.png new file mode 100644 index 0000000..6c79e8f Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/093.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/094.png b/tensorflow/TensorGAN/GAN_MNIST/out/094.png new file mode 100644 index 0000000..efd3512 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/094.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/095.png b/tensorflow/TensorGAN/GAN_MNIST/out/095.png new file mode 100644 index 0000000..2546e63 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/095.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/096.png b/tensorflow/TensorGAN/GAN_MNIST/out/096.png new file mode 100644 index 0000000..3d5e37b Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/096.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/097.png b/tensorflow/TensorGAN/GAN_MNIST/out/097.png new file mode 100644 index 0000000..2ef5301 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/097.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/098.png b/tensorflow/TensorGAN/GAN_MNIST/out/098.png new file mode 100644 index 0000000..a4d83e4 Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/098.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/out/099.png b/tensorflow/TensorGAN/GAN_MNIST/out/099.png new file mode 100644 index 0000000..c40c02c Binary files /dev/null and b/tensorflow/TensorGAN/GAN_MNIST/out/099.png differ diff --git a/tensorflow/TensorGAN/GAN_MNIST/util.py b/tensorflow/TensorGAN/GAN_MNIST/util.py new file mode 100644 index 0000000..276c211 --- /dev/null +++ b/tensorflow/TensorGAN/GAN_MNIST/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 diff --git a/tensorflow/TensorGAN/cGAN/net.py b/tensorflow/TensorGAN/cGAN/net.py new file mode 100644 index 0000000..c03f168 --- /dev/null +++ b/tensorflow/TensorGAN/cGAN/net.py @@ -0,0 +1,13 @@ +import tensorflow as tf + +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) + +# Disriminator Net + + +# Generator Net + +def gene \ No newline at end of file