We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af6c6cc commit e095ed6Copy full SHA for e095ed6
Makefile
@@ -21,11 +21,12 @@ release:
21
test:
22
pytest tests/ -m calibration -v
23
pytest tests/test_metric_general.py::test_forward -v
24
+ pytest tests/test_metric_general.py::test_cpu_gpu_consistency -v
25
-test_general:
26
+test_cs:
27
pytest tests/test_metric_general.py::test_cpu_gpu_consistency -v
28
-test_gradient:
29
+test_grad:
30
pytest tests/test_metric_general.py::test_gradient_backward -v
31
32
test_dataset:
ResultsCalibra/calibration_summary.csv
@@ -16,7 +16,7 @@ gmsd(ours),0.2203,0.0005,0.0004,0.1346,0.205
16
ilniqe,113.4801,23.9968,19.975,22.4493,56.6721
17
ilniqe(ours),115.6107,24.0661,19.7494,22.3251,54.7635
18
laion_aes,3.6420,5.5836,5.0716,4.6458,3.0889
19
-laion_aes(ours),3.6992,5.5835,5.1028,4.6500,3.0948
+laion_aes(ours),3.7204,5.5917,5.0756,4.6551,3.0973
20
lpips,0.7237,0.2572,0.0508,0.052,0.4253
lpips(ours),0.7237,0.2572,0.0508,0.0521,0.4253
mad,195.2796,80.8379,30.3918,84.3542,202.2371
@@ -46,7 +46,7 @@ pi(ours),11.9286,3.073,2.6357,2.7979,6.9546
46
psnr,21.11,20.99,27.01,23.3,21.62
47
psnr(ours),21.1136,20.9872,27.0139,23.3002,21.6186
48
ssim,0.6993,0.9978,0.9989,0.9669,0.6519
49
-ssim(ours),0.6997,0.9978,0.9989,0.9671,0.6521
+ssim(ours),0.6997,0.9978,0.9989,0.9671,0.6522
50
vif,0.0172,0.9891,0.9924,0.9103,0.1745
51
vif(ours),0.0172,0.9891,0.9924,0.9104,0.175
52
vsi,0.9139,0.962,0.9922,0.9571,0.9262
pyiqa/archs/liqe_arch.py
@@ -92,19 +92,21 @@ def forward(self, x):
92
93
if x.size(1) < self.num_patch:
94
num_patch = x.size(1)
95
+ self.num_patch = num_patch
96
else:
97
num_patch = self.num_patch
98
99
if self.training:
100
sel = torch.randint(low=0, high=x.size(0), size=(num_patch, ))
101
- sel_step = x.size(1) // self.num_patch
102
+ sel_step = max(1, x.size(1) // self.num_patch)
103
sel = torch.zeros(num_patch)
104
for i in range(num_patch):
105
sel[i] = sel_step * i
106
sel = sel.long()
107
108
x = x[:, sel, ...]
109
+ x = x.reshape(bs, num_patch, x.shape[2], x.shape[3], x.shape[4])
110
111
text_features = self.clip_model.encode_text(self.joint_texts.to(x.device))
112
text_features = text_features / text_features.norm(dim=1, keepdim=True)
@@ -130,5 +132,4 @@ def forward(self, x):
130
132
131
133
quality = 1 * logits_quality[:, 0] + 2 * logits_quality[:, 1] + 3 * logits_quality[:, 2] + \
134
4 * logits_quality[:, 3] + 5 * logits_quality[:, 4]
-
135
return quality
pyiqa/archs/ssim_arch.py
@@ -266,6 +266,8 @@ def cw_ssim(self, x, y, test_y_channel):
266
w = fspecial(s - 7 + 1, s[0] / 4, 1).to(x.device)
267
gb = int(self.guardb / (2**(self.level - 1)))
268
269
+ self.win7 = self.win7.to(x.dtype)
270
+
271
for i in range(self.ori):
272
273
band1 = cw_x[bandind][i]
tests/test_metric_general.py
@@ -88,7 +88,7 @@ def test_match_official_with_given_cases(ref_img, dist_img, metric_name, device)
88
@pytest.mark.skipif(not torch.cuda.is_available(), reason="GPU not available")
89
@pytest.mark.parametrize(
90
("metric_name"),
91
- [(k) for k in pyiqa.list_models() if k not in ['ahiq', 'fid', 'vsi', 'clipscore']]
+ [(k) for k in pyiqa.list_models() if k not in ['ahiq', 'fid', 'vsi', 'clipscore', 'topiq_nr-face', 'tres', 'tres-koniq']]
)
def test_cpu_gpu_consistency(metric_name):
"""Test if the metric results are consistent between CPU and GPU.
@@ -121,7 +121,7 @@ def test_cpu_gpu_consistency(metric_name):
121
122
123
124
- [(k) for k in pyiqa.list_models() if k not in ['pi', 'nrqm', 'fid', 'mad', 'vsi', 'clipscore', 'entropy']]
+ [(k) for k in pyiqa.list_models() if k not in ['pi', 'nrqm', 'fid', 'mad', 'vsi', 'clipscore', 'entropy', 'topiq_nr-face']]
125
126
def test_gradient_backward(metric_name, device):
127
"""Test if the metric can be used in a gradient descent process.
@@ -156,7 +156,7 @@ def test_gradient_backward(metric_name, device):
156
157
158
159
- [(k) for k in pyiqa.list_models() if k not in ['fid', 'clipscore']]
+ [(k) for k in pyiqa.list_models() if k not in ['fid', 'clipscore', 'topiq_nr-face']]
160
161
def test_forward(metric_name, device):
162
0 commit comments