AaronCIH commited on
Commit
cecf8c4
·
verified ·
1 Parent(s): 2160fea

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. 0_generate_list.py +778 -0
  2. 1_generate_iqa.py +393 -0
  3. Deblur/GoPro.tar.gz.part-aa +3 -0
  4. Deblur/GoPro.tar.gz.part-ab +3 -0
  5. Deblur/GoPro.tar.gz.part-ac +3 -0
  6. Deblur/HIDE.tar.gz.part-aa +3 -0
  7. Deblur/HIDE.tar.gz.part-ab +3 -0
  8. Deblur/HIDE.tar.gz.part-ac +3 -0
  9. Deblur/HIDE.tar.gz.part-ad +3 -0
  10. Deblur/HIDE.tar.gz.part-ae +3 -0
  11. Deblur/RealBlur-J_ECC_IMCORR_centroid_itensity_ref.tar.gz.part-aa +3 -0
  12. Deblur/RealBlur-J_ECC_IMCORR_centroid_itensity_ref.tar.gz.part-ab +3 -0
  13. Deblur/RealBlur-J_ECC_IMCORR_centroid_itensity_ref.tar.gz.part-ac +3 -0
  14. Deblur/RealBlur-R_BM3D_ECC_IMCORR_centroid_itensity_ref.tar.gz.part-aa +3 -0
  15. Deblur/RealBlur-R_BM3D_ECC_IMCORR_centroid_itensity_ref.tar.gz.part-ab +3 -0
  16. Dehaze/4kID.tar.gz.part-aa +3 -0
  17. Dehaze/4kID.tar.gz.part-ab +3 -0
  18. Dehaze/4kID.tar.gz.part-ac +3 -0
  19. Dehaze/4kID.tar.gz.part-ad +3 -0
  20. Dehaze/4kID.tar.gz.part-ae +3 -0
  21. Dehaze/4kID.tar.gz.part-af +3 -0
  22. Dehaze/4kID.tar.gz.part-ag +3 -0
  23. Dehaze/4kID.tar.gz.part-ah +3 -0
  24. Dehaze/4kID.tar.gz.part-ai +3 -0
  25. Dehaze/4kID.tar.gz.part-aj +3 -0
  26. Dehaze/4kID.tar.gz.part-ak +3 -0
  27. Dehaze/4kID.tar.gz.part-al +3 -0
  28. Dehaze/4kID.tar.gz.part-am +3 -0
  29. Dehaze/NH-Haze.tar.gz.part-aa +3 -0
  30. Dehaze/OTS.tar.gz.part-aa +3 -0
  31. Dehaze/OTS.tar.gz.part-ab +3 -0
  32. Dehaze/OTS.tar.gz.part-ac +3 -0
  33. Dehaze/SOTS.tar.gz.part-aa +3 -0
  34. Dehaze/UnannotatedHazyImages.tar.gz.part-aa +3 -0
  35. Denoise/BSD400.tar.gz.part-aa +3 -0
  36. Denoise/BSD68.tar.gz.part-aa +3 -0
  37. Denoise/CBSD68.tar.gz.part-aa +3 -0
  38. Denoise/Kodak.tar.gz.part-aa +3 -0
  39. Denoise/McMaster.tar.gz.part-aa +3 -0
  40. Denoise/SIDD.tar.gz.part-aa +3 -0
  41. Denoise/SIDD.tar.gz.part-ab +3 -0
  42. Denoise/SIDD.tar.gz.part-ac +3 -0
  43. Denoise/SIDD.tar.gz.part-ad +3 -0
  44. Denoise/Set12.tar.gz.part-aa +3 -0
  45. Denoise/Urban100.tar.gz.part-aa +3 -0
  46. Denoise/WaterlooED.tar.gz.part-aa +3 -0
  47. Derain/LHPRain.tar.gz.part-aa +3 -0
  48. Derain/LHPRain.tar.gz.part-ab +3 -0
  49. Derain/LHPRain.tar.gz.part-ac +3 -0
  50. Derain/LHPRain.tar.gz.part-ad +3 -0
