Hi, welcome back.
Now let's talk about maximizing class activations.
This is a really cool topic, in my opinion.
This basically tries to figure out what input image maximizes the class output representation of that
CNN.
So let's talk about this a bit more.
What does that actually mean?
Well, let's say we've trained a CNN to classify between cats and dogs.
But there's also a CNN actually know what a cat looks like.
What input makes a CNN output with 100 percent certainty that it's seeing a cat?
That's the question we seek to answer with class maximization.
What input image is going to make our CNN give a 100 percent probability output that this is a cat or
this is a dog?
So let's take a look at a pre-trained CNN and that CNN is VG, which you learn about shortly.
Those are one of the classical architecture of CNN architectures.
So let's take a look at this.
So apparently, this image here on the right is a class that maximizes the the output probability of
this class being a bald eagle.
Now let's go back, so take a look at this.
Why would why would this maximize that?
CNN What would that input maximize it as in when I say maximize it?
I mean, cause that CNN to give an output at 100 percent certainty.
This is a bald eagle.
Well, if you look carefully, you can see it is an amalgamation of beaks at different angles.
A bird head here, a bird head here, different beak here.
So you can see there are there are features that belong to the bald eagle that are showing up in this
image.
It's just not how the way our brains would perceive it.
So let's take a look at some takeaways here.
CNN's internalized local features.
These are things like feathers, beaks and eyes that will bear a resemblance to the class that it's
been trained to recognize.
However, this shows that CNN has learned very differently to us.
At least we think so.
We don't actually know too much yet about how our brains actually learn and process images, because
that's all behind the scenes in our brain, hopefully.
So it basically shows that CNN's basically do something called decomposition of the visual input space,
and it's a hierarchical modulated network of convolutional filters that build up that intuition that
that that this these features belong to that specific class.
So the internal network is then a probabilistic mapping between combinations of these filters and their
class levels.
So the fact that CNN has learned very differently, this tells us something.
It tells us that CNN's can often be built before.
So look at this.
I mean, this is a funny example here with this looks like a raisin cookie or chocolate chip cookie,
you can be sure, but on a chihuahua face, and you can see this as they look quite similar.
We can tell the difference.
But a CNN may actually think it's the same class, either a chihuahua or a muffin, or whatever that
classes.
So similarly, you can do something called an adversarial attack where you just apply some noise to
the image so that the image looks like this.
You apply some random noise it and it effectively looks the same to the naked eye.
However, CNN is going to predict an entirely different class because all of these little pixels that
we pushed it to made it made the airline filters failing.
So there's that that that correspond to that alien class.
It made that CNN trigger and gave a higher probability for that, that this image of being illegal,
which is clearly wrong.
And then there's another way we can do it by pasting maybe a feature of another image or the entire
image itself into the scene so that it no longer predicts Bonano, which is clearly a banana.
That's a main focus.
It would never predict toaster, so it's not wrong that it's predicting twister, but you would want
it to be maybe 50-50 probability in this case.
So there's even something called a one pixel attack where just by changing one pixel here the image,
you can see the pixels that are quite small, but maybe you can see them.
But these are popular CNN architectures here, pre-trained models.
You can see that by changing at one pixel, it changes the category from ship to car and at a 99 percent
probability, which is not good.
Similarly, from horse to frog, that airplane.
So you can see what's going on here.
You can see that CNN's can be fooled based on how they live.
And our job as computer vision engineers or practitioners or deep learning experts is to basically make
models that are more resilient against these types of attacks.
So, so in the next section, we'll take a look at grad cam.
That's an algorithm that basically gives us a visual explanation of the areas of an image that the CNN
is responding to.
It uses something called gradient descent as well, which we've mentioned previously to do this.
So stay tuned.
I'll see you in the next section.
Thank you.