使用 google colab 读取 Google dirve 文件时出现输入/输出错误

ran*_*ndc 5 python google-colaboratory

我正在用 colab 训练我的模型。当我使用 colab 中的枚举函数迭代 Google Drive 上的训练数据时,我不止一次遇到此错误。错误发生的时间不确定。该错误可能是在训练几个时期之后发生的,也可能是在几次迭代中发生的。

我尝试修改Google Drive中数据集的路径,或者减小batchsize,这些都没有效果。

   192     batch_time = AverageMeter()
   193     losses = AverageMeter()
--> 194     for i, sample in enumerate(train_loader):
   195         start = time.time()
   196         input = sample['image'].cuda()
Run Code Online (Sandbox Code Playgroud)
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2530, in open
    fp = builtins.open(filename, "rb")
OSError: [Errno 5] Input/output error: './nyud_cropped/train_labels/001187.png'
Run Code Online (Sandbox Code Playgroud)

Bob*_*ith 3

我的建议是在训练之前首先将数据从 Drive 复制到临时虚拟机。这也可能会加快速度。