input and output image shown as following


and my test code is
train_transform = transforms.Compose([
     transforms.RandomResizedCrop(224),
     transforms.RandomHorizontalFlip(),
     transforms.ToTensor(),
    ])
 a = SceneData(os.getcwd(), split='train',transform=train_transform)
 img, label = a[0]
 img = img.numpy().transpose(1,2,0)
 img = Image.fromarray(img, 'RGB')
 img.show()


the __getitem__() in dataset.py is
def __getitem__(self, index):
    file_id, category_id = self.all_data[index]
    img_path = osp.join(self.image_dir, self.split, file_id+'.jpg')
    
    try:
      img = Image.open(img_path)
    except Exception as e:
      raise e

    lbl = int(category_id)
    
    if img.mode == 'RGB':
      if self.transform:
        img = self.transform(img)
      return img, lbl

Anyone got the point to sovle it?