本文整理汇总了Python中data.util.get_image_paths方法的典型用法代码示例。如果您正苦于以下问题:Python util.get_image_paths方法的具体用法?Python util.get_image_paths怎么用?Python util.get_image_paths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data.util
的用法示例。
在下文中一共展示了util.get_image_paths方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
def __init__(self, opt):
super(LRHRSeg_BG_Dataset, self).__init__()
self.opt = opt
self.paths_LR = None
self.paths_HR = None
self.paths_HR_bg = None # HR images for background scenes
self.LR_env = None # environment for lmdb
self.HR_env = None
self.HR_env_bg = None
# read image list from lmdb or image files
self.HR_env, self.paths_HR = util.get_image_paths(opt['data_type'], opt['dataroot_GT'])
self.LR_env, self.paths_LR = util.get_image_paths(opt['data_type'], opt['dataroot_LR'])
self.HR_env_bg, self.paths_HR_bg = util.get_image_paths(opt['data_type'],
opt['dataroot_GT_bg'])
assert self.paths_HR, 'Error: HR path is 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 = [1, 0.9, 0.8, 0.7, 0.6, 0.5]
self.ratio = 10 # 10 OST data samples and 1 DIV2K general data samples(background)
示例2: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
def __init__(self, opt):
super(LQGTDataset, self).__init__()
self.opt = opt
self.data_type = self.opt['data_type']
self.paths_LQ, self.paths_GT = None, None
self.sizes_LQ, self.sizes_GT = None, None
self.LQ_env, self.GT_env = None, None # environment for lmdb
self.paths_GT, self.sizes_GT = util.get_image_paths(self.data_type, opt['dataroot_GT'])
self.paths_LQ, self.sizes_LQ = util.get_image_paths(self.data_type, opt['dataroot_LQ'])
assert self.paths_GT, 'Error: GT path is empty.'
if self.paths_LQ and self.paths_GT:
assert len(self.paths_LQ) == len(
self.paths_GT
), 'GT and LQ datasets have different number of images - {}, {}.'.format(
len(self.paths_LQ), len(self.paths_GT))
self.random_scale_list = [1]
示例3: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
def __init__(self, opt):
super(LQDataset, self).__init__()
self.opt = opt
self.opt_P = opt
self.LR_paths = None
self.LR_sizes = None # environment for lmdb
self.LR_env = None
self.LR_size = opt['LR_size']
self.real_ker_path = '/mnt/yjchai/SR_data/Flickr2K/kermap.pt'
self.real_ker_map_list = util.load_ker_map_list(self.real_ker_path)
# read image list from lmdb or image files
if opt['data_type'] == 'lmdb':
self.LR_paths, self.LR_sizes = util.get_image_paths(opt['data_type'], opt['dataroot_LQ'])
elif opt['data_type'] == 'img':
self.LR_paths = util.get_image_paths(opt['data_type'], opt['dataroot_LQ']) #LR_list
else:
print('Error: data_type is not matched in Dataset')
assert self.LR_paths, 'Error: LR paths are empty.'
示例4: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
def __init__(self, opt, ker_map_list):
super(LQkerDataset, self).__init__()
self.opt = opt
self.opt_P = opt
self.opt_F = opt
self.LR_paths = None
self.LR_sizes = None # environment for lmdb
self.LR_env = None
self.LR_size = opt['LR_size']
self.ker_maps = ker_map_list
# read image list from lmdb or image files
if opt['data_type'] == 'lmdb':
self.LR_paths, self.LR_sizes = util.get_image_paths(opt['data_type'], opt['dataroot_LQ'])
elif opt['data_type'] == 'img':
self.LR_paths = util.get_image_paths(opt['data_type'], opt['dataroot_LQ']) #LR_list
else:
print('Error: data_type is not matched in Dataset')
assert self.LR_paths, 'Error: LR paths are empty.'
示例5: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
def __init__(self, opt):
super(LQGTKerDataset, self).__init__()
self.opt = opt
self.opt_F = opt
self.opt_P = opt
self.opt_C = opt
self.LR_paths, self.GT_paths = None, None
self.LR_env, self.GT_env = None, None # environment for lmdb
self.LR_size, self.GT_size = opt['LR_size'], opt['GT_size']
# read image list from lmdb or image files
if opt['data_type'] == 'lmdb':
self.LR_paths, self.LR_sizes = util.get_image_paths(opt['data_type'], opt['dataroot_LQ'])
self.GT_paths, self.GT_sizes = util.get_image_paths(opt['data_type'], opt['dataroot_GT'])
elif opt['data_type'] == 'img':
self.LR_paths = util.get_image_paths(opt['data_type'], opt['dataroot_LQ']) # LR list
self.GT_paths = util.get_image_paths(opt['data_type'], opt['dataroot_GT']) # GT list
else:
print('Error: data_type is not matched in Dataset')
assert self.GT_paths, 'Error: GT paths are empty.'
if self.LR_paths and self.GT_paths:
assert len(self.LR_paths) == len(self.GT_paths), 'GT and LR datasets have different number of images - {}, {}.'.format(len(self.LR_paths), len(self.GT_paths))
self.random_scale_list = [1]
示例6: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
def __init__(self, opt):
super(LQGTDataset, self).__init__()
self.opt = opt
self.data_type = self.opt['data_type']
self.paths_LQ, self.paths_GT = None, None
self.sizes_LQ, self.sizes_GT = None, None
self.LQ_env, self.GT_env = None, None # environments for lmdb
self.paths_GT, self.sizes_GT = util.get_image_paths(self.data_type, opt['dataroot_GT'])
self.paths_LQ, self.sizes_LQ = util.get_image_paths(self.data_type, opt['dataroot_LQ'])
assert self.paths_GT, 'Error: GT path is empty.'
if self.paths_LQ and self.paths_GT:
assert len(self.paths_LQ) == len(
self.paths_GT
), 'GT and LQ datasets have different number of images - {}, {}.'.format(
len(self.paths_LQ), len(self.paths_GT))
self.random_scale_list = [1]
示例7: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
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.'
示例8: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
def __init__(self, opt, ker_map_list, SR_img_list):
super(SRKerDataset, self).__init__()
self.opt = opt
self.opt_C = opt
self.LR_paths = None
self.LR_sizes = None # environment for lmdb
self.LR_env = None
self.LR_size = opt['LR_size']
self.SR_env = None
self.SR_img_list = SR_img_list
self.SR_size = opt['GT_size']
self.ker_map_list = ker_map_list
self.real_ker_path = '/mnt/yjchai/SR_data/Flickr2K/kermap.pt'
self.real_ker_map_list = util.load_ker_map_list(self.real_ker_path)
# read image list from lmdb or image files
#if opt['data_type'] == 'lmdb':
# self.LR_paths, self.LR_sizes = util.get_image_paths(opt['data_type'], opt['dataroot_LQ'])
#elif opt['data_type'] == 'img':
# self.LR_paths = util.get_image_paths(opt['data_type'], opt['dataroot_LQ']) #LR_list
#else:
# print('Error: data_type is not matched in Dataset')
#assert self.LR_paths, 'Error: LR paths are empty.'
示例9: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
def __init__(self, opt):
super(LQDataset, self).__init__()
self.opt = opt
self.paths_LQ, self.paths_GT = None, None
self.LQ_env = None # environment for lmdb
self.paths_LQ, self.sizes_LQ = util.get_image_paths(self.data_type, opt['dataroot_LQ'])
assert self.paths_LQ, 'Error: LQ paths are empty.'
示例10: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
def __init__(self, opt):
super(REDSDataset, self).__init__()
self.opt = opt
# temporal augmentation
self.interval_list = opt['interval_list']
self.random_reverse = opt['random_reverse']
logger.info('Temporal augmentation interval list: [{}], with random reverse is {}.'.format(
','.join(str(x) for x in opt['interval_list']), self.random_reverse))
self.half_N_frames = opt['N_frames'] // 2
self.GT_root, self.LQ_root = opt['dataroot_GT'], opt['dataroot_LQ']
self.data_type = self.opt['data_type']
self.LR_input = False if opt['GT_size'] == opt['LQ_size'] else True # low resolution inputs
#### directly load image keys
if self.data_type == 'lmdb':
self.paths_GT, _ = util.get_image_paths(self.data_type, opt['dataroot_GT'])
logger.info('Using lmdb meta info for cache keys.')
elif opt['cache_keys']:
logger.info('Using cache keys: {}'.format(opt['cache_keys']))
self.paths_GT = pickle.load(open(opt['cache_keys'], 'rb'))['keys']
else:
raise ValueError(
'Need to create cache keys (meta_info.pkl) by running [create_lmdb.py]')
# remove the REDS4 for testing
self.paths_GT = [
v for v in self.paths_GT if v.split('_')[0] not in ['000', '011', '015', '020']
]
assert self.paths_GT, 'Error: GT path is empty.'
if self.data_type == 'lmdb':
self.GT_env, self.LQ_env = None, None
elif self.data_type == 'mc': # memcached
self.mclient = None
elif self.data_type == 'img':
pass
else:
raise ValueError('Wrong data type: {}'.format(self.data_type))
示例11: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
def __init__(self, opt):
super(LQDataset, self).__init__()
self.opt = opt
self.data_type = self.opt['data_type']
self.paths_LQ, self.paths_GT = None, None
self.LQ_env = None # environment for lmdb
self.paths_LQ, self.sizes_LQ = util.get_image_paths(self.data_type, opt['dataroot_LQ'])
assert self.paths_LQ, 'Error: LQ paths are empty.'
示例12: __init__
# 需要导入模块: from data import util [as 别名]
# 或者: from data.util import get_image_paths [as 别名]
def __init__(self, opt):
super(Vimeo90KDataset, self).__init__()
self.opt = opt
# temporal augmentation
self.interval_list = opt['interval_list']
self.random_reverse = opt['random_reverse']
logger.info('Temporal augmentation interval list: [{}], with random reverse is {}.'.format(
','.join(str(x) for x in opt['interval_list']), self.random_reverse))
self.GT_root, self.LQ_root = opt['dataroot_GT'], opt['dataroot_LQ']
self.data_type = self.opt['data_type']
self.LR_input = False if opt['GT_size'] == opt['LQ_size'] else True # low resolution inputs
#### determine the LQ frame list
'''
N | frames
1 | 4
3 | 3,4,5
5 | 2,3,4,5,6
7 | 1,2,3,4,5,6,7
'''
self.LQ_frames_list = []
for i in range(opt['N_frames']):
self.LQ_frames_list.append(i + (9 - opt['N_frames']) // 2)
#### directly load image keys
if self.data_type == 'lmdb':
self.paths_GT, _ = util.get_image_paths(self.data_type, opt['dataroot_GT'])
logger.info('Using lmdb meta info for cache keys.')
elif opt['cache_keys']:
logger.info('Using cache keys: {}'.format(opt['cache_keys']))
self.paths_GT = pickle.load(open(opt['cache_keys'], 'rb'))['keys']
else:
raise ValueError(
'Need to create cache keys (meta_info.pkl) by running [create_lmdb.py]')
assert self.paths_GT, 'Error: GT path is empty.'
if self.data_type == 'lmdb':
self.GT_env, self.LQ_env = None, None
elif self.data_type == 'mc': # memcached
self.mclient = None
elif self.data_type == 'img':
pass
else:
raise ValueError('Wrong data type: {}'.format(self.data_type))