jacobgil / pytorch-grad-cam

Advanced AI Explainability for computer vision. Support for CNNs, Vision Transformers, Classification, Object detection, Segmentation, Image similarity and more.
https://jacobgil.github.io/pytorch-gradcam-book
MIT License
10.66k stars 1.56k forks source link

How to apply gradcam to binary classification #325

Closed LoveSiameseCat closed 2 years ago

LoveSiameseCat commented 2 years ago

If the network have only one output with a sigmoid

jacobgil commented 2 years ago

Use this as a target: https://github.com/jacobgil/pytorch-grad-cam/blob/master/pytorch_grad_cam/utils/model_targets.py#L26