2018/05/24 Fix some errors in the codes, and try to reflect pytorch 0.4.0
Implementation of Learning Deep Features for Discriminative Localization(arxiv)
I used custom model with Global Average Pooling and Convolution(No FC). It was trained by using STL10 about 5000 images with 10 classes. To visualize much bigger image, I upsampled the data to 128x128(orginally 96x96). The model will be saved in 'model' folder.
To train a model
python train.py
if you want to use custom dataset, change codes in utils.py or train.py
To create CAM(it needs saved model)
python create_cam.py
it will generate CAM only randomly chosen one in the test dataset of STL10. if you want to create more than one, change codes in create_cam.py
Need opencv-python(cv2) and pytorch
pip install opencv-python
Codes of create_cam.py is influenced by https://github.com/metalbubble/CAM