Changes to the architecture

We modify the architecture of the CNN by adding more convolutional layers to illustrate how such layers can be added. Take a look at the following code:

# Model architecturemodel <- keras_model_sequential() model %>%          layer_conv_2d(filters = 32, kernel_size = c(3,3),                         activation = 'relu', input_shape = c(28,28,1)) %>%            layer_conv_2d(filters = 32, kernel_size = c(3,3),                         activation = 'relu') %>%           layer_max_pooling_2d(pool_size = c(2,2)) %>%          layer_dropout(rate = 0.25) %>%            layer_conv_2d(filters = 64, kernel_size = c(3,3),                         activation = 'relu') %>%          layer_conv_2d(filters = 64, kernel_size = c(3,3),                         activation = 'relu') %>%           layer_max_pooling_2d(pool_size = c(2,2)) %>%          layer_dropout(rate = 0.25) %>%    layer_flatten() ...

Get Advanced Deep Learning with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.