1
$\begingroup$
1    model.add(ZeroPadding2D((1, 1), input_shape=(3, 48, 48), dim_ordering='th'))
2    model.add(Convolution2D(4, 3, 3, activation='relu', dim_ordering='th',init='he_uniform'))
3    model.add(ZeroPadding2D((1, 1), dim_ordering='th'))
4    model.add(Convolution2D(4, 3, 3, activation='relu', dim_ordering='th',init='he_uniform'))
5    model.add(MaxPooling2D(pool_size=(2, 2), strides=(2, 2), dim_ordering='th'))

6    model.add(ZeroPadding2D((1, 1), dim_ordering='th'))
7    model.add(Convolution2D(8, 3, 3, activation='relu', dim_ordering='th',init='he_uniform'))
8    model.add(ZeroPadding2D((1, 1), dim_ordering='th'))
9    model.add(Convolution2D(8, 3, 3, activation='relu', dim_ordering='th',init='he_uniform'))
10    model.add(MaxPooling2D(pool_size=(2, 2), strides=(2, 2), dim_ordering='th'))

above is an example of a pretty simple keras model

The convolution layer at #2 produces as output 4 activation maps, which where learnt from 4, 3x3 kernels. Does the max pool layer at #5 combine these 4 activation maps into a single one?

Also, would it make sense to change #4 to use 8 or 16 kernels? This doesn't make sense to me because i've never seen a CNN example where the # of kernels changes from one layer to the next. It makes sense to me to change the # of kernels between #5 and #7 because the Max pool layer combines the separate activation maps into one. Any intuition on why/how this work?

$\endgroup$

1 Answer 1

1
$\begingroup$

Does the max pool layer at #5 combine these 4 activation maps into a single one?

No. As you can see the operation applied is MaxPolling2D, so it will be applied only in space and keep the channels. In this case, the output will be 24x24x4, because your stride is 2x2.

Also, would it make sense to change #4 to use 8 or 16 kernels?

Yes, it will. Actually, that is a good practice, increase the channels dimension before decrease the spatial dimension. That is one insight use in construction of the InceptionV3 architecture for image recognition (you can read it paper here, sections 2 and 5).

Any intuition on why/how this work?

I think that in the mentioned paper you can understand better these intuitons

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.