def __getitem__(self, index): orgData = utils.picCut( np.array(image.open(self.filepath[index]).convert('RGB')), config.crop_size_id) # RGB noiData = utils.addGaussianNoise(orgData, 1) return noiData.astype(np.float32).transpose( [2, 0, 1]) / 255 - 0.5, orgData.astype(np.float32).transpose( [2, 0, 1]) / 255 - 0.5
def __getitem__(self, index): cropSize = utils.sizeRecurrect(config.crop_size_esr, config.up_scale) hrPic = utils.picCut( np.array(image.open(self.filepath[index]).convert('RGB')), cropSize) lrPic = utils.resize( hrPic, (cropSize // config.up_scale, cropSize // config.up_scale)) return lrPic.astype(np.float32).transpose( [2, 0, 1]) / 255 - 0.5, hrPic.astype(np.float32).transpose( [2, 0, 1]) / 255 - 0.5