yizt / Grad-CAM.pytorch

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

ValueError: operands could not be broadcast together with shapes (224,224,4) (3,) (224,224,4) #20

Open kunyaoli opened 4 years ago

kunyaoli commented 4 years ago

ValueError: operands could not be broadcast together with shapes (224,224,4) (3,) (224,224,4) 加载自己模型的报错,修改了get_net(net_name, weight_path=None)部分

kunyaoli commented 4 years ago

Traceback (most recent call last): File "E:/chrome下载/Grad-CAM.pytorch-master/Grad-CAM.pytorch-master/main.py", line 198, in main(arguments) File "E:/chrome下载/Grad-CAM.pytorch-master/Grad-CAM.pytorch-master/main.py", line 151, in main inputs = prepare_input(img) File "E:/chrome下载/Grad-CAM.pytorch-master/Grad-CAM.pytorch-master/main.py", line 90, in prepare_input image -= means ValueError: operands could not be broadcast together with shapes (224,224,4) (3,) (224,224,4)

kunyaoli commented 4 years ago

已经修改好了,主要是原图是采用的png格式存储。全部修改成jpg,就可以了。感谢大佬