Generating CIFAR-10 images using a Keras GAN
While the network architecture remains for the most part unchanged I felt it necessary to show you an example that uses color images, as well as providing the example in Git, so that you had some place to start if you wanted to apply a GAN to your own data.
The CIFAR-10
is a famous dataset comprised of 60,000 32 x 32 x 3 RGB color images, distributed across 10 categories. Those categories are airplanes, cars, birds, cats, deer, dogs, frogs, horses, ships, and trucks. Hopefully, when you see the generated images later, you might see something that you can imagine looks like those objects.
Loading CIFAR-10
Loading the dataset is almost exactly the same, as Keras also provides a loader for CIFAR-10
, using the following code:
from keras.datasets import cifar10 def load_data(): (X_train, y_train), (X_test, y_test) = cifar10.load_data() X_train = (X_train.astype(np.float32) - 127.5) / 127.5 return X_train
Building the generator
The generator needs to produce...