无法访问文件夹中存在的 Google Drive 上的图像文件

问题描述

我正在从 Google 云端硬盘读取数据

我的目录看起来像 /content/drive/My Drive/MScA Capstone/Classification

我执行以下操作:

# Appending all the image names to a list
img_files = [] 
for i in subset['image_id']:
  img_files.append(i)

# Pick an image
img_files[1]

图像存在,它给了我输出编号 bd37eea422f128f2c3ec6d8a2b9cdc06

与此编号相同的图像在 Google 驱动器上,我仔细检查过。

但是当我尝试打印它时,它没有弹出

# Define the path to train data
root = Path('train')
# Verify image exists
img1 = io.imread(root/img_files[1]) 
plt.imshow(img1)

Error: 
/usr/local/lib/python3.6/dist-packages/imageio/core/request.py in _parse_uri(self,uri)
271                 # Reading: check that the file exists (but is allowed a dir)
272                 if not os.path.exists(fn):
 --> 273                     raise FileNotFoundError("No such file: '%s'" % fn)
274             else:
275                 # Writing: check that the directory to write to does exist

FileNotFoundError: No such file: '/content/drive/My Drive/MScA 
Capstone/Classification/train/bd37eea422f128f2c3ec6d8a2b9cdc06'

路径看起来正确,图像在那里,import imageio as iofrom pathlib import Pathimport os 已安装。

该目录看起来也不错,因为 train 文件夹是 Classification 的子目录。

我错过了什么?谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)