total_iters: 60000
output_dir: output_dir
find_unused_parameters: True
# tensor range for function tensor2img
min_max:
  (0., 1.)

model:
  name: ESRGAN
  generator:
    name: RRDBNet
    in_nc: 3
    out_nc: 3
    nf: 64
    nb: 23
  discriminator:
    name: VGGDiscriminator128
    in_channels: 3
    num_feat: 64
  pixel_criterion:
    name: L1Loss
    loss_weight: !!float 1e-2
  perceptual_criterion:
    name: PerceptualLoss
    layer_weights:
      '34': 1.0
    perceptual_weight: 1.0
    style_weight: 0.0
    norm_img: False
  gan_criterion:
    name: GANLoss
    gan_mode: vanilla
    loss_weight: !!float 5e-3

dataset:
  train:
    name: SRDataset
    gt_folder: data/DF2K/generated/tdsr/HR/
    lq_folder: data/DF2K/generated/tdsr/LR/
    num_workers: 4
    batch_size: 16
    scale: 4
    preprocess:
      - name: LoadImageFromFile
        key: lq
      - name: LoadImageFromFile
        key: gt
      - name: Transforms
        input_keys: [lq, gt]
        pipeline:
          - name: SRPairedRandomCrop
            gt_patch_size: 128
            scale: 4
            keys: [image, image]
          - name: PairedRandomHorizontalFlip
            keys: [image, image]
          - name: PairedRandomVerticalFlip
            keys: [image, image]
          - name: PairedRandomTransposeHW
            keys: [image, image]
          - name: Transpose
            keys: [image, image]
          - name: Normalize
            mean: [0., 0., 0.]
            std: [255., 255., 255.]
            keys: [image, image]
          - name: SRNoise
            noise_path: data/DF2K/Corrupted_noise/
            size: 32
            keys: [image]
  test:
    name: SRDataset
    gt_folder: data/Set14/GTmod12
    lq_folder: data/Set14/LRbicx4
    scale: 4
    preprocess:
      - name: LoadImageFromFile
        key: lq
      - name: LoadImageFromFile
        key: gt
      - name: Transforms
        input_keys: [lq, gt]
        pipeline:
          - name: Transpose
            keys: [image, image]
          - name: Normalize
            mean: [0., 0., 0.]
            std: [255., 255., 255.]
            keys: [image, image]

lr_scheduler:
  name: MultiStepDecay
  learning_rate: 0.0001
  milestones: [5000, 10000, 20000, 30000]
  gamma: 0.5

optimizer:
  optimG:
    name: Adam
    net_names:
      - generator
    weight_decay: 0.0
    beta1: 0.9
    beta2: 0.999
  optimD:
    name: Adam
    net_names:
      - discriminator
    weight_decay: 0.0
    beta1: 0.9
    beta2: 0.999

validate:
  interval: 5000
  save_img: false

  metrics:
    psnr: # metric name, can be arbitrary
      name: PSNR
      crop_border: 4
      test_y_channel: false
    ssim:
      name: SSIM
      crop_border: 4
      test_y_channel: false

log_config:
  interval: 100
  visiual_interval: 500

snapshot_config:
  interval: 5000
