pytorch-grad-cam icon indicating copy to clipboard operation
pytorch-grad-cam copied to clipboard

Problem EigenCAM for YOLO5

Open MattBlue92 opened this issue 1 year ago • 3 comments

Hi there! Hello everyone! I am trying to use grad-cam with Yolov5. I've done some experimenting and if I run the notebook using the default code found at https://jacobgil.github.io/pytorch-gradcam-book/EigenCAM%20for%20YOLO5.html everything works. The problem comes when I try to load a yolov5 custum model and with custom weights, basically if I run these 2 instructions:

cam = EigenCAM(model, target_layers, use_cuda=False) grayscale_cam = cam(tensor)[0, :, :]

the python interpreter tells me AttributeError: 'tuple' object has no attribute 'cpu'

Someone can help me?

MattBlue92 avatar Mar 20 '23 18:03 MattBlue92

I got the same problem. Have you fix this ?

JunKaiLiao avatar Jun 09 '23 07:06 JunKaiLiao

I also encountered this problem. Do you find a solution or alternative?

ZhangHaoyou avatar Apr 28 '24 11:04 ZhangHaoyou

I have found a solution to this problem. We have to modify the pytorch_grad_cam original scripts.

ZhangHaoyou avatar Apr 28 '24 12:04 ZhangHaoyou