finetune_realesrgan_x4plus.yml 3.9 KB

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