<p>You can also use random erasing so that the network learns more about some specific areas rather than just focusing on some specific parts of the face the entire time of training.</p>

<p>Paper for random erasing can be found at <a href="https://arxiv.org/abs/1708.04896" rel="nofollow noreferrer">https://arxiv.org/abs/1708.04896</a>
and its implementation can be found at <a href="https://github.com/yu4u/cutout-random-erasing" rel="nofollow noreferrer">https://github.com/yu4u/cutout-random-erasing</a>.</p>
Keras best Image Data Generator parameters for data augmentation
<p>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.</p>

<p>I want to know the best parameters of ImageDataGenerator to generate normal faces wich I can use to train my neural network with.</p>

<p>Here's the code I'm using for Data augmentation :</p>

<pre><code>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 &gt; 20:
                break
</code></pre>

<p>Here's all ImageDataGenerator's parameters</p>

<pre><code>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())
</code></pre>

<p>And here's an example of images generated using my code :</p>

<p><a href="https://i.stack.imgur.com/2Q8sF.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/2Q8sF.jpg" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/ijiqJ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/ijiqJ.jpg" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/3d3kv.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/3d3kv.jpg" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/wo42s.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/wo42s.jpg" alt="enter image description here"></a></p>

<p>As you can see, the images are distorted and not good enough to train my network.</p>

<p>I want to know what's the best parameters of ImageDataGenerator for human faces or is there any better methods for data augmentation ?</p>