1 00:00:00,660 --> 00:00:08,600 In the last lecture we saw that we were not able to achieve high valuation accuracy due to overheating 2 00:00:11,110 --> 00:00:13,910 in this lecture in this lecture. 3 00:00:13,940 --> 00:00:22,040 We will apply different image processing to avoid or what fitting and we will also introduce a global 4 00:00:22,040 --> 00:00:24,680 player in our model architecture. 5 00:00:26,750 --> 00:00:38,300 An inmates pre processing we will apply shearing rotation worship height shift and zoom to create dummy 6 00:00:38,300 --> 00:00:43,750 data from over or is no later now shearing. 7 00:00:43,750 --> 00:00:45,030 Looks like this. 8 00:00:45,070 --> 00:00:54,370 So if this is our OR is no limit shearing means we are pulling any one ad off our photo and converting 9 00:00:54,520 --> 00:01:07,180 a squid and do a rhombus rotation means rotating the image which shift means we are shifting of our 10 00:01:07,180 --> 00:01:10,240 whole image left or right. 11 00:01:10,670 --> 00:01:18,740 Height shift means we are shifting our whole image up or down and zooming means we are zooming in at 12 00:01:18,740 --> 00:01:22,600 any particular section of our image. 13 00:01:22,880 --> 00:01:32,130 Now it is very easy to randomly apply all these features to over images. 14 00:01:32,300 --> 00:01:35,980 Again we will be using image that. 15 00:01:36,500 --> 00:01:38,650 The data will flow from that screen. 16 00:01:38,870 --> 00:01:42,490 So we will be using flow from that incremental. 17 00:01:42,500 --> 00:01:47,540 And here we are reading the data we are reading the data from our train directory. 18 00:01:47,900 --> 00:01:53,690 The target size of the images we want is 150 by 150. 19 00:01:53,730 --> 00:01:58,870 And this time we want images in the bed size of potato. 20 00:01:58,890 --> 00:02:01,590 Earlier we were using bed size of 20. 21 00:02:01,590 --> 00:02:03,710 Now we are using bed size of 32 22 00:02:06,450 --> 00:02:09,030 and the class more is binary. 23 00:02:09,030 --> 00:02:19,500 Since we have two classes and images of this glasses are in separate facilities in our train directory. 24 00:02:19,630 --> 00:02:25,900 Now this is the code to convert our image data in to 10 sets. 25 00:02:25,910 --> 00:02:31,150 Now using image data generator we can apply pre processing here. 26 00:02:31,270 --> 00:02:38,050 So earlier we were only using reskilling to reskill our TV values from 0 to 255. 27 00:02:38,290 --> 00:02:40,780 2 0 2 1. 28 00:02:40,850 --> 00:02:49,690 Now we can use rotation range parameter Does the parameter to give rotation ranges. 29 00:02:49,690 --> 00:02:59,750 So here my image can rotate from minus 40 to 40 degree for each image the image data generator will 30 00:02:59,840 --> 00:03:06,800 automatically randomly choose a value between minus 40 to 40 and applied that rotation to the OR is 31 00:03:06,810 --> 00:03:08,680 no limit. 32 00:03:08,690 --> 00:03:19,860 Similarly we are using of words shift Granger point to point to means we are allowing image data generator 33 00:03:20,470 --> 00:03:26,210 to shift our images left to right by 20 percent of the total. 34 00:03:27,850 --> 00:03:32,020 Similarly we are using hide shift grains of zero point two percent. 35 00:03:32,710 --> 00:03:36,710 This means 20 percent of total height. 36 00:03:36,760 --> 00:03:42,170 We are allowing Mr the generator to shift now. 37 00:03:42,180 --> 00:03:44,230 Note that the this. 38 00:03:44,250 --> 00:03:50,510 We are not seeing that applied 20 percent off heights to every image. 39 00:03:50,760 --> 00:03:53,300 We are just mentioning the upper limit. 40 00:03:54,240 --> 00:04:01,820 So immense data generator will randomly choose a number which means zero and zero point two and apply 41 00:04:01,830 --> 00:04:06,190 that which shift or hardship to over ordinal images. 42 00:04:06,200 --> 00:04:15,490 Similarly we are using this sheer range of zero point to a zoom range of zero point two and horizontal 43 00:04:15,500 --> 00:04:15,930 flip. 44 00:04:15,980 --> 00:04:27,670 Equally good crew horizontal flip just means the mirror image along the vertical axis so right now. 45 00:04:27,750 --> 00:04:36,620 If this is our original image the camera is pointing towards right horizontal flip means the mirror 46 00:04:36,710 --> 00:04:38,930 image of this image along this axis. 47 00:04:38,960 --> 00:04:41,780 So the camera will point to the left 48 00:04:44,600 --> 00:04:48,860 so the code is very similar to last thing. 49 00:04:49,070 --> 00:04:52,600 We are creating green underscored data as an object. 50 00:04:53,790 --> 00:05:02,440 In which we are mentioning all this parameters and in this train underscore data and the data is flowing 51 00:05:02,440 --> 00:05:03,700 from directory. 52 00:05:03,730 --> 00:05:12,250 And here we are mentioning the green directory grain size bed size and plus more. 53 00:05:12,420 --> 00:05:21,210 Now we will be creaming our model on only on the training dataset so there is no need to apply all this 54 00:05:21,210 --> 00:05:23,540 transformation on the validation site 55 00:05:26,410 --> 00:05:32,710 therefore when we are creating test data then we are just re scaling our data. 56 00:05:32,710 --> 00:05:39,790 We are not applying all this transformations to our data. 57 00:05:40,670 --> 00:05:47,490 So if we execute this code we will be creating who doesn't read us first to the train and that's code 58 00:05:47,500 --> 00:05:48,050 generator. 59 00:05:48,200 --> 00:05:51,950 And second is that validation underscore gender data in validation. 60 00:05:51,950 --> 00:06:01,180 We are using test data and we are not applying any of these transformations so this are the sample of 61 00:06:01,180 --> 00:06:05,560 images that will be generated by our train data generator. 62 00:06:07,000 --> 00:06:15,370 So here you can see that all these three images are from a single original image so you can see that 63 00:06:15,610 --> 00:06:20,390 there is a horizontal flip here between these two images. 64 00:06:20,390 --> 00:06:26,930 So in the false image the cat is pointing towards left in the second element. 65 00:06:26,990 --> 00:06:29,510 The cat is pointing towards the right. 66 00:06:29,750 --> 00:06:36,980 There is some weird shift as well in this two images in the third element you can see that there is 67 00:06:37,010 --> 00:06:40,070 some percentage of shear applied to the image. 68 00:06:41,950 --> 00:06:44,610 And some Zoom is also there.