I'm new to all the stuff I'm going to talking about so that the questions may be too simple.
Thanks in advance for your answers!
My questions cames from the following image:
To be more clear:
For the first Convolution, from 1 x 28 x28
to 25 x 26 x26
, the input (1 layer) goes through the filter (25 layers). So, one layer was filtered 25 times ( right ? ).
But for the second Convolution, from 25 x 13 x 13
to 50 x 11 x 11
, what's the operation of the filter 50 x 3 x 3
applied on the input 25 x 13 x 13
? I confused about the operation. Because the output should be 1250 x 11 x 11
if each layer of the input 25 x 13 x 13
goes through the filter 50 x 3 x 3
. Why is the output still 50 layers?
For the second Max Pooling, how does MaxPooling2D()
deal with a layer with odd size? The remainder of (11 mod 2)
is 1
. In the above image, from 11
to 5
, what happened on the 1
?
In addition, What's the common operation for Max Pooling an odd-size input layer?
Each convolution is applied to all the channels of the input(output of the previous layer), in this case, one filter( from the 50x3x3 Conv2d) is applied to all 25(from 25x3x3 Conv2d) input then the results will be summed up to give one output feature map of 50Conv2d, this will be done for 50 times. here is a link about how filters are applied to features maps. The rule of thumb is, if the next convolution have N filters, its output should also have N features maps.
For maxPooling, the default value for padding in MaxPooling2D; which is applied in your case, is "valid|", it means that the pooling function will not include values that can not be contained in kernel size. in your example, kernel is 2, that means the 11th element was not included in the operation. Here is a good link about the padding="valid" flag, the second answer has a good visual on how some elements of the input are left out during this operation.