cszn / DnCNN

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

Understanding vl_nnloss.m #19

Closed ngcthuong closed 7 years ago

ngcthuong commented 7 years ago

Hi there,

I am trying to modify the loss function in DnCNN, but I am not quite sure how to do it. Could you explain a little more about your vl_nnloss?
I understand that

t = ((X-c).^2)/2; Y = sum(t(:))/size(X,4); % reconstruction error per sample;

calculates the L2 loss function. How about the second part?

Y = bsxfun(@minus,X,c).*dzdy;

why did you use bsxfun and minus? and could you explain the meaning of dzdy?

Thank you very much, Best regards, Atena

cszn commented 7 years ago

This may help you to understand the forward and backward.

ngcthuong commented 7 years ago

Thank you I already found it. Making custom layer is a bit headache.

cszn commented 7 years ago

ReLU layer is a good example for you to design a new layer.

ngcthuong commented 7 years ago

Will you intend to use DagNN? SimpleNN is quite limited for simple structure network.