SaoYan / DnCNN-PyTorch

PyTorch implementation of the TIP2017 paper "Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising"
http://ieeexplore.ieee.org/document/7839189/
GNU General Public License v3.0
407 stars 117 forks source link

关于残差与loss function问题 #4

Closed hust-lidelong closed 4 years ago

hust-lidelong commented 6 years ago

您好! 在您写的代码中,有一段没有看懂,望指点: 在train.py中, out_train = model(imgn_train) loss = criterion(out_train, noise) / (imgn_train.size()[0]*2) ...

results

model.eval() out_train = torch.clamp(imgn_train-model(imgn_train), 0., 1.) psnr_train = batch_PSNR(out_train, img_train, 1.)

1.为什么已经定义了out_train,后面还要重新定义out_train呢 2.为什么要除imgn_train.size()[0]*2。0.,1. 是什么意思啊 3.残差是指的代码中的哪个呢,文章中是 l = 1/2N ||R(y) - (y -x) ||2,文章中的残差是R(y)吧

新手,谢谢指点

chaoyueziji commented 5 years ago

让所有的值在0-1之间,imgn_train.size()[0]*2 == 2N