Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSNR - Peak Signal-to-Noise Ratio #91

Closed
Tracked by #69
minhduy13ly opened this issue Oct 11, 2024 · 3 comments
Closed
Tracked by #69

PSNR - Peak Signal-to-Noise Ratio #91

minhduy13ly opened this issue Oct 11, 2024 · 3 comments
Labels
metric suggestion New metric request

Comments

@minhduy13ly
Copy link
Contributor

Metric's name
PSNR - Peak Signal-to-Noise Ratio

Metric's category
Computer Vision

Metrics formula

$$ \text{PSNR} = 10 \cdot \log_{10}\left(\frac{MAX^2}{MSE}\right) $$

where

  • MAX is the maximum possible pixel value of the image (e.g for an 8-bit image, MAX = 255).
  • MSE is the Mean Squared Error between the original image $$O$$ and the reconstructed image $$R$$. The detailed formula for MSE is (assume both original image and reconstructed image have the size heigh and width as $$h$$ and $$w$$.

$$ MSE = \frac{1}{h \cdot w} \sum_{i=1}^{h} \sum_{j=1}^{w} \left( O(i,j) - R(i,j) \right)^2 $$

Describe the metrics use cases, and any relevant references.
In the field of image generation and reconstruction, we frequently need to measure how closely our generated images resemble the reference images. Besides modern metrics like FID and Inception Score, PSNR and SSIM are two widely-used classical metrics often used for benchmarking.

The intuition behind PSNR is that it expresses how large the possible signal value (MAX) is in comparison to the error (MSE). If the error is subtle compared to the maximum signal (i.e., a high PSNR), the reconstructed image is relatively similar to the target in terms of pixel values.

Additional context
A sample of using PSNR combined with FID for benchmarking could be found in many computer vision papers, such as EdgeConnect: Generative Image Inpainting with Adversarial Edge Learning

Screenshot 2024-10-11 at 17 42 23
@minhduy13ly minhduy13ly added the metric suggestion New metric request label Oct 11, 2024
@santiviquez
Copy link
Collaborator

This is great! Thanks for suggesting it. I'll link it into #69 as metrics to include in the book.

@minhduy13ly Would you like to take the lead on this? I can support you at any step of the PR.

@minhduy13ly
Copy link
Contributor Author

Sure @santiviquez - I could get help on this and also could help support/review on other metrics in classical ML/computer vision based on my knowledge. Since I have not contribute to any open-source project before and my experience is limited, I would love to receive the feedbacks for further improving.

Do you have any suggestion on the next step?

@santiviquez
Copy link
Collaborator

santiviquez commented Oct 13, 2024

Hi @minhduy13ly, the usual workflow looks like this:

  1. Fork this repository
  2. Clone the forked repo to your local env
  3. Create a new branch before you make any
  4. Make the desired changes
  5. Commit and push your changes to your forked repo
  6. Open a Pull Request from github.com

And that is pretty much it. This video summarizes it nicely: https://www.youtube.com/watch?v=8lGpZkjnkt4

You might need to install latex on your own machine. In case you don't have it, check out this instructions.

Let me know if you have any issues.

santiviquez added a commit that referenced this issue Oct 18, 2024
PSNR Peak-Signal-to-Noise Ratio #91 First Page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
metric suggestion New metric request
Projects
None yet
Development

No branches or pull requests

2 participants