0_generate_list.py ADDED
@@ -0,0 +1,778 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os, sys
2
+ import shutil
3
+ import numpy as np
4
+ from pathlib import Path
5
+
6
+ base_rt = f"/home/CORP/hsiang.chen/Project/Datasets/IR"
7
+
8
+ """
9
+ Deblur: GoPro, HIDE, RealBlur
10
+ """
11
+ # GoPro
12
+ # pre-process for GoPro, dataset: https://seungjunnah.github.io/Datasets/gopro
13
+ # Seungjun Nah, Tae Hyun Kim, and Kyoung Mu Lee. Deep multi-scale convolutional neural network for dynamic scene deblurring. In CVPR, 2017
14
+ rt = os.path.join(base_rt, "Deblur/GoPro")
15
+ meta_folder = os.path.join(rt, "metas")
16
+ os.makedirs(meta_folder, exist_ok=True)
17
+ for dset in ['train', 'test']: # train, test
18
+ dset_pth = os.path.join(rt, dset)
19
+ list_file = []
20
+ total_ct = 0
21
+ for sample_folder in os.listdir(dset_pth): # GOPOXXX_XX_XX
22
+ folder_pth = os.path.join(dset_pth, sample_folder)
23
+ blur_folder = os.path.join(folder_pth, 'blur')
24
+ sharp_folder = os.path.join(folder_pth, 'sharp')
25
+ for ct, sample in enumerate(os.listdir(blur_folder)):
26
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
27
+ blur_file = os.path.join(blur_folder, sample)
28
+ sharp_file = os.path.join(sharp_folder, sample)
29
+ list_file.append((blur_file, sharp_file))
30
+ total_ct += 1
31
+
32
+ with open(os.path.join(meta_folder,'{}.list'.format(dset)), 'w') as fp:
33
+ for item in list_file:
34
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
35
+ print(dset_pth, total_ct)
36
+
37
+ # HIDE
38
+ # pre-process for HIDE, dataset: https://github.com/joanshen0508/HA_deblur
39
+ # Ziyi Shen, Wenguan Wang, Xiankai Lu, Jianbing Shen, Haibin Ling, Tingfa Xu, and Ling Shao. Human-aware mo- tion deblurring. In ICCV, 2019.
40
+ # ==============================================
41
+ # HIDE/
42
+ # |- train/{image, gt}
43
+ # |- test/{image, gt}
44
+ # ==============================================
45
+ rt = os.path.join(base_rt, "Deblur/HIDE")
46
+ meta_folder = os.path.join(rt, "metas")
47
+ os.makedirs(meta_folder, exist_ok=True)
48
+ for dset in ['train', 'test']: # train, test
49
+ dset_pth = os.path.join(rt, dset)
50
+ list_file = []
51
+ total_ct = 0
52
+ if dset == 'train':
53
+ blur_folder = dset_pth
54
+ sharp_folder = os.path.join(rt, 'GT')
55
+ for ct, sample in enumerate(os.listdir(blur_folder)):
56
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
57
+ blur_file = os.path.join(blur_folder, sample)
58
+ sharp_file = os.path.join(sharp_folder, sample)
59
+ list_file.append((blur_file, sharp_file))
60
+ total_ct += 1
61
+ else:
62
+ for sample_folder in ['test-close-ups', 'test-long-shot']:
63
+ folder_pth = os.path.join(dset_pth, sample_folder)
64
+ blur_folder = folder_pth
65
+ sharp_folder = os.path.join(rt, 'GT')
66
+ for ct, sample in enumerate(os.listdir(blur_folder)):
67
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
68
+ blur_file = os.path.join(blur_folder, sample)
69
+ sharp_file = os.path.join(sharp_folder, sample)
70
+ list_file.append((blur_file, sharp_file))
71
+ total_ct += 1
72
+
73
+ with open(os.path.join(meta_folder,'{}.list'.format(dset)), 'w') as fp:
74
+ for item in list_file:
75
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
76
+ print(dset_pth, total_ct)
77
+
78
+ # RealBlur
79
+ # pre-process for RealBlur-J,R, dataset: https://github.com/rimchang/RealBlur
80
+ # Jaesung Rim, Haeyun Lee, Jucheol Won, and Sunghyun Cho. Real-world blur dataset for learning and benchmarking de- blurring algorithms. In ECCV, 2020.
81
+ rt = os.path.join(base_rt, "Deblur/")
82
+
83
+ realblur_j_test_txt = os.path.join(rt, f"RealBlur-J_ECC_IMCORR_centroid_itensity_ref/RealBlur_J_test_list.txt")
84
+ realblur_r_test_txt = os.path.join(rt, f"RealBlur-R_BM3D_ECC_IMCORR_centroid_itensity_ref/RealBlur_R_test_list.txt")
85
+
86
+ for txt in [realblur_j_test_txt, realblur_r_test_txt]:
87
+ data_list = []
88
+ total_ct = 0
89
+ miss_ct = 0
90
+ with open(txt) as fin:
91
+ for ct, line in enumerate(fin): # gt, image
92
+ line = line.strip().split()
93
+ if len(line) == 1: # no gt
94
+ data_list.append([None, os.path.join(rt, line[0])]) # image, None
95
+ miss_ct += 1
96
+ else:
97
+ data_list.append([os.path.join(rt, line[1]), os.path.join(rt, line[0])]) # image ,gt
98
+ total_ct += 1
99
+
100
+ set_dict = {realblur_j_test_txt: os.path.join(rt, f"RealBlur-J_ECC_IMCORR_centroid_itensity_ref"),
101
+ realblur_r_test_txt: os.path.join(rt, f"RealBlur-R_BM3D_ECC_IMCORR_centroid_itensity_ref")}
102
+ meta_folder = os.path.join(set_dict[txt], "metas")
103
+ os.makedirs(meta_folder, exist_ok=True)
104
+ with open(os.path.join(meta_folder,'test.list'), 'w') as fp:
105
+ for item in data_list:
106
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
107
+
108
+ print(os.path.join(meta_folder,'test.list'), total_ct, miss_ct)
109
+
110
+ """
111
+ Dehaze: 4kID, NH-Haze, OTS, SOTS
112
+ """
113
+ # OST
114
+ # pre-process for OTS, dataset: https://sites.google.com/view/reside-dehaze-datasets/reside-%CE%B2?authuser=0
115
+ # Boyi Li, Wenqi Ren, Dengpan Fu, Dacheng Tao, Dan Feng, Wenjun Zeng, and Zhangyang Wang. Benchmarking single- image dehazing and beyond. TIP, 2018.
116
+ rt = os.path.join(base_rt, "Dehaze/OTS")
117
+ meta_folder = os.path.join(rt, "metas")
118
+ os.makedirs(meta_folder, exist_ok=True)
119
+ for dset in ['hazy']:
120
+ dset_pth = os.path.join(rt, dset)
121
+ list_file = []
122
+ total_ct = 0
123
+ # 0025_0.8_0.1.jpg
124
+ for sub_folder in os.listdir(dset_pth):
125
+ input_folder = os.path.join(dset_pth, sub_folder)
126
+ gt_folder = os.path.join(rt, 'gt')
127
+ for ct, sample in enumerate(os.listdir(input_folder)):
128
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
129
+ input_file = os.path.join(input_folder, sample)
130
+ gt_file = os.path.join(gt_folder, "%s.jpg"%(sample.split('_')[0]))
131
+ list_file.append((input_file, gt_file))
132
+ total_ct += 1
133
+
134
+ set_dict = {"hazy":'train'}
135
+ with open(os.path.join(meta_folder,'{}.list'.format(set_dict[dset])), 'w') as fp:
136
+ for item in list_file:
137
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
138
+ print(dset_pth, total_ct)
139
+
140
+
141
+ # SOTS
142
+ # pre-process for SOTS, dataset: https://sites.google.com/view/reside-dehaze-datasets/reside-standard
143
+ # Boyi Li, Wenqi Ren, Dengpan Fu, Dacheng Tao, Dan Feng, Wenjun Zeng, and Zhangyang Wang. Benchmarking single- image dehazing and beyond. TIP, 2018.
144
+ rt = os.path.join(base_rt, "Dehaze/SOTS")
145
+ meta_folder = os.path.join(rt, "metas")
146
+ os.makedirs(meta_folder, exist_ok=True)
147
+ for dset in ['outdoor']:
148
+ dset_pth = os.path.join(rt, dset)
149
+ list_file = []
150
+ total_ct = 0
151
+ input_folder = os.path.join(dset_pth, 'hazy')
152
+ gt_folder = os.path.join(dset_pth, 'gt')
153
+ for ct, sample in enumerate(os.listdir(input_folder)):
154
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
155
+ input_file = os.path.join(input_folder, sample)
156
+ gt_file = os.path.join(gt_folder, "%s.png"%(sample.split("_")[0]))
157
+ list_file.append((input_file, gt_file))
158
+ total_ct += 1
159
+
160
+ set_dict = {"outdoor":'test'}
161
+ with open(os.path.join(meta_folder,'{}.list'.format(set_dict[dset])), 'w') as fp:
162
+ for item in list_file:
163
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
164
+ print(input_folder, total_ct)
165
+
166
+ # 4kID
167
+ # pre-process for 4kID, dataset: https://github.com/zzr-idam/4KDehazing
168
+ # Ultra-High-Definition Image Dehazing via Multi-Guided Bilateral Learning, CVPR21.
169
+ rt = os.path.join(base_rt, "Dehaze/4kID")
170
+ meta_folder = os.path.join(rt, "metas")
171
+ os.makedirs(meta_folder, exist_ok=True)
172
+ for dset in ['4KDehazing', '4KDehazing_test']: # train, test
173
+ dset_pth = os.path.join(rt, dset)
174
+ list_file = []
175
+ total_ct = 0
176
+ input_folder = os.path.join(dset_pth, 'inputs')
177
+ gt_folder = os.path.join(dset_pth, 'groundtrues')
178
+ for ct, sample in enumerate(os.listdir(input_folder)):
179
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
180
+ input_file = os.path.join(input_folder, sample)
181
+ gt_file = os.path.join(gt_folder, sample)
182
+ list_file.append((input_file, gt_file))
183
+ total_ct += 1
184
+
185
+ set_dict = {"4KDehazing":'train', "4KDehazing_test":'test'}
186
+ with open(os.path.join(meta_folder,'{}.list'.format(set_dict[dset])), 'w') as fp:
187
+ for item in list_file:
188
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
189
+ print(dset_pth, total_ct)
190
+
191
+
192
+ # Unann
193
+ # pre-process for unann, dataset: https://sites.google.com/view/reside-dehaze-datasets/reside-%CE%B2?authuser=0
194
+ rt = os.path.join(base_rt, "Dehaze/UnannotatedHazyImages")
195
+ meta_folder = os.path.join(rt, "metas")
196
+ os.makedirs(meta_folder, exist_ok=True)
197
+ list_file = []
198
+ total_ct = 0
199
+ input_folder = os.path.join(rt, "Image")
200
+ for ct, sample in enumerate(os.listdir(input_folder)):
201
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
202
+ input_file = os.path.join(input_folder, sample)
203
+ list_file.append((input_file, ""))
204
+ total_ct += 1
205
+
206
+ with open(os.path.join(meta_folder,'test.list'), 'w') as fp:
207
+ for item in list_file:
208
+ fp.write('{} {} {}\n'.format(item[0], None, None))
209
+ print(rt, total_ct)
210
+
211
+ # NH-Haze
212
+ rt = os.path.join(base_rt, "Dehaze/NH-Haze")
213
+ meta_folder = os.path.join(rt, "metas")
214
+ os.makedirs(meta_folder, exist_ok=True)
215
+ list_file = []
216
+ total_ct = 0
217
+ input_folder = os.path.join(rt, "images")
218
+ for ct, sample in enumerate(os.listdir(input_folder)):
219
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
220
+ input_file = os.path.join(input_folder, sample)
221
+ list_file.append((input_file, ""))
222
+ total_ct += 1
223
+
224
+ with open(os.path.join(meta_folder,'test.list'), 'w') as fp:
225
+ for item in list_file:
226
+ fp.write('{} {} {}\n'.format(item[0], None, None))
227
+ print(rt, total_ct)
228
+
229
+ """
230
+ Denoise: BSD68, BSD400, CBSD68, KodaK, McMaster, Set12, SIDD, Urban100, WaterlooED
231
+ """
232
+ """
233
+ pre-process for denoise dataset
234
+ 1. BSD400:
235
+ * David Martin, Charless Fowlkes, Doron Tal, and Jitendra Malik. A database of human segmented natural images and its application to evaluating segmentation algorithms and measuring ecological statistics. In Proceedings Eighth IEEE International Conference on Computer Vision. ICCV 2001, volume 2, pages 416–423. IEEE, 2001.
236
+ * https://github.com/smartboy110/denoising-datasets/tree/main
237
+ 2. WED:
238
+ * Kede Ma, Zhengfang Duanmu, Qingbo Wu, Zhou Wang, Hongwei Yong, Hongliang Li, and Lei Zhang. Waterloo exploration database: New challenges for image quality as- sessment models. IEEE Transactions on Image Processing, 26(2):1004–1016, 2016.
239
+ * https://kedema.org/project/exploration/index.html
240
+ 3. BSD68:
241
+ * David Martin, Charless Fowlkes, Doron Tal, and Jitendra Malik. A database of human segmented natural images and its application to evaluating segmentation algorithms and measuring ecological statistics. In Proceedings Eighth IEEE International Conference on Computer Vision. ICCV 2001, volume 2, pages 416–423. IEEE, 2001.
242
+ * https://github.com/smartboy110/denoising-datasets/tree/main
243
+ 4. CBSD68:
244
+ * David Martin, Charless Fowlkes, Doron Tal, and Jitendra Malik. A database of human segmented natural images and its application to evaluating segmentation algorithms and measuring ecological statistics. In Proceedings Eighth IEEE International Conference on Computer Vision. ICCV 2001, volume 2, pages 416–423. IEEE, 2001.
245
+ * https://github.com/smartboy110/denoising-datasets/tree/main
246
+ 5. Urban100:
247
+ * Jia-BinHuang,AbhishekSingh,andNarendraAhuja.Single image super-resolution from transformed self-exemplars. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5197–5206, 2015.
248
+ * https://github.com/jbhuang0604/SelfExSR
249
+ 6. Kodak:
250
+ * Rich Franzen. Kodak lossless true color image suite. source: http://r0k. us/graphics/kodak, 4(2), 1999.
251
+ * https://www.kaggle.com/datasets/sherylmehta/kodak-dataset
252
+ 7. McMaster, Set12
253
+ """
254
+
255
+ rt = os.path.join(base_rt, "Denoise")
256
+ dataset = ['BSD68', 'BSD400', 'CBSD68', 'Kodak',
257
+ 'McMaster', 'Set12', 'Urban100', 'WaterlooED']
258
+
259
+ for dset in dataset:
260
+ # list sample
261
+ list_file = []
262
+ total_ct = 0
263
+ dset_pth = os.path.join(rt, dset)
264
+ meta_folder = os.path.join(dset_pth, "metas")
265
+ os.makedirs(meta_folder, exist_ok=True)
266
+ input_folder = os.path.join(rt, '%s/image'%(dset))
267
+ for ct, sample in enumerate(os.listdir(input_folder)):
268
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
269
+ input_file = os.path.join(input_folder, sample)
270
+ list_file.append([input_file])
271
+ total_ct += 1
272
+
273
+ with open(os.path.join(meta_folder,'{}.list'.format(dset)), 'w') as fp:
274
+ for item in list_file:
275
+ fp.write('{} {} {}\n'.format(None, item[0], None))
276
+ print(input_folder, total_ct)
277
+
278
+
279
+ # SIDD
280
+ rt = os.path.join(base_rt, "Denoise/SIDD")
281
+ meta_folder = os.path.join(rt, "metas")
282
+ os.makedirs(meta_folder, exist_ok=True)
283
+ for dset in ['train', 'test']:
284
+ # list sample
285
+ list_file = []
286
+ total_ct = 0
287
+ dset_folder = os.path.join(rt, dset)
288
+ if dset == 'train':
289
+ for folder in os.listdir(dset_folder):
290
+ file_folder = os.path.join(dset_folder, folder)
291
+ for ct, sample in enumerate(os.listdir(file_folder)):
292
+ if "NOISY_SRGB" in sample:
293
+ input_file = os.path.join(file_folder, sample)
294
+ gt_file = os.path.join(file_folder, sample.replace("NOISY", "GT"))
295
+ list_file.append([input_file, gt_file])
296
+ total_ct += 1
297
+ elif dset == 'test':
298
+ image_folder = os.path.join(dset_folder, 'NOISY')
299
+ gt_folder = os.path.join(dset_folder, "GT")
300
+ for ct, sample in enumerate(os.listdir(image_folder)):
301
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
302
+ input_file = os.path.join(image_folder, sample)
303
+ gt_file = os.path.join(gt_folder, sample.replace("NOISY", "GT"))
304
+ list_file.append([input_file, gt_file])
305
+ total_ct += 1
306
+
307
+ with open(os.path.join(meta_folder,'{}.list'.format(dset)), 'w') as fp:
308
+ for item in list_file:
309
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
310
+ print(dset_folder, total_ct)
311
+
312
+
313
+ """
314
+ Derain: LHPRain, Practical, Rain100L, RainDS, RainTrianL, UHD-Rain
315
+ """
316
+ # RainDS
317
+ rt = os.path.join(base_rt, "Derain/RainDS")
318
+ meta_folder = os.path.join(rt, "metas")
319
+ os.makedirs(meta_folder, exist_ok=True)
320
+ for dset in ['RainDS_syn', 'RainDS_real']: # dataset
321
+ dataset_folder = os.path.join(rt, dset)
322
+ if dset == 'RainDS_syn':
323
+ set_list = ['train', 'test']
324
+ elif dset == 'RainDS_real':
325
+ set_list = ['train_set', 'test_set']
326
+ for subset in set_list:
327
+ input_folder = os.path.join(dataset_folder, subset)
328
+ for raintype in ['rainstreak', 'raindrop', 'rainstreak_raindrop']:
329
+ rain_folder = os.path.join(input_folder, raintype)
330
+ clear_folder = os.path.join(input_folder, 'gt')
331
+ list_file = []
332
+ total_ct = 0
333
+ rain_dict = {'rainstreak_raindrop': 'rd-rain', 'rainstreak': 'rain', 'raindrop': 'rd'}
334
+ # rd-rain-97, rain-97, rd-97 -> norain-97
335
+ # pie-rd-rain-97, pie-rain-97, pie-rd-97 -> pie-norain-97
336
+ for ct, sample in enumerate(os.listdir(rain_folder)):
337
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
338
+ input_file = os.path.join(rain_folder, sample)
339
+ gt_file = os.path.join(clear_folder, sample.replace(rain_dict[raintype], "norain"))
340
+ list_file.append((input_file, gt_file))
341
+ total_ct += 1
342
+
343
+ with open(os.path.join(meta_folder,'{}_{}_{}.list'.format(dset, subset, raintype)), 'w') as fp:
344
+ for item in list_file:
345
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
346
+ print(rain_folder, total_ct)
347
+
348
+ # LHPRain
349
+ # pre-process for LHPRain: https://github.com/yunguo224/LHP-Rain
350
+ # From Sky to the Ground: A Large-scale Benchmark and Simple Baseline Towards Real Rain Removal (ICCV 2023)
351
+ rt = os.path.join(base_rt, "Derain/LHPRain")
352
+ meta_folder = os.path.join(rt, "metas")
353
+ os.makedirs(meta_folder, exist_ok=True)
354
+ for dset in ['train', 'val', 'test']: # train, test
355
+ input_folder = os.path.join(rt, "input/%s"%(dset))
356
+ gt_folder = os.path.join(rt, "gt/%s"%(dset))
357
+ list_file = []
358
+ total_ct = 0
359
+ for ct, sample in enumerate(os.listdir(input_folder)):
360
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
361
+ input_file = os.path.join(input_folder, sample)
362
+ gt_file = os.path.join(gt_folder, sample)
363
+ list_file.append((input_file, gt_file))
364
+ total_ct += 1
365
+
366
+ with open(os.path.join(meta_folder,'{}.list'.format(dset)), 'w') as fp:
367
+ for item in list_file:
368
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
369
+ print(input_folder, total_ct)
370
+
371
+ # Practical
372
+ # pre-process for LHPRain: https://github.com/ZhangXinNan/RainDetectionAndRemoval
373
+ # WenhanYang,RobbyTTan,JiashiFeng,JiayingLiu,Zong- ming Guo, and Shuicheng Yan. Deep joint rain detection and removal from a single image. In CVPR, 2017
374
+ rt = os.path.join(base_rt, "Derain/Practical")
375
+ meta_folder = os.path.join(rt, "metas")
376
+ os.makedirs(meta_folder, exist_ok=True)
377
+ # create image folder
378
+ input_folder = os.path.join(rt, "image")
379
+ list_file = []
380
+ total_ct = 0
381
+ for ct, sample in enumerate(os.listdir(input_folder)):
382
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
383
+ input_file = os.path.join(input_folder, sample)
384
+ list_file.append((input_file))
385
+ total_ct += 1
386
+
387
+ with open(os.path.join(meta_folder,'test.list'), 'w') as fp:
388
+ for item in list_file:
389
+ fp.write('{} {} {}\n'.format(item, None, None))
390
+ print(rt, total_ct)
391
+
392
+
393
+ # Rain100L
394
+ # pre-process for Rain100L: https://github.com/shangwei5/BRN
395
+ # WenhanYang,RobbyTTan,JiashiFeng,JiayingLiu,Zong- ming Guo, and Shuicheng Yan. Deep joint rain detection and removal from a single image. In Proceedings of the IEEE conference on computer vision and pattern recogni- tion, pages 1357–1366, 2017.
396
+ # norain-xxx.png
397
+ # rain-xxx.png
398
+ # rainregion-xxx.png
399
+ # rainstreak-xxx.png
400
+ rt = os.path.join(base_rt, "Derain/Rain100L")
401
+ meta_folder = os.path.join(rt, "metas")
402
+ os.makedirs(meta_folder, exist_ok=True)
403
+
404
+ image_folder = os.path.join(rt, 'image')
405
+ gt_folder = os.path.join(rt, 'gt')
406
+ list_file = []
407
+ total_ct = 0
408
+ for ct, sample in enumerate(os.listdir(image_folder)):
409
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
410
+ input_file = os.path.join(image_folder, sample)
411
+ gt_file = os.path.join(gt_folder, sample.replace('rain', 'norain'))
412
+ list_file.append((input_file, gt_file))
413
+ total_ct += 1
414
+
415
+ with open(os.path.join(meta_folder,'test.list'), 'w') as fp:
416
+ for item in list_file:
417
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
418
+ print(rt, total_ct)
419
+
420
+ # Rain200L
421
+ # pre-process for RainTrainL(Rain200L): https://github.com/shangwei5/BRN
422
+ # Yang W, Tan RT, Feng J, Liu J, Guo Z, Yan S. Deep joint rain detection and removal from a single image. In IEEE CVPR 2017.
423
+ # norain-xxx.png
424
+ # rain-xxx.png
425
+ # rainregion-xxx.png
426
+ # rainstreak-xxx.png
427
+ rt = os.path.join(base_rt, "Derain/RainTrainL")
428
+ meta_folder = os.path.join(rt, "metas")
429
+ os.makedirs(meta_folder, exist_ok=True)
430
+ image_folder = os.path.join(rt, 'image')
431
+ gt_folder = os.path.join(rt, 'gt')
432
+ list_file = []
433
+ total_ct = 0
434
+ for ct, sample in enumerate(os.listdir(image_folder)):
435
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
436
+ input_file = os.path.join(image_folder, sample)
437
+ gt_file = os.path.join(gt_folder, sample.replace('rain', 'norain'))
438
+ list_file.append((input_file, gt_file))
439
+ total_ct += 1
440
+
441
+ with open(os.path.join(meta_folder,'train.list'), 'w') as fp:
442
+ for item in list_file:
443
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
444
+ print(rt, total_ct)
445
+
446
+ # UHD-Rain
447
+ # pre-process for UHD-Rain: https://github.com/wlydlut/uhddip
448
+ # UHDDIP: Ultra-High-Definition Restoration: New Benchmarks and A Dual Interaction Prior-Driven Solution
449
+ rt = os.path.join(base_rt, "Derain/UHD-Rain")
450
+ meta_folder = os.path.join(rt, "metas")
451
+ os.makedirs(meta_folder, exist_ok=True)
452
+
453
+ for dset in ['training_set', 'testing_set']: # train, test
454
+ dset_path = os.path.join(rt, dset)
455
+ input_folder = os.path.join(dset_path, 'input')
456
+ gt_folder = os.path.join(dset_path, 'gt')
457
+ list_file = []
458
+ for ct, sample in enumerate(os.listdir(input_folder)):
459
+ input_file = os.path.join(input_folder, sample)
460
+ gt_file = os.path.join(gt_folder, sample)
461
+ list_file.append((input_file, gt_file))
462
+
463
+ set_dict = {'training_set': 'train', 'testing_set':'test'}
464
+ with open(os.path.join(meta_folder,'{}.list'.format(set_dict[dset])), 'w') as fp:
465
+ for item in list_file:
466
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
467
+ print(rt, ct+1)
468
+
469
+
470
+ """
471
+ Desnow: Snow100k, UHD-Snow
472
+ """
473
+ # Snow100k: download: https://pan.baidu.com/s/1Y8fq8qQjC0YK5DTktYPfbQ?pwd=nyop#list/path=/sharelink688030094-540249285017805/snow100k&parentPath=/sharelink688030094-540249285017805
474
+ # Training set (50,000 images, 7.8GB), Test set (50,000 images, 7.8GB), Realistic snowy images (1,329 images, 67MB).
475
+ rt = os.path.join(base_rt, "Desnow/Snow100k")
476
+ meta_folder = os.path.join(rt, "metas")
477
+ os.makedirs(meta_folder, exist_ok=True)
478
+
479
+ folder = Path(rt)
480
+ img_list = list(folder.rglob("*.[jp][pn]g"))
481
+ for data in img_list:
482
+ if " " in str(data):
483
+ old = str(data)
484
+ new = old.replace(" ", "_")
485
+ os.rename(old, new)
486
+
487
+ # # training
488
+ train_rt = os.path.join(rt, 'all')
489
+ train_gt_rt = os.path.join(train_rt, 'gt')
490
+ train_img_rt = os.path.join(train_rt, 'synthetic')
491
+ list_file = []
492
+ total_ct = 0
493
+ for ct, sample in enumerate(os.listdir(train_img_rt)):
494
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
495
+ img_ = os.path.join(train_img_rt, sample)
496
+ gt_ = os.path.join(train_gt_rt, sample)
497
+ list_file.append((img_, gt_))
498
+ total_ct += 1
499
+
500
+ with open(os.path.join(meta_folder,'train.list'), 'w') as fp:
501
+ for item in list_file:
502
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
503
+ print(train_rt, total_ct)
504
+
505
+ # test_syn
506
+ test_rt = os.path.join(rt, 'media/jdway/GameSSD/overlapping/test')
507
+ for dset in os.listdir(test_rt):
508
+ test_folder = os.path.join(test_rt, dset)
509
+ test_gt_rt = os.path.join(test_folder, 'gt')
510
+ test_img_rt = os.path.join(test_folder, 'synthetic')
511
+ list_file = []
512
+ total_ct = 0
513
+ for ct, sample in enumerate(os.listdir(test_img_rt)):
514
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
515
+ img_ = os.path.join(test_img_rt, sample)
516
+ gt_ = os.path.join(test_gt_rt, sample)
517
+ list_file.append((img_, gt_))
518
+ total_ct += 1
519
+
520
+ with open(os.path.join(meta_folder,'test_%s.list'%(dset[-1])), 'w') as fp:
521
+ for item in list_file:
522
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
523
+ print(test_folder, total_ct)
524
+
525
+ # real-world testing
526
+ test_rt = os.path.join(rt, 'realistic')
527
+ list_file = []
528
+ total_ct = 0
529
+ for ct, sample in enumerate(os.listdir(test_rt)):
530
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
531
+ img_ = os.path.join(test_rt, sample)
532
+ list_file.append(img_)
533
+ total_ct += 1
534
+
535
+ with open(os.path.join(meta_folder,'test_realistic.list'), 'w') as fp:
536
+ for item in list_file:
537
+ fp.write('{} {} {}\n'.format(item, None, None))
538
+ print(test_rt, total_ct)
539
+
540
+
541
+ # UHD-Snow
542
+ # pre-process for UHD-Snow: https://github.com/wlydlut/uhddip
543
+ # UHDDIP: Ultra-High-Definition Restoration: New Benchmarks and A Dual Interaction Prior-Driven Solution
544
+ rt = os.path.join(base_rt, "Desnow/UHD-Snow")
545
+ meta_folder = os.path.join(rt, "metas")
546
+ os.makedirs(meta_folder, exist_ok=True)
547
+ for dset in ['training_set', 'testing_set']: # train, test
548
+ dset_path = os.path.join(rt, dset)
549
+ input_folder = os.path.join(dset_path, 'input')
550
+ gt_folder = os.path.join(dset_path, 'gt')
551
+ list_file = []
552
+ total_ct = 0
553
+ for ct, sample in enumerate(os.listdir(input_folder)):
554
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
555
+ input_file = os.path.join(input_folder, sample)
556
+ gt_file = os.path.join(gt_folder, sample)
557
+ list_file.append((input_file, gt_file))
558
+ total_ct += 1
559
+
560
+ set_dict = {'training_set': 'train', 'testing_set':'test'}
561
+ with open(os.path.join(meta_folder,'{}.list'.format(set_dict[dset])), 'w') as fp:
562
+ for item in list_file:
563
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
564
+ print(dset_path, total_ct)
565
+
566
+ """
567
+ Lowlight: DICM, LIME, LOL, MEF, NPE, VV
568
+ """
569
+ # LOL
570
+ # pre-process for LOL: https://github.com/fediory/hvi-cidnet
571
+ # Chen Wei, Wenjing Wang, Wenhan Yang, and Jiaying Liu. Deep retinex decomposition for low-light enhancement. In BMVC,2018
572
+ rt = os.path.join(base_rt, "LowLight/LOL")
573
+ meta_folder = os.path.join(rt, "metas")
574
+ os.makedirs(meta_folder, exist_ok=True)
575
+ for dset in ['our485', 'eval15']: # train, test
576
+ dset_path = os.path.join(rt, dset)
577
+ input_folder = os.path.join(dset_path, "low")
578
+ gt_folder = os.path.join(dset_path, "high")
579
+ list_file = []
580
+ total_ct = 0
581
+ for ct, sample in enumerate(os.listdir(input_folder)):
582
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
583
+ input_file = os.path.join(input_folder, sample)
584
+ gt_file = os.path.join(gt_folder, sample)
585
+ list_file.append((input_file, gt_file))
586
+ total_ct += 1
587
+
588
+ set_dict = {'our485':'train', 'eval15':'test'}
589
+ with open(os.path.join(meta_folder,'{}.list'.format(set_dict[dset])), 'w') as fp:
590
+ for item in list_file:
591
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
592
+ print(dset_path, total_ct)
593
+
594
+
595
+ # pre-process for low-light dataset
596
+ # 2. DICM:
597
+ # * Chulwoo Lee, Chul Lee, and Chang-Su Kim. Contrast en- hancement based on layered difference representation. In ICIP, 2012.
598
+ # * Link: Fediory/HVI-CIDNet: "You Only Need One Color Space: An Efficient Network for Low-light Image Enhancement" (github.com)
599
+ # 3. MEF:
600
+ # * Kede Ma, Kai Zeng, and Zhou Wang. Perceptual quality assessment for multi-exposure image fusion. TIP, 2015.
601
+ # * Link: Fediory/HVI-CIDNet: "You Only Need One Color Space: An Efficient Network for Low-light Image Enhancement" (github.com)
602
+ # 4. NPE:
603
+ # * ShuhangWang,JinZheng,Hai-MiaoHu,andBoLi.Naturalness preserved enhancement algorithm for non-uniform illumination images. TIP, 2013.
604
+ # * Link: Fediory/HVI-CIDNet: "You Only Need One Color Space: An Efficient Network for Low-light Image Enhancement" (github.com)
605
+ # 5. LIME:
606
+ # * Link: Fediory/HVI-CIDNet: "You Only Need One Color Space: An Efficient Network for Low-light Image Enhancement" (github.com)
607
+ # 6. VV:
608
+ # * Link: Fediory/HVI-CIDNet: "You Only Need One Color Space: An Efficient Network for Low-light Image Enhancement" (github.com)
609
+ rt = os.path.join(base_rt, "LowLight")
610
+
611
+ dataset = ['DICM', 'LIME', 'MEF', 'NPE', 'VV']
612
+ for dset in dataset:
613
+ # create image folder
614
+ # dset_pth = "./%s"%(dset)
615
+ # os.rename(dset_pth, 'image')
616
+ # os.makedirs(dset_pth)
617
+ # shutil.move('./image', dset_pth)
618
+
619
+ # list sample
620
+ dset_pth = os.path.join(rt, dset)
621
+ list_file = []
622
+ input_folder = os.path.join(dset_pth, 'image')
623
+ meta_folder = os.path.join(dset_pth, "metas")
624
+ os.makedirs(meta_folder, exist_ok=True)
625
+ folder = Path(input_folder)
626
+ img_list = list(folder.rglob("*.[jp][pn]g"))
627
+ for data in img_list:
628
+ if " " in str(data):
629
+ old = str(data)
630
+ new = old.replace(" ", "_")
631
+ os.rename(old, new)
632
+
633
+ total_ct = 0
634
+ for ct, sample in enumerate(os.listdir(input_folder)):
635
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
636
+ input_file = os.path.join(input_folder, sample)
637
+ list_file.append((input_file))
638
+ total_ct += 1
639
+
640
+ with open(os.path.join(meta_folder, 'test.list'), 'w') as fp:
641
+ for item in list_file:
642
+ fp.write('{} {} {}\n'.format(item, None, None))
643
+ print(input_folder, total_ct)
644
+
645
+ """
646
+ Other: UDC
647
+ """
648
+ # pre-process for UDC(TOLED+POLED): https://yzhouas.github.io/projects/UDC/udc.html
649
+ # Yuqian Zhou, David Ren, Neil Emerton, Sehoon Lim, and Timothy Large. Image restoration for under-display camera. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9179–9188, 2021.
650
+ def mat2png(dset_folder, name, rt):
651
+ # dset_folder: '~/UDC/{poled,toled}', name: 'poled_test_display.mat', save_folder: '~/UDC/image/'
652
+ udc_key = name.split('.')[0][6:]
653
+ udc_file = os.path.join(dset_folder, name)
654
+ udc_mat = loadmat(udc_file)[udc_key]
655
+ dset, imggt = udc_key.split('_')[0], udc_key.split('_')[1]
656
+ dset_folder = os.path.join(rt, dset)
657
+ os.makedirs(dset_folder, exist_ok=True)
658
+ if imggt == 'display':
659
+ imggt = 'image'
660
+ else:
661
+ imggt = 'gt'
662
+ imggt_folder = os.path.join(dset_folder, imggt)
663
+ os.makedirs(imggt_folder, exist_ok=True)
664
+
665
+ # restoration
666
+ n_im, h, w, c = udc_mat.shape
667
+ results = udc_mat.copy()
668
+ for i in range(n_im):
669
+ print(i, end='\r')
670
+ udc = np.reshape(udc_mat[i, :, :, :], (h, w, c))
671
+ sample = Image.fromarray(np.uint8(udc)).convert('RGB')
672
+ sample = sample.save(os.path.join(imggt_folder, '%s_%d.png'%(name.split('_')[0], i)))
673
+
674
+ rt = os.path.join(base_rt, "Other/UDC")
675
+ meta_folder = os.path.join(rt, "metas")
676
+ os.makedirs(meta_folder, exist_ok=True)
677
+ # pre-processing
678
+ poled_folder = os.path.join(rt, 'poled')
679
+ poled_sample = ['poled_test_display.mat', 'poled_test_gt.mat',
680
+ 'poled_val_display.mat', 'poled_val_gt.mat']
681
+ toled_folder = os.path.join(rt, 'toled')
682
+ toled_sample = ['toled_test_display.mat', 'toled_test_gt.mat',
683
+ 'toled_val_display.mat', 'toled_val_gt.mat']
684
+
685
+ # for sample_set in poled_sample:
686
+ # print(sample_set)
687
+ # mat2png(poled_folder, sample_set, rt)
688
+ # print()
689
+
690
+ # for sample_set in toled_sample:
691
+ # print(sample_set)
692
+ # mat2png(toled_folder, sample_set, rt)
693
+ # print()
694
+
695
+ for dset in ['val', 'test']: # train, test
696
+ dset_folder = os.path.join(rt, dset)
697
+ input_folder = os.path.join(dset_folder, 'image')
698
+ gt_folder = os.path.join(dset_folder, 'gt')
699
+ list_file = []
700
+ total_gt = 0
701
+ for ct, sample in enumerate(os.listdir(input_folder)):
702
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
703
+ input_file = os.path.join(input_folder, sample)
704
+ gt_file = os.path.join(gt_folder, sample)
705
+ list_file.append((input_file, gt_file))
706
+ total_gt += 1
707
+
708
+ with open(os.path.join(meta_folder,'{}.list'.format(dset)), 'w') as fp:
709
+ for item in list_file:
710
+ fp.write('{} {} {}\n'.format(item[0], item[1], None))
711
+ print(dset_folder, total_gt)
712
+
713
+
714
+
715
+ """
716
+ SR: DIV2K, Flickr2K, OST
717
+ """
718
+ # OST
719
+ rt = os.path.join(base_rt, "SuperResolution/OST")
720
+ meta_folder = os.path.join(rt, "metas")
721
+ os.makedirs(meta_folder, exist_ok=True)
722
+ list_file = []
723
+ total_ct = 0
724
+ image_folder = os.path.join(rt, "images")
725
+ for dset in os.listdir(image_folder): # train, test
726
+ input_folder = os.path.join(image_folder, dset)
727
+ for ct, sample in enumerate(os.listdir(input_folder)):
728
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
729
+ input_file = os.path.join(input_folder, sample)
730
+ list_file.append((input_file, None))
731
+ total_ct += 1
732
+
733
+ with open(os.path.join(meta_folder,'OST.list'), 'w') as fp:
734
+ for item in list_file:
735
+ fp.write('{} {} {}\n'.format(None, item[0], None))
736
+ print(rt, total_ct)
737
+
738
+
739
+ # Flickr2K
740
+ rt = os.path.join(base_rt, "SuperResolution/Flickr2K")
741
+ meta_folder = os.path.join(rt, "metas")
742
+ os.makedirs(meta_folder, exist_ok=True)
743
+
744
+ list_file = []
745
+ total_ct = 0
746
+ for dset in ['images']: # train, test
747
+ input_folder = os.path.join(rt, dset)
748
+ for ct, sample in enumerate(os.listdir(input_folder)):
749
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
750
+ input_file = os.path.join(input_folder, sample)
751
+ list_file.append((input_file, None))
752
+ total_ct += 1
753
+
754
+ with open(os.path.join(meta_folder,'Flickr2K.list'), 'w') as fp:
755
+ for item in list_file:
756
+ fp.write('{} {} {}\n'.format(None, item[0], None))
757
+ print(rt, total_ct)
758
+
759
+
760
+ # DIV2K
761
+ rt = os.path.join(base_rt, "SuperResolution/DIV2K")
762
+ meta_folder = os.path.join(rt, "metas")
763
+ os.makedirs(meta_folder, exist_ok=True)
764
+ for dset in ['DIV2K_train_HR', 'DIV2K_valid_HR']: # train, test
765
+ input_folder = os.path.join(rt, dset)
766
+ list_file = []
767
+ total_ct = 0
768
+ for ct, sample in enumerate(os.listdir(input_folder)):
769
+ print(ct, end='\r')
770
+ if ".png" in sample or ".jpg" in sample or ".jpeg" in sample or ".bmp" in sample or ".tif" in sample or ".JPG" in sample or ".PNG" in sample:
771
+ input_file = os.path.join(input_folder, sample)
772
+ list_file.append((input_file, None))
773
+ total_ct += 1
774
+
775
+ with open(os.path.join(meta_folder,'{}.list'.format(dset)), 'w') as fp:
776
+ for item in list_file:
777
+ fp.write('{} {} {}\n'.format(None, item[0], None))
778
+ print(input_folder, total_ct)
1_generate_iqa.py ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from PIL import Image
3
+ from pathlib import Path
4
+ import numpy as np
5
+ import random
6
+ import torchvision.transforms.functional as TF
7
+ import torchvision.transforms as transforms
8
+ import cv2
9
+ import re
10
+ import json
11
+
12
+ # ir dataset dictionary:
13
+ base_rt = f'/home/CORP/hsiang.chen/Project/Datasets/IR'
14
+ dataset_dict = {
15
+ # Image Restoration
16
+ ## Super Resolution (3)
17
+ "SR": {
18
+ "DIV2K": {'train': 'SuperResolution/DIV2K/metas/DIV2K_train_HR.list', # (800, single)
19
+ 'val': 'SuperResolution/DIV2K/metas/DIV2K_valid_HR.list'}, # (100, single)
20
+ "Flickr2K": {'train': 'SuperResolution/Flickr2K/metas/Flickr2K.list'}, # (2650, single)
21
+ "OST": {'train': 'SuperResolution/OST/metas/OST.list'}, # (10324, single)
22
+ },
23
+
24
+ ## Derain (6)
25
+ "Rain": {
26
+ "RainTrainL": {'train': 'Derain/RainTrainL/metas/train.list'}, # (200, pair)
27
+ "Rain100L": {'test': 'Derain/Rain100L/metas/test.list'}, # (100, pair)
28
+ "LHPRain": {'train': 'Derain/LHPRain/metas/train.list', # (2100, pair)
29
+ 'val': 'Derain/LHPRain/metas/val.list', # (600, pair)
30
+ 'test': 'Derain/LHPRain/metas/test.list'}, # (300, pair)
31
+ "UHDRain": {'train': 'Derain/UHD-Rain/metas/train.list', # (3000, pair)
32
+ 'test': 'Derain/UHD-Rain/metas/test.list'}, # (200, pair)
33
+ "Practical": {'test': 'Derain/Practical/metas/test.list'}, # (15, real)
34
+ "RainDS_syn_rainstreak": {'train': 'Derain/RainDS/metas/RainDS_syn_train_rainstreak.list', # (1000, pair)
35
+ 'test': 'Derain/RainDS/metas/RainDS_syn_test_rainstreak.list'}, # (200, pair)
36
+ "RainDS_syn_raindrop": {'train': 'Derain/RainDS/metas/RainDS_syn_train_raindrop.list', # (1000, pair)
37
+ 'test': 'Derain/RainDS/metas/RainDS_syn_test_raindrop.list'}, # (200, pair)
38
+ "RainDS_syn_rainstreak_raindrop": {'train': 'Derain/RainDS/metas/RainDS_syn_train_rainstreak_raindrop.list', # (1000, pair)
39
+ 'test': 'Derain/RainDS/metas/RainDS_syn_test_rainstreak_raindrop.list'}, # (200, pair)
40
+ "RainDS_real_rainstreak": {'train': 'Derain/RainDS/metas/RainDS_real_train_set_rainstreak.list', # (150, pair)
41
+ 'test': 'Derain/RainDS/metas/RainDS_real_test_set_rainstreak.list'}, # (98, pair)
42
+ "RainDS_real_raindrop": {'train': 'Derain/RainDS/metas/RainDS_real_train_set_raindrop.list', # (150, pair)
43
+ 'test': 'Derain/RainDS/metas/RainDS_real_test_set_raindrop.list'}, # (98, pair)
44
+ "RainDS_real_rainstreak_raindrop": {'train': 'Derain/RainDS/metas/RainDS_real_train_set_rainstreak_raindrop.list', # (150, pair)
45
+ 'test': 'Derain/RainDS/metas/RainDS_real_test_set_rainstreak.list'}, # (98, pair)
46
+ },
47
+
48
+ ## Dehaze (5)
49
+ "Fog":{
50
+ "SOTS": {'test': 'Dehaze/SOTS/metas/test.list'}, # (500, pair)
51
+ "OTS": {'train': 'Dehaze/OTS/metas/train.list'}, # (72135, pair)
52
+ "4kID": {'train': 'Dehaze/4kID/metas/train.list', # (15606, pair)
53
+ 'test': 'Dehaze/4kID/metas/test.list'}, # (97, pair)
54
+ "Unann": {'test': 'Dehaze/UnannotatedHazyImages/metas/test.list'}, # (4809, real)
55
+ "NH-Haze": {'test': 'Dehaze/NH-Haze/metas/test.list'}, # (5, real)
56
+ },
57
+
58
+ ## Denoise (9)
59
+ "Noise": {
60
+ "BSD400": {'train': 'Denoise/BSD400/metas/BSD400.list'}, # (400, syn)
61
+ "WED": {'train': 'Denoise/WaterlooED/metas/WaterlooED.list'}, # (4744, syn)
62
+ "BSD68": {'test': 'Denoise/BSD68/metas/BSD68.list'}, # (68, syn)
63
+ "Urban": {'test': 'Denoise/Urban100/metas/Urban100.list'}, # (100, syn)
64
+ "CBSD68": {'test': 'Denoise/CBSD68/metas/CBSD68.list'}, # (68, syn)
65
+ "Kodak": {'test': 'Denoise/Kodak/metas/Kodak.list'}, # (24, syn)
66
+ "McMaster": {'test': 'Denoise/McMaster/metas/McMaster.list'}, # (18, syn)
67
+ "Set12": {'test': 'Denoise/Set12/metas/Set12.list'}, # (12, syn)
68
+ "SIDD": {'train': 'Denoise/SIDD/metas/train.list', # (320, pair)
69
+ 'test': 'Denoise/SIDD/metas/test.list'}, # (1280, pair)
70
+ },
71
+
72
+ ## Desnow (2)
73
+ "Snow": {
74
+ "Snow100k": {'train': 'Desnow/Snow100k/metas/train.list'}, # (50000, syn)
75
+ "Snow100k-S": {'test': 'Desnow/Snow100k/metas/test_S.list'}, # (16611, syn)
76
+ "Snow100k-M": {'test': 'Desnow/Snow100k/metas/test_M.list'}, # (16588, syn)
77
+ "Snow100k-L": {'test': 'Desnow/Snow100k/metas/test_L.list'}, # (16801, syn)
78
+ "Snow100k-R": {'test': 'Desnow/Snow100k/metas/test_realistic.list'}, # (1329, real)
79
+ "UHDSnow": {'train': 'Desnow/UHD-Snow/metas/train.list', # (3000, pair)
80
+ 'test': 'Desnow/UHD-Snow/metas/test.list'}, # (200, pair)
81
+ },
82
+
83
+ ## Deblur (3)
84
+ "Blur": {
85
+ "GoPro": {'train': 'Deblur/GoPro/metas/train.list', # (2103, pair)
86
+ 'test': 'Deblur/GoPro/metas/test.list'}, # (1111, pair)
87
+ "HIDE": {'train': 'Deblur/HIDE/metas/train.list', # (6397, pair)
88
+ 'test': 'Deblur/HIDE/metas/test.list'}, # (2025, pair)
89
+ "RealBlur-J": {'test': 'Deblur/RealBlur-J_ECC_IMCORR_centroid_itensity_ref/metas/test.list'}, # (980, pair)
90
+ "RealBlur-R": {'test': 'Deblur/RealBlur-R_BM3D_ECC_IMCORR_centroid_itensity_ref/metas/test.list'},# (980, pair)
91
+ },
92
+
93
+ ## Lowlight (6)
94
+ "Low-light": {
95
+ "LOL": {'train': 'LowLight/LOL/metas/train.list', # (485, pair)
96
+ 'test': 'LowLight/LOL/metas/test.list'}, # (15, pair)
97
+ "DICM": {'test': 'LowLight/DICM/metas/test.list'}, # (69, real)
98
+ "MEF": {'test': 'LowLight/MEF/metas/test.list'}, # (17, real)
99
+ "NPE": {'test': 'LowLight/NPE/metas/test.list'}, # (8, real)
100
+ "LIME": {'test': 'LowLight/LIME/metas/test.list'}, # (10, real)
101
+ "VV": {'test': 'LowLight/VV/metas/test.list'}, # (24, real)
102
+ },
103
+
104
+ ## Others (1)
105
+ "Unknown": {
106
+ "UDC": {'val': 'Other/UDC/metas/val.list', # (60, pair)
107
+ 'test': 'Other/UDC/metas/test.list'}, # (60, pair)
108
+ },
109
+ }
110
+
111
+ def IRImageData(listfile):
112
+ # [degradation, clean, label]
113
+ paths = []
114
+ with open(listfile) as fin:
115
+ for line in fin:
116
+ line = line.strip().split()
117
+ if len(line) == 3:
118
+ paths.append(line)
119
+ paths = sorted(paths)
120
+ # Dataset
121
+ LQ_list = []
122
+ HQ_list = []
123
+ for data in paths:
124
+ lq_pth, hq_pth, label = data
125
+ if os.path.isfile(lq_pth):
126
+ LQ_list.append(lq_pth)
127
+ if os.path.isfile(hq_pth):
128
+ HQ_list.append(hq_pth)
129
+ return LQ_list, HQ_list
130
+
131
+ # question dictionary:
132
+ question_dict = {
133
+ "Full-Reference": {
134
+ "ONE": [
135
+ "Compared to the reference, what ONE distortion stands out most in the evaluated image?",
136
+ "Determine the leading ONE degradation when comparing the evaluated image to the reference.",
137
+ "Determine the most impactful ONE distortion in the evaluated image compared to the reference.",
138
+ "Highlight the most significant ONE distortion in the evaluated image in comparison to the reference.",
139
+ "Identify the chief ONE degradation in the evaluated image when compared to the reference.",
140
+ "Identify the most notable ONE distortion in the evaluated image's quality when compared to the reference.",
141
+ "In comparison to the reference, what ONE distortion is most prominent in the evaluated image?",
142
+ "What ONE distortion is most apparent in the evaluated image relative to the reference?",
143
+ "What ONE distortion most significantly affects the evaluated image compared to the reference?",
144
+ "What ONE distortion stands out in the evaluated image against the reference?",
145
+ "What critical ONE quality degradation is present in the evaluated image versus the reference?",
146
+ ],
147
+ "TWO": [
148
+ "Compared to the reference, what TWO distortions stand out most in the evaluated image?",
149
+ "Determine the leading TWO degradations when comparing the evaluated image to the reference.",
150
+ "Determine the most impactful TWO distortions in the evaluated image compared to the reference.",
151
+ "Highlight the most significant TWO distortions in the evaluated image in comparison to the reference.",
152
+ "Identify the chief TWO degradations in the evaluated image when compared to the reference.",
153
+ "Identify the most notable TWO distortions in the evaluated image's quality when compared to the reference.",
154
+ "In comparison to the reference, what TWO distortions are most prominent in the evaluated image?",
155
+ "What TWO distortions are most apparent in the evaluated image relative to the reference?",
156
+ "What TWO distortions most significantly affect the evaluated image compared to the reference?",
157
+ "What TWO distortions stand out in the evaluated image against the reference?",
158
+ "What critical TWO quality degradations are present in the evaluated image versus the reference?",
159
+ ],
160
+ "Common": [
161
+ "Compared to the reference, what distortion(s) stand out most in the evaluated image?",
162
+ "Determine the leading degradation(s) when comparing the evaluated image to the reference.",
163
+ "Determine the most impactful distortion(s) in the evaluated image compared to the reference.",
164
+ "Highlight the most significant distortion(s) in the evaluated image in comparison to the reference.",
165
+ "Identify the chief degradation(s) in the evaluated image when compared to the reference.",
166
+ "Identify the most notable distortion(s) in the evaluated image's quality when compared to the reference.",
167
+ "In comparison to the reference, what distortion(s) are most prominent in the evaluated image?",
168
+ "What critical quality degradation(s) are present in the evaluated image versus the reference?",
169
+ "What distortion(s) are most apparent in the evaluated image relative to the reference?",
170
+ "What distortion(s) most significantly affect the evaluated image compared to the reference?",
171
+ "What distortion(s) stand out in the evaluated image against the reference?"
172
+ ]
173
+ },
174
+ "Non-Reference": {
175
+ "ONE": [
176
+ "Determine the leading ONE degradation in the evaluated image.",
177
+ "Determine the most impactful ONE distortion in the evaluated image.",
178
+ "Highlight the most significant ONE distortion in the evaluated image.",
179
+ "Identify the chief ONE degradation in the evaluated image.",
180
+ "Identify the most critical ONE distortion in the evaluated image.",
181
+ "Identify the most notable ONE distortion in the evaluated image's quality.",
182
+ "In terms of image quality, what is the most glaring ONE issue with the evaluated image?",
183
+ "In the evaluated image, what ONE distortion is most detrimental to image quality?",
184
+ "Pinpoint the foremost ONE image quality issue in the evaluated image.",
185
+ "What ONE distortion is most apparent in the evaluated image?",
186
+ "What ONE distortion is most evident in the evaluated image?",
187
+ "What ONE distortion is most prominent in the evaluated image?",
188
+ "What ONE distortion is most prominent when examining the evaluated image?",
189
+ "What ONE distortion most detrimentally affects the overall quality of the evaluated image?",
190
+ "What ONE distortion most notably affects the clarity of the evaluated image?",
191
+ "What ONE distortion most significantly affects the evaluated image?",
192
+ "What ONE distortion stands out in the evaluated image?",
193
+ "What ONE quality degradation is most apparent in the evaluated image?",
194
+ "What critical ONE quality degradation is present in the evaluated image?",
195
+ "What is the foremost ONE distortion affecting the evaluated image's quality?",
196
+ "What is the leading ONE distortion in the evaluated image?",
197
+ "What is the most critical ONE image quality issue in the evaluated image?",
198
+ "What is the most severe ONE degradation observed in the evaluated image?",
199
+ "What is the primary ONE degradation observed in the evaluated image?"
200
+ ],
201
+ "TWO": [
202
+ "Determine the leading TWO degradations in the evaluated image.",
203
+ "Determine the most impactful TWO distortions in the evaluated image.",
204
+ "Highlight the most significant TWO distortions in the evaluated image.",
205
+ "Identify the chief TWO degradations in the evaluated image.",
206
+ "Identify the most critical TWO distortions in the evaluated image.",
207
+ "Identify the most notable TWO distortions in the evaluated image's quality.",
208
+ "In terms of image quality, what are the most glaring TWO issues with the evaluated image?",
209
+ "In the evaluated image, what TWO distortions are most detrimental to image quality?",
210
+ "Pinpoint the foremost TWO image quality issues in the evaluated image.",
211
+ "What TWO distortions are most apparent in the evaluated image?",
212
+ "What TWO distortions are most evident in the evaluated image?",
213
+ "What TWO distortions are most prominent in the evaluated image?",
214
+ "What TWO distortions are most prominent when examining the evaluated image?",
215
+ "What TWO distortions most detrimentally affect the overall quality of the evaluated image?",
216
+ "What TWO distortions most notably affect the clarity of the evaluated image?",
217
+ "What TWO distortions most significantly affect the evaluated image?",
218
+ "What TWO distortions stand out in the evaluated image?",
219
+ "What TWO quality degradations are most apparent in the evaluated image?",
220
+ "What are the foremost TWO distortions affecting the evaluated image's quality?",
221
+ "What are the leading TWO distortions in the evaluated image?",
222
+ "What are the most critical TWO image quality issues in the evaluated image?",
223
+ "What are the most severe TWO degradations observed in the evaluated image?",
224
+ "What are the primary TWO degradations observed in the evaluated image?",
225
+ "What critical TWO quality degradations are present in the evaluated image?",
226
+ ],
227
+ "Common": [
228
+ "Determine the leading degradation(s) in the evaluated image.",
229
+ "Determine the most impactful distortion(s) in the evaluated image.",
230
+ "Highlight the most significant distortion(s) in the evaluated image.",
231
+ "Identify the chief degradation(s) in the evaluated image.",
232
+ "Identify the most critical distortion(s) in the evaluated image.",
233
+ "Identify the most notable distortion(s) in the evaluated image's quality.",
234
+ "In terms of image quality, what are the most glaring issue(s) with the evaluated image?",
235
+ "In the evaluated image, what distortion(s) are most detrimental to image quality?",
236
+ "Pinpoint the foremost image quality issue(s) in the evaluated image.",
237
+ "What are the foremost distortion(s) affecting the evaluated image's quality?",
238
+ "What are the leading distortion(s) in the evaluated image?",
239
+ "What are the most critical image quality issue(s) in the evaluated image?",
240
+ "What are the most severe degradation(s) observed in the evaluated image?",
241
+ "What are the primary degradation(s) observed in the evaluated image?",
242
+ "What critical quality degradation(s) are present in the evaluated image?",
243
+ "What distortion(s) are most apparent in the evaluated image?",
244
+ "What distortion(s) are most evident in the evaluated image?",
245
+ "What distortion(s) are most prominent in the evaluated image?",
246
+ "What distortion(s) are most prominent when examining the evaluated image?",
247
+ "What distortion(s) most detrimentally affect the overall quality of the evaluated image?",
248
+ "What distortion(s) most notably affect the clarity of the evaluated image?",
249
+ "What distortion(s) most significantly affect the evaluated image?",
250
+ "What distortion(s) stand out in the evaluated image?",
251
+ "What quality degradation(s) are most apparent in the evaluated image?"
252
+ ]
253
+ }
254
+ }
255
+
256
+ def question_generate(ref="Full-Reference", degra="Common"):
257
+ option = f" Answer the question using a single word or phrase."
258
+ template = random.choice(question_dict[ref]["Common"] + question_dict[ref][degra])
259
+ if random.random() >= 0.4:
260
+ template += option
261
+ return template
262
+
263
+ if __name__ == "__main__":
264
+ for degradation, degra_dict in dataset_dict.items():
265
+ for dname, ddict in degra_dict.items():
266
+ for dset, list_path in ddict.items():
267
+
268
+ meta_refA = []
269
+ meta_A = []
270
+ meta_syn = []
271
+
272
+ # read data list
273
+ paths = []
274
+ with open(list_path) as fin:
275
+ for line in fin:
276
+ line = line.strip().split()
277
+ if len(line) == 3:
278
+ paths.append(line)
279
+ paths = sorted(paths)
280
+
281
+ # Dataset
282
+ LQ_list = []
283
+ HQ_list = []
284
+ for data in paths:
285
+ lq_pth, hq_pth, label = data
286
+
287
+ if os.path.isfile(hq_pth):
288
+ HQ_list.append(hq_pth)
289
+ image_ref = os.path.relpath(hq_pth, base_rt).replace("\\", "/")
290
+ id = os.path.basename(image_ref)
291
+ else:
292
+ image_ref = None
293
+
294
+ if os.path.isfile(lq_pth):
295
+ LQ_list.append(lq_pth)
296
+ image_A = os.path.relpath(lq_pth, base_rt).replace("\\", "/")
297
+ id = os.path.basename(image_A)
298
+ else:
299
+ image_A = None
300
+
301
+ meta_refA.append({
302
+ "distortion_class": degradation,
303
+ "distortion_name": degradation,
304
+ "severity": 3,
305
+ "id": id,
306
+ "image_ref": image_ref,
307
+ "image_A": image_A,
308
+ "image_B": None,
309
+ "task_type": "quality_single_A",
310
+ "conversations": [
311
+ {
312
+ "from": "human",
313
+ "value": question_generate(ref="Full-Reference", degra="ONE"),
314
+ },
315
+ {
316
+ "from": "gpt",
317
+ "value": degradation
318
+ }
319
+ ],
320
+ })
321
+
322
+ meta_A.append({
323
+ "distortion_class": degradation,
324
+ "distortion_name": degradation,
325
+ "severity": 3,
326
+ "id": id,
327
+ "image_ref": None,
328
+ "image_A": image_A,
329
+ "image_B": None,
330
+ "task_type": "quality_single_A_noref",
331
+ "conversations": [
332
+ {
333
+ "from": "human",
334
+ "value": question_generate(ref="Non-Reference", degra="ONE"),
335
+ },
336
+ {
337
+ "from": "gpt",
338
+ "value": degradation
339
+ }
340
+ ],
341
+ })
342
+
343
+ meta_syn.append({
344
+ "distortion_class": degradation,
345
+ "distortion_name": degradation,
346
+ "severity": 3,
347
+ "id": id,
348
+ "image_ref": None,
349
+ "image_A": image_ref,
350
+ "image_B": None,
351
+ "task_type": "quality_single_A_noref",
352
+ "conversations": [
353
+ {
354
+ "from": "human",
355
+ "value": question_generate(ref="Non-Reference", degra="ONE"),
356
+ },
357
+ {
358
+ "from": "gpt",
359
+ "value": degradation
360
+ }
361
+ ],
362
+ })
363
+
364
+ print(f"[{degradation}]: {dname}-{dset} - LQ[{len(LQ_list)}], HQ[{len(HQ_list)}]")
365
+
366
+ if len(LQ_list) > 0 and len(HQ_list) > 0 and len(LQ_list) == len(HQ_list): # pair
367
+ meta_refA_pth = list_path.replace(".list", "_iqa_refA_brief.json")
368
+ meta_A_pth = list_path.replace(".list", "_iqa_A_brief.json")
369
+ with open(meta_refA_pth, "w") as f:
370
+ json.dump(meta_refA, f, indent=4)
371
+ with open(meta_A_pth, "w") as f:
372
+ json.dump(meta_A, f, indent=4)
373
+ print(f"Done. Metadata saved to: {meta_refA_pth} and {meta_A_pth}")
374
+
375
+ elif len(LQ_list) > 0 and len(HQ_list) == 0: # real image
376
+ meta_A_pth = list_path.replace(".list", "_iqa_A_brief.json")
377
+ with open(meta_A_pth, "w") as f:
378
+ json.dump(meta_A, f, indent=4)
379
+ print(f"Done. Metadata saved to: {meta_A_pth}")
380
+
381
+ elif len(LQ_list) == 0 and len(HQ_list) > 0: # syn image
382
+ meta_refA_pth = list_path.replace(".list", "_iqa_refA_brief.json")
383
+ meta_syn_pth = list_path.replace(".list", "_iqa_syn_brief.json")
384
+ with open(meta_refA_pth, "w") as f:
385
+ json.dump(meta_refA, f, indent=4)
386
+ with open(meta_syn_pth, "w") as f:
387
+ json.dump(meta_syn, f, indent=4)
388
+ print(f"Done. Metadata saved to: {meta_refA_pth} and {meta_syn_pth}")
389
+
390
+ else:
391
+ raise KeyError(f"the task is not matched, please check the dataset {list_path}")
392
+
393
+
Deblur/GoPro.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2889b3ad5554fe8e40c31ee1f642a82b796d3cf2b1c63875cc36c3085fa5426e
3
+ size 4194304000
Deblur/GoPro.tar.gz.part-ab ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:472004ed8e6dc21b2681918808e84acf0818ee1d793fe13ccf50cc2790dea18c
3
+ size 4194304000
Deblur/GoPro.tar.gz.part-ac ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ec91c1d510b8c8a5f8688a5dc797b62ede3296d5480aac5a5f8b49da9165831
3
+ size 1143614891
Deblur/HIDE.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:452f0918b1e454cb9024228f468321a2f5932ec0ee2ce48ceb4bc01f5d5f6c53
3
+ size 4194304000
Deblur/HIDE.tar.gz.part-ab ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97e5f2375f82f5729fe49723db3fa275a4cbaecc3a1825e4d172a1e204ca6465
3
+ size 4194304000
Deblur/HIDE.tar.gz.part-ac ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d1fb47199263e400a1db252741f9c0625db7e036941fae3600591bb711a46db6
3
+ size 4194304000
Deblur/HIDE.tar.gz.part-ad ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a65e04c5ef92c0305aa8c2f1f65df5afb6baec146509b22a79e138717d062fb1
3
+ size 4194304000
Deblur/HIDE.tar.gz.part-ae ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74f2c6e9578295a95712b06ba43865e560aa12cf89b960b3068c6d6d006241f4
3
+ size 483302125
Deblur/RealBlur-J_ECC_IMCORR_centroid_itensity_ref.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11b27965e0c01550b121de113e4ee6b579fd34cab4b00b963c3f944d14c9d780
3
+ size 4194304000
Deblur/RealBlur-J_ECC_IMCORR_centroid_itensity_ref.tar.gz.part-ab ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0f084d63f7641a65e5ce6a5a61fc455b141de937addddf3de7b2739084f09a8
3
+ size 4194304000
Deblur/RealBlur-J_ECC_IMCORR_centroid_itensity_ref.tar.gz.part-ac ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c501435b6b11a9980e2b613c97c998075b8266aa7ff3d11baecebcc0de20ef76
3
+ size 298424062
Deblur/RealBlur-R_BM3D_ECC_IMCORR_centroid_itensity_ref.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3764b43127d0741d3a7f57288d8d74435b0c4223ff87482b121d741d5a7e061c
3
+ size 4194304000
Deblur/RealBlur-R_BM3D_ECC_IMCORR_centroid_itensity_ref.tar.gz.part-ab ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c76593f6066fec019cbb714b5a200202ce9e7abc7a9fa0716c48c5a1c35613d1
3
+ size 229355705
Dehaze/4kID.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd2cce2b5b41bebe78cd2a14c46bfbdd9261c65db7dfd0da64cb0badcf12baa4
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-ab ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84da1c0475cd4487ba7ad763d7c83258f35da81715098174e7fe14bc7c359f14
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-ac ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:485b1ceeb12f5a9f34a3a2e69f82fd49c673b87dedadeb5ec3ab73522ea64ad0
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-ad ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8be16b0581fae458b0f972b857d2f8f164578169e3f945f9301592aaeb0ccf41
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-ae ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb249c405a6480d499ae7ac8f8075d32628aacac241fe0c1b20e821845ed1914
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-af ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4e7fcec4ce108628124f8be7506351863742755744907f3651e36695cd85185
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-ag ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ecf7247c168a6968e49de98cdd5168f426baa0b3b38f50891a5462412e85f50
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-ah ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:049897691a7be3f02bea207c57c42963d9241f29b180b6a8fbeb0ab6ec4e21ca
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-ai ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ddbd01ae67bc781b52c86209ab1d5b8dfee215ea79fe85e2539c58cbe4db211
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-aj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:35f66048322dace2b07ee518cc2c87d353e48b8fab54e7728de5966aae6e3cf1
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-ak ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1ed7e74cde2cc2b26b612665d5fa35b90c4911b102bfc4311026ffc6b6390b5
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-al ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7731b8e10fa47c7cc87c5657b08e6c0bbcc419372c8fe79c722706200f11d04
3
+ size 4194304000
Dehaze/4kID.tar.gz.part-am ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64ae701385855126db0cf21ba1c46596d0f2bbb991a2c0f2c843d70464576a94
3
+ size 775873639
Dehaze/NH-Haze.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:902c3133ffc07773b34ea3c945725a43fa0b17c113e880acec06d7f59d4bff1c
3
+ size 109208609
Dehaze/OTS.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23417b1645988b95d7914396c9f7d99dd75e3a699d05f0eb6eea101c1986db61
3
+ size 4194304000
Dehaze/OTS.tar.gz.part-ab ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:13865ea0a351cc8bdb75dd5d50fa7a18904ffe68c299b393a7d6c42ebb8c4ab0
3
+ size 4194304000
Dehaze/OTS.tar.gz.part-ac ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5955f79042c70e570c636bf3c52ae323060d20d62c2967c528f2d0b878a7c2f
3
+ size 3470653279
Dehaze/SOTS.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b41f7968aa525313695a11ccaed9f0853f4e7c4a544dc566d5f53a5c7fd214a
3
+ size 434606727
Dehaze/UnannotatedHazyImages.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7595561d134839dc712863af3ee682591f3d9057c9de3c49397ab9cb6816ff3
3
+ size 372595926
Denoise/BSD400.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:131c6031fa3d51cc309b501f2f3facedcbba3696042f6bb8381d728e283cee8e
3
+ size 29241075
Denoise/BSD68.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef0ce050a7de26fe004a5e191e50bfccfdf863fca2b22ee5b573840c85ace6ab
3
+ size 6461606
Denoise/CBSD68.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eaf59bb1a2d9d7d8385d112e2d96366d6954b50b7bb78b05a2f9c72fce706f99
3
+ size 19742657
Denoise/Kodak.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b18423670e5e95c60ee7369f8a8e3254b4cc1b003bd8ede0c4713a0923be3964
3
+ size 15392636
Denoise/McMaster.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df3b694caf9b005b9ec32b6829a6afd3565e1bef614573fb32090ed1413bcdb2
3
+ size 11422404
Denoise/SIDD.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc4de385bb716830b5c102c2e45f44ec362edf24c7a7f9c25017bd5003054d2f
3
+ size 4194304000
Denoise/SIDD.tar.gz.part-ab ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad0983f18c141ad20514aa016452b71551b0b38ec2a98d7e592c110aba11214c
3
+ size 4194304000
Denoise/SIDD.tar.gz.part-ac ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1fedbf619f34341dd21b3240a053ce437019008aaf6452e9c55e79d21a26de90
3
+ size 4194304000
Denoise/SIDD.tar.gz.part-ad ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:682793e6eddff582149e4715ac0fe3bd156ec661632413fa8bafac1a40cb7559
3
+ size 945031848
Denoise/Set12.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2cedfee7ad80aa14579dae6e3521f3a5a05835db2d9582d7a2a52d2773f8c30c
3
+ size 1197964
Denoise/Urban100.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:597d41afba24de5343b883fd271d501a97062347a5ebe4de35960f34f5c41381
3
+ size 135389790
Denoise/WaterlooED.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:502e71024ca729bde83af386eff9d81cd182e55b72262b785f00067a5c5f409d
3
+ size 1642649523
Derain/LHPRain.tar.gz.part-aa ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:878857ebad4b83ffaf1a57156ec0fcf9f724478bd690ba61014fc826de2bc263
3
+ size 4194304000
Derain/LHPRain.tar.gz.part-ab ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f5e38a7705207a899c082306350ba80e0a72eb764134fde23089a1a847f4138
3
+ size 4194304000
Derain/LHPRain.tar.gz.part-ac ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ea2928318efad49a32ecb5620681ae2b8ce35aa920d86466511b5d037a252c8
3
+ size 4194304000
Derain/LHPRain.tar.gz.part-ad ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e7be23c8a7016fcc565b4df6fc482ca4b35068578536561e87666a73e236b46
3
+ size 3673485472