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

The discriminator

The first thing we need is to create our discriminator network. For this, we stack several fully connected layers together. The discriminator takes as input a batch of 784 length vectors, which is our 28x28 MNIST images flattened. The output will be just a single number for each image, which is the score of how confident the discriminator is with regard to that image being a real image. We use Leaky ReLu as the activation function to prevent ReLu units from dying out.

We return raw logits, as the loss function will apply the sigmoid activation function for us to ensure that our discriminator output is between 0 and 1:

def discriminator(x):     with tf.variable_scope("discriminator"): fc1 = tf.layers.dense(inputs=x, units=256, ...
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