## 3 Methods
### Detection Model for Apparent Defects in Metro Tunnel Liniings
#### 3.1.2 Coordinate Attention Module  
Poor ventilation and inadequate lighting in the enclosed spaces of metro tunnels can lead to noisy images with high background similarity due to increased dust particles and uneven illumination. The information loss during the down-sampling process of obtaining low-resolution feature layers in the network model exacerbates these issues. Additionally, field experiments have shown that apparent defects in metro tunnel linings often occur at circumferential joints and seams between linings, with specific spatial location characteristics. Enhancing the weight calculation for these hotspot areas during convolution computations can improve defect detection rates and accuracy. Therefore, the coordinate attention (CA) module [33] is introduced into the feature extraction part of the YOLOv8 model to obtain more detailed spatial information on target detection and suppress irrelevant information from different channels. The principle of the coordinate attention module involves decomposing channel attention encoding into two one-dimensional feature encodings. These encodings are then subjected to average pooling along the X and Y dimensions, respectively, to mitigate the positional information loss that typically occurs when transforming a feature tensor into a one-dimensional vector via two-dimensional global pooling. By embedding positional information in this way, the channel attention module can simultaneously capture target structures while considering both channel and spatial information. It enhances the model's ability to capture features in hotspot regions and long-range dependencies, allowing the network to quickly and accurately focus on defect-prone key areas while maintaining computational efficiency. The structure of the coordinate attention module is shown in Figure 4. The computation of this model primarily consists of two steps: coordinated relationship embedding and coordinate attention generation. Specifically, in the coordinated relationship embedding step, the input feature map undergoes average pooling along the horizontal and vertical coordinates within the spatial ranges of (\(H\), 1) and (\(1\), \(W\)) for each channel. This feature aggregation method generates a pair of direction-aware feature maps that capture long-range dependencies in one direction  
Figure 3: YOLOv8 framework. while preserving precise positional information in the other. The output of the _c-th_ channel at height h and width w can be expressed as follows:  
\[z_{c}^{h}(h)=\frac{1}{W}\sum_{0\leq i<W}x_{c}(h,i), \tag{1}\]  
\[z_{c}^{w}(w)=\frac{1}{H}\sum_{0\leq j<H}x_{c}(j,w) \tag{2}\]  
where \(z_{c}^{h}(h)\) denotes the pooled output of the _c-th_ channel at the vertical coordinate direction. \(h_{i}\); \(z_{c}^{w}(w)\) denotes the pooled output of the _c-th_ channel at the vertical coordinate direction \(w\); \(W\) is the horizontal dimension; \(H\) is the vertical dimension; and \(x_{c}(i,j)\) is the corresponding positional eigenvalue of the _c-th_ channel. In the coordinate attention generation step, the pooled results are first concatenated to capture bidirectional features, resulting in a pair of direction-aware feature maps. Convolution is then applied for dimensional transformation, followed by a batch normalization (BN) layer to standardize data distribution. Subsequently, the results are passed through a sigmoid function to obtain an intermediate feature map \(f\) that encodes spatial information. This approach enables the establishment of long-range dependencies in one spatial direction while preserving precise positional information in the other. The equations are as follows:  
\[f=\delta\Big{(}F_{1}\Big{(}\Big{[}Z^{h},Z^{w}\Big{]}\Big{)}\Big{)} \tag{3}\]  
where \(\Big{[}Z^{h},Z^{w}\Big{]}\) is the feature layer stacking operation along the spatial dimension; \(FI\) is \(1\times 1\) convolutional transform function; \(\delta\) is the sigmoid activation function; and \(f\) is the intermediate feature map that encodes spatial information in horizontal and vertical directions.