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)

About

This is an implementation of: Score-CAM Improved Visual Explanations Via Score-Weighted Class Activation Mapping. [https://arxiv.org/abs/1910.01279]

BibTex reference:

@misc{wang2019scorecamimproved,
title={Score-CAM:Improved Visual Explanations Via Score-Weighted Class Activation Mapping},
author={Haofan Wang and Mengnan Du and Fan Yang and Zijian Zhang},
year={2019},
eprint={1910.01279},
archivePrefix={arXiv},
primaryClass={cs.CV}
}

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.

Usage

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)
scoreCAM.prepare_cam(img)
  • 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))

and

# 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:

cat_dog_3_heatmap

Project details


Download files

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

Source Distribution

scam-net-rewintous-0.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

scam_net_rewintous-0.0.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file scam-net-rewintous-0.0.1.tar.gz.

File metadata

  • Download URL: scam-net-rewintous-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9

File hashes

Hashes for scam-net-rewintous-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b713eca00ad3b997a6bada892e454000471b267c9caff855f4ba572a644c7eb6
MD5 dc3a6a781119a366cb2bacb7e5080fd7
BLAKE2b-256 31528eb140b204ccd3813d056c31361b5e0c5f3d763b33bef98535637e4ee6ad

See more details on using hashes here.

File details

Details for the file scam_net_rewintous-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: scam_net_rewintous-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9

File hashes

Hashes for scam_net_rewintous-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9bb2985a168f951a56bc9a69863bc3232a52ef6e91e2da7c87ffd104602f9a0b
MD5 c28d332e707105d523e2d6f9fbc99796
BLAKE2b-256 cb96be5fc1cc9cdebdc0a525bafca818d46343d9d720ee72f456e946ad8b6103

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page