# YOLO-SAR: An Enhanced Multi-Scale Ship Detection Method in Low-Light Environments
## 3 Methods
### Aseff Module  
In the YOLO11 network, conventional multi-scale feature fusion can result in conflicts across feature levels. When a target is labeled positive in one layer, the same region may be treated as the background in other layers. These negative factors may lead to significant semantic gaps between scales. In the context of ship detection under low-illumination conditions, poor lighting and occlusion frequently blur contours, exacerbate scale differences, and obscure critical features. To address these challenges, we incorporate an Adaptively Spatial Feature Fusion (ASFF) strategy within the detection head. Aseff adjusts spatially adaptive weights to mitigate inter-level semantic conflicts and filters out noise that destabilizes backpropagation, thereby resolving scale inconsistencies. Subsequently, it reshapes features from all scales to a common size, allowing each level to leverage its strengths effectively. The architecture of the Aseff module is illustrated in Figure 5.  
Figure 5: Aseff module architecture.  
The ASFF module contains Level 1, Level 2, and Level 3 representations. They are adopted here to represent three distinct fusion strategies at different layers and scales. Level 1 emphasizes the finest scale and utilizes high-resolution feature mapping processes to capture the intricate details of small objects. Level 2 operates at medium resolution to identify medium-sized targets while maintaining a low computational cost. Level 3 concentrates more on the coarsest scale, employing the lowest-resolution feature mapping processes to delineate entire large objects. Within the ASFF framework, fusion weights adaptively adjust to reflect each level's contribution and comprehend the spatial relationships among multi-scale features indeed. ASFF incorporates a spatial filtering mechanism that eliminates mismatched responses, thereby enhancing the effectiveness of feature fusion. The final fusion multiplies each feature map by three learnable weights, \(\alpha\), \(\beta\), and \(\gamma\), reflecting its importance at each scale. The computation is provided in Equation (4).  
\[\mathrm{y}_{ij}^{l}=\alpha_{ij}^{l}\cdot\mathrm{x}_{ij}^{l\to l}+\beta_{ij}^{l} \cdot\mathrm{x}_{ij}^{2\to l}+\gamma_{ij}^{l}\cdot\mathrm{x}_{ij}^{3 \to l} \tag{4}\]  
\(\mathrm{y}_{ij}^{l}\) denotes the new feature map produced by the ASFF module. \(\mathrm{x}_{ij}^{1\to l}\) represents the feature vector at position (\(i\), \(j\)) that is mapped from level 1 to level \(l\). \(\alpha_{ij}^{l}\), \(\beta_{ij}^{l}\), \(\gamma_{ij}^{l}\in[0,1]\) are the spatial weights. \(\alpha,\beta,\gamma\) are assigned to position (\(i\), \(j\)) on level \(l\). These representations are shown in Equation (5).  
\[\alpha_{ij}^{l}=\frac{e^{\lambda_{ij}^{l}}}{e^{\lambda_{\alpha_{ij}}^{L}}+e^{ \lambda_{\beta_{ij}}^{l}}+e^{\lambda_{\gamma_{ij}}^{l}}}. \tag{5}\]  
The adaptive spatial feature fusion head mentioned above effectively resolves the feature loss that often arises during cross-scale fusion, and this mechanism not only enriches the core representations on various network features but also markedly boosts the model's robustness across diverse detection scenarios.