Skip to content

Commit

Permalink
scale -> scales
Browse files Browse the repository at this point in the history
  • Loading branch information
innerlee committed Aug 11, 2021
1 parent 7013f70 commit 8d40b78
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tools/data/super-resolution/div2k/preprocess_div2k_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def main_extract_subimages(args):
A higher value means a smaller size and longer compression time.
Use 0 for faster CPU decompression. Default: 3, same in cv2.
scale (list[int]): The downsampling factors corresponding to the LR folders you want to process.
scales (list[int]): The downsampling factors corresponding to the
LR folders you want to process.
Default: [2, 3, 4].
input_folder (str): Path to the input folder.
save_folder (str): Path to save folder.
Expand All @@ -33,14 +34,16 @@ def main_extract_subimages(args):
Usage:
For each folder, run this script.
By default, there are four folders to be processed for DIV2K dataset according to scale factor list ([2,3,4])
By default, there are four folders to be processed for DIV2K dataset
according to scale factor list ([2,3,4])
DIV2K_train_HR
DIV2K_train_LR_bicubic/X2
DIV2K_train_LR_bicubic/X3
DIV2K_train_LR_bicubic/X4
After process, each sub_folder should have the same number of
subimages. You can also process a subset of folders by modifying the argument
'scale'. Remember to modify opt configurations according to your settings.
subimages. You can also specify scales by modifying the argument
'scales'. Remember to modify opt configurations according to your
settings.
"""

opt = {}
Expand All @@ -55,7 +58,7 @@ def main_extract_subimages(args):
opt['thresh_size'] = args.thresh_size
extract_subimages(opt)

for scale in args.scale:
for scale in args.scales:
opt['input_folder'] = osp.join(args.data_root,
f'DIV2K_train_LR_bicubic/X{scale}')
opt['save_folder'] = osp.join(args.data_root,
Expand Down Expand Up @@ -346,10 +349,8 @@ def parse_args():
description='Prepare DIV2K dataset',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--data-root', help='dataset root')
parser.add_argument('--scale',
nargs='*',
default=[2, 3, 4],
help='scale factor')
parser.add_argument(
'--scales', nargs='*', default=[2, 3, 4], help='scale factor list')
parser.add_argument(
'--crop-size',
nargs='?',
Expand Down

0 comments on commit 8d40b78

Please sign in to comment.