So I am currently going over the ResNet paper and trying to understand the output dimensions of each of the layer, and it seems that I am already stuck on the first layer and its output dimension.

If I understand correctly, the size of output of a particular layer can be calculated as (ORIGINAL_SIZE - FILTER_SIZE) / STRIDE + 1

In the plain example of the ResNet, presented below on the right hand side, they claim they use 224x224 image. Therefore, when I calculate the output dimension of the 7x7 convolution with stride 2, I get

(224 - 7) / 2 + 1 = 109.5, so I round it 110.

However, in the paper they claim that their output size is 112. How would that be possible?

ResNet plain 34-layer

  • $\begingroup$ 112=224/2 seems to be the correct calculation. $\endgroup$ – Yuval Filmus Mar 9 '18 at 13:37
  • $\begingroup$ @YuvalFilmus so where is the 7x7 convolution? $\endgroup$ – Johhny Bravo Mar 9 '18 at 14:50
  • $\begingroup$ It's probably an implementation detail. Maybe they apply the convolution even outside the boundary of the actual image. It's not a big deal. $\endgroup$ – Yuval Filmus Mar 9 '18 at 14:52
  • $\begingroup$ I am asking as I am trying to understand what happens when remaining size is 1, but there is still a convolution layer with filter size greater than the actual width. $\endgroup$ – Johhny Bravo Mar 9 '18 at 15:13

I managed to find an official github repository, and they use a padding of size 3, and therefore the output 112.


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.