Hi.
Welcome back to the visualization part of this course in helping you understand what CNN's live.
So in this section, we'll take a look at maximizing filters.
This basically is trying to tell us what image will make our filter fire fully.
So let's take a look at how we do this.
So as I said, what input maximizes our filter to truly understand what our filter is looking for?
It's best if we can find the input image that results in that specific filter, obtaining its maximum
real output score.
So remember, this is a network here and what we're trying to find, this is a real output in the end
here.
We're trying to find what image here will cause the maximum values that we can possibly get here.
So it's a bit tricky, isn't it?
So let's take a look at how we do that.
So now suppose we had a filter that responded maximum its maximum response output kitchen map output
was to chins.
OK, so you would think something like this might be then the input image that maximizes that particular
filter that's looking for a chin?
Well, in reality, it actually looks more like this kind of a mess.
Isn't it kind of confusing?
But that's actually what I was.
CNN's learning.
That's what the filters are learning, so it's pretty interesting to analyze each of these results.
There were a lot of good papers around CNN visualization, and that's how Google Deep Dream, which
we'll discuss later on and discourse.
That's how that algorithm came about, trying to basically manipulate filter maximization and class
maximization and those sorts of things.
So viewing the input that maximizes each filter, it gives us a nice visualization of the CNN's modular
hierarchical decomposition of its visual space.
Pretty big sounding words.
But what I'm trying to say here is that firstly, it's basically just in cool direction and color.
Now this direction and colorful tones then get combined it into basic grids and spots and structures
and more complicated patterns.
So that's basically how we build up the sea and how the CNN builds up its ability to recognize complex
patterns.
So you can see, conversely, one here looks quite like this like textures and that type of stuff,
too.
We can see it's a little bit more structured, but doesn't look that much different to the conflict.
One kind of tree you can see a bit more distinct patterns, definitely in control.
You can see a lot more definite patterns as the image you can see.
This looks like some sort of cloth pattern, and this looks like it's the same thing, but different
angles.
This one looks like a bunch of weird swirls of blobs in the middle.
This one looks like a bunch of little circles, so you can see it's interesting patterns that the higher
layers learn.
So this is basically a summary of filter maximization here that we're seeing.
Now, let's take a look at how we can implement this and could.
So firstly, we have to load a tree in the model.
So we have a model, a model that we've trained previously.
Then we define a lost function that seeks to maximize the activation of a specific filter.
We give it to filter index here and specific specifically and give it actually a name as well.
And then a small trick here is that we normalized the gradient of pixels of the input image, which
avoids very small and very large gradients to ensure a smooth gradient assent process.
Now, this will sound a bit tricky, so it's fully understandable if you don't understand what is going
on right now.
However, hopefully when we start to execute this and could, it will only a lot more sense.
This is a pretty high level explanation of what we're doing.
But basically, in layman's terms, what we're trying to do is that we're trying to find a way to create
a lost function that by using the gradient asset essence press process instead of this descent process.
So instead of trying to find a minimum loss for inside, a maximum of us know of an input that maximizes
that particular filter.
So hopefully that does make a little more sense to, you know.
And what will go on, though, after we after we go into the code and do that?
And then we'll take a look at maximizing class activations, which I find is pretty cool.
Actually, this is probably the coolest part of visualizations, in my opinion.
So I'll see you in the next section.
Thank you.