Closed MiriamHaegele closed 6 years ago
can you attach the notebook in which this issue occurs please? (drag-and-drop into your text input field)
via miriam
I can print the following layer names at line 90 in innvestigate.applications.mnist
for i in range(len(model.layers)): print(i, model.layers[i].name)
None
0 input_1
1 flatten_1
2 dense_1
3 dense_2
4 dense_3
5 dense_4
for i in range(len(model_w_sm.layers)): print(i, model.layers[i].name)
IndexError: list index out of range
0 input_1
1 flatten_1
2 dense_1
3 dense_2
4 dense_3
5 dense_4
So both models do not have any duplicate layer names. The layer name duplication preventing the training of patterns must happen after the model has been loaded.
Did not check the notebook yet
I have a notion what could be wrong. Could you please add how I can reproduce the error?
please see the attachment in https://github.com/albermax/innvestigate/issues/64#issuecomment-383132848
or, alternatively, checkout commit 282245b and run python3 examples/mnist_lrp.py
The file minst_lrp.py
will replace mnist_all_methods.py
(and change name) in a following commit, though. Would be nice if this works.
Fixed. Is a problem of Keras. I changed the names of the loaded layers.
If I use Sebastian's pretrained model, I get the following Error Message when it tries to compute the integrated gradients:
RuntimeError: ('The name "dense_1" is used 2 times in the model. All layer names should be unique. Layer names: ', ['input_1', 'flatten_1', 'dense_1', 'dense_2', 'dense_3', 'dense_4', 'greater_than_zero_1', 'greater_than_zero_2', 'greater_than_zero_3', 'greater_than_zero_4', 'as_float_x_1', 'dense_1', 'as_float_x_2', 'dense_2', 'as_float_x_3', 'dense_3', 'as_float_x_4', 'dense_4', 'transpose_1', 'transpose_2', 'multiply_1', 'ones_like_1', 'transpose_3', 'transpose_4', 'multiply_2', 'ones_like_2', 'transpose_5', 'transpose_6', 'multiply_3', 'ones_like_3', 'transpose_7', 'transpose_8', 'multiply_4', 'ones_like_4', 'dot_1', 'count_non_zero_1', 'dot_2', 'sum_3', 'sum_2', 'dot_3', 'count_non_zero_2', 'dot_4', 'sum_6', 'sum_5', 'dot_5', 'count_non_zero_3', 'dot_6', 'sum_9', 'sum_8', 'dot_7', 'count_non_zero_4', 'dot_8', 'sum_12', 'sum_11', 'safe_divide_1', 'safe_divide_2', 'safe_divide_3', 'safe_divide_4', 'safe_divide_5', 'safe_divide_6', 'safe_divide_7', 'safe_divide_8', 'safe_divide_9', 'safe_divide_10', 'safe_divide_11', 'safe_divide_12', 'running_means_1', 'running_means_3', 'running_means_2', 'running_means_4', 'running_means_6', 'running_means_5', 'running_means_7', 'running_means_9', 'running_means_8', 'running_means_10', 'running_means_12', 'running_means_11', 'average_1', 'average_2', 'average_3', 'average_4', 'sum_1', 'sum_4', 'sum_7', 'sum_10', 'sum_13', 'broadcast_1', 'broadcast_2', 'broadcast_3', 'broadcast_4'])