Deep Learning Models -- A collection of various deep learning architectures, models, and tips for TensorFlow and PyTorch in Jupyter Notebooks.

In [1]:
%load_ext watermark
%watermark -a 'Sebastian Raschka' -v -p tensorflow
Sebastian Raschka 

CPython 3.7.3
IPython 7.6.1

tensorflow 1.13.1

Model Zoo -- General Adversarial Networks

Implementation of General Adversarial Nets (GAN) where both the discriminator and generator are multi-layer perceptrons with one hidden layer only. In this example, the GAN generator was trained to generate MNIST images.

Uses

  • samples from a random normal distribution (range [-1, 1])
  • dropout
  • leaky relus
  • batch normalization [performs worse here]
  • separate batches for "fake" and "real" images (where the labels are 1 = real images, 0 = fake images)
  • MNIST images normalized to [-1, 1] range
  • generator with tanh output
In [2]:
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import pickle as pkl

tf.test.gpu_device_name()
Out[2]:
'/device:GPU:0'
In [3]:
### Abbreviatiuons
# dis_*: discriminator network
# gen_*: generator network

########################
### Helper functions
########################

def leaky_relu(x, alpha=0.0001):
    return tf.maximum(alpha * x, x)


########################
### DATASET
########################

mnist = input_data.read_data_sets('MNIST_data')


#########################
### SETTINGS
#########################

# Hyperparameters
learning_rate = 0.001
training_epochs = 100
batch_size = 64
dropout_rate = 0.5

# Other settings
print_interval = 200

# Architecture
dis_input_size = 784
gen_input_size = 100

dis_hidden_size = 128
gen_hidden_size = 128


#########################
### GRAPH DEFINITION
#########################

g = tf.Graph()
with g.as_default():
    
    # Placeholders for settings
    dropout = tf.placeholder(tf.float32, shape=None, name='dropout')
    is_training = tf.placeholder(tf.bool, shape=None, name='is_training')
    
    # Input data
    dis_x = tf.placeholder(tf.float32, shape=[None, dis_input_size], name='discriminator_input') 
    gen_x = tf.placeholder(tf.float32, [None, gen_input_size], name='generator_input')


    ##################
    # Generator Model
    ##################

    with tf.variable_scope('generator'):
        # linear -> ~~batch norm~~ -> leaky relu -> dropout -> tanh output
        gen_hidden = tf.layers.dense(inputs=gen_x, units=gen_hidden_size,
                                      activation=None)
        #gen_hidden = tf.layers.batch_normalization(gen_hidden, training=is_training)
        gen_hidden = leaky_relu(gen_hidden)
        gen_hidden = tf.layers.dropout(gen_hidden, rate=dropout_rate)
        gen_logits = tf.layers.dense(inputs=gen_hidden, units=dis_input_size, 
                                     activation=None)
        gen_out = tf.tanh(gen_logits, 'generator_output')


    ######################
    # Discriminator Model
    ######################
    
    def build_discriminator_graph(input_x, reuse=None):
        # linear -> ~~batch norm~~ -> leaky relu -> dropout -> sigmoid output
        with tf.variable_scope('discriminator', reuse=reuse):
            hidden = tf.layers.dense(inputs=input_x, units=dis_hidden_size, 
                                     activation=None)
            #hidden = tf.layers.batch_normalization(hidden, training=is_training)
            hidden = leaky_relu(hidden)
            hidden = tf.layers.dropout(hidden, rate=dropout_rate)
            logits = tf.layers.dense(inputs=hidden, units=1, activation=None)
            out = tf.sigmoid(logits)
        return logits, out    

    # Create a discriminator for real data and a discriminator for fake data
    dis_real_logits, dis_real_out = build_discriminator_graph(dis_x, reuse=False)
    dis_fake_logits, dis_fake_out = build_discriminator_graph(gen_out, reuse=True)


    #####################################
    # Generator and Discriminator Losses
    #####################################
    
    # Two discriminator cost components: loss on real data + loss on fake data
    # Real data has class label 1, fake data has class label 0
    dis_real_loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=dis_real_logits, 
                                                            labels=tf.ones_like(dis_real_logits))
    dis_fake_loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=dis_fake_logits, 
                                                            labels=tf.zeros_like(dis_fake_logits))
    dis_cost = tf.add(tf.reduce_mean(dis_fake_loss), 
                      tf.reduce_mean(dis_real_loss), 
                      name='discriminator_cost')
 
    # Generator cost: difference between dis. prediction and label "1" for real images
    gen_loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=dis_fake_logits,
                                                       labels=tf.ones_like(dis_fake_logits))
    gen_cost = tf.reduce_mean(gen_loss, name='generator_cost')
    
    
    #########################################
    # Generator and Discriminator Optimizers
    #########################################
      
    dis_optimizer = tf.train.AdamOptimizer(learning_rate)
    dis_train_vars = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='discriminator')
    dis_update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS, scope='discriminator')
    
    with tf.control_dependencies(dis_update_ops): # required to upd. batch_norm params
        dis_train = dis_optimizer.minimize(dis_cost, var_list=dis_train_vars,
                                           name='train_discriminator')
    
    gen_optimizer = tf.train.AdamOptimizer(learning_rate)
    gen_train_vars = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='generator')
    gen_update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS, scope='generator')
    
    with tf.control_dependencies(gen_update_ops): # required to upd. batch_norm params
        gen_train = gen_optimizer.minimize(gen_cost, var_list=gen_train_vars,
                                           name='train_generator')
    
    # Saver to save session for reuse
    saver = tf.train.Saver()
