Skip to content
forked from frgfm/torch-cam

Class activation maps for your PyTorch models (CAM, Grad-CAM, Grad-CAM++, Smooth Grad-CAM++, Score-CAM)

License

Notifications You must be signed in to change notification settings

picEmily/torch-cam

 
 

Repository files navigation

Torchcam: class activation explorer

License Codacy Badge Build Status codecov Docs Pypi

Simple way to leverage the class-specific activation of convolutional layers in PyTorch.

gradcam_sample

Table of Contents

Getting started

Prerequisites

  • Python 3.6 (or more recent)
  • pip

Installation

You can install the package using pypi as follows:

pip install torchcam

or using conda:

conda install -c frgfm torchcam

Usage

You can find a detailed example below to retrieve the CAM of a specific class on a resnet architecture.

python scripts/cam_example.py --model resnet50 --class-idx 232

gradcam_sample

Technical roadmap

The project is currently under development, here are the objectives for the next releases:

  • Parallel CAMs: enable batch processing.
  • Benchmark: compare class activation map computations for different architectures.
  • Signature improvement: retrieve automatically the specific required layer names.
  • Refined RPN: create a region proposal network using CAM.
  • Task transfer: turn a well-trained classifier into an object detector.

Documentation

The full package documentation is available here for detailed specifications. The documentation was built with Sphinx using a theme provided by Read the Docs.

Contributing

Please refer to CONTRIBUTING if you wish to contribute to this project.

Credits

This project is developed and maintained by the repo owner, but the implementation was based on the following precious papers:

License

Distributed under the MIT License. See LICENSE for more information.

About

Class activation maps for your PyTorch models (CAM, Grad-CAM, Grad-CAM++, Smooth Grad-CAM++, Score-CAM)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%