我无法让 google collab 接受我为文件夹指定的路径。
data_dir = "/content/drive/MyDrive/Traffic_sign/TSF/Traffic_sign_classification"
!ls
train_path = 'Train'
test_path = 'Test'
# Resizing the images to 30x30x3
IMG_HEIGHT = 30
IMG_WIDTH = 30
channels = 3
这是输出:
Meta Meta.csv output Test Test.csv Train Train.csv
所以它显然是在目录中获取内容,但是当我运行它时
NUM_CATEGORIES = len(os.listdir(train_path))
NUM_CATEGORIES
我收到这个错误
NotADirectoryError Traceback (most recent call last)
<ipython-input-55-215493947f82> in <module>()
----> 1 NUM_CATEGORIES = len(os.listdir(train_path))
2 NUM_CATEGORIES
NotADirectoryError: [Errno 20] Not a directory: 'Train'
我不知道为什么会遇到这个问题,因为 Train 是 Traffic_sign_classification 中的一个文件夹。有谁知道如何修理它?