Removing Noise from Images using a CNN model in Pytorch — Part 1

Ayoola Olaleye
2 min readNov 26, 2020

--

Sometimes when we take photos, they contain some fuzziness, actually some sort of noise. This noise get induced into our photos either while taking them or during transmission. That’s why, in this post, we will be using a CNN model to remove noise (gaussian) from images while keeping it features intact.

That sounds cool, right? Let’s get started.

noisy image
A noisy image of myself

I believe if you’re reading this, you already have an idea of neural networks, CNN and some basic understanding of Pytorch deep learning framework.

In order to remove noise from images, we’ll be following a paper, Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising by Kai Zhang et al. I’ll suggest you take a quick look at the paper before you continue.

Having read the paper, here are three important things to note:

  1. The proposed model is called DnCNN; hence, in the remainder of this post, I’ll be using the word DnCNN whenever I am referring to the model.
  2. The goal of the proposed model DnCNN is to recover a clean image x from a noisy observation y. The noisy observation y is a combination of a clean image x and residual image v.

Here’s a mathematical representation: y = x + v.

3. A residual learning formulation is used to train a residual mapping R(y) ≈ v. To get the clean image x, we subtract the residual image at the output of the model R(y) from the noisy input image y.

Mathematically, x = y − R(y)

DnCNN Model Architecture (source: Beyond a Guassian Denoiser paper)

In conclusion, for our model, we’ll be passing a noisy image y at the input and get the residual image R(y) at the output. The clean image x is then gotten by subtracting the R(y) from the y.

In the next post, we’ll be seeing a Pytorch implementation of the paper.

--

--

Ayoola Olaleye
Ayoola Olaleye

Written by Ayoola Olaleye

I write on Computer Vision, Deep Learning and Machine Learning techniques.

No responses yet