INTRODUCTION:
To be very precise and clear, if you have 100 images in a dataset. You want to train your model but 100 is a very less number for a model to train and provide accurate results.
So, it would be great if you don't have to manually collect more images or download them more from the internet to increase the size of your dataset.
What if you can convert those 100 images into 500 or more images and increase your dataset size multiple times. This process is known as Image data augmentation.
If you have worked on a real-time dataset or created your own dataset, you might have faced a problem of different and multiple images. Either we get tired of collecting images from different angles or we feel lazy as always.
So, in these short lines of code, you can create a dataset of a huge amount of images. The source code is provided at the bottom. I have taken an image of my helmet for reference. You can take any image which you want.
Yes -> Congratulations, you are on your way to becoming a data scientist soon.
No -> Alright, it is the right time to start practicing it.
I have some projects for you to start your journey in data science and machine learning.
Also, if you don't have any/much knowledge about algorithms used in data science and machine learning, then you must understand the most basic algorithms used in data science.
UNDERSTANDING MACHINE LEARNING ALGORITHMS
Now let's get started with the code without wasting much any of your time.
We will use Tensorflow(more specifically Keras), a very powerful library in Python to make our code very easy.
In the below part of code, libraries are simply imported.
After importing the libraries, we will immediately instantiate(call) the required libraries and methods and try to get our work finished in no time.
This is the most important line of the project. In the above line of code, the ImageDataGenerator method of the preprocessing library of Keras is being called. It takes a number of parameters depending upon the requirement of the user.
- width_shift_range
- height_shift_range
- shear_range
- zoom_range
- rotation_range
- horizontal_flip, vertical_flip
Now, if you have followed it till here you might be wondering that would it be possible to use two or more augmentations at the same time. It is possible to do it.
1 Comments
Cool
ReplyDeleteThank You!