AaronCIH commited on
Commit
96eb7de
·
verified ·
1 Parent(s): c0fcf02

Upload scripts/2_generate_iqa_detail.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/2_generate_iqa_detail.py +387 -0
scripts/2_generate_iqa_detail.py ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ data format:
3
+ {
4
+ "distortion_classes": [
5
+ "saturate_strengthen",
6
+ "compression"
7
+ ],
8
+ "distortion_names": [
9
+ "saturate_strengthen_HSV",
10
+ "compression_jpeg_2000"
11
+ ],
12
+ "severities": [
13
+ 2,
14
+ 3
15
+ ],
16
+ "image_ref": null,
17
+ "image_A": "KADIS700K/refA_md_detail/dist_imgs/abyssinian-ground-hornbill-560232_0.png",
18
+ "image_B": null,
19
+ "id": "abyssinian-ground-hornbill-560232_0",
20
+ "task_type": "quality_single_A_noref",
21
+ "conversations": [
22
+ {
23
+ "from": "human",
24
+ "value": "Assess the image's quality from a professional standpoint."
25
+ },
26
+ {
27
+ "from": "gpt",
28
+ "value": "The image depicts a bird with a large beak holding some material. The colors appear unnaturally saturated, reducing detail and creating an unrealistic representation of the subject. Additionally, there's significant artifacting indicative of heavy compression, which further degrades clarity and texture. Overall, the image quality is poor, with the distortions severely impacting the visual integrity of the content."
29
+ }
30
+ ]
31
+ },
32
+ """
33
+ import os
34
+ from PIL import Image
35
+ from pathlib import Path
36
+ import numpy as np
37
+ import random
38
+ import torchvision.transforms.functional as TF
39
+ import torchvision.transforms as transforms
40
+ import cv2
41
+ import re
42
+ import json
43
+
44
+ # ir dataset dictionary:
45
+ base_rt = f'/home/CORP/hsiang.chen/Project/Datasets/IR'
46
+ dataset_dict = {
47
+ # Image Restoration
48
+ ## Super Resolution (3)
49
+ "HR": {
50
+ "DIV2K": {'train': 'SuperResolution/DIV2K/metas/DIV2K_train_HR.list', # (800, single)
51
+ 'val': 'SuperResolution/DIV2K/metas/DIV2K_valid_HR.list'}, # (100, single)
52
+ "Flickr2K": {'train': 'SuperResolution/Flickr2K/metas/Flickr2K_HR.list'}, # (2650, single)
53
+ "OST": {'train': 'SuperResolution/OST/metas/OST_HR.list'}, # (10324, single)
54
+ },
55
+
56
+ "Low Resolution": {
57
+ "DIV2K": {'train1': 'SuperResolution/DIV2K/metas/DIV2K_train_pair_SR1.list', # (800, pair)
58
+ 'train2': 'SuperResolution/DIV2K/metas/DIV2K_train_pair_SR2.list', # (800, pair)
59
+ 'train3': 'SuperResolution/DIV2K/metas/DIV2K_train_pair_SR3.list', # (800, pair)
60
+ 'val': 'SuperResolution/DIV2K/metas/DIV2K_valid_pair_SR.list'}, # (100, pair)
61
+ "Flickr2K": {'train1': 'SuperResolution/Flickr2K/metas/Flickr2K_train_pair_SR1.list', # (2650, pair)
62
+ 'train2': 'SuperResolution/Flickr2K/metas/Flickr2K_train_pair_SR2.list', # (2650, pair)
63
+ 'train3': 'SuperResolution/Flickr2K/metas/Flickr2K_train_pair_SR3.list'},# (2650, pair)
64
+ "OST": {'train1': 'SuperResolution/OST/metas/OST_train_pair_SR1.list', # (10324, pair)
65
+ 'train2': 'SuperResolution/OST/metas/OST_train_pair_SR2.list', # (10324, pair)
66
+ 'train3': 'SuperResolution/OST/metas/OST_train_pair_SR3.list'}, # (10324, pair)
67
+ },
68
+
69
+ ## Derain (5)
70
+ "Rain": {
71
+ "RainTrainL": {'train': 'Derain/RainTrainL/metas/train.list'}, # (200, pair)
72
+ "Rain100L": {'test': 'Derain/Rain100L/metas/test.list'}, # (100, pair)
73
+ "LHPRain": {'train': 'Derain/LHPRain/metas/train.list', # (2100, pair)
74
+ 'val': 'Derain/LHPRain/metas/val.list', # (600, pair)
75
+ 'test': 'Derain/LHPRain/metas/test.list'}, # (300, pair)
76
+ "UHDRain": {'train': 'Derain/UHD-Rain/metas/train.list', # (3000, pair)
77
+ 'test': 'Derain/UHD-Rain/metas/test.list'}, # (200, pair)
78
+ "Practical": {'test': 'Derain/Practical/metas/test.list'}, # (15, real)
79
+ },
80
+
81
+ ## Deraindrop (2)
82
+ "RainDrop": {
83
+ "RainDrop": {'train': 'Derain/RainDrop/metas/Raindrop_train.list', # (861, pair)
84
+ 'test_a': 'Derain/RainDrop/metas/Raindrop_test_a.list', # (58, pair)
85
+ 'test_b': 'Derain/RainDrop/metas/Raindrop_test_b.list'}, # (249, pair)
86
+ "RainDS_syn_rainstreak": {'train': 'Derain/RainDS/metas/RainDS_syn_train_rainstreak.list', # (1000, pair)
87
+ 'test': 'Derain/RainDS/metas/RainDS_syn_test_rainstreak.list'}, # (200, pair)
88
+ "RainDS_syn_raindrop": {'train': 'Derain/RainDS/metas/RainDS_syn_train_raindrop.list', # (1000, pair)
89
+ 'test': 'Derain/RainDS/metas/RainDS_syn_test_raindrop.list'}, # (200, pair)
90
+ "RainDS_syn_rainstreak_raindrop": {'train': 'Derain/RainDS/metas/RainDS_syn_train_rainstreak_raindrop.list', # (1000, pair)
91
+ 'test': 'Derain/RainDS/metas/RainDS_syn_test_rainstreak_raindrop.list'}, # (200, pair)
92
+ "RainDS_real_rainstreak": {'train': 'Derain/RainDS/metas/RainDS_real_train_set_rainstreak.list', # (150, pair)
93
+ 'test': 'Derain/RainDS/metas/RainDS_real_test_set_rainstreak.list'}, # (98, pair)
94
+ "RainDS_real_raindrop": {'train': 'Derain/RainDS/metas/RainDS_real_train_set_raindrop.list', # (150, pair)
95
+ 'test': 'Derain/RainDS/metas/RainDS_real_test_set_raindrop.list'}, # (98, pair)
96
+ "RainDS_real_rainstreak_raindrop": {'train': 'Derain/RainDS/metas/RainDS_real_train_set_rainstreak_raindrop.list', # (150, pair)
97
+ 'test': 'Derain/RainDS/metas/RainDS_real_test_set_rainstreak.list'}, # (98, pair)
98
+ },
99
+
100
+ ## Dehaze (5)
101
+ "Fog":{
102
+ "SOTS": {'test': 'Dehaze/SOTS/metas/test.list'}, # (500, pair)
103
+ "OTS": {'train': 'Dehaze/OTS/metas/train.list'}, # (72135, pair)
104
+ "4kID": {'train': 'Dehaze/4kID/metas/train.list', # (15606, pair)
105
+ 'test': 'Dehaze/4kID/metas/test.list'}, # (97, pair)
106
+ "Unann": {'test': 'Dehaze/UnannotatedHazyImages/metas/test.list'}, # (4809, real)
107
+ "NH-Haze": {'test': 'Dehaze/NH-Haze/metas/test.list'}, # (5, real)
108
+ },
109
+
110
+ ## Denoise (9)
111
+ "Noise": {
112
+ "BSD400": {'train': 'Denoise/BSD400/metas/BSD400.list',
113
+ 'train1': 'Denoise/BSD400/metas/BSD400_Noise_L1.list',
114
+ 'train2': 'Denoise/BSD400/metas/BSD400_Noise_L3.list',
115
+ 'train3': 'Denoise/BSD400/metas/BSD400_Noise_L5.list',}, # (400, syn)
116
+ "WED": {'train': 'Denoise/WaterlooED/metas/WaterlooED.list',
117
+ 'train1': 'Denoise/WaterlooED/metas/WaterlooED_Noise_L1.list',
118
+ 'train2': 'Denoise/WaterlooED/metas/WaterlooED_Noise_L3.list',
119
+ 'train3': 'Denoise/WaterlooED/metas/WaterlooED_Noise_L5.list',}, # (4744, syn)
120
+ "BSD68": {'test': 'Denoise/BSD68/metas/BSD68.list',
121
+ 'test1': 'Denoise/BSD68/metas/BSD68_Noise_L1.list',
122
+ 'test2': 'Denoise/BSD68/metas/BSD68_Noise_L3.list',
123
+ 'test3': 'Denoise/BSD68/metas/BSD68_Noise_L5.list'}, # (68, syn)
124
+ "Urban": {'test': 'Denoise/Urban100/metas/Urban100.list',
125
+ 'test1': 'Denoise/Urban100/metas/Urban100_Noise_L1.list',
126
+ 'test2': 'Denoise/Urban100/metas/Urban100_Noise_L3.list',
127
+ 'test3': 'Denoise/Urban100/metas/Urban100_Noise_L5.list'}, # (100, syn)
128
+ "CBSD68": {'test': 'Denoise/CBSD68/metas/CBSD68.list',
129
+ 'test1': 'Denoise/CBSD68/metas/CBSD68_Noise_L1.list',
130
+ 'test2': 'Denoise/CBSD68/metas/CBSD68_Noise_L3.list',
131
+ 'test3': 'Denoise/CBSD68/metas/CBSD68_Noise_L5.list',}, # (68, syn)
132
+ "Kodak": {'test': 'Denoise/Kodak/metas/Kodak.list',
133
+ 'test1': 'Denoise/Kodak/metas/Kodak_Noise_L1.list',
134
+ 'test2': 'Denoise/Kodak/metas/Kodak_Noise_L3.list',
135
+ 'test3': 'Denoise/Kodak/metas/Kodak_Noise_L5.list'}, # (24, syn)
136
+ "McMaster": {'test': 'Denoise/McMaster/metas/McMaster.list',
137
+ 'test1': 'Denoise/McMaster/metas/McMaster_Noise_L1.list',
138
+ 'test2': 'Denoise/McMaster/metas/McMaster_Noise_L3.list',
139
+ 'test3': 'Denoise/McMaster/metas/McMaster_Noise_L5.list'}, # (18, syn)
140
+ "Set12": {'test': 'Denoise/Set12/metas/Set12.list',
141
+ 'test1': 'Denoise/Set12/metas/Set12_Noise_L1.list',
142
+ 'test2': 'Denoise/Set12/metas/Set12_Noise_L3.list',
143
+ 'test3': 'Denoise/Set12/metas/Set12_Noise_L5.list',}, # (12, syn)
144
+ "SIDD": {'train': 'Denoise/SIDD/metas/train.list', # (320, pair)
145
+ 'test': 'Denoise/SIDD/metas/test.list'}, # (1280, pair)
146
+
147
+ "DIV2K": {'train1': 'SuperResolution/DIV2K/metas/DIV2K_train_pair_Noise_L1.list', # (800, pair)
148
+ 'train2': 'SuperResolution/DIV2K/metas/DIV2K_train_pair_Noise_L3.list', # (800, pair)
149
+ 'train3': 'SuperResolution/DIV2K/metas/DIV2K_train_pair_Noise_L5.list', # (800, pair)
150
+ 'val': 'SuperResolution/DIV2K/metas/DIV2K_valid_pair_Noise.list'}, # (100, pair)
151
+ "Flickr2K": {'train1': 'SuperResolution/Flickr2K/metas/Flickr2K_train_pair_Noise_L1.list', # (2650, pair)
152
+ 'train2': 'SuperResolution/Flickr2K/metas/Flickr2K_train_pair_Noise_L3.list', # (2650, pair)
153
+ 'train3': 'SuperResolution/Flickr2K/metas/Flickr2K_train_pair_Noise_L5.list'},# (2650, pair)
154
+ },
155
+
156
+ ## Desnow (2)
157
+ "Snow": {
158
+ "Snow100k": {'train': 'Desnow/Snow100k/metas/train.list'}, # (50000, syn)
159
+ "Snow100k-S": {'test': 'Desnow/Snow100k/metas/test_S.list'}, # (16611, syn)
160
+ "Snow100k-M": {'test': 'Desnow/Snow100k/metas/test_M.list'}, # (16588, syn)
161
+ "Snow100k-L": {'test': 'Desnow/Snow100k/metas/test_L.list'}, # (16801, syn)
162
+ "Snow100k-R": {'test': 'Desnow/Snow100k/metas/test_realistic.list'}, # (1329, real)
163
+ "UHDSnow": {'train': 'Desnow/UHD-Snow/metas/train.list', # (3000, pair)
164
+ 'test': 'Desnow/UHD-Snow/metas/test.list'}, # (200, pair)
165
+ },
166
+
167
+ ## Deblur (3)
168
+ "Blur": {
169
+ "GoPro": {'train': 'Deblur/GoPro/metas/train.list', # (2103, pair)
170
+ 'test': 'Deblur/GoPro/metas/test.list'}, # (1111, pair)
171
+ "HIDE": {'train': 'Deblur/HIDE/metas/train.list', # (6397, pair)
172
+ 'test': 'Deblur/HIDE/metas/test.list'}, # (2025, pair)
173
+ "RealBlur-J": {'test': 'Deblur/RealBlur-J_ECC_IMCORR_centroid_itensity_ref/metas/test.list'}, # (980, pair)
174
+ "RealBlur-R": {'test': 'Deblur/RealBlur-R_BM3D_ECC_IMCORR_centroid_itensity_ref/metas/test.list'},# (980, pair)
175
+ },
176
+
177
+ ## Lowlight (6)
178
+ "Low-light": {
179
+ "LOL": {'train': 'LowLight/LOL/metas/train.list', # (485, pair)
180
+ 'test': 'LowLight/LOL/metas/test.list'}, # (15, pair)
181
+ "DICM": {'test': 'LowLight/DICM/metas/test.list'}, # (69, real)
182
+ "MEF": {'test': 'LowLight/MEF/metas/test.list'}, # (17, real)
183
+ "NPE": {'test': 'LowLight/NPE/metas/test.list'}, # (8, real)
184
+ "LIME": {'test': 'LowLight/LIME/metas/test.list'}, # (10, real)
185
+ "VV": {'test': 'LowLight/VV/metas/test.list'}, # (24, real)
186
+ },
187
+
188
+ ## Others (1)
189
+ "Unknown": {
190
+ "UDC": {'val': 'Other/UDC/metas/val.list', # (60, pair)
191
+ 'test': 'Other/UDC/metas/test.list'}, # (60, pair)
192
+ },
193
+ }
194
+
195
+ def IRImageData(listfile):
196
+ # [degradation, clean, label]
197
+ paths = []
198
+ with open(listfile) as fin:
199
+ for line in fin:
200
+ line = line.strip().split()
201
+ if len(line) == 3:
202
+ paths.append(line)
203
+ paths = sorted(paths)
204
+ # Dataset
205
+ LQ_list = []
206
+ HQ_list = []
207
+ for data in paths:
208
+ lq_pth, hq_pth, label = data
209
+ if os.path.isfile(lq_pth):
210
+ LQ_list.append(lq_pth)
211
+ if os.path.isfile(hq_pth):
212
+ HQ_list.append(hq_pth)
213
+ return LQ_list, HQ_list
214
+
215
+ # question dictionary:
216
+ question_dict = {
217
+ "query": [
218
+ "Analyze the image's quality, and detail your findings.",
219
+ "Analyze the image's quality, focusing on its key elements, and detail your findings.",
220
+ "Assess the image's quality from a professional standpoint.",
221
+ "Assess the image's quality with a critical eye, highlighting both strengths and areas for improvement.",
222
+ "Assess the quality of the image with detailed reasons.",
223
+ "Can you provide a detailed evaluation of the image's quality?",
224
+ "Could you assess the overall quality of the image and elaborate on your evaluation?",
225
+ "Could you please analyze the quality of the image, considering factors such as composition and clarity, and then elaborate on your assessment?",
226
+ "Evaluate the image's clarity and explain how it contributes to the overall quality.",
227
+ "Evaluate the image's quality and justify your evaluation.",
228
+ "Evaluate the overall quality of the image and provide a comprehensive explanation of your assessment.",
229
+ "Evaluate the quality of the image and provide a comprehensive explanation.",
230
+ "Examine the image for quality aspects, and explain assessment by considering different factors influencing the composition and clarity.",
231
+ "Examine the image's quality by considering factors influencing its clarity.",
232
+ "How about the overall quality of the image, and why?",
233
+ "How do you perceive the quality of the image, and what aspects influence your judgment?",
234
+ "How does the image's quality impact its overall effectiveness or appeal?",
235
+ "How would you rate the image's quality, and what factors contribute to your assessment?",
236
+ "How would you rate the overall quality of the image, and why?",
237
+ "How would you rate the quality of the image, and what specific elements contribute to your assessment?",
238
+ "In your opinion, what are the strengths and weaknesses of the image in terms of quality, and why?",
239
+ "Offer an assessment of the image's quality, highlighting any strengths or weaknesses.",
240
+ "Please appraise the image's quality and provide insights into what makes it visually appealing or otherwise.",
241
+ "Please evaluate the image's quality and provide your reasons.",
242
+ "Provide a comprehensive assessment of the image's quality, including both strengths and areas for improvement.",
243
+ "Provide a thorough evaluation of the image's quality.",
244
+ "What aspects of the image do you find most appealing or problematic from a quality perspective, and why?",
245
+ "What criteria are you using to assess the overall quality of the image, and can you explain your assessment in detail?",
246
+ "What is your opinion on the image's quality? Elaborate on your evaluation.",
247
+ "What is your opinion on the quality of the image? Explain your viewpoint."
248
+ ]
249
+ }
250
+
251
+ def question_generate():
252
+ template = random.choice(question_dict["query"])
253
+ return template
254
+
255
+ if __name__ == "__main__":
256
+ for degradation, degra_dict in dataset_dict.items():
257
+ for dname, ddict in degra_dict.items():
258
+ for dset, list_path in ddict.items():
259
+
260
+ meta_refA = []
261
+ meta_A = []
262
+ meta_syn = []
263
+
264
+ # read data list
265
+ paths = []
266
+ list_path = os.path.join(base_rt, list_path)
267
+ with open(list_path) as fin:
268
+ for line in fin:
269
+ line = line.strip().split()
270
+ if len(line) == 3:
271
+ paths.append(line)
272
+ paths = sorted(paths)
273
+
274
+ # Dataset
275
+ LQ_list = []
276
+ HQ_list = []
277
+ for data in paths:
278
+ lq_pth, hq_pth, label = data
279
+
280
+ if os.path.isfile(hq_pth):
281
+ HQ_list.append(hq_pth)
282
+ image_ref = os.path.relpath(hq_pth, base_rt).replace("\\", "/")
283
+ id = os.path.basename(image_ref)
284
+ else:
285
+ image_ref = None
286
+
287
+ if os.path.isfile(lq_pth):
288
+ LQ_list.append(lq_pth)
289
+ image_A = os.path.relpath(lq_pth, base_rt).replace("\\", "/")
290
+ id = os.path.basename(image_A)
291
+ else:
292
+ image_A = None
293
+
294
+ meta_refA.append({
295
+ "distortion_class": degradation,
296
+ "distortion_name": degradation,
297
+ "severity": 3,
298
+ "id": id,
299
+ "image_ref": image_ref,
300
+ "image_A": image_A,
301
+ "image_B": None,
302
+ "task_type": "quality_single_A",
303
+ "conversations": [
304
+ {
305
+ "from": "human",
306
+ "value": question_generate(),
307
+ },
308
+ {
309
+ "from": "gpt",
310
+ "value": None
311
+ }
312
+ ],
313
+ })
314
+
315
+ meta_A.append({
316
+ "distortion_class": degradation,
317
+ "distortion_name": degradation,
318
+ "severity": 3,
319
+ "id": id,
320
+ "image_ref": None,
321
+ "image_A": image_A,
322
+ "image_B": None,
323
+ "task_type": "quality_single_A_noref",
324
+ "conversations": [
325
+ {
326
+ "from": "human",
327
+ "value": question_generate(),
328
+ },
329
+ {
330
+ "from": "gpt",
331
+ "value": None
332
+ }
333
+ ],
334
+ })
335
+
336
+ meta_syn.append({
337
+ "distortion_class": degradation,
338
+ "distortion_name": degradation,
339
+ "severity": 3,
340
+ "id": id,
341
+ "image_ref": image_ref,
342
+ "image_A": None,
343
+ "image_B": None,
344
+ "task_type": "quality_single_A_noref",
345
+ "conversations": [
346
+ {
347
+ "from": "human",
348
+ "value": question_generate(),
349
+ },
350
+ {
351
+ "from": "gpt",
352
+ "value": None
353
+ }
354
+ ],
355
+ })
356
+
357
+ if len(LQ_list) > 0 and len(HQ_list) > 0 and len(LQ_list) == len(HQ_list): # pair
358
+ meta_refA_pth = list_path.replace(".list", "_iqa_refA_detail.json")
359
+ meta_A_pth = list_path.replace(".list", "_iqa_A_detail.json")
360
+ with open(meta_refA_pth, "w") as f:
361
+ json.dump(meta_refA, f, indent=4)
362
+ with open(meta_A_pth, "w") as f:
363
+ json.dump(meta_A, f, indent=4)
364
+
365
+ print(f"[{os.path.relpath(meta_refA_pth, base_rt)}, ], # LQ[{len(LQ_list)}], HQ[{len(HQ_list)}], quality_single_A, {degradation}, {dname}-{dset}")
366
+ print(f"[{os.path.relpath(meta_A_pth, base_rt)}, ], # LQ[{len(LQ_list)}], HQ[{len(HQ_list)}], quality_single_A_noref, {degradation}, {dname}-{dset}")
367
+
368
+ elif len(LQ_list) > 0 and len(HQ_list) == 0: # real image
369
+ meta_A_pth = list_path.replace(".list", "_iqa_A_detail.json")
370
+ with open(meta_A_pth, "w") as f:
371
+ json.dump(meta_A, f, indent=4)
372
+ print(f"[{os.path.relpath(meta_A_pth, base_rt)}, ], # LQ[{len(LQ_list)}], HQ[{len(HQ_list)}], quality_single_A_noref, {degradation}, {dname}-{dset}")
373
+
374
+ elif len(LQ_list) == 0 and len(HQ_list) > 0: # syn image
375
+ meta_refA_pth = list_path.replace(".list", "_iqa_syn_refA_detail.json")
376
+ meta_syn_pth = list_path.replace(".list", "_iqa_syn_A_detail.json")
377
+ with open(meta_refA_pth, "w") as f:
378
+ json.dump(meta_refA, f, indent=4)
379
+ with open(meta_syn_pth, "w") as f:
380
+ json.dump(meta_syn, f, indent=4)
381
+ print(f"[{os.path.relpath(meta_refA_pth, base_rt)}, ], # LQ[{len(LQ_list)}], HQ[{len(HQ_list)}], quality_single_A, {degradation}, {dname}-{dset}")
382
+ print(f"[{os.path.relpath(meta_syn_pth, base_rt)}, ], # LQ[{len(LQ_list)}], HQ[{len(HQ_list)}], quality_single_A_noref, {degradation}, {dname}-{dset}")
383
+
384
+ else:
385
+ raise KeyError(f"the task is not matched, please check the dataset {list_path}")
386
+
387
+