I'm working on facial expression recognition using Keras, the dataset I'm using does not have a big amount of data available, So I'm going to use Keras's image preprocessing for data augmentation.
I want to know the best parameters of ImageDataGenerator to generate normal faces wich I can use to train my neural network with.
Here's the code I'm using for Data augmentation :
def data_augmentation(subdir):
datagen = ImageDataGenerator(
featurewise_center=False,
samplewise_center=False,
featurewise_std_normalization=False,
samplewise_std_normalization=False,
zca_whitening=False,
rotation_range=30,
width_shift_range=0.2,
height_shift_range=0.2,
horizontal_flip=True,
vertical_flip=False)
print ("\nData augmentation...")
print ("\nProcess...")
for file in glob.glob(subdir+"*/*.jpg"):
img = load_img(file)
print ("\nProcessing..." + str(file))
x = img_to_array(img)
x = x.reshape((1,) + x.shape)
i = 0
for batch in datagen.flow(x, batch_size=1, save_to_dir='data_aug', save_prefix='Fig', save_format='jpg'):
i += 1
if i > 20:
break
Here's all ImageDataGenerator's parameters
keras.preprocessing.image.ImageDataGenerator(featurewise_center=False,
samplewise_center=False,
featurewise_std_normalization=False,
samplewise_std_normalization=False,
zca_whitening=False,
zca_epsilon=1e-6,
rotation_range=0.,
width_shift_range=0.,
height_shift_range=0.,
shear_range=0.,
zoom_range=0.,
channel_shift_range=0.,
fill_mode='nearest',
cval=0.,
horizontal_flip=False,
vertical_flip=False,
rescale=None,
preprocessing_function=None,
data_format=K.image_data_format())
And here's an example of images generated using my code :
As you can see, the images are distorted and not good enough to train my network.
I want to know what's the best parameters of ImageDataGenerator for human faces or is there any better methods for data augmentation ?



