Closed hasibzunair closed 6 years ago
Please let's me know the versions of Keras, Tensorflow and Keras-vis.
Keras 2.2.0 Tensorflow 1.8 Keras-vis 0.4.1
Resloved!
Thanks to Keisen.
Run: pip install git+https://github.com/raghakot/keras-vis.git@137f268b77f40a12d373db17da74dcc9fe759680
The above code has not fixed my issues.
Error info: File "/home/celine/.environments/tensorflow_new/lib/python3.5/site-packages/vis/visualization/saliency.py", line 125, in visualize_saliency return visualize_saliency_with_losses(model.input, losses, seed_input, grad_modifier) File "/home/celine/.environments/tensorflow_new/lib/python3.5/site-packages/vis/visualization/saliency.py", line 73, in visualize_saliency_with_losses grads = opt.minimize(seed_input=seed_input, max_iter=1, grad_modifier=grad_modifier, verbose=False)[1] File "/home/celine/.environments/tensorflow_new/lib/python3.5/site-packages/vis/optimizer.py", line 143, in minimize computed_values = self.compute_fn([seed_input, 0]) File "/home/celine/.environments/tensorflow_new/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2661, in call return self._call(inputs) File "/home/celine/.environments/tensorflow_new/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2630, in _call session) File "/home/celine/.environments/tensorflow_new/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2582, in _make_callable callable_fn = session._make_callable_from_options(callable_opts) File "/home/celine/.environments/tensorflow_new/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1480, in _make_callable_from_options return BaseSession._Callable(self, callable_options) File "/home/celine/.environments/tensorflow_new/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1441, in init session._session, options_ptr, status) File "/home/celine/.environments/tensorflow_new/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 519, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: img_tensor_2:0 is both fed and fetched. Exception ignored in: <bound method BaseSession._Callable.del of <tensorflow.python.client.session.BaseSession._Callable object at 0x7fa93b44d588>> Traceback (most recent call last): File "/home/celine/.environments/tensorflow_new/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1464, in del self._session._session, self._handle, status) File "/home/celine/.environments/tensorflow_new/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 519, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: No such callable handle: 1225037744
@celinew1221 please check the version of your packages
I am ending up with the same error.
Keras: 2.2.0 Tensorflow: 1.8.0 Keras-vis: 0.4.1
When I install the library as mentioned in this comment, I get the error:
File "visualization.py", line 15, in <module>
grads = visualize_saliency(model, layer_idx, filter_indices=5, seed_input=img)
File "/usr/local/lib/python3.5/dist-packages/vis/visualization/saliency.py", line 125, in visualize_saliency
return visualize_saliency_with_losses(model.input, losses, seed_input, grad_modifier)
File "/usr/local/lib/python3.5/dist-packages/vis/visualization/saliency.py", line 73, in visualize_saliency_with_losses
grads = opt.minimize(seed_input=seed_input, max_iter=1, grad_modifier=grad_modifier, verbose=False)[1]
File "/usr/local/lib/python3.5/dist-packages/vis/optimizer.py", line 143, in minimize
computed_values = self.compute_fn([seed_input, 0])
File "/usr/local/lib/python3.5/dist-packages/keras/backend/tensorflow_backend.py", line 2661, in __call__
return self._call(inputs)
File "/usr/local/lib/python3.5/dist-packages/keras/backend/tensorflow_backend.py", line 2630, in _call
session)
File "/usr/local/lib/python3.5/dist-packages/keras/backend/tensorflow_backend.py", line 2582, in _make_callable
callable_fn = session._make_callable_from_options(callable_opts)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1480, in _make_callable_from_options
return BaseSession._Callable(self, callable_options)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1441, in __init__
session._session, options_ptr, status)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py", line 519, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: input_1:0 is both fed and fetched.
Exception ignored in: <bound method BaseSession._Callable.__del__ of <tensorflow.python.client.session.BaseSession._Callable object at 0x7fe5a4a31e48>>
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1464, in __del__
self._session._session, self._handle, status)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py", line 519, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: No such callable handle: 140624093988304
Exception ignored in: <bound method BaseSession.__del__ of <tensorflow.python.client.session.Session object at 0x7fe59f8c4d30>>
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 707, in __del__
TypeError: 'NoneType' object is not callable
Hi, @aakaashjois . This issue was fixed by PR #120 .
Please look a part of your stack trace,
computed_values = self.compute_fn([seed_input, 0])
is in optimizer.py
, line 143.
File "/usr/local/lib/python3.5/dist-packages/vis/optimizer.py", line 143, in minimize
computed_values = self.compute_fn([seed_input, 0])
But, In the currently master branch, It is in optimizer.py
, line 152.
So It have possible that keras-vis version is old in your environment.
Please retry pip install git+https://github.com/raghakot/keras-vis.git
.
Thanks.
If you're having this issue because your input layer is fed directly into the output layer, simply add an intermediate Lambda layer to solve the problem.
This generates the error:
input_stuff = Input(...)
model = Model(input_stuff, output_stuff)
This works perfectly:
input_stuff = Input(...)
dummy_layer = Lambda(lambda x: x)(input_stuff)
model = Model(dummy_layer, output_stuff)
pip install git+https://github.com/raghakot/keras-vis.git can solve the problem
https://github.com/raghakot/keras-vis/blob/master/examples/vggnet/activation_maximization.ipynb
The above code is showing this error when i try to run it