Original article was published on Deep Learning on Medium
Image augmentation techniques
Preparing datasets is not easy task, especially when you are looking for datasets that are not available online, so you need to collect them from here and there.
Deep learning requires a large datasets, for images datasets they usually contain thousands of Images, there are a lot of images datasets available online for example Google Image datasets .
What if we couldn’t find enough images for our dataset ?
Now we use some techniques called Data Augmentation
This technique take the image and apply change the angle, brightness and zoom
Here we will apply some of these techniques with codes so let’s start:
1- import the required libraries that we will need for augmentation:
2- load the image that we want to use:
3- Horizontal flip: here we flip the image horizontally
4- vertical flip: here we flip the image vertically
5- Rotate image: here we rotate images in different angles
6- change the Brightness of the image:
7- Zoom in the image:
These was some techniques to make your image dataset larger
we are NOT finished yet
here is a full code to load a whole dataset and apply some of these techniques:
1- import the libraries
2- Load the image dataset using this function:
3- define the functions for augmentations:
4- Then finally we create the loop to apply the augmentations on all of the dataset’s images and save them
Now we are done, using this article you can expand your dataset size and make your model more accurate.