Skip to main content

Score Weighted Class Activation Mapping. A tool for convolutional neural network activation analysis

Project description

Score-Weighted Class Activation Mapping (SCAM-NET)


This is an implementation of: Score-CAM Improved Visual Explanations Via Score-Weighted Class Activation Mapping. []

BibTex reference:

title={Score-CAM:Improved Visual Explanations Via Score-Weighted Class Activation Mapping},
author={Haofan Wang and Mengnan Du and Fan Yang and Zijian Zhang},

It is capable of postprocessing CNNs by taking its final output convolutional layer and softmax layer and generating spatial heatmap for the specified class. Regions with higher score correspond to the pixels with greater importance in classifying an image with a specific class.


To use ScoreCAM class with Keras is as easy as adding 2 calls:

from scam.keras import ScoreCAM
scoreCAM = ScoreCAM(model_input=model_input, last_conv_output=conv_layers, softmax_output=softmax_output, input_shape=input_shape)
  • model_input - is an input layer
  • conv_layers - last convolutional layer output
  • softmax_output - final classification layer output.
  • input_shape - expected image spatial dimensions (e.g. (224,224))


# return heatmap of the same size as image
heatmap = scoreCAM.get_class_heatmap(class_id)

Expected Output

The output is a heatmap which describes an importance of a class class_id with respect to pixel location. Below is the sample output for tiger_cat class:


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for scam-net-rewintous, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size scam_net_rewintous-0.0.1-py3-none-any.whl (9.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size scam-net-rewintous-0.0.1.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page