SCUNet icon indicating copy to clipboard operation
SCUNet copied to clipboard

Data range is clipped for 8 bit images with noise?

Open robmarkcole opened this issue 2 years ago • 1 comments

Hi I am using 8-bit greyscale as input, and note the usual /255 operations to put data in the range 0-1. However the operation

        if args.need_degradation:  # degradation process
            np.random.seed(seed=0)  # for reproducibility
            img_L += np.random.normal(0, args.noise_level_img/255., img_L.shape)

can result in values outside this range, as shown in the image below: image

I note that the values are later clipped by util.single2uint so what is saved is not precisely what is processed. Furthermore I wonder the effect on inferencing - presumably values are also clipped to 0-1 range?

robmarkcole avatar Oct 10 '22 13:10 robmarkcole

I noted also if I add significant noise (say noise_level_img = 100) then the output image has a very distorted histogram:

image

robmarkcole avatar Oct 10 '22 14:10 robmarkcole

It is a common setting for Gaussian denoising, please refer to https://webpages.tuni.fi/foi/GCF-BM3D/ If you retrain the model with clipping setting, the PSNR results would not change. https://github.com/cszn/FFDNet/blob/master/Demo_AWGN_Gray_Clip.m

cszn avatar Oct 26 '22 18:10 cszn