09.05.2023 Views

pdfcoffee

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Autoencoders

This results in producing a bottleneck effect in the flow of information in

the network. The hidden layer in between is also called the "bottleneck layer."

Learning in the autoencoder consists of developing a compact representation of

the input signal at the hidden layer so that the output layer can faithfully reproduce

the original input.

In the following diagram, you can see the architecture of Vanilla autoencoder:

Figure 2: Architecture of the Vanilla autoencoder, visualized

Let us try to build a Vanilla autoencoder. While in the paper Hinton used it for

dimension reduction, in the code to follow we will use autoencoders for image

reconstruction. We will train the autoencoder on the MNIST database and will use it

to reconstruct the test images. In the code, we will use the TensorFlow Keras Layers

class to build our own encoder and decoder layers, so firstly let's learn a little about

the Layers class.

TensorFlow Keras layers ‒ defining custom

layers

TensorFlow provides an easy way to define your own custom layer both from

scratch or as a composition of existing layers. The TensorFlow Keras layers package

defines a Layers object. We can make our own layer by simply making it a child

class of the Layers class. It is necessary to define the dimensions of the output while

defining the layer. Though input dimensions are optional, if you do not define them,

it will infer it automatically from the data. To build our own layer we will need to

implement three methods:

[ 348 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!