Now that we’ve practiced using convolution layers to make a classifier, let’s use them for a GAN.

We’ll start with the code we developed for the CelebA GAN here.

The CelebA images are rectangular 217 by 178 pixels in size. To keep our convolutions simple, we’ll work with square 128 by 128 images. This means that we’ll need to crop the training images to this size.

Helper function

The following code is a helper function for cropping a numpy image array to a given size, with the crop centered on the supplied image.

Get hands-on with 1200+ tech skills courses.