# Hybrid-Supervised-Learning-Based Automatic Image Segmentation for Water Leakage in Subway Tunnels
## 2 Approach
### Semantic Segmentation of Water Leakage in Subway Tunnels  
As can be seen from Figure 6, WRDeepLabV3+ consists of two modules. The encoding area (Encoder) is used for the extraction of high-level semantic information. The decoding area (Decoder) is used for the extraction of low-level semantic information. The WRes2 Net network proposed in 2.3 is used as the backbone network of WRDeeplabv3+ to extract the feature information of water leakage. The channel attention mechanism (\(CA\)) is added to  
Figure 5: (**a**) is the Res2 Net module, (**b**) is the WRes2 Net module, (**c**) is the WRes2 Net shortcut Rate is the dilation rate, and Avgpool is the average pooling layer. the Encoder [35]. \(CA\) assigns larger weights to highly responsive channels after feature extraction using depth-wise-separable convolutional layers of different channels. Suppose the high-level semantic information is \(F_{c}^{h}\in I^{W\times H\times C}\), \(F_{c}^{h}=[F_{1},F_{2},\ldots,F_{C}]\), where \(W\) and \(H\) are the width and height of the input feature image, and \(C\) is the channel number. \(CA\) is represented as:  
\[f_{CA}(g_{c},\Phi_{CA})=e_{1}\{fc_{2}\{r[fc_{1}(g_{c},\Phi_{CA1})],\Phi_{CA2}\}\} \tag{10}\]  
In the formula, \(g_{c}\) is the feature map after \(F_{c}^{\cdot}\) average pooling, \(\Phi_{CA}\) is the parameter in the channel attention module, \(e_{1}\) is the Sigmoid activation, \(fc\) is the fully connected layer, and \(r\) is the ReLU activation. The \(CA\) module outputs \(f_{CA}\) and weights the feature map to obtain the output feature map:  
\[F_{c}^{h^{\prime}}=F_{c}^{h}.f_{CA} \tag{11}\]  
Compared with the encoding area, the decoding area can obtain the location and edge information of the target information and other features. However, there is a lot of background information, which will affect the segmentation accuracy to a certain extent. The spatial attention mechanism (\(SA\)) is introduced in the Decoder. It can focus on the target feature area, adaptively combine high-level features with low-level features, and use high-level features to filter out background information [36]. To obtain global information without increasing parameters, semantic segmentation is improved by global convolutional networks. Two-layer convolution operation is used, and the two-layer convolution kernels are \(1\times 5\) and \(5\times 1\), respectively, which are used to obtain key feature information. \(SA\) is expressed as:  
\[A_{1}=Con_{1}\Big{[}Con_{2}\Big{(}F_{c}^{h},\Phi_{SA1}\Big{)},\Phi_{SA2}\Big{]} \tag{12}\]  
\[A_{2}=Con_{2}\Big{[}Con_{1}\Big{(}F_{c}^{h},\Phi_{SA1}\Big{)},\Phi_{SA2}\Big{]} \tag{13}\]  
\[f_{SA}\Big{(}F_{c}^{h^{\prime\prime}},\[PERSON]_{SA}\Big{)}=e_{2}A_{1}+A_{2} \tag{14}\]  
In the formula, \(A_{1}\) is the feature map completed by convolution of convolution kernels \(1\times 5\) and \(5\times 1\), \(A_{2}\) is the feature map completed by convolution of convolution kernels \(5\times 1\) and \(1\times 5\), \(Con_{1}\) is the convolution kernel of \(5\times 1\times C\), \(Con_{2}\) is the convolution kernel of \(1\times 5\times C\), \(e_{2}\) is the Sigmoid activation, \(F_{c}^{h^{\prime\prime}}\) is obtained by \(SA\) weighting, and \(\Phi_{CA}\) is the parameter in the spatial attention module. Figure 6: WRDeeplabv3+ overall model. Training a complex deep learning model can take a long time, and the optimizer can improve the training efficiency of the model. At the same time, different optimizers can also improve the performance of the model and achieve better training results. In the training process, the learning-rate decay methods StepLR and CosineAnnealingLR (CosLR) are added, and the two optimizers SGD and Adam are also compared. In addition, the training is divided into a freezing phase (Freeze) and an unfreezing phase (Unfreeze). At the same time, the _Focal Loss_ function is used to solve the problem of positive and negative sample imbalance [37]. Its formula is shown in (15). \[Loss=