Solved by ptrblck in post #2 
              
              
                I’m not exactly sure, what your custom Dataset is doing, but based on the folder structure you have, you could probably just use torchvision.dataset.ImageFolder and pass the transformation to it. 
This will assign a class index to each folder. 
If you would like to stick to your custom Dataset, if s…