# LHB-YOLOv8: An Optimized YOLOv8 Network for Complex Background Drop Stone Detection
## 2 Methodology
### Dynamic Large Convolutional Kernel Spatial Attention Mechanisms  
Attention mechanisms were first used in natural language processing but are now widely used in areas such as computer vision. The core idea is that the model should pay more attention to information that is critical to the task while ignoring unimportant parts when processing the data. Through this selective allocation of attention, the model is able to extract features more efficiently. In visual tasks, the attention mechanism can help the model to better focus on the target region and reduce background interference. For example, the common SE (Squeeze and Excitation) module [20] enables the enhancement of useful feature channels by adaptively adjusting the weights of the channels. The CBAM  
Figure 1: Detailed LBH-YOLOv8 framework. (Convolutional Block Attention Module) [21] combines spatial and channel attention to further enhance feature expression, as well as the Global Attention Mechanism (GAM) [22] and Efficient Channel Attention (ECA) [23], among others. However, the large kernel attention mechanism enhances the model's ability to perceive global features by using a large convolutional kernel to capture a larger range of contextual information. Compared to the traditional small convolutional kernel, it can focus on key information in a larger region while maintaining computational efficiency. This mechanism performs well when dealing with complex scenes or large targets, especially in tasks such as image segmentation and target detection, which improves the model's ability to balance the processing of global and local information and enhances the model's accuracy and generalization. Therefore, the LSKAttention mechanism is chosen to be placed in the backbone part in this paper. The working principle of LSKAttention is shown in Figure 2. LSKAttention expands the receptive field by using a series of deep convolutional kernels of different sizes instead of simply using a fixed-size convolutional kernel. To avoid an increase in computational complexity, the large convolutional kernel is decomposed into multiple layers of smaller convolutional kernels, each with a different dilation rate. This design allows the receptive field to expand rapidly, capturing contextual information at different scales. The convolution size of layer \(i\) is \(k_{i}\), and the expansion rate is \(d_{i}\). The receptive field of each layer (\(RF_{i}\)) is based on the receptive field of the previous layer (\(RF_{i-1}\)) and is a function of the size of the convolutional kernel and expansion rate of the current layer:  
\[RF_{1}=k_{1} \tag{1}\]  
\[RF_{i}=d_{i}(k_{i}-1)+RF_{i-1} \tag{2}\]  
By increasing the size of the convolutional kernel (\(k\)) and the expansion rate (\(d\)) layer by layer, the sensory field can be rapidly expanded to ensure that contextual information can be captured over long distances. After features are extracted at multiple scales, the spatial selection mechanism selects contextual information that is suitable for different regions. Specific steps include the following:  
First, the features extracted through different convolution kernels are stitched into a feature matrix (\(\tilde{U}\)):  
\[\tilde{U}=[\tilde{U}_{1};\tilde{U}_{2};\dots;\tilde{U}_{N}] \tag{3}\]  
Average pooling and maximum pooling are performed on this spliced feature matrix to obtain a global spatial feature descriptor:  
Figure 2: LSK module.