0% found this document useful (0 votes)
34 views

Keras Import Module Error Fix

The document provides fixes for two common errors when importing Keras modules, suggesting using TensorFlow versions of image and models imports instead of the plain Keras versions.

Uploaded by

ela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Keras Import Module Error Fix

The document provides fixes for two common errors when importing Keras modules, suggesting using TensorFlow versions of image and models imports instead of the plain Keras versions.

Uploaded by

ela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

If you are getting any of these errors, please use the following fix:

1) For "ImportError: cannot import name 'image' from 'keras.preprocessing'", please


use:

---------------------------------------------------------------

import tensorflow as tf

tf.keras.preprocessing.image.img_to_array()

instead of:

image.img_to_array() use

2)For error "ModuleNotFoundError: No module named keras.models," please use:

-----------------------------------------------------

from tensorflow.keras.models import

instead of:

from keras.models import

You might also like