Data Augmentation in DL Neural Networks
DL neural networks often see improved efficiency with the increase of available data. Data augmentation is a technique employed to artificially generate new training data, crafted from pre-existing datasets. This method involves the use of domain-specific techniques to manipulate training data into unique, fresh training samples.
Image Data Augmentation
Image data augmentation is the most recognized form of data augmentation, where images from the dataset are transformed into modified versions. Such transformations involve zooming, flipping, shifting, and other image editing techniques. The main aim is to supplement the training set with extra, plausible instances. This typically involves alterations to the dataset images that the model might encounter. Consequently, it's clear that the precise data augmentation approaches used for training must be thoughtfully selected, with the dataset and understanding of the problem domain in consideration.
Testing and Training with Augmented Data
A modest local data system and training run could be employed to test the data augmentation techniques alone or combined, in order to assess their impact on model performance. Current DL algorithms, like CNN, can learn features irrespective of their location in an image. However, augmentation can aid this transform invariant learning process by helping the model understand transform invariant features. Image data augmentation is typically applied only to the training dataset and not on testing datasets. Data preparation, including image resizing and pixel scaling, differs in that it needs to be uniformly done across all data interfacing the model.
Using Keras for Data Augmentation
In the context of model training, the Keras deep learning package allows automatic usage of data augmentation. This is achieved through the ImageDataGenerator class. First, the class has to be created, and augmentation types must be defined using parameters given to the constructor method. The class supports various methods including image scaling techniques. The model doesn't use the dataset images directly, rather, it is provided with enhanced images. Since augmentations are randomly done, real images and their nearly identical versions can be generated and used during training. Both the validation and test data can be defined using a data generator. Another ImageDataGenerator instance is often used, which might resemble the pixel scaling configuration of the original instance used for training data but doesn't require data augmentation. This is because augmentation is chiefly used to artificially expand the training dataset to enhance model performance on an unenhanced dataset.
Common Data Augmentation Techniques
Data augmentation techniques used are horizontal and vertical flipping, random brightness adjustment, and random rotation. In flipping, the columns and rows of pixels are reversed, specified by a boolean horizontal or vertical flip option given to the ImageDataGenerator constructor. Random brightness augmentation either darkens or lightens image, or does both, in order to enhance brightness. This technique encourages model adaptation to different brightness conditions, achieved by giving a brightness range option to the ImageDataGenerator constructor that provides the min and max range as a float. This float represents a percentage for brightening calculation; values below 1.0 dim the image, more than 1.0 brightens it, with 1.0 having no effect. A rotation augmentation randomly rotates the image clockwise from 0 to 360 degrees. The rotation would likely rotate pixels out of the captured image, leaving blank image spaces that must be filled.