charlesCXK / CAM-pytorch

CAM algorithm implemented by python3 and pytorch 0.4.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I. Introduction

Use pytorch 0.4.0 and python3 to implemennt CAM (class avtivation mapping). Just a simple lab, acting on cifar-10 dataset.

Click here for more


II. Usage

$ python3 cam.py

And the result will be saved in directory res.


III. Description for packages and files.

— 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.


V. To do

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.

About

CAM algorithm implemented by python3 and pytorch 0.4.0


Languages

Language:Python 100.0%