# Inception neural network input layer confusion

According to the original paper on page 4, 224x224x3 image is reduced to 112x112x64 using a filter 7x7 and stride 2 after convolution.

nxn = 224x224

fxf = 7x7

stride = s = 2

padding = p = 0

Output of convolution is (((n+2p-f)/s)+1) according to which

(n+2p-f)=(224+0-7)=217, divide by stride = 217/2=108.5 (taking the lower value), adding 118+1=119.

How do we get a output image of 112 now?

The padding is not size zero* in the inception CNN layers. In fact it is deliberately chosen to pad so that the convolution by itself would produce an image the same size as the original. I.e. $$p=(f−1)/2$$, in some libraries this is called "same" padding.

So, $$p=3$$

The stride is not 2. It is $$s=1$$ for the convolution. The Inception CNN does not use strided convolutions. Instead the stride of 2 is associated with a later max-pooling layer.

Therefore, using $$(((n+2p-f)/s)+1)$$ with the correct values $$(((224 + 6 - 7)/1)+1 = 224$$

Then apply max-pooling, with stride 2. $$224/2 = 112$$.

* Not to be confused with "zero padding" which means pad using $$0$$ as the value to insert into the new area. So you can have "zero padding with $$p=3$$"

• thank you for your opinion. Even with p=1 which is obviously isn't the case. Still doesn't explain 112x112 – Santhosh Dhaipule Chandrakanth Oct 9 '18 at 16:11
• @SanthoshDhaipuleChandrakanth: 112 is just half 224 . . . easy to explain after using "same" padding. Stride is 1 for convolution, the stride of 2 is a max pooling layer, it is not a strided convolution done in one step. I have updated the answer. – Neil Slater Oct 9 '18 at 16:17
• @santhosh: what Neil presents here is not an opinion. It is a fact-based answer to your question. The important difference to an opinion is that fact-based answers can be correct or wrong. In contrast to opinions. Opinions are inherently vague and subject to discussion and cannot be right or wrong. – Martin Thoma Nov 8 '18 at 18:02