# A Road Crack Detection Method Based on Residual and Attention Mechanism
## 3 Experimental Results and Analysis
### Experimental Setup  
2 Experimental platform: All network models in this article were implemented based on a deep learning architecture called PyTorch. In our proposed network structure, the SGD optimization method was used to update parameters, with a learning rate initialized to 0.01 and momentum optimization algorithm set to 0.9. All experiments in this paper were carried out using GeForce RTX 3060 GPU, which is from NVIDIA, Santa Clara, CA, USA. 3 Datasets: This study used three publicly available crack datasets, namely CrackTree260, CrackLS315, and DeepCrack [21]. The CrackTree260 dataset is a dataset  
Figure 5: Structure of the spatial attention mechanism module. Figure 6: The network structure of our model. of asphalt pavement images, which includes 260 pavement images with a size of 800 \(\times\) 600 pixels. The CrackLS315 dataset includes 315 crack images with a size of 512 \(\times\) 512 pixels. The DeepCrack dataset is a dataset of concrete pavement images, which includes 537 pavement images with dimensions of 544 \(\times\) 384 pixels. The labeled images in these datasets were manually labeled. To address the issue of an insufficient number of images in the dataset, we employed four data augmentation methods: vertical reflection, mirror reflection, translation, and random rotation. Through the above operations, the number of training datasets can be expanded by 8 times. To validate the established neural network models, we selected 75% of each dataset as training data and 25% as test data. Factors such as lighting and exposure can lead to unclear crack boundaries in road surface images, which increases the difficulty of road surface crack detection. To address this issue, this article adopted the CLAHE (contrast limited adaptive histogram equalization) method to enhance the crack areas in road crack images by adjusting the contrast of local regions. Compared with ordinary histogram equalization algorithms, CLAHE divides the entire image into blocks, and then counts the frequency of each pixel value appearing in each block to obtain the histogram of each block. Contrast limiting is applied to each block, also known as cropping limiting. Usually, we evenly distribute the trimmed parts to other parts of the histogram. An image processed by the CLAHE algorithm can greatly enhance the difference between crack information and road background, which greatly improves the quality of the sample image. The images before and after CLAHE enhancement processing are shown in Figure 7.  
4. Evaluation indicators: In this article, classic evaluation indicators in the field of semantic segmentation, such as precision (P), recall (R), and F1 score, were selected for evaluation. Formula (5) is a calculation method for accuracy, which can express the ratio of detection results to ground-truth. Formula (6) is the calculation method for recall rate, which represents the percentage of correctly detected crack pixels to detected crack pixels. Formula (7) is the calculation method for F1 value, which can measure both accuracy and recall. The higher the F1 value, the better the detection effect. Among them, \(TP\) represents the number of pixels correctly classified as cracks, \(FP\) represents the number of pixels incorrectly classified as cracks, and \(FN\) represents the number of pixels incorrectly classified as background, i.e., false negatives  
\[P =\frac{TP}{TP+FP} \tag{5}\] \[R =\frac{TP}{TP+FN}\] (6) \[\text{F1} =\frac{2\times P\times R}{P+R} \tag{7}\]  
Figure 7: Contrast images before and after CLAHE enhancement. (**a**) Original image. (**b**) Enhanced image corresponding to (**a**). (**c**) Original image. (**d**) Enhanced image corresponding to (**c**). Comparison method: This article compared the advanced crack segmentation methods; all comparison methods were based on deep learning as follows:  
* U-Net. Its network structure mainly consists of three parts: encoder, decoder, and skip connection, and is widely used in the field of image segmentation;
* [PERSON] et al.