Convolutional neural network (source code)

= Convolutional neural network

A convolutional neural network uses local connections and <weight sharing> across input positions. Each learned filter detects the same local feature at multiple positions; successive <activation functions> and layers combine those features. Shared filters impose <translation equivariance> away from boundary and sampling effects, while a <pooling layer> can reduce spatial size.

For a standard dense-channel two-dimensional convolution with a $k_h$ by $k_w$ kernel, $C_{\mathrm{in}}$ input channels and $C_{\mathrm{out}}$ output channels, the parameter count including one bias per output channel is
$$
k_hk_wC_{\mathrm{in}}C_{\mathrm{out}}+C_{\mathrm{out}}.
$$
It is independent of the image's spatial dimensions. For example, a three-by-three convolution from three channels to sixteen channels has $3\cdot3\cdot3\cdot16+16=448$ parameters. Grouped or depthwise convolutions use different connectivity and therefore different counts.