Calculate the Output size in Convolution layer [closed] Calculate the Output size in Convolution layer [closed] python python

Calculate the Output size in Convolution layer [closed]


you can use this formula [(W−K+2P)/S]+1.

  • W is the input volume - in your case 128
  • K is the Kernel size - in your case 5
  • P is the padding - in your case 0 i believe
  • S is the stride - which you have not provided.

So, we input into the formula:

Output_Shape = (128-5+0)/1+1Output_Shape = (124,124,40)

NOTE: Stride defaults to 1 if not provided and the 40 in (124, 124, 40) is the number of filters provided by the user.


You can find it in two ways:simple method: input_size - (filter_size - 1)

W - (K-1)Here W = Input size            K = Filter size            S = Stride            P = Padding

But the second method is the standard to find the output size.

Second method: (((W - K + 2P)/S) + 1)        Here W = Input size        K = Filter size        S = Stride        P = Padding 


Formula : n[i]=(n[i-1]−f[i]+2p[i])/s[i]+1

where,

n[i-1]=128f[i]=5p[i]=0s[i]=1

so,

n[i]=(128-5+0)/1+1 =124

so the size of the output layer is: 124x124x40Where '40' is the number of filters