First, here are the imports to set things up:
import tensorflow as tfimport numpy as npfrom tensorflow.keras.datasets import cifar10from tensorflow.keras.preprocessing.image import ImageDataGeneratorfrom tensorflow.keras.models import Sequentialfrom tensorflow.keras.layers import Dense, Dropout, Activation, Flattenfrom tensorflow.keras.layers import Conv2D, MaxPooling2D,BatchNormalizationfrom tensorflow.keras import regularizersfrom tensorflow.keras.models import load_modelimport osfrom matplotlib import pyplot as pltfrom PIL import Image
You may need to run pip install PIL.
Next, we have a set of values that we will use throughout the rest of the code:
batch_size = 32number_of_classes = 10epochs = 100 # for testing; use epochs ...