# How to train CNN for noise removal from images using Matlab [closed]

I am currently working on a project of mine where I want to use Convolutional neural networks for noise removal from images. I am talking about removing Poisson type of noise. The software that I am using is Matlab 2018b. However, following all the instructions from this site gives me poor results. I will now roughly explain my implementation and I will also post a link to my source code, in hopes that someone can point out where I am making a mistake.

1. I first created a folder with a small number of training images taken from the PASCAL VOC dataset. The training set consists of 40 images, and I am using such a small dataset just to see whether the network is able to produce any meaningful result before training it with the full dataset.

2. I used the previously created folder with the training images to make an imageDataStore, so I have easy access to all the images

3. Then, using a for loop I resized all the images in the datastore, applied Poisson noise to all of them and stored them in a folder called X. The pristine images were stored in a folder called Y.

4. Using a for loop I stored the noisy images in a 4D array named X, with the dimensions height x width x channels x Number of images. I did the same thing with the pristine images, calling the 4D array Y.

5. Made validation 4D arrays containing ten images from the original training set of 40.

6. Defined the layers of the ConvNet using the dnCNNLayers function from matlab. I went for an 11 layer network. The layers which it gives can be found here.

7. For the training options i set the 'sgdm' solver, initial learning rate of 1e-7, max epochs to 500, validation frequency to 5, and I set it to train using my gpu.

8. The training process starts by executing the following command netPoisson=trainNetwork(X,Y,layers,options);. Here X is the 4D array containing the noisy images, and Y contains all the pristine images.

9. Here is a snapshot from the training process finished. Notice how absurdely large the Validation RMS is.

10. In this step I test the network on a sample image from the dataset by using the following command denoisedI=denoiseImage(noisyI, netPoisson); Here we can see the pristine image, the noisy image, and the image which was supposed to be the denoised one.

11. Subtracting the noisy image and the supposedly denoised image yields a somewhat noise free image, but that makes no sense whatsover.

The matlab code for all of this is here. All help will be appreciated. With regards, Emir.

• Usually, pixel values of images are scaled prior to dispatch to a CNN. Did you un-scale the output? – Sycorax Jan 29 '19 at 18:12
• Oh come on guys, don't put it on hold, I really need help. I came here after posting over at Matlab Answers first. – Shemafied Jan 29 '19 at 20:24
• Is it ok then to move this question to stack overflow? – Shemafied Jan 31 '19 at 9:27