# Research on Improved YOLO11 for Detecting Small Targets in Sonar Images Based on Data Enhancement
## 3 Methodology
### Improved Network
#### 3.2.1 FASFFHead  
Sonar imaging often suffers from blurry edges and lost details due to environmental disturbances and the physical damage of sound waves. Therefore, it is essential to strengthen multi-scale feature integration and utilization to better extract target features and suppress noise in complex backgrounds. ASHF (Adaptively Spatial Feature Fusion) is designed to improve multi-scale feature fusion in feature pyramids, such as FPNs (Feature  
Figure 4: SFE-YOLO structure. Pyramid Networks) [24]. Unlike traditional FPN methods that use simple concatenation or addition for fusion, leading to feature conflicts and gradient interference at the same spatial location, AFF introduces a dynamic weight mechanism. This mechanism adaptively learns weights to fuse features from different levels and dynamically adjusts weights based on input content, suppressing conflicting information and enhancing effective features. ASFF mainly consists of two parts: re-scaling and adaptive fusion. During re-scaling, low-level features are first adjusted for channel numbers through \(1\times 1\) convolution and then enlarged via interpolation. The high-level features are downsampled through \(3\times 3\) convolution and pooling to align with the target layer's resolution. After alignment, features are passed through \(1\times 1\) convolution to generate spatial weight maps. These weight maps are shown in Equation (1). \[\alpha_{i}^{l}(x,y)=\frac{e^{\pi l_{i}^{l}(x,y)}}{\sum\limits_{k=1}^{L}e^{\pi l _{i}^{l}(x,y)}} \tag{1}\]  
Let \(l\) be the target level and \((x,y)\) the spatial coordinates. The final output feature is the weighted sum of features from all levels, as shown in Equation (2). \[F_{out}^{l}=\sum\limits_{i=1}^{L}\alpha_{i}^{l}\cdot F_{i}^{l} \tag{2}\]  
However, existing AFF methods still suffer from edge blurring, feature suppression, and scale oscillation in sonar target detection. To address these issues, this study proposes a Four-head Adaptive Feature Fusion Detection Head (FASFFHead). By reconstructing the feature pyramid architecture and adding a high-resolution shallow feature output layer, we construct a four-level cascaded detection network to enhance the ability to capture details of small targets. We innovatively design a hierarchical weight decoupling mechanism, introducing independently learnable adaptive parameters to optimize cross-layer feature contribution ratios, combined with a progressive training strategy to balance the collaborative expression of shallow details and deep semantics. To resolve information loss during feature alignment, we integrate a dual-path calibration module that employs dilated convolution and channel attention to reinforce edge fidelity and critical feature filtering, respectively. This achieves multi-scale gradient propagation optimization, significantly improving small target detection accuracy and scale stability, as shown in Equation (3). \[\vec{F}_{out}^{l}=\beta\cdot F_{P2}^{l}+\sum\limits_{i=3}^{5}\alpha_{i}^{l} \cdot F_{i}^{l} \tag{3}\]  
\(\beta\) is optimized via backpropagation, with a moderate initial value to prevent initial training oscillations. The weight generation branch is extended to four heads to compute the weight coefficients shown in Equation (4). \[\alpha_{i}^{l}\cdot\beta=\text{Softmax}(\text{Conv}_{1\times 1}(\text{ Concat}(w_{P2},w_{P3},w_{P4},w_{P5}))) \tag{4}\]  
The final output is expressed as shown in Equation (5). \[F_{final}^{l}=\beta\cdot F_{P2}^{l}+\alpha_{3}^{l}\cdot F_{P3}^{l}+\alpha_{4}^ {l}\cdot F_{P4}^{l}+\alpha_{5}^{l}\cdot F_{P5}^{l} \tag{5}\]  
In summary, FASFFHead mainly introduces additional coefficients. Adding an output and integrating a dual-path calibration module enhances sensitivity to tiny targets during significant target scale changes.