train_realesrgan_x4plus.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. # ----------------- 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. resume_state: ~
  92. # training settings
  93. train:
  94. ema_decay: 0.999
  95. optim_g:
  96. type: Adam
  97. lr: !!float 1e-4
  98. weight_decay: 0
  99. betas: [0.9, 0.99]
  100. optim_d:
  101. type: Adam
  102. lr: !!float 1e-4
  103. weight_decay: 0
  104. betas: [0.9, 0.99]
  105. scheduler:
  106. type: MultiStepLR
  107. milestones: [400000]
  108. gamma: 0.5
  109. total_iter: 400000
  110. warmup_iter: -1 # no warm up
  111. # losses
  112. pixel_opt:
  113. type: L1Loss
  114. loss_weight: 1.0
  115. reduction: mean
  116. # perceptual loss (content and style losses)
  117. perceptual_opt:
  118. type: PerceptualLoss
  119. layer_weights:
  120. # before relu
  121. 'conv1_2': 0.1
  122. 'conv2_2': 0.1
  123. 'conv3_4': 1
  124. 'conv4_4': 1
  125. 'conv5_4': 1
  126. vgg_type: vgg19
  127. use_input_norm: true
  128. perceptual_weight: !!float 1.0
  129. style_weight: 0
  130. range_norm: false
  131. criterion: l1
  132. # gan loss
  133. gan_opt:
  134. type: GANLoss
  135. gan_type: vanilla
  136. real_label_val: 1.0
  137. fake_label_val: 0.0
  138. loss_weight: !!float 1e-1
  139. net_d_iters: 1
  140. net_d_init_iters: 0
  141. # Uncomment these for validation
  142. # validation settings
  143. # val:
  144. # val_freq: !!float 5e3
  145. # save_img: True
  146. # metrics:
  147. # psnr: # metric name
  148. # type: calculate_psnr
  149. # crop_border: 4
  150. # test_y_channel: false
  151. # logging settings
  152. logger:
  153. print_freq: 100
  154. save_checkpoint_freq: !!float 5e3
  155. use_tb_logger: true
  156. wandb:
  157. project: ~
  158. resume_id: ~
  159. # dist training settings
  160. dist_params:
  161. backend: nccl
  162. port: 29500