A SAR ship detection method based on attention mechanism and multi-scale feature fusion
By constructing a SAR ship detection method based on attention mechanism and multi-scale feature fusion, the problem of multi-scale ship detection in complex backgrounds of SAR images is solved, high-precision detection of small targets is achieved, and the performance of the detector in complex backgrounds is improved.
Patent Information
- Application Number
- CN202410686317.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2044-05-29
AI Technical Summary
Existing SAR image small target detection methods have poor detection accuracy in complex backgrounds, are difficult to effectively extract multi-scale ship features, and are affected by background clutter and noise, resulting in unsatisfactory detection results.
A SAR ship detection method based on attention mechanism and multi-scale feature fusion is adopted. By constructing a target detection network, including the backbone network of CSPDarknet53 architecture, the attention feature fusion network WEF-Net and the prediction head, the loss function is optimized to improve the detection accuracy by using the Balanced Feature Module (BFM) and the Feature Enhancement Fusion Module (FEF), combined with the coordinated attention mechanism and the multi-receptive field extension module.
It effectively suppresses interference from complex backgrounds, enhances the focus on ship targets, and improves the accuracy and precision of multi-scale ship detection, especially in small target detection. The optimized loss function further enhances the detection performance.
Smart Images

Figure CN118675046B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of SAR image target detection technology, and in particular to a SAR ship detection method based on attention mechanism and multi-scale feature fusion. Background Technology
[0002] Maritime ship target detection is widely used not only in the civilian sector but also plays a crucial role in the military field. Therefore, the use of Synthetic Aperture Radar (SAR) imagery for maritime ship target detection has received considerable attention from all parties.
[0003] However, due to the characteristics of SAR imaging, targets in SAR images account for a very small proportion and are very small in size. Furthermore, synthetic aperture radar (SAR) suffers from scattering effects and resolution limitations due to wavelength and antenna size, making it difficult to acquire details and boundary information of small targets, thus affecting detection accuracy. Current research on deep learning for small target detection in SAR images is limited and yields unsatisfactory results.
[0004] In addition, compared to optical remote sensing images, SAR images acquired from satellites and airborne platforms typically have lower resolution and are more susceptible to background clutter and noise. This is because:
[0005] (1) SAR images have complex backgrounds. Due to the influence of factors such as SAR clutter, imaging principles, and ground structure, existing detection methods have difficulty distinguishing between targets and backgrounds.
[0006] (2) The proportion of ships in SAR images, especially small ships, varies greatly. Due to the diversity of ship scales in SAR images, existing methods are difficult to effectively extract ship features from SAR images.
[0007] Therefore, detecting multi-scale ships in complex background clutter remains a significant challenge. Summary of the Invention
[0008] In order to accurately detect multi-scale ships in complex background clutter, this invention provides a SAR ship detection method based on attention mechanism and multi-scale feature fusion, which can effectively detect SAR multi-scale ship targets in complex backgrounds.
[0009] This invention provides a SAR ship detection method based on attention mechanism and multi-scale feature fusion, comprising:
[0010] Step 1: Construct a target detection network, which includes a backbone network based on the CSPDarknet53 architecture, an attention-based feature fusion network WEF-Net, and a prediction head. The backbone network extracts features from the input SAR image to generate feature maps of different sizes. The WEF-Net includes a Balanced Feature Mechanism (BFM) module and a Feature Enhancement Fusion (FEF) module. The BFM includes a Coordinating Attention Mechanism (CA) module to process the feature maps of different sizes output by the backbone network based on the attention mechanism to generate global features with a balanced receptive field. The FEF module balances the semantic information at different levels of the feature pyramid based on the feature maps of different sizes output by the backbone network and the global features output by the BFM to generate fused feature maps of different sizes. The prediction head performs ship detection based on the fused feature maps of different sizes output by the FEF module to obtain the detection results.
[0011] Step 2: Train the target detection network to obtain a trained target detection model;
[0012] Step 3: Input the SAR image to be detected into the trained target detection model to obtain the detection results.
[0013] In this implementation, WEF-Net acts as the neck network, balancing feature maps of different resolutions in deep and shallow layers. Since different feature maps contribute differently to the overall detection process, WEF-Net balances the proportion of positional information across different layers and channels to improve information effectiveness and reduce redundancy, thus balancing semantic information and resolution across different layers.
[0014] Furthermore, the BFM includes a first balanced branch, a second balanced branch, a third balanced branch, and a weighted feature fusion (WFF) module; wherein, the first balanced branch includes a multi-receptive field extension module (MRFFM) and an upsampling operation, the second balanced branch includes a CA module, and the third balanced branch includes a CA module and a max pooling operation;
[0015] Correspondingly, the BFM generates global features with receptive field balance based on feature maps of different sizes output by the backbone network, specifically including:
[0016]
[0017] Where w1, w2, and w3 represent the learnable weight parameters of the WFF module, △ represents a small number used to avoid numerical instability; Ci are feature maps of different sizes output by the backbone network, i = 2, 3, 4; UpSample represents the upsampling operation, MP represents the max pooling operation, CA represents the coordinated attention mechanism module, and F represents the global features generated by BFM.
[0018] Furthermore, the FEF module includes a multi-receptive field extension module (MRFFM), a first enhancement branch, a second enhancement branch, and a third enhancement branch; wherein, the first enhancement branch includes max pooling operation, a weighted feature fusion (WFF) module, an ELAN module, and a reparameterized convolution (RepConv); the second enhancement branch includes a WFF module, an ELAN module, and RepConv; and the third enhancement branch includes upsampling operation, a WFF module, an ELAN module, and RepConv.
[0019] Correspondingly, the FEF module balances the semantic information at different levels of the feature pyramid based on the feature maps of different sizes output by the backbone network and the global features output by BFM to generate fused feature maps of different sizes, specifically including:
[0020]
[0021]
[0022]
[0023] Among them, w xy The learnable weight parameters of the WFF module are represented by x = 1, 2, 3 and y = 1, 2. △ represents a small number used to avoid numerical instability. Ci represents feature maps of different sizes output by the backbone network, and Pi represents fused feature maps of different sizes output by the FEF module, i = 2, 3, 4. UpSample represents the upsampling module, MP represents the max pooling operation, F represents the global features output by BFM, E represents the ELAN module, and Rep represents RepConv.
[0024] Furthermore, the MRFFM process for processing the input feature map includes:
[0025]
[0026]
[0027]
[0028] P = Conv 1×1 [R1,R2,R3,X]
[0029] Where P is the output feature map of MRFFM, X represents the input feature map, Ri represents the intermediate variable, and i = 1, 2, 3; and Three 3×3 dilated convolutions with different dilation rates, Conv 1×1 It is a 1×1 standard convolution, and [·] represents the channel concatenation operation.
[0030] Furthermore, the ELAN module includes a first branch, a second branch, and a CA module; wherein, the first branch includes a CBS module with a 1×1 convolution kernel, and the second branch includes a CBS module with a 1×1 convolution kernel and four CBS modules with a 3×3 convolution kernel connected in sequence.
[0031] Correspondingly, the ELAN module's processing of the input feature map includes:
[0032] First, the input feature maps are fed into the first branch and the second branch respectively. Then, the outputs of the first branch and the second branch are concatenated. The concatenated output is then passed through the CA module and a CBS module with a 1×1 convolution kernel to obtain the final output of the ELAN module.
[0033] In the implementation, considering the interference of the surrounding complex background on the detector, the ELAN module was redesigned by combining convolution and attention, so that it can enhance the model's attention to target location information during feature fusion through the attention mechanism.
[0034] Furthermore, the processing procedure of the CA module for the input feature map includes:
[0035] Global average pooling is performed on the input feature map X in both the horizontal and vertical directions according to the following formula, so that its size is compressed to 1×H×C and W×1×C respectively:
[0036]
[0037]
[0038] Where W, H, and C are the width, height, and number of channels of the input feature map X. and These represent the results of X-average pooling and Y-average pooling, respectively.
[0039] The results of average pooling in both directions are concatenated according to the following formula, then compressed to the number of channels C / r using a 1×1 convolution, followed by batch normalization and a sigmoid non-linear activation function to obtain intermediate variables:
[0040]
[0041] Among them, F v ∈R 1×(W+H)×C / r Representing intermediate variables, r represents the channel contraction rate, and Conv 1×1 σ represents a 1×1 standard convolution, σ represents the Sigmoid nonlinear activation function, BN represents batch normalization, and [·] represents channel concatenation.
[0042] The intermediate variable is split into two feature maps according to the following formula, and their respective weight matrices are generated. The input feature map X is then multiplied by the two weight matrices to obtain the output of the CA module:
[0043] F c (i,j)=X c (i,j)×σ(Conv 1×1 (F h ))×σ(Conv 1×1 (F w ))
[0044] Among them, F h and F w This represents two feature maps obtained by splitting the intermediate variable.
[0045] Furthermore, during the training process in step 2, the following formula is used as the loss function;
[0046] L CIoU-NWD = (1-λ)*(1-NWD)+λ*L CIOU
[0047] Where NWD represents the NWD loss function, L CIOU Let denot CIoU loss function, and λ denote a given balance factor.
[0048] Due to the imaging characteristics of SAR images, small targets account for a large proportion of the images. Therefore, in this embodiment, an optimized loss function is used to enhance the model's detection performance for small targets.
[0049] The beneficial effects of this invention are:
[0050] (1) An attention feature fusion network was designed to suppress the interference of complex backgrounds through the attention mechanism, so that the model pays more attention to the ship target. Furthermore, in this fusion network, a weighted feature fusion module and an improved ELAN module are embedded to better integrate feature information of different scales, and enhance and improve the fusion of multi-scale feature maps with complex backgrounds.
[0051] (2) A multi-receptive field extension module was designed to learn contextual information in order to build more expressive multi-scale features.
[0052] (3) Taking advantage of the CIoU and NWD loss functions, the loss function was optimized as a balance between bounding box regression accuracy and training convergence, which improved the detection accuracy of small ships.
[0053] (4) Experiments on the Synthetic Aperture Radar Ship Detection Dataset (SSDD), High Resolution Synthetic Aperture Radar Image Dataset (HRSID), and Large SAR Ship Detection Dataset (LS-SSDD-v1.0) show that the method of this invention has better performance in SAR image target detection compared with other algorithms. The ablation experiments demonstrate that each improved module proposed in this invention effectively improves detection accuracy. Therefore, the method proposed in this invention is more suitable for target detection in SAR images than existing target detection algorithms, and has significant practical implications for research on target detection in SAR images. Attached Figure Description
[0054] Figure 1 This is a schematic diagram of the overall network structure of the SAR ship detection method based on attention mechanism and multi-scale feature fusion according to an embodiment of the present invention;
[0055] Figure 2 This is a schematic diagram of the WEF-Net structure, provided in an embodiment of the present invention.
[0056] Figure 3 A schematic diagram of the redesigned ELAN module (ELAN-A) structure provided for an embodiment of the present invention;
[0057] Figure 4 This is a schematic diagram of the multi-receptive field extension module (MRFFM) structure provided in an embodiment of the present invention;
[0058] Figure 5 This is a schematic diagram of the Coordination Attention Mechanism (CA) module structure provided in an embodiment of the present invention;
[0059] Figure 6 The images show the detection results of the Synthetic Aperture Radar Ship Detection Dataset (SSDD) in different scenarios provided by the embodiments of the present invention; the yellow boxes represent false detections, and the green boxes represent false negatives; the first column is the original image, the second column is the detection result of the corresponding baseline (YOLOv7), and the third column is the detection result of the present invention; (a) is a sparse nearshore scene; (b) is a nearshore scene with complex background interference; (c) and (d) are dense nearshore scenes;
[0060] Figure 7 The following are the detection results of different scenes in the High Resolution Synthetic Aperture Radar Image Dataset (HRSID) provided by the embodiments of the present invention; the yellow box represents false detections and the green box represents false negatives; the first column is the original image, the second column is the detection result of the corresponding baseline (YOLOV7), and the third column is the detection result of the present invention; (a) is a sparse nearshore scene; (b) is a nearshore scene with complex background interference; (c) and (d) are dense nearshore scenes;
[0061] Figure 8The images show the detection results of the large-scale SAR ship detection dataset (LS-SSDD-v1.0) in different scenarios provided by the embodiments of the present invention; the yellow boxes represent false detections and the green boxes represent false negatives; the first column is the original image, the second column is the detection result of the corresponding baseline (YOLOV7), and the third column is the detection result of the present invention; (a) is a sparse nearshore scene; (b) is a nearshore scene with complex background interference; (c) is a nearshore scene in a narrow river; and (d) is a dense nearshore scene. Detailed Implementation
[0062] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of the embodiments of this invention will be clearly described below with reference to the accompanying drawings. 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.
[0063] Example 1
[0064] This invention provides a SAR ship detection method based on attention mechanism and multi-scale feature fusion, comprising the following steps:
[0065] S101: Construct a target detection network;
[0066] Specifically, such as Figure 1 As shown, the object detection network consists of three parts: a backbone network based on the CSPDarknet53 architecture, an attention feature fusion network WEF-Net, and a prediction head.
[0067] The backbone network extracts features from the input SAR image to generate feature maps of different sizes (in this embodiment, there are three different sizes of feature maps, which are C2, C3 and C4 from largest to smallest).
[0068] WEF-Net, acting as the neck of the backbone network, enhances and fuses multi-scale features output from the backbone network based on an attention mechanism, thereby balancing the features output from different levels of the backbone network. This WEF-Net includes a Balanced Feature Module (BFM) and a Feature Enhancement and Fusion Module (FEF). The BFM includes a Coordinating Attention Mechanism (CA) module to process feature maps of different sizes output from the backbone network based on the attention mechanism to generate globally balanced features. The FEF module balances the semantic information at different levels of the feature pyramid based on the feature maps of different sizes output from the backbone network and the global features output from the BFM to generate fused feature maps of different sizes (in this embodiment, three different sizes of fused feature maps are included, from largest to smallest: feature maps P2, P3, and P4). Figure 1(not shown in the image);
[0069] Correspondingly, in this example, there are a total of 3 prediction heads. These 3 prediction heads perform ship detection based on 3 fused feature maps of different sizes output by the FEF module, and obtain the detection results.
[0070] As one possible implementation method, such as Figure 2 As shown, this embodiment of the invention provides an attention feature fusion network WEF-Net, which includes a Balanced Feature Module (BFM) and a Feature Enhancement Fusion Module (FEF). The BFM network structure includes a first balanced branch, a second balanced branch, a third balanced branch, and a weighted feature fusion (WFF) module. The first balanced branch includes a Multi-Receptive Field Extension (MRFFM) module and an upsampling operation; the second balanced branch includes a Continuous Aspect Ratio (CA) module; and the third balanced branch includes a CA module and a max-pooling operation. Correspondingly, the BFM generates global features with balanced receptive fields based on feature maps of different sizes output by the backbone network, specifically including:
[0071]
[0072] Where w1, w2, and w3 represent the learnable weight parameters of the WFF module, △ represents a small number used to avoid numerical instability; Ci are feature maps of different sizes output by the backbone network, i = 2, 3, 4; UpSample represents the upsampling module, MP represents the max pooling operation, which can achieve the function of downsampling, CA represents the coordinated attention mechanism module, and F represents the global features generated by BFM.
[0073] Specifically, the last three feature maps C2, C3, and C4 output from the backbone network are used as input. First, the first balanced branch extracts features from feature map C4 using the multi-receptive field expansion module and performs upsampling to adjust it to the same shape as feature map C3. Then, the second balanced branch directly processes feature map C3 through the coordinated attention module. Next, the third balanced branch processes feature map C2 first through the coordinated attention module and then performs downsampling to adjust it to the same shape as feature map C3. Finally, the outputs of these three balanced branches are weighted and fused using the weighted feature fusion module to obtain global features, which are then used as input to the subsequent FEF module.
[0074] The FEF module includes a multi-receptive field extension module (MRFFM), a first enhancement branch, a second enhancement branch, and a third enhancement branch. The first enhancement branch includes max pooling, a weighted feature fusion (WFF) module, an ELAN module, and a reparameterized convolution (RepConv). The second enhancement branch includes a WFF module, an ELAN module, and RepConv. The third enhancement branch includes upsampling, a WFF module, an ELAN module, and RepConv.
[0075] Correspondingly, the FEF module balances the semantic information at different levels of the feature pyramid based on the feature maps of different sizes output by the backbone network and the global features output by BFM to generate fused feature maps of different sizes, specifically including:
[0076]
[0077]
[0078]
[0079] Among them, w xy The learnable weight parameters of the WFF module are represented by x = 1, 2, 3 and y = 1, 2. △ represents a small number used to avoid numerical instability. Ci represents feature maps of different sizes output by the backbone network, and Pi represents fused feature maps of different sizes output by the FEF module, i = 2, 3, 4. UpSample represents the upsampling module, MP represents the max pooling operation, which can achieve downsampling. F represents the global features output by BFM, E represents the ELAN module, and Rep represents RepConv.
[0080] Specifically, the global features output by BFM are used as input. First, the multi-receptive-field extension module is used to extract contextual features from this input. Then, the feature map output by the multi-receptive-field extension module is divided into two branches for upsampling and downsampling, respectively, so as to decompose it into feature maps with the same resolution as feature maps C2 and C4. Next, in the first and third enhancement branches, the WFF module is used to perform weighted feature fusion with feature map C2 of the same resolution, and the downsampling output is used to perform weighted feature fusion with feature map C4 of the same resolution, respectively. In the second enhancement branch, the WFF module is directly used to perform weighted feature fusion with feature map C3 of the same resolution. Finally, in the three branches, the output of the WFF module is passed through the ELAN module and the reparameterized convolution RepConv for feature learning in turn.
[0081] It should be noted that the WFF module in this embodiment of the invention is not a simple channel concatenation, but rather a weighted collaborative operation with a set of learnable weight parameters set for each feature map at different scales. For the Feature Enhancement Fusion (FEF) module, which only needs to fuse two feature maps, two learnable weights are assigned to the two feature maps to determine the importance of each feature map. The fusion formula is as follows:
[0082]
[0083] Where P is the feature after fusion of F1 and F2, F1 and F2 are two feature maps to be fused, w1 and w2 are learnable weights, and △ is a very small number used to avoid numerical instability.
[0084] Similarly, for the case of the Balanced Feature Module (BFM) fusing three feature maps, three learnable weights are assigned to the three feature maps to be fused, resulting in output features with rich contextual information. Through this operation, the importance of different feature maps during training can be distinguished, allowing the model to retain more important information about the target.
[0085]
[0086] Where P is the fused feature of F1, F2, and F3, F1, F2, and F3 are the three feature maps to be fused, w1, w2, and w3 are the learnable weights, and △ is a very small number used to avoid numerical instability.
[0087] S102: Train the target detection network to obtain a trained target detection model;
[0088] S103: Input the SAR image to be detected into the trained target detection model to obtain the detection result.
[0089] Example 2
[0090] Building upon the above embodiments, in order to learn more and better feature information, suppress complex background information, highlight ship target features, and improve detection performance, this embodiment further improves the existing ELAN module by hybridizing convolution and attention mechanisms to redesign a new ELAN module, which is then applied to WEF-Net. In this embodiment, this new ELAN module is referred to as the ELAN-A module, and its structure is as follows: Figure 3 As shown, it includes a first branch, a second branch, and a CA module; wherein, the first branch includes a CBS module with a 1×1 convolution kernel, and the second branch includes a CBS module with a 1×1 convolution kernel and four CBS modules with a 3×3 convolution kernel connected in sequence.
[0091] Correspondingly, the ELAN module's processing of the input feature map includes:
[0092] First, the input feature maps are fed into the first branch and the second branch respectively. In the first branch, a 1×1 convolution is used to change the number of channels. In the second branch, the feature maps first undergo a 1×1 convolution to change the number of channels, and then four 3×3 convolutional modules are used for feature extraction. Next, the outputs of the first and second branches are concatenated, and then the concatenated output is passed sequentially through a CA module and a CBS module with a 1×1 kernel to obtain the final output of the ELAN module.
[0093] Furthermore, in the above embodiments, the following are employed: Figure 4 The MRFFM shown here balances features from different receptive fields, thereby extracting more contextual features. The MRFFM process for processing the input feature map includes:
[0094]
[0095]
[0096]
[0097] P = Conv 1×1 [R1,R2,R3,X]
[0098] Where P is the output feature map of MRFFM, X represents the input feature map, Ri represents the intermediate variable, and i = 1, 2, 3; and Three 3×3 dilated convolutions with different dilation rates are used. In this embodiment, the dilation rates of the three dilated convolutions are 2, 4, and 8, respectively. 1×1 It is a 1×1 standard convolution, and [·] represents the channel cascading operation.
[0099] Specifically, first, a 3×3 dilated convolution is performed on the input feature map X with a dilation rate of 2, and features are extracted using an attention mechanism to obtain feature map R1. Then, feature map R1 is superimposed on the original feature map X and a 1×1 convolution is used to change the number of channels, followed by another 3×3 dilated convolution with a dilation rate of 4, and features are extracted using an attention mechanism to obtain feature map R2. Next, feature map R2 is superimposed on the original feature map X and feature map R1 and a 1×1 convolution is used to change the number of channels, followed by another 3×3 dilated convolution with a dilation rate of 8, and features are extracted using an attention mechanism to obtain feature map R3. Finally, the obtained feature maps R1, R2, R3 are stacked with the original feature map X and a 1×1 convolution is used to change the number of channels to the same as the original feature map X.
[0100] Furthermore, in the above embodiments, the following are employed: Figure 5The CA module shown is used to make the model focus more on the feature information of the ship target. The processing of the input feature map by the CA module includes:
[0101] Global average pooling is performed on the input feature map X in both the horizontal and vertical directions according to the following formula, so that its size is compressed to 1×H×C and W×1×C respectively:
[0102]
[0103]
[0104] Where W, H, and C are the width, height, and number of channels of the input feature map X. and These represent the results of X-average pooling and Y-average pooling, respectively.
[0105] The results of average pooling in both directions are concatenated according to the following formula, then the number of channels is compressed to C / r using a 1×1 convolution with a channel shrinkage rate of r = 16. Batch normalization and a Sigmoid non-linear activation function are then applied to obtain intermediate variables:
[0106] F v =σ(BN(Conv) 1×1 [Z h Z w ]))
[0107] Among them, F v ∈R 1×(W+H)×C / r The intermediate variable is the attention weight F obtained through the Sigmoid activation function. h and F w Composition, r represents the channel contraction rate (r = 16 in this invention), Conv 1×1 σ represents a 1×1 standard convolution, σ represents the Sigmoid nonlinear activation function, BN represents batch normalization, and [·] represents channel concatenation.
[0108] The intermediate variable is split into two feature maps according to the following formula. Then, the two feature maps are transformed into feature maps of size 1×H×C and W×1×C respectively by passing them through 1×1 convolution and the Sigmoid non-linear activation function, and their respective weight matrices are generated. Finally, the input feature map X is multiplied by the two weight matrices to obtain the output of the CA module, as shown in the following formula:
[0109] F c (i,j)=X c (i,j)×σ(Conv 1×1 (F h ))×σ(Conv 1×1 (F w))
[0110] Among them, F h and F w This represents two feature maps obtained by splitting the intermediate variable.
[0111] Example 3
[0112] Due to the large proportion of small targets in SAR images, this embodiment of the invention further optimizes the loss function used during training to enhance the model's detection performance for small targets.
[0113] This invention employs the CIoU loss function, which, compared to previous IoU methods, considers overlap area, center-to-center distance, and aspect ratio. The formula for the CIoU loss function can be expressed as:
[0114]
[0115]
[0116]
[0117] L CIoU =1-IoU+R CIoU
[0118] Where D is the Euclidean distance between the centers of the predicted and ground truth boxes. C is the diagonal length of the minimum bounding box covering both boxes, α is a weighting factor, and υ is used to measure the similarity of the aspect ratios of the ground truth and predicted boxes. Furthermore, w gt h is the width of the actual ground frame. gt is the height of the ground truth bounding box, w is the width of the predicted bounding box, and h is the height of the predicted bounding box.
[0119] This invention also employs the NWD loss function. Specifically, the bounding boxes are first modeled as a two-dimensional Gaussian distribution, and then the normalized Wasserstein distance (NWD) is used to measure the similarity of the derived Gaussian distribution. NWD is more suitable for measuring the similarity between small targets. The formula for the NWD loss function is shown below:
[0120]
[0121]
[0122] in, Represents bounding box A. Let B represent the bounding box, ||·||2 represent the 2-norm, and c is a constant factor.
[0123] This invention combines CIoU and NWD losses, fully leveraging the advantages of each to optimize the loss function. Here, λ is a trade-off factor; adjusting the value of λ balances the NWD metric and CIoU loss. The calculation formula can be expressed as:
[0124] L CIoU-NWD = (1-λ)*(1-NWD)+λ*L CIOU
[0125] This invention provides a SAR ship detection method based on attention mechanisms and multi-scale feature fusion. It embeds a multi-receptive field extension module into the attention feature fusion network and redesigns the ELAN module by combining convolution and attention. Subsequently, due to the large proportion of small targets in SAR images, an optimized loss function is used to enhance the model's detection performance for small targets. This invention balances features at different levels through the proposed attention feature fusion network and embeds a multi-receptive field module to learn contextual information, thereby improving the detection performance of multi-scale targets. The redesigned ELAN module enhances the model's focus on target location information during feature fusion through an attention mechanism, suppressing interference from complex surrounding backgrounds and highlighting ship feature information. To verify the effectiveness of this invention, the following experiments were conducted.
[0126] The object detection method proposed in this invention was validated on an Ubuntu 20.04.4 LTS system. It was trained and tested using an NVIDIA GeForce RTX 3070 (8G) graphics processing unit, an Intel Core i7-10700K CPU, Python version 3.8, CUDA version 11.4, and PyTorch version 1.13.1.
[0127] In the experiments, the initial learning rate was set to 0.01, momentum to 0.937, and weight decay to 0.0005. Furthermore, the SGD optimizer was used during the training phase. For SSDD, the image size in the dataset was examined, and the average image size on SSDD was 481×331. Therefore, setting the input size to 512×512 did not result in a significant loss of image information. HRSID and LS-SSDD-v1.0, on the other hand, used a standard image resolution of 800×800.
[0128] Experiments were conducted on the SSDD dataset and compared with other detection methods. As shown in Table 1, the present invention was compared with some popular and widely used detectors such as Faster-RCNN, Libra R-CNN, YOLOv4, YOLOv5-1, and baseline YOLOv7. It can be seen that the present invention achieved the best results in F1, mAP, recall, and precision, at 95.1%, 98.0%, 95.2%, and 95.1%, respectively. Compared with other SAR ship detectors, the present invention also has advantages in detection performance. Experimental results show that although BiFF-FESA achieved a higher precision of 96.1%, the present invention has advantages in F1 and mAP. The present invention achieved the best mAP, surpassing that of BiFF-FESA.
[0129] Table 1 Comparison of experimental results of the method of this invention with other methods on the SSDD dataset.
[0130] method mAP P R F1 Faster R-CNN 91.3 87.3 89.2 88.3 Libra R-CNN 93.9 86.1 94.6 90.1 YOLOv4 92.1 92.8 84.3 88.3 YOLOv5-l 92.1 93.6 89.1 91.2 YOLOv7 94.6 91.0 90.3 90.6 SAR-ShipNet 89.1 95.1 76.3 84.6 GFB-Net 93.0 85.6 94.0 89.6 CR2A-Net 89.8 94.0 87.8 90.7 PPA-Net 95.2 95.2 91.2 93.1 YOLO-FA 96.8 95.2 95.0 95.0 BiFF-FESA 97.8 96.1 94.0 95.0 This invention 98.0 95.2 95.1 95.1
[0131] To more intuitively illustrate the advantages of the detection method proposed in this invention, detection results for several images in different scenes are also provided. For example... Figure 6 As shown, (a) represents a sparse nearshore scene; (b) represents a nearshore scene with complex background interference; and (c) and (d) represent dense nearshore scenes. From (a) and (b), it can be seen that YOLOv7 performs false detections, misidentifying ship wake waves and buildings as ships. In (c) and (d), YOLOv7 simultaneously performs false and false detections, misidentifying shoreline buildings as ships and missing overlapping ship detections.
[0132] Furthermore, this invention was used for multi-scale ship detection in large-scale SAR ship scenarios. As shown in Table 2, the invention was compared with other target detectors on the HRSID dataset. The invention achieved a mAP of 93.1%, resulting in better mAP and F1 scores than other SAR ship detectors. On the HRSID dataset, its mAP was 0.7% higher than the best-performing detector in the table, RFD. Although DRPSM achieved a higher recall rate, the invention achieved the best results in mAP, accuracy, and F1, with a 6.6% improvement in mAP. This invention demonstrates a significant advantage on this dataset.
[0133] The invention was also compared with other object detectors on the LS-SSDD-v1.0 dataset, and the results are shown in Table 3. Experimental results show that the invention achieves a mAP of 76.9% on the LS-SSDD-v1.0 dataset, demonstrating better mAP and F1 scores than other object detectors in large-scale image detection tasks. In LS-SSDD-v1.0, the invention achieves a 0.7% improvement in mAP and the best F1 score compared to the best detector, LRTransDet.
[0134] Table 2 Comparison of experimental results of the method of this invention with other methods on the HRSID dataset.
[0135] method mAP P R F1 Faster R-CNN 79.4 80.2 82.1 81.1 Cascade R-CNN 87.4 89.0 85.7 87.3 YOLOv4 81.7 85.9 76.3 80.8 YOLOv5 85.9 85.6 85.5 85.5 YOLOv7 90.0 91.9 80.1 85.5 DetNet 83.2 84.3 80.6 82.4 PPA-Net 89.2 90.3 88.2 89.2 ATSD 88.1 90.2 86.5 88.3 DRPSM 86.5 - 90.1 - SIFNet 79.7 79.9 82.7 81.2 RFD 92.4 - 84.3 - This invention 93.1 93.6 85.9 89.5
[0136] Table 3 compares the experimental results of the method of this invention with other methods on the LS-SSDD-v1.0 dataset.
[0137]
[0138]
[0139] To comprehensively evaluate the performance of all methods, AP was used. 50 AP 75 AP S AP M and AP L As evaluation metrics, this invention was compared with other detectors on HRSID and LS-SSDD-v1.0. These metrics are the same as those defined on the COCO dataset. Here, AP 50 This is the metric when IoU = 0.5; AP 75 This is the metric when IoU = 0.75, which better reflects positional accuracy. AP S AP M and AP L This is a metric for evaluating the ability of this invention to detect targets of different scales. Based on the area occupancy defined in parentheses, they indicate small (area < 32). 2 (pixels), medium (32) 2 <area<64 2 (pixels) and large (area>64) 2 The AP score of the pixel target. In the experiment, AP 50 This is the primary indicator, while other indicators are used as references. The results are shown in Tables 4 and 5, respectively.
[0140] Table 4 Comparison of experimental results of the method of this invention with other methods on the HRSID dataset.
[0141] method <![CDATA[AP 50 ]]> <![CDATA[AP 75 ]]> <![CDATA[AP S ]]> <![CDATA[AP M ]]> <![CDATA[AP L ]]> FCOS 87.0 65.9 60.7 63.4 25.2 RetinaNet 80.1 59.4 54.6 60.0 22.1 Mask R-CNN 81.1 67.7 59.9 63.7 13.9 YOLO-SD 83.7 67.6 62.3 51.9 1.3 LPEDet 89.7 71.8 65.8 63.4 24.2 FEPS-Net 90.7 74.3 66.8 65.2 31.6 SDNet 90.6 75.1 66.1 72.1 56.9 ESD-Net 91.0 77.7 67.6 65.6 40.8 NAS-YOLOX 91.1 71.9 65.2 68.6 34.1 SFPN 91.2 77.3 69.0 69.6 29.7 This invention 93.1 77.9 57.4 80.0 64.2
[0142] Table 5 compares the experimental results of the method of this invention with those of other methods on the LS-SSDD-v1.0 dataset.
[0143] method <![CDATA[AP 50 ]]> <![CDATA[AP 75 ]]> <![CDATA[AP S ]]> <![CDATA[AP M ]]> <![CDATA[AP L ]]> Faster R-CNN 66.6 10.8 24.6 37.4 - Libra Faster R-CNN 65.9 10.0 24.0 38.5 - RetinaNet 60.7 7.2 20.2 36.7 - YOLO-SD 72.0 12.2 27.1 39.9 - ATSS 66.5 8.9 23.3 35.2 - LssDet 74.3 9.4 25.8 36.9 - This invention 76.9 15.0 28.7 42.3 -
[0144] The present invention was compared with fifteen other CNN-based methods on the HRSID and LS-SSDD-v1.0 datasets. The table shows the AP of the present invention on the HRSID dataset. 50 AP 75 AP M AP L All of these methods significantly outperformed other methods (93.1%, 77.9%, 80.0%, and 64.2%, respectively). While this invention is inferior to other models in detecting small-sized ships, it excels in AP... 50 AP 75 AP M AP L The results are 1.9%, 0.6%, 10.4%, and 34.5% higher than the best model SFPN in the table, respectively. This indicates that the present invention has significant advantages in the detection of medium and large ships. In addition, the results of the present invention on the LS-SSDD-v1.0 dataset are all superior to other methods (76.9%, 15.0%, 28.7%, and 42.3%, respectively).
[0145] Furthermore, the visualization results of this invention and the baseline on the HRSID dataset are as follows: Figure 7 As shown in the diagram: (a) is a sparse nearshore scene. (b) is a nearshore scene with complex background interference. (c)(d) are dense nearshore scenes. In (a), it can be seen that YOLOv7 performs false detections, misidentifying sea clutter and the shoreline as ships. (b) YOLOv7 performs false negatives. (c)(d) YOLOv7 performs both false negatives and false negatives, while this invention correctly detects all ships.
[0146] The visualization results of this invention and the baseline on the LS-SSDD-v1.0 dataset are as follows: Figure 8 As shown in the diagram: (a) is a sparse nearshore scene; (b) is a nearshore scene with complex background interference; (c) is a nearshore scene in a narrow river; and (d) is a dense nearshore scene. YOLOv7 missed detections in all four scenes (a), (b), (c), and (d), while this invention correctly detected the missed vessels.
[0147] To verify the role of each module of this invention in SAR ship target detection, ablation experiments were conducted on the SSDD dataset against the baseline YOLOv7. The experimental results are shown in Table 6. As can be seen in the first row of the table, the baseline only achieved 94.5% mAP. 50It achieved an accuracy of 89.0% and a recall of 90.0%. After introducing WEF-Net, mAP... 50 The accuracy was improved to 96.1%, with recall and precision increasing by 1.0% and 5.7%, respectively. Furthermore, compared to the baseline model, the optimized loss function improved accuracy by 6.9%, recall by 1.2%, and F1 score by 3.4%. The collaboration between WEF-Net and the optimized loss function further improved mAP. 50 Increased by 2.5% (from 94.5% to 97.0%), mAP 50-95 It increased by 5.4% (from 63.9% to 69.3%). With the introduction of ELAN-A, mAP... 50 It improved by 1.7% compared to the baseline, and with the synergy of WEF-Net and the optimized loss function, accuracy and recall improved by 6.2% and 5.1% respectively compared to the baseline model, mAP 50 Increased to 98.0%.
[0148] Table 6 Ablation experiments on the SSDD dataset.
[0149]
[0150]
[0151] The experimental data above shows that:
[0152] (1) The present invention proposes a SAR ship detection model based on attention mechanism and multi-scale feature fusion, which can perform more accurate detection work on SAR images.
[0153] (2) The attention feature fusion network designed in this invention suppresses the interference of complex backgrounds through the attention mechanism, making the model more focused on the ship target. It also embeds a weighted feature fusion module and an improved ELAN module to better integrate feature information at different scales, thereby enhancing and improving the fusion of multi-scale feature maps with complex backgrounds.
[0154] (3) The present invention designs a multi-receptive field extension module to learn contextual information, which can construct more expressive multi-scale features.
[0155] (4) This invention utilizes the advantages of CIoU and NWD loss functions to optimize the loss function as a balance between bounding box regression accuracy and training convergence, thereby improving the detection accuracy of small ships.
[0156] (5) Experiments on the Synthetic Aperture Radar Ship Detection Dataset (SSDD), High Resolution Synthetic Aperture Radar Image Dataset (HRSID), and Large SAR Ship Detection Dataset (LS-SSDD-v1.0) show that the method of this invention has better performance in SAR image target detection compared with other algorithms. The ablation experiments demonstrate that each improved module proposed in this invention effectively improves detection accuracy. Therefore, the method proposed in this invention is more suitable for target detection in SAR images than existing target detection algorithms, and has significant practical implications for research on target detection in SAR images.
[0157] 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.
Claims
1. A SAR ship detection method based on attention mechanism and multi-scale feature fusion, characterized in that, include: Step 1: Construct a target detection network, which includes a backbone network based on the CSPDarknet53 architecture, an attention-based feature fusion network WEF-Net, and a prediction head. The backbone network extracts features from the input SAR image to generate feature maps of different sizes. The WEF-Net includes a Balanced Feature Mechanism (BFM) module and a Feature Enhancement Fusion (FEF) module. The BFM includes a Coordinating Attention Mechanism (CA) module to process the feature maps of different sizes output by the backbone network based on the attention mechanism to generate global features with a balanced receptive field. The FEF module balances the semantic information at different levels of the feature pyramid based on the feature maps of different sizes output by the backbone network and the global features output by the BFM to generate fused feature maps of different sizes. The prediction head performs ship detection based on the fused feature maps of different sizes output by the FEF module to obtain the detection results. The BFM includes a first balanced branch, a second balanced branch, a third balanced branch, and a weighted feature fusion (WFF) module; wherein, the first balanced branch includes a multi-receptive field extension module (MRFFM) and an upsampling operation, the second balanced branch includes a CA module, and the third balanced branch includes a CA module and a max pooling operation; The FEF module includes a multi-receptive field extension module (MRFFM), a first enhancement branch, a second enhancement branch, and a third enhancement branch. The first enhancement branch includes max pooling, a weighted feature fusion (WFF) module, an ELAN module, and a reparameterized convolution (RepConv). The second enhancement branch includes a WFF module, an ELAN module, and RepConv. The third enhancement branch includes upsampling, a WFF module, an ELAN module, and RepConv. The MRFFM process for processing the input feature map includes: in, This is the output feature map of MRFFM. Represents the input feature map, Indicates intermediate variables. ; , and Three with different expansion rates dilated convolution, yes Standard convolution, Indicates channel cascading operation; Step 2: Train the target detection network to obtain a trained target detection model; Step 3: Input the SAR image to be detected into the trained target detection model to obtain the detection results.
2. The SAR ship detection method based on attention mechanism and multi-scale feature fusion according to claim 1, characterized in that, The BFM generates global features with receptive field balance based on feature maps of different sizes output by the backbone network, specifically including: in, , and This represents the learnable weight parameters of the WFF module. It represents a tiny number used to avoid numerical instability; These are feature maps of different sizes output by the backbone network. ; Indicates an upsampling operation. This indicates a max pooling operation. This indicates the attention coordination mechanism module. This represents the global features generated by BFM.
3. The SAR ship detection method based on attention mechanism and multi-scale feature fusion according to claim 1, characterized in that, The FEF module balances the semantic information at different levels of the feature pyramid based on the feature maps of different sizes output by the backbone network and the global features output by BFM to generate fused feature maps of different sizes. Specifically, this includes: in, This represents the learnable weight parameters of the WFF module. , , It represents a tiny number used to avoid numerical instability; These are feature maps of different sizes output by the backbone network. This represents the fused feature maps of different sizes output by the FEF module. ; Indicates the upsampling module. This indicates a max pooling operation. This represents the global features output by BFM. This indicates the ELAN module, and Rep indicates RepConv.
4. The SAR ship detection method based on attention mechanism and multi-scale feature fusion according to claim 1, characterized in that, The ELAN module includes a first branch, a second branch, and a CA module; wherein, the first branch includes a CBS module with a 1×1 convolution kernel, and the second branch includes a CBS module with a 1×1 convolution kernel and four CBS modules with a 3×3 convolution kernel connected in sequence. Correspondingly, the ELAN module's processing of the input feature map includes: First, the input feature maps are fed into the first branch and the second branch respectively. Then, the outputs of the first branch and the second branch are concatenated. The concatenated output is then passed through the CA module and a CBS module with a 1×1 convolution kernel to obtain the final output of the ELAN module.
5. A SAR ship detection method based on attention mechanism and multi-scale feature fusion according to any one of claims 1 to 4, characterized in that, The CA module's processing of the input feature map includes: The input feature map X is subjected to global average pooling in both the horizontal and vertical directions according to the following formula, so as to compress its size to [size not specified]. and : in, , and These are the width, height, and number of channels of the input feature map X. and They represent Average pooling and The result of average pooling; The results of average pooling in both directions are concatenated according to the following formula, then compressed to the number of channels C / r using a 1×1 convolution, followed by batch normalization and a sigmoid non-linear activation function to obtain intermediate variables: in, Indicates intermediate variables. Indicates the channel contraction rate. This represents a 1×1 standard convolution. This represents the Sigmoid non-linear activation function. This indicates batch normalization operation. Indicates channel cascading operation; The intermediate variable is split into two feature maps according to the following formula, and their respective weight matrices are generated. The input feature map is then... Multiplying by the two weight matrices yields the output of the CA module: in, and This represents two feature maps obtained by splitting the intermediate variable.
6. The SAR ship detection method based on attention mechanism and multi-scale feature fusion according to claim 1, characterized in that, During the training process in step 2, the following formula is used as the loss function; Where NWD represents the NWD loss function, Represents the CIoU loss function. This represents a given balance factor.
Citation Information
Patent Citations
SAR image ship target detection method based on multistage feature fusion and mixed attention
CN116469002A
Multi-scale SAR image ship detection method based on attention mechanism
CN117911760A
