# Improved YOLOv5-Based Real-Time Road pavement Damage Detection in Road Infrastructure Management
## 3 Methodology
### Improved YOLOv5s
#### 3.2.1 Enhancing Object Detection with Attention Mechanism  
The analysis of human vision yielded the concept of attention mechanisms. Thus, attention mechanisms in deep learning are comparable to the selective attention mechanism of humans. Their primary objective is to select more critical information regarding the current task objective from many pieces while disregarding other unimportant details. Spatial, channel, and mixed mechanisms are the three primary categories of attention mechanisms.  
The ECA-Net is a recently developed attention mechanism characterized by its lightweight and efficient design [35]. It improves the Squeeze and Excitation Network (SENet) framework [36]. The YOLOv5 model was enhanced by integrating an ECA attention mechanism to enrich defect detection accuracy in complex scenes. Figure 4 depicts the ECA attention mechanism. This integration facilitated the model's focus on object regions while training and reducing insignificant information representation. ECA employs the one-dimensional sparse convolution filter to generate channel weights to replace the full connection layer in the SENet. According to the study's findings, implementing the proposed method can enhance the precision of predictions without imposing additional computational demands. Furthermore, the method can be readily integrated into mobile networks, facilitating widespread deployment.  
The ECA-Net model utilizes Global Average Pooling (GAP) to transform the input feature map \(X\), a real-valued matrix with dimensions \(W\times H\times C\), into a singular real value. The resulting features are \(X_{avg}\), a matrix with \(1\times 1\times C\) dimensions. The variables \(W\), \(H\)  
Figure 4: The ECA-Net structure.  
and \(C\) correspond to the feature's width, height, and channel, respectively, as indicated in Equation (10). The feature extraction process from \(X_{avg}\) is achieved through a convolutional operation using a one-dimensional convolution kernel of size \(K\). \(K\) is represented as Equation (11).  
\[\tilde{X}=\frac{1}{WH}\sum_{i=1,j=1}^{W}X_{ij} \tag{10}\]  
\[K=\frac{\log_{2}C+1}{2} \tag{11}\]  
The sigmoid activation function is commonly employed to trigger the output result following convolution to obtain the weight parameter. This parameter reflects the correlation and significance of all the channels. Then, the weight variable \(W\) is applied to the input feature map, resulting in the completion of the capturing of each channel feature of the feature map. This approach amplifies significant characteristics by assigning greater weights, whereas insignificant factors are subdued by assigning lesser weights.  
To complete the objective, four attention modules were examined. Various positions were utilized for their incorporation, including after each C3 module in the backbone, solely after the final C3 module in the backbone, the neck portion of the architecture, and the neck and backbone. Our findings indicate that incorporating an attention module into the backbone of the model results in increased weightiness due to the substantial number of parameters present in each C3 block of the backbone. The feature extraction process that passes through these attention modules also contributes to this increased weightiness. The attention module was added right after the final C3 block and before the SPPF. By placing the attention module before the SPPF, the refined feature representation from the attention module can be efficiently combined with the spatially pooled features. This strategic placement facilitates enhanced network performance by enabling selective focus on the most relevant features [37]. Furthermore, including ECA-Net after every C3 block in the downsampling process can improve the network's performance by augmenting its capacity to capture long-range interdependencies among distinct spatial locations within the feature map [38].