Exemplo n.º 1
0
def create_dataset(dataset_opt):
    '''create dataset'''
    mode = dataset_opt['mode']
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR':
        from data.LRHR_dataset import LRHRDataset as D
    elif mode == 'LRHROTF':
        from data.LRHROTF_dataset import LRHRDataset as D
    elif mode == 'LRHRC':
        from data.LRHRC_dataset import LRHRDataset as D
    elif mode == 'LRHRseg_bg':
        from data.LRHR_seg_bg_dataset import LRHRSeg_BG_Dataset as D
    elif mode == 'VLRHR':
        from data.Vid_dataset import VidTrainsetLoader as D
    elif mode == 'VLR':
        from data.Vid_dataset import VidTestsetLoader as D
    elif mode == 'LRHRPBR':
        from data.LRHRPBR_dataset import LRHRDataset as D
    else:
        raise NotImplementedError(
            'Dataset [{:s}] is not recognized.'.format(mode))
    dataset = D(dataset_opt)
    logger = logging.getLogger('base')
    logger.info('Dataset [{:s} - {:s}] is created.'.format(
        dataset.__class__.__name__, dataset_opt['name']))
    return dataset
Exemplo n.º 2
0
def create_dataset(dataset_opt):
    mode = dataset_opt['mode']
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
        dataset = D(dataset_opt)
    elif mode == 'LQGT':
        from data.LQGT_dataset import LQGTDataset as D
        dataset = D(dataset_opt)
    # elif mode == 'LQGTseg_bg':
    #     from data.LQGT_seg_bg_dataset import LQGTSeg_BG_Dataset as D
    elif mode == 'yoon':
        if dataset_opt["phase"] == "train":
            from degradation_pair_data import DegradationParing as D
            hr_folder = dataset_opt["dataroot_GT"]
            kern_folder = dataset_opt["kernel_folder"]
            noise_folder = dataset_opt["noise_folder"]
            gt_patch_size = dataset_opt["GT_size"]
            scale_factor = 1 / dataset_opt["scale"]
            use_shuffle = dataset_opt["use_shuffle"]
            rgb = dataset_opt["color"] == "RGB"
            dataset = D(hr_folder,
                        kern_folder,
                        noise_folder,
                        scale_factor,
                        gt_patch_size,
                        permute=use_shuffle,
                        bgr2rgb=rgb)
        else:
            from degradation_pair_data import TestDataSR as D
            lr_folder = dataset_opt["dataroot_LQ"]
            gt_folder = dataset_opt["dataroot_GT"]
            use_shuffle = dataset_opt["use_shuffle"]
            rgb = dataset_opt["color"] == "RGB"
            dataset = D(lr_folder,
                        gt_folder,
                        "/mnt/data/NTIRE2020/realSR/track1/Corrupted-te-x",
                        permute=use_shuffle,
                        bgr2rgb=rgb)
    else:
        raise NotImplementedError(
            'Dataset [{:s}] is not recognized.'.format(mode))

    logger = logging.getLogger('base')
    logger.info('Dataset [{:s} - {:s}] is created.'.format(
        dataset.__class__.__name__, dataset_opt['name']))
    return dataset
Exemplo n.º 3
0
def create_dataset(dataset_opt, is_train=True):
    '''create dataset'''
    mode = dataset_opt['mode']
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR':
        from data.LRHR_dataset import LRHRDataset as D
    elif mode == 'RANK_IMIM_Pair':
        from data.Rank_IMIM_Pair_dataset import RANK_IMIM_Pair_Dataset as D
    else:
        raise NotImplementedError(
            'Dataset [{:s}] is not recognized.'.format(mode))
    if 'RANK_IMIM_Pair' in mode:
        dataset = D(dataset_opt, is_train=is_train)
    else:
        dataset = D(dataset_opt)
    logger = logging.getLogger('base')
    logger.info('Dataset [{:s} - {:s}] is created.'.format(
        dataset.__class__.__name__, dataset_opt['name']))
    return dataset
