Of course, the best way to learn is by doing, so let's jump in and start coding our first GAN. In this example, we will be building the basic DCGAN and then modifying it later for our purposes. Open up Chapter_3_2.py and follow these steps:
This code was originally pulled from https://github.com/eriklindernoren/Keras-GAN, which is the best representation of GANs in Keras anywhere, and is all thanks to Erik Linder-Norén. Great job, and thanks for the hard work, Erik.
An alternate listing a vanilla GAN has been added as Chapter_3_1.py for your learning pleasure.
An alternate listing a vanilla GAN has been added as Chapter_3_1.py for your learning pleasure.
- We start by importing libraries:
from __future__ import print_function, division
from keras.datasets import mnist
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D
from keras.layers.advanced_activations import...