def __init__(self, opt): super(LRHRDataset, self).__init__() # self.args = args self.opt = opt self.train = (opt['phase'] == 'train') self.split = 'train' if self.train else 'test' self.repeat = 1 # TODO # self.benchmark = benchmark self.scale = self.opt['scale'] self.idx_scale = 0 # read image list from lmdb or image files self.HR_env, self.paths_HR = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_HR']) self.LR_env, self.paths_LR = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_LR']) assert self.paths_HR, 'Error: HR paths are empty.' if self.paths_LR and self.paths_HR: assert len(self.paths_LR) == len(self.paths_HR), \ 'HR and LR datasets have different number of images - {}, {}.'.format(\ len(self.paths_LR), len(self.paths_HR)) # TODO: random_scale # self.random_scale_list = [1, 0.9, 0.8, 0.7, 0.6, 0.5] self.random_scale_list = None
def __init__(self, opt): super(LRHRlmdbDataset, self).__init__() self.opt = opt self.paths_LR = None self.paths_HR = None self.LR_env = None # environment for lmdb self.HR_env = None # read image list from subset list txt if opt['subset_file'] is not None and opt['phase'] == 'train': with open(opt['subset_file']) as f: self.paths_HR = sorted([os.path.join(opt['dataroot_HR'], line.rstrip('\n')) \ for line in f]) if opt['dataroot_LR'] is not None: raise NotImplementedError('Now subset only supports generating LR on-the-fly.') # read image list from lmdb or image files self.HR_env, self.paths_HR = common.get_image_paths(opt['data_type'], opt['dataroot_HR']) self.LR_env, self.paths_LR = common.get_image_paths(opt['data_type'], opt['dataroot_LR']) assert self.paths_HR, 'Error: HR paths are empty.' if self.paths_LR and self.paths_HR: assert len(self.paths_LR) == len(self.paths_HR), \ 'HR and LR datasets have different number of images - {}, {}.'.format( \ len(self.paths_LR), len(self.paths_HR)) self.random_scale_list = None
def __init__(self, opt): super(MLRMHRDataset, self).__init__() self.opt = opt self.train = (opt['phase'] == 'train') self.split = 'train' if self.train else 'test' self.scale = self.opt['scale'] self.paths_HR, self.paths_LR = [], [] # change the length of train dataset (influence the number of iterations in each epoch) self.repeat = 2 # read image list from image/binary files for scale in self.scale: paths_LR = common.get_image_paths( self.opt['data_type'], os.path.join(self.opt['dataroot_LR'], 'x' + str(scale))) paths_HR = common.get_image_paths( self.opt['data_type'], os.path.join(self.opt['dataroot_HR'], 'x' + str(scale))) assert paths_LR, '[Error] x%s LR paths are empty.' % scale assert paths_HR, '[Error] x%s LR paths are empty.' % scale assert len(paths_HR) == len(paths_LR), \ '[Error] x%s HR: [%d] and LR: [%d] have different number of images.' % ( scale, len(paths_HR), len(paths_LR)) self.paths_LR.append(paths_LR) self.paths_HR.append(paths_HR)
def __init__(self, opt): super(LRHRDataset, self).__init__() self.opt = opt self.train = (opt['phase'] == 'train') self.split = 'train' if self.train else 'test' self.scale = self.opt['scale'] self.paths_HR, self.paths_LR1, self.paths_LR2 = None, None, None # change the length of train dataset (influence the number of iterations in each epoch) self.repeat = 2 # read image list from image/binary files self.paths_HR = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_HR']) self.paths_LR1 = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_LR1']) self.paths_LR2 = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_LR2']) self.paths_LR3 = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_LR3']) assert self.paths_HR, '[Error] HR paths are empty.' if self.paths_LR1 and self.paths_LR2 and self.paths_LR3 and self.paths_HR: assert len(self.paths_LR1) == len(self.paths_HR) and len(self.paths_LR2) == len(self.paths_HR) and len(self.paths_LR3) == len(self.paths_HR), \ '[Error] HR: [%d], LR1: [%d], LR2: [%d], and LR3: [%d] have different number of images.'%( len(self.paths_HR), len(self.paths_LR1), len(self.paths_LR2), len(self.paths_LR3))
def __init__(self, opt): super(HRDataset, self).__init__() self.opt = opt self.train = (opt['phase'] == 'train') self.split = 'train' if self.train else 'test' self.scale = self.opt['scale'] self.paths_HR, self.paths_LR = None, None if self.train: self.lr_size = self.opt['LR_size'] self.hr_size = self.lr_size * self.scale # change the length of train dataset (influence the number of iterations in each epoch) self.repeat = 1 # read image list from image/binary files self.paths_HR = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_HR']) assert self.paths_HR, '[Error] HR paths are empty.' self.filters_path = opt['blur_kernel_path'] self.filter_bank = common.get_filters(self.filters_path) assert (len(self.filter_bank) > 0) self.n_filters = len(self.filter_bank) if opt['noise_patch_path']: self.paths_noise_patches = common.get_image_paths( self.opt['data_type'], self.opt['noise_patch_path']) self.n_noise_patches = len(self.paths_noise_patches) assert (self.n_noise_patches > 0) print("Number of noise patches = {}".format(self.n_noise_patches))
def __init__(self, opt): super(LRPANDataset, self).__init__() self.opt = opt self.scale = self.opt['scale'] self.paths_LR = None # read image list from image/binary files self.paths_LR = common.get_image_paths(opt['data_type'], opt['dataroot_LR']) self.paths_PAN = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_PAN']) assert self.paths_LR and len(self.paths_PAN)==len(self.paths_LR), '[Error] LR paths are empty.'
def __init__(self, opt): super(IRVISCoGAN_dataset, self).__init__() # self.args = args self.opt = opt self.train = (opt['phase'] == 'train') self.split = 'train' if self.train else 'test' self.repeat = 1 # read image list from lmdb or image files self.VIS_env, self.paths_VIS = common.get_image_paths( self.opt['data_type'], self.opt['dataroot_VI']) self.IR_env, self.paths_IR = common.get_image_paths( self.opt['data_type'], self.opt['dataroot_IR']) self.FUS_env, self.paths_PF = common.get_image_paths( self.opt['data_type'], self.opt['dataroot_PF'])
def __init__(self, opt): super(LRDataset, self).__init__() self.opt = opt self.paths_LR = None self.LR_env = None # environment for lmdb # read image list from lmdb or image files self.LR_env, self.paths_LR = util.get_image_paths( opt['data_type'], opt['dataroot_LR']) assert self.paths_LR, 'Error: LR paths are empty.'
def __init__(self, opt): super(LRHRSegDataset, self).__init__() self.opt = opt self.paths_LR = None self.paths_HR = None self.LR_env = None # environment for lmdb self.HR_env = None # read image list from lmdb or image files self.HR_env, self.paths_HR = util.get_image_paths(opt['data_type'], opt['dataroot_HR']) self.LR_env, self.paths_LR = util.get_image_paths(opt['data_type'], opt['dataroot_LR']) assert self.paths_HR, 'Error: HR paths are empty.' if self.paths_LR and self.paths_HR: assert len(self.paths_LR) == len(self.paths_HR), \ 'HR and LR datasets have different number of images - {}, {}.'.format(\ len(self.paths_LR), len(self.paths_HR)) # randomly scale list self.random_scale_list = [1, 0.9, 0.8, 0.7, 0.6, 0.5]
def __init__(self, opt): super(LRHRDataset, self).__init__() self.opt = opt self.msx2 = True if 'MSX2' in opt['dataroot_LRPAN'] else False self.train = ('train' in opt['phase']) self.split = 'train' if self.train else 'test' self.scale = self.opt['scale'] self.paths_HR, self.paths_LR = None, None # change the length of train dataset (influence the number of iterations in each epoch) self.repeat = 2 # read image list from image/binary files self.paths_HR = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_HR'], opt['subset']) self.paths_LR = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_LR'], opt['subset']) self.paths_PAN = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_PAN'], opt['subset']) self.paths_LRPAN = common.get_image_paths(self.opt['data_type'], self.opt['dataroot_LRPAN'], opt['subset']) assert self.paths_HR, '[Error] HR paths are empty.' if self.paths_LR and self.paths_HR: assert len(self.paths_LR) == len(self.paths_HR), \ '[Error] HR: [%d] and LR: [%d] have different number of images.'%( len(self.paths_LR), len(self.paths_HR))