Exemplo n.º 4
0
def create_dataset(dataset_opt):
    mode = dataset_opt['mode'].upper()
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR':
        from data.LRHR_dataset import LRHRDataset as D
    else:
        raise NotImplementedError("Dataset [%s] is not recognized." % mode)
    dataset = D(dataset_opt)
    print('===> [%s] Dataset is created.' % (mode))
    return dataset
Exemplo n.º 5
0
def create_dataset(dataset_opt):
    mode = dataset_opt['mode']
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
    elif mode == 'LQGT':
        from data.LQGT_dataset import LQGTDataset as D
    else:
        raise NotImplementedError('Dataset [{:s}] is not recognized.'.format(mode))
    dataset = D(dataset_opt)

    logger = logging.getLogger('base')
    logger.info('Dataset [{:s} - {:s}] is created.'.format(dataset.__class__.__name__,
                                                           dataset_opt['name']))
    return dataset
Exemplo n.º 6
0
def create_dataset(dataset_opt):
    mode = dataset_opt['mode']
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR':
        from data.LRHR_dataset import LRHRDataset as D
    elif mode == 'LRHRseg_bg':
        from data.LRHR_seg_bg_dataset import LRHRSeg_BG_Dataset as D
    else:
        raise NotImplementedError("Dataset [%s] is not recognized." % mode)
    dataset = D(dataset_opt)
    print('Dataset [%s - %s] is created.' %
          (dataset.__class__.__name__, dataset_opt['name']))
    return dataset
Exemplo n.º 7
0
def create_dataset(dataset_opt):
    mode = dataset_opt['mode']
    if mode == 'LR': # Only LR images are provided
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR': # LR and target images are provided
        from data.LRHR_dataset import LRHRDataset as D
    elif mode == 'LRHR_four_levels': # LR, target with intermediate resolution images are provided
        from data.LRHR_four_levels_dataset import LRHRFourLevelsDataset as D
    else:
        raise NotImplementedError('Dataset [{:s}] is not recognized.'.format(mode))

    dataset = D(dataset_opt)
    print('Dataset [{:s} - {:s}] is created.'.format(dataset.__class__.__name__,
                                                     dataset_opt['name']))
    return dataset
Exemplo n.º 8
0
def create_dataset(dataset_opt):
    mode = dataset_opt['mode']
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR':
        from data.LRHR_dataset import LRHRDataset as D
    elif mode == 'LRHR_mid':
        from data.LRHR_mid_dataset import LRHRMidDataset as D
    else:
        raise NotImplementedError(
            'Dataset [{:s}] is not recognized.'.format(mode))
    dataset = D(dataset_opt)
    print('Dataset [{:s} - {:s}] is created.'.format(
        dataset.__class__.__name__, dataset_opt['name']))
    return dataset
Exemplo n.º 9
0
def create_dataset(dataset_opt, **kwargs):
    mode = dataset_opt['mode']
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR':
        from data.LRHR_dataset import LRHRDataset as D
    elif mode == 'LRHRseg_bg':
        from data.LRHR_seg_bg_dataset import LRHRSeg_BG_Dataset as D
    elif 'JPEG' in mode:
        from data.JPEG_dataset import JpegDataset as D
    else:
        raise NotImplementedError(
            'Dataset [{:s}] is not recognized.'.format(mode))
    dataset = D(dataset_opt, **kwargs)
    print('Dataset [{:s} - {:s}] is created.'.format(
        dataset.__class__.__name__, dataset_opt['name']))
    return dataset
Exemplo n.º 10
0
def _create_dataset(dataset_opt):
    mode = dataset_opt['mode']
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR':
        from data.LRHR_dataset import LRHRDataset as D
    elif mode == 'AB':
        from data.AB_dataset import ABDataset as D
    elif mode == 'ImgSyn_five_levels':
        from data.ImgSyn_five_levels_dataset import ImageLabelDatasetFiveLevels as D
    else:
        raise NotImplementedError(
            'Dataset [{:s}] is not recognized.'.format(mode))
    dataset = D(dataset_opt)
    print('Dataset [{:s} - {:s}] is created.'.format(
        dataset.__class__.__name__, dataset_opt['name']))
    return dataset
