#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
Stars, last 29 weeks+377
10 Apr 2026: 12,626 stars17 Apr 2026: 12,654 stars24 Apr 2026: 12,683 stars1 May 2026: 12,699 stars8 May 2026: 12,709 stars15 May 2026: 12,722 stars22 May 2026: 12,740 stars29 May 2026: 12,763 stars5 Jun 2026: 12,778 stars12 Jun 2026: 12,797 stars19 Jun 2026: 12,810 stars26 Jun 2026: 12,831 stars3 Jul 2026: 12,842 stars10 Jul 2026: 12,859 stars17 Jul 2026: 12,868 stars24 Jul 2026: 12,879 stars31 Jul 2026: 12,897 stars7 Aug 2026: 12,905 stars14 Aug 2026: 12,916 stars21 Aug 2026: 12,926 stars28 Aug 2026: 12,931 stars4 Sept 2026: 12,937 stars11 Sept 2026: 12,943 stars18 Sept 2026: 12,954 stars25 Sept 2026: 12,961 stars2 Oct 2026: 12,972 stars9 Oct 2026: 12,981 stars16 Oct 2026: 12,991 stars23 Oct 2026: 12,993 stars30 Oct 2026: 13,003 stars

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
Also in ML frameworks and libraries
RankProjectScore
1pytorchPython tensor library with GPU support and tape-based autograd for deep learning105.1k starscustom license95 out of 100
2transformersPython library defining open models for text, vision, audio and multimodal tasks168.4k starsApache-2.094 out of 100
3ultralyticsPython library and CLI for training and running YOLO vision models63k starsAGPL-3.093 out of 100
#4pytorch-image-modelsPyTorch library of image models, pretrained weights and reference training scripts37.3k starsApache-2.093 out of 100
#5supervisionPython toolkit for loading, annotating and counting computer vision detections Live demo ↗ (opens in a new tab)51.4k starsMIT91 out of 100