Loading Image datasets in custom data loader

Hello
I read up the pytorch tutorials on custom dataloaders but most of them are written considering the dataset is in a csv format.
I found a few datasets like Leed Sports Database.They just have images in zip file as data and visualized folder.I do not understand how to load these in a custom dataloader.Same goes for MNIST and FashionMNIST.I found their ubyte files on their website but i have totally no clue on how to access them via the customdataloader.
Can anyone explain this in more detail,I am not familiar with all python commands so it might be possible i am missing out an obvious command for this thati should be knowing

If the dataset has images in folders/directories corresponding to classes, it might map nicely to an ImageFolder:
ImageFolder — Torchvision main documentation (pytorch.org)

1 Like

Try torchvision .

torchvision.datasets.FashionMNIST
torchvision.datasets.MNIST
LSP(Leed Sports Pose) Dataset

1 Like

Thanks i understood it

The leed sports database looks very complicated to understand.The dataset on ther website has images,visualized and a mat file.Are the training and test samples in the mat file?
Can you give a small summary of what to do when doing it with a customdataloader

class CustomDataset(Dataset):
    def __init__(self, some_args):
        # We can do anything here. For example:
        # 1. list files
        # 2. load all data (not recommended for big data)
        # 3. define transforms
        # ... 
    
    def __getitem__(self, item):
        # load one sample, apply transforms, return image, and label 

    def __len__(self):
        # return len(data)

Here are some examples:

1 Like

Thanks i will try to experiment writing it and figure it out