Hi when I am trying to run a code in keras it is showing me the following error:
from keras.utils.visualize_util import plot
ImportError: No module named 'keras.utils.visualize_util'
How can I solve this? thanks
Use
from keras.utils import plot_model
instead
Tensorflow 2:
from tensorflow.keras.utils import plot_model
You will have to either fix the code manually, or downgrade Keras.
By looking at the commit history of that module, you can see that it was renamed on February 28, 2017 from visualize_util
to vis_utils
. The plot
function was also renamed to plot_model
.
You will have to update the code to reflect these changes, or use a proper Keras version where the code you are using was developed or tested.
Instead of using this:
from tensorflow.keras.utils.np_utils import to_categorical
Use this instead:
from tensorflow.python.keras.utils.np_utils import to_categorical
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With