juglab / n2v

This is the implementation of Noise2Void training.
Other
387 stars 107 forks source link

Clipping is missing in noisy image synthesis #74

Closed guochengqian closed 4 years ago

guochengqian commented 4 years ago

Hi N2V team! At first, thanks for your amazing work and reproducible code. I can reproduce your result and obtain PSNR from 27.62 -> 27.68 for BSD68 grey level denoising.

However, I find there is a mistake in your code. When you synthesize the Gaussian noisy image, you should always clip and transform them into unit8. (remember it is still an image). Unfortunately, you did not clip them. (If you look at the training or the test_data, their data range can be from -40 to 350.

I have fixed the bug when I reproduce your result. If we add clip: np.clip(x, 0, 255.) in training and testing:
the final PSNR will be from 27.42 -> 27.49. (PNSR lower than before.)

However, this issue will not influence your major merit. Please fix the mistake in your code, which will benefit the community and help the community always make a fair comparison.

Thank you!

alex-krull commented 4 years ago

Hello guochengqian, Thank you for pointing this out. We consciously decided against clipping. Even though photographs are often stored in 8 bit, this is not true for other types of images (e.g. in microscopy often 16 bit or even 32 bit float is used). Clipping would change the distribution of the noise, making it no longer zero-centered, which we rely on in N2V. So to illustrate the principle, we decided against clipping in the paper. Note that all the baselines we ran to compare our method against use the same unclipped data. However, we do agree that people might expect the data to be clipped. We will point this out in the example notebook and also include your suggested line as a comment so that it can be uncommented to enable clipping if desired.

Cheers, Alex

guochengqian commented 4 years ago

That is good. Thank you. Do mention that in the new version of the notebook. At least the data should be clipped even if they can be float type not uint8. There should never be a negative value.