Batch must contain tensors, numpy arrays, numbers, dicts or lists; found <class 'NoneType'>

I am making use of DataLoader but it is giving me an error, I have attracted my code at this gist:- dataset.py · GitHub

You can check there, below is my folder directory:-


and going inside train folder:-

and going one of the folder inse train folder:-

I am debugging from hours, let me know if you can help me in this!!

I’ve looked over your code, but haven’t found anything at first glance. Only thing that comes to mind is if your loader is not actually accessing an image.

Did you check if your glob.glob is actually finding a filepath? It could return empty lists. If yes, check if your img_path = self.filenames[index] actually gets a correct file name.