pytorch-grad-cam

Advanced AI Explainability for computer vision. Support for CNNs, Vision Transformers, Classification, Object detection, Segmentation, Image similarity and mor

What is pytorch-grad-cam?

Advanced AI Explainability for computer vision. Support for CNNs, Vision Transformers, Classification, Object detection, Segmentation, Image similarity and more.

Overview of pytorch-grad-cam

What it is

pytorch-grad-cam is a PyTorch package for explainable AI in computer vision. It provides a collection of state-of-the-art pixel attribution methods to diagnose model predictions during development or production. The package supports CNNs, Vision Transformers, and tasks including classification, object detection, semantic segmentation, and embedding similarity. It also includes metrics to evaluate explanation trustworthiness and tune performance.

Key features

  • Comprehensive collection of pixel attribution methods for computer vision (GradCAM, HiResCAM, ScoreCAM, GradCAM++, AblationCAM, XGradCAM, EigenCAM, EigenGradCAM, LayerCAM, FullGrad, Deep Feature Factorizations, KPCA-CAM, FEM, ShapleyCAM, FinerCAM, SegEigenCAM, RefineCAM, SESS).
  • Tested on many common CNN networks and Vision Transformers.
  • Works with classification, object detection, semantic segmentation, embedding-similarity, and more.
  • Includes smoothing methods (aug_smooth, eigen_smooth) to improve CAM visual quality.
  • Full support for batches of images in all methods.
  • Includes metrics for checking explanation trustworthiness and tuning performance.

Use cases

  • Diagnosing why a model made a particular prediction (e.g., why an image is classified as 'pug' vs 'tabby cat').
  • Explaining object detection and semantic segmentation outputs.
  • Explaining similarity between images or embeddings.
  • Analyzing model behavior for research or debugging in production.

Getting started

bashpip install grad-camSee the repository README for detailed usage examples and documentation.

License and pricing

License: MIT. The package is open source.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/jacobgilpytorch-grad-cam.svg)](https://yunodb.com/tools/jacobgilpytorch-grad-cam?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/jacobgilpytorch-grad-cam?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/jacobgilpytorch-grad-cam.svg" alt="Featured on YunoDB" height="20"></a>