<p>In short, there is a common formula for output dims calculation:</p>

<p><a href="https://i.stack.imgur.com/vD1u3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vD1u3.png" alt="formula"></a></p>

<p>You can find explanation in <a href="https://medium.com/mlreview/a-guide-to-receptive-field-arithmetic-for-convolutional-neural-networks-e0f514068807" rel="noreferrer">A guide to receptive field arithmetic for Convolutional Neural Networks</a>.</p>

<p>In addition, I'd like to recommend amazing article <a href="https://arxiv.org/abs/1603.07285" rel="noreferrer">A guide to convolution arithmetic for deep learning</a>.</p>

<p>And this repo <a href="https://github.com/vdumoulin/conv_arithmetic" rel="noreferrer">conv_arithmetic</a> with convolution animations.</p>
How to calculate output sizes after a convolution layer in a configuration file?
<p>I'm new to convolutional neural networks and wanted to know how to calculate or figure out the output sizes between layers of a model given a configuration file for pytorch similar to those following instructions in <a href="https://blog.paperspace.com/how-to-implement-a-yolo-v3-object-detector-from-scratch-in-pytorch-part-2/" rel="nofollow noreferrer">this link</a>. </p>

<p>Most of the stuff I've already looked at hasn't been very clear and concise. How am I supposed to calculate the sizes through each layer?
Below is a snippet of a configuration file that would be parsed.</p>

<pre class="lang-sh prettyprint-override"><code># (3, 640, 640)
[convolutional]
batch_normalize=1
filters=16
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

# (16, 320, 320)
</code></pre>