AI_DL_Assignment / 8. Build CNNs in Python using Keras /11. Displaying Your Model Visually.srt
Prince-1's picture
Add files using upload-large-folder tool
d157f08 verified
1
00:00:01,580 --> 00:00:07,310
And welcome to chapter 8 point 1 0 where we're actually going to use curus to display a visual output
2
00:00:07,460 --> 00:00:08,420
or model.
3
00:00:08,650 --> 00:00:12,950
So remember before previously I was drawing all this nice visualization of our model.
4
00:00:13,220 --> 00:00:18,640
Well carrots can actually do something not quite as nice as this but it produces a pretty decent model
5
00:00:18,660 --> 00:00:22,730
visualization that helps you basically show people and explain your model.
6
00:00:22,910 --> 00:00:24,240
So let's see how we do it.
7
00:00:24,290 --> 00:00:26,220
Let's go back to what I thought in the book.
8
00:00:26,500 --> 00:00:26,840
OK.
9
00:00:26,870 --> 00:00:32,630
So now we're about to visualize our model so to visualize our model we need to import this library from
10
00:00:32,680 --> 00:00:34,200
Carousel dysfunction.
11
00:00:34,280 --> 00:00:39,680
It's called plot model and it's found in Cara's utilities thought visualization utilities vid's underscore
12
00:00:39,680 --> 00:00:41,220
utilities for short.
13
00:00:41,240 --> 00:00:43,980
So what we do we create or recreate or model first.
14
00:00:44,030 --> 00:00:49,430
We don't necessarily have to do this but it's good practice just in case we didn't do it before and
15
00:00:49,450 --> 00:00:53,370
it previously as in the previous cells and this I Pitre notebook.
16
00:00:53,390 --> 00:00:59,800
So let's go ahead and run the slime on this block and we get this table which is our same model output
17
00:00:59,810 --> 00:01:00,610
from before.
18
00:01:00,770 --> 00:01:01,740
All right.
19
00:01:01,970 --> 00:01:04,370
This in itself is a pretty decent visualization.
20
00:01:04,370 --> 00:01:06,970
However it's not like a visual diagram.
21
00:01:07,220 --> 00:01:09,380
What we're going to do is produce a visual Vaga now.
22
00:01:09,440 --> 00:01:15,320
So to do this we use a plot model function and a plot modeled function basically takes a model that
23
00:01:15,340 --> 00:01:20,820
we find here we take we enter a pot for the file to be saved.
24
00:01:20,870 --> 00:01:25,550
So we just use this path here which is the way our train models are saved and we give it a phylum model
25
00:01:25,550 --> 00:01:30,720
and scale plot PNB we can be more descriptive and give it like this model.
26
00:01:30,740 --> 00:01:31,510
All right.
27
00:01:32,060 --> 00:01:34,860
And then after we use matplotlib to actually show.
28
00:01:34,880 --> 00:01:40,220
So we just point matplotlib here that image directory of where we see that and we plotted here and it
29
00:01:40,220 --> 00:01:42,140
comes up below right here.
30
00:01:42,200 --> 00:01:43,500
So let's see how this works.
31
00:01:43,520 --> 00:01:48,990
Let's run this block and then we go here's a nice model visualization.
32
00:01:49,040 --> 00:01:54,530
What's cool about this is that we have inputs and outputs coming in and out is actually quite nice.
33
00:01:54,530 --> 00:01:55,970
This is basically a random number.
34
00:01:55,970 --> 00:02:00,990
Never have been able to figure out what this number actually is pretty much ignored for now.
35
00:02:01,040 --> 00:02:01,820
What school is that.
36
00:02:01,820 --> 00:02:04,160
We actually have Olias coming in here.
37
00:02:04,280 --> 00:02:07,780
We have all kinds of layers tool is here Max pooling.
38
00:02:07,840 --> 00:02:13,050
It shows input outputs what dropout does doesn't change a thing just drops out some layers.
39
00:02:13,250 --> 00:02:19,330
While training Flaten which we know what it does now are dense connections here or drop out again and
40
00:02:19,330 --> 00:02:21,130
are fully connectedly the end here.
41
00:02:21,200 --> 00:02:23,390
Which is also for the connectedly here.
42
00:02:23,930 --> 00:02:25,260
And basically this is it.
43
00:02:25,340 --> 00:02:30,190
So if you were to go to this directory here let's go to the planning directory.
44
00:02:30,290 --> 00:02:32,110
Let's go to train models.
45
00:02:32,330 --> 00:02:41,420
We can see here it is and it's clearer and sharper than I in the book being a DNG file and that's it.
46
00:02:41,420 --> 00:02:43,130
So we've just successfully saved.