# CL-YOLOv8: Crack Detection Algorithm for Fair-Faced Walls Based on Deep Learning
## 3 Proposed Methods
### Introducing the LSKA Mechanism Module  
The attention mechanism is typically used to enhance the focus of a model on specific parts or features of input data. In the context of object detection tasks, utilizing attention mechanisms can help the model to concentrate on the relevant features of the detected objects, thereby enhancing its detection accuracy. Visual Attention Networks (VANs) with Large Kernel Attention (LKA) modules have been proven to offer an excellent performance across a range of visual tasks. Large kernels refer to convolutional kernels with larger receptive fields, capable of capturing more extensive contextual information, albeit at a higher computational cost. However, in scenarios involving large kernels, allocating weights to features at each position may lead to efficiency issues. For instance, in the LKA module, the depth convolutional layer's computational and memory usage increase geometrically with the kernel size. The Large Separable Kernel Attention (LSKA) module deals with this issue by decomposing traditional 2D convolutional kernels into two 1D kernels. Firstly, it decomposes a large 2D kernel into horizontal and vertical 1D kernels, significantly reducing the parameter count and computational complexity. During the convolution operation, LSKA first performs horizontal convolution on the input using one 1D kernel, followed by vertical convolution using another 1D kernel. These consecutive convolution operations achieve similar effects to the original large 2D kernel [23]. By innovatively decomposing kernels and employing consecutive convolution, LSKA maintains the advantages of utilizing large kernels while reducing computational and memory costs. A comparison between LKA and LSKA modules is illustrated in Figure 2.  
A large kernel convolution can be divided into the three following components: a spatial depth-wise convolution, a depth-wise dilation convolution, and a channel convolution (\(1\times 1\) convolution) [24]. Following the methodology outlined in reference [23], the output of LSKA can be obtained as follows. \[\overline{Z}^{C}=\sum_{H,W}W^{C}_{(2d-1)\times 1}*\left(\sum_{H,W}W^{C}_{1 \times(2d-1)}*F^{C}\right) \tag{1}\]  
\[Z^{C}=\sum_{H,W}W^{C}_{\lfloor\frac{1}{2}\rfloor\times 1}*\left(\sum_{H,W}W^{C }_{1\times\lfloor\frac{1}{2}\rfloor}*\overline{Z}^{C}\right) \tag{2}\]  
\[A^{C}=W_{1\times 1}*\overline{Z}^{C} \tag{3}\]  
\[\overline{F}^{C}=A^{C}\otimes F^{C} \tag{4}\]  
where \(d\) is the dilation rate. \(\overline{Z}^{C}\) in Equation (1) denotes the output of depth-wise convolution with a kernel size \((2d-1)\times 1\), which captures the local spatial information and compensates for the gridding effect [24] of the following depth-wise dilated convolution in Equation (2) with a kernel size \(\left(\left\lfloor\frac{k}{d}\right\rfloor\times 1\right)\). Note that \(\left\lfloor\cdot\right\rfloor\) represents the floor operation. The dilated depth-wise convolution is responsible for capturing the global spatial information of the output \(\overline{Z}^{C}\) of the depth-wise convolution. The LSKA model is shown in Figure 3.  
YOLOv8 introduces the Spatial Pyramid Pooling-Fast (SPPF) module, an optimized and improved version of the traditional Spatial Pyramid Pooling (SPP) module [25]. SPPF significantly reduces the computational complexity by adopting efficient pooling strategies, including reducing the number of pooling layers and merging multiple pooling operations [26]. As LSKA effectively integrates multi-scale features, it ensures the proper reflection of the critical information at each scale and position. By utilizing separable kernels, it highlights the crucial features at different scales and positions with a higher precision. Therefore, integrating the LSKA module into YOLOv8's SPPF structure further enhances its spatial awareness and feature extraction capabilities.