finetune_realesrgan_x4plus_pairdata.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. # general settings
  2. name: finetune_RealESRGANx4plus_400k_pairdata
  3. model_type: RealESRGANModel
  4. scale: 4
  5. num_gpu: auto
  6. manual_seed: 0
  7. # USM the ground-truth
  8. l1_gt_usm: True
  9. percep_gt_usm: True
  10. gan_gt_usm: False
  11. high_order_degradation: False # do not use the high-order degradation generation process
  12. # dataset and data loader settings
  13. datasets:
  14. train:
  15. name: DIV2K
  16. type: RealESRGANPairedDataset
  17. dataroot_gt: datasets/DF2K
  18. dataroot_lq: datasets/DF2K
  19. meta_info: datasets/DF2K/meta_info/meta_info_DIV2K_sub_pair.txt
  20. io_backend:
  21. type: disk
  22. gt_size: 256
  23. use_hflip: True
  24. use_rot: False
  25. # data loader
  26. use_shuffle: true
  27. num_worker_per_gpu: 5
  28. batch_size_per_gpu: 12
  29. dataset_enlarge_ratio: 1
  30. prefetch_mode: ~
  31. # Uncomment these for validation
  32. # val:
  33. # name: validation
  34. # type: PairedImageDataset
  35. # dataroot_gt: path_to_gt
  36. # dataroot_lq: path_to_lq
  37. # io_backend:
  38. # type: disk
  39. # network structures
  40. network_g:
  41. type: RRDBNet
  42. num_in_ch: 3
  43. num_out_ch: 3
  44. num_feat: 64
  45. num_block: 23
  46. num_grow_ch: 32
  47. network_d:
  48. type: UNetDiscriminatorSN
  49. num_in_ch: 3
  50. num_feat: 64
  51. skip_connection: True
  52. # path
  53. path:
  54. # use the pre-trained Real-ESRNet model
  55. pretrain_network_g: experiments/pretrained_models/RealESRNet_x4plus.pth
  56. param_key_g: params_ema
  57. strict_load_g: true
  58. pretrain_network_d: experiments/pretrained_models/RealESRGAN_x4plus_netD.pth
  59. param_key_d: params
  60. strict_load_d: true
  61. resume_state: ~
  62. # training settings
  63. train:
  64. ema_decay: 0.999
  65. optim_g:
  66. type: Adam
  67. lr: !!float 1e-4
  68. weight_decay: 0
  69. betas: [0.9, 0.99]
  70. optim_d:
  71. type: Adam
  72. lr: !!float 1e-4
  73. weight_decay: 0
  74. betas: [0.9, 0.99]
  75. scheduler:
  76. type: MultiStepLR
  77. milestones: [400000]
  78. gamma: 0.5
  79. total_iter: 400000
  80. warmup_iter: -1 # no warm up
  81. # losses
  82. pixel_opt:
  83. type: L1Loss
  84. loss_weight: 1.0
  85. reduction: mean
  86. # perceptual loss (content and style losses)
  87. perceptual_opt:
  88. type: PerceptualLoss
  89. layer_weights:
  90. # before relu
  91. 'conv1_2': 0.1
  92. 'conv2_2': 0.1
  93. 'conv3_4': 1
  94. 'conv4_4': 1
  95. 'conv5_4': 1
  96. vgg_type: vgg19
  97. use_input_norm: true
  98. perceptual_weight: !!float 1.0
  99. style_weight: 0
  100. range_norm: false
  101. criterion: l1
  102. # gan loss
  103. gan_opt:
  104. type: GANLoss
  105. gan_type: vanilla
  106. real_label_val: 1.0
  107. fake_label_val: 0.0
  108. loss_weight: !!float 1e-1
  109. net_d_iters: 1
  110. net_d_init_iters: 0
  111. # Uncomment these for validation
  112. # validation settings
  113. # val:
  114. # val_freq: !!float 5e3
  115. # save_img: True
  116. # metrics:
  117. # psnr: # metric name
  118. # type: calculate_psnr
  119. # crop_border: 4
  120. # test_y_channel: false
  121. # logging settings
  122. logger:
  123. print_freq: 100
  124. save_checkpoint_freq: !!float 5e3
  125. use_tb_logger: true
  126. wandb:
  127. project: ~
  128. resume_id: ~
  129. # dist training settings
  130. dist_params:
  131. backend: nccl
  132. port: 29500