The difference between Depthwise convolution, Pointwise convolution and ordinary convolution

1 Ordinary convolution

Principle: Ordinary convolution is that a convolution kernel is convolved with all channels of the input, and then the results of convolution at the same position of different channels are added together, as shown in the figure below: First, the corresponding position in each channel The elements are multiplied and added, and finally the sum of all channels is calculated as the final result. The number of channels of the convolution kernel is equal to the number of input channels, and the number of output channels is equal to the number of convolution kernels.

2 Depthwise convolution

Principle: A convolution kernel of Depthwise convolution is only responsible for one channel, and a convolution kernel is only convolved with one channel. Then the number of convolution kernels needs to be equal to the number of input channels, and the number of output channels remains unchanged, which is equal to the number of input channels and equal to the number of convolution kernels. So the depthwise convolution only changes the size of the feature map and does not change the number of channels. However, this operation independently performs convolution operations on each channel of the input layer , and does not effectively use the feature information of different channels at the same spatial position.

Depthwise convolution only changes the size of the feature map and does not change the number of channels.

3 Pointwise convolution

 The operation of Pointwise Convolution is similar to the conventional convolution operation. The size of its convolution kernel is 1×1×M, and M is the number of channels in the previous layer. Therefore, the convolution operation here will weight and combine the maps in the previous step in the depth direction to generate a new Feature map. There are several convolution kernels and several output Feature maps.

Pointwise convolution does not change the size of the feature map, but only changes the number of channels.

 4 Depthwise separable convolution (depthwise separable convolution) 

Depthwise separable convolution depthwise separable convolution is composed of depthwise (DW) and pointwise (PW). Compared with conventional convolution operations, the number of parameters and computational cost are relatively low . Commonly used in lightweight models, such as MobileNet

Guess you like

Origin blog.csdn.net/Bolly_He/article/details/124107316