GithubHelp home page GithubHelp logo

imagedenoisingautoencoder's Introduction

ImageDenoisingAutoencoder

The Denoising autoencoder is implemented with Pytorch and is applied on the MNIST dataset.

Table of contents

Required Imports

  • NumPy
  • Matplotlib(for data visualization)
  • PyTorch(for building and training the autoencoder)

Dataset

The MNIST Dataset is used. It is a dataset of 60,000 training samples and 10,000 test samples. Each sample is a 28×28 pixel grayscale image of a single handwritten digit between 0 and 9.

Denoising Autoencoder

  • Components of Autoencoder:
    • Encoder - This network downsamples the data into lower dimensions.
    • Decoder - This network reconstructs the original data from the lower dimensional representation
  • In denoising autoencoders some noise is introduced to the input images. It tries to reconstruct the original image without noise. Such a noisy input reduces the risk of overfitting and prevents the autoencoder from learning a simple identity function.

Model architecture

#Encoder
      nn.Conv2d(1,16,3, stride = 2, padding = 1)
      nn.ReLU()
      nn.Conv2d(16,32,3, stride = 2, padding = 1)
      nn.ReLU()
      nn.Conv2d(32,64,7)
#Decoder
      nn.ConvTranspose2d(64,32,7)
      nn.ReLU()
      nn.ConvTranspose2d(32,16,3, stride = 2, padding=1, output_padding = 1)
      nn.ReLU()
      nn.ConvTranspose2d(16,1,3, stride = 2, padding=1, output_padding = 1)
      nn.Sigmoid()    

Hyperparameters

Hyperparameter Value
Learning rate 0.001
Number of epochs 20
Batch Size 64

Training

Adding noise

A function is defined to add noise to the images. torch.randn is used to create a noisy tensor of the same size as the input.

Optimizer and Loss function

MSE loss and the Adam optimization technique is used.

Training-Loss plot

Loss Plot image

Results

  Original                  Noisy                Denoised

results image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.