‫In the last lecture, we saw that we were not able to achieve high validation accuracy due
‫to overfitting.
‫In this lecture.
‫In this lecture, we will apply different image pre processing to avoid over fitting, and we will also
‫introduce a dropout layer in our model architecture.
‫in image preprocessing.
‫We will apply sheering rotation.
‫Shift, height shift and zoom to create dummy data from our
‫original data
‫Now sheering looks like this.
‫So if this is our origional image sheering means.
‫We are pulling any 1 edge of our photo.
‫And converting a square into and do a rhombus rotation means rotating the image.
‫Which shift means we are shifting of a whole image?
‫Left or right?
‫Hide shift means we are shifting of wholly made 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 meat doesn't litter.
‫The data will flow from that ACRI.
‫So we will be using flow from Derek Cremator.
‫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 one 50 by one 50.
‫And this time we want images in the bed size of potato.
‫Earlier, we were using Betsey's of 20.
‫Now we are using Betsey's of today.
‫And the last more is binary.
‫Since we have two classes and the images of these glasses are in separate folders in our working directory.
‫Now, this is the code to convert over inmate data into handsets now using inmates due to and later
‫we can apply preprocessing here.
‫So earlier we were only using rescaling to rescale RGV values from zero to 255 to zero to one.
‫No, we can use a patient range parameter.
‫This the parameter to give rotation ranges.
‫So here my inmates can rotate from minus 40 to 40 degree.
‫For each inmate.
‫That inmates detergent network will automatically randomly choose a value between minus 40 to 40 and
‫applied that probation to the audience limit.
‫Similarly, we are using overt word shift Grange of point to.
‫Point two means we are allowing inmates due to the need to shift our images left or right.
‫By 20 percent of the total work.
‫Similarly, we are using hyd shift grainge of zero point two percent.
‫This means 20 percent of total height.
‫We are allowing inmates who died in return to shift.
‫Now, note that these sultriness, we are not seeing that.
‫Applied 20 percent of high tariffs to agreement.
‫We are just mentioning the upper limit.
‫So he data generator will randomly choose a number between zero and zero point to.
‫And applied that which shift or hardship to over or regional limits.
‫Similarly, we are using those sheer range of zero point to a zoom range of zero point two and horizontal
‫flip equate to 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 in point to the left.
‫So the code is very similar to last thing.
‫We are creating green underscore doesn't object.
‫And which we are mentioning all this parameters.
‫And in this train underscored details in the details flowing from Betty Currie.
‫And here we are mentioning the train directory, train size, bed size and plus more.
‫Now we will be dreaming of a model only on the creating data dataset.
‫So there is no need to uplay all this transformation on the validation side.
‫Therefore, when we are creating pest detection, we are just rescaling 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 let us first to the train.
‫And that's code generator.
‫And second is the validation underscored in data and validation.
‫We are using test detection.
‫We are we are not applying any of these transformations.
‫So this are the sample of images that will be generated by our train doesn't return.
‫So here you can see that all these three images are from a single original image.
‫So you can see that that is a horizontal flip here.
‫Between these two images.
‫So in the first image, the cat is pointing towards left in the second limit.
‫The cat is pointing towards right.
‫There is some work shift as well, and this two images in the tournament.
‫You can see that there is some percentage of sheer applied to the image.
‫And some zoom is also there.