ImportError: cannot import name 'imresize' from 'scipy.misc' with keras-vis

Ask Questions Forum: ask Machine Learning Questions to our readersCategory: TensorFlow/KerasImportError: cannot import name 'imresize' from 'scipy.misc' with keras-vis
Chris Staff asked 1 month ago

I am getting the following ImportError when using the keras-vis package:


Traceback (most recent call last):
File "model_tv.py", line 74, in
from tf_keras_vis.visualization import visualize_activation
File "C:\Users\chris\Anaconda3\envs\tensorflow_gpu\lib\site-packages\vis\visualization\__init__.py", line 7, in
from .saliency import visualize_saliency_with_losses
File "C:\Users\chris\Anaconda3\envs\tensorflow_gpu\lib\site-packages\vis\visualization\saliency.py", line 5, in
from scipy.misc import imresize
ImportError: cannot import name 'imresize' from 'scipy.misc' (C:\Users\chris\Anaconda3\envs\tensorflow_gpu\lib\site-packages\scipy\misc\__init__.py)

What is the cause?

1 Answers
Best Answer
Chris Staff answered 1 month ago

This is caused by the fact that imresize has been deprecated from Scipy: https://github.com/scipy/scipy/releases/tag/v1.3.0rc1
The keras-vis package has simply not adapted yet. Since it last updated in April 2020, I’m not too confident that it will stay up to date with changes in TensorFlow. Haven’t made it work yet on my system. I recommend tf-keras-vis instead, which works with TensorFlow 2 based Keras.

Your Answer

10 + 1 =