question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong PSNR value by the in-place operator?

See original GitHub issue

Hi, @apchenstu

Thank you for sharing this really great idea! It’s very helpful for me to develop other ideas related to Radiance Fields.

By the way, I just notice that you might have wrong PSNR value by the in-place operator(+=). You’ve assigned the image loss variable loss to total_loss, and then increase it with the += operator. It will modify the original image loss loss variable resulting in wrong PSNR; in fact, smaller than the true value. You can check this at my colab.

Thank you, Sangmin Kim.

https://github.com/apchenstu/TensoRF/blob/17deeedae5ab4106b30a3295709ec3a8a654c7b1/train.py#L190-L198,

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
sangminkim-99commented, Aug 11, 2022

Hi, @Derry-Xing Yes, it is not related to the quality of the output images but only for the output PSNR values. I just want to check the reported PSNR at the paper is correct.

0reactions
sangminkim-99commented, Sep 6, 2022

how come it affects the PSNR, the calculation of PSNR is related to this PSNRs.append(-10.0 * np.log(loss) / np.log(10.0)) it’s about the variable loss, instead of total_loss, or did I miss something?

At line 190, total loss shares the same memory with loss. Then any in-place operation on total_loss will modify the image loss term(loss in this code).

thx, now I change it to

psnrloss = loss.clone().detach().item()
...
PSNRs.append(-10.0 * np.log(psnrloss ) / np.log(10.0))

is it correct now?

Yes it seems good,

But i think you can just change the in-place operator; i.e. total_loss = total_loss + …

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Incorrect results for PSNR calculation - Stack Overflow
Example luma PSNR values for a cjpeg compressed image at various quality levels. The PSNR is not calculated for the whole RGB image...
Read more >
ImageBufAlgo: Image Processing - OpenImageIO 2.4
The function is passed a destination ImageBuf where the results will be stored, and the return value is a bool that is true...
Read more >
PSNR graph for different Speckle noise level and algorithms
The PSNR, MSE, SSIM, and SNR values of the de-noised images are calculated and a comparative analysis is performed with the conventional de-noising...
Read more >
Noise2Noise: Learning Image Restoration without Clean Data
bad images into good images by only looking at bad images, ... PSNR values refer to the images shown here, see text for...
Read more >
How to solve the error in PSNR function? - MATLAB Answers
Just like the error message says, psnr() does not take that many input arguments. You passed in 4 and it can take only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found