#7373rd of 126 in ML frameworks and libraries
pytorch-grad-cam
PyTorch library of CAM methods for explaining vision model predictions
- Stars
- 13k
- License
- MIT
- Last commit
- Nov 2026
- Language
- Python
12,626 on 10 Apr 202613,003 on 30 Oct 2026
From GitHub's daily star counts.
Checked on GitHub.
Overview
pytorch-grad-cam implements pixel attribution methods such as GradCAM, HiResCAM, ScoreCAM, AblationCAM, LayerCAM and FullGrad for PyTorch vision models. It works with CNNs and vision transformers on classification, object detection, segmentation and embedding-similarity tasks, using a reshape transform and custom model targets. It also includes metrics such as ROAD and ARCC for checking explanation quality.
Who it is for: ML engineers and researchers debugging or benchmarking vision model explanations
Strengths
- Around 20 CAM methods behind one API, including gradient-free ones like AblationCAM and ScoreCAM
- Batch support in all methods; reshape_transform adapts it to ViT and Swin
- Built-in metrics (ROAD, ARCC) to evaluate and tune explanations
- Tutorials cover Faster-RCNN, YOLO5, segmentation, HuggingFace and embeddings
Weaknesses
- Vision only; no text or LLM explainability
- Target layer must be chosen manually per architecture
- aug_smooth multiplies run time by 6; ScoreCAM and AblationCAM need many forward passes
- No tagged releases; installed from PyPI as grad-cam
What it needs
- GPU optional
- Needs PyTorch, torchvision, OpenCV
- Models: ResNet, VGG, DenseNet, MobileNet, Vision Transformer
Quick answers
Is pytorch-grad-cam open source?
Yes. Its code is on GitHub under the MIT license.
Does pytorch-grad-cam need a GPU?
No. It runs on a CPU and can use a GPU when you have one.
Also in ML frameworks and libraries
See all 126| Rank | Project | Score |
|---|---|---|
| 1 | pytorchPython tensor library with GPU support and tape-based autograd for deep learning | 95 out of 100 |
| 2 | transformersPython library defining open models for text, vision, audio and multimodal tasks | 94 out of 100 |
| 3 | ultralyticsPython library and CLI for training and running YOLO vision models | 93 out of 100 |
| #4 | pytorch-image-modelsPyTorch library of image models, pretrained weights and reference training scripts | 93 out of 100 |
| #5 | supervisionPython toolkit for loading, annotating and counting computer vision detections | 91 out of 100 |