Class Activation Maps (CAM) is a powerful technique used in Computer Vision for classification tasks. It allows the scientist to inspect the image to be categorized and understand which parts/pixels of that image have contributed more to the final output of the model.
类激活图(CAM)是Computer Vision中用于分类任务的一项强大技术。 它使科学家可以检查要分类的图像,并了解该图像的哪些部分/像素为模型的最终输出做出了更大的贡献。
Basically, imagine we build a CNN with the goal of classifying people’s pictures into “Man” and “Woman”, then we feed it with a new picture and it returns the label “Man”. With the CAM tool, we would be able to see which parts of the picture activate the “Man” class the most. This can be very useful if we want to improve the accuracy of our model and have to understand which layers need to be modified, or whether we might want to differently pre-process the training set images.
基本上,假设我们构建了一个CNN ,目标是将人们的图片分为“男人”和“女人”,然后将其添加到新图片中,并返回标签“ Man”。 使用CAM工具,我们将能够看到图片中哪个部分最能激活 “ Man”类。 如果我们想提高模型的准确性,并且必须了解需要修改哪些图层,或者是否需要对训练集图像进行不同的预处理,那么这将非常有用。
In this article, I’m going to show you the idea behind this procedure. For this purpose, I will use a pre-trained CNN, Resnet50 (read the official paper here), using weights deriving from its training on the Imagenet dataset (you can read more about this dataset