yizt / Grad-CAM.pytorch

pytorch实现Grad-CAM和Grad-CAM++,可以可视化任意分类网络的Class Activation Map (CAM)图,包括自定义的网络;同时也实现了目标检测faster r-cnn和retinanet两个网络的CAM图;欢迎试用、关注并反馈问题...
Apache License 2.0
715 stars 166 forks source link

AttributeError: 'NoneType' object has no attribute 'zero_' #27

Closed Wiikk closed 3 years ago

Wiikk commented 3 years ago

Hi, thanks for sharing the code. I use Grad-CAM in my own classification model, but I got the following error and can't fix it. Could you please figure out the solutions? Thanks.

Traceback (most recent call last): File "/remote-home/my/Code/baseline/CAM_Visual.py", line 289, in main(config, args) File "/remote-home/my/Code/baseline/CAMVisual.py", line 252, in main inputs.grad.zero() # 梯度置零 AttributeError: 'NoneType' object has no attribute 'zero_'

bozai27 commented 3 years ago

hi, I had the same problem, How did you solve it?

kuyedie520 commented 3 years ago

这个问题怎么解决?