1 00:00:00,930 --> 00:00:02,220 Model fitting is complete. 2 00:00:03,120 --> 00:00:10,620 It has run 430 epochs and we can see that we have achieved validation, accuracy of nearly 89 to 90 3 00:00:10,620 --> 00:00:14,990 percent in the twenty seventy Borg. 4 00:00:15,200 --> 00:00:17,440 You can see that it is ninety point five. 5 00:00:18,690 --> 00:00:23,790 So at the 30th Epoch is giving us a validation accuracy of eighty nine point eight percent. 6 00:00:24,750 --> 00:00:28,950 You can see on the graph that our validation accuracy is stagnant. 7 00:00:29,280 --> 00:00:31,170 It has stopped increasing. 8 00:00:33,360 --> 00:00:39,300 Also, you can observe that validation accuracy is a little bit on the higher side, then turning accuracy. 9 00:00:40,920 --> 00:00:47,280 This is a little counterintuitive because usually we see that training accuracy are always higher than 10 00:00:47,280 --> 00:00:48,390 validation equities. 11 00:00:49,710 --> 00:00:55,170 This is mostly because the input data during training is being transformed. 12 00:00:55,470 --> 00:00:56,040 It has. 13 00:00:57,150 --> 00:00:59,130 Zoom out effect it has here. 14 00:00:59,310 --> 00:01:02,670 It has linear transformations and rotation transformations. 15 00:01:03,630 --> 00:01:08,070 So that is why training accuracy is a little bit less than the validation accuracy. 16 00:01:09,810 --> 00:01:11,140 You can save the last model. 17 00:01:11,220 --> 00:01:14,850 That is the more latitude epoch using this same model. 18 00:01:15,060 --> 00:01:19,770 I just got STF five function and you can retrieve this model. 19 00:01:20,460 --> 00:01:26,250 That is, you can create a new model and save these same architecture and read into that. 20 00:01:26,400 --> 00:01:29,740 Using this load model just is DFI function. 21 00:01:31,500 --> 00:01:36,180 Now the last part of our analysis is checking the performance on test data. 22 00:01:37,890 --> 00:01:44,570 Although we saw the performance on validation data and we did not modify anything in the model basis, 23 00:01:44,600 --> 00:01:45,990 the validation deserved. 24 00:01:47,070 --> 00:01:52,270 So the result on validation data will be very similar to the design on that data. 25 00:01:53,520 --> 00:02:01,290 But just to see how it is done, we have to create a test in data that is generated, will have test 26 00:02:01,290 --> 00:02:08,100 territory and test data engine as the input parameters we specified test data. 27 00:02:08,180 --> 00:02:15,630 Again, in this line it was only rescaling the images, the data of pixels by dividing it by 255. 28 00:02:18,120 --> 00:02:20,820 That goes as a parameter and this function. 29 00:02:22,980 --> 00:02:24,360 The other barometers are seen. 30 00:02:25,590 --> 00:02:33,600 We run this and then we can use the evaluate underscored generator function to evaluate the performance 31 00:02:33,600 --> 00:02:36,120 of this model on our deficit. 32 00:02:38,640 --> 00:02:44,090 So do you value it in later function as run and on the test set? 33 00:02:44,490 --> 00:02:50,340 I'm getting an accuracy of eighty nine point nine percent on the validation test. 34 00:02:50,370 --> 00:02:52,500 Also, I was getting eighty nine point eight percent. 35 00:02:53,010 --> 00:02:59,550 Both of these are giving the same level of accuracy for us because for our model validation, data is 36 00:02:59,550 --> 00:03:02,250 also equally unseen as the test data. 37 00:03:05,060 --> 00:03:12,860 Last time, when we only used data augmentation, we were able to get accuracy's in the range of 83 38 00:03:12,860 --> 00:03:13,850 to 84 percent. 39 00:03:14,900 --> 00:03:20,060 Now we have increment of nearly six percent in the accuracy range. 40 00:03:20,690 --> 00:03:25,290 And this increase is because of the convolutional base that we have used. 41 00:03:25,740 --> 00:03:32,780 The convolutional base was an already train set of convolutional and pooling layers, and those trained 42 00:03:32,780 --> 00:03:38,060 LEDs have given us an incremental accuracy of nearly six to seven percent. 43 00:03:38,300 --> 00:03:47,210 So we'll achieve nearly 90 percent, not to further increase the accuracy to 96, 97 percent. 44 00:03:48,470 --> 00:03:51,920 You need to do only one small change to the standard model. 45 00:03:54,380 --> 00:03:59,160 And that small changes to remove this freeze roots line. 46 00:04:00,050 --> 00:04:07,820 As you remember, we used this line to freeze the weight of our convolutional base, which means that 47 00:04:08,430 --> 00:04:10,760 the convolutional base will not be retrained. 48 00:04:12,740 --> 00:04:17,510 Now, one way is to unfreeze the last few layers. 49 00:04:18,560 --> 00:04:22,300 And another way is to unfreeze the entire convolutional base. 50 00:04:24,530 --> 00:04:28,760 Both of these will give you significant increase in the accuracy. 51 00:04:30,800 --> 00:04:37,880 The concept is, since the features that we were finding out from this convolutional base were targeted 52 00:04:38,000 --> 00:04:39,610 at the image data. 53 00:04:41,120 --> 00:04:45,420 It may need some tuning in, finding out the features. 54 00:04:45,460 --> 00:04:47,450 Also for our particular problem. 55 00:04:48,800 --> 00:04:56,330 So if you do not freeze the rates of last few conversion layers or you do not freeze the of the entire 56 00:04:56,330 --> 00:05:00,800 convolutional base, then you can further increase the accuracy. 57 00:05:01,110 --> 00:05:07,520 And with BDD model, without freezing the rates, you should be able to get accuracy's in the range 58 00:05:07,520 --> 00:05:08,660 of 97 percent. 59 00:05:10,100 --> 00:05:18,440 But keep in mind that since this is a very big network, it will take a lot of computation power of 60 00:05:18,440 --> 00:05:19,100 your computer. 61 00:05:19,430 --> 00:05:23,000 So it will take a lot of memory from your DRAM and Dipu. 62 00:05:24,410 --> 00:05:29,030 Also it will take one or two hours extra if you're running a very big model. 63 00:05:31,310 --> 00:05:38,840 So it may not be feasible to run this on every computer, but just to tell you that this is a possibility. 64 00:05:39,110 --> 00:05:44,480 And you can get 97 percent accuracy in image recognition problems. 65 00:05:45,680 --> 00:05:52,520 This is the only change you have to make and you will be able to get 97 percent accuracy for such problems. 66 00:05:54,650 --> 00:05:56,030 So that's the entire project. 67 00:05:56,750 --> 00:06:04,940 We started this project by importing the data and building a normal, convolutional neural network, 68 00:06:05,630 --> 00:06:09,770 which was giving us accuracy's in the range of 70 to 75 percent. 69 00:06:11,780 --> 00:06:15,440 Then we improve the accuracy using the documentation. 70 00:06:16,370 --> 00:06:20,780 We updated our image data generator with few more parameters. 71 00:06:21,200 --> 00:06:28,310 And this data generator was giving us artificial images with some transformations on the original images 72 00:06:28,310 --> 00:06:28,630 only. 73 00:06:30,050 --> 00:06:37,250 So instead of inputting 2000 images in one epoch, we were inputting 30, 200 images, and all these 74 00:06:37,250 --> 00:06:40,340 images had some transformations done on them. 75 00:06:42,020 --> 00:06:50,090 This improved the accuracy of our model from nearly 73 74 percent to 83 84 percent. 76 00:06:52,420 --> 00:06:53,950 Then we made another small change. 77 00:06:54,490 --> 00:07:00,850 We removed our own convolutional base and used the convolutional base of a pre train model. 78 00:07:03,190 --> 00:07:04,720 We used we did you 16. 79 00:07:06,220 --> 00:07:10,210 You can try out on other models also with this change. 80 00:07:10,360 --> 00:07:14,080 We were able to get accuracy's in the range of 90 percent. 81 00:07:15,630 --> 00:07:22,420 And the last part, which I'm not running right now, but you can try on your only if you have a very 82 00:07:22,420 --> 00:07:31,990 good system with large arm and large Deepu, then you can probably run that part also in which you unpretty 83 00:07:31,990 --> 00:07:32,620 delayers. 84 00:07:35,630 --> 00:07:36,650 You removed this line 85 00:07:39,370 --> 00:07:47,390 from the entire model compiler for data game and then take out the desert accuracy and that will be 86 00:07:47,390 --> 00:07:49,660 coming out at nearly 97 percent. 87 00:07:52,040 --> 00:07:58,220 And with this project, I believe that you'll be pretty comfortable in building of a major recognition 88 00:07:58,220 --> 00:08:01,940 model using convolutional neural networks on your system.