我打算从Keras教程项目中的tflean数据集中导入牛津花。它下载了图像(下载时,它显示一条消息:该计算机不支持curses(请安装/重新安装curses以获取最佳体验)) 但是在开始解析图像后,它立即显示“停止迭代”错误。
我已经尝试过重新安装tensorflow和tflearn API并将其升级到最新版本。我仍然看到相同的错误。我正在使用Jupyter笔记本电脑环境和Anaconda。
这是我的代码:
import numpy as np
np.random.seed(42)
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D
from keras.layers.normalization import BatchNormalization
import tflearn.datasets.oxflower17 as oxflower17
X, Y= oxflower17.load_data(one_hot=True)
它应该已经解析了图像,但显示了这一点:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
d:\ProgramData\Anaconda3\lib\site-packages\tflearn\data_utils.py in build_image_dataset_from_dir(directory, dataset_file, resize, convert_gray, filetypes, shuffle_data, categorical_Y)
593 try:
--> 594 X, Y = pickle.load(open(dataset_file, 'rb'))
595 except Exception:
FileNotFoundError: [Errno 2] No such file or directory: '17flowers\\17flowers.pkl'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
d:\ProgramData\Anaconda3\lib\site-packages\tflearn\data_utils.py in directory_to_samples(directory, flags, filter_channel)
729 try: # Python 2
--> 730 classes = sorted(os.walk(directory).next()[1])
731 except Exception: # Python 3
AttributeError: 'generator' object has no attribute 'next'
During handling of the above exception, another exception occurred:
StopIteration Traceback (most recent call last)
<ipython-input-4-13aafefe0bb6> in <module>
1 import tflearn.datasets.oxflower17 as oxflower17
----> 2 X, Y= oxflower17.load_data(one_hot=True)
d:\ProgramData\Anaconda3\lib\site-packages\tflearn\datasets\oxflower17.py in load_data(dirname, resize_pics, shuffle, one_hot)
32 convert_gray=False,
33 shuffle_data=shuffle,
---> 34 categorical_Y=one_hot)
35
36 return X, Y
d:\ProgramData\Anaconda3\lib\site-packages\tflearn\data_utils.py in build_image_dataset_from_dir(directory, dataset_file, resize, convert_gray, filetypes, shuffle_data, categorical_Y)
594 X, Y = pickle.load(open(dataset_file, 'rb'))
595 except Exception:
--> 596 X, Y = image_dirs_to_samples(directory, resize, convert_gray, filetypes)
597 if categorical_Y:
598 Y = to_categorical(Y, np.max(Y) + 1) # First class is '0'
d:\ProgramData\Anaconda3\lib\site-packages\tflearn\data_utils.py in image_dirs_to_samples(directory, resize, convert_gray, filetypes)
573 if filetypes:
574 if filetypes not in [list, tuple]: filetypes = list(filetypes)
--> 575 samples, targets = directory_to_samples(directory, flags=filetypes)
576 for i, s in enumerate(samples):
577 samples[i] = load_image(s)
d:\ProgramData\Anaconda3\lib\site-packages\tflearn\data_utils.py in directory_to_samples(directory, flags, filter_channel)
730 classes = sorted(os.walk(directory).next()[1])
731 except Exception: # Python 3
--> 732 classes = sorted(os.walk(directory).__next__()[1])
733 for c in classes:
734 c_dir = os.path.join(directory, c)
StopIteration: