PIL file open error
ramchandracheke opened this issue · comments
RamchandraCheke commented
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
xyl3902596 commented
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)
RamchandraCheke commented
Thank you @xyl3902596 . That works. It would be great if these changes are made in main program.