Multiple layers in Keras can share the output from one layer. There can be multiple different feature extraction layers from an input, or multiple layers can be used to predict the output from a feature extraction layer.
Let's look at both of these examples.
In this section, we show how multiple convolutional layers with differently sized kernels interpret an image input. The model takes colored CIFAR images with a size of 32 x 32 x 3 pixels. There are two CNN feature extraction submodels that share this input; the first has a kernel size of 4, the second a kernel size of 8. The outputs from these feature extraction sub-models are flattened into vectors and concatenated into one long vector, and this is passed on to a fully connected layer for interpretation before a final output layer makes a binary classification.
This is the model topology:
- One input layer
- Two feature extraction layers
- One interpretation layer
- One dense output layer