# Mixer U-Net: An Improved Automatic Road Extraction from UAV Imagery
## 2 Preliminaries
### Building Blocks
#### 2.1.2 Depthwise Separable Convolutions  
The term \"depthwise separable convolutions\" was used for the first time by [PERSON] in his PhD thesis [28]. In traditional convolutional layers, the weights in the network are shared, feature extraction and feature fusion are performed simultaneously, the invariant function is used to sample the pooling layer spatially, and a large number of parameters are generated [29]. Contrarily, depthwise separable convolutions (also known as depthwise convolutions, not to be confused with the spatially separable convolutions in the image processing community) consists of two consecutive independent convolutional layers: _depthwise convolution_ that applies a single filter across each channel (\(n\) different filters for \(n\)-channel input) of input data and _pointwise convolution_-\(1\times 1\) convolution that projects the output of the depthwise convolution into a new channel space [30] (see Figure 1). This factorization operation enables decreasing the model size and computational cost remarkably. The following includes the mathematical expressions of traditional convolution (Equation (1)), depthwise convolution (Equation (2), \(\odot\) denotes the element-wise product), pointwise convolution (Equation (3)), and depthwise separable convolution (Equation (4)) operations:  
Figure 1: Depthwise separable convolutions. \[Conv(W,y)_{(i,j)}=\sum_{k,l,m}^{K,L,M}W_{(k,l,m)}\cdot y_{(i+k,j+l,m)} \tag{1}\]  
\[DepthwiseConv(W,y)_{(i,j)}=\sum_{k,l}^{K,L}W_{(k,l)}\odot y_{(i+k,j+l)} \tag{2}\]  
\[PointwiseConv(W,y)_{(i,j)}=\sum_{m}^{M}W_{(m)}\cdot y_{(i,j,m)} \tag{3}\]  
\[DepthwiseSepConv(W_{p},W_{d},y)_{(i,j)}=PointwiseConv_{(i,j)}(W_{p}, DepthwiseConv_{(i,j)}(W_{d},y)) \tag{4}\]  
where \(W\) stands for the input data, \(y\) denotes convolutional filter with the size of \(K\times L\) in the case of traditional and depthwise convolution, and \(1\times 1\) in the case of pointwise convolution. \(M\) and \((i,j)\) represent channel size and pixels of the input data accordingly. In order to enlighten the impact of depthwise separable convolutions, we compute the computational cost required for a traditional convolution and a depthwise separable convolution and compared them. By convolving a \(P\times P\times M\)-shaped input data through a \(K\times K\times M\) traditional convolution layer, we obtain a \(Q\times Q\times N\)-shaped feature map where \(P\) is a spatial resolution of input data, \(M\) is the number of channels of the input or equivalently, the number of the convolution kernel, \(K\) is the filter size, \(Q\) represents the spatial resolution of the output, and \(N\) is the number of channels of the convolved feature map. Assuming that the stride is 1 and there is no padding operation, the computational cost of the standard convolution is as follows. \[Parameters=K\cdot K\cdot M\cdot N \tag{5}\]  
\[Flops=Q\cdot Q\cdot K\cdot K\cdot M\cdot N\]  
In the case of depthwise separable convolutions, depthwise convolution operation is performed first. The cost of depthwise convolution is given by the following. \[Parameters=K\cdot K\cdot M \tag{6}\]  
\[Flops=Q\cdot Q\cdot K\cdot K\cdot M\]  
Next, the pointwise convolution is performed, which results in the following. \[Parameters=M\cdot N \tag{7}\]  
\[Conv(W,y)_{(i,j)}=\sum_{k,l,m}^{K,L,M}W_{(k,l,m)}\cdot y_{(i+k,j+l,m)} \tag{1}\]0  
In total, depthwise separable convolution operation yields the following. \[Conv(W,y)_{(i,j)}=\sum_{k,l,m}^{K,L,M}W_{(k,l,m)}\cdot y_{(i+k,j+l,m)} \tag{1}\]1  
\[Conv(W,y)_{(i,j)}=\sum_{k,l,m}^{K,L,M}W_{(k,l,m)}\cdot y_{(i+k,j+l,m)} \tag{1}\]2  
By factorizing the standard convolution into two parts, computational cost can be reduced by the following. \[Conv(W,y)_{(i,j)}=\sum_{k,l,m}^{K,L,M}W_{(k,l,m)}\cdot y_{(i+k,j+l,m)} \tag{1}\]3  
Applications of depthwise separable convolutions can be found in the Xception model [30] by [PERSON] and MobileNet family [31; 32; 33] by [PERSON] et al. and [PERSON] et al. In one incarnation of their MobileNets model, [PERSON] et al.