deep-learning-with-python-notebooks icon indicating copy to clipboard operation
deep-learning-with-python-notebooks copied to clipboard

5.2-using-convnets-with-small-datasets

Open mwddevcenter opened this issue 5 years ago • 5 comments

ImportError: Could not import PIL.Image. The use of array_to_img requires PIL. Assume the train_dir path is not correct. How can i fix it?

mwddevcenter avatar Dec 15 '18 16:12 mwddevcenter

I fixed it by install pillow lib, Thanks all. pip install pillow

mwddevcenter avatar Dec 15 '18 16:12 mwddevcenter

@mwddevcenter please close

morenoh149 avatar Dec 17 '18 18:12 morenoh149

I fixed it by install pillow lib, Thanks all. pip install pillow

I don't think it is the problem of his. I have the pillow pakege but still have this problem. I don't remember what I did for this problem. But now I don't have this error and came out to another error. Now sure if the new error was affected by this error.

AJFeng avatar May 23 '19 06:05 AJFeng

Suggestion: instead of using from keras.preprocessing import image, use:

import tensorflow as tf

load_img = tf.keras.utils.load_img
img_to_array = tf.keras.utils.img_to_array
array_to_img = tf.keras.utils.array_to_img

codekiln avatar Jul 10 '22 15:07 codekiln

YES!!! I have received your E-mail——Steven Lee

ifond avatar Jul 10 '22 15:07 ifond