Skip to content

Instantly share code, notes, and snippets.

@Kakarot-2000
Created May 3, 2021 05:57
Show Gist options
  • Save Kakarot-2000/56597eec3ee9e014e52139894093aac1 to your computer and use it in GitHub Desktop.
Save Kakarot-2000/56597eec3ee9e014e52139894093aac1 to your computer and use it in GitHub Desktop.
#data augmentation
x_train=x_train.reshape((x_train.shape[0],48,48,1))
x_test=x_test.reshape((x_test.shape[0],48,48,1))
from keras.preprocessing.image import ImageDataGenerator
train_datagen = ImageDataGenerator(rescale=1./255,
rotation_range=60,
shear_range=0.5,
zoom_range=0.5,
width_shift_range=0.5,
height_shift_range=0.5,
horizontal_flip=True,
fill_mode='nearest')
validation_datagen = ImageDataGenerator(rescale=1./255)
train_datagen.fit(x_train)
validation_datagen.fit(x_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment