Skip to main content

Class activation maps for your PyTorch CNN models

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torchcam-0.1.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torchcam-0.1.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file torchcam-0.1.1.tar.gz.

File metadata

  • Download URL: torchcam-0.1.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

File hashes

Hashes for torchcam-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4697f5f246ea84e574ad9f247c2d1341e18dfa7d8740f320c08a1dfd8d002263
MD5 5fdd84db13c67e19bde17f4dee1bccf1
BLAKE2b-256 532f35e021a6aa72bcefaed9bf848c634b9b00fb5b4c3c8576925cb5a1dde766

See more details on using hashes here.

File details

Details for the file torchcam-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: torchcam-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

File hashes

Hashes for torchcam-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b82e160167d6f374c87aa4f43ce43f25dabba13bc1f5a3ec4f72e2d1a668736d
MD5 dd089886b664f09a34cc8848eba0d87a
BLAKE2b-256 d350c9b06806ab8a4d72e00f6a21867ca62e939bb24127d60f2565f1955e235e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page