Of course, as long as you write your own Dataset 36 which is very easy to implement. Then you can utilize the speedup of multiprocessing by using Dataloader 9
You may refer to Imagefolder 37 it’s a standard implementation of Dataset.

  
      github.com
  
  
    pytorch/vision/blob/master/torchvision/datasets/folder.py#L62-L91 94





def default_loader(path):
from torchvision import get_image_backend
if get_image_backend() == 'accimage':
    return accimage_loader(path)
else:
    return pil_loader(path)




class ImageFolder(data.Dataset):
"""A generic data loader where the images are arranged in this way: ::


    root/dog/xxx.png
    root/dog/xxy.png
    root/dog/xxz.png


    root/cat/123.png
    root/cat/nsdf3.png
    root/cat/asd932_.png


  This file has been truncated. show original