In the last lecture we saw that we were not able to achieve high valuation accuracy due to overheating
in this lecture in this lecture.
We will apply different image processing to avoid or what fitting and we will also introduce a global
player in our model architecture.
An inmates pre processing we will apply shearing rotation worship height shift and zoom to create dummy
data from over or is no later now shearing.
Looks like this.
So if this is our OR is no limit shearing means we are pulling any one ad off our photo and converting
a squid and do a rhombus rotation means rotating the image which shift means we are shifting of our
whole image left or right.
Height shift means we are shifting our whole image up or down and zooming means we are zooming in at
any particular section of our image.
Now it is very easy to randomly apply all these features to over images.
Again we will be using image that.
The data will flow from that screen.
So we will be using flow from that incremental.
And here we are reading the data we are reading the data from our train directory.
The target size of the images we want is 150 by 150.
And this time we want images in the bed size of potato.
Earlier we were using bed size of 20.
Now we are using bed size of 32
and the class more is binary.
Since we have two classes and images of this glasses are in separate facilities in our train directory.
Now this is the code to convert our image data in to 10 sets.
Now using image data generator we can apply pre processing here.
So earlier we were only using reskilling to reskill our TV values from 0 to 255.
2 0 2 1.
Now we can use rotation range parameter Does the parameter to give rotation ranges.
So here my image can rotate from minus 40 to 40 degree for each image the image data generator will
automatically randomly choose a value between minus 40 to 40 and applied that rotation to the OR is
no limit.
Similarly we are using of words shift Granger point to point to means we are allowing image data generator
to shift our images left to right by 20 percent of the total.
Similarly we are using hide shift grains of zero point two percent.
This means 20 percent of total height.
We are allowing Mr the generator to shift now.
Note that the this.
We are not seeing that applied 20 percent off heights to every image.
We are just mentioning the upper limit.
So immense data generator will randomly choose a number which means zero and zero point two and apply
that which shift or hardship to over ordinal images.
Similarly we are using this sheer range of zero point to a zoom range of zero point two and horizontal
flip.
Equally good crew horizontal flip just means the mirror image along the vertical axis so right now.
If this is our original image the camera is pointing towards right horizontal flip means the mirror
image of this image along this axis.
So the camera will point to the left
so the code is very similar to last thing.
We are creating green underscored data as an object.
In which we are mentioning all this parameters and in this train underscore data and the data is flowing
from directory.
And here we are mentioning the green directory grain size bed size and plus more.
Now we will be creaming our model on only on the training dataset so there is no need to apply all this
transformation on the validation site
therefore when we are creating test data then we are just re scaling our data.
We are not applying all this transformations to our data.
So if we execute this code we will be creating who doesn't read us first to the train and that's code
generator.
And second is that validation underscore gender data in validation.
We are using test data and we are not applying any of these transformations so this are the sample of
images that will be generated by our train data generator.
So here you can see that all these three images are from a single original image so you can see that
there is a horizontal flip here between these two images.
So in the false image the cat is pointing towards left in the second element.
The cat is pointing towards the right.
There is some weird shift as well in this two images in the third element you can see that there is
some percentage of shear applied to the image.
And some Zoom is also there.