2

If my input size is 5x5, the stride is 1x1, and the filter size is 3x3 then I can compute on paper that the final size of the convolved matrix will be 3x3.

But, when this input size changes to 28x28, or 50x50 then how can I compute the size of the convolved matrix on paper? Is there any formula or any trick to do that?

Maxim
  • 52,561
  • 27
  • 155
  • 209
nirvair
  • 4,001
  • 10
  • 51
  • 85

1 Answers1

5

Yes, there's a formula (see the details in cs231n class):

W2 = (W1 - F + 2*P) / S + 1
H2 = (H1 - F + 2*P) / S + 1

where W1xH1 is the original image size, F is the filter size, S is the stride and P is one more parameter - the padding size. Also note that result channel size equals to the number of filters.

Maxim
  • 52,561
  • 27
  • 155
  • 209