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 generator

Now we create our generator network. The job of the generator is to take a vector of random noise as input and from this, produce an output image. For this example, we again use fully connected layers that will, at the end, produce an output of a 784 long vector that we can reshape to get our 28x28 image:

def generator(z):     with tf.variable_scope("generator"):         fc1 = tf.layers.dense(inputs=z, units=1024, activation=tf.nn.relu)         fc2 = tf.layers.dense(inputs=fc1, units=1024, activation=tf.nn.relu)         img = tf.layers.dense(inputs=fc2, units=784, activation=tf.nn.tanh)              return img

We use the tanh activation on the output to restrict generated images to be in the range -1 to 1.

Now that the models are defined, we can look at the loss functions ...

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