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

Train the net by my own (clean-noisy)image pairs #58

Open hujiayu712 opened 5 years ago

hujiayu712 commented 5 years ago

hello If i want to train the net by my own (clean-noisy)image pairs but not guassian noise. How can i revise the train code.Thanks a lot!

ngcthuong commented 5 years ago

You need to modify generatepatches.m and the training code which is DnCNN_train_dag.m or DnCNN_train.m The details are following

  1. 1, Change generatepatches Currently the code generate imdb files with two filed imdb.labels - clean patch and imbd.set - indicate training and testing mini-batch.
  2. In training code, the getSimpleNNBatch(imdb, batch) function will add noise to the clean image in imdb.labels as "inputs".

So for your problem you need to

  1. Modify generatepatches.m
    • It should return imdb with imdb.input (your noisy) and imdb.labels (clean image)
  2. Modify training code
    • Just load inputs and labels in getSimpleNNBatch(imdb, batch), do not need to add noise

Hope it helps