Hi guys,
I have been receiving the following errors when loading images with PIL.Image and could not find ways to solve them. Could anyone help me?
 for i, inputs in enumerate(data_loader):
  File "/homes/.local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 210, in __next__
    return self._process_next_batch(batch)
  File "/homes/.local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 230, in _process_next_batch
    raise batch.exc_type(batch.exc_msg)
IOError: Traceback (most recent call last):
  File "/homes/.local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 42, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/homes/my-project/utils/data/preprocessor.py", line 23, in __getitem__
    return self._get_single_item(indices)
  File "/homes/my-project/utils/data/preprocessor.py", line 30, in _get_single_item
    img = Image.open(fpath).convert('RGB')
  File "/homes/.local/lib/python2.7/site-packages/PIL/Image.py", line 2530, in open
    fp = builtins.open(filename, "rb")
IOError: [Errno 121] Remote I/O error: '/homes/my-project/images/571_02_0001.jpg'

The _get_single_item function in preprocessor.py looks like:
def _get_single_item(self, index):
        fpath, others = self.dataset[index]
        img = Image.open(fpath).convert('RGB')
        if self.transform is not None:
            img = self.transform(img)
        return img

I am sure there is no problem with those images that cause the errors, because I tried opening those images that caused the errors in an independent console and they can be successfully opened.