0
$\begingroup$

I'm trying to white board the different mechanisms behind a convolutional neural network. I have on question regarding the dimension of my volume after using a max pooling layer. Let's suppose I have a (21,21,#filtres) volume's dimension. If Max Pooling divide by 2 the height and width of my volume, what will be the dimension after the Max Pooling layer ? If odd numbers are a problem when using max pooling layer, How do I fix it ?

Thank you !

$\endgroup$
  • $\begingroup$ Are you considering the stride parameter (available in most libraries)? If so, what is it set to? The default would be to set stride equal to the pooling size i.e. 2, and therefore divide layer size by 2. $\endgroup$ – Neil Slater Sep 2 at 14:15
  • $\begingroup$ From the lectures I followed, stride was often set to 1. Make it equal to 2 will fix the problem ? $\endgroup$ – Valentin Sep 2 at 14:31
  • $\begingroup$ If stride is set to 1 there is no problem, the pooling will not need to be applied partially in order to cover the whole input. Your output would be (20, 20, num_filters) though, it doesn't shrink the feature map as much. It still provides useful generalisation. Stride is often set to 1 for the convolutional layer, but not for pooling layers, so it may be the value you noticed from lectures was referring convolutional layers. $\endgroup$ – Neil Slater Sep 2 at 14:32
0
$\begingroup$

The result from applying a max pooling layer with a stride that does not exactly fit to the input will be dependent on the implementation in your library.

Assuming stride 2, and pool size (2,2), in your case the most likely things are:

  • The result will round up, so you will have a feature map layer with dimensions (11, 11, num_filters) although the right edge pixels will be a max over 2 pixels in the input, and the right bottom corner will just be a copy of the right bottom corner in the input (counting from top left as $(0, 0)$)

  • It is an error condition for your libary.

If it is not an error, then the max pooling should still perform the task it was intended to. If important features are often at the right or bottom edge, then they may generalise slightly less well, but you probably won't notice a measurable effect.

You could experiment with different sizes of pooling, different strides, or padding the previous convolutional layer so that the max pooling fits exactly. You will have to do something like this if the library has errors when the pooling does not fit exactly. You can test your experiments using cross validation, to see if there is any measurable difference.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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