Misc changes

This commit is contained in:
James Betker 2020-07-04 13:22:50 -06:00
parent 510b2f887d
commit 188de5e15a
2 changed files with 7 additions and 7 deletions

View File

@ -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)

View File

@ -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)