Exemplo n.º 11
0
def create_dataset(dataset_opt):
    '''create dataset'''
    mode = dataset_opt['mode']
    if mode == 'LR':  # for testing
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR':  # for training or validation
        from data.LRHR_dataset import LRHRDataset as D
    elif mode == 'MLRHR':  # for training or validation
        from data.MLRHR_dataset import MLRHRDataset as D
    else:
        raise NotImplementedError(
            'Dataset [{:s}] is not recognized.'.format(mode))

    dataset = D(dataset_opt)
    logger = logging.getLogger('base')
    logger.info('Dataset [{:s} - {:s}] is created.'.format(
        dataset.__class__.__name__, dataset_opt['name']))
    return dataset
Exemplo n.º 12
0
def create_dataset(dataset_opt):
    '''create dataset'''
    mode = dataset_opt['mode']
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR':
        from data.LRHR_dataset import LRHRDataset as D
    elif mode == 'LRHRseg_bg':
        from data.LRHR_seg_bg_dataset import LRHRSeg_BG_Dataset as D
    elif mode == 'dstl':
        from data.dstl_dataset.dataset_png import DstlDataset as D
    else:
        raise NotImplementedError(
            'Dataset [{:s}] is not recognized.'.format(mode))
    dataset = D(dataset_opt)
    logger = logging.getLogger('base')
    logger.info('Dataset [{:s} - {:s}] is created.'.format(
        dataset.__class__.__name__, dataset_opt['name']))
    return dataset
Exemplo n.º 13
0
def create_dataset(dataset_opt):
    mode = dataset_opt['mode'].upper()
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR':
        from data.LRHR_dataset import LRHRDataset as D
    elif mode == 'LRHR_LMDB':
        from data.LRHR_dataset import LRHRlmdbDatasetwithcoeff as D
    elif mode == 'LRHRSEG':
        from data.LRHR_seg_dataset import LRHRSegDataset as D
    elif mode == 'LRHR_H5':
        from data.LRHR_H5dataset import LRHRH5Dataset as D
    elif mode == 'LRHR_H5_M':
        from data.LRHR_H5dataset4memory import LRHRH5Dataset as D
    else:
        raise NotImplementedError("Dataset [%s] is not recognized." % mode)
    dataset = D(dataset_opt)
    print('Dataset [%s - %s] is created.' %
          (dataset.name(), dataset_opt['name']))
    return dataset
Exemplo n.º 14
0
def create_dataset(dataset_opt):
    '''create dataset'''
    mode = dataset_opt['mode']
    if mode == 'LR':
        from data.LR_dataset import LRDataset as D
    elif mode == 'LRHR':
        from data.LRHR_dataset import LRHRDataset as D
    elif mode == 'LRHR_Trans_Wavelet_GAN':
        from data.LRHR_Trans_Wavelet_GAN import LRHRTransWaveletGAN as D
    elif mode == 'LRHR_wavelet_unpair':
        from data.LRHR_wavelet_unpairMix_dataset import LRHR_wavelet_Mixunpair_Dataset as D
    elif mode == 'LRHR_wavelet_unpair_fake_real_w_EQ':
        from data.LRHR_wavelet_unpairEq_dataset import LRHR_wavelet_Equnpair_Dataset as D
    elif mode == 'LRHR_wavelet_unpair_fake_weights_EQ':
        from data.LRHR_wavelet_unpairEq_fake_w_dataset import LRHR_wavelet_Equnpair_Dataset as D
    else:
        raise NotImplementedError(
            'Dataset [{:s}] is not recognized.'.format(mode))
    dataset = D(dataset_opt)
    logger = logging.getLogger('base')
    logger.info('Dataset [{:s} - {:s}] is created.'.format(
        dataset.__class__.__name__, dataset_opt['name']))
    return dataset
Exemplo n.º 15
0
def create_dataset(dataset_opt):
    return D(dataset_opt)
Exemplo n.º 16
0
def create_dataset(dataset_opt):
    '''create dataset'''
    dataset = D(dataset_opt)
    return dataset