I am trying to customize ImageFolder to return the image, category and sub-category names. Yet, here’s what worked for my case:
 def __getitem__(self, index):        
        return super(ImageFolder, self).__getitem__(index), self.imgs[index]

Are there any better ways?