1
00:00:00,420 --> 00:00:04,560
In this video, we're going to create our first CNN model.

2
00:00:05,640 --> 00:00:11,370
For dog and cat dataset that we discussed in our last lecture.

3
00:00:13,240 --> 00:00:16,870
We have over data in the form of JPEG images.

4
00:00:17,740 --> 00:00:24,400
You can download this images from the links that we have provided in the resources section of this video.

5
00:00:26,290 --> 00:00:35,560
Once you download the zip file and expect that you will get free folders, ice cream and validation.

6
00:00:37,620 --> 00:00:42,540
Each of these folders contain two soap folders, cats and dogs.

7
00:00:44,010 --> 00:00:51,560
And in this folders, you can find the images of cats and dogs that we are going to use for a lot more

8
00:00:51,560 --> 00:00:51,810
than.

9
00:00:54,080 --> 00:01:02,090
One thing you can straightaway notice is that the dimensions of this images are not standardized.

10
00:01:02,900 --> 00:01:05,420
So you can see this is a portrait image.

11
00:01:06,980 --> 00:01:08,790
And this is a landscape image.

12
00:01:09,410 --> 00:01:12,020
So we have to resize over images as well.

13
00:01:13,720 --> 00:01:16,690
Now we have around 4000 different images.

14
00:01:17,380 --> 00:01:20,590
We will use to Kosen images for training.

15
00:01:21,870 --> 00:01:29,520
We will be called polls and images for our testing purpose, and we will take another posehn images

16
00:01:29,730 --> 00:01:31,320
for our relevation data say.

17
00:01:34,560 --> 00:01:43,380
Now, before starting, we will save the location of this spoilers in three variables that are green

18
00:01:43,390 --> 00:01:46,520
territory validation directory and text directory.

19
00:01:47,600 --> 00:01:48,380
So just.

20
00:01:50,000 --> 00:01:50,400
Copy.

21
00:01:50,480 --> 00:01:52,640
The address of this four years.

22
00:01:54,480 --> 00:01:58,170
And save it and this three different variables.

23
00:01:59,790 --> 00:02:05,970
Now, if you are coping, you will get backward slash instead of forward slices.

24
00:02:06,820 --> 00:02:12,550
So just remember to put R before pasting this folder addresses.

25
00:02:15,350 --> 00:02:22,340
So we have saved addresses of all these four letters and three different variables, train directory

26
00:02:22,360 --> 00:02:24,770
validation category and asperity.

27
00:02:31,940 --> 00:02:37,280
Now we have to convert this picture images in the form of values.

28
00:02:39,670 --> 00:02:48,110
The first step to do this is to read the picture fine, then decode the JPC, contain two RGV grit's

29
00:02:48,130 --> 00:02:48,730
of pixel.

30
00:02:49,090 --> 00:02:52,390
So we want three channels red, blue and green.

31
00:02:55,090 --> 00:03:03,070
Then we need to convert this RGV floating point values and what value between zero and one.

32
00:03:05,520 --> 00:03:11,790
So to do all these steps we will use get us inmates data generator module.

33
00:03:15,280 --> 00:03:20,860
This module have functions to perform, all these steps using the single function.

34
00:03:23,180 --> 00:03:23,630
Paul.

35
00:03:24,840 --> 00:03:26,880
Let's just import image detergent.

36
00:03:26,970 --> 00:03:27,780
Victor Modu.

37
00:03:31,280 --> 00:03:33,560
Now, there are two parts of this.

38
00:03:33,650 --> 00:03:35,240
Inmates do the generator module.

39
00:03:36,820 --> 00:03:44,380
First is to get the image and then the second part is to reskill that image.

40
00:03:45,970 --> 00:03:54,610
You can feel the images from directly from numb by erry or from any other source here.

41
00:03:55,270 --> 00:04:01,510
In our case, we want our images to directly feed it from a directory or a formula.

42
00:04:02,740 --> 00:04:07,470
So we will be using flow from directory method of image to tagine record.

43
00:04:09,810 --> 00:04:16,410
So I have created this train, the Dudgeon Object from IMS data generator.

44
00:04:17,100 --> 00:04:17,760
And here.

45
00:04:18,830 --> 00:04:25,430
As an argument, we are providing the rescaling value to be weighed RGV values by 255.

46
00:04:26,480 --> 00:04:35,300
Our RGV values lies between zero to 255 and to convert them and to zero to one interval, we have to

47
00:04:35,300 --> 00:04:37,190
divide that by 250 by.

48
00:04:39,310 --> 00:04:47,460
So first, we are creating an object with data to function with reskilling value of one divided by 255.

49
00:04:49,660 --> 00:04:52,140
Then we are using flow from that to my truck.

