history = model.fit(X_train, Y_train, batch_size=batch_size,
validation_data=(X_test, Y_test), nb_epoch=nb_epoch)
else:
print("Using real time data augmentation")
// This will do preprocessing and realtime data augmentation
datagen = ImageDataGenerator(
featurewise_center=False, // set input mean to 0 over the dataset
After Change
// Whether to apply global contrast normalization and ZCA whitening
gcn = True
zca = True
traingen = ImageDataGenerator(rescale=1./255, featurewise_center=gcn,
featurewise_std_normalization=gcn,
zca_whitening=zca, horizontal_flip=True,
rotation_range=10, width_shift_range=0.1,
height_shift_range=0.1)
// Compute quantities required for featurewise normalization
// (std, mean, and principal components if ZCA whitening is applied)
traingen.fit(X_train/255.)
trainflow = traingen.flow(X_train, Y_train, batch_size=batch_size)
testgen = ImageDataGenerator(rescale=1./255, featurewise_center=gcn,
featurewise_std_normalization=gcn,
zca_whitening=zca)
testgen.fit(X_test/255.)
testflow = testgen.flow(X_test, Y_test, batch_size=batch_size)