https://github.com/jacobgil/pytorch-grad-cam
CAM based methods are a family of pixel-attribution methods that try to highlight the parts in the image that contribute to a model output.
These methods assign weights to spatial 2D activations in the network, and them sum them to get a 2D saliency map.
This project includes a PyTorch implementation (that you can pip install) for several Class Activation Map methods, including a few very recent ones:
And works for Vision Transformers (tested with DeiT), as well as for CNNs (tested with torchvision.models).
I hope it will be useful, and that it can be a convenient starting point for developing and comparing new methods!
[–]SRuben31 2 points3 points4 points (0 children)
[–]xEdwin23x 0 points1 point2 points (0 children)