Answers.Body: <p>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. <span class="math-container">$p=(f−1)/2$</span>, in some libraries this is called "same" padding.</p>
  
  <p>So, <span class="math-container">$p=3$</span></p>
  
  <p>The stride is not 2. It is <span class="math-container">$s=1$</span> for the convolution. The Inception CNN does not use strided convolutions. Instead the stride of 2 is associated with a later max-pooling layer.</p>
  
  <p>Therefore, using <span class="math-container">$(((n+2p-f)/s)+1)$</span> with the correct values <span class="math-container">$(((224 + 6 - 7)/1)+1 = 224$</span></p>
  
  <p>Then apply max-pooling, with stride 2. <span class="math-container">$224/2 = 112$</span>.</p>
  
  <hr>
  
  <p>* Not to be confused with "zero padding" which means pad using <span class="math-container">$0$</span> as the value to insert into the new area. So you can have "zero padding with <span class="math-container">$p=3$</span>"</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-09T16:11:37.503Z
Answers.Text: thank you for your opinion. Even with `p`=`1` which is obviously isn't the case.  Still doesn't explain `112x112`
Answers.UserDisplayName: Santhosh Dhaipule Chandrakanth
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-09T16:17:08.483Z
Answers.Text: @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.
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-08T18:02:36.347Z
Answers.Text: @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.
Answers.UserDisplayName: Martin Thoma
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-09T16:03:01.783Z
Answers.LastActivityDate: 2018-10-09T16:20:22.783Z
Answers.LastEditDate: 2018-10-09T16:20:22.783Z
Answers.UserDisplayName: Neil Slater
Body: <p>According to the <a href="https://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Szegedy_Going_Deeper_With_2015_CVPR_paper.pdf" rel="nofollow noreferrer">original paper</a> on page 4, <span class="math-container">$224 \times 224 \times 3$</span> image is reduced to <span class="math-container">$112 \times 112 \times 64$</span> using a filter <span class="math-container">$7 \times 7$</span> and stride <span class="math-container">$2$</span> after convolution.</p>
  <ul>
  <li><span class="math-container">$n \times n = 224 \times 224$</span></li>
  <li><span class="math-container">$f \times f = 7 \times 7$</span></li>
  <li>stride: <span class="math-container">$s = 2$</span></li>
  <li>padding: <span class="math-container">$p = 0$</span></li>
  </ul>
  <p>The output of the convolution is <span class="math-container">$(((n+2p-f)/s)+1)$</span> (according to <a href="http://cs231n.github.io/convolutional-networks/" rel="nofollow noreferrer">this</a>), so we have <span class="math-container">$(n+2p-f)=(224+0-7)=217$</span>, then we divide by the stride, i.e. <span class="math-container">$217/2=108.5$</span> (taking the lower value), then we add 1, i.e. <span class="math-container">$118+1=119$</span>.</p>
  <p>How do we get an output image of <span class="math-container">$112$</span> now?</p>
  
Tags: <neural-networks><convolutional-neural-networks><pooling><convolution-arithmetic><inception>
Title: In the inception neural network, how is an image of shape $224 \times 224 \times 3$ converted into one of shape $112 \times 112 \times 64$?
UserDisplayName: Santhosh Dhaipule Chandrakanth
ThreadText: # In the inception neural network, how is an image of shape $224 \times 224 \times 3$ converted into one of shape $112 \times 112 \times 64$?
  
  (Asked by: username_0 on 2018-10-09)
  
  According to the [original paper](https://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Szegedy_Going_Deeper_With_2015_CVPR_paper.pdf) on page 4, $224 \times 224 \times 3$ image is reduced to $112 \times 112 \times 64$ using a filter $7 \times 7$ and stride $2$ after convolution.
  
  * $n \times n = 224 \times 224$
  * $f \times f = 7 \times 7$
  * stride: $s = 2$
  * padding: $p = 0$
  
  The output of the convolution is $(((n+2p-f)/s)+1)$ (according to [this](http://cs231n.github.io/convolutional-networks/)), so we have $(n+2p-f)=(224+0-7)=217$, then we divide by the stride, i.e. $217/2=108.5$ (taking the lower value), then we add 1, i.e. $118+1=119$.
  
  How do we get an output image of $112$ now?
  
  **Tags:** neural-networks, convolutional-neural-networks, pooling, convolution-arithmetic, inception
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-10-09. Score: 1
  
  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$"
  
  > **Comments:**
  > **username_0**: thank you for your opinion. Even with `p`=`1` which is obviously isn't the case.  Still doesn't explain `112x112`  
  > **username_1**: @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.  
  > **username_2**: @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.  
  
  ---
  
  