4

I am trying to load some data from google drive to my colab notebook, but I am getting an empty list.

Code:

from google.colab import drive
drive.mount('/content/drive')

import glob
import os

test_path = '/content/gdrive/My Drive/ML/data/cifar-100/test'

#path = os.path.join(test_path, 'class1', '*.jpg')
#path = os.path.join(test_path, 'class1', '*g')
path = os.path.join(test_path, 'class1', '*.*')

files = glob.glob(path)
len(files)

Output: 0

Data

enter image description here

enter image description here

Can anybody tell me why it’s not loading, everything seems to be fine

CodeIt
  • 2,882
  • 3
  • 19
  • 33
arush1836
  • 795
  • 2
  • 12
  • 26

1 Answers1

2

You have mounted your drive to /content/drive but in your test path you are using /content/gdrive which will not work. You need to use /content/drive/My drive/...

test_path = '/content/drive/My Drive/ML/data/cifar-100/test'

See here for more info.

Hope it helps!

CodeIt
  • 2,882
  • 3
  • 19
  • 33