﻿1
00:00:03,460 --> 00:00:08,560
‫Now the next step is to create the structure of our CNN model

2
00:00:11,910 --> 00:00:15,070
‫for this problem.

3
00:00:15,090 --> 00:00:19,940
‫We will be using four different conv layers with Max pooling.

4
00:00:20,670 --> 00:00:30,530
‫And after that we will apply our dense layer and then an output Nero so for our first layer we will

5
00:00:30,530 --> 00:00:35,180
‫have one layer with 32 feeders and three by three window.

6
00:00:36,590 --> 00:00:42,580
‫And our input sizes 150 by 150 by 3.

7
00:00:42,620 --> 00:00:45,750
‫Remember we mentioned our target size.

8
00:00:45,750 --> 00:00:49,740
‫While data processing as one for pick was one of these.

9
00:00:50,510 --> 00:00:55,010
‫And since this images are colored images we have added we will lose.

10
00:00:55,010 --> 00:01:00,990
‫That's why we are providing a third dimension as three after this.

11
00:01:00,990 --> 00:01:03,270
‫We want the max pooling layer here.

12
00:01:03,300 --> 00:01:06,600
‫We will use a window of two way too.

13
00:01:06,900 --> 00:01:14,150
‫After this we will use another layer with six to 44 years and three by three window.

14
00:01:14,340 --> 00:01:23,600
‫Then another willingly then we will use another con layer with 128 features and add another pooling

15
00:01:23,600 --> 00:01:32,980
‫layer of the White tool window then we will have another layer of 128 filters and a pooling there with

16
00:01:33,100 --> 00:01:34,750
‫two by two window

17
00:01:38,410 --> 00:01:46,090
‫then we will use like ten and then a single dense layer with five and value at all and then a single

18
00:01:46,090 --> 00:01:48,710
‫output layer with one neuron.

19
00:01:48,730 --> 00:01:51,640
‫Since we would only want to predict two glasses

20
00:01:55,090 --> 00:02:00,420
‫one important thing here is to know the number of features that we are using.

21
00:02:00,550 --> 00:02:07,240
‫You can see as we are going on in our network we are increasing the number of four years and now what

22
00:02:07,240 --> 00:02:09,930
‫can layer.

23
00:02:10,100 --> 00:02:15,290
‫So this is a general practice with each cone layer.

24
00:02:15,320 --> 00:02:18,070
‫You have to double the number of filters.

25
00:02:18,080 --> 00:02:28,270
‫You are going to use and another important thing is that if you remember the max pool of window 2 way

26
00:02:28,270 --> 00:02:33,860
‫to you at reducing the size of fewer images.

27
00:02:33,940 --> 00:02:46,310
‫So if you have a image of 150 by 150 after Max bullying you will have a major of 75 but 75 so after

28
00:02:46,380 --> 00:02:52,970
‫this is step off that this layer we will have images in the dimension of zone divide by 70 feet.

29
00:02:53,010 --> 00:03:00,910
‫Then after this another Max pulling we will have images of 37 by 37.

30
00:03:01,080 --> 00:03:11,770
‫Then after this we will have images of 18 by 18 and then 9 by 9 so if you see the number of features

31
00:03:11,890 --> 00:03:23,320
‫are increasing as we go along on our network and the work and the lens of forward images are decreasing.

32
00:03:23,390 --> 00:03:26,450
‫This is a standard practice.

33
00:03:26,450 --> 00:03:35,060
‫You are image size should decrease with each one layer and the feature map height should increase as

34
00:03:35,060 --> 00:03:40,980
‫you go along the network.

35
00:03:41,310 --> 00:03:49,430
‫So this is the structure we are following for this problem let's just run this

36
00:03:55,060 --> 00:03:59,100
‫another thing is that earlier we were using guitars got laid.

37
00:03:59,350 --> 00:04:05,520
‫So now we have important layers and we don't have to put guitars or layers and so on.

38
00:04:05,570 --> 00:04:07,330
‫So another little thing

39
00:04:11,330 --> 00:04:15,100
‫let's look at somebody.

40
00:04:15,560 --> 00:04:24,280
‫You can see we have four can layer with four different pooling layers and then a dense layer and then

41
00:04:24,290 --> 00:04:32,220
‫output layer the total number of parameters that we are creating in our model is that on three million

42
00:04:35,850 --> 00:04:36,530
‫now.

43
00:04:36,660 --> 00:04:39,070
‫The next step is to compile the model.

44
00:04:39,480 --> 00:04:44,430
‫And this time instead of using as Zilly we are going to use Adam's prop

45
00:04:47,850 --> 00:04:49,470
‫Adam's prop.

