Keras implementation of the VGG16-CAM model
Switch branches/tags
Nothing to show
Clone or download
Thibault de Boissiere
Thibault de Boissiere Update
Latest commit 9686911 Sep 13, 2016
Failed to load latest commit information. Update Sep 13, 2016 Update Sep 13, 2016
example_VGG16CAM1.png Add pictures Jul 8, 2016
example_VGG16CAM2.png Add pictures Jul 8, 2016

Implementation of the VGG-CAM model with keras


Original matlab implementation and paper here.


  • keras with theano backend (keras version 1.0.4 or later)
  • h5py
  • numpy
  • matplotlib
  • opencv3

External data

Download the keras vgg16 weights.


  1. Use the train_VGGCAM function to fine tune the VGG16 model on your data. You should write your own code to feed the data into the network.
  2. Use the plot_classmap function to then plot the class activation map on an image specified by its path.

Example plot

On the Kaggle StateFarm dataset:

Drive + Phone 1 Drive + Phone 2

The network is focusing on the cell phone the driver is holding, regardless of driver ID or hand position.