项目作者: nvs-abhilash

项目描述 :
Class Activation Mapping visulaization
高级语言: Python
项目地址: git://github.com/nvs-abhilash/CAM-keras.git
创建时间: 2018-06-12T19:48:01Z
项目社区:https://github.com/nvs-abhilash/CAM-keras

开源协议:MIT License

下载


Class Activation Mapping visulaization

Class Activation Mapping is a way to enables the convolutional neural network to have remarkable localization ability despite being trained on image-level labels. I use it to visualize what my model is looking in the images.

The theory is described here: http://cnnlocalization.csail.mit.edu/

The script cam_keras.py is the Keras implementation of Class Activation Mapping. It is based on this script in pytorch.

Installing Dependencies

This project depends on latest version of

  • tensorflow
  • pillow
  • opencv-python
  • numpy
  • requests

Do pip install <missing_package> to install whatever you don’t have. Using conda environment is recommended.

Running cam_keras

To get the output you have to run:

  1. python3 cam_keras.py

Note:

  1. To change the model, change the model_id in the script.
  2. The output image is stored in CAM.jpg.
  3. To change the input image, modify the IMG_URL in the script.

Example result

Input image

Input image

Output image

CAM image