diff --git a/configs/realsr_bicubic_noise_x4_df2k.yaml b/configs/realsr_bicubic_noise_x4_df2k.yaml index d8b7423653b734c5092137bea436e059ca279b53..95de7fbad96b26831ecb4fe0a3b5b8bad6ecc2e2 100644 --- a/configs/realsr_bicubic_noise_x4_df2k.yaml +++ b/configs/realsr_bicubic_noise_x4_df2k.yaml @@ -34,8 +34,8 @@ model: dataset: train: name: SRDataset - gt_folder: data/realsr_preprocess/DF2K/generated/tdsr/HR_sub/ - lq_folder: data/realsr_preprocess/DF2K/generated/tdsr/LR_sub/ + gt_folder: data/DF2K/generated/tdsr/HR/ + lq_folder: data/DF2K/generated/tdsr/LR/ num_workers: 4 batch_size: 16 scale: 4 @@ -64,7 +64,7 @@ dataset: std: [255., 255., 255.] keys: [image, image] - name: SRNoise - noise_path: data/realsr_preprocess/DF2K/Corrupted_noise/ + noise_path: data/DF2K/Corrupted_noise/ size: 32 keys: [image] test: diff --git a/configs/realsr_kernel_noise_x4_dped.yaml b/configs/realsr_kernel_noise_x4_dped.yaml index 6aadc3f9f92c2b853e819291ed03eae750c9dc10..9322d97eb8ee9fc26c3b250217681ea7e160690c 100644 --- a/configs/realsr_kernel_noise_x4_dped.yaml +++ b/configs/realsr_kernel_noise_x4_dped.yaml @@ -34,8 +34,8 @@ model: dataset: train: name: SRDataset - gt_folder: data/realsr_preprocess/DPED/generated/clean/train_tdsr/HR/ - lq_folder: data/realsr_preprocess/DPED/generated/clean/train_tdsr/LR/ + gt_folder: data/DPED/generated/clean/train_tdsr/HR/ + lq_folder: data/DPED/generated/clean/train_tdsr/LR/ num_workers: 4 batch_size: 16 scale: 4 @@ -64,7 +64,7 @@ dataset: std: [255., 255., 255.] keys: [image, image] - name: SRNoise - noise_path: data/realsr_preprocess/DPED/DPEDiphone_noise/ + noise_path: data/DPED/DPEDiphone_noise/ size: 32 keys: [image] test: diff --git a/lsr2_preprocess.py b/data/lsr2_preprocess.py similarity index 100% rename from lsr2_preprocess.py rename to data/lsr2_preprocess.py diff --git a/data/realsr_preprocess/collect_noise.py b/data/realsr_preprocess/collect_noise.py index 18a7c48553600723a5645c048045252e6aedaed5..1520cba78d475898206e577fa54b64123fd6f04f 100644 --- a/data/realsr_preprocess/collect_noise.py +++ b/data/realsr_preprocess/collect_noise.py @@ -27,7 +27,8 @@ parser.add_argument('--upscale_factor', opt = parser.parse_args() # define input and target directories -with open('./preprocess/paths.yml', 'r') as stream: +cur_path = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(cur_path, './paths.yml'), 'r') as stream: PATHS = yaml.load(stream) diff --git a/data/realsr_preprocess/create_bicubic_dataset.py b/data/realsr_preprocess/create_bicubic_dataset.py index 085feb6f90594b41dfbb8ad912c20fe7b8b69211..a9cb3985c3624d328735a1a2fb0f34d7c42d2a76 100644 --- a/data/realsr_preprocess/create_bicubic_dataset.py +++ b/data/realsr_preprocess/create_bicubic_dataset.py @@ -48,7 +48,8 @@ parser.add_argument('--upscale_factor', opt = parser.parse_args() # define input and target directories -with open('./paths.yml', 'r') as stream: +cur_path = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(cur_path, './paths.yml'), 'r') as stream: PATHS = yaml.load(stream) if opt.dataset == 'df2k': @@ -82,7 +83,8 @@ else: tdsr_hr_dir = path_tdsr + 'HR' tdsr_lr_dir = path_tdsr + 'LR' -assert not os.path.exists(PATHS['datasets'][opt.dataset]) +assert not os.path.exists(tdsr_hr_dir) +assert not os.path.exists(tdsr_lr_dir) if not os.path.exists(tdsr_hr_dir): os.makedirs(tdsr_hr_dir) diff --git a/data/realsr_preprocess/paths.yml b/data/realsr_preprocess/paths.yml index 508ba3079dbf994eada47e2e495e121e4defccb7..ce20727fbd2f24d3aa3e77139af9771df7535c06 100644 --- a/data/realsr_preprocess/paths.yml +++ b/data/realsr_preprocess/paths.yml @@ -1,13 +1,13 @@ df2k: tdsr: - source: '/workspace/datasets/ntire20/Corrupted-tr-x' - target: '/workspace/datasets/ntire20/Corrupted-tr-y' + source: './data/ntire20/Corrupted-tr-x' + target: './data/ntire20/Corrupted-tr-y' valid: dped: clean: hr: - train: '/workspace/datasets/ntire20/DPEDiphone-tr-x' - valid: '/workspace/datasets/ntire20/DPEDiphone-va' + train: './data/ntire20/DPEDiphone-tr-x' + valid: './data/datasets/ntire20/DPEDiphone-va' datasets: - df2k: 'DF2K' - dped: 'DPED' + df2k: 'data/DF2K' + dped: 'data/DPED' diff --git a/docs/en_US/tutorials/super_resolution.md b/docs/en_US/tutorials/super_resolution.md index 25605cdbba981357fd32137f2c5888c5242b6f8e..c5f0d1b6a77f2c7994ced0973b98f731fad353c0 100644 --- a/docs/en_US/tutorials/super_resolution.md +++ b/docs/en_US/tutorials/super_resolution.md @@ -52,6 +52,16 @@ python data/process_div2k_data.py --data-root data/DIV2K ``` + Prepare dataset for realsr df2k model: + Download dataset from [NTIRE 2020 RWSR](https://competitions.codalab.org/competitions/22220#participate) and unzip it to your path. + Unzip Corrupted-tr-x.zip and Corrupted-tr-y.zip to ``PaddleGAN/data/ntire20`` directory. + + Run the following commands: + ``` + python ./data/realsr_preprocess/create_bicubic_dataset.py --dataset df2k --artifacts tdsr + + python ./data/realsr_preprocess/collect_noise.py --dataset df2k --artifacts tdsr + ``` ### 1.2.2 Train/Test