StopIteration:无法导入PIL.Image.使用array_to_img需要PIL错误 [英] StopIteration: Could not import PIL.Image. The use of `array_to_img` requires PIL error
本文介绍了StopIteration:无法导入PIL.Image.使用array_to_img需要PIL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
import keras
Using TensorFlow backend.
from keras.preprocessing.image import ImageDataGenerator
train_datagen = ImageDataGenerator(
rescale=1./255,
shear_range=0.2,
zoom_range=0.2,
horizontal_flip=True)
test_datagen = ImageDataGenerator(rescale=1./255)
training_set = train_datagen.flow_from_directory(
'E:/Python/A-
Z/Convolutional_Neural_Networks/dataset/training_set',
target_size=(64, 64),
batch_size=32,
class_mode='binary')
test_set = test_datagen.flow_from_directory(
'E:/Python/A-
Z/Convolutional_Neural_Networks/dataset/test_set',
target_size=(64, 64),
batch_size=32,
class_mode='binary')
classifier.fit_generator(
training_set,
steps_per_epoch=8000,
epochs=25,
validation_data=test_set,
validation_steps=2000)
请帮助我是这个CNN的初学者,我正在使用keras对任务进行编程,但是出现上述错误(标题中给出) 我尝试安装然后卸载枕头 但是没有任何工作,它显示了相同的错误,我也尝试了其他一些StackOverflow答案,但是它们也没有工作
please help I am a beginner in this CNN I am using keras to program the task but I am getting the above error(given in the title) I have tried installing and then uninstalling pillow but nothing working it is showing the same error I have also tried some other StackOverflow answers but they are also not working
推荐答案
我遇到了与您相同的错误. 这是我的环境: 我在anaconda中创建"tensorflow" env,使用python 3.6内核,激活env,然后
I came the same error as you. this is my environment: I create "tensorflow" env in anaconda, python 3.6 kernel,activate the env, then
pip install tensorflow
pip install keras
pip install pillow
并且错误已修复.
这篇关于StopIteration:无法导入PIL.Image.使用array_to_img需要PIL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文