Advertisement
Illuvitar

OSError: cannot identify image file <_io.BufferedReader name

Dec 17th, 2018
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.39 KB | None | 0 0
  1. ---------------------------------------------------------------------------
  2. OSError                                   Traceback (most recent call last)
  3. <ipython-input-18-b8aafda42618> in <module>()
  4.       8     epoch_examples = 0
  5.       9
  6. ---> 10     for images, labels in trainloader:
  7.      11         step += 1
  8.      12         print("Starting epoch {}, step {}".format(e+1, step))
  9.  
  10. /usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py in __next__(self)
  11.     613         if self.num_workers == 0:  # same-process loading
  12.     614             indices = next(self.sample_iter)  # may raise StopIteration
  13. --> 615             batch = self.collate_fn([self.dataset[i] for i in indices])
  14.     616             if self.pin_memory:
  15.     617                 batch = pin_memory_batch(batch)
  16.  
  17. /usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py in <listcomp>(.0)
  18.     613         if self.num_workers == 0:  # same-process loading
  19.     614             indices = next(self.sample_iter)  # may raise StopIteration
  20. --> 615             batch = self.collate_fn([self.dataset[i] for i in indices])
  21.     616             if self.pin_memory:
  22.     617                 batch = pin_memory_batch(batch)
  23.  
  24. /usr/local/lib/python3.6/dist-packages/torchvision/datasets/folder.py in __getitem__(self, index)
  25.      99         """
  26.    100         path, target = self.samples[index]
  27. --> 101         sample = self.loader(path)
  28.    102         if self.transform is not None:
  29.    103             sample = self.transform(sample)
  30.  
  31. /usr/local/lib/python3.6/dist-packages/torchvision/datasets/folder.py in default_loader(path)
  32.    145         return accimage_loader(path)
  33.    146     else:
  34. --> 147         return pil_loader(path)
  35.    148
  36.    149
  37.  
  38. /usr/local/lib/python3.6/dist-packages/torchvision/datasets/folder.py in pil_loader(path)
  39.    127     # open path as file to avoid ResourceWarning (https://github.com/python-pillow/Pillow/issues/835)
  40.    128     with open(path, 'rb') as f:
  41. --> 129         img = Image.open(f)
  42.    130         return img.convert('RGB')
  43.    131
  44.  
  45. /usr/local/lib/python3.6/dist-packages/PIL/Image.py in open(fp, mode)
  46.   2450         fp.close()
  47.   2451     raise IOError("cannot identify image file %r"
  48. -> 2452                   % (filename if filename else fp))
  49.   2453
  50.   2454 #
  51.  
  52. OSError: cannot identify image file <_io.BufferedReader name='flower_data/train/101/image_07973.jpg'>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement