jacobgil/keras-grad-cam

Can I "load_model"?

Yamadate opened this issue · 4 comments

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

Same issue on the Pytorch version:

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

IndexError: list index out of range

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

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.

可能为时已晚,但更改 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,请问应该怎样解决呢