raghakot / keras-vis

Neural network visualization toolkit for keras
https://raghakot.github.io/keras-vis
MIT License
2.97k stars 664 forks source link

What about tensorflow 2.0? #173

Closed doantientai closed 4 years ago

doantientai commented 5 years ago

I am trying to visualize the saliency map of a model built with tensorflow 2.0 and I received the error below. From what I understand, the main reason is that the term placeholder does not exist anymore in TF2.0. What should I do?

My gist: https://gist.github.com/doantientai/7ad1aaa0f734fa2119d4a951fe3c35d1

Traceback (most recent call last): File "/media/tai/6TB/Projects/SaliencyMaps/SaliencyMaps.py", line 187, in <module> model = utils.apply_modifications(model) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/vis/utils/utils.py", line 124, in apply_modifications return load_model(model_path) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/engine/saving.py", line 419, in load_model model = _deserialize_model(f, custom_objects, compile) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/engine/saving.py", line 225, in _deserialize_model model = model_from_config(model_config, custom_objects=custom_objects) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/engine/saving.py", line 458, in model_from_config return deserialize(config, custom_objects=custom_objects) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/layers/__init__.py", line 55, in deserialize printable_module_name='layer') File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object list(custom_objects.items()))) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/engine/network.py", line 1022, in from_config process_layer(layer_data) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/engine/network.py", line 1008, in process_layer custom_objects=custom_objects) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/layers/__init__.py", line 55, in deserialize printable_module_name='layer') File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 147, in deserialize_keras_object return cls.from_config(config['config']) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/engine/base_layer.py", line 1109, in from_config return cls(**config) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/engine/input_layer.py", line 87, in __init__ name=self.name) File "/media/tai/6TB/VirtualEnvs/tf20alpha/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 517, in placeholder x = tf.placeholder(dtype, shape=shape, name=name) AttributeError: module 'tensorflow' has no attribute 'placeholder'

marcodelmoral commented 5 years ago

We need this on TF 2.0!

gndowns commented 5 years ago

@raghakot Do you have any plans for this?

dyoann commented 4 years ago

same here 👍

secutron commented 4 years ago

same here!!!

doantientai commented 4 years ago

There is another repo working on TF20. You may find it interesting. https://github.com/sicara/tf-explain

RomainCendre commented 4 years ago

There is another repo working on TF20. You may find it interesting. https://github.com/sicara/tf-explain

I found tf-explain quite limited compared to Keras-vis. I'm not saying is bad, but it seems that it never works on other networks except vgg16 for me Dis you have any feedbacks?