How to do it...

  1. Let's start with importing all the libraries, as follows:
from keras.datasets import cifar10from keras.preprocessing.image import ImageDataGeneratorfrom keras.models import Sequentialfrom keras.layers import Dense, Dropout, Activation, Flattenfrom keras.layers import Conv2D, MaxPooling2Dfrom keras.optimizers import Adamfrom keras.callbacks import EarlyStopping, TensorBoard, ModelCheckpoint
  1. We will be using the cifar10 dataset for our experiments. We load and pre-process the data like this:
(X_train, y_train), (X_test, y_test) = cifar10.load_data()X_train = X_train.astype('float32')/255.X_test = X_test.astype('float32')/255.n_classes = 10y_train = keras.utils.to_categorical(y_train, n_classes)y_test = keras.utils.to_categorical(y_test, ...

Get Python Deep Learning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.