AI_DL_Assignment / 8. Build CNNs in Python using Keras /10. Saving and Loading Your Model.srt
Prince-1's picture
Add files using upload-large-folder tool
d157f08 verified
1
00:00:00,430 --> 00:00:00,850
OK.
2
00:00:00,880 --> 00:00:04,340
So let's talk about how we save our models that we just trained.
3
00:00:04,380 --> 00:00:08,020
We spend some time training a model and we don't want to lose this model in clothes.
4
00:00:08,040 --> 00:00:09,000
I buy the book.
5
00:00:09,000 --> 00:00:13,350
So let's figure out how we save and load our models.
6
00:00:13,390 --> 00:00:15,790
OK so we just spend so much time printing our model.
7
00:00:15,810 --> 00:00:17,890
So let's get to saving it now.
8
00:00:17,930 --> 00:00:24,780
So if you scroll down below these charts to see if she's part of the model object you just specified
9
00:00:24,830 --> 00:00:27,000
directory and file him as you want.
10
00:00:27,000 --> 00:00:33,570
So basically we can just call this chapter 8 which is from 8 here eminence simple CNN Tennie box can
11
00:00:33,570 --> 00:00:36,080
actually put on display here make it look a little bit nicer.
12
00:00:36,510 --> 00:00:39,780
And voila it saved instantly.
13
00:00:39,780 --> 00:00:46,770
So now if you want to redo it on what all this is into and you found him here and we use Chris's model
14
00:00:46,890 --> 00:00:48,720
which is part of the models library here.
15
00:00:49,200 --> 00:00:55,890
And this basically this is what's strange to most people loading isn't as instantaneous as saving and
16
00:00:55,890 --> 00:01:00,990
that's because it has to actually unpack everything now and put it back into the model format.
17
00:01:01,020 --> 00:01:06,150
It's a bit tricky to understand I actually spend some time trying to figure it out because I had a project
18
00:01:06,150 --> 00:01:11,840
where I was loading 50 different models at once and it was taking maybe about five 10 minutes to live
19
00:01:11,840 --> 00:01:13,130
with all of them together.
20
00:01:13,530 --> 00:01:14,940
So let's just run this quickly.
21
00:01:15,600 --> 00:01:16,510
And there we go.
22
00:01:16,520 --> 00:01:17,930
Stick what 15 seconds.
23
00:01:18,340 --> 00:01:22,860
And so there's no snow or model which was called the model before.
24
00:01:22,890 --> 00:01:24,280
It's called classifier.
25
00:01:24,690 --> 00:01:30,270
And now we can use it here classify it just like we were using model before they are interchangeable
26
00:01:30,270 --> 00:01:33,080
now because our model is effectively classified.
27
00:01:33,080 --> 00:01:34,660
It's just a different name.
28
00:01:34,680 --> 00:01:40,510
What I mean by that is you see how we declared this as a model equals sequential No what we've related
29
00:01:40,510 --> 00:01:41,220
to our model.
30
00:01:41,220 --> 00:01:44,160
I didn't want to overwrite what we had see if it was a model.
31
00:01:44,250 --> 00:01:48,160
So effectively model is now as we have seen it and loaded it.
32
00:01:48,180 --> 00:01:52,730
It's now effectively Plus a classified called classify.
33
00:01:52,770 --> 00:01:53,600
Should say.
34
00:01:53,880 --> 00:01:57,630
And we can load it here and basically run some tests.
35
00:01:57,640 --> 00:01:58,800
This has an error in it.
36
00:01:58,800 --> 00:02:01,280
Him just to leave this quickly.
37
00:02:02,560 --> 00:02:04,940
And it should work fine now.
38
00:02:04,980 --> 00:02:05,490
There we go.
39
00:02:05,570 --> 00:02:07,940
So we're actually running some test animals here.
40
00:02:07,940 --> 00:02:09,630
So this is a zero a tree.
41
00:02:09,650 --> 00:02:13,740
It can see how accurate this model is.
42
00:02:13,760 --> 00:02:14,530
It's quite cool.
43
00:02:15,500 --> 00:02:19,050
And it actually looks and what it actually is because it's a bit tilted.
44
00:02:19,430 --> 00:02:20,130
So that's good.
45
00:02:20,200 --> 00:02:20,660
It's great.
46
00:02:20,660 --> 00:02:27,740
Actually we've just trained we've just loaded and trained and tested and plotted and analyzed and done
47
00:02:27,800 --> 00:02:30,470
all of the settings for this model.
48
00:02:30,470 --> 00:02:34,940
So if you wanted to put it all together because you don't actually need to have every block separate
49
00:02:34,940 --> 00:02:40,130
like this this was basically for teaching purposes I actually never separate these things that much
50
00:02:42,060 --> 00:02:47,780
but let's put it all together so quickly you can see this is everything here and you run this and you
51
00:02:47,780 --> 00:02:49,990
basically start training instantaneously.