机缘
只是不想光闷头在研究,为了能和别人分享研究。
收获
学会了如何写文章。
日常
一般自己的爱好,文章都写的很快。发现确实也可以将学习的东西发出来,正在计划。
成就
深度学习是使用 GoPro 数据集,因为文件夹结构复杂太难用,索性读取文本文件对。
def __init__(self, opt):
super(PairedImagePathTextDataset, self).__init__()
self.opt = opt
# file client (io backend)
self.file_client = None
self.io_backend_opt = opt['io_backend']
self.mean = opt['mean'] if 'mean' in opt else None
self.std = opt['std'] if 'std' in opt else None
# 改写成从文件中读取路径,加一个文件夹路径作为根路径
self.dataroot = opt['dataroot']
self.gt_folder, self.lq_folder = self.dataroot, self.dataroot
# 传入gt和lq的文件路径
self.gt_path_file = opt['gt_file']
self.lq_path_file = opt['lq_file']
# no tmpl
# noLMDB
self.paths = paired_paths_from_text([self.lq_path_file, self.gt_path_file], ['lq', 'gt'], self.dataroot)
def paired_paths_from_text(files, keys, dataroot):
"""Scan text to generate image path pairs.
Args:
files (list[str]): A list of text file path. The order of list should
keys (list[str]): A list of keys identifying folders. The order should
dataroot (str): Path to the root of data.
Returns:
dict: Image path pairs that contains lq path and gt path.
"""
assert len(files) == 2, ('The len of folders should be 2 with [input_files, gt_files]. ' f'But got {len(files)}')
assert len(keys) == 2, f'The len of keys should be 2 with [input_key, gt_key]. But got {len(keys)}'
input_file, gt_file = files
input_key, gt_key = keys
with open(input_file, 'r') as f:
input_paths = [osp.normpath(line.strip()) for line in f]
with open(gt_file, 'r') as f:
gt_paths = [osp.normpath(line.strip()) for line in f]
assert len(input_paths) == len(gt_paths), (f'{input_key} and {gt_key} datasets have different number of images: '
f'{len(input_paths)}, {len(gt_paths)}.')
paths = []
for input_path, gt_path in zip(input_paths, gt_paths):
input_path = osp.join(dataroot, input_path)
gt_path = osp.join(dataroot, gt_path)
paths.append(dict([(f'{input_key}_path', input_path), (f'{gt_key}_path', gt_path)]))
return paths
憧憬
正在学习:
- 硬件:嵌入式
- 软件:深度学习