zdaxie / PixPro

Propagate Yourself: Exploring Pixel-Level Consistency for Unsupervised Visual Representation Learning, CVPR 2021

Home Page:https://arxiv.org/abs/2011.10043

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PIL file open error

ramchandracheke opened this issue · comments

Hi,

Thank you for this amazing repo. I am trying to train a model. However, I am getting below error. It seems like, issue with PIL reader.

   data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/work/PixPro/contrast/data/dataset.py", line 261, in __getitem__
    image = self.loader(path)
  File "/work/PixPro/contrast/data/dataset.py", line 219, in default_img_loader
    return pil_loader(path)
  File "/work/PixPro/contrast/data/dataset.py", line 202, in pil_loader
    return img.convert('RGB')
  File "/home/users/conda/envs/PixPro/lib/python3.7/site-packages/PIL/Image.py", line 904, in convert
    self.load()
  File "/home/users/conda/envs/PixPro/lib/python3.7/site-packages/PIL/ImageFile.py", line 228, in load
    seek(offset)
ValueError: seek of closed file

I am using dual gpu setup and I have set the parameters accordingly.

Could you please help me?
Thanks

I also met this problem, and I solved it like this:
modified line 199 in dataset.py

with open(path, 'rb') as f:
      img = Image.open(f)

as
img = Image.open(path)

Thank you @xyl3902596 . That works. It would be great if these changes are made in main program.