File size: 7,856 Bytes
7122534
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# python train.py -opt options/sr/x1_ITF_SkinDiffDetail_Lite_v1.yml
name: x1_ITF_SkinDiffDetail_Lite_v1
# the name that defines the experiment and the directory that will be created in the experiments directory.
# name: debug_001_template  # use the "debug" or "debug_nochkp" prefix in the name to run a test session and check everything is working. Does validation and state saving every 8 iterations. Remove "debug" to run the real training session.
use_tb_logger: false
# wheter to enable Tensorboard logging or not. Output will be saved in: traiNNer/tb_logger/
model: sr 
# the model training strategy to be used. Depends on the type of model, from: https://github.com/victorca25/traiNNer/tree/master/codes/models
scale: 1 # the scale factor that will be used for training for super-resolution cases. Default is "1".
gpu_ids: [0] # the list of `CUDA_VISIBLE_DEVICES` that will be used during training, ie. for two GPUs, use [0, 1]. The batch size should be a multiple of the number of 'gpu_ids', since images will be distributed from the batch to each GPU.
use_amp: true # select to use PyTorch's Automatic Mixed Precision package to train in low-precision FP16 mode (lowers VRAM requirements).
use_swa: false # select to use Stochastic Weight Averaging
use_cem: false # select to use CEM during training. https://github.com/victorca25/traiNNer/tree/master/codes/models/modules/architectures/CEM

# Dataset options:
datasets: # configure the datasets
  train: # the stage the dataset will be used for (training)
    name: x1_ITF_SkinDiffDetail_Lite_v1 # the name of your dataset (only informative)
    mode: aligned 
    # dataset mode: https://github.com/victorca25/traiNNer/tree/master/codes/data
    dataroot_HR: [
      #'K:/TRAINING/data/Skin_Diff2Nrml/hr_clean_tiles/'
      '../datasets/Skin_DiffDetail/hr/'
      ]
    dataroot_LR: [
      #'K:/TRAINING/data/Skin_Diff2Nrml/lr_clean_tiles/'
      '../datasets/Skin_DiffDetail/lr_soft/'
      ] # low resolution images
    subset_file: null
    use_shuffle: true
    znorm: false
    n_workers: 8
    batch_size: 12
    virtual_batch_size: 12
    preprocess: crop
    crop_size: 64
    image_channels: 3

    # Color space conversion
    # color: 'y'
    # color_LR: 'y'
    # color_HR: 'y'
    
    # LR and HR modifiers.
    # aug_downscale: 0.2
    # shape_change: reshape_lr
    
    # Enable random downscaling of HR images (will fix LR pair to correct size)
    hr_downscale: true
    hr_downscale_types: [0, 3]
    hr_downscale_amount: [1, 2, 4]
    # #pre_crop: true
    
    # Presets and on the fly (OTF) augmentations
    #augs_strategy: combo
    #add_blur_preset: custom_blur
    #add_resize_preset: custom_resize
    #add_noise_preset: custom_noise
    #aug_downscale: 0.2
    resize_strat: pre
    
    # On the fly generation of LR:
    # dataroot_kernels: 'KERNEL PATH !!!! CHANGE THIS OR COMMENT OUT'
    #lr_downscale: false
    #lr_downscale_types: ["linear", "bicubic", "nearest_aligned"]

    # Rotations augmentations:
    use_flip: true
    use_rot: true
    use_hrrot: true
    
    # Noise and blur augmentations:
    #lr_blur: true
    #lr_blur_types: {sinc: 0.2, iso: 0.2, ansio2: 0.4, sinc2: 0.2, clean: 3}
    #noise_data: 'K:/TRAINING/traiNNer/noise_patches/'
    #lr_noise: true
    #lr_noise_types: {camera: 0.1, jpeg: 0.8, clean: 3}
    #lr_noise2: false
    #lr_noise_types2: {jpeg: 1, webp: 0, clean: 2, camera: 2}
    #hr_noise: false
    #hr_noise_types:  {gaussian: 1, clean: 4}
    
    # Color augmentations
    # lr_fringes: false
    # lr_fringes_chance: 0.4
    # auto_levels: HR
    # rand_auto_levels: 0.7
    #lr_unsharp_mask: true
    #lr_rand_unsharp: 0.7
    # hr_unsharp_mask: true
    # hr_rand_unsharp: 1
    
    # Augmentations for classification or (maybe) inpainting networks:
    # lr_cutout: false
    # lr_erasing: false

  #val: 
    #name: val_set14_part
    #mode: aligned
    #dataroot_B: '../datasets/val/hr'
    #dataroot_A: '../datasets/val/lr'
    
    #znorm: false
    
    # Color space conversion:
    # color: 'y'
    # color_LR: 'y'
    # color_HR: 'y'
    

