# general settings
name: 103_EDVR_L_x4_SR_REDS_woTSA_600k_B4G8_valREDS4_wandb
model_type: EDVRModel
scale: 4
num_gpu: 8  # set num_gpu: 0 for cpu mode
manual_seed: 10

# dataset and data loader settings
datasets:
  train:
    name: REDS
    type: REDSDataset
    dataroot_gt: datasets/REDS/train_sharp
    dataroot_lq: datasets/REDS/train_sharp_bicubic
    dataroot_flow: ~
    meta_info_file: basicsr/data/meta_info/meta_info_REDS_GT.txt
    val_partition: REDS4  # set to 'official' when use the official validation partition
    io_backend:
      type: disk

    num_frame: 5
    gt_size: 256
    interval_list: [1]
    random_reverse: false
    use_hflip: true
    use_rot: true

    # data loader
    use_shuffle: true
    num_worker_per_gpu: 3
    batch_size_per_gpu: 4
    dataset_enlarge_ratio: 200
    prefetch_mode: ~

  val:
    name: REDS4
    type: VideoTestDataset
    dataroot_gt: datasets/REDS/train_sharp
    dataroot_lq: datasets/REDS/train_sharp_bicubic
    meta_info_file: basicsr/data/meta_info/meta_info_REDS4_test_GT.txt
    # change to 'meta_info_REDSofficial4_test_GT' when use the official validation partition
    io_backend:
      type: disk

    cache_data: false
    num_frame: 5
    padding: reflection_circle

# network structures
network_g:
  ema_decay: 0.999
  type: EDVR
  num_in_ch: 3
  num_out_ch: 3
  num_feat: 128
  num_frame: 5
  deformable_groups: 8
  num_extract_block: 5
  num_reconstruct_block: 40
  center_frame_idx: ~
  hr_in: false
  with_predeblur: false
  with_tsa: false

# path
path:
  pretrain_network_g: ~
  strict_load_g: true
  resume_state: ~

# training settings
train:
  optim_g:
    type: Adam
    lr: !!float 4e-4
    weight_decay: 0
    betas: [0.9, 0.99]

  scheduler:
    type: CosineAnnealingRestartLR
    periods: [150000, 150000, 150000, 150000]
    restart_weights: [1, 0.5, 0.5, 0.5]
    eta_min: !!float 1e-7

  total_iter: 600000
  warmup_iter: -1  # no warm up
  dcn_lr_mul: 1

  # losses
  pixel_opt:
    type: CharbonnierLoss
    loss_weight: 1.0
    reduction: sum

# validation settings
val:
  val_freq: !!float 5e3
  save_img: false

  metrics:
    psnr: # metric name, can be arbitrary
      type: calculate_psnr
      crop_border: 0
      test_y_channel: false

# logging settings
logger:
  print_freq: 100
  save_checkpoint_freq: !!float 5e3
  use_tb_logger: true
  wandb:
    project: ~
    resume_id: ~

# dist training settings
dist_params:
  backend: nccl
  port: 29500
