简体   繁体   English

无法在Colaboratory中加载Google云端硬盘中的数据

[英]Trouble loading data from Google Drive in Colaboratory

I am trying to load some data from google drive to my colab notebook, but I am getting an empty list. 我正在尝试将一些数据从谷歌驱动器加载到我的colab笔记本,但我得到一个空列表。

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 输出 :0

Data 数据

在此输入图像描述

在此输入图像描述

Can anybody tell me why it's not loading, everything seems to be fine 任何人都可以告诉我它为什么不加载,一切似乎都没问题

You have mounted your drive to /content/drive but in your test path you are using /content/gdrive which will not work. 您已将驱动器安装到/content/drive但在测试路径中使用的是/content/gdrive ,这将无效。 You need to use /content/drive/My drive/... 你需要使用/content/drive/My drive/...

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

See here for more info. 有关详细信息,请参见此处

Hope it helps! 希望能帮助到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM