csjunxu / Noisy-As-Clean-TIP2020

PyTorch Code for "Noisy-As-Clean: Learning Self-supervised Denoising from Corrupted Image", TIP 2020.
70 stars 9 forks source link

A doubt about how this code work #3

Open hhhhsh opened 3 years ago

hhhhsh commented 3 years ago

In your paper, you say that you train the network with the loss ||f(y+n)-y||^2, where y is the noisy image. This means that the noisy image y should be fixed. However, in your code, given a clean image x, you just add different noisy n_i in different iterations of training, which means you have different version of the noisy image y. This is wrong I think. Also, consider y=x+n_1, the n should be different with n since we do not know n_1. In your code, you just add this n_1 to y to get y+n, which I think is also wrong. Can you revise the codes to the right one?

hhhhsh commented 3 years ago

The later one means that you know the ground truth since we can get x from y-n_1.

csjunxu commented 3 years ago

We are sorry to have this problem, we have checked our code and admit our mistake. Luckily, the real world image denoising part is not wrong, since we do not know the noise beforehand. Now, we are working on a correction of this work, and hope provide you a right but equally effective code as soom as possible.

Please wait for our correction. Thank you for your remind~

csjunxu commented 3 years ago

In Gaussian noise removal, a natural operation is using fixed random seed to generate the noise. Then we indeed know the n_1 in y=x+n_1 beforehand. The reason is that we know the noise level. then the noise n_2 can be generated exactly the same as n_1. The key is that, we know the noise level, not the noise itself. In test stage, you cannot get x from y-n_1, since we cannot use n_1 to perform denoising directly.

sherbret commented 1 year ago

As @hhhhsh , I have troubles understanding how this code works. I tried to minimize the expectancy of ||f(y+n)-y||^2 by myself where y is a fixed noisy image (sigma=5 in my experiments with the grayscale image House of Set12), f is DnCNN (parameters initialized randomly) and n is a noisy random vector of pure Gaussian noise (sigma=5 as well). y is fixed but n changes every gradient step. After 100 gradient steps with Adam, I evaluate the PSNR of the resulting image f(y) but its PSNR is much lower PSNR than the image denoised by a trained DnCNN on an external dataset composed clean/noisy image pairs. Am I doing something wrong ?

Also, I do not understand how you get better PSNR results with N2N than with DnCNN (see tables of the article) which is trained on clean/noisy images pairs. Intuitively, training with ground truths should be superior. Which network architecture do you use exactly for N2N ?

Thank you very much for your answer !