Upload train_realesrgan_x4plus.yml
Browse files
options/train_realesrgan_x4plus.yml
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# general settings
|
2 |
+
name: train_RealESRGANx4plus_400k_B12G4
|
3 |
+
model_type: RealESRGANModel
|
4 |
+
scale: 4
|
5 |
+
num_gpu: auto # auto: can infer from your visible devices automatically. official: 4 GPUs
|
6 |
+
manual_seed: 0
|
7 |
+
|
8 |
+
# ----------------- options for synthesizing training data in RealESRGANModel ----------------- #
|
9 |
+
# USM the ground-truth
|
10 |
+
l1_gt_usm: True
|
11 |
+
percep_gt_usm: True
|
12 |
+
gan_gt_usm: False
|
13 |
+
|
14 |
+
# the first degradation process
|
15 |
+
resize_prob: [0.2, 0.7, 0.1] # up, down, keep
|
16 |
+
resize_range: [0.15, 1.5]
|
17 |
+
gaussian_noise_prob: 0.5
|
18 |
+
noise_range: [1, 30]
|
19 |
+
poisson_scale_range: [0.05, 3]
|
20 |
+
gray_noise_prob: 0.4
|
21 |
+
jpeg_range: [30, 95]
|
22 |
+
|
23 |
+
# the second degradation process
|
24 |
+
second_blur_prob: 0.8
|
25 |
+
resize_prob2: [0.3, 0.4, 0.3] # up, down, keep
|
26 |
+
resize_range2: [0.3, 1.2]
|
27 |
+
gaussian_noise_prob2: 0.5
|
28 |
+
noise_range2: [1, 25]
|
29 |
+
poisson_scale_range2: [0.05, 2.5]
|
30 |
+
gray_noise_prob2: 0.4
|
31 |
+
jpeg_range2: [30, 95]
|
32 |
+
|
33 |
+
gt_size: 256
|
34 |
+
queue_size: 180
|
35 |
+
|
36 |
+
# dataset and data loader settings
|
37 |
+
datasets:
|
38 |
+
train:
|
39 |
+
name: DF2K+OST
|
40 |
+
type: RealESRGANDataset
|
41 |
+
dataroot_gt: datasets/DF2K
|
42 |
+
meta_info: datasets/DF2K/meta_info/meta_info_DF2Kmultiscale+OST_sub.txt
|
43 |
+
io_backend:
|
44 |
+
type: disk
|
45 |
+
|
46 |
+
blur_kernel_size: 21
|
47 |
+
kernel_list: ['iso', 'aniso', 'generalized_iso', 'generalized_aniso', 'plateau_iso', 'plateau_aniso']
|
48 |
+
kernel_prob: [0.45, 0.25, 0.12, 0.03, 0.12, 0.03]
|
49 |
+
sinc_prob: 0.1
|
50 |
+
blur_sigma: [0.2, 3]
|
51 |
+
betag_range: [0.5, 4]
|
52 |
+
betap_range: [1, 2]
|
53 |
+
|
54 |
+
blur_kernel_size2: 21
|
55 |
+
kernel_list2: ['iso', 'aniso', 'generalized_iso', 'generalized_aniso', 'plateau_iso', 'plateau_aniso']
|
56 |
+
kernel_prob2: [0.45, 0.25, 0.12, 0.03, 0.12, 0.03]
|
57 |
+
sinc_prob2: 0.1
|
58 |
+
blur_sigma2: [0.2, 1.5]
|
59 |
+
betag_range2: [0.5, 4]
|
60 |
+
betap_range2: [1, 2]
|
61 |
+
|
62 |
+
final_sinc_prob: 0.8
|
63 |
+
|
64 |
+
gt_size: 256
|
65 |
+
use_hflip: True
|
66 |
+
use_rot: False
|
67 |
+
|
68 |
+
# data loader
|
69 |
+
use_shuffle: true
|
70 |
+
num_worker_per_gpu: 5
|
71 |
+
batch_size_per_gpu: 12
|
72 |
+
dataset_enlarge_ratio: 1
|
73 |
+
prefetch_mode: ~
|
74 |
+
|
75 |
+
# Uncomment these for validation
|
76 |
+
# val:
|
77 |
+
# name: validation
|
78 |
+
# type: PairedImageDataset
|
79 |
+
# dataroot_gt: path_to_gt
|
80 |
+
# dataroot_lq: path_to_lq
|
81 |
+
# io_backend:
|
82 |
+
# type: disk
|
83 |
+
|
84 |
+
# network structures
|
85 |
+
network_g:
|
86 |
+
type: RRDBNet
|
87 |
+
num_in_ch: 3
|
88 |
+
num_out_ch: 3
|
89 |
+
num_feat: 64
|
90 |
+
num_block: 23
|
91 |
+
num_grow_ch: 32
|
92 |
+
|
93 |
+
network_d:
|
94 |
+
type: UNetDiscriminatorSN
|
95 |
+
num_in_ch: 3
|
96 |
+
num_feat: 64
|
97 |
+
skip_connection: True
|
98 |
+
|
99 |
+
# path
|
100 |
+
path:
|
101 |
+
# use the pre-trained Real-ESRNet model
|
102 |
+
pretrain_network_g: experiments/pretrained_models/RealESRNet_x4plus.pth
|
103 |
+
param_key_g: params_ema
|
104 |
+
strict_load_g: true
|
105 |
+
resume_state: ~
|
106 |
+
|
107 |
+
# training settings
|
108 |
+
train:
|
109 |
+
ema_decay: 0.999
|
110 |
+
optim_g:
|
111 |
+
type: Adam
|
112 |
+
lr: !!float 1e-4
|
113 |
+
weight_decay: 0
|
114 |
+
betas: [0.9, 0.99]
|
115 |
+
optim_d:
|
116 |
+
type: Adam
|
117 |
+
lr: !!float 1e-4
|
118 |
+
weight_decay: 0
|
119 |
+
betas: [0.9, 0.99]
|
120 |
+
|
121 |
+
scheduler:
|
122 |
+
type: MultiStepLR
|
123 |
+
milestones: [400000]
|
124 |
+
gamma: 0.5
|
125 |
+
|
126 |
+
total_iter: 400000
|
127 |
+
warmup_iter: -1 # no warm up
|
128 |
+
|
129 |
+
# losses
|
130 |
+
pixel_opt:
|
131 |
+
type: L1Loss
|
132 |
+
loss_weight: 1.0
|
133 |
+
reduction: mean
|
134 |
+
# perceptual loss (content and style losses)
|
135 |
+
perceptual_opt:
|
136 |
+
type: PerceptualLoss
|
137 |
+
layer_weights:
|
138 |
+
# before relu
|
139 |
+
'conv1_2': 0.1
|
140 |
+
'conv2_2': 0.1
|
141 |
+
'conv3_4': 1
|
142 |
+
'conv4_4': 1
|
143 |
+
'conv5_4': 1
|
144 |
+
vgg_type: vgg19
|
145 |
+
use_input_norm: true
|
146 |
+
perceptual_weight: !!float 1.0
|
147 |
+
style_weight: 0
|
148 |
+
range_norm: false
|
149 |
+
criterion: l1
|
150 |
+
# gan loss
|
151 |
+
gan_opt:
|
152 |
+
type: GANLoss
|
153 |
+
gan_type: vanilla
|
154 |
+
real_label_val: 1.0
|
155 |
+
fake_label_val: 0.0
|
156 |
+
loss_weight: !!float 1e-1
|
157 |
+
|
158 |
+
net_d_iters: 1
|
159 |
+
net_d_init_iters: 0
|
160 |
+
|
161 |
+
# Uncomment these for validation
|
162 |
+
# validation settings
|
163 |
+
# val:
|
164 |
+
# val_freq: !!float 5e3
|
165 |
+
# save_img: True
|
166 |
+
|
167 |
+
# metrics:
|
168 |
+
# psnr: # metric name
|
169 |
+
# type: calculate_psnr
|
170 |
+
# crop_border: 4
|
171 |
+
# test_y_channel: false
|
172 |
+
|
173 |
+
# logging settings
|
174 |
+
logger:
|
175 |
+
print_freq: 100
|
176 |
+
save_checkpoint_freq: !!float 5e3
|
177 |
+
use_tb_logger: true
|
178 |
+
wandb:
|
179 |
+
project: ~
|
180 |
+
resume_id: ~
|
181 |
+
|
182 |
+
# dist training settings
|
183 |
+
dist_params:
|
184 |
+
backend: nccl
|
185 |
+
port: 29500
|