From 188de5e15ac047a5834d89248aa8bf44feac1a46 Mon Sep 17 00:00:00 2001 From: James Betker Date: Sat, 4 Jul 2020 13:22:50 -0600 Subject: [PATCH] Misc changes --- codes/data_scripts/extract_subimages.py | 12 ++++++------ codes/train.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/codes/data_scripts/extract_subimages.py b/codes/data_scripts/extract_subimages.py index eac70f06..8a3e2f74 100644 --- a/codes/data_scripts/extract_subimages.py +++ b/codes/data_scripts/extract_subimages.py @@ -20,13 +20,13 @@ def main(): # CV_IMWRITE_PNG_COMPRESSION from 0 to 9. A higher value means a smaller size and longer # compression time. If read raw images during training, use 0 for faster IO speed. if mode == 'single': - opt['input_folder'] = 'F:\\4k6k\\datasets\\fkaw\\images' - opt['save_folder'] = 'F:\\4k6k\\datasets\\fkaw\\square_images' + opt['input_folder'] = 'F:\\4k6k\\datasets\\div2k\\DIV2K_train_HR' + opt['save_folder'] = 'F:\\4k6k\\datasets\\div2k\\tiled1024' opt['crop_sz'] = 1024 # the size of each sub-image opt['step'] = 880 # step of the sliding crop window opt['thres_sz'] = 240 # size threshold - opt['resize_final_img'] = .5 - opt['only_resize'] = .5 + opt['resize_final_img'] = 1 + opt['only_resize'] = False extract_single(opt, split_img) elif mode == 'pair': GT_folder = '../../datasets/div2k/DIV2K_train_HR' @@ -164,7 +164,7 @@ def worker(path, opt, split_mode=False, left_img=True): crop_img = img[x:x + crop_sz, y:y + crop_sz, :] crop_img = np.ascontiguousarray(crop_img) # If this fails, change it and the imwrite below to the write extension. - assert ".jpg" in img_name + assert ".png" in img_name if 'resize_final_img' in opt.keys(): # Resize too. resize_factor = opt['resize_final_img'] @@ -173,7 +173,7 @@ def worker(path, opt, split_mode=False, left_img=True): crop_img = cv2.resize(crop_img, dsize, interpolation = cv2.INTER_AREA) cv2.imwrite( osp.join(opt['save_folder'], - img_name.replace('.jpg', '_l{:05d}_s{:03d}.png'.format(left, index))), crop_img, + img_name.replace('.png', '_l{:05d}_s{:03d}.png'.format(left, index))), crop_img, [cv2.IMWRITE_PNG_COMPRESSION, opt['compression_level']]) return 'Processing {:s} ...'.format(img_name) diff --git a/codes/train.py b/codes/train.py index e429b815..37efc401 100644 --- a/codes/train.py +++ b/codes/train.py @@ -33,7 +33,7 @@ def init_dist(backend='nccl', **kwargs): def main(): #### options parser = argparse.ArgumentParser() - parser.add_argument('-opt', type=str, help='Path to option YAML file.', default='../options/train_div2k_srg3.yml') + parser.add_argument('-opt', type=str, help='Path to option YAML file.', default='../experiments/train_div2k_srg2/train_div2k_srg2_basis.yml') parser.add_argument('--launcher', choices=['none', 'pytorch'], default='none', help='job launcher') parser.add_argument('--local_rank', type=int, default=0)