File size: 3,679 Bytes
f518bf0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# general settings
name: Allweather_Histotormer
model_type: ImageCleanModel
scale: 1
num_gpu: 4  # set num_gpu: 0 for cpu mode
manual_seed: 100

# dataset and data loader settings
datasets:
  train:
    name: TrainSet
    type: Dataset_PairedImage
    dataroot_gt: /home1/ssq/data/allweather/gt/
    dataroot_lq: /home1/ssq/data/allweather/input/
    geometric_augs: true

    filename_tmpl: '{}'
    io_backend:
      type: disk

    # data loader
    use_shuffle: true
    num_worker_per_gpu: 8
    batch_size_per_gpu: 8

    ### -------------Progressive training--------------------------
    mini_batch_sizes: [8,5,2,1,1]             # Batch size per gpu   
    iters: [92000,84000,56000,36000,32000]
    gt_size: 362   # Max patch size for progressive training
    gt_sizes: [128,160,256,320,362]  # Patch sizes for progressive training.
    ### ------------------------------------------------------------

    ### ------- Training on single fixed-patch size 128x128---------
    # mini_batch_sizes: [8]   
    # iters: [300000]
    # gt_size: 128   
    # gt_sizes: [128]
    ### ------------------------------------------------------------

    dataset_enlarge_ratio: 1
    prefetch_mode: ~

  val_snow_s:
    name: ValSet_Snow100K-S
    type: Dataset_PairedImage
    dataroot_gt: /home1/ssq/data/allweather/test/Snow100K-S/gt/
    dataroot_lq: /home1/ssq/data/allweather/test/Snow100K-S/synthetic/
    io_backend:
      type: disk
  val_snow_l:
    name: ValSet_Snow100K-L
    type: Dataset_PairedImage
    dataroot_gt: /home1/ssq/data/allweather/test/Snow100K-L/gt/
    dataroot_lq: /home1/ssq/data/allweather/test/Snow100K-L/synthetic/
    io_backend:
      type: disk
  val_test1:
    name: ValSet_Test1
    type: Dataset_PairedImage
    dataroot_gt: /home1/ssq/data/allweather/test/Test1/gt/
    dataroot_lq: /home1/ssq/data/allweather/test/Test1/input/
    io_backend:
      type: disk
  val_raindrop:
    name: ValSet_RainDrop
    type: Dataset_PairedImage
    dataroot_gt: /home1/ssq/data/allweather/test/RainDrop/gt/
    dataroot_lq: /home1/ssq/data/allweather/test/RainDrop/input/
    io_backend:
      type: disk


# network structures
network_g:
  type: Histoformer
  inp_channels: 3
  out_channels: 3
  dim: 36
  num_blocks: [4,4,6,8]
  num_refinement_blocks: 4
  heads: [1,2,4,8]
  ffn_expansion_factor: 2.667
  bias: False
  LayerNorm_type: WithBias
  dual_pixel_task: False


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

# training settings
train:
  total_iter: 300000
  warmup_iter: -1 # no warm up
  use_grad_clip: true

  # Split 300k iterations into two cycles. 
  # 1st cycle: fixed 3e-4 LR for 92k iters. 
  # 2nd cycle: cosine annealing (3e-4 to 1e-6) for 208k iters.
  scheduler:
    type: CosineAnnealingRestartCyclicLR # ReduceLROnPlateau
    periods: [92000, 208000]       
    restart_weights: [1,1]
    eta_mins: [0.0003,0.000001]   
  
  mixing_augs:
    mixup: false
    mixup_beta: 1.2
    use_identity: true

  optim_g:
    type: AdamW
    lr: !!float 3e-4
    weight_decay: !!float 1e-4
    betas: [0.9, 0.999]
  
  # losses
  pixel_opt:
    type: L1Loss
    loss_weight: 1
    reduction: mean
  seq_opt:
    type: Pearson

# validation settings
val:
  window_size: 8
  val_freq: !!float 1e3
  save_img: true
  rgb2bgr: true
  use_image: true
  max_minibatch: 8

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

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

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