# Adaptive Attention-Enhanced Yolo for Wall Crack Detection
## 3 Materials and Methods  
### Yolo Algorithm  
Here, we introduce the basic framework of Yolo using Yolov5 as an example. YOLOv5 is an end-to-end DL model that integrates an input layer, backbone network, neck module, and prediction layer [33]. By using advanced techniques such as grid division, it can achieve high-precision object detection on images with different resolutions.  
In the input processing stage of the YOLOv5 network, the Mosaic data enhancement method [34] is used, which randomly scales, clips, and splices the images. In this stage, the adaptive anchor frame mechanism is also used to calculate the appropriate anchor frame size through the preset data set annotation information, and adjust and optimize the model training. Adaptive image scaling reduces the need for image filling, which enables the training process to extract more features, significantly reducing the computational burden of forward reasoning.  
In the backbone stage of YOLOv5 network, image feature extraction is carried out by several modules. First, the input image is sliced and convolved by the Focus module to obtain initial feature maps. The feature map then flows through multiple Cross-Stage Partials (CSPs) and Convolutional Block Layers (CBLs), which work together to further extract image features. The CSP structure uses residual connection to integrate the output of multiple CBLs, and finally realizes multi-scale feature fusion through the space pyramid pool module.  
In the neck module of YOLOv5, image features are further extracted through the fusion of deep and shallow information. This stage uses the Feature Pyramid Network (FPN) feature pyramid structure to generate a multi-scale feature pyramid by fusing different levels of feature maps together through up-sampling and down-sampling operations. The upper layer mainly captures semantic information, while the lower layer retains detailed location information. The neck module combines semantic information from the FPN from the top to the bottom with positional information from the path aggregation network [35] from the bottom to the top, thereby optimizing the fusion of multiple layers of features.  
In the prediction stage of YOLOv5, the main task is to target and classify the feature maps from the previous stage. In this step, the image is divided into several grids, and for each grid, multiple candidate boxes are created. The final target detection results can be obtained by filtering out less dense frames using non-maximum suppression [36] technology. In the training process, the detection results generated by the model will be compared with the actual marked location box and classification label, and the error will be calculated and the model parameters will be updated through backpropagation. Through this method, the model learns on a large number of labeled images and continuously optimizes the parameters, which ultimately enables the model to perform effective target detection on unlabeled natural images.  
Figure 1 shows the improved model network structure and highlights the design of the three new modules. These modules include the Swin Transformer-based CSP Bottleneck with three convolutions (STC3), the Adaptive Receptive Field (ARF), and the Head Attention (HA) module. The diagram clearly shows how these components are integrated into the overall network.