lucidrains / lightweight-gan

Implementation of 'lightweight' GAN, proposed in ICLR 2021, in Pytorch. High resolution image generations that can be trained within a day or two
MIT License
1.62k stars 220 forks source link

PIL.UnidentifiedImageError exception handling for corrupted images #109

Open quickgrid opened 2 years ago

quickgrid commented 2 years ago

I tried training with cats and dogs dataset and got this error on an image after some progress in training,

PIL.UnidentifiedImageError: cannot identify image file '...\\Cat\\666.jpg'

Wondering if exception handling should be added at the cost of extra runtime overhead. This error was generated from,

https://github.com/lucidrains/lightweight-gan/blob/fce20938562a0cc289c915f7317722a8241abd37/lightweight_gan/lightweight_gan.py#L331

I found this same error with same dataset was mentioned here, https://discuss.pytorch.org/t/pil-unidentifiedimageerror-in-dataloader/73577,