Spaces:
Runtime error
Runtime error
update label
Browse files
peak_signal_to_noise_ratio.py
CHANGED
@@ -51,7 +51,7 @@ _CITATION = """
|
|
51 |
|
52 |
|
53 |
@evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
|
54 |
-
class
|
55 |
def _info(self):
|
56 |
return evaluate.MetricInfo(
|
57 |
description=_DESCRIPTION,
|
@@ -91,8 +91,8 @@ class StructuralSimilarityIndexMeasure(evaluate.Metric):
|
|
91 |
sample_weight=None,
|
92 |
) -> Dict[str, float]:
|
93 |
samples = zip(predictions, references)
|
94 |
-
|
95 |
-
|
96 |
-
weights=sample_weight
|
97 |
-
|
98 |
|
|
|
51 |
|
52 |
|
53 |
@evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
|
54 |
+
class PeakSignaltoNoiseRatio(evaluate.Metric):
|
55 |
def _info(self):
|
56 |
return evaluate.MetricInfo(
|
57 |
description=_DESCRIPTION,
|
|
|
91 |
sample_weight=None,
|
92 |
) -> Dict[str, float]:
|
93 |
samples = zip(predictions, references)
|
94 |
+
psnrs = map(lambda args: peak_signal_noise_ratio(*args, data_range), samples)
|
95 |
+
return {
|
96 |
+
"Peak Signal-to-Noise Ratio": np.average(list(psnrs), weights=sample_weight)
|
97 |
+
}
|
98 |
|