path:
    root: '../'
    pretrain_model_G: '../experiments/pretrained_models/1x_DIV2K-Lite_SpongeBC1-Lite_interp.pth'
    # pretrain_model_D: 'K:/TRAINING/data/models/x1_ITF_SkinDiff2Nrm_Lite_v3_208500_D.pth'
    resume_state: '../experiments/x1_ITF_SkinDiffDetail_Lite_v1/training_state/latest.state'

# Generator options:
network_G: esrgan-lite # configurations for the Generator network


# Discriminator options:
network_D:
    # ESRGAN (default)| PPON:
    which_model_D: multiscale # discriminator_vgg_128 | discriminator_vgg | discriminator_vgg_128_fea (feature extraction) | patchgan | multiscale
    norm_type: batch
    act_type: leakyrelu
    mode: CNA # CNA | NAC
    nf: 32
    in_nc: 3
    nlayer: 3 # only for patchgan and multiscale
    num_D: 3 # only for multiscale

train:
    # Optimizer options:
    optim_G: adamp
    optim_D: adamp
    
    # Schedulers options:
    lr_scheme: MultiStepLR
    lr_steps_rel: [50000, 100000, 200000, 300000]
    lr_gamma: 0.5

    # For SWA scheduler
    swa_start_iter_rel: 0.05
    swa_lr: 1e-4
    swa_anneal_epochs: 10
    swa_anneal_strategy: "cos"
    
    # Losses:
    pixel_criterion: l1  # pixel (content) loss
    pixel_weight: 0.05
    feature_criterion: l1 # feature loss (VGG feature network)
    feature_weight: 0.3
    cx_type: contextual  # contextual loss
    cx_weight: 1
    cx_vgg_layers: {conv_3_2: 1, conv_4_2: 1}
    #hfen_criterion: l1  # hfen
    #hfen_weight: 1e-6 
    #grad_type: grad-4d-l1  # image gradient loss
    #grad_weight: 4e-1
    # tv_type: normal  # total variation
    # tv_weight: 1e-5
    # tv_norm: 1
    ssim_type: ssim  # structural similarity
    ssim_weight: 0.05
    lpips_weight: 0.25  # [.25] perceptual loss
    lpips_type: net-lin
    lpips_net: squeeze
    
    # Experimental losses
    # spl_type: spl  # spatial profile loss
    # spl_weight: 0.1
    #of_type: overflow  # overflow loss
    #of_weight: 0.1
    # range_weight: 1  # range loss
    # fft_type: fft  # FFT loss
    # fft_weight: 0.2 #[.2]
    color_criterion: color-l1cosinesim  # color consistency loss
    color_weight: 0.1
    # avg_criterion: avg-l1  # averaging downscale loss
    # avg_weight: 5
    # ms_criterion: multiscale-l1  # multi-scale pixel loss
    # ms_weight: 1e-2
    #fdpl_type: fdpl  # frequency domain-based perceptual loss
    #fdpl_weight: 1e-3
    
    # Adversarial loss:
    #gan_type: vanilla
    #gan_weight: 4e-3
    # freeze_loc: 4
    # For wgan-gp:
    # D_update_ratio: 1
    # D_init_iters: 0
    # gp_weigth: 10
    # Feature matching (if using the discriminator_vgg_128_fea or discriminator_vgg_fea):
    # gan_featmaps: true
    # dis_feature_criterion: cb  # discriminator feature loss
    # dis_feature_weight: 0.01
    
    # For PPON:
    # p1_losses: [pix]
    # p2_losses: [pix-multiscale, ms-ssim]
    # p3_losses: [fea]
    # ppon_stages: [1000, 2000]
    
    # Differentiable Augmentation for Data-Efficient GAN Training
    # diffaug: true
    # dapolicy: 'color,transl_zoom,flip,rotate,cutout'
    
    # Batch (Mixup) augmentations
    #mixup: false
    #mixopts: [blend, rgb, mixup, cutmix, cutmixup] # , "cutout", "cutblur"]
    #mixprob: [1.0, 1.0, 1.0, 1.0, 1.0] #, 1.0, 1.0]
    #mixalpha: [0.6, 1.0, 1.2, 0.7, 0.7] #, 0.001, 0.7]
    #aux_mixprob: 1.0
    #aux_mixalpha: 1.2
   # mix_p: 1.2
    
    # Frequency Separator
    #fs: true
    #lpf_type: average
    #hpf_type: average
    
    # Other training options:
    manual_seed: 0
    niter: 250000
    # warmup_iter: -1
    #val_freq: 5e3
    # overwrite_val_imgs: true
    # val_comparison: true
    # metrics: 'psnr,ssim,lpips'
    #grad_clip: auto
    #grad_clip_value: 0.1 # "auto"

logger:
    print_freq: 50
    save_checkpoint_freq: 500
    overwrite_chkp: false