[ECCV 2020] Learning Enriched Features for Real Image Restoration and Enhancement. SOTA results for image denoising, super-resolution, and image enhancement.
Other
667
stars
96
forks
source link
There is a question that the data processing of super-resolution and the data processing of Image denoising? #20
There is a question that the data processing of super-resolution and the data processing of Image denoising?
`##################################################################################################
class DataLoaderTrain(Dataset):
def init(self, rgb_dir, img_options=None, target_transform=None):
super(DataLoaderTrain, self).init()
self.target_transform = target_transform
clean_files = sorted(os.listdir(os.path.join(rgb_dir, 'groundtruth')))
noisy_files = sorted(os.listdir(os.path.join(rgb_dir, 'input')))
self.clean_filenames = [os.path.join(rgb_dir, 'groundtruth', x) for x in clean_files if is_png_file(x)]
self.noisy_filenames = [os.path.join(rgb_dir, 'input', x) for x in noisy_files if is_png_file(x)]
self.img_options = img_options
self.tar_size = len(self.clean_filenames) # get the size of target
def __len__(self):
return self.tar_size
def __getitem__(self, index):
tar_index = index % self.tar_size
clean = torch.from_numpy(np.float32(load_img(self.clean_filenames[tar_index])))
noisy = torch.from_numpy(np.float32(load_img(self.noisy_filenames[tar_index])))
clean = clean.permute(2,0,1)
noisy = noisy.permute(2,0,1)
clean_filename = os.path.split(self.clean_filenames[tar_index])[-1]
noisy_filename = os.path.split(self.noisy_filenames[tar_index])[-1]
#Crop Input and Target
ps = self.img_options['patch_size']
H = clean.shape[1]
W = clean.shape[2]
r = np.random.randint(0, H - ps)
c = np.random.randint(0, W - ps)
clean = clean[:, r:r + ps, c:c + ps]
noisy = noisy[:, r:r + ps, c:c + ps]
apply_trans = transforms_aug[random.getrandbits(3)]
clean = getattr(augment, apply_trans)(clean)
noisy = getattr(augment, apply_trans)(noisy)
return clean, noisy, clean_filename, noisy_filename`
There is a question that the data processing of super-resolution and the data processing of Image denoising? `################################################################################################## class DataLoaderTrain(Dataset): def init(self, rgb_dir, img_options=None, target_transform=None): super(DataLoaderTrain, self).init()