Coder Social home page Coder Social logo

abhijitramesh / auto-encoders Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 109 KB

Auto-Encoders are neural networks that learns to encode data then learn how to reconstruct this data back to something which is as close as the original representation of the input data.

Jupyter Notebook 100.00%

auto-encoders's Introduction

Auto-Encoders

Auto-Encoders are Neural Networks that learns how to efficently encode a data and then also how to reconstruct this data back to something as similar as the original data.

If you recollect how CNNs work under the hood, you know the convolutinal layers take in an input image and then reduces its dimentionality so but at the same time it becomes more aware of the pattens in this netowork this aspect of the neural netowork is what we are going to use in Auto-Encoders, if we consider the process of how the convolutional layers as an encoder, we can reverse the process to make a decoder.

Simple Encoder

Let us first create a Simple Encoder for this we are going to take the MNIST dataset which has Images of dimention 28281 where the last value represents the dimention of the colour channel which is grayscale,

  • then we are going to flatten this images into a vector of 784.

Encoder

  • We will pass this vector to a linear layer which gives an output to the dimention we specify.
  • This linear layer is passed through a ReLU activation funtion.

Decorder

  • Our next layer would have a linear layer which would inverse the change in the first linear layer it takes in an input of the dimention we specify and output a vector of dimention 784.
  • We will apply sigmoid funtion to this layer.

Click here to checkout the notebook on Simple Autoencoder.

Learnable Upsampling

Since we are in the topic of Image Compression let us bring in convolutionl neural networks into the talk, they are remarkably well when they are used for classifying images. This is mainly because they are a combination of convolutional and maxpooling layers, the convolutional layers understand a feature of the image while the maxpooling layer does is it will decrease the dimentionality of the image. So if we consider this as out encorder for our decorder we need to increase the dimention of out image or do some kind of unpooling. One thig we can do is something called as nearest neibours which is let us take the example of a matrix which has elements 1,2,3,4 in dimention 2x2, so if we have to upsample this we just copy the values four times 1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4 in dimention 4x4 which means we have upsampled our image but the problem here is we would not have something which is exactly the first image and every time we do unpooling the loss increases compared to the original image so we use somthing known as Learnable Upsampling one example of this is Transpose Convolutions which insted of copying values have weights that can learn what the values of the nebouring pixel values would be.

If you like to know about the math and working behind transpose convolutional layers check this link from towards data-science.

Convolutional Encoder

Let us try and encode our data using a convolutional encorder and maxpooling in between and de-code the same using a transpose convolutional layer.

click here

Denoising Encoder

Since we see that convolutional encorders kind of removes the noise in the image we can actully modify its purpose to do the same, training the model with a noisy image and then using it to predict the image without the noise.

click here

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.