cszn / DnCNN

Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising (TIP, 2017)
https://cszn.github.io/
1.42k stars 534 forks source link

Is the code on line 23 in the main_train.py file[DnCNN-keras] correct? #63

Closed wangweiwei104 closed 4 years ago

wangweiwei104 commented 5 years ago

noise = np.random.normal(0, args.sigma / 255.0, batch_x.shape) # noise batch_y = batch_x + noise yield batch_y, batch_x

Does these lines of code mean that the labels are clean pictures rather than noises? However, in the paper 'Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising ', the noise are set as labels. Is the code correct?

ngcthuong commented 5 years ago

You should see the training file. He gets it correctly but just inverses the index. Here the main_train.py, line 162.

The index is [1] then [0]

batch_x, batch_y = batch_yx[1].cuda(), batch_yx[0].cuda()

wangweiwei104 commented 5 years ago

@ngcthuong Thank you for your reply, but there are no 162 lines in the main_train.py file. I didn't find this code.

batch_x, batch_y = batch_yx[1].cuda(), batch_yx[0].cuda()

ngcthuong commented 5 years ago

FYI image

wangweiwei104 commented 5 years ago

@ngcthuong I am referring to the keras version rather than pytorch here !

bittergourd1224 commented 4 years ago

The network output is still noise, the only difference is the author subtracts noise from inputs to get the estimated clean image, as you can see in line 76: x = Subtract(name = 'subtract' + str(layer_count))([inpt, x]) # input - noise Actually there are no difference, since the idea of residual still resides here.

wangweiwei104 commented 4 years ago

The network output is still noise, the only difference is the author subtracts noise from inputs to get the estimated clean image, as you can see in line 76: x = Subtract(name = 'subtract' + str(layer_count))([inpt, x]) # input - noise Actually there are no difference, since the idea of residual still resides here.

ok, I got it! Thanks! @bittergourd1224