Encoder model

For the encoder model, we will use three convolutional layers with 512, 512, and 256 filters, as shown in the following code:

# Encoder network
input_layer <- layer_input(shape = c(128,128,3))
encoder <- input_layer %>%
layer_conv_2d(filters = 512, kernel_size = c(3,3), activation = 'relu', padding = 'same') %>%
layer_max_pooling_2d(pool_size = c(2,2),padding = 'same') %>%
layer_conv_2d(filters = 512, kernel_size = c(3,3), activation = 'relu', padding = 'same') %>%
layer_max_pooling_2d(pool_size = c(2,2),padding = 'same') %>%
layer_conv_2d(filters = 256, kernel_size = c(3,3), activation = 'relu', padding = 'same') %>%
layer_max_pooling_2d(pool_size = c(2,2), padding = 'same')
summary(encoder)
Output
Tensor("max_pooling2d_22/MaxPool:0", shape=(?, 16, 16, 256), dtype=float32)

Here, the encoder network is 16 x 16 x 256 in size. We will keep the other features similar to the encoder models that we used in the previous two examples. Now, we will specify the decoder architecture of the autoencoder network.

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

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