You may refer to the implementation of ImageFolder

  
      github.com
  
  
    pytorch/vision/blob/master/torchvision/datasets/folder.py#L115-L122 46

Args:
    index (int): Index


Returns:
    tuple: (image, target) where target is class_index of the target class.
"""
path, target = self.imgs[index]
img = self.loader(path)



  
  
    
    
  
  


Here is pseudo code that may be helpful:
import torchvision as tv
class MyImageFoler(tv.datasets.ImageFolder):
    def __getitem__(self,index):
        origin_data = process(self.imgs[data])
        transoform_data = transform(origin_data)
        return origin_data,transoform_data,label

dataloader = Dataloader(MyImageFoler())
for origin_datas, transoform_datas, labels in dataloader:
    train()