O'Reilly logo

Deep Learning By Example by Ahmed Menshawy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Training the model

Now, it's time to train the model and see how the generator will be able to fool, to some extent, the discriminator, by generating images very close to the original CelebA dataset.

But first, let's define a helper function that will display some generated images by the generator:

# define a function to visualize some generated images from the generatordef show_generator_output(sess, num_images, input_latent_z, output_channel_dim, img_mode):    cmap = None if img_mode == 'RGB' else 'gray'    latent_space_z_dim = input_latent_z.get_shape().as_list()[-1]    examples_z = np.random.uniform(-1, 1, size=[num_images, latent_space_z_dim])    examples = sess.run(        generator(input_latent_z, output_channel_dim, False),        feed_dict={input_latent_z: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required