46
00:04:49,470 --> 00:04:55,140
‫Have a little advantage or as Julie while performing image processing.

47
00:04:55,140 --> 00:04:57,810
‫That's why we are going to use Adam's prop.

48
00:04:57,810 --> 00:05:04,880
‫And here we have also mentioned the learning rate of zero point zero 0 1 by default.

49
00:05:04,880 --> 00:05:13,240
‫The learning rate is point 0 1 and we have mentioned the learning date of zero point 0 0 1 7 this

50
00:05:17,500 --> 00:05:18,000
‫now.

51
00:05:18,050 --> 00:05:29,220
‫The next step is to fit training data in our model and earlier we were using model load fit but now

52
00:05:29,310 --> 00:05:37,560
‫since we have data in the form of green generator we are getting our data in the batches of 20 directly

53
00:05:37,560 --> 00:05:39,660
‫from our directory.

54
00:05:39,740 --> 00:05:49,890
‫That's why instead of using dot fake we are going to use dot generated for using image data generated

55
00:05:49,980 --> 00:05:51,040
‫as our input.

56
00:05:51,060 --> 00:05:53,360
‫We have to use for dinner.

57
00:05:54,690 --> 00:05:58,170
‫The process is almost same instead of DOT fed.

58
00:05:58,170 --> 00:06:07,080
‫You have to use dot underscore the data then then you have to provide the object that is generating

59
00:06:07,080 --> 00:06:07,780
‫the data.

60
00:06:07,800 --> 00:06:16,010
‫In our case that is green generator that we have created earlier.

61
00:06:16,640 --> 00:06:26,110
‫Now now another difference is that this train generator is generating data continuously.

62
00:06:26,730 --> 00:06:33,450
‫So we have to mention this stopping point and we are mentioning the stopping point in the form of number

63
00:06:33,450 --> 00:06:35,270
‫of steps.

64
00:06:36,000 --> 00:06:42,720
‫As you remember here while creating our train generator we mentioned that the bed size should be of

65
00:06:42,720 --> 00:06:44,220
‫20.

66
00:06:44,220 --> 00:06:51,140
‫So this train generator is generating data in the packets of 20 images.

67
00:06:51,210 --> 00:06:59,660
‫Now our crane dataset is of 2000 images so how many steps are required to cover all that to hold on

68
00:06:59,660 --> 00:07:01,050
‫the steps.

69
00:07:01,140 --> 00:07:07,490
‫That is 2000 divided by the number of images in each bet which is 20.

70
00:07:07,590 --> 00:07:15,610
‫So that's where we want under step in the hundreds of steps we are going to cover all the 2000 images

71
00:07:15,640 --> 00:07:18,450
‫that we have in our train directory.

72
00:07:19,870 --> 00:07:24,050
‫So just remember to use the steps but epoch barometer.

73
00:07:25,470 --> 00:07:34,140
‫And this you should go away by dividing the total number of images that you have by the number of images

74
00:07:34,260 --> 00:07:37,170
‫you have in your each batch.

75
00:07:37,440 --> 00:07:40,590
‫So 2000 divided by 20 equally 200.

76
00:07:42,300 --> 00:07:45,150
‫We want to create this model for 20 bucks.

77
00:07:45,150 --> 00:07:50,290
‫That's why we are providing box equal to 20 and similar to fate.

78
00:07:50,310 --> 00:07:56,910
‫We can provide our validation data as well here the validation data is in the form of validation and

79
00:07:57,000 --> 00:07:59,940
‫data.

80
00:08:00,180 --> 00:08:08,550
‫We have created validation generated Aliyah and here also we are using a bed size of 20 and in our validation

81
00:08:08,550 --> 00:08:14,120
‫formula we have it on poles and may images so tall then divided by 20.

82
00:08:14,320 --> 00:08:17,260
‫We need to run this for steps.

83
00:08:17,260 --> 00:08:20,260
‫So we have to provide validation additional steps equally 250

84
00:08:24,170 --> 00:08:26,280
‫let's run this.

85
00:08:26,300 --> 00:08:31,910
‫So if you see this is very similar to fake function and fake function will directly provide the data

86
00:08:32,540 --> 00:08:39,200
‫here and set off providing data directly we are providing a generator that is generating the data and

87
00:08:39,200 --> 00:08:46,310
‫we are mentioning the steps or the limit on the number of times that generator is going to generate

88
00:08:46,310 --> 00:08:46,760
‫the data.

89
00:08:47,930 --> 00:08:50,600
‫So the training may take several minutes.

90
00:08:51,290 --> 00:08:54,440
‫So I am skipping the training part.

