Skip to content

YangYafei1998/CAM-pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pytorch-CAM

This repository is an implementation of Class Activation Mapping in PyTorch.

Class Activation Mapping (CAM)

Paper and Archiecture: Learning Deep Features for Discriminative Localization

Paper Author Implementation: metalbubble/CAM

We propose a technique for generating class activation maps using the global average pooling (GAP) in CNNs. A class activation map for a particular category indicates the discriminative image regions used by the CNN to identify that category. The procedure for generating these maps is illustrated as follows:



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.



Code Description

Usage: python3 main.py

Network: ResNet18, MobileNetV2

Data:

  • thress classes for test and training
  • classes = {0: 'CDRom', 1: 'HardDrive', 2: 'PowerSupply'}

Checkpoint

  • Checkpoint will be created in the checkpoint folder every ten epoch.
  • By setting RESUME = #, you can resume from checkpoint/#.pt.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages