Why does pytorch dataloader add a "._" infront of some file names?

I am running a pretty basic model and loading the input data (images in this case ) using torchvision.datasets , I am facing an issue in that the script is somehow inserting a “._” as a prefix on some of the names of the image files . Does any body knows why or a workaround ?

    raise batch.exc_type(batch.exc_msg)                              [1/1927]
IOError: Traceback (most recent call last):
  File "/opt/conda/envs/pytorch-py27/lib/python2.7/site-packages/torch/utils$data/dataloader.py", line 40, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/opt/conda/envs/pytorch-py27/lib/python2.7/site-packages/torchvision$datasets/folder.py", line 116, in __getitem__
    img = self.loader(path)
  File "/opt/conda/envs/pytorch-py27/lib/python2.7/site-packages/torchvision$datasets/folder.py", line 63, in default_loader
    return pil_loader(path)
  File "/opt/conda/envs/pytorch-py27/lib/python2.7/site-packages/torchvision/
datasets/folder.py", line 45, in pil_loader
    with Image.open(f) as img:
  File "/opt/conda/envs/pytorch-py27/lib/python2.7/site-packages/PIL/Image.py
", line 2519, in open
    % (filename if filename else fp))
IOError: cannot identify image file <open file './anime-faces/aqua_eyes/._dan
booru_2559693_dc628b766d7142f2d2d9c75559e36eb5.jpg', mode 'rb' at 0x7f16dee79

1 Like

I’m facing the same problem, did you solve it?