1
00:00:00,270 --> 00:00:07,830
So we're now ready to train our CNN to CNN that we just constructed a pill, let's begin treating it.

2
00:00:07,920 --> 00:00:15,410
So an increase it's actually quite simple to train CNN's well, neural networks compared to PyTorch.

3
00:00:16,140 --> 00:00:18,810
That's a given by batting with PyTorch, to be honest.

4
00:00:19,140 --> 00:00:21,570
It allows you some nitty-gritty control.

5
00:00:22,140 --> 00:00:26,910
Some good python type style language that we can actually interact with.

6
00:00:26,910 --> 00:00:28,380
Get the opposite inputs.

7
00:00:28,470 --> 00:00:30,750
Perform operations in real time and loop.

8
00:00:31,260 --> 00:00:31,980
It's quite nice.

9
00:00:32,580 --> 00:00:37,290
However, wood carries a lot of that is abstracted away, and you can see what I mean here.

10
00:00:37,860 --> 00:00:43,710
Once we have a model that's compiled here, all we have to do is no specified about a specified number

11
00:00:43,710 --> 00:00:47,160
of epochs and we just do model dot fit.

12
00:00:47,790 --> 00:00:54,600
We have history equals a model that fit only because the model not fit after every iteration of every

13
00:00:54,600 --> 00:00:54,960
epoch.

14
00:00:54,960 --> 00:01:01,380
I should say it outputs its towards tick accuracy to validation, lost validation, accuracy and training

15
00:01:01,380 --> 00:01:03,720
loss us so we can plot this afterward.

16
00:01:04,200 --> 00:01:05,220
So it's a good thing.

17
00:01:05,880 --> 00:01:06,960
So don't don't worry about that.

18
00:01:06,990 --> 00:01:14,020
So in the model that fit function, we simply input our training data or treating labels, specify what

19
00:01:14,040 --> 00:01:20,520
that size, which is 128 we're going to use specify epochs verbose, which is a mode where we display

20
00:01:20,520 --> 00:01:21,330
this information.

21
00:01:21,750 --> 00:01:23,640
If you said that to zero, you get less information.

22
00:01:23,640 --> 00:01:27,150
Instead of two, you get even more information during the training process.

23
00:01:27,780 --> 00:01:29,440
I think it's just three modes right now.

24
00:01:29,460 --> 00:01:30,240
Zero one two.

25
00:01:30,840 --> 00:01:34,710
And then we specify our validation data in this tuple here.

26
00:01:35,100 --> 00:01:37,500
This is the testino, and this is a test levels.

27
00:01:38,280 --> 00:01:44,010
And then in the end, we can actually simply just do Model three, evaluate give it to tested the test

28
00:01:44,010 --> 00:01:44,490
labels.

29
00:01:44,970 --> 00:01:50,760
So the verbose to zero by, I think it's by default zero anyway, and we can get the score out of it.

30
00:01:51,150 --> 00:01:54,930
The score gives you in scoring first index gives us a test loss.

31
00:01:55,350 --> 00:01:57,720
Second index gives us the test accuracy.

32
00:01:58,230 --> 00:02:00,150
So this is quite simple.

33
00:02:00,570 --> 00:02:02,550
So now let's begin training this model.

34
00:02:04,110 --> 00:02:08,520
Oops model wasn't defined, and that was because we didn't run this block of code previously.

35
00:02:10,080 --> 00:02:12,750
And that's also because we didn't run the code above it.

36
00:02:13,500 --> 00:02:18,510
Sorry about that, but it's a good practice to keep running these blocks of good.

37
00:02:19,560 --> 00:02:22,830
Make sure you ran sequentially because they depend on each other.

38
00:02:24,390 --> 00:02:26,970
And now we do need to run that.

39
00:02:27,420 --> 00:02:30,660
Now we can start training our model, and there we go.

40
00:02:31,110 --> 00:02:32,430
So it's beginning to first book.

41
00:02:32,820 --> 00:02:37,170
Pretty soon you'll start seeing the output in real time as it goes through each batch.

42
00:02:37,680 --> 00:02:38,190
There we go.

43
00:02:38,580 --> 00:02:40,110
So what are some of his here?

44
00:02:40,170 --> 00:02:42,780
This number is a number of batches in our data.

45
00:02:43,620 --> 00:02:51,990
Remember, we set it at 128 well, 5th 60000, divided by 128 is 469.

46
00:02:52,560 --> 00:02:57,120
So that's why you have four hundred and sixty nine as total number of batches here.

47
00:02:57,420 --> 00:03:01,440
So you can see how quickly it's going through all the batteries in the data, taking the three seconds

48
00:03:01,440 --> 00:03:04,560
of each one, which is actually much faster than our PyTorch model.

49
00:03:05,010 --> 00:03:08,100
And I will see the PyTorch model in that.

50
00:03:08,100 --> 00:03:12,930
In that proof, his example was slower, even though we're using the same hardware and GBU just because

51
00:03:12,930 --> 00:03:14,430
of how we were doing things in the loop.

52
00:03:14,970 --> 00:03:17,790
There's other ways with Pi too we can make things much faster.

53
00:03:18,150 --> 00:03:20,370
But for now, that was just a basic example.

54
00:03:20,640 --> 00:03:22,830
So I didn't want to complicate things too much for you guys.

55
00:03:25,680 --> 00:03:33,030
One thing you wouldn't notice still is that after 10 epochs, the Python model was actually more accurate.

56
00:03:33,610 --> 00:03:39,330
We're at 92 percent here with Keros, but if I, it was at ninety seven point eight percent accuracy,

57
00:03:39,330 --> 00:03:45,420
and that probably has to do with the normalization that we with zero scented invito, which you can

58
00:03:45,420 --> 00:03:51,720
see how it actually does make a difference where the convergence and at the end of the twenty five epochs

59
00:03:51,720 --> 00:03:58,320
would still finished and quite in a very short space of time, we get ninety five percent accuracy in

60
00:03:58,320 --> 00:03:58,620
the end.

61
00:03:59,340 --> 00:04:06,770
And you can see the output, the Tesla says accuracy that came from the score, this variable and that

62
00:04:06,870 --> 00:04:08,670
came from a model that evaluates here.

63
00:04:09,810 --> 00:04:11,370
So we'll stop there for now.

64
00:04:11,760 --> 00:04:15,810
And in the next section, we'll take a look at plotting our loss and accuracy charts.

65
00:04:16,830 --> 00:04:17,820
See you in the next section.

66
00:04:17,970 --> 00:04:18,420
Thank you.
