遇到OSError:[Errno 5]输入/输出错误。阅读图像时

时间:2020-07-11 14:14:31

标签: python deep-learning pytorch python-imaging-library

我正在使用python训练我的模型,并在尝试转换特定图片时遇到此问题。该图片确实存在,可以通过PIL成功读取,但是在进行转换时将报告此错误。我不确定如何处理这种情况。

Traceback (most recent call last):
  File "/home/wangwenlong/文件保存/img_read.py", line 31, in <module>
    img = train_trans(img)
  File "/home/wangwenlong/anaconda3/envs/pt1.11/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 61, in __call__
    img = t(img)
  File "/home/wangwenlong/anaconda3/envs/pt1.11/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 196, in __call__
    return F.resize(img, self.size, self.interpolation)
  File "/home/wangwenlong/anaconda3/envs/pt1.11/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 246, in resize
    return img.resize(size[::-1], interpolation)
  File "/home/wangwenlong/anaconda3/envs/pt1.11/lib/python3.6/site-packages/PIL/Image.py", line 1817, in resize
    self.load()
  File "/home/wangwenlong/anaconda3/envs/pt1.11/lib/python3.6/site-packages/PIL/ImageFile.py", line 224, in load
    s = read(self.decodermaxblock)
  File "/home/wangwenlong/anaconda3/envs/pt1.11/lib/python3.6/site-packages/PIL/PngImagePlugin.py", line 668, in load_read
    return self.fp.read(read_bytes)
OSError: [Errno 5] Input/output error

0 个答案:

没有答案