Skip to Content
Hands-On Convolutional Neural Networks with TensorFlow
book

Hands-On Convolutional Neural Networks with TensorFlow

by Iffat Zafar, Giounona Tzanidou, Richard Burton, Nimesh Patel, Leonardo Araujo
August 2018
Intermediate to advanced
272 pages
7h 2m
English
Packt Publishing
Content preview from Hands-On Convolutional Neural Networks with TensorFlow

Training the GAN

So now that we have a generator, a discriminator, and our loss function, all that is left is to train! We will give a sketch idea of how to do this in TensorFlow, because there is nothing fancy in this part; it is just piecing together the stuff from the previous section, along with loading and feeding MNIST images, as we did earlier.

First, set up two solvers: one for the discriminator and one for the generator. A smaller value of beta1 for the AdamOptimizer is used as it has been shown to help GAN train to converge:

discriminator_solver = tf.train.AdamOptimizer(learning_rate=0.001, beta1=0.5)generator_solver = tf.train.AdamOptimizer(learning_rate=0.001, beta1=0.5)

Next, create a random noise vector; this can be done with ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Computer Vision Using Deep Learning: Neural Network Architectures with Python and Keras

Computer Vision Using Deep Learning: Neural Network Architectures with Python and Keras

Vaibhav Verdhan

Publisher Resources

ISBN: 9781789130331Supplemental Content