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
  • 3,492
  • 3
  • 26
  • 37
arush1836
  • 1,327
  • 8
  • 19
  • 37

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
  • 3,492
  • 3
  • 26
  • 37