Query regarding (.output_shape) parameters used in CNN model

I am applying CNN model on my dataset for predictions. After reshaping the dimensions, the input_shape of my model1 becomes:

model1.input_shape: (None, 1, 3, 4)

then i apply CNN ist input layer defined below:

model1.add(Convolution2D(128, (2,2), border_mode= 'valid' , input_shape=(1, 3, 4), activation= 'relu'))

here above 1 is number of channel, 3,4 represents my nodes means 12 input nodes or features, now wehn i check the output_shape of model1, it is:

model1.output_shape: (None, 128, 2, 3)

here 128 are number of neurons i specified in my input layer. My question is what does the elements 2,3 shows here?

Topic deep-learning machine-learning

Category Data Science


The output shape in a 2D convolutional layer depends on :

  • The input size W, H
  • The filter size F
  • The padding P
  • The stride S
  • The number of filters or depth D

Here, in your model, W=3, H=4, F=2, P=0 (default padding in Keras), S=1 (default stride in Keras), D=128 as you defined it.

The transformation is defined by the mathematical convolution operation, giving you an output shape as:

$\frac{W−F+2P}{S} + 1$

This output shape shows how your input reacts (in terms of size) when convolved with your 128 filters one by one.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.