esrgan_x4_div2k.yaml 2.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
total_iters: 250000
output_dir: output_dir
# 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/DIV2K/DIV2K_train_HR_sub
    lq_folder: data/DIV2K/DIV2K_train_LR_bicubic/X4_sub
    num_workers: 6
    batch_size: 32
    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]
  test:
    name: SRDataset
    gt_folder: data/DIV2K/val_set14/Set14
    lq_folder: data/DIV2K/val_set14/Set14_bicLRx4
    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: [50000, 100000, 200000, 300000]
  gamma: 0.5

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

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