0
votes

I am using Keras to make a CNN, and I want to visualize the model with plot_model().

When I look at the shape of the Conv2d layers, there is a thing that I can't figure out.

Let's say my Conv2d layer has kernel size [8 x 8], stride is [4 by 4], padding is 'same' and I want 16 feature maps.

Input shape to this layer is [None, 3, 160, 320] and output is [None,1,40,16].

'None' is samples, but what is 1 and 40? I guess 16 is number of feature maps?

Since I implemented padding = 'same', shouldn't the image size out have the same width and height as input, or isn't this the same thing?

Thanks!

1

1 Answers

0
votes

Well, since you're using "strides", you'll never have the same shape.

Your convolutional filter (which can be seen as a sliding window) is jumping four pixels in its sliding.

As a result, you get your final shape divided by 4 (and rounded up).

  • 3/4 rounded up = 1
  • 160/4 = 40
  • 16 is the number of feature maps, indeed.