Use pytorch 0.4.0 and python3 to implemennt CAM (class avtivation mapping). Just a simple lab, acting on cifar-10 dataset.
$ python3 cam.py
And the result will be saved in directory res.
— res/ —
A directory where the results are placed.
— cifar-10-batches-py/ —
Cifar-10 data set
— cam.py —
Run and save the result of CAM method.
— train.py —
Train the net I defined with 20 epoches and SGD.
— params.pkl —
Model-state saved by pytorch.
IV. Result
Some of the results are shown below. White regions are what we interested in.
Use larger dataset, for now, the size of feature map before GAP layer is only 8*8, and I resize it to 224*224. There must be much loss of information during this process.