WARNING:tensorflow:From <ipython-input-3-5955a43821e7>:17: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use alternatives such as official/mnist/dataset.py from tensorflow/models.
WARNING:tensorflow:From /home/raschka/miniconda3/lib/python3.7/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:260: maybe_download (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Please write your own downloading logic.
WARNING:tensorflow:From /home/raschka/miniconda3/lib/python3.7/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:262: extract_images (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.data to implement this functionality.
Extracting MNIST_data/train-images-idx3-ubyte.gz
WARNING:tensorflow:From /home/raschka/miniconda3/lib/python3.7/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:267: extract_labels (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.data to implement this functionality.
Extracting MNIST_data/train-labels-idx1-ubyte.gz
Extracting MNIST_data/t10k-images-idx3-ubyte.gz
Extracting MNIST_data/t10k-labels-idx1-ubyte.gz
WARNING:tensorflow:From /home/raschka/miniconda3/lib/python3.7/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:290: DataSet.__init__ (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use alternatives such as official/mnist/dataset.py from tensorflow/models.
WARNING:tensorflow:From <ipython-input-3-5955a43821e7>:64: dense (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.dense instead.
WARNING:tensorflow:From /home/raschka/miniconda3/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From <ipython-input-3-5955a43821e7>:67: dropout (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.dropout instead.
In [4]:
##########################
### TRAINING & EVALUATION
##########################

with tf.Session(graph=g) as sess:
    sess.run(tf.global_variables_initializer())
    
    avg_costs = {'discriminator': [], 'generator': []}

    for epoch in range(training_epochs):
        dis_avg_cost, gen_avg_cost = 0., 0.
        total_batch = mnist.train.num_examples // batch_size

        for i in range(total_batch):
            
            batch_x, batch_y = mnist.train.next_batch(batch_size)
            batch_x = batch_x*2 - 1 # normalize
            batch_randsample = np.random.uniform(-1, 1, size=(batch_size, gen_input_size))
            
            # Train
            _, dc = sess.run(['train_discriminator', 'discriminator_cost:0'],
                             feed_dict={'discriminator_input:0': batch_x, 
                                        'generator_input:0': batch_randsample,
                                        'dropout:0': dropout_rate,
                                        'is_training:0': True})
            _, gc = sess.run(['train_generator', 'generator_cost:0'],
                             feed_dict={'generator_input:0': batch_randsample,
                                        'dropout:0': dropout_rate,
                                        'is_training:0': True})
            
            dis_avg_cost += dc
            gen_avg_cost += gc

            if not i % print_interval:
                print("Minibatch: %03d | Dis/Gen Cost:    %.3f/%.3f" % (i + 1, dc, gc))
                

        print("Epoch:     %03d | Dis/Gen AvgCost: %.3f/%.3f" % 
              (epoch + 1, dis_avg_cost / total_batch, gen_avg_cost / total_batch))
        
        avg_costs['discriminator'].append(dis_avg_cost / total_batch)
        avg_costs['generator'].append(gen_avg_cost / total_batch)
    
    
    saver.save(sess, save_path='./gan.ckpt')
Minibatch: 001 | Dis/Gen Cost:    1.499/0.801
Minibatch: 201 | Dis/Gen Cost:    0.053/3.507
Minibatch: 401 | Dis/Gen Cost:    0.081/2.734
Minibatch: 601 | Dis/Gen Cost:    0.034/4.557
Minibatch: 801 | Dis/Gen Cost:    0.039/4.194
Epoch:     001 | Dis/Gen AvgCost: 0.118/3.638
Minibatch: 001 | Dis/Gen Cost:    0.057/5.300
Minibatch: 201 | Dis/Gen Cost:    0.116/3.594
Minibatch: 401 | Dis/Gen Cost:    0.280/5.187
Minibatch: 601 | Dis/Gen Cost:    0.194/3.634
Minibatch: 801 | Dis/Gen Cost:    0.173/5.460
Epoch:     002 | Dis/Gen AvgCost: 0.210/5.091
Minibatch: 001 | Dis/Gen Cost:    0.045/7.738
Minibatch: 201 | Dis/Gen Cost:    0.407/6.936
Minibatch: 401 | Dis/Gen Cost:    1.025/7.490
Minibatch: 601 | Dis/Gen Cost:    1.244/5.377
Minibatch: 801 | Dis/Gen Cost:    0.383/8.268
Epoch:     003 | Dis/Gen AvgCost: 0.425/6.283
Minibatch: 001 | Dis/Gen Cost:    0.303/4.227
Minibatch: 201 | Dis/Gen Cost:    0.920/6.391
Minibatch: 401 | Dis/Gen Cost:    0.439/5.984
Minibatch: 601 | Dis/Gen Cost:    0.284/6.037
Minibatch: 801 | Dis/Gen Cost:    0.432/7.308
Epoch:     004 | Dis/Gen AvgCost: 0.666/5.462
Minibatch: 001 | Dis/Gen Cost:    0.412/6.210
Minibatch: 201 | Dis/Gen Cost:    1.066/2.377
Minibatch: 401 | Dis/Gen Cost:    0.142/4.366
Minibatch: 601 | Dis/Gen Cost:    0.242/2.430
Minibatch: 801 | Dis/Gen Cost:    0.605/4.105
Epoch:     005 | Dis/Gen AvgCost: 0.724/4.420
Minibatch: 001 | Dis/Gen Cost:    0.302/5.794
Minibatch: 201 | Dis/Gen Cost:    0.600/7.009
Minibatch: 401 | Dis/Gen Cost:    0.806/2.755
Minibatch: 601 | Dis/Gen Cost:    1.148/4.533
Minibatch: 801 | Dis/Gen Cost:    0.538/4.364
Epoch:     006 | Dis/Gen AvgCost: 1.041/4.112
Minibatch: 001 | Dis/Gen Cost:    1.779/2.379
Minibatch: 201 | Dis/Gen Cost:    0.946/2.030
Minibatch: 401 | Dis/Gen Cost:    3.150/2.253
Minibatch: 601 | Dis/Gen Cost:    0.933/5.070
Minibatch: 801 | Dis/Gen Cost:    0.324/4.628
Epoch:     007 | Dis/Gen AvgCost: 1.220/3.451
Minibatch: 001 | Dis/Gen Cost:    1.709/1.255
Minibatch: 201 | Dis/Gen Cost:    0.811/4.043
Minibatch: 401 | Dis/Gen Cost:    0.464/3.975
Minibatch: 601 | Dis/Gen Cost:    0.691/4.367
Minibatch: 801 | Dis/Gen Cost:    1.116/2.952
Epoch:     008 | Dis/Gen AvgCost: 0.897/3.234
Minibatch: 001 | Dis/Gen Cost:    1.047/2.900
Minibatch: 201 | Dis/Gen Cost:    1.718/2.889
Minibatch: 401 | Dis/Gen Cost:    1.200/4.795
Minibatch: 601 | Dis/Gen Cost:    1.769/2.707
Minibatch: 801 | Dis/Gen Cost:    2.332/2.182
Epoch:     009 | Dis/Gen AvgCost: 1.177/3.189
Minibatch: 001 | Dis/Gen Cost:    1.002/3.703
Minibatch: 201 | Dis/Gen Cost:    2.067/4.743
Minibatch: 401 | Dis/Gen Cost:    1.234/4.623
Minibatch: 601 | Dis/Gen Cost:    0.854/4.411
Minibatch: 801 | Dis/Gen Cost:    1.638/1.421
Epoch:     010 | Dis/Gen AvgCost: 1.291/3.432
Minibatch: 001 | Dis/Gen Cost:    1.629/2.710
Minibatch: 201 | Dis/Gen Cost:    1.308/3.971
Minibatch: 401 | Dis/Gen Cost:    2.249/3.359
Minibatch: 601 | Dis/Gen Cost:    1.885/1.676
Minibatch: 801 | Dis/Gen Cost:    1.319/2.525
Epoch:     011 | Dis/Gen AvgCost: 1.498/3.245
Minibatch: 001 | Dis/Gen Cost:    1.963/2.263
Minibatch: 201 | Dis/Gen Cost:    1.135/4.232
Minibatch: 401 | Dis/Gen Cost:    2.014/2.104
Minibatch: 601 | Dis/Gen Cost:    1.125/2.537
Minibatch: 801 | Dis/Gen Cost:    1.047/1.561
Epoch:     012 | Dis/Gen AvgCost: 1.442/2.569
Minibatch: 001 | Dis/Gen Cost:    1.365/2.689
Minibatch: 201 | Dis/Gen Cost:    0.843/2.897
Minibatch: 401 | Dis/Gen Cost:    1.164/2.392
Minibatch: 601 | Dis/Gen Cost:    1.075/2.963
Minibatch: 801 | Dis/Gen Cost:    1.559/3.283
Epoch:     013 | Dis/Gen AvgCost: 1.481/2.584
Minibatch: 001 | Dis/Gen Cost:    1.169/3.168
Minibatch: 201 | Dis/Gen Cost:    2.146/2.435
Minibatch: 401 | Dis/Gen Cost:    1.401/1.977
Minibatch: 601 | Dis/Gen Cost:    1.242/2.711
Minibatch: 801 | Dis/Gen Cost:    1.284/2.257
Epoch:     014 | Dis/Gen AvgCost: 1.482/2.315
Minibatch: 001 | Dis/Gen Cost:    1.039/2.691
Minibatch: 201 | Dis/Gen Cost:    1.347/2.808
Minibatch: 401 | Dis/Gen Cost:    1.038/2.143
Minibatch: 601 | Dis/Gen Cost:    0.918/2.080
Minibatch: 801 | Dis/Gen Cost:    0.539/4.845
Epoch:     015 | Dis/Gen AvgCost: 1.384/2.196
Minibatch: 001 | Dis/Gen Cost:    1.907/1.858
Minibatch: 201 | Dis/Gen Cost:    1.775/2.612
Minibatch: 401 | Dis/Gen Cost:    0.863/2.014
Minibatch: 601 | Dis/Gen Cost:    0.568/1.905
Minibatch: 801 | Dis/Gen Cost:    0.810/3.251
Epoch:     016 | Dis/Gen AvgCost: 1.094/2.179
Minibatch: 001 | Dis/Gen Cost:    0.740/2.500
Minibatch: 201 | Dis/Gen Cost:    0.782/2.762
Minibatch: 401 | Dis/Gen Cost:    1.272/2.372
Minibatch: 601 | Dis/Gen Cost:    0.761/2.366
Minibatch: 801 | Dis/Gen Cost:    2.352/1.841
Epoch:     017 | Dis/Gen AvgCost: 1.066/2.450
Minibatch: 001 | Dis/Gen Cost:    1.175/2.691
Minibatch: 201 | Dis/Gen Cost:    0.759/2.902
Minibatch: 401 | Dis/Gen Cost:    0.801/2.311
Minibatch: 601 | Dis/Gen Cost:    1.014/2.195
Minibatch: 801 | Dis/Gen Cost:    1.175/2.144
Epoch:     018 | Dis/Gen AvgCost: 1.100/2.185
Minibatch: 001 | Dis/Gen Cost:    0.812/1.680
Minibatch: 201 | Dis/Gen Cost:    2.677/1.964
Minibatch: 401 | Dis/Gen Cost:    0.624/2.512
Minibatch: 601 | Dis/Gen Cost:    0.981/1.890
Minibatch: 801 | Dis/Gen Cost:    1.459/1.721
Epoch:     019 | Dis/Gen AvgCost: 1.178/2.177
Minibatch: 001 | Dis/Gen Cost:    0.880/2.496
Minibatch: 201 | Dis/Gen Cost:    1.203/2.107
Minibatch: 401 | Dis/Gen Cost:    1.411/2.383
Minibatch: 601 | Dis/Gen Cost:    0.661/2.956
Minibatch: 801 | Dis/Gen Cost:    1.653/1.281
Epoch:     020 | Dis/Gen AvgCost: 1.077/2.120
Minibatch: 001 | Dis/Gen Cost:    1.325/1.552
Minibatch: 201 | Dis/Gen Cost:    1.511/1.762
Minibatch: 401 | Dis/Gen Cost:    0.545/2.786
Minibatch: 601 | Dis/Gen Cost:    0.981/2.327
Minibatch: 801 | Dis/Gen Cost:    1.124/2.572
Epoch:     021 | Dis/Gen AvgCost: 1.235/2.125
Minibatch: 001 | Dis/Gen Cost:    0.998/1.983
Minibatch: 201 | Dis/Gen Cost:    1.259/1.341
Minibatch: 401 | Dis/Gen Cost:    0.625/2.941
Minibatch: 601 | Dis/Gen Cost:    0.714/5.057
Minibatch: 801 | Dis/Gen Cost:    0.991/2.332
Epoch:     022 | Dis/Gen AvgCost: 1.146/2.147
Minibatch: 001 | Dis/Gen Cost:    0.708/2.030
Minibatch: 201 | Dis/Gen Cost:    1.056/2.033
Minibatch: 401 | Dis/Gen Cost:    1.246/2.583
Minibatch: 601 | Dis/Gen Cost:    1.637/2.728
Minibatch: 801 | Dis/Gen Cost:    1.832/1.761
Epoch:     023 | Dis/Gen AvgCost: 1.215/2.502
Minibatch: 001 | Dis/Gen Cost:    0.862/2.704
Minibatch: 201 | Dis/Gen Cost:    1.137/2.953
Minibatch: 401 | Dis/Gen Cost:    1.408/2.223
Minibatch: 601 | Dis/Gen Cost:    0.749/1.927
Minibatch: 801 | Dis/Gen Cost:    1.386/2.217
Epoch:     024 | Dis/Gen AvgCost: 1.118/2.367
Minibatch: 001 | Dis/Gen Cost:    0.772/3.150
Minibatch: 201 | Dis/Gen Cost:    0.754/2.970
Minibatch: 401 | Dis/Gen Cost:    1.812/2.498
Minibatch: 601 | Dis/Gen Cost:    1.302/1.448
Minibatch: 801 | Dis/Gen Cost:    1.737/1.535
Epoch:     025 | Dis/Gen AvgCost: 1.098/2.251
Minibatch: 001 | Dis/Gen Cost:    1.468/1.880
Minibatch: 201 | Dis/Gen Cost:    0.828/2.362
Minibatch: 401 | Dis/Gen Cost:    0.887/2.395
Minibatch: 601 | Dis/Gen Cost:    1.148/1.352
Minibatch: 801 | Dis/Gen Cost:    0.746/2.773
Epoch:     026 | Dis/Gen AvgCost: 1.171/1.918
Minibatch: 001 | Dis/Gen Cost:    0.932/1.585
Minibatch: 201 | Dis/Gen Cost:    1.097/1.633
Minibatch: 401 | Dis/Gen Cost:    1.325/1.310
Minibatch: 601 | Dis/Gen Cost:    0.965/1.691
Minibatch: 801 | Dis/Gen Cost:    1.335/2.311
Epoch:     027 | Dis/Gen AvgCost: 1.164/1.811
Minibatch: 001 | Dis/Gen Cost:    1.696/1.660
Minibatch: 201 | Dis/Gen Cost:    1.549/1.011
Minibatch: 401 | Dis/Gen Cost:    1.539/1.977
Minibatch: 601 | Dis/Gen Cost:    1.217/2.030
Minibatch: 801 | Dis/Gen Cost:    0.913/2.136
Epoch:     028 | Dis/Gen AvgCost: 1.130/1.810
Minibatch: 001 | Dis/Gen Cost:    1.261/1.633
Minibatch: 201 | Dis/Gen Cost:    1.625/1.646
Minibatch: 401 | Dis/Gen Cost:    1.237/1.713
Minibatch: 601 | Dis/Gen Cost:    0.907/2.767
Minibatch: 801 | Dis/Gen Cost:    0.920/2.089
Epoch:     029 | Dis/Gen AvgCost: 1.137/1.996
Minibatch: 001 | Dis/Gen Cost:    1.050/2.399
Minibatch: 201 | Dis/Gen Cost:    1.429/1.843
Minibatch: 401 | Dis/Gen Cost:    1.365/1.363
Minibatch: 601 | Dis/Gen Cost:    0.744/2.369
Minibatch: 801 | Dis/Gen Cost:    1.378/1.662
Epoch:     030 | Dis/Gen AvgCost: 1.196/1.989
Minibatch: 001 | Dis/Gen Cost:    0.772/2.210
Minibatch: 201 | Dis/Gen Cost:    1.081/1.819
Minibatch: 401 | Dis/Gen Cost:    1.405/2.020
Minibatch: 601 | Dis/Gen Cost:    0.874/2.064
Minibatch: 801 | Dis/Gen Cost:    1.140/1.534
Epoch:     031 | Dis/Gen AvgCost: 1.149/1.845
Minibatch: 001 | Dis/Gen Cost:    0.673/1.721
Minibatch: 201 | Dis/Gen Cost:    1.039/1.507
Minibatch: 401 | Dis/Gen Cost:    1.258/2.033
Minibatch: 601 | Dis/Gen Cost:    1.060/2.744
Minibatch: 801 | Dis/Gen Cost:    0.829/2.429
Epoch:     032 | Dis/Gen AvgCost: 1.160/1.769
Minibatch: 001 | Dis/Gen Cost:    1.357/1.201
Minibatch: 201 | Dis/Gen Cost:    1.426/1.726
Minibatch: 401 | Dis/Gen Cost:    0.856/1.783
Minibatch: 601 | Dis/Gen Cost:    0.924/2.410
Minibatch: 801 | Dis/Gen Cost:    1.203/1.522
Epoch:     033 | Dis/Gen AvgCost: 1.135/1.975
Minibatch: 001 | Dis/Gen Cost:    1.164/2.432
Minibatch: 201 | Dis/Gen Cost:    1.096/1.507
Minibatch: 401 | Dis/Gen Cost:    1.239/1.824
Minibatch: 601 | Dis/Gen Cost:    1.192/1.348
Minibatch: 801 | Dis/Gen Cost:    0.996/1.754
Epoch:     034 | Dis/Gen AvgCost: 1.208/1.829
Minibatch: 001 | Dis/Gen Cost:    1.242/1.672
Minibatch: 201 | Dis/Gen Cost:    1.113/1.508
Minibatch: 401 | Dis/Gen Cost:    1.252/1.732
Minibatch: 601 | Dis/Gen Cost:    1.451/1.694
Minibatch: 801 | Dis/Gen Cost:    2.160/1.091
Epoch:     035 | Dis/Gen AvgCost: 1.179/1.709
Minibatch: 001 | Dis/Gen Cost:    1.172/1.468
Minibatch: 201 | Dis/Gen Cost:    1.029/1.332
Minibatch: 401 | Dis/Gen Cost:    1.154/1.738
Minibatch: 601 | Dis/Gen Cost:    1.183/1.573
Minibatch: 801 | Dis/Gen Cost:    1.088/1.760
Epoch:     036 | Dis/Gen AvgCost: 1.124/1.631
Minibatch: 001 | Dis/Gen Cost:    1.012/1.819
Minibatch: 201 | Dis/Gen Cost:    0.637/2.376
Minibatch: 401 | Dis/Gen Cost:    1.122/1.738
Minibatch: 601 | Dis/Gen Cost:    1.197/1.748
Minibatch: 801 | Dis/Gen Cost:    1.577/1.326
Epoch:     037 | Dis/Gen AvgCost: 1.058/1.737
Minibatch: 001 | Dis/Gen Cost:    1.102/1.309
Minibatch: 201 | Dis/Gen Cost:    1.194/1.909
Minibatch: 401 | Dis/Gen Cost:    1.068/1.622
Minibatch: 601 | Dis/Gen Cost:    0.813/1.146
Minibatch: 801 | Dis/Gen Cost:    1.066/2.090
Epoch:     038 | Dis/Gen AvgCost: 1.063/1.702
Minibatch: 001 | Dis/Gen Cost:    0.746/2.406
Minibatch: 201 | Dis/Gen Cost:    1.053/2.018
Minibatch: 401 | Dis/Gen Cost:    1.828/1.306
Minibatch: 601 | Dis/Gen Cost:    1.176/1.687
Minibatch: 801 | Dis/Gen Cost:    0.936/1.637
Epoch:     039 | Dis/Gen AvgCost: 1.065/1.742
Minibatch: 001 | Dis/Gen Cost:    1.136/1.674
Minibatch: 201 | Dis/Gen Cost:    0.920/2.337
Minibatch: 401 | Dis/Gen Cost:    1.041/2.284
Minibatch: 601 | Dis/Gen Cost:    0.898/1.703
Minibatch: 801 | Dis/Gen Cost:    0.730/1.847
Epoch:     040 | Dis/Gen AvgCost: 1.019/1.705
Minibatch: 001 | Dis/Gen Cost:    1.108/1.857
Minibatch: 201 | Dis/Gen Cost:    0.910/2.276
Minibatch: 401 | Dis/Gen Cost:    0.847/1.606
Minibatch: 601 | Dis/Gen Cost:    0.893/1.573
Minibatch: 801 | Dis/Gen Cost:    1.135/1.412
Epoch:     041 | Dis/Gen AvgCost: 1.037/1.742
Minibatch: 001 | Dis/Gen Cost:    1.379/1.338
Minibatch: 201 | Dis/Gen Cost:    1.526/1.049
Minibatch: 401 | Dis/Gen Cost:    1.013/1.924
Minibatch: 601 | Dis/Gen Cost:    1.119/1.600
Minibatch: 801 | Dis/Gen Cost:    1.003/1.814
Epoch:     042 | Dis/Gen AvgCost: 1.031/1.794
Minibatch: 001 | Dis/Gen Cost:    1.030/2.025
Minibatch: 201 | Dis/Gen Cost:    0.877/1.875
Minibatch: 401 | Dis/Gen Cost:    0.921/1.640
Minibatch: 601 | Dis/Gen Cost:    0.965/1.603
Minibatch: 801 | Dis/Gen Cost:    0.909/1.645
Epoch:     043 | Dis/Gen AvgCost: 1.009/1.827
Minibatch: 001 | Dis/Gen Cost:    0.791/2.442
Minibatch: 201 | Dis/Gen Cost:    0.838/2.087
Minibatch: 401 | Dis/Gen Cost:    1.243/1.474
Minibatch: 601 | Dis/Gen Cost:    0.721/1.858
Minibatch: 801 | Dis/Gen Cost:    0.914/2.415
Epoch:     044 | Dis/Gen AvgCost: 0.958/1.946
Minibatch: 001 | Dis/Gen Cost:    0.702/2.619
Minibatch: 201 | Dis/Gen Cost:    0.992/1.902
Minibatch: 401 | Dis/Gen Cost:    1.179/1.937
Minibatch: 601 | Dis/Gen Cost:    0.678/2.214
Minibatch: 801 | Dis/Gen Cost:    1.052/1.813
Epoch:     045 | Dis/Gen AvgCost: 0.911/2.090
Minibatch: 001 | Dis/Gen Cost:    1.388/1.223
Minibatch: 201 | Dis/Gen Cost:    0.858/1.659
Minibatch: 401 | Dis/Gen Cost:    0.963/1.696
Minibatch: 601 | Dis/Gen Cost:    0.817/2.054
Minibatch: 801 | Dis/Gen Cost:    1.116/1.923
Epoch:     046 | Dis/Gen AvgCost: 0.922/1.994
Minibatch: 001 | Dis/Gen Cost:    1.074/1.816
Minibatch: 201 | Dis/Gen Cost:    1.057/1.903
Minibatch: 401 | Dis/Gen Cost:    0.974/2.285
Minibatch: 601 | Dis/Gen Cost:    0.958/1.663
Minibatch: 801 | Dis/Gen Cost:    0.720/2.033
Epoch:     047 | Dis/Gen AvgCost: 0.940/1.975
Minibatch: 001 | Dis/Gen Cost:    0.873/2.338
Minibatch: 201 | Dis/Gen Cost:    0.994/2.113
Minibatch: 401 | Dis/Gen Cost:    1.032/1.914
Minibatch: 601 | Dis/Gen Cost:    0.973/1.713
Minibatch: 801 | Dis/Gen Cost:    1.007/2.006
Epoch:     048 | Dis/Gen AvgCost: 0.929/1.995
Minibatch: 001 | Dis/Gen Cost:    0.796/2.331
Minibatch: 201 | Dis/Gen Cost:    0.867/2.452
Minibatch: 401 | Dis/Gen Cost:    0.850/2.010
Minibatch: 601 | Dis/Gen Cost:    0.631/1.922
Minibatch: 801 | Dis/Gen Cost:    0.972/1.750
Epoch:     049 | Dis/Gen AvgCost: 0.924/1.972
Minibatch: 001 | Dis/Gen Cost:    0.604/2.530
Minibatch: 201 | Dis/Gen Cost:    0.976/1.983
Minibatch: 401 | Dis/Gen Cost:    1.014/2.037
Minibatch: 601 | Dis/Gen Cost:    1.226/1.931
Minibatch: 801 | Dis/Gen Cost:    1.125/1.876
Epoch:     050 | Dis/Gen AvgCost: 0.902/1.979
Minibatch: 001 | Dis/Gen Cost:    0.854/1.767
Minibatch: 201 | Dis/Gen Cost:    0.925/1.759
Minibatch: 401 | Dis/Gen Cost:    0.840/2.344
Minibatch: 601 | Dis/Gen Cost:    0.774/2.354
Minibatch: 801 | Dis/Gen Cost:    1.070/1.733
Epoch:     051 | Dis/Gen AvgCost: 0.872/2.043
Minibatch: 001 | Dis/Gen Cost:    0.789/2.300
Minibatch: 201 | Dis/Gen Cost:    0.614/3.100
Minibatch: 401 | Dis/Gen Cost:    0.887/1.908
Minibatch: 601 | Dis/Gen Cost:    0.776/1.562
Minibatch: 801 | Dis/Gen Cost:    0.998/2.279
Epoch:     052 | Dis/Gen AvgCost: 0.903/2.070
Minibatch: 001 | Dis/Gen Cost:    0.802/2.421
Minibatch: 201 | Dis/Gen Cost:    0.952/2.056
Minibatch: 401 | Dis/Gen Cost:    0.675/2.499
Minibatch: 601 | Dis/Gen Cost:    0.792/2.306
Minibatch: 801 | Dis/Gen Cost:    1.190/1.979
Epoch:     053 | Dis/Gen AvgCost: 0.875/2.092
Minibatch: 001 | Dis/Gen Cost:    1.068/1.628
Minibatch: 201 | Dis/Gen Cost:    1.108/1.678
Minibatch: 401 | Dis/Gen Cost:    1.048/2.059
Minibatch: 601 | Dis/Gen Cost:    1.113/2.057
Minibatch: 801 | Dis/Gen Cost:    0.953/1.486
Epoch:     054 | Dis/Gen AvgCost: 0.866/2.063
Minibatch: 001 | Dis/Gen Cost:    1.089/1.407
Minibatch: 201 | Dis/Gen Cost:    0.832/2.120
Minibatch: 401 | Dis/Gen Cost:    1.001/1.995
Minibatch: 601 | Dis/Gen Cost:    0.921/1.745
Minibatch: 801 | Dis/Gen Cost:    0.989/2.212
Epoch:     055 | Dis/Gen AvgCost: 0.844/2.096
Minibatch: 001 | Dis/Gen Cost:    0.842/2.184
Minibatch: 201 | Dis/Gen Cost:    0.837/1.958
Minibatch: 401 | Dis/Gen Cost:    1.033/1.802
Minibatch: 601 | Dis/Gen Cost:    0.943/2.060
Minibatch: 801 | Dis/Gen Cost:    0.834/2.175
Epoch:     056 | Dis/Gen AvgCost: 0.862/2.101
Minibatch: 001 | Dis/Gen Cost:    0.922/2.310
Minibatch: 201 | Dis/Gen Cost:    1.073/2.040
Minibatch: 401 | Dis/Gen Cost:    0.853/1.952
Minibatch: 601 | Dis/Gen Cost:    0.904/1.947
Minibatch: 801 | Dis/Gen Cost:    0.944/2.081
Epoch:     057 | Dis/Gen AvgCost: 0.873/2.043
Minibatch: 001 | Dis/Gen Cost:    1.090/1.978
Minibatch: 201 | Dis/Gen Cost:    1.284/1.474
Minibatch: 401 | Dis/Gen Cost:    0.943/2.089
Minibatch: 601 | Dis/Gen Cost:    1.055/1.573
Minibatch: 801 | Dis/Gen Cost:    0.740/1.757
Epoch:     058 | Dis/Gen AvgCost: 0.900/2.020
Minibatch: 001 | Dis/Gen Cost:    0.818/2.143
Minibatch: 201 | Dis/Gen Cost:    0.729/2.164
Minibatch: 401 | Dis/Gen Cost:    0.920/1.911
Minibatch: 601 | Dis/Gen Cost:    0.912/2.173
Minibatch: 801 | Dis/Gen Cost:    0.871/1.367
Epoch:     059 | Dis/Gen AvgCost: 0.915/1.963
Minibatch: 001 | Dis/Gen Cost:    0.730/2.418
Minibatch: 201 | Dis/Gen Cost:    0.949/1.898
Minibatch: 401 | Dis/Gen Cost:    0.819/1.575
Minibatch: 601 | Dis/Gen Cost:    0.856/2.401
Minibatch: 801 | Dis/Gen Cost:    0.854/2.037
Epoch:     060 | Dis/Gen AvgCost: 0.893/2.009
Minibatch: 001 | Dis/Gen Cost:    0.781/2.354
Minibatch: 201 | Dis/Gen Cost:    1.172/1.546
Minibatch: 401 | Dis/Gen Cost:    0.879/1.791
Minibatch: 601 | Dis/Gen Cost:    0.812/1.771
Minibatch: 801 | Dis/Gen Cost:    0.884/1.892
Epoch:     061 | Dis/Gen AvgCost: 0.929/1.906
Minibatch: 001 | Dis/Gen Cost:    1.150/1.968
Minibatch: 201 | Dis/Gen Cost:    0.681/2.181
Minibatch: 401 | Dis/Gen Cost:    0.995/2.047
Minibatch: 601 | Dis/Gen Cost:    0.833/1.952
Minibatch: 801 | Dis/Gen Cost:    0.769/2.289
Epoch:     062 | Dis/Gen AvgCost: 0.928/1.944
Minibatch: 001 | Dis/Gen Cost:    1.160/2.092
Minibatch: 201 | Dis/Gen Cost:    0.723/2.487
Minibatch: 401 | Dis/Gen Cost:    1.002/1.868
Minibatch: 601 | Dis/Gen Cost:    0.917/1.817
Minibatch: 801 | Dis/Gen Cost:    0.848/2.062
Epoch:     063 | Dis/Gen AvgCost: 0.931/1.909
Minibatch: 001 | Dis/Gen Cost:    1.035/1.570
Minibatch: 201 | Dis/Gen Cost:    0.967/2.279
Minibatch: 401 | Dis/Gen Cost:    1.159/1.458
Minibatch: 601 | Dis/Gen Cost:    1.011/2.168
Minibatch: 801 | Dis/Gen Cost:    1.006/1.775
Epoch:     064 | Dis/Gen AvgCost: 0.913/1.966
Minibatch: 001 | Dis/Gen Cost:    0.911/2.114
Minibatch: 201 | Dis/Gen Cost:    0.566/2.601
Minibatch: 401 | Dis/Gen Cost:    1.130/2.184
Minibatch: 601 | Dis/Gen Cost:    0.849/1.832
Minibatch: 801 | Dis/Gen Cost:    1.059/1.766
Epoch:     065 | Dis/Gen AvgCost: 0.931/1.954
Minibatch: 001 | Dis/Gen Cost:    0.692/2.185
Minibatch: 201 | Dis/Gen Cost:    0.919/1.905
Minibatch: 401 | Dis/Gen Cost:    0.652/1.633
Minibatch: 601 | Dis/Gen Cost:    1.256/1.778
Minibatch: 801 | Dis/Gen Cost:    0.961/1.922
Epoch:     066 | Dis/Gen AvgCost: 0.922/1.911
Minibatch: 001 | Dis/Gen Cost:    0.684/1.942
Minibatch: 201 | Dis/Gen Cost:    0.848/2.016
Minibatch: 401 | Dis/Gen Cost:    0.831/1.920
Minibatch: 601 | Dis/Gen Cost:    0.752/2.258
Minibatch: 801 | Dis/Gen Cost:    1.119/1.636
Epoch:     067 | Dis/Gen AvgCost: 0.922/1.919
Minibatch: 001 | Dis/Gen Cost:    0.880/2.082
Minibatch: 201 | Dis/Gen Cost:    0.802/2.038
Minibatch: 401 | Dis/Gen Cost:    0.981/2.474
Minibatch: 601 | Dis/Gen Cost:    0.847/2.154
Minibatch: 801 | Dis/Gen Cost:    0.732/2.222
Epoch:     068 | Dis/Gen AvgCost: 0.925/1.963
Minibatch: 001 | Dis/Gen Cost:    0.917/1.813
Minibatch: 201 | Dis/Gen Cost:    0.839/2.056
Minibatch: 401 | Dis/Gen Cost:    0.894/1.528
Minibatch: 601 | Dis/Gen Cost:    0.893/2.075
Minibatch: 801 | Dis/Gen Cost:    1.144/1.701
Epoch:     069 | Dis/Gen AvgCost: 0.953/1.883
Minibatch: 001 | Dis/Gen Cost:    1.146/1.550
Minibatch: 201 | Dis/Gen Cost:    0.910/1.836
Minibatch: 401 | Dis/Gen Cost:    0.771/2.159
Minibatch: 601 | Dis/Gen Cost:    0.794/2.206
Minibatch: 801 | Dis/Gen Cost:    0.882/1.976
Epoch:     070 | Dis/Gen AvgCost: 0.946/1.862
Minibatch: 001 | Dis/Gen Cost:    1.024/2.227
Minibatch: 201 | Dis/Gen Cost:    0.701/2.145
Minibatch: 401 | Dis/Gen Cost:    1.103/1.465
Minibatch: 601 | Dis/Gen Cost:    1.293/1.638
Minibatch: 801 | Dis/Gen Cost:    0.744/2.072
Epoch:     071 | Dis/Gen AvgCost: 0.935/1.874
Minibatch: 001 | Dis/Gen Cost:    1.032/2.021
Minibatch: 201 | Dis/Gen Cost:    0.738/1.859
Minibatch: 401 | Dis/Gen Cost:    1.135/1.680
Minibatch: 601 | Dis/Gen Cost:    0.856/1.340
Minibatch: 801 | Dis/Gen Cost:    0.816/1.972
Epoch:     072 | Dis/Gen AvgCost: 0.952/1.893
Minibatch: 001 | Dis/Gen Cost:    1.001/1.478
Minibatch: 201 | Dis/Gen Cost:    1.411/1.265
Minibatch: 401 | Dis/Gen Cost:    0.930/2.295
Minibatch: 601 | Dis/Gen Cost:    1.105/1.378
Minibatch: 801 | Dis/Gen Cost:    0.925/1.804
Epoch:     073 | Dis/Gen AvgCost: 0.953/1.845
Minibatch: 001 | Dis/Gen Cost:    0.961/1.286
Minibatch: 201 | Dis/Gen Cost:    0.828/2.103
Minibatch: 401 | Dis/Gen Cost:    1.008/1.696
Minibatch: 601 | Dis/Gen Cost:    0.778/1.847
Minibatch: 801 | Dis/Gen Cost:    0.844/2.085
Epoch:     074 | Dis/Gen AvgCost: 0.982/1.797
Minibatch: 001 | Dis/Gen Cost:    0.905/1.921
Minibatch: 201 | Dis/Gen Cost:    0.754/1.991
Minibatch: 401 | Dis/Gen Cost:    1.016/1.657
Minibatch: 601 | Dis/Gen Cost:    0.972/1.795
Minibatch: 801 | Dis/Gen Cost:    1.148/1.830
Epoch:     075 | Dis/Gen AvgCost: 0.968/1.795
Minibatch: 001 | Dis/Gen Cost:    1.372/1.324
Minibatch: 201 | Dis/Gen Cost:    1.200/1.701
Minibatch: 401 | Dis/Gen Cost:    0.881/2.057
Minibatch: 601 | Dis/Gen Cost:    1.004/2.116
Minibatch: 801 | Dis/Gen Cost:    1.202/1.830
Epoch:     076 | Dis/Gen AvgCost: 0.991/1.795
Minibatch: 001 | Dis/Gen Cost:    1.057/1.560
Minibatch: 201 | Dis/Gen Cost:    1.003/1.761
Minibatch: 401 | Dis/Gen Cost:    0.955/1.610
Minibatch: 601 | Dis/Gen Cost:    1.095/1.392
Minibatch: 801 | Dis/Gen Cost:    1.100/1.507
Epoch:     077 | Dis/Gen AvgCost: 0.961/1.742
Minibatch: 001 | Dis/Gen Cost:    1.152/1.784
Minibatch: 201 | Dis/Gen Cost:    0.992/1.961
Minibatch: 401 | Dis/Gen Cost:    0.911/1.835
Minibatch: 601 | Dis/Gen Cost:    0.809/1.638
Minibatch: 801 | Dis/Gen Cost:    1.052/1.610
Epoch:     078 | Dis/Gen AvgCost: 0.984/1.756
Minibatch: 001 | Dis/Gen Cost:    0.858/1.878
Minibatch: 201 | Dis/Gen Cost:    0.876/1.748
Minibatch: 401 | Dis/Gen Cost:    0.924/1.538
Minibatch: 601 | Dis/Gen Cost:    0.838/1.521
Minibatch: 801 | Dis/Gen Cost:    0.865/2.007
Epoch:     079 | Dis/Gen AvgCost: 0.978/1.719
Minibatch: 001 | Dis/Gen Cost:    0.993/1.604
Minibatch: 201 | Dis/Gen Cost:    0.886/2.165
Minibatch: 401 | Dis/Gen Cost:    0.953/1.691
Minibatch: 601 | Dis/Gen Cost:    0.925/1.663
Minibatch: 801 | Dis/Gen Cost:    0.994/1.546
Epoch:     080 | Dis/Gen AvgCost: 0.980/1.753
Minibatch: 001 | Dis/Gen Cost:    0.925/1.650
Minibatch: 201 | Dis/Gen Cost:    1.015/1.703
Minibatch: 401 | Dis/Gen Cost:    0.915/1.581
Minibatch: 601 | Dis/Gen Cost:    0.873/1.733
Minibatch: 801 | Dis/Gen Cost:    1.039/1.695
Epoch:     081 | Dis/Gen AvgCost: 0.977/1.740
Minibatch: 001 | Dis/Gen Cost:    1.212/1.183
Minibatch: 201 | Dis/Gen Cost:    1.112/1.577
Minibatch: 401 | Dis/Gen Cost:    0.973/2.126
Minibatch: 601 | Dis/Gen Cost:    0.606/2.113
Minibatch: 801 | Dis/Gen Cost:    0.847/2.012
Epoch:     082 | Dis/Gen AvgCost: 0.967/1.758
Minibatch: 001 | Dis/Gen Cost:    0.772/1.764
Minibatch: 201 | Dis/Gen Cost:    0.671/1.990
Minibatch: 401 | Dis/Gen Cost:    0.844/1.877
Minibatch: 601 | Dis/Gen Cost:    0.853/2.527
Minibatch: 801 | Dis/Gen Cost:    0.964/1.633
Epoch:     083 | Dis/Gen AvgCost: 0.987/1.707
Minibatch: 001 | Dis/Gen Cost:    0.976/1.744
Minibatch: 201 | Dis/Gen Cost:    1.072/1.362
Minibatch: 401 | Dis/Gen Cost:    1.031/1.393
Minibatch: 601 | Dis/Gen Cost:    0.954/1.825
Minibatch: 801 | Dis/Gen Cost:    0.836/1.711
Epoch:     084 | Dis/Gen AvgCost: 0.980/1.743
Minibatch: 001 | Dis/Gen Cost:    0.921/1.526
Minibatch: 201 | Dis/Gen Cost:    0.926/1.544
Minibatch: 401 | Dis/Gen Cost:    1.243/1.350
Minibatch: 601 | Dis/Gen Cost:    0.898/2.016
Minibatch: 801 | Dis/Gen Cost:    1.004/1.656
Epoch:     085 | Dis/Gen AvgCost: 0.996/1.671
Minibatch: 001 | Dis/Gen Cost:    0.782/1.880
Minibatch: 201 | Dis/Gen Cost:    0.759/1.909
Minibatch: 401 | Dis/Gen Cost:    0.908/1.543
Minibatch: 601 | Dis/Gen Cost:    0.959/1.884
Minibatch: 801 | Dis/Gen Cost:    0.924/1.711
Epoch:     086 | Dis/Gen AvgCost: 0.976/1.688
Minibatch: 001 | Dis/Gen Cost:    0.863/1.577
Minibatch: 201 | Dis/Gen Cost:    0.695/1.784
Minibatch: 401 | Dis/Gen Cost:    1.120/1.191
Minibatch: 601 | Dis/Gen Cost:    0.973/1.373
Minibatch: 801 | Dis/Gen Cost:    0.790/1.858
Epoch:     087 | Dis/Gen AvgCost: 0.987/1.715
Minibatch: 001 | Dis/Gen Cost:    1.046/1.534
Minibatch: 201 | Dis/Gen Cost:    0.862/1.680
Minibatch: 401 | Dis/Gen Cost:    1.203/1.293
Minibatch: 601 | Dis/Gen Cost:    1.047/1.687
Minibatch: 801 | Dis/Gen Cost:    1.166/1.271
Epoch:     088 | Dis/Gen AvgCost: 0.998/1.668
Minibatch: 001 | Dis/Gen Cost:    0.939/1.627
Minibatch: 201 | Dis/Gen Cost:    1.006/1.552
Minibatch: 401 | Dis/Gen Cost:    1.000/2.030
Minibatch: 601 | Dis/Gen Cost:    0.967/1.653
Minibatch: 801 | Dis/Gen Cost:    1.079/1.452
Epoch:     089 | Dis/Gen AvgCost: 1.003/1.628
Minibatch: 001 | Dis/Gen Cost:    0.762/2.099
Minibatch: 201 | Dis/Gen Cost:    1.094/1.581
Minibatch: 401 | Dis/Gen Cost:    0.955/1.827
Minibatch: 601 | Dis/Gen Cost:    0.913/1.636
Minibatch: 801 | Dis/Gen Cost:    0.888/1.655
Epoch:     090 | Dis/Gen AvgCost: 1.009/1.615
Minibatch: 001 | Dis/Gen Cost:    1.039/1.598
Minibatch: 201 | Dis/Gen Cost:    1.073/1.546
Minibatch: 401 | Dis/Gen Cost:    1.064/1.819
Minibatch: 601 | Dis/Gen Cost:    1.318/1.673
Minibatch: 801 | Dis/Gen Cost:    1.236/1.260
Epoch:     091 | Dis/Gen AvgCost: 1.027/1.618
Minibatch: 001 | Dis/Gen Cost:    1.103/1.504
Minibatch: 201 | Dis/Gen Cost:    1.076/1.272
Minibatch: 401 | Dis/Gen Cost:    0.886/1.757
Minibatch: 601 | Dis/Gen Cost:    1.162/1.607
Minibatch: 801 | Dis/Gen Cost:    0.954/1.409
Epoch:     092 | Dis/Gen AvgCost: 1.022/1.609
Minibatch: 001 | Dis/Gen Cost:    0.949/1.956
Minibatch: 201 | Dis/Gen Cost:    0.998/1.719
Minibatch: 401 | Dis/Gen Cost:    0.899/1.689
Minibatch: 601 | Dis/Gen Cost:    0.970/1.853
Minibatch: 801 | Dis/Gen Cost:    0.832/1.923
Epoch:     093 | Dis/Gen AvgCost: 1.029/1.599
Minibatch: 001 | Dis/Gen Cost:    0.924/1.722
Minibatch: 201 | Dis/Gen Cost:    1.081/1.599
Minibatch: 401 | Dis/Gen Cost:    1.064/1.853
Minibatch: 601 | Dis/Gen Cost:    1.064/1.687
Minibatch: 801 | Dis/Gen Cost:    0.949/1.681
Epoch:     094 | Dis/Gen AvgCost: 1.014/1.623
Minibatch: 001 | Dis/Gen Cost:    1.184/1.398
Minibatch: 201 | Dis/Gen Cost:    1.253/1.560
Minibatch: 401 | Dis/Gen Cost:    1.275/1.165
Minibatch: 601 | Dis/Gen Cost:    0.997/1.793
Minibatch: 801 | Dis/Gen Cost:    0.782/1.754
Epoch:     095 | Dis/Gen AvgCost: 1.027/1.586
Minibatch: 001 | Dis/Gen Cost:    1.037/1.669
Minibatch: 201 | Dis/Gen Cost:    0.920/1.356
Minibatch: 401 | Dis/Gen Cost:    0.983/1.841
Minibatch: 601 | Dis/Gen Cost:    1.036/1.789
Minibatch: 801 | Dis/Gen Cost:    0.725/1.858
Epoch:     096 | Dis/Gen AvgCost: 1.032/1.619
Minibatch: 001 | Dis/Gen Cost:    0.962/1.652
Minibatch: 201 | Dis/Gen Cost:    1.470/1.198
Minibatch: 401 | Dis/Gen Cost:    1.111/1.698
Minibatch: 601 | Dis/Gen Cost:    0.994/1.527
Minibatch: 801 | Dis/Gen Cost:    1.331/1.572
Epoch:     097 | Dis/Gen AvgCost: 1.055/1.564
Minibatch: 001 | Dis/Gen Cost:    1.087/1.334
Minibatch: 201 | Dis/Gen Cost:    1.018/1.639
Minibatch: 401 | Dis/Gen Cost:    0.982/1.277
Minibatch: 601 | Dis/Gen Cost:    1.133/1.765
Minibatch: 801 | Dis/Gen Cost:    1.211/1.279
Epoch:     098 | Dis/Gen AvgCost: 1.059/1.494
Minibatch: 001 | Dis/Gen Cost:    0.973/1.580
Minibatch: 201 | Dis/Gen Cost:    0.833/1.588
Minibatch: 401 | Dis/Gen Cost:    1.061/1.590
Minibatch: 601 | Dis/Gen Cost:    0.899/1.743
Minibatch: 801 | Dis/Gen Cost:    0.928/2.045
Epoch:     099 | Dis/Gen AvgCost: 1.042/1.551
Minibatch: 001 | Dis/Gen Cost:    0.870/1.786
Minibatch: 201 | Dis/Gen Cost:    0.913/1.308
Minibatch: 401 | Dis/Gen Cost:    1.149/1.388
Minibatch: 601 | Dis/Gen Cost:    1.013/1.634
Minibatch: 801 | Dis/Gen Cost:    1.060/1.759
Epoch:     100 | Dis/Gen AvgCost: 1.038/1.577
In [5]:
%matplotlib inline
import matplotlib.pyplot as plt

plt.plot(range(len(avg_costs['discriminator'])), 
         avg_costs['discriminator'], label='discriminator')
plt.plot(range(len(avg_costs['generator'])),
         avg_costs['generator'], label='generator')
plt.legend()
plt.show()
In [6]:
####################################
### RELOAD & GENERATE SAMPLE IMAGES
####################################


n_examples = 25

with tf.Session(graph=g) as sess:
    saver.restore(sess, save_path='./gan.ckpt')

    batch_randsample = np.random.uniform(-1, 1, size=(n_examples, gen_input_size))
    new_examples = sess.run('generator/generator_output:0',
                            feed_dict={'generator_input:0': batch_randsample,
                                       'dropout:0': 0.0,
                                       'is_training:0': False})

fig, axes = plt.subplots(nrows=5, ncols=5, figsize=(8, 8),
                         sharey=True, sharex=True)

for image, ax in zip(new_examples, axes.flatten()):
    ax.imshow(image.reshape((dis_input_size // 28, dis_input_size // 28)), cmap='binary')

plt.show()
WARNING:tensorflow:From /home/raschka/miniconda3/lib/python3.7/site-packages/tensorflow/python/training/saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
INFO:tensorflow:Restoring parameters from ./gan.ckpt