Gradient Based Class Activation Maps for TensorFlow models.
Project description
cnncam
Introduction
An open python library for researchers and developers to generate GradCAM explanations for the tensorflow CNN models.
Other popular python ML frameworks will soon be supported by the cnn-cam library
Install
The below instructions assume you already have pip installed and exposed to the python environment where you want to run cnncam.
Official instructions for installing pip can be found here
Run the below pip command in a shell of your choice.
pip install cnncam
Demo
We currently support two ways of obtaining GradCAM heatmaps:
- Display heatmap. If you're only interested in seeing the heatmap images for your model's prediction, you can run the below script:
from cnncam import display_heatmap
display_heatmap(model=model, # your keras model
img=img, # your image
predicted_class=pred, # your models prediction for the image
layer_name='block5_conv3', # the layer you would like to see GradCAM for
alpha=0.6 # opacity of heatmap overlayed on image
)
See /examples for executable examples, including the above application of our implementation of GradCAM on VGG-16 with the ower of this repo's very cute cat, meso.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cnncam-1.0.0.tar.gz.
File metadata
- Download URL: cnncam-1.0.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08bdc65dc3069587fafa6ca9419496ef891b3f20cb5a329e3d27f34452fe7aea
|
|
| MD5 |
0ec20bb5e341e3de4b179659faa8e7af
|
|
| BLAKE2b-256 |
f8271d7e9843f5a85d0a5987f4da41a15a27e81c400f1f9d26d201685de78cb6
|
File details
Details for the file cnncam-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cnncam-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0d6da385a0d9dbf336ee0c352c5eaff16a62e35d75b8951af843258153dd261
|
|
| MD5 |
80014c45d70ce29256d7670de302ab98
|
|
| BLAKE2b-256 |
152a3b4cfa289534c247427e8bfb9083d80dc24798c5e79e81acf2628e1cde2d
|