如何解决无法访问文件夹中存在的 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 io
、from pathlib import Path
和 import os
已安装。
该目录看起来也不错,因为 train
文件夹是 Classification
的子目录。
我错过了什么?谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。