Padding in Alexnet

Image size 2272273, upon which conv layer is applied with 96 filters with kernel size 1111 which results into (222-11)/4+1= 555596 size, after which max pooling layer of 33 kernel size is applied which results into (55-3)/2+1=272796. After which conv layer of kernel size 55 is applied which results into (27-5)/1+1 which should be 2323256 for 256 filters. however in the document it’s showing the size is 2727*256. If padding is applied with size 4, then is not the quaility itlsef is degraded, as either we can pad 0 or any const value in their place?

Hey @tisandas2011

The Size (27, 27) is correct when padding of 2 is used:
(27-5+4)/1 + 1 = 27
Coming to the second question, padding is always done with 0 (so that weights when multiplied by 0 becomes 0 and the padding elements do not interfere with the output) elements and it doesn’t degrade the quality. Rather, it helps in detecting the features present in the corners of the images which otherwise would have been ignored (generally for large filters).

Hope this helps!

Thanks for the explanation!

1 Like