Implementation of the paper Learning Deep Features for Discriminative Localization.
Learn more about this paper and the original matlab implementation here.
Part of codes is based on VGG16CAM-keras. This repo implements VGG16-CAM model with keras in Theano backend.
- keras with tensorflow
- numpy
- matplotlib
- opencv-python
- scipy
View demo.py
.
First you need to convert your pretrained model to CAM-model. And then train the new model on your data. See the sample function train_cam_model
in demo.py
.
After trianning the CAM-model, you can use the input features of GAP layer and the weights of last classifier to generate final output. See the sample function plot_cam_map
in demo.py
.
Below image is from kaggle competition.