在训练和测试数据集中加载图像时获得权限被拒绝

时间:2019-02-07 04:13:38

标签: python tensorflow image-processing machine-learning keras

我正在尝试在x_train中加载图像,但是却出现了一个没有此权限的错误。

import keras
import tensorflow as tf

train_path = open('C:/Users/dwika/Desktop/catdog/data/train', 'rb')
x_train = []
test_path = open('C:/Users/dwika/Desktop/catdog/data/test', 'rb')
x_test = []

for img in train_path:
    img_path = train_path + img
    x = keras.preprocessing.image.load_img(img_path)
    x_train.append(x)

for img in test_path:
    img_path = test_path + img
    x = keras.preprocessing.image.load_img(img_path)
    x_test.append(x)

我遇到这种错误。

 Using TensorFlow backend.
 Traceback (most recent call last):
 File "C:/Users/dwika/Desktop/catdog/catdog.py", line 4, in <module>
 train_path = open('C:/Users/dwika/Desktop/catdog/data/train', 'rb')
 PermissionError: [Errno 13] Permission denied:'C:/Users/dwika/Desktop/catdog/data/train'

0 个答案:

没有答案