463465810cz commited on
Commit
0a4be84
·
1 Parent(s): e5c4654

Former-commit-id: 0f02d4ec4c7da26edff8a98e7fedb1006cc9d334

README.md CHANGED
@@ -1,6 +1,23 @@
1
  # Dual Aggregation Transformer for Image Super-Resolution
2
 
3
- This repository is for DAT introduced in the paper.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  ## Dependencies
6
 
@@ -9,32 +26,125 @@ This repository is for DAT introduced in the paper.
9
  - NVIDIA GPU + [CUDA](https://developer.nvidia.com/cuda-downloads)
10
 
11
  ```bash
12
- # Cd to the default directory 'DAT'
 
13
  pip install -r requirements.txt
14
  python setup.py develop
15
  ```
16
 
17
- ## Test
18
 
19
- - Download the pre-trained [models](https://ufile.io/rf58x0s9) and place them in `experiments/pretrained_models/`.
 
 
 
 
 
 
20
 
21
- We provide DAT with scale factors: x2, x3, x4.
22
 
23
- - Download [testing](https://ufile.io/6ek67nf8) (Set5, Set14, BSD100, Urban100, Manga109) datasets, place them in `datasets/`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- - Run the following scripts. The testing configuration is in `options/Test/`. More detail about YML, please refer to [Configuration](https://github.com/XPixelGroup/BasicSR/blob/master/docs/Config.md).
26
 
27
- **You can change the testing configuration in YML file, like 'test_DAT_x2.yml'.**
 
 
 
 
 
 
28
 
29
  ```shell
30
  # No self-ensemble
 
 
 
 
 
31
  # DAT, reproduces results in Table 2 of the main paper
32
  python basicsr/test.py -opt options/Test/test_DAT_x2.yml
33
  python basicsr/test.py -opt options/Test/test_DAT_x3.yml
34
  python basicsr/test.py -opt options/Test/test_DAT_x4.yml
35
  ```
36
-
37
- - The output is in `results`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  ## Acknowledgements
40
 
 
1
  # Dual Aggregation Transformer for Image Super-Resolution
2
 
3
+ [Zheng Chen](https://scholar.google.com/citations?user=zssRkBAAAAAJ), [Yulun Zhang](http://yulunzhang.com/), [Jinjin Gu](https://www.jasongt.com/), [Linghe Kong](https://www.cs.sjtu.edu.cn/~linghe.kong/), [Xiaokang Yang](https://scholar.google.com/citations?user=yDEavdMAAAAJ&hl), and [Fisher Yu](https://www.yf.io/), "Dual Aggregation Transformer for Image Super-Resolution", ICCV, 2023
4
+
5
+ [[arXiv]]() [[visual results](https://drive.google.com/drive/folders/1ZMaZyCer44ZX6tdcDmjIrc_hSsKoMKg2?usp=drive_link)] [[pretrained models](https://drive.google.com/drive/folders/1iBdf_-LVZuz_PAbFtuxSKd_11RL1YKxM?usp=drive_link)]
6
+
7
+ ---
8
+
9
+ > **Abstract:** *Transformer-based methods have recently been widely used in low-level vision tasks, including image super-resolution (SR). These networks utilize self-attention along different dimensions, spatial or channel, and achieve impressive performance. This inspires us to combine the two dimensions in Transformer for a more powerful representation capability. Based on the above idea, we propose a novel Transformer model, Dual Aggregation Transformer (DAT), for image SR. Our DAT aggregates features across spatial and channel dimensions, in the inter-block and intra-block dual manner. Specifically, we alternately apply spatial and channel self-attention in consecutive Transformer blocks. The alternate strategy enables DAT to capture the global context and realize inter-block feature aggregation. Furthermore, we propose the adaptive interaction module (AIM) and the spatial-gate feed-forward network (SGFN) to achieve intra-block feature aggregation. AIM complements two self-attention mechanisms from corresponding dimensions. Meanwhile, SGFN introduces additional non-linear spatial information in the feed-forward network. Extensive experiments show that our DAT surpasses current state-of-the-art methods.*
10
+ >
11
+ > <p align="center">
12
+ > <img width="800" src="figs/DAT.png">
13
+ > </p>
14
+
15
+ ---
16
+
17
+ | HR | LR | [SwinIR](https://github.com/JingyunLiang/SwinIR) | [CAT](https://github.com/zhengchen1999/CAT) | DAT (ours) |
18
+ | :------------------------------------------: | :-----------------------------------------------: | :----------------------------------------------: | :-------------------------------------------: | :-------------------------------------------: |
19
+ | <img src="figs/img_059_HR_x4.png" height=80> | <img src="figs/img_059_Bicubic_x4.png" height=80> | <img src="figs/img_059_SwinIR_x4.png" height=80> | <img src="figs/img_059_CAT_x4.png" height=80> | <img src="figs/img_059_DAT_x4.png" height=80> |
20
+ | <img src="figs/img_049_HR_x4.png" height=80> | <img src="figs/img_049_Bicubic_x4.png" height=80> | <img src="figs/img_049_SwinIR_x4.png" height=80> | <img src="figs/img_049_CAT_x4.png" height=80> | <img src="figs/img_049_DAT_x4.png" height=80> |
21
 
22
  ## Dependencies
23
 
 
26
  - NVIDIA GPU + [CUDA](https://developer.nvidia.com/cuda-downloads)
27
 
28
  ```bash
29
+ # Clone the github repo and go to the default directory 'DAT'.
30
+ git clone https://github.com/zhengchen1999/DAT.git
31
  pip install -r requirements.txt
32
  python setup.py develop
33
  ```
34
 
35
+ ## Contents
36
 
37
+ 1. [Datasets](#Datasets)
38
+ 1. [Models](#Models)
39
+ 1. [Training](#Training)
40
+ 1. [Testing](#Testing)
41
+ 1. [Results](#Results)
42
+ 1. [Citation](#Citation)
43
+ 1. [Acknowledgements](#Acknowledgements)
44
 
45
+ ---
46
 
47
+ ## Datasets
48
+
49
+ Used training and testing sets can be downloaded as follows:
50
+
51
+ | Training Set | Testing Set | Visual Results |
52
+ | :----------------------------------------------------------- | :----------------------------------------------------------: | :----------------------------------------------------------: |
53
+ | [DIV2K](https://data.vision.ee.ethz.ch/cvl/DIV2K/) (800 training images) + [Flickr2K](https://cv.snu.ac.kr/research/EDSR/Flickr2K.tar) (2650 images) [complete training dataset [DF2K](https://drive.google.com/file/d/1TubDkirxl4qAWelfOnpwaSKoj3KLAIG4/view?usp=share_link)] | Set5 + Set14 + BSD100 + Urban100 + Manga109 [complete testing dataset [download](https://drive.google.com/file/d/1yMbItvFKVaCT93yPWmlP3883XtJ-wSee/view?usp=sharing)] | [here](https://drive.google.com/drive/folders/1ZMaZyCer44ZX6tdcDmjIrc_hSsKoMKg2?usp=drive_link) |
54
+
55
+ Download training and testing datasets and put them into the corresponding folders of `datasets/` and `restormer/datasets`. See [datasets](datasets/README.md) for the detail of directory structure.
56
+
57
+ ## Models
58
+
59
+ | Method | Params (M) | FLOPs (G) | Dataset | PSNR (dB) | SSIM | Model Zoo | Visual Results |
60
+ | :----- | :--------: | :-------: | :------: | :-------: | :----: | :----------------------------------------------------------: | :----------------------------------------------------------: |
61
+ | DAT-S | 11.21 | 203.3 | Urban100 | 27.68 | 0.8300 | [Google Drive](https://drive.google.com/drive/folders/1hb77nOTpCo9iU_jmg_izHOPRvPJujRiL?usp=drive_link) | [Google Drive](https://drive.google.com/file/d/1W-CeN2Z0e1r0rOdc3t-GcGrRV-qTGdub/view?usp=drive_link) |
62
+ | DAT | 14.80 | 275.8 | Urban100 | 27.87 | 0.8343 | [Google Drive](https://drive.google.com/drive/folders/1eZqgQEBQ69Vzf8afrPkvL27JHubW6o0t?usp=drive_link) | [Google Drive](https://drive.google.com/file/d/1B4zJsZaiVsu009ilTh81BV7-8Hr98BI2/view?usp=drive_link) |
63
+
64
+ The performance is reported on Urban100 (x4, SR). The test input size of FLOPs is 128 x 128.
65
+
66
+
67
+
68
+ ## Training
69
+
70
+ - Download [training](https://drive.google.com/file/d/1TubDkirxl4qAWelfOnpwaSKoj3KLAIG4/view?usp=share_link) (DF2K, already processed) and [testing](https://drive.google.com/file/d/1yMbItvFKVaCT93yPWmlP3883XtJ-wSee/view?usp=sharing) (Set5, Set14, BSD100, Urban100, Manga109, already processed) datasets, place them in `datasets/`.
71
+
72
+ - Run the following scripts. The training configuration is in `options/train/`.
73
+
74
+ ```shell
75
+ # DAT-S, input=64x64, 4 GPUs
76
+ python -m torch.distributed.launch --nproc_per_node=4 --master_port=4321 basicsr/train.py -opt options/Train/train_DAT_S_x2.yml --launcher pytorch
77
+ python -m torch.distributed.launch --nproc_per_node=4 --master_port=4321 basicsr/train.py -opt options/Train/train_DAT_S_x3.yml --launcher pytorch
78
+ python -m torch.distributed.launch --nproc_per_node=4 --master_port=4321 basicsr/train.py -opt options/Train/train_DAT_S_x4.yml --launcher pytorch
79
+
80
+ # DAT, input=64x64, 4 GPUs
81
+ python -m torch.distributed.launch --nproc_per_node=4 --master_port=4321 basicsr/train.py -opt options/Train/train_DAT_x2.yml --launcher pytorch
82
+ python -m torch.distributed.launch --nproc_per_node=4 --master_port=4321 basicsr/train.py -opt options/Train/train_DAT_x3.yml --launcher pytorch
83
+ python -m torch.distributed.launch --nproc_per_node=4 --master_port=4321 basicsr/train.py -opt options/Train/train_DAT_x4.yml --launcher pytorch
84
+ ```
85
+
86
+ - The training experiment is in `experiments/`.
87
 
88
+ ## Testing
89
 
90
+ - Download the pre-trained [models](https://drive.google.com/drive/folders/1iBdf_-LVZuz_PAbFtuxSKd_11RL1YKxM?usp=drive_link) and place them in `experiments/pretrained_models/`.
91
+
92
+ We provide pre-trained models for image SR: DAT-S and DAT (x2, x3, x4).
93
+
94
+ - Download [testing](https://ufile.io/6ek67nf8) (Set5, Set14, BSD100, Urban100, Manga109) datasets, place them in `datasets/`.
95
+
96
+ - Run the following scripts. The testing configuration is in `options/test/`.
97
 
98
  ```shell
99
  # No self-ensemble
100
+ # DAT-S, reproduces results in Table 2 of the main paper
101
+ python basicsr/test.py -opt options/Test/test_DAT_S_x2.yml
102
+ python basicsr/test.py -opt options/Test/test_DAT_S_x3.yml
103
+ python basicsr/test.py -opt options/Test/test_DAT_S_x4.yml
104
+
105
  # DAT, reproduces results in Table 2 of the main paper
106
  python basicsr/test.py -opt options/Test/test_DAT_x2.yml
107
  python basicsr/test.py -opt options/Test/test_DAT_x3.yml
108
  python basicsr/test.py -opt options/Test/test_DAT_x4.yml
109
  ```
110
+
111
+ - The output is in `results/`.
112
+
113
+ ## Results
114
+
115
+ We achieved state-of-the-art performance on image SR, JPEG compression artifact reduction and real image denoising. Detailed results can be found in the paper. All visual results of CAT can be downloaded [here](https://drive.google.com/drive/folders/1SIQ342yyrlHTCxINf9wYNchOa5eOw_7s?usp=sharing).
116
+
117
+ <details>
118
+ <summary>Image SR (click to expan)</summary>
119
+
120
+ - results in Table 2 of the main paper
121
+
122
+ <p align="center">
123
+ <img width="900" src="figs/Table-1.png">
124
+ </p>
125
+
126
+
127
+ - visual comparison (x4) in the main paper
128
+
129
+ <p align="center">
130
+ <img width="900" src="figs/Figure-1.png">
131
+ </p>
132
+
133
+
134
+ - </details>
135
+
136
+ ## Citation
137
+
138
+ If you find the code helpful in your resarch or work, please cite the following paper(s).
139
+
140
+ ```
141
+ @inproceedings{chen2023dual,
142
+ title={Dual Aggregation Transformer for Image Super-Resolution},
143
+ author={Chen, Zheng and Zhang, Yulun and Gu, Jinjin and Kong, Linghe and Yang, Xiaokang and Yu, Fisher},
144
+ booktitle={ICCV},
145
+ year={2023}
146
+ }
147
+ ```
148
 
149
  ## Acknowledgements
150
 
figs/.gitattributes ADDED
@@ -0,0 +1 @@
 
 
1
+ *.{png,jpg} filter=lfs diff=lfs merge=lfs -text
figs/DAT.png ADDED

Git LFS Details

  • SHA256: 39fd2add39fb54231203ea4208e69ed7f734653724f0911b378e45f51c0913ab
  • Pointer size: 131 Bytes
  • Size of remote file: 474 kB
figs/Figure-1.png ADDED

Git LFS Details

  • SHA256: 6421c15a4025ec957764f6cb2266c57599606791a7bd8f46c62d25bf78ea49a0
  • Pointer size: 132 Bytes
  • Size of remote file: 2.07 MB
figs/Table-1.png ADDED

Git LFS Details

  • SHA256: 20e74e18b57965867cbab8577e2d94c008a70d9cbe0e8d5bd48cc1b293deaa75
  • Pointer size: 131 Bytes
  • Size of remote file: 470 kB
figs/img_049_Bicubic_x4.png ADDED

Git LFS Details

  • SHA256: 3996380256f52615ce2f84600324f0433b00dbea264c046f050b57e7949fd408
  • Pointer size: 129 Bytes
  • Size of remote file: 5.29 kB
figs/img_049_CAT_x4.png ADDED

Git LFS Details

  • SHA256: f3d7632543eaf421549d5c8802707f85446e38a30f8ff15921e0d65a9548b7b9
  • Pointer size: 129 Bytes
  • Size of remote file: 6.28 kB
figs/img_049_DAT_x4.png ADDED

Git LFS Details

  • SHA256: 5baa481452f89c8cbceafbf8fe0e1961981c419a45e543fa8e9387d233fee144
  • Pointer size: 129 Bytes
  • Size of remote file: 7.53 kB
figs/img_049_HR_x4.png ADDED

Git LFS Details

  • SHA256: 52ba1f51d25bf7b6b31faea72be5a635bee9787ddd65f866fb41d0c5aceb8154
  • Pointer size: 130 Bytes
  • Size of remote file: 10.1 kB
figs/img_049_SwinIR_x4.png ADDED

Git LFS Details

  • SHA256: aa8157d69d9fd0717e04a1155c2ac3de4a2106e43606bb176508f3b550bd328e
  • Pointer size: 129 Bytes
  • Size of remote file: 6.28 kB
figs/img_059_Bicubic_x4.png ADDED

Git LFS Details

  • SHA256: cd5bfc697784b24e7b6de830ff9a8e9ba15137579c99b19fdadb3d62497ad572
  • Pointer size: 129 Bytes
  • Size of remote file: 6.53 kB
figs/img_059_CAT_x4.png ADDED

Git LFS Details

  • SHA256: b433449418f16a1f47f68410c8ec6a3c86d3c35a7731393f87b49d63c7f509ba
  • Pointer size: 130 Bytes
  • Size of remote file: 12.2 kB
figs/img_059_DAT_x4.png ADDED

Git LFS Details

  • SHA256: 95114ee9f05bc8def69543e1c356bc716c9eb2f034d971581c808bd3e03eb3d0
  • Pointer size: 130 Bytes
  • Size of remote file: 12.9 kB
figs/img_059_HR_x4.png ADDED

Git LFS Details

  • SHA256: 6c5a46a3e801daa31f1950fb8173649708ddc11b3db095a0568876f4b7d7e353
  • Pointer size: 130 Bytes
  • Size of remote file: 14.3 kB
figs/img_059_SwinIR_x4.png ADDED

Git LFS Details

  • SHA256: 2be3b9f741b517a7fea3a4998cbc9203fe16693302cd3a4b349fac107bb0e531
  • Pointer size: 130 Bytes
  • Size of remote file: 11.5 kB
options/Test/test_DAT_S_x2.yml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # general settings
2
+ name: test_DAT_S_x2
3
+ model_type: SRModel
4
+ scale: 2
5
+ num_gpu: 1
6
+ manual_seed: 10
7
+
8
+ datasets:
9
+ test_1: # the 1st test dataset
10
+ task: SR
11
+ name: Set5
12
+ type: PairedImageDataset
13
+ dataroot_gt: datasets/benchmark/Set5/HR
14
+ dataroot_lq: datasets/benchmark/Set5/LR_bicubic/X2
15
+ filename_tmpl: '{}x2'
16
+ io_backend:
17
+ type: disk
18
+
19
+ test_2: # the 2st test dataset
20
+ task: SR
21
+ name: Set14
22
+ type: PairedImageDataset
23
+ dataroot_gt: datasets/benchmark/Set14/HR
24
+ dataroot_lq: datasets/benchmark/Set14/LR_bicubic/X2
25
+ filename_tmpl: '{}x2'
26
+ io_backend:
27
+ type: disk
28
+
29
+ test_3: # the 3st test dataset
30
+ task: SR
31
+ name: B100
32
+ type: PairedImageDataset
33
+ dataroot_gt: datasets/benchmark/B100/HR
34
+ dataroot_lq: datasets/benchmark/B100/LR_bicubic/X2
35
+ filename_tmpl: '{}x2'
36
+ io_backend:
37
+ type: disk
38
+
39
+ test_4: # the 4st test dataset
40
+ task: SR
41
+ name: Urban100
42
+ type: PairedImageDataset
43
+ dataroot_gt: datasets/benchmark/Urban100/HR
44
+ dataroot_lq: datasets/benchmark/Urban100/LR_bicubic/X2
45
+ filename_tmpl: '{}x2'
46
+ io_backend:
47
+ type: disk
48
+
49
+ test_5: # the 5st test dataset
50
+ task: SR
51
+ name: Manga109
52
+ type: PairedImageDataset
53
+ dataroot_gt: datasets/benchmark/Manga109/HR
54
+ dataroot_lq: datasets/benchmark/Manga109/LR_bicubic/X2
55
+ filename_tmpl: '{}_LRBI_x2'
56
+ io_backend:
57
+ type: disk
58
+
59
+
60
+ # network structures
61
+ network_g:
62
+ type: DAT
63
+ upscale: 2
64
+ in_chans: 3
65
+ img_size: 64
66
+ img_range: 1.
67
+ split_size: [8,16]
68
+ depth: [6,6,6,6,6,6]
69
+ embed_dim: 180
70
+ num_heads: [6,6,6,6,6,6]
71
+ expansion_factor: 2
72
+ resi_connection: '1conv'
73
+
74
+ # path
75
+ path:
76
+ pretrain_network_g: experiments/pretrained_models/DAT/DAT_S_x2.pth
77
+ strict_load_g: True
78
+
79
+ # validation settings
80
+ val:
81
+ save_img: False
82
+ suffix: ~ # add suffix to saved images, if None, use exp name
83
+ use_chop: False
84
+
85
+ metrics:
86
+ psnr: # metric name, can be arbitrary
87
+ type: calculate_psnr
88
+ crop_border: 2
89
+ test_y_channel: True
90
+ ssim:
91
+ type: calculate_ssim
92
+ crop_border: 2
93
+ test_y_channel: True
options/Test/test_DAT_S_x3.yml.yml ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # general settings
2
+ name: test_DAT_S_x3
3
+ model_type: SRModel
4
+ scale: 3
5
+ num_gpu: 1
6
+ manual_seed: 10
7
+
8
+ datasets:
9
+ test_1: # the 1st test dataset
10
+ task: SR
11
+ name: Set5
12
+ type: PairedImageDataset
13
+ dataroot_gt: datasets/benchmark/Set5/HR
14
+ dataroot_lq: datasets/benchmark/Set5/LR_bicubic/X3
15
+ filename_tmpl: '{}x3'
16
+ io_backend:
17
+ type: disk
18
+
19
+ test_2: # the 2st test dataset
20
+ task: SR
21
+ name: Set14
22
+ type: PairedImageDataset
23
+ dataroot_gt: datasets/benchmark/Set14/HR
24
+ dataroot_lq: datasets/benchmark/Set14/LR_bicubic/X3
25
+ filename_tmpl: '{}x3'
26
+ io_backend:
27
+ type: disk
28
+
29
+ test_3: # the 3st test dataset
30
+ task: SR
31
+ name: B100
32
+ type: PairedImageDataset
33
+ dataroot_gt: datasets/benchmark/B100/HR
34
+ dataroot_lq: datasets/benchmark/B100/LR_bicubic/X3
35
+ filename_tmpl: '{}x3'
36
+ io_backend:
37
+ type: disk
38
+
39
+ test_4: # the 4st test dataset
40
+ task: SR
41
+ name: Urban100
42
+ type: PairedImageDataset
43
+ dataroot_gt: datasets/benchmark/Urban100/HR
44
+ dataroot_lq: datasets/benchmark/Urban100/LR_bicubic/X3
45
+ filename_tmpl: '{}x3'
46
+ io_backend:
47
+ type: disk
48
+
49
+ test_5: # the 5st test dataset
50
+ task: SR
51
+ name: Manga109
52
+ type: PairedImageDataset
53
+ dataroot_gt: datasets/benchmark/Manga109/HR
54
+ dataroot_lq: datasets/benchmark/Manga109/LR_bicubic/X3
55
+ filename_tmpl: '{}_LRBI_x3'
56
+ io_backend:
57
+ type: disk
58
+
59
+ # network structures
60
+ network_g:
61
+ type: DAT
62
+ upscale: 3
63
+ in_chans: 3
64
+ img_size: 64
65
+ img_range: 1.
66
+ split_size: [8,16]
67
+ depth: [6,6,6,6,6,6]
68
+ embed_dim: 180
69
+ num_heads: [6,6,6,6,6,6]
70
+ expansion_factor: 2
71
+ resi_connection: '1conv'
72
+
73
+ # path
74
+ path:
75
+ pretrain_network_g: experiments/pretrained_models/DAT/DAT_S_x3.pth
76
+ strict_load_g: True
77
+
78
+ # validation settings
79
+ val:
80
+ save_img: False
81
+ suffix: ~ # add suffix to saved images, if None, use exp name
82
+ use_chop: False
83
+
84
+ metrics:
85
+ psnr: # metric name, can be arbitrary
86
+ type: calculate_psnr
87
+ crop_border: 3
88
+ test_y_channel: True
89
+ ssim:
90
+ type: calculate_ssim
91
+ crop_border: 3
92
+ test_y_channel: True
options/Test/test_DAT_S_x4.yml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # general settings
2
+ name: test_DAT_S_x4
3
+ model_type: SRModel
4
+ scale: 4
5
+ num_gpu: 1
6
+ manual_seed: 10
7
+
8
+ datasets:
9
+ test_1: # the 1st test dataset
10
+ task: SR
11
+ name: Set5
12
+ type: PairedImageDataset
13
+ dataroot_gt: datasets/benchmark/Set5/HR
14
+ dataroot_lq: datasets/benchmark/Set5/LR_bicubic/X4
15
+ filename_tmpl: '{}x4'
16
+ io_backend:
17
+ type: disk
18
+
19
+ test_2: # the 2st test dataset
20
+ task: SR
21
+ name: Set14
22
+ type: PairedImageDataset
23
+ dataroot_gt: datasets/benchmark/Set14/HR
24
+ dataroot_lq: datasets/benchmark/Set14/LR_bicubic/X4
25
+ filename_tmpl: '{}x4'
26
+ io_backend:
27
+ type: disk
28
+
29
+ test_3: # the 3st test dataset
30
+ task: SR
31
+ name: B100
32
+ type: PairedImageDataset
33
+ dataroot_gt: datasets/benchmark/B100/HR
34
+ dataroot_lq: datasets/benchmark/B100/LR_bicubic/X4
35
+ filename_tmpl: '{}x4'
36
+ io_backend:
37
+ type: disk
38
+
39
+ test_4: # the 4st test dataset
40
+ task: SR
41
+ name: Urban100
42
+ type: PairedImageDataset
43
+ dataroot_gt: datasets/benchmark/Urban100/HR
44
+ dataroot_lq: datasets/benchmark/Urban100/LR_bicubic/X4
45
+ filename_tmpl: '{}x4'
46
+ io_backend:
47
+ type: disk
48
+
49
+ test_5: # the 5st test dataset
50
+ task: SR
51
+ name: Manga109
52
+ type: PairedImageDataset
53
+ dataroot_gt: datasets/benchmark/Manga109/HR
54
+ dataroot_lq: datasets/benchmark/Manga109/LR_bicubic/X4
55
+ filename_tmpl: '{}_LRBI_x4'
56
+ io_backend:
57
+ type: disk
58
+
59
+
60
+ # network structures
61
+ network_g:
62
+ type: DAT
63
+ upscale: 4
64
+ in_chans: 3
65
+ img_size: 64
66
+ img_range: 1.
67
+ split_size: [8,16]
68
+ depth: [6,6,6,6,6,6]
69
+ embed_dim: 180
70
+ num_heads: [6,6,6,6,6,6]
71
+ expansion_factor: 2
72
+ resi_connection: '1conv'
73
+
74
+ # path
75
+ path:
76
+ pretrain_network_g: experiments/pretrained_models/DAT/DAT_S_x4.pth
77
+ strict_load_g: True
78
+
79
+ # validation settings
80
+ val:
81
+ save_img: False
82
+ suffix: ~ # add suffix to saved images, if None, use exp name
83
+ use_chop: False
84
+
85
+ metrics:
86
+ psnr: # metric name, can be arbitrary
87
+ type: calculate_psnr
88
+ crop_border: 4
89
+ test_y_channel: True
90
+ ssim:
91
+ type: calculate_ssim
92
+ crop_border: 4
93
+ test_y_channel: True
options/Test/test_DAT_x2.yml CHANGED
@@ -64,11 +64,11 @@ network_g:
64
  in_chans: 3
65
  img_size: 64
66
  img_range: 1.
67
- split_size: [8,16]
68
  depth: [6,6,6,6,6,6]
69
  embed_dim: 180
70
  num_heads: [6,6,6,6,6,6]
71
- expansion_factor: 2
72
  resi_connection: '1conv'
73
 
74
  # path
 
64
  in_chans: 3
65
  img_size: 64
66
  img_range: 1.
67
+ split_size: [8,32]
68
  depth: [6,6,6,6,6,6]
69
  embed_dim: 180
70
  num_heads: [6,6,6,6,6,6]
71
+ expansion_factor: 4
72
  resi_connection: '1conv'
73
 
74
  # path
options/Test/test_DAT_x3.yml CHANGED
@@ -63,11 +63,11 @@ network_g:
63
  in_chans: 3
64
  img_size: 64
65
  img_range: 1.
66
- split_size: [8,16]
67
  depth: [6,6,6,6,6,6]
68
  embed_dim: 180
69
  num_heads: [6,6,6,6,6,6]
70
- expansion_factor: 2
71
  resi_connection: '1conv'
72
 
73
  # path
 
63
  in_chans: 3
64
  img_size: 64
65
  img_range: 1.
66
+ split_size: [8,32]
67
  depth: [6,6,6,6,6,6]
68
  embed_dim: 180
69
  num_heads: [6,6,6,6,6,6]
70
+ expansion_factor: 4
71
  resi_connection: '1conv'
72
 
73
  # path
options/Test/test_DAT_x4.yml CHANGED
@@ -64,11 +64,11 @@ network_g:
64
  in_chans: 3
65
  img_size: 64
66
  img_range: 1.
67
- split_size: [8,16]
68
  depth: [6,6,6,6,6,6]
69
  embed_dim: 180
70
  num_heads: [6,6,6,6,6,6]
71
- expansion_factor: 2
72
  resi_connection: '1conv'
73
 
74
  # path
 
64
  in_chans: 3
65
  img_size: 64
66
  img_range: 1.
67
+ split_size: [8,32]
68
  depth: [6,6,6,6,6,6]
69
  embed_dim: 180
70
  num_heads: [6,6,6,6,6,6]
71
+ expansion_factor: 4
72
  resi_connection: '1conv'
73
 
74
  # path
options/Train/train_DAT_S_x2.yml ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # general settings
2
+ name: train_DAT_S_x2
3
+ model_type: SRModel
4
+ scale: 2
5
+ num_gpu: auto
6
+ manual_seed: 10
7
+
8
+ # dataset and data loader settings
9
+ datasets:
10
+ train:
11
+ task: SR
12
+ name: DF2K
13
+ type: PairedImageDataset
14
+ dataroot_gt: datasets/DF2K/HR
15
+ dataroot_lq: datasets/DF2K/LR_bicubic/X2
16
+ filename_tmpl: '{}x2'
17
+ io_backend:
18
+ type: disk
19
+
20
+ gt_size: 128
21
+ use_hflip: True
22
+ use_rot: True
23
+
24
+ # data loader
25
+ use_shuffle: True
26
+ num_worker_per_gpu: 12
27
+ batch_size_per_gpu: 8
28
+ dataset_enlarge_ratio: 100
29
+ prefetch_mode: ~
30
+
31
+ val:
32
+ task: SR
33
+ name: Set5
34
+ type: PairedImageDataset
35
+ dataroot_gt: datasets/benchmark/Set5/HR
36
+ dataroot_lq: datasets/benchmark/Set5/LR_bicubic/X2
37
+ filename_tmpl: '{}x2'
38
+ io_backend:
39
+ type: disk
40
+
41
+ # network structures
42
+ network_g:
43
+ type: DAT
44
+ upscale: 2
45
+ in_chans: 3
46
+ img_size: 64
47
+ img_range: 1.
48
+ split_size: [8,16]
49
+ depth: [6,6,6,6,6,6]
50
+ embed_dim: 180
51
+ num_heads: [6,6,6,6,6,6]
52
+ expansion_factor: 2
53
+ resi_connection: '1conv'
54
+
55
+ # path
56
+ path:
57
+ pretrain_network_g: ~
58
+ strict_load_g: True
59
+ resume_state: ~
60
+
61
+ # training settings
62
+ train:
63
+ optim_g:
64
+ type: Adam
65
+ lr: !!float 2e-4
66
+ weight_decay: 0
67
+ betas: [0.9, 0.99]
68
+
69
+ scheduler:
70
+ type: MultiStepLR
71
+ milestones: [250000, 400000, 450000, 475000]
72
+ gamma: 0.5
73
+
74
+ total_iter: 500000
75
+ warmup_iter: -1 # no warm up
76
+
77
+ # losses
78
+ pixel_opt:
79
+ type: L1Loss
80
+ loss_weight: 1.0
81
+ reduction: mean
82
+
83
+ # validation settings
84
+ val:
85
+ val_freq: !!float 5e3
86
+ save_img: False
87
+
88
+ metrics:
89
+ psnr: # metric name, can be arbitrary
90
+ type: calculate_psnr
91
+ crop_border: 2
92
+ test_y_channel: True
93
+
94
+ # logging settings
95
+ logger:
96
+ print_freq: 200
97
+ save_checkpoint_freq: !!float 5e3
98
+ use_tb_logger: True
99
+ wandb:
100
+ project: ~
101
+ resume_id: ~
102
+
103
+ # dist training settings
104
+ dist_params:
105
+ backend: nccl
106
+ port: 29500
options/Train/train_DAT_S_x3.yml.yml ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # general settings
2
+ name: train_DAT_S_x3
3
+ model_type: SRModel
4
+ scale: 3
5
+ num_gpu: auto
6
+ manual_seed: 10
7
+
8
+ # dataset and data loader settings
9
+ datasets:
10
+ train:
11
+ task: SR
12
+ name: DF2K
13
+ type: PairedImageDataset
14
+ dataroot_gt: datasets/DF2K/HR
15
+ dataroot_lq: datasets/DF2K/LR_bicubic/X3
16
+ filename_tmpl: '{}x3'
17
+ io_backend:
18
+ type: disk
19
+
20
+ gt_size: 192
21
+ use_hflip: True
22
+ use_rot: True
23
+
24
+ # data loader
25
+ use_shuffle: True
26
+ num_worker_per_gpu: 12
27
+ batch_size_per_gpu: 8
28
+ dataset_enlarge_ratio: 100
29
+ prefetch_mode: ~
30
+
31
+ val:
32
+ task: SR
33
+ name: Set5
34
+ type: PairedImageDataset
35
+ dataroot_gt: datasets/benchmark/Set5/HR
36
+ dataroot_lq: datasets/benchmark/Set5/LR_bicubic/X3
37
+ filename_tmpl: '{}x3'
38
+ io_backend:
39
+ type: disk
40
+
41
+ # network structures
42
+ network_g:
43
+ type: DAT
44
+ upscale: 2
45
+ in_chans: 3
46
+ img_size: 64
47
+ img_range: 1.
48
+ split_size: [8,16]
49
+ depth: [6,6,6,6,6,6]
50
+ embed_dim: 180
51
+ num_heads: [6,6,6,6,6,6]
52
+ expansion_factor: 2
53
+ resi_connection: '1conv'
54
+
55
+ # path
56
+ path:
57
+ pretrain_network_g: experiments/pretrained_models/DAT-S/DAT_S_x2.pth # save half of training time if we finetune from x2 and halve initial lr.
58
+ strict_load_g: False
59
+ resume_state: ~
60
+
61
+ # training settings
62
+ train:
63
+ optim_g:
64
+ type: Adam
65
+ # lr: !!float 2e-4
66
+ lr: !!float 1e-4
67
+ weight_decay: 0
68
+ betas: [0.9, 0.99]
69
+
70
+ scheduler:
71
+ type: MultiStepLR
72
+ # milestones: [ 250000, 400000, 450000, 475000 ]
73
+ milestones: [ 125000, 200000, 225000, 237500 ]
74
+ gamma: 0.5
75
+
76
+ # total_iter: 500000
77
+ total_iter: 250000
78
+ warmup_iter: -1 # no warm up
79
+
80
+ # losses
81
+ pixel_opt:
82
+ type: L1Loss
83
+ loss_weight: 1.0
84
+ reduction: mean
85
+
86
+ # validation settings
87
+ val:
88
+ val_freq: !!float 5e3
89
+ save_img: False
90
+
91
+ metrics:
92
+ psnr: # metric name, can be arbitrary
93
+ type: calculate_psnr
94
+ crop_border: 4
95
+ test_y_channel: True
96
+
97
+ # logging settings
98
+ logger:
99
+ print_freq: 200
100
+ save_checkpoint_freq: !!float 5e3
101
+ use_tb_logger: True
102
+ wandb:
103
+ project: ~
104
+ resume_id: ~
105
+
106
+ # dist training settings
107
+ dist_params:
108
+ backend: nccl
109
+ port: 29500
options/Train/train_DAT_S_x4.yml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # general settings
2
+ name: test_DAT_S_x4
3
+ model_type: SRModel
4
+ scale: 4
5
+ num_gpu: auto
6
+ manual_seed: 10
7
+
8
+ # dataset and data loader settings
9
+ datasets:
10
+ train:
11
+ task: SR
12
+ name: DF2K
13
+ type: PairedImageDataset
14
+ dataroot_gt: datasets/DF2K/HR
15
+ dataroot_lq: datasets/DF2K/LR_bicubic/X4
16
+ filename_tmpl: '{}x4'
17
+ io_backend:
18
+ type: disk
19
+
20
+ gt_size: 256
21
+ use_hflip: true
22
+ use_rot: true
23
+
24
+ # data loader
25
+ use_shuffle: True
26
+ num_worker_per_gpu: 12
27
+ batch_size_per_gpu: 8
28
+ dataset_enlarge_ratio: 100
29
+ prefetch_mode: ~
30
+
31
+ val:
32
+ task: SR
33
+ name: Set5
34
+ type: PairedImageDataset
35
+ dataroot_gt: datasets/benchmark/Set5/HR
36
+ dataroot_lq: datasets/benchmark/Set5/LR_bicubic/X4
37
+ filename_tmpl: '{}x4'
38
+ io_backend:
39
+ type: disk
40
+
41
+
42
+ # network structures
43
+ network_g:
44
+ type: DAT
45
+ upscale: 4
46
+ in_chans: 3
47
+ img_size: 64
48
+ img_range: 1.
49
+ split_size: [8,16]
50
+ depth: [6,6,6,6,6,6]
51
+ embed_dim: 180
52
+ num_heads: [6,6,6,6,6,6]
53
+ expansion_factor: 2
54
+ resi_connection: '1conv'
55
+
56
+ # path
57
+ path:
58
+ pretrain_network_g: experiments/pretrained_models/DAT-S/DAT_S_x2.pth # save half of training time if we finetune from x2 and halve initial lr.
59
+ strict_load_g: False
60
+ resume_state: ~
61
+
62
+ # training settings
63
+ train:
64
+ optim_g:
65
+ type: Adam
66
+ # lr: !!float 2e-4
67
+ lr: !!float 1e-4
68
+ weight_decay: 0
69
+ betas: [0.9, 0.99]
70
+
71
+ scheduler:
72
+ type: MultiStepLR
73
+ # milestones: [ 250000, 400000, 450000, 475000 ]
74
+ milestones: [ 125000, 200000, 225000, 237500 ]
75
+ gamma: 0.5
76
+
77
+ # total_iter: 500000
78
+ total_iter: 250000
79
+ warmup_iter: -1 # no warm up
80
+
81
+ # losses
82
+ pixel_opt:
83
+ type: L1Loss
84
+ loss_weight: 1.0
85
+ reduction: mean
86
+
87
+ # validation settings
88
+ val:
89
+ val_freq: !!float 5e3
90
+ save_img: False
91
+
92
+ metrics:
93
+ psnr: # metric name, can be arbitrary
94
+ type: calculate_psnr
95
+ crop_border: 4
96
+ test_y_channel: True
97
+
98
+ # logging settings
99
+ logger:
100
+ print_freq: 200
101
+ save_checkpoint_freq: !!float 5e3
102
+ use_tb_logger: True
103
+ wandb:
104
+ project: ~
105
+ resume_id: ~
106
+
107
+ # dist training settings
108
+ dist_params:
109
+ backend: nccl
110
+ port: 29500
options/Train/train_DAT_x2.yml ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # general settings
2
+ name: train_DAT_x2
3
+ model_type: SRModel
4
+ scale: 2
5
+ num_gpu: auto
6
+ manual_seed: 10
7
+
8
+ # dataset and data loader settings
9
+ datasets:
10
+ train:
11
+ task: SR
12
+ name: DF2K
13
+ type: PairedImageDataset
14
+ dataroot_gt: datasets/DF2K/HR
15
+ dataroot_lq: datasets/DF2K/LR_bicubic/X2
16
+ filename_tmpl: '{}x2'
17
+ io_backend:
18
+ type: disk
19
+
20
+ gt_size: 128
21
+ use_hflip: True
22
+ use_rot: True
23
+
24
+ # data loader
25
+ use_shuffle: True
26
+ num_worker_per_gpu: 12
27
+ batch_size_per_gpu: 8
28
+ dataset_enlarge_ratio: 100
29
+ prefetch_mode: ~
30
+
31
+ val:
32
+ task: SR
33
+ name: Set5
34
+ type: PairedImageDataset
35
+ dataroot_gt: datasets/benchmark/Set5/HR
36
+ dataroot_lq: datasets/benchmark/Set5/LR_bicubic/X2
37
+ filename_tmpl: '{}x2'
38
+ io_backend:
39
+ type: disk
40
+
41
+ # network structures
42
+ network_g:
43
+ type: DAT
44
+ upscale: 2
45
+ in_chans: 3
46
+ img_size: 64
47
+ img_range: 1.
48
+ split_size: [8,32]
49
+ depth: [6,6,6,6,6,6]
50
+ embed_dim: 180
51
+ num_heads: [6,6,6,6,6,6]
52
+ expansion_factor: 4
53
+ resi_connection: '1conv'
54
+
55
+ # path
56
+ path:
57
+ pretrain_network_g: ~
58
+ strict_load_g: True
59
+ resume_state: ~
60
+
61
+ # training settings
62
+ train:
63
+ optim_g:
64
+ type: Adam
65
+ lr: !!float 2e-4
66
+ weight_decay: 0
67
+ betas: [0.9, 0.99]
68
+
69
+ scheduler:
70
+ type: MultiStepLR
71
+ milestones: [250000, 400000, 450000, 475000]
72
+ gamma: 0.5
73
+
74
+ total_iter: 500000
75
+ warmup_iter: -1 # no warm up
76
+
77
+ # losses
78
+ pixel_opt:
79
+ type: L1Loss
80
+ loss_weight: 1.0
81
+ reduction: mean
82
+
83
+ # validation settings
84
+ val:
85
+ val_freq: !!float 5e3
86
+ save_img: False
87
+
88
+ metrics:
89
+ psnr: # metric name, can be arbitrary
90
+ type: calculate_psnr
91
+ crop_border: 2
92
+ test_y_channel: True
93
+
94
+ # logging settings
95
+ logger:
96
+ print_freq: 200
97
+ save_checkpoint_freq: !!float 5e3
98
+ use_tb_logger: True
99
+ wandb:
100
+ project: ~
101
+ resume_id: ~
102
+
103
+ # dist training settings
104
+ dist_params:
105
+ backend: nccl
106
+ port: 29500
options/Train/train_DAT_x3.yml ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # general settings
2
+ name: train_DAT_x3
3
+ model_type: SRModel
4
+ scale: 3
5
+ num_gpu: auto
6
+ manual_seed: 10
7
+
8
+ # dataset and data loader settings
9
+ datasets:
10
+ train:
11
+ task: SR
12
+ name: DF2K
13
+ type: PairedImageDataset
14
+ dataroot_gt: datasets/DF2K/HR
15
+ dataroot_lq: datasets/DF2K/LR_bicubic/X3
16
+ filename_tmpl: '{}x3'
17
+ io_backend:
18
+ type: disk
19
+
20
+ gt_size: 192
21
+ use_hflip: True
22
+ use_rot: True
23
+
24
+ # data loader
25
+ use_shuffle: True
26
+ num_worker_per_gpu: 12
27
+ batch_size_per_gpu: 8
28
+ dataset_enlarge_ratio: 100
29
+ prefetch_mode: ~
30
+
31
+ val:
32
+ task: SR
33
+ name: Set5
34
+ type: PairedImageDataset
35
+ dataroot_gt: datasets/benchmark/Set5/HR
36
+ dataroot_lq: datasets/benchmark/Set5/LR_bicubic/X3
37
+ filename_tmpl: '{}x3'
38
+ io_backend:
39
+ type: disk
40
+
41
+ # network structures
42
+ network_g:
43
+ type: DAT
44
+ upscale: 2
45
+ in_chans: 3
46
+ img_size: 64
47
+ img_range: 1.
48
+ split_size: [8,32]
49
+ depth: [6,6,6,6,6,6]
50
+ embed_dim: 180
51
+ num_heads: [6,6,6,6,6,6]
52
+ expansion_factor: 4
53
+ resi_connection: '1conv'
54
+
55
+ # path
56
+ path:
57
+ pretrain_network_g: experiments/pretrained_models/DAT/DAT_x2.pth # save half of training time if we finetune from x2 and halve initial lr.
58
+ strict_load_g: False
59
+ resume_state: ~
60
+
61
+ # training settings
62
+ train:
63
+ optim_g:
64
+ type: Adam
65
+ # lr: !!float 2e-4
66
+ lr: !!float 1e-4
67
+ weight_decay: 0
68
+ betas: [0.9, 0.99]
69
+
70
+ scheduler:
71
+ type: MultiStepLR
72
+ # milestones: [ 250000, 400000, 450000, 475000 ]
73
+ milestones: [ 125000, 200000, 225000, 237500 ]
74
+ gamma: 0.5
75
+
76
+ # total_iter: 500000
77
+ total_iter: 250000
78
+ warmup_iter: -1 # no warm up
79
+
80
+ # losses
81
+ pixel_opt:
82
+ type: L1Loss
83
+ loss_weight: 1.0
84
+ reduction: mean
85
+
86
+ # validation settings
87
+ val:
88
+ val_freq: !!float 5e3
89
+ save_img: False
90
+
91
+ metrics:
92
+ psnr: # metric name, can be arbitrary
93
+ type: calculate_psnr
94
+ crop_border: 4
95
+ test_y_channel: True
96
+
97
+ # logging settings
98
+ logger:
99
+ print_freq: 200
100
+ save_checkpoint_freq: !!float 5e3
101
+ use_tb_logger: True
102
+ wandb:
103
+ project: ~
104
+ resume_id: ~
105
+
106
+ # dist training settings
107
+ dist_params:
108
+ backend: nccl
109
+ port: 29500
options/Train/train_DAT_x4.yml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # general settings
2
+ name: test_DAT_S_x4
3
+ model_type: SRModel
4
+ scale: 4
5
+ num_gpu: auto
6
+ manual_seed: 10
7
+
8
+ # dataset and data loader settings
9
+ datasets:
10
+ train:
11
+ task: SR
12
+ name: DF2K
13
+ type: PairedImageDataset
14
+ dataroot_gt: datasets/DF2K/HR
15
+ dataroot_lq: datasets/DF2K/LR_bicubic/X4
16
+ filename_tmpl: '{}x4'
17
+ io_backend:
18
+ type: disk
19
+
20
+ gt_size: 256
21
+ use_hflip: true
22
+ use_rot: true
23
+
24
+ # data loader
25
+ use_shuffle: True
26
+ num_worker_per_gpu: 12
27
+ batch_size_per_gpu: 8
28
+ dataset_enlarge_ratio: 100
29
+ prefetch_mode: ~
30
+
31
+ val:
32
+ task: SR
33
+ name: Set5
34
+ type: PairedImageDataset
35
+ dataroot_gt: datasets/benchmark/Set5/HR
36
+ dataroot_lq: datasets/benchmark/Set5/LR_bicubic/X4
37
+ filename_tmpl: '{}x4'
38
+ io_backend:
39
+ type: disk
40
+
41
+
42
+ # network structures
43
+ network_g:
44
+ type: DAT
45
+ upscale: 4
46
+ in_chans: 3
47
+ img_size: 64
48
+ img_range: 1.
49
+ split_size: [8,32]
50
+ depth: [6,6,6,6,6,6]
51
+ embed_dim: 180
52
+ num_heads: [6,6,6,6,6,6]
53
+ expansion_factor: 4
54
+ resi_connection: '1conv'
55
+
56
+ # path
57
+ path:
58
+ pretrain_network_g: experiments/pretrained_models/DAT-S/DAT_S_x2.pth # save half of training time if we finetune from x2 and halve initial lr.
59
+ strict_load_g: False
60
+ resume_state: ~
61
+
62
+ # training settings
63
+ train:
64
+ optim_g:
65
+ type: Adam
66
+ # lr: !!float 2e-4
67
+ lr: !!float 1e-4
68
+ weight_decay: 0
69
+ betas: [0.9, 0.99]
70
+
71
+ scheduler:
72
+ type: MultiStepLR
73
+ # milestones: [ 250000, 400000, 450000, 475000 ]
74
+ milestones: [ 125000, 200000, 225000, 237500 ]
75
+ gamma: 0.5
76
+
77
+ # total_iter: 500000
78
+ total_iter: 250000
79
+ warmup_iter: -1 # no warm up
80
+
81
+ # losses
82
+ pixel_opt:
83
+ type: L1Loss
84
+ loss_weight: 1.0
85
+ reduction: mean
86
+
87
+ # validation settings
88
+ val:
89
+ val_freq: !!float 5e3
90
+ save_img: False
91
+
92
+ metrics:
93
+ psnr: # metric name, can be arbitrary
94
+ type: calculate_psnr
95
+ crop_border: 4
96
+ test_y_channel: True
97
+
98
+ # logging settings
99
+ logger:
100
+ print_freq: 200
101
+ save_checkpoint_freq: !!float 5e3
102
+ use_tb_logger: True
103
+ wandb:
104
+ project: ~
105
+ resume_id: ~
106
+
107
+ # dist training settings
108
+ dist_params:
109
+ backend: nccl
110
+ port: 29500