kakaobrain / nerf-factory

An awesome PyTorch NeRF library
https://kakaobrain.github.io/NeRF-Factory
Apache License 2.0
1.27k stars 107 forks source link

Save as png format instead of jpg format #20

Closed johnnylu305 closed 1 year ago

johnnylu305 commented 1 year ago

jpg is lossy compression. Hence, users may get different psnr if they compute psnr offline with saved jpg files.

jeongyw12382 commented 1 year ago

@johnnylu305 Oh, thanks for the suggestion. I'm not really aware about this issue so I am currently seeking for relevant references. Could you elaborate about the issue more, or recommend me any references to follow-up?

johnnylu305 commented 1 year ago

@jeongyw12382

The command I used to get online computing PSNR and saved JPG file

python3 run.py --ginc configs/nerf/llff.gin --scene hand --seed 20230126 --ginb run.run_train=False

The issue I got

When I tried to compute the PSNR between saved JPG file (lossy compression) and ground truth, the PSNR did not match the PSNR from the above command.

Possible solution

After I saved it as PNG file (losseless compression), the PSNR is the same as the online version.

Reference

(I don't have GPU to run the experiment now, but I hope these can verify my statement.) https://en.wikipedia.org/wiki/JPEG https://en.wikipedia.org/wiki/PNG

jeongyw12382 commented 1 year ago

Okay. This seems fine. Accepting the pull request. Thanks :)