Spaces:
Runtime error
Runtime error
Update contents
Browse files
README.md
CHANGED
@@ -12,37 +12,59 @@ pinned: false
|
|
12 |
|
13 |
# Metric Card for Peak Signal to Noise Ratio
|
14 |
|
15 |
-
|
16 |
|
17 |
## Metric Description
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
## How to Use
|
21 |
-
*Give general statement of how to use the metric*
|
22 |
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
### Inputs
|
26 |
-
*List all input arguments in the format below*
|
27 |
-
- **input_field** *(type): Definition of input, with explanation if necessary. State any default value(s).*
|
28 |
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
-
|
32 |
|
33 |
-
|
|
|
34 |
|
35 |
-
|
36 |
-
*Give examples, preferrably with links to leaderboards or publications, to papers that have reported this metric, along with the values they have reported.*
|
37 |
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
40 |
|
41 |
-
## Limitations and Bias
|
42 |
-
*Note any known limitations or biases that the metric has, with links and references if possible.*
|
43 |
|
44 |
-
## Citation
|
45 |
-
*Cite the source where this metric was introduced.*
|
46 |
|
47 |
## Further References
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Metric Card for Peak Signal to Noise Ratio
|
14 |
|
15 |
+
|
16 |
|
17 |
## Metric Description
|
18 |
+
It is the ratio between the maximum possible power of a signal and the power of
|
19 |
+
corrupting noise that affects the fidelity of its representation. This metric is
|
20 |
+
commonly used to measure the quality of images generated by models.
|
21 |
+
|
22 |
+
- Super-Resolution
|
23 |
+
- Image Denoising
|
24 |
+
- Image Compression
|
25 |
+
|
26 |
+
PSNR is a measure of the quality of reconstruction of an image. The higher the PSNR, the
|
27 |
+
better the quality of the image.
|
28 |
|
29 |
## How to Use
|
|
|
30 |
|
31 |
+
At minimum, this metric requires predictions and references as inputs.
|
32 |
+
|
33 |
+
```python
|
34 |
+
import evaluate
|
35 |
+
|
36 |
+
psnr = evaluate.load("jpxkqx/peak_signal_to_noise_ratio")
|
37 |
+
psnr.compute(predictions=[[0.0, 0.1], [0.1, 0.9]], references=[[0.0, 0.2], [0.1, 0.8]])
|
38 |
+
```
|
39 |
|
40 |
### Inputs
|
|
|
|
|
41 |
|
42 |
+
- **predictions** *('np.array'): Predictions to evaluate.*
|
43 |
+
- **references** *('np.array'): True image to consider as baseline.*
|
44 |
+
- **data_range** *('float'): The data range of the images (distance between the minimum
|
45 |
+
and maximum possible values). If not provided, it is determined from the image data-type.*
|
46 |
+
- **sample_weight** *('list'): Sample weights default to None.*
|
47 |
+
|
48 |
|
49 |
+
### Output Values
|
50 |
|
51 |
+
- **psnr** *('float'): Peak Signal to Noise Ratio, which it is expressed as a
|
52 |
+
logarithmic quantity using the decibel scale.*
|
53 |
|
54 |
+
Outputs example:
|
|
|
55 |
|
56 |
+
```python
|
57 |
+
{'psnr': 35.23}
|
58 |
+
```
|
59 |
+
Typical values for the PSNR in lossy image and video compression are between 30 and 50
|
60 |
+
dB, provided the bit depth is 8 bits.
|
61 |
|
|
|
|
|
62 |
|
|
|
|
|
63 |
|
64 |
## Further References
|
65 |
+
|
66 |
+
|
67 |
+
[Peak Signal to Noise Ratio (PSNR) - Wikipedia](https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio)
|
68 |
+
[Peak Signal to Noise Ratio (PSNR) - scikit-image](https://scikit-image.org/docs/dev/api/skimage.metrics.html#skimage.metrics.peak_signal_noise_ratio)
|
69 |
+
[Peak Signal to Noise Ratio (PSNR) - PyTorch](https://pytorch.org/ignite/generated/ignite.metrics.PSNR.html)
|
70 |
+
[Peak Signal to Noise Ratio (PSNR) - TensorFlow](https://www.tensorflow.org/api_docs/python/tf/image/psnr)
|