pytorch-cnn-visualizations icon indicating copy to clipboard operation
pytorch-cnn-visualizations copied to clipboard

GradCAM

Open rashhkk opened this issue 3 years ago • 0 comments

How to solve this kind of issue while using gradcam.py code? I am using ResNet152 architecture. Thank you.

Traceback (most recent call last): File "gradcam.py", line 112, in cam = grad_cam.generate_cam(prep_img, target_class) File "gradcam.py", line 63, in generate_cam conv_output, model_output = self.extractor.forward_pass(input_image) File "gradcam.py", line 42, in forward_pass conv_output, x = self.forward_pass_on_convolutions(x) File "gradcam.py", line 31, in forward_pass_on_convolutions x = module(x) # Forward File "C:\Users\Rashi\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "C:\Users\Rashi\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\linear.py", line 94, in forward return F.linear(input, self.weight, self.bias) File "C:\Users\Rashi\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\functional.py", line 1753, in linear return torch._C._nn.linear(input, weight, bias) RuntimeError: mat1 and mat2 shapes cannot be multiplied (2048x1 and 2048x2)

rashhkk avatar Sep 18 '22 03:09 rashhkk