50
00:04:52,270 --> 00:04:55,600
Since our data is in the form of Faldo's or decreased.

51
00:04:57,560 --> 00:05:04,900
Then we are creating two different generators, one for our train data and another one for our valuation

52
00:05:04,910 --> 00:05:05,260
data.

53
00:05:06,550 --> 00:05:10,140
For train data, first we have to mention the train directory.

54
00:05:10,770 --> 00:05:16,810
We have already saved the information on forward train that to address in this train directory variable.

55
00:05:17,670 --> 00:05:22,230
So first parameter here is our variable, which contains the directory name.

56
00:05:23,220 --> 00:05:28,920
Then the second parameter here is the size of images that we want.

57
00:05:30,720 --> 00:05:40,170
So since our image sizes are not centralized, we are a serializing it using the target size of 150

58
00:05:40,200 --> 00:05:41,670
by 150 pixels.

59
00:05:42,580 --> 00:05:46,750
So all of our images are going to convert in this size.

60
00:05:50,270 --> 00:05:55,010
Now, we have to mention the bed size that we are going to use in our model.

61
00:05:55,880 --> 00:06:00,530
So earlier, if you remember last time we were using a bed size of 64.

62
00:06:01,220 --> 00:06:03,640
Now we are using a bed size of 20.

63
00:06:04,880 --> 00:06:13,400
Now this floor from that tree will feed images in the Betties or twenty two over train generated.

64
00:06:15,830 --> 00:06:21,100
Then we have to provide information that base content in the form of folders.

65
00:06:21,740 --> 00:06:28,220
So since we are doing binary classification and we have two four years, one Fourcade and one for DOT,

66
00:06:28,760 --> 00:06:31,190
we have to provide last more as binary.

67
00:06:34,190 --> 00:06:42,860
The output of this green generator will be in the form of X variables and the VI variables Y labels

68
00:06:43,040 --> 00:06:45,500
will depend on the name of the formulas.

69
00:06:46,130 --> 00:06:49,820
So if we have cats and dogs as our four year.

70
00:06:52,810 --> 00:06:55,660
So what viability will will automatically become.

71
00:06:56,140 --> 00:07:01,450
Cats and dogs for all the images that are inside those four wheelers.

72
00:07:03,840 --> 00:07:07,410
Now, let's three ways what this train the narrator is doing.

73
00:07:08,270 --> 00:07:08,650
First.

74
00:07:09,990 --> 00:07:11,960
We are going into a train directory.

75
00:07:12,630 --> 00:07:14,000
There are two for us there.

76
00:07:14,220 --> 00:07:15,270
Cats and dogs.

77
00:07:16,460 --> 00:07:22,550
We are resizing all the images in the shape of one foot by one foot pixels.

78
00:07:24,370 --> 00:07:27,880
We are feeding images in the batches of 20.

79
00:07:28,620 --> 00:07:32,180
So at the time, we are picking 20 images.

80
00:07:33,860 --> 00:07:39,880
Then to create wine labels, we are using the folder names.

81
00:07:40,700 --> 00:07:46,280
And since there are two folders and it's a binary classification problem, we have to grow it last more

82
00:07:46,370 --> 00:07:47,150
as binary.

83
00:07:48,780 --> 00:07:55,020
Then as a result of this function, we will have over images in the form of floating point ten sets

84
00:07:55,140 --> 00:07:58,380
with RGV values between zero and 255.

85
00:08:00,190 --> 00:08:04,710
This is the kind of data we used in our last video.

86
00:08:05,920 --> 00:08:11,500
Then we are reskilling those Excel values between zero and one.

87
00:08:12,070 --> 00:08:14,950
And that's why we are dividing it back 255.

88
00:08:17,820 --> 00:08:22,170
Now, why we have created this train, do dudgeon object?

89
00:08:22,950 --> 00:08:30,600
This is because instead of directly feeding all the data and blow it a fixed function, we are going

90
00:08:30,600 --> 00:08:37,040
to feed 20 images at a time and do our fit function while training over model.

91
00:08:38,920 --> 00:08:47,530
One of the advantage of using this image data generator is that in case we want augmented data, we

92
00:08:47,530 --> 00:08:56,680
can directly apply many more functions like Rescale, Zoom, Schirò, etc, to generate some more data

93
00:08:56,710 --> 00:08:58,190
from our existing data.

94
00:09:00,890 --> 00:09:04,280
If you want some more detail about this email, do to generate a.

95
00:09:05,670 --> 00:09:09,840
You can click on this link to open that, get us documentation.

96
00:09:12,000 --> 00:09:16,410
So here you will get all the information you need for inmates, people siccing.
