GuoShi28 / CBDNet

Code for "Toward Convolutional Blind Denoising of Real Photographs", CVPR 2019
Apache License 2.0
501 stars 92 forks source link

Questions regarding estimator training #21

Closed TouqeerAhmad closed 5 years ago

TouqeerAhmad commented 5 years ago

Hi Guo Shi,

I am trying to train the estimator network alone in the tensorflow and have few questions about training settings that I could not get answers from the paper of the GitHub page; would you please answer them?

  1. In paper the patch size is mentioned to be 128x128 -- are these patches cropped from images at random? or they are cropped on a grid basis with a stride from each training image?
  2. How many number of batches are there in one epoch?
  3. Are the 1600 images from each Waterloo and FiveK data sets are chosen at random befogging the training or they different in each epoch?
  4. From paper it takes around 3 days to train full network, do you have any estimate for the estimator network -- since the estimator seems to be a fraction of the full CBDNet.

Hoping to get a prompt response. Thank you!

TouqeerAhmad commented 5 years ago

Also could you provide the code for losses (even Matlab code if you can). Thanks!

GuoShi28 commented 5 years ago

@TouqeerAhmad , The training data are choosen randomly. And for loss function, I gauss you mean TV_loss. It's my implement of TV_loss. If you have other questions or find mistake in my work, please feel free to contact me.

function Y = vl_nnloss(X,c,dzdy,varargin)

if nargin <= 2 || isempty(dzdy)
    switch varargin{2}
        case 'TVlossl2'
            PxX = X(:,[2:end end],:,:) - X;
            PxY = X([2:end end],:,:,:) - X;
            Y = sum(PxX(:).^2)/2 + sum(PxY(:).^2)/2;
    end
else
     switch varargin{2}
         case 'TVlossl2'
            PxX = X(:,[2:end end],:,:) - X;
            PxY = X([2:end end],:,:,:) - X;
            dzdy_temp_x = PxX .* dzdy;
            dzdy_temp_y = PxY .* dzdy;
            dzdy_X = dzdy_temp_x(:,[1 1:end-1],:,:) - dzdy_temp_x;
            dzdy_Y = dzdy_temp_y([1 1:end-1],:,:,:) - dzdy_temp_y;
            Y = dzdy_X + dzdy_Y;
     end
end
TouqeerAhmad commented 5 years ago

Thank you for sharing the "TV_loss" code! Can you please let me know the number of batches per epoch?

Have you tried training the estimator CNN only? In that case how are you generating the Ground Truth noise maps? I understand it should be some parts from "AddNoiseMosai.m" -- would you be able to share the code to generate Ground Truth sigma maps.

TouqeerAhmad commented 5 years ago

Just looked at the other issues -- feels like "L*n_sigma_s + n_sigma_c" is being used as GT noise map. Is that correct?

GuoShi28 commented 5 years ago

Yes, In this paper, the ground-truth is defined as this