SAR ship detection method based on edge enhancement and context feature aggregation
By combining multi-scale directional gated convolution modules, local-global fusion modules, and high-resolution feature pyramid networks, the problem of low detection accuracy in SAR ship detection under speckle noise and complex backgrounds is solved, achieving high-precision identification and recall of multi-scale ship targets.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUXI UNIV
- Filing Date
- 2026-04-09
- Publication Date
- 2026-07-03
AI Technical Summary
Existing SAR ship detection models suffer from low detection accuracy, high false negative and false positive rates when faced with speckle noise, complex background interference, and weak features of small targets, making it difficult to effectively identify multi-scale ship targets.
A high-resolution feature pyramid network is used in conjunction with a multi-scale directional gated convolution module and a local-to-global fusion module. By edge enhancement and contextual feature aggregation, directional edge and geometric structure features of ship targets at multiple scales are extracted. An adaptive gating fusion mechanism is used to dynamically adjust the fusion ratio of local details and global context.
It significantly improves the detection accuracy and recall rate of multi-scale ship targets and reduces the false detection rate, especially in the detection performance in complex backgrounds and small target scenarios.
Smart Images

Figure CN122336491A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a SAR ship detection method, specifically a SAR ship detection method based on edge enhancement and contextual feature aggregation, belonging to the field of target detection technology. Background Technology
[0002] Synthetic Aperture Radar (SAR), with its all-weather, all-day, and high-resolution imaging capabilities, has significant research value and application prospects in fields such as maritime traffic monitoring, national defense security, and resource exploration. In particular, it provides key technical support for tasks such as maritime rescue, border patrol, and waterway safety, and has therefore become a research hotspot both domestically and internationally.
[0003] With the rise of deep learning technology, it has gradually become the mainstream in the field of SAR target detection. In the field of SAR ship detection, some existing detection models adopt dynamic deformable convolution and large receptive field attention mechanisms to improve the model's ability to perceive local details and global context. Others design adaptive large kernel selection modules and multi-scale attention mechanisms combined with structural reparameterization technology to improve the detection accuracy and edge computing efficiency of small ships in SAR images. However, in SAR ship target detection tasks, ship targets are often affected by speckle noise and complex background interference, and their shapes and scales vary greatly. Small targets have weak features, resulting in low detection accuracy and high false positive and false negative rates of existing detection models.
[0004] To address this, a SAR ship detection method based on edge enhancement and contextual feature aggregation is proposed. Summary of the Invention
[0005] To address the aforementioned technical issues, this invention proposes a SAR ship detection method that combines a multi-scale directional gated convolutional module and a dynamic fusion decision module. This method effectively alleviates the problem of losing features of small targets in deep networks and significantly improves the detection accuracy and recall rate of ships at multiple scales.
[0006] To achieve the above objectives, this invention provides a SAR ship detection method based on edge enhancement and contextual feature aggregation, comprising the following steps:
[0007] Step 1: Obtain the SAR ship image dataset, preprocess it, and divide it into training set, validation set, and test set;
[0008] Step 2: Build a SAR ship detection network model based on edge enhancement and contextual feature aggregation, including: input backbone network, neck network and detection head;
[0009] The backbone network is used to extract orientation-aware multi-scale feature maps, including a multi-scale orientation-gated convolution module and a local-global fusion module; the neck network uses a bidirectional feature fusion path of a high-resolution feature pyramid network to process the multi-scale feature maps and generate multi-scale fused feature maps; the detection head receives the multi-scale fused feature maps output by the neck network and uses them to detect ship targets at different scales.
[0010] Step 3: Input the SAR ship images from the training set and the validation set into the SAR ship detection network model for training and validation, respectively. Calculate the loss function and perform backpropagation to update the network parameters to obtain the optimal parameter model.
[0011] Step 4: Input the test set into the optimal parameter model and output the SAR ship detection results.
[0012] Furthermore, in step 2, the specific feature extraction process of the backbone network includes:
[0013] First, feature extraction is performed on the input image using a multi-scale directional gated convolution module and a local-global fusion module to obtain feature map C2;
[0014] Subsequently, the feature map C2 is processed by the first CBS module and the local-global fusion module to obtain the feature map C3;
[0015] Next, feature map C3 is processed by the second CBS module and the local-global fusion module to obtain feature map C4;
[0016] Finally, feature map C4 is processed by the third CBS module and the local-global fusion module to obtain feature map C5;
[0017] The Convolution-Batch Normalization-SiLU (CBS) module includes: a standard convolution, a batch normalization layer, and a SiLU activation function.
[0018] Furthermore, the specific implementation process of the multi-scale directional gated convolution module includes:
[0019] First, the input features are subjected to orientation-specific filling along different directions, and then the processed features are processed separately using multi-scale asymmetric convolution kernels through parallel convolution branches;
[0020] Then, after the convolution kernel operation of each branch, batch normalization and SiLU activation function processing are performed to obtain fine directional features and coarse directional features;
[0021] Next, a hierarchical gating fusion strategy is used to fuse the fine directional features and the coarse directional features to obtain fine fused features and coarse fused features;
[0022] Finally, the fine-grained and coarse-grained features are concatenated and then subjected to 2×2 convolution to integrate cross-channel information and regularize the number of channels, outputting an enhanced feature map.
[0023] Furthermore, the local-to-global fusion module adopts a dual-branch parallel architecture, and its specific implementation process includes:
[0024] The CBS module with convolutional branches processes the input features of the local-global fusion module to extract local features;
[0025] The global context attention mechanism module with attention branch is used to process the input features of the local-global fusion module and extract global features;
[0026] The local and global features are input into an adaptive gated fusion unit for processing to obtain fused features. Specifically, global average pooling is performed on the local and global features respectively, and after concatenation, they are interactively mapped through a 1×1 convolutional layer and the ReLU activation function. Finally, the Softmax function is used to generate normalized fusion weights. The fusion weights are multiplied by the local and global features channel by channel, and then the weighted feature maps are added element by element to obtain the final fused features.
[0027] Furthermore, the specific process of the global context attention mechanism module includes:
[0028] The input feature map is mapped into query vector, key vector, and value vector, respectively.
[0029] The query vector and key vector are input into the spatial attention branch and the channel attention branch respectively for processing to obtain the query weight and key weight.
[0030] The query weight and key weight are combined by addition, and then multiplied by the value vector after linear transformation to obtain the final output feature;
[0031] Specifically, the spatial attention branch is processed using 5×5 depthwise convolution, batch normalization, GELU activation function, and sigmoid activation function to generate spatial attention weights; the channel attention branch is processed using global adaptive average pooling, 1×1 convolution, GELU activation function, and sigmoid activation function to generate channel attention weights.
[0032] Furthermore, the specific process by which the neck network generates multi-scale fused feature maps using a high-resolution feature pyramid network includes:
[0033] The feature map C5 output from the backbone network is input into the spatial pyramid pooling module to generate feature map P5.
[0034] Feature map P5 is first upsampled and then concatenated with feature map C4. After concatenation, feature fusion is performed by the first C3K2 module to generate feature map P4.
[0035] Feature map P4 is upsampled a second time and then concatenated with feature map C3. After concatenation, feature fusion is performed by the second C3K2 module to generate feature map P3.
[0036] Feature map P3 is upsampled in the third step and then concatenated with feature map C2. After concatenation, feature fusion is performed by the third C3K2 module to generate feature map N2.
[0037] Feature map N2 is extracted by the fourth CBS module and then concatenated with feature map P3. After concatenation, feature fusion is performed by the fourth C2K2 module to obtain feature map N3.
[0038] Feature map N3 is extracted by the fifth CBS module and then concatenated with feature map P4. After concatenation, feature fusion is performed by the fifth C3K2 module to obtain feature map N4.
[0039] Feature map N4 is processed by the sixth CBS module to extract features, and then concatenated with feature map P5. After concatenation, feature fusion is performed by the sixth C3K2 module to obtain feature map N5.
[0040] Furthermore, the loss function includes classification loss and regression loss; wherein the classification loss uses the binary cross-entropy loss function, and the regression loss uses the CIoU loss function.
[0041] The present invention also provides an electronic device, including a processor and a memory, the memory storing program code that, when executed by the processor, causes the processor to perform the steps of the method.
[0042] The present invention also provides a storage medium storing a computer program or instructions that, when the computer program or instructions are run on a computer, execute the steps of the method described.
[0043] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0044] This invention addresses key technical challenges in SAR ship detection, such as speckle noise interference, variable ship target dimensions, and weak features of small targets. It proposes a detection method based on edge enhancement and contextual feature aggregation. The invention incorporates a multi-scale directional gated convolutional module in the backbone network to enhance feature extraction of directional edges and geometric structures of ships, providing high-quality initial directional representations for subsequent processing.
[0045] This invention constructs a local-to-global fusion module, which adopts a dual-branch parallel architecture. The convolutional branch extracts local detail features through a CBS module, while the attention branch models global dependencies using a global context attention mechanism module. The global context attention mechanism module, through parallel processing of spatial and channel attention branches, can simultaneously capture the spatial distribution and inter-channel correlations of ship targets in SAR images, effectively solving the problem that a single attention mechanism cannot adequately consider both local and global information in complex backgrounds. Subsequently, an adaptive gating fusion unit dynamically fuses the local features extracted by the convolutional branch and the global features extracted by the attention branch. By generating channel-level fusion weights, it adaptively adjusts the fusion ratio of local details and global context, solving the problem that fixed fusion methods are difficult to adapt to when ship target scales vary, and achieving accurate ship target discrimination at a higher semantic level.
[0046] This invention constructs a high-resolution feature pyramid and adds a small target detection head, which effectively alleviates the problem of small target features being lost in deep networks and significantly improves the detection accuracy and recall rate of ships at multiple scales. Attached Figure Description
[0047] Figure 1 This is a flowchart illustrating a SAR ship detection method based on edge enhancement and context feature aggregation network provided by the present invention.
[0048] Figure 2 A model structure diagram based on edge enhancement and context feature aggregation network provided by the present invention;
[0049] Figure 3 The structural diagram of the multi-scale directional gated convolution module provided by the present invention;
[0050] Figure 4 A structural diagram of the global context attention mechanism module provided by this invention;
[0051] Figure 5 A structural diagram of the local-to-global fusion module provided by this invention;
[0052] Figure 6 A structural diagram of the high-resolution feature pyramid module provided by this invention;
[0053] Figure 7 The diagram shows a comparison of detection results of different methods provided by the present invention in typical scenarios. (a) is the original image, (b) is RT-DETR, (c) is YOLOv10, (d) is YOLOv11, (e) is YOLOv12, (f) is EMFENet, (g) is DEPDet, and (h) is the present invention. Detailed Implementation
[0054] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, and the advantages of the present invention in the above and / or other aspects will become clearer.
[0055] This embodiment provides a SAR ship detection method based on edge enhancement and contextual feature aggregation network, such as... Figure 1 As shown, it includes the following steps:
[0056] Step 1: Obtain the SAR ship image dataset, preprocess the dataset, and divide it into training set, validation set, and test set according to the set ratio;
[0057] Furthermore, the steps for obtaining the dataset, preprocessing the dataset, and partitioning the dataset are as follows:
[0058] The datasets to be acquired are: SSDD and HRSID ship image datasets, including SAR images and corresponding annotation files for the SAR images;
[0059] The dataset preprocessing specifically involves performing basic preprocessing operations such as size unification, data type conversion, and normalization on the original images in the SSDD and HRSID ship image datasets, and performing data augmentation operations, including mosaic enhancement, mirroring, and flipping, to avoid overfitting of the model.
[0060] The specific method for dividing the dataset is as follows: the enhanced SSDD and HRSID ship image datasets are randomly divided into three parts, with the training set accounting for 70%, the validation set accounting for 20%, and the test set accounting for 10%.
[0061] Step 2: Build a SAR ship detection network model based on edge enhancement and contextual feature aggregation, including an input backbone network, a neck network, and a detection head;
[0062] Model structure reference Figure 2The backbone network is used to extract orientation-aware multi-scale feature maps. It mainly consists of standard convolution (Conv), multi-scale orientation gate convolution (MDGConv), local-global fusion (LGF), batch normalization (BN) layer and SiLU activation function.
[0063] Furthermore, in step 2, the specific feature extraction process of the backbone network includes:
[0064] First, feature extraction is performed on the input image using a multi-scale directional gated convolution module and a local-global fusion module to obtain feature map C2;
[0065] Subsequently, feature map C2 is processed by the first CBS module and the local-global fusion module to obtain feature map C3;
[0066] Next, feature map C3 is processed by the second CBS module and the local-global fusion module to obtain feature map C4;
[0067] Finally, feature map C4 is processed by the third CBS module and the local-global fusion module to obtain feature map C5;
[0068] The Convolution-Batch Normalization-SiLU (CBS) module features downsampling capabilities, comprising standard convolutions, batch normalization layers, and the SiLU activation function. The stride of the standard convolution is set to 2, downsampling the feature map size to half the input scale. All CBS modules in the backbone network employ the same downsampling ratio, meaning that the feature map height and width are halved after each downsampling step.
[0069] Furthermore, the model structure reference for the multi-scale directional gated convolution module. Figure 3 The specific implementation process includes:
[0070] First, the input features are subjected to orientation-specific filling along different directions, and then the processed features are processed separately using multi-scale asymmetric convolution kernels through parallel convolution branches;
[0071] Then, after the convolution kernel operation of each branch, batch normalization and SiLU activation function processing are performed to obtain fine directional features and coarse directional features; the above process is shown in the following formula.
[0072] ,
[0073] ,
[0074] ,
[0075] ,
[0076] Where X is the input feature map; X P This represents the feature after direction-specific filling processing. The four parameters of the filling parameter P represent the pixel filling amount in the left, right, top, and bottom directions, respectively; Conv 1×3 Conv 3×1 Conv 1×5 With Conv 5×1 represents convolution operations with kernel sizes of 1×3, 3×1, 1×5, and 5×1, respectively; BN represents batch normalization; SiLU represents the SiLU activation function; X1, X2, X3, and X4 are the output feature maps of the 1×3, 3×1, 1×5, and 5×1 convolution branches, respectively.
[0077] Next, a hierarchical gating fusion strategy is applied to the fine-grained and coarse-grained directional features to obtain fine-grained and coarse-grained fused features; the above process is shown in the following equation:
[0078] ,
[0079] ,
[0080] ,
[0081] ,
[0082] Where X1 and X2 are fine-grained directional features, X3 and X4 are coarse-grained directional features, Cat represents the concatenation operation, ReLU represents the ReLU activation function, and sigmoid represents the sigmoid activation function. This indicates element-wise multiplication, where G1 and G2 are spatial gating weights, and Y1 and Y2 are fine-grained and coarse-grained fusion features, respectively.
[0083] Finally, the fine-grained and coarse-grained features are concatenated and then subjected to 2×2 convolution for cross-channel information integration and channel number regularization, outputting the enhanced feature map Y. The above process is shown in the following equation:
[0084] ,
[0085] The multi-scale directional gated convolution module provided in this embodiment performs direction-specific filling of the input features along the four directions (left, right, up, and down), and processes them through four sets of parallel convolutional branches. These four branches use 1×3, 3×1, 1×5, and 5×1 convolutional kernels to extract horizontal and vertical features, respectively. After each convolutional operation, batch normalization and SiLU activation function processing are performed. Then, a hierarchical gated fusion strategy is used for feature integration. First, the fine directional features are concatenated along the channel dimension and fed into the gating unit to generate a spatial weight map. The features from the two branches are then weighted and summed pixel-by-pixel to obtain the fine fused features. Similarly, the coarse directional features are concatenated and weighted by the gating unit to obtain the coarse features. Then, the fine and coarse features are concatenated to obtain cross-scale features. Finally, a 2×2 convolution is used for feature integration and channel number normalization to output the enhanced feature map. This enhances the perception capability of multi-scale directional scattering features of ships.
[0086] It should be noted that this multi-scale directional gated convolutional module is only used in the high-resolution feature extraction stage of the backbone network and is not deployed in the low-resolution feature layer. The reason is that high-resolution feature maps retain rich spatial details and edge information, providing sufficient geometric support for directional feature extraction; while low-resolution feature maps suffer significant loss of spatial details and substantial attenuation of directional edge information after multiple downsampling. Deploying this module at this stage would not allow it to fully leverage its advantage in enhancing directional edge perception and would introduce unnecessary computational overhead. Therefore, placing the multi-scale directional gated convolutional module in the high-resolution feature extraction stage can more effectively enhance the extraction of features related to the ship's directional edges and geometric structure.
[0087] Furthermore, the local-to-global fusion module adopts a dual-branch parallel architecture, the structure of which is referenced from... Figure 5 The specific implementation process includes:
[0088] The CBS module with convolutional branches processes the input features of the local-global fusion module to extract local features;
[0089] The global context attention mechanism module with attention branch is used to process the input features of the local-global fusion module and extract global features;
[0090] Local and global features are input into an adaptive gated fusion unit for processing to obtain fused features. Specifically, the local and global features are concatenated, then interactively mapped using global average pooling, a 1×1 convolutional layer, and the ReLU activation function. Finally, the Softmax function is used to generate normalized fusion weights. The fusion weights are multiplied channel-wise by the local and global features respectively, and then the weighted feature maps are summed element-wise to obtain the final fused features. ,
[0091] ,
[0092] ,
[0093] ,
[0094] Among them, F in For the input features, GCA represents the Global Context Attention mechanism module, X local For local features, X global For global features, GAP is global average pooling, Softmax is the Softmax activation function, G is the gate weight, and F is the global average pooling function. out This refers to the fused features of the final output.
[0095] Furthermore, the global context attention mechanism module references... Figure 4 The specific process includes:
[0096] The input feature map is mapped into query vector, key vector, and value vector, respectively.
[0097] The query vector and key vector are input into the spatial attention branch and the channel attention branch respectively for processing to obtain the query weight and key weight.
[0098] The query weight and key weight are combined by addition, and then multiplied by the value vector after linear transformation to obtain the final output feature;
[0099] Specifically, the spatial attention branch is processed using 5×5 depthwise convolution, batch normalization, GELU activation function, and sigmoid activation function to generate spatial attention weights; the channel attention branch is processed using global adaptive average pooling, 1×1 convolution, GELU activation function, and sigmoid activation function to generate channel attention weights. The above process is shown in the following equation.
[0100] ,
[0101] ,
[0102] Where x is the input feature, Represents depthwise convolution. This indicates adaptive average pooling.
[0103] The neck network uses a bidirectional feature fusion path of High Resolution Feature Pyramid Network (HR-FPN) to process multi-scale feature maps and generate multi-scale fused feature maps. The HR-FPN structure includes two paths, one from top to bottom and one from bottom to top, and is mainly composed of Spatial Pyramid Pooling Module (SPPF), Upsampling, Concat, C3K2 Module and CBS Module.
[0104] The spatial pyramid pooling module consists of a CBS module and three consecutive 5×5 max pooling layers connected in series. After the input features are processed by the CBS module, they are passed through the three max pooling layers in sequence. The original features are then concatenated with the features obtained after the three pooling steps, and finally, the multi-scale fused features are output through the CBS module.
[0105] The C3K2 module is mainly composed of two CBS modules and multiple CBS sub-layers, and is primarily used for feature fusion and channel number adjustment after feature concatenation.
[0106] Furthermore, the specific process by which the neck network generates multi-scale fused feature maps using a high-resolution feature pyramid network includes:
[0107] The feature map C5 output from the backbone network is input into the spatial pyramid pooling module to generate feature map P5.
[0108] Feature map P5 is first upsampled and then concatenated with feature map C4. After concatenation, feature fusion is performed by the first C3K2 module to generate feature map P4.
[0109] Feature map P4 is upsampled a second time and then concatenated with feature map C3. After concatenation, feature fusion is performed by the second C3K2 module to generate feature map P3.
[0110] Feature map P3 is upsampled in the third step and then concatenated with feature map C2. After concatenation, feature fusion is performed by the third C3K2 module to generate feature map N2.
[0111] Feature map N2 is extracted by the fourth CBS module and then concatenated with feature map P3. After concatenation, feature fusion is performed by the fourth C2K2 module to obtain feature map N3.
[0112] Feature map N3 is extracted by the fifth CBS module and then concatenated with feature map P4. After concatenation, feature fusion is performed by the fifth C3K2 module to obtain feature map N4.
[0113] Feature map N4 is processed by the sixth CBS module to extract features, and then concatenated with feature map P5. After concatenation, feature fusion is performed by the sixth C3K2 module to obtain feature map N5.
[0114] Its structural reference Figure 6 The key improvement lies in introducing an additional high-resolution feature map C2 from the shallowest layer, which is then fused with the P3 feature map after downsampling from the top to the bottom path to generate a new high-resolution feature map P2 / N2. This constructs a feature path that retains rich edge and detail information, and finally outputs feature maps N2, N3, N4 and N5 for detection.
[0115] The detection head receives the multi-scale fused feature map output by the neck network, which is used to detect ship targets at different scales;
[0116] Furthermore, the multi-scale fused feature maps N2, N3, N4, and N5 output from HR-FPN are input into a dedicated multi-detector head. This detector head comprises four maps, corresponding to the target scales of micro, small, medium, and large. Each detector head has the same structure, consisting of two consecutive CBS modules and a final prediction convolutional layer. Specifically, the high-resolution feature map N2 serves as the input to the first detector head, specifically for detecting micro-scale ship targets; feature map N3 serves as the input to the second detector head, specifically for detecting small-scale ship targets; feature map N4 serves as the input to the third detector head, specifically for detecting medium-scale ship targets; and feature map N5 serves as the input to the fourth detector head, specifically for detecting large-scale ship targets.
[0117] Furthermore, the four detection heads perform forward inference on the corresponding feature maps N2, N3, N4, and N5, respectively, independently predicting candidate bounding boxes and their confidence scores. Finally, the prediction results at all scales are aggregated, and non-maximum suppression (NMS) post-processing is used to filter out highly overlapping redundant boxes, outputting the final ship detection results, completing the end-to-end process from SAR image to target localization.
[0118] Step 3: Input the preprocessed SAR images from the training and validation sets into the edge enhancement and context feature aggregation network in Step 2, calculate the loss function and perform backpropagation, update the network parameters, and obtain the optimal parameter model;
[0119] Step three specifically includes:
[0120] Step 3.1: Randomly initialize the parameters of the SAR ship detection network. Input the preprocessed training set and validation set data from Step 1 into the SAR ship detection network based on edge enhancement and context feature aggregation in Step 2, perform forward propagation, generate the predicted bounding boxes and class probabilities of ship targets, and calculate the loss.
[0121] Step 3.2: Backpropagate the loss and update the network parameters. Use minimizing the loss function as the optimization objective to obtain and save the optimal parameter model.
[0122] The loss function in step 3.2 will consist of both classification loss and regression loss. For classification, a binary cross-entropy loss function will be used, while for regression, a complete intersection over union (CIoU) loss function will be employed. CIoU loss, building upon IoU loss, considers the distance between the center points of the bounding boxes and their aspect ratio, providing more accurate bounding box regression supervision and thus improving the model's accuracy in locating ship targets.
[0123] Step 3.1 trains the network by inputting the SSDD and HRSID ship images and their annotations from Step 1. Model performance is monitored on the validation set, and the network model's precision (P), recall (R), and mean average precision (mAP) are finally evaluated on the test set. The core formulas are as follows:
[0124] ,
[0125] ,
[0126] ,
[0127] In the formula, TP, FP, and FN represent the number of true positives, false positives, and false negatives, respectively.
[0128] Step 4: Input the preprocessed test set into the optimal parameter model trained in Step 3, and output the detection result map of SAR ship image.
[0129] This example uses two publicly available SAR ship detection datasets: the Synthetic Aperture Radar Ship Detection Dataset (SSDD) and the High-Resolution SAR Images Dataset (HRSID). The SSDD dataset contains 1160 SAR images with a total of 2456 ship target instances; the images vary in size, and the target scales span a wide range. The HRSID dataset contains 5604 high-resolution SAR images with a total of 16951 ship target instances; the images have higher resolution and contain a large number of small targets. For data preprocessing, all images were first uniformly scaled to 640×640 pixels and their data types were converted. Then, normalization was performed to normalize the pixel values to the [0,1] interval. To enhance the model's generalization ability and avoid overfitting, data augmentation techniques such as mosaic enhancement, random mirroring, and random rotation were used to expand the training set. The dataset was divided into training, validation, and test sets in a 7:2:1 ratio. The parameter configuration for model training is shown in Table 1.
[0130] Table 1 Training parameter configuration
[0131]
[0132] To fully evaluate the performance of the model proposed in this invention, a comprehensive comparison was conducted with several mainstream target detection models. The models compared included RT-DETR, YOLOv10, YOLOv11, YOLOv12, and recent advanced models for SAR image or small target detection, such as AC-YOLO, EMFENet, and DEPDet. In addition to comprehensive performance metrics, to specifically evaluate the model's ability to detect small and medium-sized vessels, the average accuracy of small targets (APsmall) was specifically introduced as a key evaluation metric. Detailed comparison results are listed in Tables 2 and 3.
[0133] As shown in Table 2, the model constructed in this invention achieved good results on multiple metrics on the SSDD dataset. In terms of accuracy, it significantly outperformed other comparative models with a score of 97.1%. This indicates that MDGConv effectively enhances the feature response to the directional edges of ships through orientation-specific padding and multi-scale asymmetric convolution kernels, while suppressing background noise interference, thereby significantly reducing the false detection rate during the prediction stage.
[0134] In terms of overall detection accuracy (mAP) of 0.5:0.95, EECFAN achieved 64.3%, comparable to the best-performing DEPDet at 64.4%, but significantly outperforming other YOLO series models and EMFENet. This indicates that the LGF module, through an adaptive gating fusion mechanism, dynamically adjusts the fusion ratio of local details and global context, enabling the model to obtain sufficient semantic information for targets at different scales, thus maintaining stable detection accuracy even under stricter IoU thresholds.
[0135] It is worth noting that EMFENet achieved the highest score of 58.1% on the AP small metric, which specifically measures the performance of small target detection. This directly verifies the effectiveness of the HR-FPN structure in preserving and utilizing shallow high-resolution features. Although EMFENet performed exceptionally well in recall and mAP0.5, reaching 95.4% and 98.4% respectively, its relatively low mAP0.5:0.95 and APsmall metrics indicate potential shortcomings in its accuracy in locating small targets under different IoU thresholds.
[0136] In summary, on the SSDD dataset, this invention achieves the highest precision and excellent small target detection capability while maintaining a high recall rate, demonstrating its comprehensive advantages.
[0137] Table 2. Comparison of the proposed model with mainstream models on SSDD.
[0138]
[0139] The comparison results on the HRSID dataset are shown in Table 3. The model of this invention ranks first in all four metrics: P, R, mAP0.5, and mAP0.5:0.95. In particular, EECFAN improves upon the second-best performing DEPDet model by 1.1 percentage points in the mAP0.5:0.95 metric, indicating that EECFAN achieves more stable and accurate localization under different IoU thresholds. In small target detection, the AP small value of this invention reaches 53.4%, also outperforming all comparative models, further demonstrating the effectiveness of this model in handling small targets in complex scenes.
[0140] Table 3. Comparison of the proposed model with mainstream models on HRSID.
[0141]
[0142] This embodiment also provides experimental detection results for a SAR ship detection method based on edge enhancement and context feature aggregation network, as shown below. Figure 7As shown, in the comparison of detection results under different complex scenarios, the detection bounding box in this embodiment is closest to the real annotation. In dense scenes, the present invention can accurately distinguish targets, thanks to the modeling capability of the local-global fusion module for the global context, which solves the problem of missed detection caused by scale variations. In scenarios with small targets, the present invention can stably detect small and medium-sized ship targets that were missed by the comparison model, verifying the ability of the high-resolution feature pyramid to preserve the detailed features of small targets. In complex background scenarios, the false alarm rate of the present invention is significantly lower than that of the comparison model, proving the suppression effect of the multi-scale directional gated convolution module on speckle noise and complex background interference. The above results verify the superiority of the present invention in small target detection and complex background suppression.
[0143] This invention provides a SAR ship detection method based on edge enhancement and contextual feature aggregation. Many methods and approaches exist for implementing this technical solution; the above description is merely a preferred embodiment of the invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. All components not explicitly stated in this embodiment can be implemented using existing technologies.
Claims
1. A SAR ship detection method based on edge enhancement and contextual feature aggregation, characterized in that, Includes the following steps: Step 1: Obtain the SAR ship image dataset, preprocess it, and divide it into training set, validation set, and test set; Step 2: Build a SAR ship detection network model based on edge enhancement and contextual feature aggregation; Step 3: Input the SAR ship images from the training set and the validation set into the SAR ship detection network model for training and validation, respectively. Calculate the loss function and perform backpropagation to update the network parameters to obtain the optimal parameter model. Step 4: Input the test set into the optimal parameter model and output the SAR ship detection results.
2. The SAR ship detection method based on edge enhancement and contextual feature aggregation according to claim 1, characterized in that, In step 2, the SAR ship detection network model includes: a backbone network, a neck network, and a detection head; The backbone network is used to extract orientation-aware multi-scale feature maps, including a multi-scale orientation-gated convolution module and a local-global fusion module; the neck network uses a bidirectional feature fusion path of a high-resolution feature pyramid network to process the multi-scale feature maps and generate multi-scale fused feature maps; the detection head receives the multi-scale fused feature maps output by the neck network and detects ship targets at different scales.
3. The SAR ship detection method based on edge enhancement and contextual feature aggregation according to claim 2, characterized in that, The specific feature extraction process of the backbone network includes: First, feature extraction is performed on the input image using a multi-scale directional gated convolution module and a local-global fusion module to obtain feature map C2; Subsequently, the feature map C2 is processed by the first CBS module and the local-global fusion module to obtain the feature map C3; Next, feature map C3 is processed by the second CBS module and the local-global fusion module to obtain feature map C4; Finally, feature map C4 is processed by the third CBS module and the local-global fusion module to obtain feature map C5; The CBS module includes: a standard convolutional layer, a batch normalized layer, and a SiLU activation function.
4. The SAR ship detection method based on edge enhancement and contextual feature aggregation according to claim 3, characterized in that, The specific implementation process of the multi-scale directional gated convolution module includes: First, the input features are subjected to orientation-specific filling along different directions, and then the processed features are processed separately using multi-scale asymmetric convolution kernels through parallel convolution branches; Then, after the convolution kernel operation of each branch, batch normalization and SiLU activation function processing are performed to obtain fine directional features and coarse directional features; Next, a hierarchical gating fusion strategy is used to fuse the fine directional features and the coarse directional features to obtain fine fused features and coarse fused features; Finally, the fine-grained and coarse-grained features are concatenated and then subjected to 2×2 convolution to integrate cross-channel information and regularize the number of channels, outputting an enhanced feature map.
5. The SAR ship detection method based on edge enhancement and contextual feature aggregation according to claim 3, characterized in that, The local-to-global fusion module adopts a dual-branch parallel architecture, and its specific implementation process includes: The CBS module with convolutional branches processes the input features of the local-global fusion module to extract local features; The global context attention mechanism module with attention branch is used to process the input features of the local-global fusion module and extract global features; The local and global features are input into an adaptive gated fusion unit for processing to obtain fused features. Specifically, global average pooling is performed on the local and global features respectively, and after concatenation, they are interactively mapped through a 1×1 convolutional layer and the ReLU activation function. Finally, the Softmax function is used to generate normalized fusion weights. The fusion weights are multiplied by the local and global features channel by channel, and then the weighted feature maps are added element by element to obtain the final fused features.
6. The SAR ship detection method based on edge enhancement and contextual feature aggregation according to claim 5, characterized in that, The specific process of the global context attention mechanism module includes: The input feature map is mapped into query vector, key vector, and value vector, respectively. The query vector and key vector are input into the spatial attention branch and the channel attention branch respectively for processing to obtain the query weight and key weight. The query weight and key weight are combined by addition, and then multiplied by the value vector after linear transformation to obtain the final output feature; Specifically, the spatial attention branch is processed using 5×5 depthwise convolution, batch normalization, GELU activation function, and sigmoid activation function to generate spatial attention weights; the channel attention branch is processed using global adaptive average pooling, 1×1 convolution, GELU activation function, and sigmoid activation function to generate channel attention weights.
7. The SAR ship detection method based on edge enhancement and contextual feature aggregation according to claim 2, characterized in that, The specific process by which the neck network generates multi-scale fused feature maps using a high-resolution feature pyramid network includes: The feature map C5 output from the backbone network is input into the spatial pyramid pooling module to generate feature map P5. Feature map P5 is first upsampled and then concatenated with feature map C4. After concatenation, feature fusion is performed by the first C3K2 module to generate feature map P4. Feature map P4 is upsampled a second time and then concatenated with feature map C3. After concatenation, feature fusion is performed by the second C3K2 module to generate feature map P3. Feature map P3 is upsampled in the third step and then concatenated with feature map C2. After concatenation, feature fusion is performed by the third C3K2 module to generate feature map N2. Feature map N2 is extracted by the fourth CBS module and then concatenated with feature map P3. After concatenation, feature fusion is performed by the fourth C2K2 module to obtain feature map N3. Feature map N3 is extracted by the fifth CBS module and then concatenated with feature map P4. After concatenation, feature fusion is performed by the fifth C3K2 module to obtain feature map N4. Feature map N4 is processed by the sixth CBS module to extract features, and then concatenated with feature map P5. After concatenation, feature fusion is performed by the sixth C3K2 module to obtain feature map N5.
8. The SAR ship detection method based on edge enhancement and contextual feature aggregation according to claim 1, characterized in that, The loss function includes classification loss and regression loss; wherein the classification loss uses the binary cross-entropy loss function, and the regression loss uses the CIoU loss function.
9. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing program code that, when executed by the processor, causes the processor to perform the steps of the SAR ship detection method based on edge enhancement and context feature aggregation as described in any one of claims 1 to 8.
10. A storage medium, characterized in that, The system stores a computer program or instructions that, when executed on a computer, perform the steps of the SAR ship detection method based on edge enhancement and context feature aggregation as described in any one of claims 1 to 8.