jacobgil / keras-grad-cam

An implementation of Grad-CAM with keras
MIT License
657 stars 237 forks source link

Can I "load_model"? #10

Open Yamadate opened 7 years ago

Yamadate commented 7 years ago

Thank you for your great code! I'm trying to use it for other keras classifier models. However, I got an error shown below with other models than VGG16 as it is. How can I load model and weights? Is it possible to use "load_model"?

IndexError: list index out of range

Duanxuxxx commented 5 years ago

Same issue on the Pytorch version:

grads_val = self.extractor.get_gradients()[-1].cpu().data.numpy()

IndexError: list index out of range

leanderme commented 4 years ago

Probably too late, but change l.name is layer_name to l.name == layer_name:

conv_output =  [l for l in model.layers if l.name == layer_name][0].output
ttppss commented 3 years ago

Same issue on the Pytorch version:

grads_val = self.extractor.get_gradients()[-1].cpu().data.numpy()

IndexError: list index out of range

Hi,

Have you found the solution?

Thanks.

wjlhahaha commented 1 week ago

可能为时已晚,但更改 l.name layer_name l.name == layer_name:

conv_output =  [l for l in model.layers if l.name == layer_name][0].output

您好按照您发的代码修改后仍然报错: conv_output = [l for l in model.layers if l.name == layer_name][0].output IndexError: list index out of range,请问应该怎样解决呢