This repository uses Class Activation Mapping on diffusion MRI data, implemented in PyTorch.
Paper and Archiecture: Learning Deep Features for Discriminative Localization
Paper Author Implementation: metalbubble/CAM
Class activation maps could be used to intepret the prediction decision made by the CNN. The left image below shows the class activation map of top 5 predictions respectively, you can see that the CNN is triggered by different semantic regions of the image for different predictions. The right image below shows the CNN learns to localize the common visual patterns for the same object class.
Dependancies: pytorch-gpu, dipy.
Usage: first, set parameters in 'utils.py' accordingly.
Then, run
python3 main.py
Network: VGG, GoogLeNet, AlexNet, Inception V3
Data: HCP life span dataset.
- Download the zipped files and upzip them.
- Preprocess using 'data.py', to create slices.
- Divde the total dataset into train group and test group. As you do that, [images must be arranged in this way][4]:
../DATA/HCP/16x3_slice/train/old/*.png ../DATA/HCP/16x3_slice/test/young/*.png
Checkpoint
- Checkpoint will be created in the checkpoint folder every ten epoch.
- By setting
RESUME = #
, you can resume fromcheckpoint/$ModelN$#.pt
.
Visualization
run tensorboard --logdir runs/
to visualize in browser.