1. Learn
  2. /
  3. Courses
  4. /
  5. Deep Learning for Images with PyTorch

Connected

Exercise

Generating images

Now that you have designed and trained your GAN, it's time to evaluate the quality of the images it can generate. For a start, you will perform a visual inspection to see if the generation resemble the Pokemons at all. To do this, you will create random noise as input for the generator, pass it to the model and plot the outputs.

The Deep Convolutional Generator with trained weights is available to you as gen. torch and matplotlib.pyplot as plt are already imported for you.

Instructions

100 XP
  • Create a random noise tensor of shape num_images_to_generate by 16, the input noise size you used to train the generator, and assign it to noise.
  • Generate images by passing the noise to the generator and assign them to fake.
  • Inside the for loop, slice fake to extract the i-th image and assign it to image_tensor.
  • Permute image_tensor's dimensions from (color, height, width) to (hight, width, color) and assign the output to image_tensor_permuted.