Torchcam: class activation explorer
Class activation maps for your PyTorch models (CAM, Grad-CAM, Grad-CAM++, Smooth Grad-CAM++, Score-CAM)
- Python 3.6 (or more recent)
You can install the package using pypi as follows:
pip install torchcam
or using conda:
conda install -c frgfm torchcam
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
The project is currently under development, here are the objectives for the next releases:
- [x] Parallel CAMs: enable batch processing.
- [x] 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.
Please refer to
CONTRIBUTING if you wish to contribute to this project.
Subscribe to Python Awesome
Get the latest posts delivered right to your inbox