train_realesrgan_x2plus.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # general settings
  2. name: train_RealESRGANx2plus_400k_B12G4
  3. model_type: RealESRGANModel
  4. scale: 2
  5. num_gpu: auto # auto: can infer from your visible devices automatically. official: 4 GPUs
  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. scale: 2
  81. network_d:
  82. type: UNetDiscriminatorSN
  83. num_in_ch: 3
  84. num_feat: 64
  85. skip_connection: True
  86. # path
  87. path:
  88. # use the pre-trained Real-ESRNet model
  89. pretrain_network_g: experiments/pretrained_models/RealESRNet_x2plus.pth
  90. param_key_g: params_ema
  91. strict_load_g: true
  92. resume_state: ~
  93. # training settings
  94. train:
  95. ema_decay: 0.999
  96. optim_g:
  97. type: Adam
  98. lr: !!float 1e-4
  99. weight_decay: 0
  100. betas: [0.9, 0.99]
  101. optim_d:
  102. type: Adam
  103. lr: !!float 1e-4
  104. weight_decay: 0
  105. betas: [0.9, 0.99]
  106. scheduler:
  107. type: MultiStepLR
  108. milestones: [400000]
  109. gamma: 0.5
  110. total_iter: 400000
  111. warmup_iter: -1 # no warm up
  112. # losses
  113. pixel_opt:
  114. type: L1Loss
  115. loss_weight: 1.0
  116. reduction: mean
  117. # perceptual loss (content and style losses)
  118. perceptual_opt:
  119. type: PerceptualLoss
  120. layer_weights:
  121. # before relu
  122. 'conv1_2': 0.1
  123. 'conv2_2': 0.1
  124. 'conv3_4': 1
  125. 'conv4_4': 1
  126. 'conv5_4': 1
  127. vgg_type: vgg19
  128. use_input_norm: true
  129. perceptual_weight: !!float 1.0
  130. style_weight: 0
  131. range_norm: false
  132. criterion: l1
  133. # gan loss
  134. gan_opt:
  135. type: GANLoss
  136. gan_type: vanilla
  137. real_label_val: 1.0
  138. fake_label_val: 0.0
  139. loss_weight: !!float 1e-1
  140. net_d_iters: 1
  141. net_d_init_iters: 0
  142. # Uncomment these for validation
  143. # validation settings
  144. # val:
  145. # val_freq: !!float 5e3
  146. # save_img: True
  147. # metrics:
  148. # psnr: # metric name
  149. # type: calculate_psnr
  150. # crop_border: 4
  151. # test_y_channel: false
  152. # logging settings
  153. logger:
  154. print_freq: 100
  155. save_checkpoint_freq: !!float 5e3
  156. use_tb_logger: true
  157. wandb:
  158. project: ~
  159. resume_id: ~
  160. # dist training settings
  161. dist_params:
  162. backend: nccl
  163. port: 29500