简体   繁体   中英

This error occurs when I use fit_generate method for my CNN model - “Could not import PIL.Image. The use of `array_to_img` requires PIL.”

from keras.models import Sequential
from keras.preprocessing.image import ImageDataGenerator
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
import tensorflow as tf

Compile

classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])

ERROR OCCURS WHEN I RUN THE BELOW LINE

**classifier.fit_generator(training_set,
steps_per_epoch = 8000,
epochs = 25,
validation_data = test_set,
validation_steps = 2000)**

错误快照

(For someone else's reference) Found the solution : Uninstall Anaconda and reinstall Anaconda3 = 1.6.2. Then install Theano + TensorFlow and Keras using anaconda-prompt commands.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM