1 00:00:00,700 --> 00:00:08,500 Now we are beginning with the end to end CNN project in which we are going to import colored images 2 00:00:08,620 --> 00:00:15,250 of dogs and cats, and we will try to classify which image contains a cat and which image contains the 3 00:00:15,250 --> 00:00:15,530 dog. 4 00:00:16,880 --> 00:00:20,090 For this, we are going to use cats and dogs dataset. 5 00:00:21,120 --> 00:00:25,720 I have already created a small subset of the entire data. 6 00:00:26,710 --> 00:00:29,740 The entire data is available at Google dot com. 7 00:00:30,820 --> 00:00:36,820 If we want to look at the entire data, you can go check out a dot com and look for cats and dogs. 8 00:00:38,550 --> 00:00:45,220 But I have created a small subset that is available in a zip line which is put on a Google tree. 9 00:00:45,910 --> 00:00:49,330 You will get these Google Drive link in the course description. 10 00:00:49,840 --> 00:00:52,120 You have to download that to it to get data. 11 00:00:54,670 --> 00:01:03,320 Have downloaded deep, I create a folder called CNN in your working directory here at the location of 12 00:01:03,320 --> 00:01:04,310 my working directory. 13 00:01:04,640 --> 00:01:07,400 If you want to change the location of your working directory. 14 00:01:08,270 --> 00:01:14,180 Click on this button and select the position where you want to go. 15 00:01:14,660 --> 00:01:21,700 So if you want to have desktop at working directly, click on desktop, click on Open and they go into 16 00:01:21,710 --> 00:01:27,260 mode and set that as your working directory in your working directory. 17 00:01:27,740 --> 00:01:29,310 Create a folder called CNN. 18 00:01:31,790 --> 00:01:32,410 You can do it. 19 00:01:32,430 --> 00:01:39,050 The novel Windows Way out here and I have written record in art using which you can create this folder. 20 00:01:41,480 --> 00:01:48,230 So if you run these two lines, it will create a new board in your working directory, which will be 21 00:01:48,230 --> 00:01:48,860 titled TNN. 22 00:01:50,300 --> 00:01:52,330 I'm not running this line because I already have. 23 00:01:52,340 --> 00:01:54,830 This will live within this folder. 24 00:01:55,220 --> 00:02:00,710 You have to unzip the zip file that you have downloaded when you unzip it. 25 00:02:00,800 --> 00:02:05,300 You'll get three folders, one test, one three and one validation. 26 00:02:06,770 --> 00:02:12,380 This all these three contain data in the train folder. 27 00:02:12,500 --> 00:02:14,990 You have for their two folders, cats and dogs. 28 00:02:16,040 --> 00:02:20,690 Cat four Look contains 1000 images which have gotten it. 29 00:02:24,010 --> 00:02:28,520 Dogs contains 1000 images, the dogs in. 30 00:02:31,000 --> 00:02:34,420 Similarly, in the validation dataset, also we have two folders. 31 00:02:34,870 --> 00:02:42,990 But the number of injured images is 500 in cats and 500 in dogs and indeed test sick. 32 00:02:44,170 --> 00:02:48,280 We again have 500 images of cats and 500 images of dogs. 33 00:02:50,200 --> 00:02:52,470 So we are going to use this training data. 34 00:02:53,270 --> 00:02:55,750 And this validation data set to fit our model. 35 00:02:57,670 --> 00:03:02,860 So the first step was to create the CNN pedigree and we didn't diabetic medically, you have to underbelly 36 00:03:03,110 --> 00:03:06,150 zip with which you will get all this data. 37 00:03:08,570 --> 00:03:14,770 Much of the video data, we have to create some variables which was stored the location of these directories. 38 00:03:19,410 --> 00:03:25,500 These will be used to pay our model that this is where you have to take your data from. 39 00:03:26,460 --> 00:03:29,120 So there is a slight variation that we are doing this time. 40 00:03:30,390 --> 00:03:38,090 Instead of loading all the data of images into a video, will really be giving the directory from which 41 00:03:38,100 --> 00:03:40,260 the images are to be taken by our model. 42 00:03:42,210 --> 00:03:43,590 So let us see how this is to be done. 43 00:03:44,130 --> 00:03:49,020 First of all, we have to store these vertically locations in different variables. 44 00:03:49,710 --> 00:03:57,240 So these IPTV rebels, we are going to create trained directory, which will have the position of training 45 00:03:57,240 --> 00:04:02,850 data, validation directory for validation data and test retreat for testing. 46 00:04:05,910 --> 00:04:10,380 So basically these three variables are actually pointing to these deep olders. 47 00:04:14,530 --> 00:04:22,270 Now, the first step is to pre-process the images that we have in pre processing. 48 00:04:22,750 --> 00:04:31,300 We have to convert these colored images into Tensas and that to the pixel value ranging from zero to 49 00:04:31,300 --> 00:04:31,630 one. 50 00:04:32,680 --> 00:04:38,290 So if you remember in M-Net also, we had values ranging from zero to 255. 51 00:04:39,740 --> 00:04:42,580 We descale it to a value between zero and one. 52 00:04:43,990 --> 00:04:45,460 So we have to do that rescaling. 53 00:04:45,700 --> 00:04:51,730 We have to handily Tainos and we have to create one sense it instead of having three different dentals. 54 00:04:52,090 --> 00:04:57,830 So all that thing is handled by this one function image data. 55 00:05:00,120 --> 00:05:07,330 So two, pre-process the images that we are going to feed into a model, we use dysfunction, image, 56 00:05:07,330 --> 00:05:08,000 data generated. 57 00:05:09,670 --> 00:05:12,340 There is one more important feature of dysfunction. 58 00:05:13,420 --> 00:05:14,650 This we will see later on. 59 00:05:15,010 --> 00:05:23,260 The feature is that this function helps us generate artificial image data to which we will use to check 60 00:05:23,260 --> 00:05:26,740 the impact of data augmentation or not model performance. 61 00:05:27,410 --> 00:05:29,930 So that is part of the little picture in this picture. 62 00:05:30,160 --> 00:05:33,510 We will just use data that we have in these deep waters. 63 00:05:35,650 --> 00:05:39,430 And this data is being processed by this function to be done. 64 00:05:39,550 --> 00:05:47,170 These two commands, I'm getting this error because I have not activated my kiraz celebrity because 65 00:05:47,170 --> 00:05:48,400 I'm using a new project. 66 00:05:48,820 --> 00:05:52,640 If you are using the same old project, you're get us to have it. 67 00:05:52,640 --> 00:05:53,850 You will be already at it. 68 00:05:54,070 --> 00:05:55,170 So you will not get this. 69 00:05:56,350 --> 00:06:02,620 I'm going this again also doing the same pre processing for our validation dataset. 70 00:06:05,020 --> 00:06:09,730 So now you can see that we have two data edibles on that I can take. 71 00:06:11,080 --> 00:06:15,700 And these contain the tinted information of those colored images. 72 00:06:17,410 --> 00:06:20,320 Next, we are going to bring in one more change. 73 00:06:21,730 --> 00:06:26,560 Instead of feeding the training data all at once, not fit function. 74 00:06:27,010 --> 00:06:30,160 We are going to give the data in batches of 20. 75 00:06:32,020 --> 00:06:39,700 And those 20 batches of images will be generated by this function flow images directory. 76 00:06:40,700 --> 00:06:44,500 What this function will do instead of loading the image into what? 77 00:06:46,020 --> 00:06:46,290 Yes. 78 00:06:46,570 --> 00:06:53,650 Straightaway taking that image from the directory and putting it to a model within this function. 79 00:06:54,130 --> 00:06:56,170 We have several parameters to be specified. 80 00:06:57,550 --> 00:06:59,860 The first barometer is the training directory. 81 00:07:01,550 --> 00:07:03,130 This we stored earlier. 82 00:07:04,090 --> 00:07:04,820 This is telling. 83 00:07:04,840 --> 00:07:06,220 Where is the training data? 84 00:07:06,360 --> 00:07:09,190 Situated at the next parameter. 85 00:07:09,370 --> 00:07:10,780 Is this train DTG? 86 00:07:11,650 --> 00:07:18,460 This is the function which will be these killing images, which will be preprocessing it so that those 87 00:07:18,460 --> 00:07:20,500 images could be paid to output function. 88 00:07:22,150 --> 00:07:27,340 Then there is a barometer which tells us what should be the size of images. 89 00:07:28,630 --> 00:07:33,520 As I told you earlier, the image size in our dataset is not standard. 90 00:07:34,840 --> 00:07:39,130 But the image size for our network should be standard. 91 00:07:39,970 --> 00:07:47,110 So we need to reshape the images to a target size, which will be the standard size of images which 92 00:07:47,110 --> 00:07:48,850 we are feeding our model. 93 00:07:49,600 --> 00:07:55,150 So here we are converting all the images to a 150 150 pixel image. 94 00:07:56,600 --> 00:07:59,770 So this is the size of image which we are putting up. 95 00:08:02,200 --> 00:08:03,940 Next parameter is bat size. 96 00:08:04,650 --> 00:08:09,550 That sizes number of images that will be leading to our model at one go. 97 00:08:11,500 --> 00:08:16,240 So this is the same bad size which we specified in different function. 98 00:08:16,800 --> 00:08:19,570 Earlier we specified a bad size of 60 foot. 99 00:08:20,940 --> 00:08:22,790 This time, I'm giving a bad sales up. 100 00:08:22,920 --> 00:08:23,370 Grindy. 101 00:08:25,240 --> 00:08:28,250 And the last parameterize last mode, which is by. 102 00:08:29,010 --> 00:08:32,250 This is because we are solving a binary classification problem. 103 00:08:33,630 --> 00:08:39,200 And when this function looks into genetically, it sees two folders. 104 00:08:40,050 --> 00:08:43,090 One will be titled Cat and well reedited dogs. 105 00:08:44,220 --> 00:08:51,420 So it understands that the two folders represent two classes into which this binary classification is 106 00:08:51,420 --> 00:08:51,870 to be done. 107 00:08:53,640 --> 00:08:57,060 So we have to tell that it is a binary classification we are doing. 108 00:08:57,840 --> 00:09:02,040 And the two classes are the two folders within this statically. 109 00:09:05,060 --> 00:09:14,520 So this function will be giving us batches of 20 images which are being processed and having Tiger of 110 00:09:14,520 --> 00:09:15,780 150 by 150. 111 00:09:16,560 --> 00:09:19,710 And those are to be classified into two classes. 112 00:09:20,970 --> 00:09:24,440 And these badges of 20 will keep on coming infinitely. 113 00:09:25,860 --> 00:09:29,100 So it is a infinite loop in this function. 114 00:09:29,130 --> 00:09:32,340 Keeps on sending 20 images all the time. 115 00:09:32,340 --> 00:09:33,240 We tell it to stop. 116 00:09:34,190 --> 00:09:41,190 So later on, remember this, that we will have to tell this function to stop giving 20 images. 117 00:09:43,280 --> 00:09:46,530 So this is what this flow images form data is doing. 118 00:09:47,190 --> 00:09:53,220 Instead of loading all the images, we are telling that the image data is to be taken from that, that 119 00:09:53,440 --> 00:09:55,550 we were just doing it. 120 00:09:56,250 --> 00:10:00,920 And at ago, when the images are to be fed to our modern. 121 00:10:03,230 --> 00:10:05,260 You have done the same thing with validation to do it. 122 00:10:06,660 --> 00:10:09,170 It is also giving us batches of grindy images. 123 00:10:13,430 --> 00:10:14,290 Now, that underscore. 124 00:10:17,650 --> 00:10:18,890 Poor ventilation generator also. 125 00:10:20,840 --> 00:10:23,730 So this completes the data pre processing part. 126 00:10:24,660 --> 00:10:27,980 We are ready to give the image information to our model.