A multi-scale feature enhanced deep learning SAR ship detection method
By designing a multi-scale feature enhancement SAR ship detection method, employing MPFEBackbone and a hybrid feature attention module, and combining it with the Wise-IOU loss function, the method solves the feature generalization and accuracy problems of SAR image detection models in complex scenes, and achieves efficient ship target detection.
Patent Information
- Application Number
- CN202410654998.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-05-24
AI Technical Summary
Existing SAR image detection models have poor feature generalization ability and low detection accuracy in complex scenes, especially for small and dense targets, and are difficult to accurately distinguish and locate ship targets under multi-scale changes.
A multi-scale feature enhancement deep learning method is adopted to design the multi-scale sensing SAR ship feature extraction backbone MPFEBackbone. Combined with the hybrid feature attention module and the dynamic non-monotonic focusing loss function Wise-IOU, the MHF-SARNet ship target detection model is constructed, and the detection accuracy is improved through iterative training.
It improves the recognition rate and detection accuracy of ship targets, reduces the computational resource requirements, adapts to the actual application of mobile terminals, enhances the ability to recover from complex backgrounds, and improves the robustness and generalization ability of the model.
Smart Images

Figure CN118628905B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of SAR image target detection technology, and in particular to a multi-scale feature enhancement deep learning SAR ship detection method. Background Technology
[0002] Synthetic Aperture Radar (SAR) is characterized by its all-weather, all-day operation and ability to provide high-resolution images. Today, with the rapid development of SAR technology, it is widely used in various fields such as marine monitoring, ecological environment monitoring, major natural disaster monitoring, and resource exploration. Ship detection is essential for maritime management and military operations; however, due to the effects of scattering imaging mechanisms, speckle patterns, and sea clutter, detecting small and dense targets against complex backgrounds remains a challenging task.
[0003] In recent years, with the rapid development of deep learning (DL), convolutional neural networks (CNNs) have received widespread attention and research in target detection and recognition of SAR images due to their excellent feature extraction and processing capabilities. Currently, detection network models are mainly divided into single-stage detection networks and two-stage detection networks. Researchers have conducted extensive research based on these networks and achieved excellent results.
[0004] However, ship detection remains a significant challenge in practical applications. Due to the complexities of SAR imaging mechanisms and various factors, the influence of ocean surface fluctuations introduces substantial clutter and speckle noise, leading to false positives and false negatives, low detection accuracy, and poor feature generalization ability, especially for small targets. Therefore, the low-level feature saliency module still needs enhancement to distinguish ships from interference. Furthermore, accurate differentiation and localization are difficult for dense targets with large scale variations or near-shore ships, and there is a lack of global and contextual feature aggregation based on scattering mechanisms. Summary of the Invention
[0005] To address the issues of poor feature generalization and low detection accuracy in existing SAR image detection models under complex scenarios, this invention aims to provide a multi-scale feature-enhanced deep learning SAR ship detection method that improves detection accuracy, reduces the number of parameters, and saves computational resources to a greater extent.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a multi-scale feature-enhanced deep learning SAR ship detection method, which includes the following sequential steps:
[0007] (1) Preprocess the SAR ship detection data to obtain a dataset, and divide the dataset into a training dataset and a test dataset. The dataset includes SAR ship images in the near-shore area and sea area.
[0008] (2) Based on the YOLOv7 architecture, design the multi-scale sensing SAR ship feature extraction backbone MPFEBackbone, use hybrid feature attention to construct the neck network to focus effective features, reduce background noise, and form the MHF-SARNet ship target detection model.
[0009] (3) Based on the MHF-SARNet ship target detection model, the dynamic non-monotonic focusing loss function Wise-IOU is introduced as the bounding box regression loss;
[0010] (4) Input the training dataset into the MHF-SARNet ship target detection model for iterative training to obtain the trained MHF-SARNet ship target detection model.
[0011] (5) Input the image to be detected into the trained MHF-SARNet ship target detection model for detection and obtain the SAR ship target detection result.
[0012] In step (1), the preprocessing refers to horizontally flipping, randomly cropping, rotating and data augmenting the SAR ship image, and uniformly adjusting the SAR ship image to a size of 640*640 pixels.
[0013] In step (2), the multi-scale sensing SAR ship feature extraction backbone MPFEBackbone includes two CBH layers, four Bneck modules and one DSDC module;
[0014] The two CBH layers have the same structure. Each CBH layer consists of a 3×3 convolutional layer, a batch normalization layer, and a Hardswish activation function. First, the 3×3 convolutional layer transforms the input image. Then, the batch normalization layer standardizes the input distribution of each layer of the neural network. Finally, the HardSwish activation function propagates the gradient. The specific formula for the HardSwish activation function is as follows:
[0015]
[0016] In the formula, t is the input tensor;
[0017] The four Bneck modules include the first, second, third, and fourth Bneck modules, wherein the first, second, and third Bneck modules have the same structure; the first Bneck module includes two 1×1 ordinary convolutions and one 3×3 depthwise separable convolution, and the fourth Bneck module includes two 1×1 ordinary convolutions, one 3×3 depthwise separable convolution, and an SE attention mechanism.
[0018] The DSDC module includes three channel-wise convolutions, a concatenation module, a 1×1 pointwise convolution, and a SiLU activation function. The input feature map is fed into the three channel-wise convolutions, which are expanded with a rate of 1, 2, and 4 respectively. The SiLU activation function is used for feature mapping. The resulting feature maps are then concatenated, and a 1×1 pointwise convolution is used to obtain the output feature map.
[0019] The input image size is 640*640*1. First, it goes through two CBH layers for shallow feature extraction, resulting in a feature map of size 320*320*64. Then, it enters the first Bneck module, resulting in a feature map of size 160*160*128. Next, it enters the DSDC module, resulting in a feature map of size 160*160*256. After that, it goes through the second, third, and fourth Bneck modules, respectively, to obtain feature maps of sizes 80*80*512, 40*40*1024, and 20*20*1024.
[0020] In step (2), the construction of the neck network using hybrid feature attention specifically refers to: incorporating two hybrid feature attention modules, namely the HFAM module, into the neck network, and replacing the 3×3 convolution module in the ELAN module of the YOLOv7 network model with the GSConv module;
[0021] For the HFAM module, a 1×1 convolution is first used to change the number of channels. Then, it splits into two branches. The first branch is a multi-head attention mechanism, using two heads. For each head, a linear transformation W is applied. Q W K W V Get query q i , key k i Sum V i Where i represents the head index, i∈{1,2}, calculate the attention score matrix Z. i :
[0022] Z i =Softmax(q i ×k i T +q i ×(R h +R w )T V i
[0023] In the formula, R h and R w These represent relative information in the vertical and horizontal directions, respectively.
[0024] The softmax function is used to transform an input vector into a probability distribution, such that all output probability values are between 0 and 1.
[0025]
[0026] In the formula, z i Let c be the output value of the i-th node, and c be the number of output nodes.
[0027] Finally, the attention score matrices of the two heads are concatenated and mapped back to the dimension of the original feature vectors through a linear transformation Wo, resulting in the final output feature map Z:
[0028] Z = [Z1:Z2]W o
[0029] Z1 and Z2 refer to the output feature maps of the two heads, respectively;
[0030] The second branch is a concatenation of a spatial attention mechanism and a channel attention mechanism. First, the spatial attention mechanism is divided into two branches: the first branch consists of a max-pooling layer followed by a fully connected layer; the second branch consists of an average-pooling layer followed by a fully connected layer. The outputs of these two branches are summed and merged into a single branch. Then, after passing through a sigmoid activation function, the output channel attention weights Wc∈R are determined. C×1×1 C represents the number of channels. The channel attention weights Wc are multiplied by the input feature map X to obtain the output matrix F. c :
[0031] W c =σ(MLP(AvgPool(X))+σ(MLP(MaxPool(X))))
[0032] F c =W c ·X
[0033] The channel attention mechanism is also divided into two branches: the first is a max pooling layer, and the second is an average pooling layer. The outputs of these two branches are concatenated, passed through a 7x7 convolutional layer, and then through a sigmoid activation function, with the output spatial attention weights W. s ∈R 1×W×H W is the width of the feature map, and H is the height of the feature map. s *F cThe output matrix F is obtained. s :
[0034] W s =σ(f 7*7 (AvgPool(F c ),MaxPool(F c )))
[0035] F s =W s ·F c
[0036] Finally, the first and second branches are concatenated, and the number of channels is restored by a 1*1 convolution to obtain the final output result.
[0037] Step (3) specifically refers to: using the Wise-IOU loss function as the bounding box regression loss function, the formula of which is as follows:
[0038]
[0039] L IOU =1-IOU
[0040]
[0041] WIOU=rR IOU L IOU
[0042] In the formula, (x,y) represents the coordinates of the center point of the predicted bounding box, (x... gt ,y gt ) refers to the coordinates of the center point of the actual bounding box; R WIOU ∈[1, e), L IOU ∈[0,1], e is approximately equal to 2, * represents the separation operation; IOU is the intersection-union ratio of the ground truth bounding box and the predicted bounding box, Wg and Hg are the width and height of the matrix formed by the union of the ground truth bounding box and the predicted bounding box, respectively, δ and α are both hyperparameters; r refers to the non-monotonic focusing coefficient;
[0043] In Wise-IOU, an outlier β is added to describe anchor frame quality.
[0044]
[0045] In the formula, L * IOU For L IOU Perform the separation operation;
[0046] The lower the outlier β of the anchor frame, the higher the quality of the anchor frame, and the smaller the gradient gain is assigned to the anchor frame; conversely, the higher the outlier β of the anchor frame, the lower the quality of the anchor frame, and the smaller the gradient gain is assigned to the anchor frame.
[0047] As can be seen from the above technical solution, the beneficial effects of the present invention are as follows: First, the multi-scale sensing SAR ship feature extraction backbone MPFEBackbone of the present invention adopts an efficient bottleneck structure and inverse residual network, combined with depthwise separable convolution, which reduces parameters and computational requirements while improving the recognition rate of ship targets. It is an important way to solve resource constraints and adapt to the actual application needs of mobile terminals. Second, by incorporating depthwise separable extended convolutional structures with expansion rates of 1, 2, and 4 into the multi-scale sensing SAR ship feature extraction backbone MPFEBackbone to increase different receptive fields, the performance is superior in multi-scale target scenarios, and the ship recognition rate is higher. Third, in SAR ship detection tasks, ships are usually affected by coherent speckle noise and clutter. To address the background complexity problem in SAR ship detection, a hybrid feature attention module is introduced. By fusing multi-head self-attention and spatial and channel attention mechanisms, it enriches the captured detailed information while incorporating a global dependency feature, greatly enhancing the model's ability to recover from complex background interference and improving ship detection accuracy, making it a major advancement in this field. Attached Figure Description
[0048] Figure 1 This is a flowchart of the method of the present invention;
[0049] Figure 2 This is a structural diagram of the MHF-SARNet ship target detection model in this invention;
[0050] Figure 3 This is a schematic diagram comparing the detection performance of the present invention with that of the original YOLOv7 model. Detailed Implementation
[0051] like Figure 1 As shown, a multi-scale feature-enhanced deep learning SAR ship detection method is proposed, which includes the following sequential steps:
[0052] (1) Preprocess the SAR ship detection data to obtain a dataset, and divide the dataset into a training dataset and a test dataset. The dataset includes SAR ship images in the near-shore area and sea area.
[0053] (2) Based on the YOLOv7 architecture, design the multi-scale sensing SAR ship feature extraction backbone MPFEBackbone, use hybrid feature attention to construct the neck network to focus effective features, reduce background noise, and form the MHF-SARNet ship target detection model.
[0054] (3) Based on the MHF-SARNet ship target detection model, the dynamic non-monotonic focusing loss function Wise-IOU is introduced as the bounding box regression loss;
[0055] (4) Input the training dataset into the MHF-SARNet ship target detection model for iterative training to obtain the trained MHF-SARNet ship target detection model.
[0056] (5) Input the image to be detected into the trained MHF-SARNet ship target detection model for detection and obtain the SAR ship target detection result.
[0057] In step (1), the SAR ship images are horizontally flipped, randomly cropped, rotated, and data augmented, and then uniformly adjusted to a size of 640*640 pixels. The dataset used is the SAR Ship Detection Dataset (SSDD). For the 1160 samples in the SAR Ship Detection Dataset, it is divided into training dataset and test dataset in an 8:2 ratio.
[0058] like Figure 2 As shown, in step (2), the multi-scale sensing SAR ship feature extraction backbone MPFEBackbone includes two CBH layers, four Bneck modules, and one DSDC module; the overall structure of MPFEBackbone is shown in Table 1 below:
[0059] Table 1
[0060]
[0061]
[0062] The two CBH layers have the same structure. Each CBH layer consists of a 3×3 convolutional layer, a batch normalization layer, and a Hardswish activation function. In the shallow layers of the network, low-level feature extraction is typically required from the original SAR image to capture local features such as shape and texture. This invention uses CBH layers for shallow feature extraction. First, a 3×3 convolutional layer transforms the input image. Then, a batch normalization layer standardizes the input distribution of each layer of the neural network. Finally, the HardSwish activation function propagates the gradient. The specific formula for the HardSwish activation function is as follows:
[0063]
[0064] In the formula, t is the input tensor;
[0065] The four Bneck modules include the first, second, third, and fourth Bneck modules, with the first, second, and third Bneck modules having identical structures. The first Bneck module includes two 1×1 ordinary convolutions and one 3×3 depthwise separable convolution, while the fourth Bneck module includes two 1×1 ordinary convolutions, one 3×3 depthwise separable convolution, and an SE attention mechanism. The Bneck module is essentially a reverse residual network structure, and the depthwise separable convolution is key to the module's lightweight design. First, the input features are expanded using 1×1 pointwise convolutions to compensate for the insufficient feature information acquisition caused by the small size of the input feature map. Then, feature extraction is performed using 3×3 depthwise convolutions. Afterward, the channels are compressed again using 1×1 pointwise convolutions. Finally, a residual connection is derived from the pointwise convolutions and concatenated with the compressed convolution result to obtain the final result. The multi-scale perceptual feature extraction backbone network also incorporates an SE attention mechanism in the residual link, thereby enhancing the network's learning ability through compression and activation. Since the number of channels in the backbone C7 layer reaches its maximum after the channels are expanded, only the SE attention mechanism in the C7 layer is retained in order to balance network performance and computational complexity.
[0066] The DSDC module comprises three channel-wise convolutions, a concatenation module, a 1×1 pointwise convolution, and a SiLU activation function. The input feature map is fed into the three channel-wise convolutions, which are expanded with scaling factors of 1, 2, and 4 respectively. Feature mapping is then performed using the SiLU activation function. The resulting feature maps are then concatenated, and a 1×1 pointwise convolution is applied to obtain the output feature map. The DSDC module utilizes different dilation rates to expand the receptive field while preserving local details, effectively capturing feature information of targets at different scales. The DSDC module constructs a multi-flow path structure through expanded convolutions, improving the network's ability to detect targets at different scales while maintaining resolution. In the channel-wise convolution stage of depthwise separable convolutions, for small targets, a channel-wise convolution with a scaling factor of 1 is retained, while channel-wise convolutions with scaling factors of 2 and 4 are used to increase the receptive field, thereby capturing feature information of large-scale targets.
[0067] The input image size is 640*640*1. First, it goes through two CBH layers for shallow feature extraction, resulting in a feature map of size 320*320*64. Then, it enters the first Bneck module, resulting in a feature map of size 160*160*128. Next, it enters the DSDC module, resulting in a feature map of size 160*160*256. After that, it goes through the second, third, and fourth Bneck modules, respectively, to obtain feature maps of sizes 80*80*512, 40*40*1024, and 20*20*1024.
[0068] like Figure 2As shown, in step (2), the construction of the neck network using hybrid feature attention specifically refers to: incorporating two hybrid feature attention modules, namely the HFAM module, into the neck network, and replacing the 3×3 convolution module in the ELAN module of the YOLOv7 network model with the GSConv module.
[0069] Two main design considerations were taken into account in the neck network:
[0070] First, there are two HFAM modules, namely the first HFAM module and the second HFAM module. The first HFAM module is connected to a branch with a feature map size of 80*80*512 derived from the C5 layer of MPFEBackbone. The second HFAM module is connected to a branch with a feature map size of 40*40*1024 derived from the C6 layer of MPFEBackbone. The branch with a feature map size of 20*20*1024 derived from the C7 layer of MPFEBackbone is connected to the SPPCSPC module of the YOLOv7 network model.
[0071] Second, while adding two HFAM modules to the multi-scale perceptual feature extraction backbone network improves the detection capability of targets in complex backgrounds, there is still room for optimization of the model training parameters. Therefore, this invention replaces the 3×3 convolutional module in the ELAN module of the YOLOv7 network model with the GSConv module to achieve a lighter weight. After the feature map enters the GSConv module, it first undergoes channel dimensionality reduction through a 1×1 convolution, followed by depthwise separable convolution. Then, the results of ordinary convolution and depthwise separable convolution are concatenated and shuffled, thereby permeating the feature information generated by traditional convolution into various parts of the information generated by depthwise separable convolution, effectively preserving multi-channel information while reducing computational load.
[0072] The HFAM module primarily utilizes a synergistic effect of multi-head self-attention, channel attention, and spatial attention mechanisms. First, a multi-head self-attention path is used to construct long-range dependencies between different pixels. The HFAM module employs two attention heads to balance accuracy and parameter count, with each head independently calculating an attention score. For the HFAM module, a 1×1 convolution is first used to change the number of channels and reduce computational cost. Then, it branches into two branches. The first branch is the multi-head attention mechanism, employing two heads. For each head, a linear transformation W is used... Q W K W V Get query q i , key k i Sum V i Where i represents the head index, i∈{1,2}, calculate the attention score matrix Z. i :
[0073] Zi =Softmax(q i ×k i T +q i ×(R h +R w ) T V i
[0074] In the formula, R h and R w These represent relative information in the vertical and horizontal directions, respectively.
[0075] The softmax function is used to transform an input vector into a probability distribution, such that all output probability values are between 0 and 1.
[0076]
[0077] In the formula, z i Let c be the output value of the i-th node, and c be the number of output nodes.
[0078] Finally, the attention score matrices of the two heads are concatenated and mapped back to the dimension of the original feature vectors through a linear transformation Wo, resulting in the final output feature map Z:
[0079] Z = [Z1:Z2]W o
[0080] Z1 and Z2 refer to the output feature maps of the two heads, respectively;
[0081] The second branch is a concatenation of a spatial attention mechanism and a channel attention mechanism. First, the spatial attention mechanism is divided into two branches: the first branch consists of a max-pooling layer followed by a fully connected layer; the second branch consists of an average-pooling layer followed by a fully connected layer. The outputs of these two branches are summed and merged into a single branch. Then, after passing through a sigmoid activation function, the output channel attention weights Wc∈R are determined. C×1×1 C represents the number of channels. The channel attention weights Wc are multiplied by the input feature map X to obtain the output matrix F. c :
[0082] W c =σ(MLP(AvgPool(X))+σ(MLP(MaxPool(X))))
[0083] F c =W c ·X
[0084] The channel attention mechanism is also divided into two branches: the first is a max pooling layer, and the second is an average pooling layer. The outputs of these two branches are concatenated, passed through a 7x7 convolutional layer, and then through a sigmoid activation function, with the output spatial attention weights W. s ∈R 1×W×H W is the width of the feature map, and H is the height of the feature map. s *F c The output matrix F is obtained. s :
[0085] W s =σ(f 7*7 (AvgPool(F c ),MaxPool(F c )))
[0086] F s =W s ·F c
[0087] Finally, the first and second branches are concatenated, and the number of channels is restored by a 1*1 convolution to obtain the final output result, making the features complementary and thus enriching the details and global information.
[0088] Step (3) specifically refers to: using the Wise-IOU loss function as the bounding box regression loss function, the formula of which is as follows:
[0089]
[0090] L IOU =1-IOU
[0091]
[0092] WIOU=rR IOU L IOU
[0093] In the formula, (x,y) represents the coordinates of the center point of the predicted bounding box, (x... gt ,y gt ) refers to the coordinates of the center point of the actual bounding box; R WIOU ∈[1, e), L IOU ∈[0,1], e is approximately equal to 2, * represents the separation operation; IOU is the intersection-union ratio of the ground truth bounding box and the predicted bounding box, Wg and Hg are the width and height of the matrix formed by the union of the ground truth bounding box and the predicted bounding box, respectively, δ and α are both hyperparameters; r refers to the non-monotonic focusing coefficient;
[0094] In Wise-IOU, an outlier β is added to describe anchor frame quality.
[0095]
[0096] In the formula, L * IOU For L IOU Perform the separation operation;
[0097] The lower the outlier β of the anchor frame, the higher the quality of the anchor frame, and a smaller gradient gain is assigned to the anchor frame; conversely, when the outlier β of the anchor frame is high, the lower the quality of the anchor frame, and a smaller gradient gain is assigned to the anchor frame, thereby reducing the harmful gradients generated by low-quality anchor frames.
[0098] The MHF-SARNet ship target detection model incorporates multiple target feature enhancement strategies to improve the detection capability of ship targets in SAR images. Firstly, for the backbone network, considering the characteristics of SAR ship images, a multi-scale sensing SAR ship feature extraction backbone (MPFEBackbone) is designed, primarily to extend the depth of the input image and extract multi-scale scattering features. After extracting the backbone network feature maps, the HFAM module is used for further feature filtering. Combining the advantages of spatial channel attention and self-attention, global dependencies are established to improve the model's ability to distinguish target features from background noise. Then, the feature maps are fully integrated into the lightweight neckline. Finally, Wise-IOU is used as the bounding box loss to further improve the model's robustness and generalization ability.
[0099] This invention uses mean precision (mAP) and parameters as evaluation metrics. mAP is the region enclosed by the precision-recall curve, and the formula is as follows:
[0100]
[0101]
[0102]
[0103] Among them, TP refers to true positive; FP refers to false positive; and FN refers to false negative.
[0104] To test the ship detection capability of this invention in SAR images, relevant metrics were calculated for both the existing YOLOv7 network model and this invention. All experiments were implemented on an Ubuntu 22.04 system using the PyTorch DL framework, with an NVIDIA GeForce RTX 4080 and CUDA 12.2 hardware configuration. The batch size was set to 8, and the training image size was 640×640. Furthermore, the model of this invention was trained from scratch without loading pre-trained weights, with an initial learning rate of 0.01. The comparison results of relevant metrics between existing technologies and this invention are shown in Table 1.
[0105] method mAP(%) Parameters (M) Existing detection technology (Yolov7) 93.4 37.2 The model of this invention is MHF-SARNet 96.8 32.1
[0106] As can be seen, compared with the baseline model, the MHF-SARNet ship target detection model improves the average accuracy (mAP50) by 3.4% and reduces the number of parameters by 5.1M. This demonstrates that the present invention is more feasible and superior to existing technologies.
[0107] To more intuitively illustrate the advantages of the MHF-SARNet ship target detection model, detection results in different scenarios are presented, such as... Figure 3 As shown, Figure 3 Yellow circles indicate missed detections, blue circles indicate false alarms, green boxes are true labeled boxes, and red boxes are correctly detected boxes. Compared with YOLOv7, this invention can more effectively extract SAR ship target and background features, effectively alleviating the problems of missed detections and false detections in scenarios such as SAR ship target scale changes and complex backgrounds.
[0108] In summary, the backbone network of the MHF-SARNet ship target detection model of this invention adopts an efficient bottleneck structure and an inverse residual network, combined with depthwise separable convolutions. This reduces parameters and computational requirements while improving the ship target recognition rate, making it an important approach to address resource constraints and adapt to the practical application needs of mobile terminals. By incorporating depthwise separable extended convolutional structures with expansion rates of 1, 2, and 4 into the MPFEBackbone of the MHF-SARNet ship target detection model's backbone network to increase different receptive fields, the model exhibits superior performance and a higher ship recognition rate in multi-scale target scenarios. In SAR ship detection tasks, ships are typically affected by coherent speckle noise and clutter. To address the background complexity issue in SAR ship detection, a hybrid feature attention module is introduced. By fusing multi-head self-attention with spatial and channel attention mechanisms, a globally dependent feature is incorporated while enriching the captured detailed information, significantly enhancing the model's ability to recover from complex background interference and improving ship detection accuracy, making it a major advancement in this field.
Claims
1. A multi-scale feature-enhanced deep learning SAR ship detection method, characterized in that: The method includes the following steps in sequence: (1) Preprocess the SAR ship detection data to obtain a dataset, and divide the dataset into a training dataset and a test dataset. The dataset includes SAR ship images in the near coast and sea areas. (2) Based on the YOLOv7 architecture, a multi-scale sensing SAR ship feature extraction backbone MPFEBackbone was designed. Hybrid feature attention was used to construct a neck network, focusing on effective features, reducing background noise, and forming an MHF-SARNet ship target detection model. (3) Based on the MHF-SARNet ship target detection model, the dynamic non-monotonic focusing loss function Wise-IOU is introduced as the bounding box regression loss; (4) Input the training dataset into the MHF-SARNet ship target detection model for iterative training to obtain the trained MHF-SARNet ship target detection model; (5) Input the image to be detected into the trained MHF-SARNet ship target detection model for detection, and obtain the SAR ship target detection result; In step (2), the construction of the neck network using hybrid feature attention specifically refers to: incorporating two hybrid feature attention modules, namely the HFAM module, into the neck network, and replacing the 3×3 convolution module in the ELAN module of the YOLOv7 network model with the GSConv module; For the HFAM module, a 1×1 convolution is first used to change the number of channels. Then, it splits into two branches. The first branch is a multi-head attention mechanism, using two heads. For each head, a linear transformation W is applied. Q W K W V Get query q i , key k i Sum V i Where i represents the head index, i∈{1,2}, calculate the attention score matrix Z. i : , In the formula, R h and R w These represent relative information in the vertical and horizontal directions, respectively. The softmax function is used to transform an input vector into a probability distribution, such that all output probability values are between 0 and 1. , In the formula, Let c be the output value of the i-th node, and c be the number of output nodes. Finally, the attention score matrices of the two heads are concatenated and mapped back to the dimension of the original feature vectors through a linear transformation Wo, resulting in the final output feature map Z: , Z1 and Z2 refer to the output feature maps of the two heads, respectively; The second branch is a concatenation of a spatial attention mechanism and a channel attention mechanism. First, the spatial attention mechanism is divided into two branches: the first branch consists of a max-pooling layer followed by a fully connected layer; the second branch consists of an average-pooling layer followed by a fully connected layer. The outputs of these two branches are summed and merged into a single branch. Then, after passing through a sigmoid activation function, the output channel attention weights Wc∈R are determined. C×1×1 C represents the number of channels. The channel attention weights Wc are multiplied by the input feature map X to obtain the output matrix F. c : , , The channel attention mechanism is also divided into two branches: the first is a max pooling layer, and the second is an average pooling layer. The outputs of these two branches are concatenated, passed through a 7x7 convolutional layer, and then through a sigmoid activation function, with the output spatial attention weights W. s ∈R 1×W×H W is the width of the feature map, and H is the height of the feature map. s *F c The output matrix F is obtained. s : , , Finally, the first and second branches are concatenated, and the number of channels is restored by a 1*1 convolution to obtain the final output result.
2. The multi-scale feature-enhanced deep learning SAR ship detection method according to claim 1, characterized in that: In step (1), the preprocessing refers to horizontally flipping, randomly cropping, rotating and data augmenting the SAR ship image, and uniformly adjusting the SAR ship image to a size of 640*640 pixels.
3. The multi-scale feature-enhanced deep learning SAR ship detection method according to claim 1, characterized in that: In step (2), the multi-scale sensing SAR ship feature extraction backbone MPFEBackbone includes two CBH layers, four Bneck modules and one DSDC module; The two CBH layers have the same structure. Each CBH layer consists of a 3×3 convolutional layer, a batch normalization layer, and a Hardswish activation function. First, the 3×3 convolutional layer transforms the input image. Then, the batch normalization layer standardizes the input distribution of each layer of the neural network. Finally, the HardSwish activation function propagates the gradient. The specific formula for the HardSwish activation function is as follows: , In the formula, t is the input tensor; The four Bneck modules include the first, second, third, and fourth Bneck modules, wherein the first, second, and third Bneck modules have the same structure; the first Bneck module includes two 1×1 ordinary convolutions and one 3×3 depthwise separable convolution, and the fourth Bneck module includes two 1×1 ordinary convolutions, one 3×3 depthwise separable convolution, and an SE attention mechanism. The DSDC module includes three channel-wise convolutions, a concatenation module, a 1×1 pointwise convolution, and a SiLU activation function. The input feature map is fed into the three channel-wise convolutions, which are expanded with a rate of 1, 2, and 4 respectively. The SiLU activation function is used for feature mapping. The resulting feature maps are then concatenated, and a 1×1 pointwise convolution is used to obtain the output feature map. The input image size is 640*640*1. First, it goes through two CBH layers for shallow feature extraction, resulting in a feature map of size 320*320*64. Then, it enters the first Bneck module, resulting in a feature map of size 160*160*128. Next, it enters the DSDC module, resulting in a feature map of size 160*160*256. After that, it goes through the second, third, and fourth Bneck modules, respectively, to obtain feature maps of sizes 80*80*512, 40*40*1024, and 20*20*1024.
4. The multi-scale feature-enhanced deep learning SAR ship detection method according to claim 1, characterized in that: Step (3) specifically refers to: using the Wise-IOU loss function as the bounding box regression loss function, the formula of which is as follows: , , , , In the formula, (x,y) represents the coordinates of the center point of the predicted bounding box, (x,y) gt ,y gt ) refers to the coordinates of the center point of the actual bounding box; R WIOU ∈[1, e), L IOU ∈[0,1], e is approximately equal to 2, and * represents the split operation; IOU is the intersection-union ratio of the ground truth bounding boxes and the predicted bounding boxes, Wg and Hg are the width and height of the matrix formed by the union of the ground truth bounding boxes and the predicted bounding boxes, respectively, δ and α are hyperparameters; r refers to the non-monotonic focusing coefficient. In Wise-IOU, an outlier β is added to describe anchor frame quality. , In the formula, L * IOU For L IOU Perform the separation operation; The lower the outlier β of the anchor frame, the higher the quality of the anchor frame, and the smaller the gradient gain is assigned to the anchor frame; conversely, the higher the outlier β of the anchor frame, the lower the quality of the anchor frame, and the smaller the gradient gain is assigned to the anchor frame.
