ImageFolder vs custom dataset for image classification


I need to do image classifcation and also use the same images alsong with another sensor measurement into a lstm. Therefore, i have created my own custom dataset class following this tutorial
However, image classification by fine tuning image classifier models like resnet50, vgg19 etc does not perform well with custom dataset class. If i use ImageFolder , the classifier works well with accuracy above 95 %. Is there a way to use custom dataset class for image classification


ImageFolder or a custom Dataset are just two different ways to read the data from disk.
If you observe wildly different results when using one or the other, then there is a bug in some of the code.