Path issues in google colab

1.9k Views Asked by At

I am having trouble getting google collab to accept a path I specified for a folder.

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

this is the output:

Meta  Meta.csv  output  Test  Test.csv  Train  Train.csv

so it is clearly getting the contents in the directory, but when I run this

NUM_CATEGORIES = len(os.listdir(train_path))
NUM_CATEGORIES

I get this error

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'

I have no clue why I am getting this problem as Train is a folder in Traffic_sign_classification. Does anyone know how to fix it?

0

There are 0 best solutions below