Encoder model

The code that's used for the encoder network is as follows:

# Encoder
input_layer <-
layer_input(shape = c(28,28,1))
encoder <- input_layer %>%
layer_conv_2d(filters = 32,
kernel_size = c(3,3),
activation = 'relu',
padding = 'same') %>%
layer_max_pooling_2d(pool_size = c(2,2),
padding = 'same') %>%
layer_conv_2d(filters = 32,
kernel_size = c(3,3),
activation = 'relu',
padding = 'same') %>%
layer_max_pooling_2d(pool_size = c(2,2),
padding = 'same') summary(encoder)
OutputTensor("max_pooling2d_6/MaxPool:0", shape=(?, 7, 7, 32), dtype=float32)

Here, the input layer is specified to be 28 x 28 x 1 in size. We use two convolution layers with 32 filters each and a rectifier linear unit as the activation function. Each convolution layer is followed by pooling layers. After the first pooling layer, the height and width change to 14 x 14, and after the second pooling layer, this changes to 7 x 7. The output of the encoder network in this example has 7 x 7 x 32 dimensions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset