Sar ship detection method and system with hierarchical attention fusion and edge enhancement
By employing a SAR ship detection method based on hierarchical attention fusion and edge enhancement, the problems of low accuracy and high false alarm rate in SAR image detection are solved, achieving efficient detection under data-scarce conditions and improving the stability and generalization ability of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 先进计算与关键软件(信创)海河实验室
- Filing Date
- 2026-04-03
- Publication Date
- 2026-06-16
AI Technical Summary
Existing SAR ship detection methods suffer from low detection accuracy, high false alarm rate, and overfitting when faced with speckle noise, complex backgrounds, and multi-scale variations, especially when data is scarce.
A hierarchical attention fusion and edge enhancement approach is adopted. By using a multi-scale edge information selection module, a cross-domain feature gating module, and a hierarchical attention fusion block module, the ship target features are enhanced, background noise is suppressed, and multi-scale information interaction and ship detection are achieved.
It improves training stability and generalization ability in low-sample detection scenarios, effectively alleviates overfitting problems, and enhances detection accuracy and robustness.
Smart Images

Figure CN121962936B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ship identification and detection technology, and in particular to a SAR ship detection method and system with hierarchical attention fusion and edge enhancement. Background Technology
[0002] The inherent imaging mechanism of synthetic aperture radar (SAR) presents unique challenges for accurate ship detection. For example... Figure 1 As shown, the blue box represents manually labeled ship target areas, the green ellipse marks coherence speckle noise, and the red ellipse indicates areas easily misidentified as ships. Figure 1 In (a), SAR images are generally affected by speckle noise, which significantly reduces image quality and blurs target outlines, making it extremely difficult to distinguish ships from waves and background clutter. Figure 1 (b) and Figure 1 In (c), the nearshore scene has an extremely complex background; structures such as ports, islands, and breakwaters may exhibit strong scattering characteristics similar to ships, leading to a high false alarm rate. Figure 1 In (d), ship targets exhibit significant multi-scale variations, ranging from large cargo ships hundreds of meters long to small fishing boats only a few pixels in size. Small targets are particularly prone to losing feature information during downsampling in deep convolutional networks, leading to missed detections. Furthermore, the actual acquisition and high-quality annotation of large-scale SAR datasets are often costly and labor-intensive, while deep learning models typically rely on large labeled datasets to achieve high performance. This dependency makes developing models capable of good generalization from limited data crucial.
[0003] To address these challenges, researchers have explored various solutions, ranging from traditional algorithms to deep learning methods. Early algorithms, such as the Constant False Alarm Rate (CFAR) detector, relied on statistical modeling of background clutter to set adaptive detection thresholds. However, these methods have limited generalization ability when faced with complex and variable nearshore backgrounds, and their hand-designed features struggle to capture high-level semantic information of ship targets. In recent years, deep learning methods based on Convolutional Neural Networks (CNNs) have become mainstream due to their powerful automatic feature extraction capabilities. Despite significant progress, existing methods still have limitations. On the one hand, most architectures based on Feature Pyramid Networks (FPNs) employ simple feature fusion operations such as addition or concatenation, which can lead to spatial misalignment and semantic gaps between different feature levels, failing to achieve optimal multi-scale information interaction. On the other hand, although attention mechanisms are used to enhance target features and suppress noise, they often overemphasize local details or fail to fundamentally address the problems of blurred target edges and complex background noise structures in SAR images. Summary of the Invention
[0004] This invention aims to address at least one of the technical problems existing in related technologies. To this end, this invention provides a SAR ship detection method and system based on hierarchical attention fusion and edge enhancement, achieving superior training stability and generalization ability even in scenarios with few samples, effectively alleviating the overfitting problem that often occurs in baseline models when data is scarce.
[0005] This invention provides a SAR ship detection method with hierarchical attention fusion and edge enhancement, comprising:
[0006] S1: Obtain the initial ship data map and preprocess it to obtain the input feature map;
[0007] S2: Construct an enhanced image recognition model. Train the enhanced image recognition model based on the input feature map to obtain a trained image recognition model. The enhanced image recognition model includes a multi-scale edge information selection module, a cross-domain feature gating module, and a hierarchical attention fusion block module. The multi-scale edge information selection module is used to distinguish between the target and the edge caused by noise. The cross-domain feature gating module is used to enhance the response of strong scattering points such as the ship hull while suppressing background interference. The hierarchical attention fusion block module is used to focus on the fine-grained local details of the ship and its global position context in the scene.
[0008] S3: Input the actual SAR image into the trained image recognition model to obtain the ship detection result.
[0009] According to the SAR ship detection method with hierarchical attention fusion and edge enhancement provided by the present invention, the steps of the multi-scale edge information selection module include:
[0010] S11: Convolve the input feature map to obtain the MSEIS convolution result;
[0011] S12: Input the MSEIS convolution results into N multi-scale edge information modules respectively to obtain the first MSEIS result to the Nth MSEIS result; where N is the total number of multi-scale edge information modules;
[0012] S13: Concatenate the MSEIS convolution result with the first MSEIS result to the Nth MSEIS result to obtain the MSEIS output result.
[0013] According to the SAR ship detection method with hierarchical attention fusion and edge enhancement provided by the present invention, the steps of the multi-scale edge information module include:
[0014] S111: Perform average pooling on the MSEIS convolution result to obtain the first edge information result;
[0015] S112: Convolve the first edge information result to obtain the second edge information result;
[0016] S113: Input the second edge information result into the edge enhancement unit to obtain the third edge information result;
[0017] S114: Perform bilinear interpolation on the third edge information result to obtain the nth MSEIS result, where n is the ordinal number of the multi-scale edge information module.
[0018] According to the SAR ship detection method with hierarchical attention fusion and edge enhancement provided by the present invention, the process of the edge enhancement unit is as follows:
[0019] S1111: Perform average pooling on the second edge information result to obtain the first EEU result;
[0020] S1112: Subtracting the first EEU result from the second edge information yields the high-frequency edge component;
[0021] S1113: First, convolve the high-frequency edge components and then activate them using the sigmoid activation function to obtain the second EEU result;
[0022] S1114: Add the second edge information result and the second EEU result to obtain the third edge information result.
[0023] According to the SAR ship detection method with hierarchical attention fusion and edge enhancement provided by the present invention, the process of the cross-domain feature gating module is as follows:
[0024] S21: Input the MSEIS output results into the space gating module to obtain the space gating output results;
[0025] S22: Input the spatial gating output result into the local feature modulation module to obtain the CDFG result.
[0026] According to the SAR ship detection method with hierarchical attention fusion and edge enhancement provided by the present invention, the flow of the space gating module is as follows:
[0027] S211: Max pooling is performed on the MSEIS output to obtain the max pooling SG result, average pooling is performed on the MSEIS output to obtain the average pooling SG result, the max pooling SG result and the average pooling SG result are concatenated, and then convolution is performed to obtain the spatial descriptor.
[0028] S212: The MSEIS output result is first subjected to a depthwise convolution with a dilation rate of 2, then a depthwise convolution with a dilation rate of 3, and finally activated using the GELU activation function to obtain the second SG result;
[0029] S213: The MSEIS output is convolved and then activated using the GELU activation function to obtain the third SG result;
[0030] S214: Multiply the second SG result and the spatial descriptor element-wise to obtain the first SG result, and add the first SG result and the third SG result to obtain the spatial gating output result.
[0031] According to the SAR ship detection method with hierarchical attention fusion and edge enhancement provided by the present invention, the process of the local feature modulation module is as follows:
[0032] S221: Average the spatial gating output results to obtain the spatial mean of the spatial gating output;
[0033] S222: Subtracting the spatial mean value of the spatial gated output from the spatial gated output result yields the deviation characteristic;
[0034] S223: Multiply the deviation features and spatial gating output results element-wise, and then multiply them by the interactive learning self-modulation intensity to obtain the first LFM result;
[0035] S224: Multiply the spatial gating output result by the direct scaling factor to obtain the second LFM result;
[0036] S225: Add the first LFM result and the second LFM result to obtain the output of the local feature modulation module.
[0037] According to the SAR ship detection method with hierarchical attention fusion and edge enhancement provided by the present invention, the flow of the hierarchical attention fusion block module is as follows:
[0038] S31: Perform a 1*1 convolution on the output of the local feature modulation module to obtain the first HAFB feature map; perform a 3*3 convolution on the output of the local feature modulation module to obtain the second HAFB feature map; combine the first HAFB feature map and the second HAFB feature map and perform a 3*3 convolution to obtain the baseline fusion feature;
[0039] S32: Input the first HAFB feature map and the small patch into the LGA module to obtain the first local attention branch; input the first HAFB feature map and the large patch into the LGA module to obtain the first global attention branch; concatenate the first local attention branch and the first global attention branch to obtain the first hierarchical attention branch;
[0040] S33: Input the second HAFB feature map and the small patch into the LGA module to obtain the second local attention branch; input the second HAFB feature map and the large patch into the LGA module to obtain the second global attention branch; concatenate the second local attention branch and the second global attention branch to obtain the second hierarchical attention branch;
[0041] S34: The baseline fusion features, the first hierarchical attention branch, and the second hierarchical attention branch are concatenated by channel to obtain the HAFB concatenation result;
[0042] S35: The HAFB concatenation result is first subjected to dimensionality reduction convolution, then reparameterizable convolution, and then convolution again to obtain the model output result.
[0043] According to the SAR ship detection method with hierarchical attention fusion and edge enhancement provided by the present invention, the steps of the LGA module are as follows:
[0044] S311: Divide the HAFB feature map into multiple non-overlapping initial patches according to the patch size;
[0045] S312: Flatten the initial patch and input it into a multilayer perceptron to obtain a high-dimensional embedding;
[0046] S313: Softmax activation is performed on the high-dimensional embedding to obtain an attention map;
[0047] S314: Multiply the high-dimensional embedding and attention map element by element, and compare the cosine similarity with the cue vector to obtain the gated mask;
[0048] S315: The high-dimensional embedding, attention map and gated mask are multiplied element by element, the gated features are linearly transformed through the matrix, then bilinear interpolation is performed for upsampling, and finally convolution is performed to obtain the attention branch.
[0049] The present invention also provides a SAR ship detection system with hierarchical attention fusion and edge enhancement, comprising:
[0050] Data initialization module: used to acquire initial ship data maps and perform preprocessing to obtain input feature maps;
[0051] Model building and training module: used to build an enhanced image recognition model, and to train the enhanced image recognition model based on the input feature map to obtain the trained image recognition model; the enhanced image recognition model includes a multi-scale edge information selection module, a cross-domain feature gating module, and a hierarchical attention fusion block module;
[0052] Image recognition module: Used to input actual SAR images into the trained image recognition model to obtain ship detection results.
[0053] The above-described one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects:
[0054] This invention provides a hierarchical attention fusion and edge enhancement SAR ship detection method and system. By designing and incorporating a multi-scale edge information selection module, a cross-domain feature gating module, and a hierarchical attention fusion block module, it achieves superior training stability and generalization ability even in low-sample detection scenarios, effectively alleviating the overfitting problem that usually occurs in baseline models when data is scarce.
[0055] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0056] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0057] Figure 1 This is a schematic diagram illustrating typical challenges in SAR ship detection scenarios.
[0058] Figure 2 This is a flowchart illustrating the SAR ship detection method with hierarchical attention fusion and edge enhancement provided by the present invention.
[0059] Figure 3 This is the overall architecture diagram of the multi-scale edge information selection module.
[0060] Figure 4 This is the overall architecture diagram of the cross-domain feature gating mechanism.
[0061] Figure 5 This is the overall architecture diagram of the hierarchical attention fusion block module.
[0062] Figure 6 This is a training curve showing the mAP50:95 (%) of different module configurations on the SSDD small sample dataset.
[0063] Figure 7 These are feature maps of each module.
[0064] Figure 8 This is a comparison chart of the target detection performance of different methods in nearshore and offshore scenarios.
[0065] Figure 9This is a structural block diagram of the SAR ship detection system with hierarchical attention fusion and edge enhancement provided by the present invention.
[0066] Figure label:
[0067] 101. Data initialization module; 102. Model building and training module; 103. Image recognition module. Detailed Implementation
[0068] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention. The following embodiments are used to illustrate this invention but cannot be used to limit the scope of this invention.
[0069] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0070] The following is combined Figures 2 to 9 This invention is described.
[0071] Example
[0072] like Figure 2 As shown, Figure 2 This is a flowchart illustrating a hierarchical attention fusion and edge enhancement SAR ship detection method, including the following steps:
[0073] S1: Obtain the initial ship data map and preprocess it to obtain the input feature map;
[0074] S2: Construct an enhanced image recognition model, and train the enhanced image recognition model based on the input feature map to obtain a trained image recognition model; the enhanced image recognition model includes a multi-scale edge information selection module, a cross-domain feature gating module, and a hierarchical attention fusion block module;
[0075] S3: Input the actual SAR image into the trained image recognition model to obtain the ship detection result.
[0076] Specifically, such as Figure 3 As shown, the steps of the Multi-Scale Edge Information Select module (MSEIS) include:
[0077] S11: Convolve the input feature map to obtain the MSEIS convolution result;
[0078] S12: Input the MSEIS convolution results into N multi-scale edge information modules respectively to obtain the first MSEIS result to the Nth MSEIS result; where N is the total number of multi-scale edge information modules;
[0079] S13: Concatenate the MSEIS convolution result with the first MSEIS result to the Nth MSEIS result to obtain the MSEIS output result.
[0080] Specifically, the steps of the multi-scale edge information module include:
[0081] S111: Perform average pooling on the MSEIS convolution result to obtain the first edge information result;
[0082] S112: Convolve the first edge information result to obtain the second edge information result;
[0083] S113: Input the second edge information result into the edge enhancement unit to obtain the third edge information result;
[0084] S114: Perform bilinear interpolation on the third edge information result to obtain the nth MSEIS result, where n is the ordinal number of the multi-scale edge information module.
[0085] The average pooling convolution kernels in different multi-scale edge information modules are different. In this embodiment of the invention, the convolution kernels include four types: 3*3, 6*6, 9*9, and 12*12.
[0086] Specifically, the process of the Edge Enhancement Unit (EEU) is as follows:
[0087] S1111: The second edge information result The first EEU result is obtained by performing average pooling. :
[0088]
[0089] in, This represents an average pooling operation with a 3×3 kernel and a step size of 1.
[0090] S1112: Subtracting the first EEU result from the second edge information yields the high-frequency edge component. :
[0091] .
[0092] S1113: First, perform convolution on the high-frequency edge components, then activate them using the sigmoid activation function to obtain the second EEU result. ;
[0093]
[0094] in, It is the sigmoid activation function. It is a convolution function.
[0095] S1114: Add the second edge information result and the second EEU result to obtain the third edge information result. :
[0096]
[0097] Specifically, such as Figure 4 As shown, the process of the Cross-Domain Feature Gating Module (CDFG) is as follows:
[0098] S21: Input the MSEIS output results into the space gating module to obtain the space gating output results;
[0099] S22: Input the spatial gating output result into the local feature modulation module to obtain the CDFG result.
[0100] Specifically, the process of the Spatial Gating Module (SG) is as follows:
[0101] S211: The output results of the MSEIS Max pooling is performed to obtain the max pooling SG result, and the MSEIS output result is then processed. Average pooling is performed to obtain the average pooling SG result. The max pooling SG result and the average pooling SG result are concatenated, and then convolution is performed to obtain the spatial descriptor. :
[0102]
[0103] in, For concatenation functions, For max pooling function, For average pooling function
[0104] S212: The MSEIS output result is first subjected to a depthwise convolution with a dilation rate of 2, then a depthwise convolution with a dilation rate of 3, and finally activated using the GELU activation function to obtain the second SG result;
[0105] S213: The MSEIS output is convolved and then activated using the GELU activation function to obtain the third SG result;
[0106] S214: Multiply the second SG result and the spatial descriptor element-wise to obtain the first SG result, and add the first SG result and the third SG result to obtain the spatial gating output result.
[0107] Specifically, the process of the Local Feature Modulation Module (LFM) is as follows:
[0108] S221: Average the spatial gating output results to obtain the spatial mean of the spatial gating output;
[0109] S222: Subtracting the spatial mean value of the spatial gated output from the spatial gated output result yields the deviation characteristic;
[0110] S223: Multiply the deviation features and spatial gating output results element-wise, and then multiply them by the interactive learning self-modulation intensity to obtain the first LFM result;
[0111] S224: Multiply the spatial gating output result by the direct scaling factor to obtain the second LFM result;
[0112] S225: Add the first LFM result and the second LFM result to obtain the output of the local feature modulation module.
[0113] like Figure 5 As shown, the process of the Hierarchical Attention Fusion Block (HAFB) module is as follows:
[0114] S31: Perform a 1*1 convolution on the output of the local feature modulation module to obtain the first HAFB feature map; perform a 3*3 convolution on the output of the local feature modulation module to obtain the second HAFB feature map; combine the first HAFB feature map and the second HAFB feature map and perform a 3*3 convolution to obtain the baseline fusion feature;
[0115] S32: Input the first HAFB feature map and the small patch into the LGA module to obtain the first local attention branch; input the first HAFB feature map and the large patch into the LGA module to obtain the first global attention branch; concatenate the first local attention branch and the first global attention branch to obtain the first hierarchical attention branch;
[0116] S33: Input the second HAFB feature map and the small patch into the LGA module to obtain the second local attention branch; input the second HAFB feature map and the large patch into the LGA module to obtain the second global attention branch; concatenate the second local attention branch and the second global attention branch to obtain the second hierarchical attention branch;
[0117] S34: The baseline fusion features, the first hierarchical attention branch, and the second hierarchical attention branch are concatenated by channel to obtain the HAFB concatenation result;
[0118] S35: The HAFB concatenation result is first subjected to dimensionality reduction convolution, then reparameterizable convolution, and then convolution again to obtain the model output result.
[0119] Figure 5 The orange-red area represents the calculation process of the first layer attention branch, the blue area represents the calculation process of the second layer attention branch, and the green area represents the calculation process of the baseline fusion feature. In the figure, p represents the patch size, where the small patch is 2 and the large patch is 4.
[0120] Specifically, the steps of the LGA module (Local-Global Attention Module) are as follows:
[0121] S311: Divide the HAFB feature map into multiple non-overlapping initial patches according to the patch size;
[0122] S312: Flatten the initial patch and input it into a multilayer perceptron to obtain a high-dimensional embedding;
[0123] S313: Softmax activation is performed on the high-dimensional embedding to obtain an attention map;
[0124] S314: Multiply the high-dimensional embedding and attention map element by element, and compare the cosine similarity with the cue vector to obtain the gated mask;
[0125] S315: The high-dimensional embedding, attention map and gated mask are multiplied element by element, the gated features are linearly transformed through the matrix, then bilinear interpolation is performed for upsampling, and finally convolution is performed to obtain the attention branch.
[0126] This invention will sequentially introduce the datasets used, experimental setup, evaluation metrics, module ablation experiments, comparative analysis with existing state-of-the-art methods, and analysis of small-sample detection performance and visualization results. The experiments are primarily based on three representative datasets: SSDD, RSDD-SAR, and HRSID, covering typical SAR imaging scenarios such as nearshore, offshore, and complex port environments. All experiments were performed on an NVIDIA GeForce RTX 3080Ti GPU to ensure consistency and reproducibility.
[0127] The performance of the method proposed in this invention is mainly evaluated by the mean average accuracy (mAP), which is the average value of the intersection-union ratio (IoU) threshold ranging from 0.50 to 0.95, denoted as mAP. 50:95 In addition, precision (P), recall (R), and the number of model parameters (Params), in millions, are also used as auxiliary evaluation metrics.
[0128] Precision (P) represents the proportion of correctly detected positive samples out of all results that were detected as positive; recall (R) represents the proportion of correctly detected positive samples out of all actual positive samples. The formulas for calculating P and R are as follows:
[0129]
[0130] Wherein, TP represents true positives, indicating the number of correctly detected positive samples; FP represents false positives, indicating the number of background regions that are mistakenly detected as targets; and FN represents false negatives, indicating the number of actual targets that are not detected.
[0131] Mean precision (AP) is defined as the area under the precision-recall curve, calculated by integration:
[0132]
[0133] in, P ( R The AP value represents the precision at a recall of R. A higher AP value indicates better performance of the object detection algorithm. Since the dataset used in this study only contains the category "ships", the mAP value is equal to the AP value.
[0134] Table 1 Ablation analysis of module combinations and their impact on detection performance
[0135]
[0136] As shown in Table 1, this study explored the effects of combined MSEIS, CDFG, and HAFB modules on the SSDD, RSDD, and HRSID datasets through ablation experiments. The results show that the contributions of each module differ, but multi-module collaboration can steadily improve model performance and demonstrate gains across datasets. CDFG, as a sub-module of MSEIS, enhances its feature processing capabilities, and the two work synergistically to progressively improve accuracy.
[0137] The HAFB module delivers performance gains when used independently, particularly on the HRSID dataset, where it provides a 1.54% improvement. More importantly, it exhibits a powerful synergistic enhancement effect when combined with other modules, further amplifying its performance advantages.
[0138] Overall, the combination of all three modules yielded the highest accuracy, validating the effectiveness of the proposed modular design and its superior generalization ability on different SAR ship detection datasets.
[0139] Table 2 Comparison data in the HRSID dataset
[0140]
[0141] Table 3 shows the comparison data in the RSDD dataset.
[0142]
[0143] Tables 2 and 3 compare the proposed method (Ours) with several classic and improved object detection networks on the HRSID and RSDD datasets, respectively. Mean accuracy (mAP) is used. 50 and mAP 50:95 Performance is evaluated using the number of parameters (Params). The table lists RetinaNet, Faster R-CNN, YOLO11n, YOLO13n, RT-DETR, Yueetal., CSnNet, FEPS-Net, Cpoints-Net, Co-DETR, LSKNet, EVA-02, and MMI-Det as other object detection networks.
[0144] In both datasets, classic detectors such as Faster R-CNN and YOLO variants serve as baselines due to their well-established detection frameworks. However, their performance tends to degrade when faced with challenging scenarios, such as small object detection, low-contrast maritime targets, or complex backgrounds. This highlights the trade-off between detection accuracy, robustness, and model efficiency.
[0145] In contrast, improved models such as CSnNet, Co-DETR, and LSKNet combine advanced mechanisms such as context modeling, multi-scale fusion, or transformer-based backbones to produce better accuracy, but sometimes at the cost of model complexity.
[0146] The proposed model achieved state-of-the-art performance on both benchmarks, demonstrating significant improvements in accuracy and robustness. On the HRSID dataset, the proposed model achieved 93.6% mAP. 50 and 68.7% mAP 50:95 This surpasses all comparison methods. On the RSDD dataset, the proposed model achieves 96.9% mAP. 50 and 71.4% mAP 50:95 It also significantly exceeded the baseline of the best performance.
[0147] This demonstrates the effectiveness of our proposed architectural enhancements, including refined feature extraction, adaptive fusion mechanisms, and structural optimization, all of which contribute to robust and accurate detection in complex SAR ship detection environments. Notably, our model maintains a modest parameter count (38.5M), ensuring a good trade-off between accuracy and computational efficiency.
[0148] like Figure 6 As shown, Figure 6 The dynamic impact of each module on the SSDD dataset under few-shot training is shown. The baseline (blue) quickly peaks at approximately 62.5% but then declines, showing clear signs of overfitting and poor generalization in the few-shot setting. Compared to the baseline, the HAFB module (grey) improves overall performance but still shows a decline in later performance, indicating limited stability. The MSEIS module (yellow) has a significant accuracy gain and strong resistance to overfitting. Its curve remains stable and gradually improves, showing enhanced generalization in the low-data region. The full model (COMP, black) achieves the best performance (65.2%), converges the fastest, shows no degradation, and consistently outperforms all other configurations. Figure 6 The ordinate of the middle axis represents the mAP in the SSDD dataset. 50:95 .
[0149] The module proposed in this invention significantly improves detection with limited shots by enhancing accuracy, training stability, and generalization ability. This is crucial for SAR ship detection tasks with limited annotated data.
[0150] like Figure 7 As shown, Figure 7 As shown, Figure 7 In the middle (a), the raw SAR image is shown, where the ship target is submerged in a challenging sea clutter background. Figure 7 As shown in (b), as a component of the MSEIS module, the EEU focuses on enhancing the scattering characteristics of the ship's metallic edges, highlighting part of the hull outline against the background of ocean waves, but noise interference still exists; as Figure 7As shown in (c), the MSEIS module significantly improves the separation between the target and the background, especially in high sea state scenes, where the rectangular structure of the ship's hull contrasts sharply with the blurred wave texture, and edge localization is clearer; LGA (p=2) and LGA (p=4) demonstrate the effect of the CDFG module under different parameters, among which, Figure 7 When d is p=2, it balances fine-grained details with a broader context. Figure 7 When p=4 in (e), the attention mechanism amplifies features related to the ship and suppresses the surrounding low-scattering coastline area, significantly improving target contrast; for example... Figure 7 The HAFB module shown in (f) uses multi-scale feature fusion to not only preserve the detailed features of each ship in dense ship scenes, but also clearly distinguish their spatial distribution, effectively reducing false alarms and missed detections. p represents the patch size.
[0151] like Figure 8 As shown, Figure 8 This presentation showcases a visual comparison of current mainstream target detection methods and the proposed method in two typical SAR scenarios: nearshore and offshore. Each column, from left to right, corresponds to: Figure 8 (a) shows the RT-DETR model. Figure 8 (b) is the YOLO11n model. Figure 8 (c) represents the CSnNet model. Figure 8 In the middle (d), R represents the Co-DET model. Figure 8 (e) represents the YOLO13n model. Figure 8 (f) shows the method proposed in this invention. Red circles mark falsely detected targets, yellow circles mark missed targets, and blue boxes represent manually marked ship target areas. The first row shows the detection results for near-shore areas, and the second row shows the detection results for dense targets in the open ocean.
[0152] The results show that RT-DETR and YOLO11n have a high number of false detections in near-shore areas, especially in areas with complex scattering near the shoreline and strong echoes from port buildings. These models tend to misclassify non-ship scatterers as targets, resulting in a significant number of missed detections. CSnNet and Co-DETR show some improvement in target detection, but still suffer from missed detections in densely packed small targets in the open ocean. YOLO13n demonstrates improved detection capabilities in dense scenes, but its localization accuracy and boundary awareness remain insufficient, with instances of target overlap and offset.
[0153] In comparison, our proposed method performs exceptionally well in both nearshore and open-ocean scenarios. Thanks to the MSEIS module's enhancement of multi-scale edge information and the EEU unit's enhancement of ship metal edges, our method effectively distinguishes ships from complex backgrounds, improving edge sharpness and geometric integrity. The CDFG module, through a "space-channel" dual-domain gating mechanism, further focuses on salient areas of ships, suppressing background noise and shoreline interference, and enhancing the contrast between targets and background. In dense target scenarios in the open ocean, the HAFB module, through hierarchical multi-scale semantic fusion, effectively captures the spatial distribution and contextual information of dense small targets, significantly reducing the probability of false alarms and missed detections. Our proposed method outperforms the comparative methods in target edge perception, local and global feature alignment, and discrimination capabilities in complex backgrounds.
[0154] like Figure 9 As shown, Figure 9 This is a structural block diagram of the SAR ship detection system with hierarchical attention fusion and edge enhancement provided by the present invention, which includes the following modules:
[0155] Data initialization module 101: used to acquire initial ship data map and preprocess it to obtain input feature map;
[0156] Model building and training module 102: used to build an enhanced image recognition model, and to train the enhanced image recognition model based on the input feature map to obtain a trained image recognition model; the enhanced image recognition model includes a multi-scale edge information selection module, a cross-domain feature gating module, and a hierarchical attention fusion block module;
[0157] Image recognition module 103: used to input actual SAR images into the trained image recognition model to obtain ship detection results.
[0158] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0159] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
[0160] It should be noted that the embodiments of this disclosure can be implemented using hardware, software, or a combination of both. The hardware portion can be implemented using dedicated logic; the software portion can be stored in memory and executed by a suitable instruction execution system, such as a microprocessor or dedicated-design hardware. Those skilled in the art will understand that the above-described devices and methods can be implemented using computer-executable instructions and / or included in processor control code, for example, such code provided on a programmable memory or a data carrier such as an optical or electronic signal carrier.
[0161] Furthermore, although the operation of the methods of this disclosure is described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Rather, the steps depicted in the flowcharts may be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps. It should also be noted that the features and functions of two or more devices according to this disclosure may be embodied in one device. Conversely, the features and functions of one device described above may be further divided and embodied by multiple devices.
[0162] While this disclosure has been described with reference to several specific embodiments, it should be understood that this disclosure is not limited to the specific embodiments disclosed. This disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A SAR ship detection method with hierarchical attention fusion and edge enhancement, characterized in that, Includes the following steps: S1: Obtain the initial ship data map and preprocess it to obtain the input feature map; S2: Construct an enhanced image recognition model. Train the enhanced image recognition model based on the input feature map to obtain a trained image recognition model. The enhanced image recognition model includes a multi-scale edge information selection module, a cross-domain feature gating module, and a hierarchical attention fusion block module. The multi-scale edge information selection module is used to distinguish between edges caused by targets and noise. The cross-domain feature gating module is used to enhance the response of strong scattering points such as the ship hull while suppressing background interference. The hierarchical attention fusion block module is used to focus on the fine-grained local details of the ship and its global positional context in the scene. The process of the cross-domain feature gating module is as follows: S21: Input the MSEIS output result to the space gating module to obtain the space gating output result; the process of the space gating module is as follows: S211: Max pooling is performed on the MSEIS output to obtain the max pooling SG result, average pooling is performed on the MSEIS output to obtain the average pooling SG result, the max pooling SG result and the average pooling SG result are concatenated, and then convolution is performed to obtain the spatial descriptor. S212: The MSEIS output result is first subjected to a depthwise convolution with a dilation rate of 2, then a depthwise convolution with a dilation rate of 3, and finally activated using the GELU activation function to obtain the second SG result; S213: The MSEIS output is convolved and then activated using the GELU activation function to obtain the third SG result; S214: Multiply the second SG result and the spatial descriptor element-wise to obtain the first SG result, and add the first SG result and the third SG result to obtain the spatial gating output result; S22: Input the spatial gating output result into the local feature modulation module to obtain the CDFG result; the process of the local feature modulation module is as follows: S221: Average the spatial gating output results to obtain the spatial mean of the spatial gating output; S222: Subtracting the spatial mean value of the spatial gated output from the spatial gated output result yields the deviation characteristic; S223: Multiply the deviation features and spatial gating output results element-wise, and then multiply them by the interactive learning self-modulation intensity to obtain the first LFM result; S224: Multiply the spatial gating output result by the direct scaling factor to obtain the second LFM result; S225: Add the first LFM result and the second LFM result to obtain the output of the local feature modulation module; S3: Input the actual SAR image into the trained image recognition model to obtain the ship detection result.
2. The SAR ship detection method with hierarchical attention fusion and edge enhancement according to claim 1, characterized in that, The steps of the multi-scale edge information selection module include: S11: Convolve the input feature map to obtain the MSEIS convolution result; S12: Input the MSEIS convolution results into N multi-scale edge information modules respectively to obtain the first MSEIS result to the Nth MSEIS result; where N is the total number of multi-scale edge information modules; S13: Concatenate the MSEIS convolution result with the first MSEIS result to the Nth MSEIS result to obtain the MSEIS output result.
3. The SAR ship detection method with hierarchical attention fusion and edge enhancement according to claim 2, characterized in that, The steps of the multi-scale edge information module include: S111: Perform average pooling on the MSEIS convolution result to obtain the first edge information result; S112: Convolve the first edge information result to obtain the second edge information result; S113: Input the second edge information result into the edge enhancement unit to obtain the third edge information result; S114: Perform bilinear interpolation on the third edge information result to obtain the nth MSEIS result, where n is the ordinal number of the multi-scale edge information module.
4. The SAR ship detection method with hierarchical attention fusion and edge enhancement according to claim 3, characterized in that, The process of the edge enhancement unit is as follows: S1111: Perform average pooling on the second edge information result to obtain the first EEU result; S1112: Subtracting the first EEU result from the second edge information yields the high-frequency edge component; S1113: First, convolve the high-frequency edge components and then activate them using the sigmoid activation function to obtain the second EEU result; S1114: Add the second edge information result and the second EEU result to obtain the third edge information result.
5. The SAR ship detection method with hierarchical attention fusion and edge enhancement according to claim 1, characterized in that, The process of the hierarchical attention fusion block module is as follows: S31: Perform a 1*1 convolution on the output of the local feature modulation module to obtain the first HAFB feature map; perform a 3*3 convolution on the output of the local feature modulation module to obtain the second HAFB feature map; combine the first HAFB feature map and the second HAFB feature map and perform a 3*3 convolution to obtain the baseline fusion feature; S32: Input the first HAFB feature map and the small patch into the LGA module to obtain the first local attention branch; The first HAFB feature map and the large patch are input into the LGA module to obtain the first global attention branch; The first local attention branch and the first global attention branch are concatenated to obtain the first hierarchical attention branch; S33: Input the second HAFB feature map and the small patch into the LGA module to obtain the second local attention branch; The second HAFB feature map and the large patch are input into the LGA module to obtain the second global attention branch; The second local attention branch and the second global attention branch are concatenated to obtain the second hierarchical attention branch; S34: The baseline fusion features, the first hierarchical attention branch, and the second hierarchical attention branch are concatenated by channel to obtain the HAFB concatenation result; S35: The HAFB concatenation result is first subjected to dimensionality reduction convolution, then reparameterizable convolution, and then convolution again to obtain the model output result.
6. The SAR ship detection method with hierarchical attention fusion and edge enhancement according to claim 5, characterized in that, The steps of the LGA module are as follows: S311: Divide the HAFB feature map into multiple non-overlapping initial patches according to the patch size; S312: Flatten the initial patch and input it into a multilayer perceptron to obtain a high-dimensional embedding; S313: Softmax activation is performed on the high-dimensional embedding to obtain an attention map; S314: Multiply the high-dimensional embedding and attention map element by element, and compare the cosine similarity with the cue vector to obtain the gated mask; S315: The high-dimensional embedding, attention map and gated mask are multiplied element by element, the gated features are linearly transformed through the matrix, then bilinear interpolation is performed for upsampling, and finally convolution is performed to obtain the attention branch.
7. A hierarchical attention fusion and edge enhancement SAR ship detection system, for performing any one of the hierarchical attention fusion and edge enhancement SAR ship detection methods as claimed in claims 1 to 6, characterized in that, include: Data initialization module: used to acquire initial ship data maps and perform preprocessing to obtain input feature maps; Model building and training module: used to build an enhanced image recognition model, and to train the enhanced image recognition model based on the input feature map to obtain the trained image recognition model; the enhanced image recognition model includes a multi-scale edge information selection module, a cross-domain feature gating module, and a hierarchical attention fusion block module; Image recognition module: Used to input actual SAR images into the trained image recognition model to obtain ship detection results.
Citation Information
Patent Citations
Multi-scale context feature enhanced remote sensing fine-grained ship detection method
CN120912859A
SAR small target ship detection method and system based on three-branch attention module and mixed measurement mode
CN121685929A