Я пытался загрузить данные изображения, но мне не удалось с ошибкой:
FileNotFoundError: [WinError 3] The system cannot find the path specified:
Код такой, как показано ниже.
def load_data():
datasets = ['seg_train/seg_train', 'seg_test/seg_test']
size = (150,150)
output = []
for dataset in datasets:
directory =
"D:/Hoin/Desktop/호준폴더/Python/Data/intel-image-classification/" + dataset
images = []
labels = []
for folder in os.listdir(directory):
curr_label = class_names_label[folder]
for file in os.listdir(directory + "/" + folder):
img_path = directory + "/" + folder + "/" + file
curr_img = cv2.imread(img_path)
curr_img = cv2.resize(curr_img, size)
images.append(curr_img)
labels.append(curr_label)
images, labels = shuffle(images, labels) ### Shuffle the data !!!
images = np.array(images, dtype = 'float32') ### Our images
labels = np.array(labels, dtype = 'int32') ### From 0 to
num_classes-1!
output.append((images, labels))
return output
(train_images, train_labels), (test_images, test_labels) = load_data()
, тогда я получаю
Traceback (most recent call last):
File "<ipython-input-59-bdc5f874dbf6>", line 1, in <module>
(train_images, train_labels), (test_images, test_labels) = load_data()
File "<ipython-input-58-23e2daec9c02>", line 15, in load_data
for folder in os.listdir(directory):
FileNotFoundError: [WinError 3] 지정된 경로를 찾을 수 없습니다:
'D:/Hoin/Desktop/호준폴더/Python/Data/intel-image-classification/seg_train/seg_train'
(this means ''FileNotFoundError: [WinError 3] The system cannot find the path specified:')
Я не знаю, как решить эту проблему. Я использую windows
версию anaconda
.
Может кто-нибудь помочь мне в этом? Спасибо.