コード例 #1
0
    def __init__(self, args, train=True):
        super().__init__()
        self.args = args
        self.train = train
        self.dir_hr = join(args.dir_datasets + '/DIV2K/HR')
        self.dir_lr = [
            join(args.dir_datasets + '/DIV2K/LR/X' + str(scale))
            for scale in args.upscale
        ]

        self.n_train = args.n_train
        self.n_test = 20

        if train:
            self.images_hr = [
                entry.path for entry in scandir(self.dir_hr)
                if is_image_file(entry.name)
            ][:self.n_train]
        else:
            self.images_hr = [
                entry.path for entry in scandir(self.dir_hr)
                if is_image_file(entry.name)
            ][self.n_train:self.n_train + self.n_test]

        self.images_lr = self._get_lr()
コード例 #2
0
ファイル: trainset.py プロジェクト: colorjam/SR
 def __init__(self, args):
     super().__init__()
     self.args = args
     self.dir_hr = join(args.dir_datasets, args.data_train + '/HR')
     self.images_hr = [
         entry.path for entry in scandir(self.dir_hr)
         if is_image_file(entry.name)
     ]
コード例 #3
0
    def __init__(self, args):
        super().__init__()
        self.upscale = args.upscale

        self.dir_hr = join(args.dir_datasets, args.data_test + '/HR')
        self.dir_lr = [
            join(args.dir_datasets, args.data_test + '/LR/X' + str(scale))
            for scale in self.upscale
        ]
        self.images_hr = [
            entry.path for entry in scandir(self.dir_hr)
            if is_image_file(entry.name)
        ]
        self.images_lr = self._get_lr()
コード例 #4
0
    def __init__(self, opt):

        base_dir = opt.train_dir
        #self.use_npy = opt.use_npy

        #if self.use_npy:
        #    low_dir = os.path.join(base_dir, 'low.npy')
        #    high_dir = os.path.join(base_dir, 'low_avg.npy')
        low_dir = os.path.join(base_dir, 'Low')
        high_dir = os.path.join(base_dir, 'Low_avg')

        self.dsets = {}
        #if self.use_npy:
        #    self.dsets['low'] = np.load(low_dir)
        #    self.dsets['high'] = np.load(high_dir)

        self.dsets['low'] = [
            os.path.join(high_dir, x) for x in os.listdir(low_dir)
            if is_image_file(x)
        ]
        self.dsets['high'] = [
            os.path.join(high_dir, x) for x in os.listdir(high_dir)
            if is_image_file(x)
        ]
コード例 #5
0
ファイル: demo.py プロジェクト: colorjam/SR
 def __init__(self, args):
     super().__init__()
     self.args = args
     self.dir_demo = join(args.dir_datasets, args.data_test)
     self.images_demo = [entry.path for entry in scandir(self.dir_demo) if is_image_file(entry.name)]