How to make a dataloader with a directory of subfolders relevant to each class

I have a dataset that contains images of brain tumoursl. I want to make a CNN to classify these images.What I have seen is a directory of images which is separated in “train” , “test” folders.

However, in this case, the dataset directory structure is as follows.

Now, I want to make 3 dataloaders. ( a train_dataloader,a validation_dataloader & a test_dataloader.)
Does anyone know how to do this in PyTorch.

You could use the torchvision.datasets.ImageFolder class for the datasets, create the splits via, and wrap them in DataLoaders.