I am doing noise restoration, I have 1 set of images for input and one set of images for labels, but when I augment the data with pytorch, when I visualize a batch, the images and labels are different, although it is still the same image but if i do the crop it will be two different areas which is not what i really want.

image1214×472 208 KB

class GAN_DATASET(Dataset):
  def __init__(self, ImageFolder, LabelFolder, data_transforms):
    self.transforms = data_transforms
    self.list_image = []
    self.list_label = []
    for i in os.listdir(ImageFolder):
      self.list_image.append(i)

    for i in os.listdir(LabelFolder):
      self.list_label.append(i)

    self.root_hazy_image = os.path.join(ImageFolder)
    self.root_hazy_label = os.path.join(LabelFolder)
    self.file_len = len(self.list_image)

  def __getitem__(self, index, is_train=True):
      hazy = Image.open(self.root_hazy_image + self.list_image[index])
      hazy = self.transforms(hazy)
      
      label = Image.open(self.root_hazy_label + self.list_label[index])
      label = self.transforms(label)
      
      name = self.list_image[index]
      return hazy,label,name
  def __len__(self):
      return self.file_len