Now, in this video, we are going to create artificial image data, which we are going to use as training
data to improve the performance of our model.
So the first step is same.
We need to create directory variables.
If you are continuing with the last project, these variables will already be created for you.
Since I have created a new project, I need to run these lines of code again to create directory variables.
Now, this is the point where we have difference between the last model and this model, this time in
the image data generator.
Instead of just having this rescale parameter, we are going to give a few more parameters.
The concept is image data generator is going to generate new images by rotating, shifting, sharing
or zooming the images that we already have in us.
So imagine that we have an image of a cat face image.
Data generator will create a new image from that face by rotating that at some particular angle.
We have given that range for that angle from zero to 40 degrees or shifting that face horizontally or
vertically by 20 percent.
Sheering the image sharing.
There was two translating different pixel roles, but different values.
So the bottom most rule of pixel will remain at its position and the top most will move horizontally
by some percentage.
So we have given a sheer range of, again, 20 percent, a zoom range of 20 percent.
Horizontal flip is also allowed.
So the image can be horizontally flipped and film mode suggest what is to be done with newly created
pixels.
For example, when we hear the end image, there will be some newly created pixels.
When we zoom out, there will be some newly created pixels.
What should be done with those pixels?
When we said phillimore to nearest, it means whatever is the nearest value of pixel in that actual
image.
That would be free throughout the newly created pixels.
So I'll go through this again.
Rotation means you can give a value between zero to 180 and it tells what is the range of rotation within
which the image will be randomly rotated.
Hi, Chip.
And we'd shift our ranges within which deep picture will be horizontally or vertically translated.
Shearing's is what shearing transformations luminance is for.
Zooming in or zooming out, horizontal flip is flipping the image horizontally, and Fillmore is used
for filling the newly created pixels, which will appear when we do a rotation or zoom in or shirting.
So when we give all these parameters, random values of all these parameters will be taken.
And a new image will be created from the old image.
That's underscored.
Now, this data gene function is really this will be used for generating data, for training and validation
for testing.
We do not need to do any such things.
We have our test set.
We just need to reskill the information in that using image data generator function, but only specifying
this.
But we drove reskilling by 255.
So we'd underscore the strange NATO function will be exactly same as last time.
Only difference will be the second parameter.
Instead of using the train gen that we created last time, we are going to use this data engine data.
Will have additional randomly generated images also.
So when this brain generator is giving images of bad taste today, to this time we distribute instead
of going deep.
So when this dream generator is giving images in batches of today to all of the images, will have something
changed from the original dataset.
So the original image will have a random mutations in all of these parameters.
And those 32 newly generated images will be sending class more is still binary.
Exactly.
Same thing is done for validation generated.
We run both of these lines of code.
Our model architecture, again, stays the same.
We have Ford Convolutional Lears for Max pulling levers in combination with each convolutional layer.
After that, we have a flattened layer which gives its output as input to our densely connected neural
network.
So we create this architecture.
You can see the model again if you want to.
Then we compile this model again with these same lost function, which is binary cross and Droopy Optimizer
is automats prop with a learning rate of 10 is about minus four.
And the metric we are going to monitor is accuracy.
This fit function is all the same.
So if you have noticed the only difference in this model than the previous model is here, the Rangin
has been replaced by dadaji and data.
Jane has more parameters instead of just one of rescaling with all the random values of these parameters
will have newly created images.
Those images will go in a batch of 32 and the steps, but epoch is still hundred.
So the thing is, last thing in each people, there were two thousand images using which the training
was being done this time.
Since we are generating 32 image bache, we will have 32 hundred images but epoch.
Now when we done this, it is again going to take a long time, but hopefully this will give us better
validation, accuracy.
Let's wait and watch.