Coders Packet

Image Denoiser using Autoencoders in Python

By Ishan Gurtu

This project is based on implementing an Autoencoder using deep learning on the MNIST dataset using Tensorflow Library on Google Colaboratory to denoise digit images using Python Language.

In this packet, I have implemented a simple Autoencoder on a well-known MNIST dataset which contains 60,000 28x28 pixel digit images for training and 10,000 images for testing commonly used for digit recognition. Here, it is used to denoise images using an Autoencoder.

This Code packet is written and executed in Python Programming Language.

An Autoencoder in simple words consists of an Encoder Network which takes in a high-dimensional complex input and encodes it into a simpler state(latent state) of less dimension in a Bottle Neck. The second part of it consists of a Decoder Network which reads the latent state of the data and reconstructs it back into a high dimensional state of the input size filtering noise in this case.

I specifically used Autoencoder for denoising images due to the following reasons:

1. Encoders and Decoders are Highly data specific rather than some general math noise removal algorithm.

2. Encoders and Decoders are Learnt by providing noisy images and their corresponding label images.

 

Steps of Implementation of the project in the Code Packet:

1. Import Necessary libraries- Keras, NumPy, Matplotlib.

2. Parameters selection of image, batch size, epochs, noise factor, etc.

3. Loading the dataset which is present already in the Keras library, no need for external downloading.

4. Adding noise to the images.

5. Create the encoder network having two conv2d layers, first of 128 filters with 3X3 kernel size, and a second layer with 64 filters. Relu used

    Similarly, the decoder network has two conv2d layers of 64 and 128 filters respectively with a 3X3 kernel size. Relu used.

    Finally, a two-dimensional output layer with one filter hopefully outputting finalized denoised images. Sigmoid Activation Used.

6. Compiling and training the model.

7. Saving the model and loading it.

8. Creating denoised images with test images and plotting it along with pure and noisy images.

 

To run it on your system or on Google Colab:

1. Import necessary libraries. (written already)

2. Specify parameters. (written already)

3.  Load data. (code written)

4. Add noise to the image. (code present already)

5. Load model. (shown)

6. Predict denoised images. (code present)

7. Plot images. (code present)

 

More simply, from the code packet download the executable python file and model.h5 file. Run the code sections mentioned above in their respective order.

 

 

Download Complete Code

Comments

No comments yet