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
9.91k stars 1.52k forks source link

Combining Grad-CAM with Guided Backpropagation #166

Closed Mshz2 closed 2 years ago

Mshz2 commented 2 years ago

Hi,

In the Readme you have shown the result of Combining Grad-CAM with Guided Backpropagation for the pug dog class. May I please as for the help how can I do the same in these lines?

cam = GradCAM(model=model, target_layers=target_layers, use_cuda=args.use_cuda) grayscale_cam = cam(input_tensor=input_tensor, target_category=target_category)

jacobgil commented 2 years ago

Hello, You have an example here: https://github.com/jacobgil/pytorch-grad-cam/blob/master/cam.py#L125