1
00:00:00,210 --> 00:00:02,730
Now, let's take a look at our digital order.

2
00:00:02,940 --> 00:00:04,860
So what is a detail exactly?

3
00:00:05,490 --> 00:00:12,960
Well, and pretty much how we get data into the neural net where we training it is by using something

4
00:00:12,960 --> 00:00:15,390
called a digital order and what it is and what it does.

5
00:00:15,780 --> 00:00:20,520
It basically returns to data from the from the training dataset.

6
00:00:21,000 --> 00:00:22,860
And remember, this has over transforms.

7
00:00:23,340 --> 00:00:24,360
So we have something.

8
00:00:24,570 --> 00:00:26,550
So it creates an object called a train loader.

9
00:00:27,090 --> 00:00:33,420
And with this, we can set about size, which I'll explain to you shortly how it works shuffle, which

10
00:00:33,420 --> 00:00:34,800
means it's going to pull the data randomly.

11
00:00:34,800 --> 00:00:40,290
It's randomly shuffling the data so we don't pull it in a sequence and number of workers, no number

12
00:00:40,290 --> 00:00:46,380
of workers as a parameter that allows you to control how many CPU cores you want to utilize in this

13
00:00:46,380 --> 00:00:47,610
data loading operation.

14
00:00:48,150 --> 00:00:52,350
Now it's a good parameter to mess with if you want to experiment with different speeds.

15
00:00:53,100 --> 00:00:56,700
I tend to leave it at zero in most cases when I'm doing it on Cloud Atlas.

16
00:00:57,240 --> 00:01:02,990
However, you can set it up to because I believe the idea there's a dual CPU, one club or even one

17
00:01:03,030 --> 00:01:03,990
CPU sometimes.

18
00:01:04,470 --> 00:01:07,170
So you can experiment with this, but generally leave it at zero.

19
00:01:07,410 --> 00:01:07,710
OK?

20
00:01:08,700 --> 00:01:10,730
And you can see we create a little louder.

21
00:01:11,160 --> 00:01:12,580
We create two data ladders.

22
00:01:12,600 --> 00:01:16,710
We create one for training data and one for a test data.

23
00:01:16,890 --> 00:01:20,310
So now let's take a look at what the data object returns.

24
00:01:20,490 --> 00:01:26,610
So if you're familiar with some more advanced python, you would know what an item it is.

25
00:01:26,910 --> 00:01:33,870
So Oteri is an object that basically allows you to retune and iterate a little pointer to an object

26
00:01:34,050 --> 00:01:36,720
so you can actually accesses objects quite quickly.

27
00:01:37,350 --> 00:01:41,640
It's a good technique when you're trying to do optimal programming and improve the speeds.

28
00:01:42,210 --> 00:01:46,380
So instead of pretending to actually do this is a much faster to do so.

29
00:01:46,830 --> 00:01:52,350
By using the Python data function, we can extract this and make it into an item.

30
00:01:52,360 --> 00:01:54,840
It's a hill, so we have data to know.

31
00:01:55,170 --> 00:01:56,640
So what does that allow us to do?

32
00:01:56,790 --> 00:02:00,860
Well, it allows us to access the first batch of data from our data.

33
00:02:01,590 --> 00:02:09,300
So by creating this data, creating a data iterator from our train loader, we have data data.

34
00:02:09,300 --> 00:02:14,610
And then by applying the DOT next function, it gives us the batch removing specified about size of

35
00:02:14,610 --> 00:02:15,330
128.

36
00:02:15,750 --> 00:02:22,680
It returns a batch of data, so the images and the labels, which is exactly what we want to use when

37
00:02:22,680 --> 00:02:27,240
training at CNN so we can actually print the sizes of them.

38
00:02:27,720 --> 00:02:32,430
These are tenses again, torch tenses so you can see it does return exactly what we wanted.

39
00:02:33,270 --> 00:02:39,780
One hundred and twenty eight images, this is adapted up to that shifted now, and it's 28 by 28, and

40
00:02:39,790 --> 00:02:46,710
the levels are basically the classes zero to nine and it returns one hundred and twenty eight, which

41
00:02:46,710 --> 00:02:49,680
corresponds to a class name for each image.

42
00:02:50,670 --> 00:02:56,130
So that's exactly what we want, and you can see if you wanted to check the image dimensions of one,

43
00:02:56,670 --> 00:02:59,130
you can see it's exactly as we expected it one, 2020.

44
00:02:59,130 --> 00:03:05,160
It just accesses the first index of this images from the batch we extracted here.

45
00:03:06,240 --> 00:03:11,670
So alternatively, I'm just going to show you quickly another way we can plot images using to experience

46
00:03:11,670 --> 00:03:14,520
one of the utilities called Maigret.

47
00:03:14,730 --> 00:03:18,960
It's actually quite simple, and we actually use the data loader to create this.

48
00:03:19,170 --> 00:03:25,450
So by creating the ideal reader from our train loader, we get data later here and then we just use

49
00:03:25,450 --> 00:03:30,330
the next to get to batch like we did before we create a simple plotting function on top here.

50
00:03:30,930 --> 00:03:34,380
And then we just used a simple function to watch creation utils.

51
00:03:34,380 --> 00:03:35,050
Don't make grid.

52
00:03:35,580 --> 00:03:40,470
Take all 128 images here and use them show function to display it.

53
00:03:40,800 --> 00:03:41,730
It's quite simple.

54
00:03:42,210 --> 00:03:49,080
And if you wanted to actually print the labels, we can just print the labels by just putting it into

55
00:03:49,110 --> 00:03:51,450
a little list comprehension here.

56
00:03:51,810 --> 00:03:57,680
Extract out all of the values from the labels here and print them together in a nice way like this.

57
00:03:57,720 --> 00:04:03,990
Not really that nice, but at least we have all of the class names here, so you can see it's Zoom in

58
00:04:03,990 --> 00:04:04,290
a bit.

59
00:04:05,700 --> 00:04:08,430
Two five five one seven can see the sequence here.

60
00:04:08,430 --> 00:04:13,910
The class labels two five five one seven six nine eight and so on.

61
00:04:13,920 --> 00:04:17,820
So that's that's what we call a batch and remember and mini batch.

62
00:04:18,270 --> 00:04:19,290
This a gradient descent.

63
00:04:19,890 --> 00:04:20,760
This is what we use.

64
00:04:20,760 --> 00:04:23,310
This is the batch we feed into the neural network.

65
00:04:23,700 --> 00:04:29,710
Get the losses applied back propagation with the optimizer, which is stochastic gradient in most cases

66
00:04:29,730 --> 00:04:35,730
or whatever, optimize that you want to use and just keep doing it again and again a bit more batches

67
00:04:35,730 --> 00:04:36,180
of data.

68
00:04:37,080 --> 00:04:38,130
So let's stop there.

69
00:04:38,130 --> 00:04:41,040
And now we'll take a look at the real nitty gritty here.

70
00:04:41,310 --> 00:04:43,400
How do we build a CNN invite?

71
00:04:43,410 --> 00:04:45,810
OK, so I'll see you in the next section.

72
00:04:46,020 --> 00:04:46,440
Thank you.
