July 2019
Intermediate to advanced
512 pages
19h 39m
English
We just learned how CGAN works and the architecture of CGAN. To strengthen our understanding, now we will learn how to implement CGAN in TensorFlow for generating an image of specific handwritten digit, say digit 7.
First, Load the required libraries:
import warningswarnings.filterwarnings('ignore')import numpy as npimport tensorflow as tffrom tensorflow.examples.tutorials.mnist import input_datatf.logging.set_verbosity(tf.logging.ERROR)tf.reset_default_graph()import matplotlib.pyplot as plt%matplotlib inlinefrom IPython import display
Load the MNIST dataset:
data = input_data.read_data_sets("data/mnist",one_hot=True)
Read now
Unlock full access