Open mperini opened 4 years ago
Yes , I also encounter same issue but not sure what to do
I also encounter same issue
Same here...
same problem. it was ok a month ago.
any solution? :(
need help
This project seems to stale, see https://github.com/raghakot/keras-vis/issues/221#issuecomment-662279588
That's why people start to migrate to Pytorch
Any help?
This project seems to be stale, see #221 (comment)
Sorry for late reply.
Try this: pip install keras==2.2.2 & pip install tensorflow==1.10.0
Let me know, the solution worked or not
It is working now. Thanks, A lot!!!
It also works for me although I have to make some changes to my code. I also used Keras 2.2.2 with TensorFlow 2.0 and it was okay too. However, I moved my code to tf.keras and used the method provided in the official Keras documentation and it works like a charm:)
Sorry for late reply.
Try this: pip install keras==2.2.2 & pip install tensorflow==1.10.0
Let me know, the solution worked or not
It also works for me although I have to make some changes to my code. I also used Keras 2.2.2 with TensorFlow 2.0 and it was okay too. However, I moved my code to tf.keras and used the method provided in the official Keras documentation and it works like a charm:)
I also have save issue of can't import '_Conv', but my problem is not solved by Keras 2.2.2 and TensorFlow 2.0. Can you guide me further, what will be the solution without downgrading Tensorflow. Or can you kindly share your code and environment details.
_Conv method not available with later version keras 2.4, the way to solve this is use Conv2D API. You can update the saliency.py module as I did below
$ diff visualization/saliency.py visualization/saliency.py.org
5,6c5
< #from scipy.misc import imresize
< import cv2
---
> from scipy.misc import imresize
8,9c7,8
< from keras.layers.convolutional import Conv2D
< from keras.layers.pooling import MaxPooling1D, MaxPooling2D, AveragePooling1D, AveragePooling2D
---
> from keras.layers.convolutional import _Conv
> from keras.layers.pooling import _Pooling1D, _Pooling2D, _Pooling3D
32c31
< if isinstance(layer, (Conv2D, MaxPooling1D, MaxPooling2D, AveragePooling1D, AveragePooling2D)):
---
> if isinstance(layer, (_Conv, _Pooling1D, _Pooling2D, _Pooling3D)):
187,189c186
< #heatmap = imresize(heatmap, input_dims, interp='bicubic', mode='F')
< heatmap = cv2.resize(src=heatmap, dsize=input_dims,interpolation=cv2.INTER_CUBIC)
<
---
> heatmap = imresize(heatmap, input_dims, interp='bicubic', mode='F')
@jmajumde did you update your tensorflow_backend.py file as well?
@jmajumde did you update your tensorflow_backend.py file as well?
I am having the same problem and would like to ask the same question. Do I need to update tensorflow_backend.py @jmajumde ?
Try this: pip install keras==2.2.2 & pip install tensorflow==1.14.0
solved my issue... installed in Colab
try this:
my version, got from pip list
tensorflow 2.4.1
keras 2.4.3
keras-vis 0.5.0
change following lines in saliency.py
from Python38\Lib\site-packages\vis\visualization\
6 from keras.layers.convolutional import Conv2D
7 from keras.layers.pooling import MaxPooling1D, MaxPooling2D, AveragePooling1D, AveragePooling2D
and
33 if isinstance(layer, (Conv2D, MaxPooling1D, MaxPooling2D, AveragePooling1D, AveragePooling2D)):
still if you want to use functions like visualize_saliency
you may probably get other errors like keras.backend has no attribute identity
; which are really hard to solve with current versions of tensorflow and keras, at least I spent ~ 2h and in my case it doesn't worth anymore.
This lib is far behind the current changes, consider using tf_keras_vis or other visualization libs.
try this: my version, got from
pip list
tensorflow 2.4.1 keras 2.4.3 keras-vis 0.5.0change following lines in
saliency.py
fromPython38\Lib\site-packages\vis\visualization\
6 from keras.layers.convolutional import Conv2D
7 from keras.layers.pooling import MaxPooling1D, MaxPooling2D, AveragePooling1D, AveragePooling2D
and33 if isinstance(layer, (Conv2D, MaxPooling1D, MaxPooling2D, AveragePooling1D, AveragePooling2D)):
still if you want to use functions like
visualize_saliency
you may probably get other errors likekeras.backend has no attribute identity
; which are really hard to solve with current versions of tensorflow and keras, at least I spent ~ 2h and in my case it doesn't worth anymore.This lib is far behind the current changes, consider using tf_keras_vis or other visualization libs.
Yes, tf_keras_vis is great! Thanks for the suggestion
[x] Check that you are up-to-date with the master branch of keras-vis. You can update with: pip install git+git://github.com/raghakot/keras-vis.git --upgrade --no-deps
[x] If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
[ ] If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with: pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
[x] Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).
Hi, after a fresh installation of keras-vis using
pip install -U -I git+https://github.com/raghakot/keras-vis.git
I try to import Keras by runningimport keras
and encounter the following error:ImportError: cannot import name '_Conv' from 'keras.layers.convolutional'
.As backend for Keras I'm using Tensorflow version
2.2.0
. As far as I understood the_Conv
class is only available for older Tensorflow versions. I've tried to downgrade to Tensorflow 1.15.0, but then I encounter compatibility issues using Keras 2.0, as required by keras-vis.Has anybody else encountered this issue? Is there a workaround?