π±Introduction
π€‘ Concepts of Image Augmentation Technique
π₯ Basics of Image Augmentation which is a technique to avoid overfitting
β When we have got a small dataset we are able to manipluate the dataset without changing the underlying images to open up whole scenarios for training and to be able to train by variuos techniques of image augmentation
Note: Image augmentation is needed for both training and test set π
π© Basic Concept of Image Augmentation
π©βπ« The concept is very simple though:
If we have limited data, then the chances of you having data to match potential future predictions is also limited, and logically, the less data we have, the less chance we have of getting accurate predictions for data that our model hasn't yet seen.
π If we are training a model to spot cats, and our model has never seen what a cat looks like when lying down, it might not recognize that in future.
Augmentation simply amends our images on-the-fly while training using transforms like rotation.
So, it could 'simulate' an image of a cat lying down by rotating a 'standing' cat by 90 degrees.
As such we get a cheap β¨ way of extending our dataset beyond what we have already.
π Note: Doing image augmentation in runtime is preferred rather than to do it on memory to keep original data as it is π€
π€ΈββοΈ Image Augmentation Techniques
β
Mirroring
Flipping the image horizontally
π Example
β Random Cropping
Picking an image and taking random crops
π Example
π¨ Color Shifting
Adding and subtracting some values from color channels
π Example
π Shearing Transformation
Shear transformation slants the shape of the image
π Example
π©βπ» Code Example
The following code is used to do image augmentation
Parameter
Description
rescale
Rescaling images, NNs work better with normalized data so we rescale images so values are between 0,1
rotation_range
A value in degrees (0β180), a range within which to randomly rotate pictures
Height and width shifting
Randomly shifts pictures vertically or horizontally
shear_range
Randomly applying shearing transformations
zoom_range
Randomly zooming inside pictures
horizontal_flip
Randomly flipping half of the images horizontally
fill_mode
A strategy used for filling in newly created pixels, which can appear after a rotation or a width/height shift.
Full code example is here πΎ π
π§ References
Last updated