total_iters: 600000
output_dir: output_dir
checkpoints_dir: checkpoints
# tensor range for function tensor2img
min_max:
  (0., 1.)

model:
  name: EDVRModel
  tsa_iter: False
  generator:
    name: EDVRNet
    in_nf: 3
    out_nf: 3
    scale_factor: 1
    nf: 128
    nframes: 5
    groups: 8
    front_RBs: 5
    back_RBs: 40
    center: 2
    predeblur: True
    HR_in: True
    w_TSA: False
  pixel_criterion:
    name: CharbonnierLoss

dataset:
  train:
    name: RepeatDataset
    times: 1000
    num_workers: 6
    batch_size: 8  #4 gpus
    dataset:
      name: VSRREDSDataset
      lq_folder: data/REDS/train_blur/X4
      gt_folder: data/REDS/train_sharp/X4
      ann_file: data/REDS/meta_info_REDS_GT.txt
      num_frames: 5
      val_partition: REDS4
      test_mode: False
      preprocess:
        - name: GetFrameIdx
          interval_list: [1]
          frames_per_clip: 99
        - name: ReadImageSequence
          key: lq
        - name: ReadImageSequence
          key: gt
        - name: Transforms
          input_keys: [lq, gt]
          pipeline:
            - name: SRPairedRandomCrop
              gt_patch_size: 256
              scale: 1
              keys: [image, image]
            - name: PairedRandomHorizontalFlip
              keys: [image, image]
            - name: PairedRandomVerticalFlip
              keys: [image, image]
            - name: PairedRandomTransposeHW
              keys: [image, image]
            - name: TransposeSequence
              keys: [image, image]
            - name: NormalizeSequence
              mean: [0., 0., 0.]
              std: [255., 255., 255.]
              keys: [image, image]


  test:
    name: VSRREDSDataset
    lq_folder: data/REDS/REDS4_test_blur/X4
    gt_folder: data/REDS/REDS4_test_sharp/X4
    ann_file: data/REDS/meta_info_REDS_GT.txt
    num_frames: 5
    val_partition: REDS4
    test_mode: True
    preprocess:
        - name: GetFrameIdxwithPadding
          padding: reflection_circle
        - name: ReadImageSequence
          key: lq
        - name: ReadImageSequence
          key: gt
        - name: Transforms
          input_keys: [lq, gt]
          pipeline:
            - name: TransposeSequence
              keys: [image, image]
            - name: NormalizeSequence
              mean: [0., 0., 0.]
              std: [255., 255., 255.]
              keys: [image, image]

lr_scheduler:
  name: CosineAnnealingRestartLR
  learning_rate: !!float 2e-4
  periods: [150000, 150000, 150000, 150000]
  restart_weights: [1, 0.5, 0.5, 0.5]
  eta_min: !!float 1e-7

optimizer:
  name: Adam
  # add parameters of net_name to optim
  # name should in self.nets
  net_names:
    - generator
  beta1: 0.9
  beta2: 0.99

validate:
  interval: 5000
  save_img: false

  metrics:
    psnr: # metric name, can be arbitrary
      name: PSNR
      crop_border: 0
      test_y_channel: False
    ssim:
      name: SSIM
      crop_border: 0
      test_y_channel: False

log_config:
  interval: 10
  visiual_interval: 5000

snapshot_config:
  interval: 5000
