github.com
  
  
    chenyuntc/scene-baseline/blob/f40173e732c1df876d5934c1d7f2141fc44fce13/dataset.py#L34-L45 69

def __getitem__(self,index):
    img_path = os.path.join(self.path,self.imgs[index])
    img = load(img_path)
    img = self.transforms(img)
    return img,self.labels[index],self.imgs[index]


def train(self):
    data = self.datas['train']
    self.imgs,self.labels = data['ids'],data['labels']
    self.path = self.opt.train_dir
    self.transforms = self.train_transforms
    return self



  
  
    
    
  
  


This maybe helpful.