experiencor / deep-viz-keras

Implementations of some popular Saliency Maps in Keras
https://experiencor.github.io/cnn_visual.html
164 stars 31 forks source link

guided_grads_node error in GuidedBackprop class #1

Closed ndrmahmoudi closed 7 years ago

ndrmahmoudi commented 7 years ago

Hi,

Fist of all, thanks for this great package. I am trying to adapt these gradient functions for sentence classification deep models created by keras (you may see the code here). The saliency function works completely fine. However, when I modify the GuidedBackprop for my case, it gives the error below in : AttributeError: 'NoneType' object has no attribute 'outer_context' > <ipython-input-102-3cc50a22f302>(23)guided_backprop() 22 imported_x = guided_graph.get_tensor_by_name(loaded_model.layers[1].inbound_nodes[0].input_tensors[0].name) ---> 23 guided_grads_node = tf.gradients(imported_y, imported_x) 24 Do you thinks what is the reason for this error? Can you please help me to solve this issue?

As you may see, I just changed imported_x to be able to get tensor's real name (because otherwise, it gives another error which is ValueError: The name 'dropout_1' looks like an (invalid) Operation name, not a Tensor. Tensor names must be of the form "<op_name>:<output_index>".).

Regards, Nader

experiencor commented 7 years ago

Hi Nader, please let me know the full code to build the model that gives rise to this error. I'll give it a try to reproduce the error.

ndrmahmoudi commented 7 years ago

Please check your mailbox.

Thanks