A ship detection method, device and equipment based on synthetic aperture radar image
By replacing the module in the YOLOv8 network and introducing attention mechanism and multi-scale feature extraction, the problems of blurring and model offset of small ship object detection in SAR images are solved, and the accuracy and accuracy of ship detection are improved.
Patent Information
- Application Number
- CN202410716348.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-06-04
AI Technical Summary
The existing synthetic aperture radar (SAR) image ship target detection method has low detection accuracy in complex marine environments, especially due to the blurred and low resolution of small ship targets, which lead to difficulty in extracting features, and the model is prone to shift to small ship targets. , resulting in underfitting the target of large ships.
By replacing the C2f module of the YOLOv8 network with the ECC2f module and replacing the SPPF module with the Mini-DenseASPP module, an improved YOLOv8 network is built, and the feature extraction ability is enhanced by using the ECA attention mechanism and SE attention mechanism, combining multi-scale feature extraction, and optimizing Bounding box loss function to improve detection accuracy.
It improves the accuracy and accuracy of SAR image ship detection, and can effectively obtain small ship characteristics even in the case of a large number of small ships, avoid model offsets, and enhances the detection ability of targets of different scales and shapes.
Smart Images

Figure CN118691964B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of ship detection, and in particular to a ship detection method, device and equipment based on synthetic aperture radar images. Background Art
[0002] At present, with the rapid development of marine trade and shipping industry, the monitoring and identification of ship targets has become a key element of maritime safety and supervision. However, in complex marine environments, traditional optical images or radar images may be limited by factors such as weather, clouds, and lighting, resulting in a decrease in detection accuracy and reliability.
[0003] To address this problem, ship target detection technology based on Synthetic Aperture Radar (SAR) images came into being. In the field of ship target detection, SAR technology has unique advantages, such as independence from weather and lighting conditions, high resolution, and all-weather monitoring, making it an ideal ship target detection tool.
[0004] However, the existing SAR image ship target detection methods still face some challenges in practical applications. Due to the diversity of marine ship targets and their different sizes, small ship targets in SAR ship images are blurred due to low resolution, making feature extraction difficult. If the focus is on the detection of small ship targets, the model will shift to small ship targets, resulting in underfitting of large ship targets. In summary, the current SAR image ship target detection methods have low detection accuracy for ships. Summary of the invention
[0005] Based on this, it is necessary to provide a ship detection method, device and equipment based on synthetic aperture radar images to address the above technical problems.
[0006] This manual adopts the following technical solutions:
[0007] This specification provides a ship detection method based on synthetic aperture radar images, including:
[0008] Acquire synthetic aperture radar ship images collected at historical moments as sample images, and annotate the true bounding box of each ship in the sample images;
[0009] The C2f module in the Backbone module of the YOLOv8 network is replaced with the ECC2f module, and the SPPF module is replaced with the Mini-DenseASPP module. The Backbone module after the module replacement is combined with the Neck module and the Prediction module in the YOLOv8 network to construct an improved YOLOv8 network.
[0010] The sample image is input into the improved YOLOv8 network to obtain the predicted bounding box of each ship in the sample image; and the improved YOLOv8 network is trained with the minimization of the deviation loss between the predicted bounding box and the true bounding box as the optimization goal to obtain the ship detection model;
[0011] The ship detection model is used to detect the synthetic aperture radar ship image to be detected, and the synthetic aperture radar ship image to be detected is recognized through the Backbone module to obtain the preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected; the Neck module is used to extract the features of the preliminary feature map to obtain the enhanced feature map of each ship structure; the Prediction module is used to detect the enhanced feature map to obtain each ship target in the synthetic aperture radar ship image to be detected;
[0012] The real bounding box of each ship in the labeled sample image specifically includes:
[0013] By marking the center point coordinates of each ship in the sample image and the width and height of the bounding box, the real bounding box of each ship is formed;
[0014] The method of replacing the C2f module in the backbone network of the YOLOv8 network with the ECC2f module specifically includes:
[0015] The BottleNeck module in the C2f module in the backbone network of the YOLOv8 network is replaced with the ECBottleNeck module; the ECBottleNeck module is obtained by embedding the ECA attention mechanism into the residual structure of the BottleNeck module;
[0016] The method of identifying the synthetic aperture radar ship image to be detected by the Backbone module and obtaining a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected specifically includes:
[0017] The Conv module in the Backbone module performs a convolution operation on the synthetic aperture radar ship image to be detected, and the obtained feature map is input into the first convolution layer of the ECBottleneck module in the Backbone module, and a convolution operation is performed through a 1×1 convolution kernel to obtain the ship features at the first scale;
[0018] The ship features at the first scale are input into the second convolutional layer of the ECBottleneck module, and a convolution operation is performed through a 3×3 convolution kernel to obtain a ship feature map at the second scale;
[0019] The ship features at the first scale are input into the ECA attention mechanism of the ECBottleneck module to generate the attention weights of each feature channel, and the features of each feature channel are weighted by the attention weights to obtain a weighted feature map;
[0020] The weighted feature map and the ship feature map at the second scale are spliced in the output channel dimension to obtain a spliced feature map; multiple rounds of alternating feature extraction are performed through the Conv module and the Backbone module to obtain a first feature map, and the first feature map is input into the Mini-DenseASPP module for multi-scale ship feature extraction to obtain a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected;
[0021] The first feature map is input into the Mini-DenseASPP module to extract multi-scale ship features, and a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected is obtained, specifically including:
[0022] The first convolution branch in the Mini-DenseASPP module convolves the preliminary feature map with a 1×1 convolution kernel to extract the ship features at the first scale to obtain the first branch feature map;
[0023] The second convolution branch in the Mini-DenseASPP module convolves the first branch feature map with a 3×3 convolution kernel to extract the ship features at the second scale to obtain the second branch feature map;
[0024] The second convolution branch in the Mini-DenseASPP module convolves the second branch feature map with a 5×5 convolution kernel to extract the ship features at the third scale to obtain the third branch feature map;
[0025] The first branch feature map, the second branch feature map and the third branch feature map are spliced in the output channel dimension through the Mini-DenseASPP module to obtain a multi-scale spliced feature map;
[0026] The SE attention mechanism module in the Mini-DenseASPP module performs global average pooling on the multi-scale spliced feature map, generates the attention weight of each feature channel, and weights the features of each feature channel in the multi-scale spliced feature map through the attention weight;
[0027] The weighted multi-scale spliced feature map is convolved with a 1×1 convolution kernel through the Mini-DenseASPP module to extract the ship features and obtain a preliminary feature map.
[0028] The deviation loss between the predicted bounding box and the true bounding box specifically includes:
[0029] The attention-based bounding box loss function Wise-IoU v1 between the predicted bounding box and the true bounding box is determined by the following formula:
[0030] L WIoUv1 =R WIoU L IoU ,
[0031] The outlier degree is used to determine the quality of the predicted bounding box by the following formula:
[0032]
[0033] The non-monotonic focusing function is constructed based on the outlier degree by the following formula to determine the deviation loss Wise-IoU v3 between the predicted bounding box and the true bounding box:
[0034] L WIoUv3 =kL WIoUv1 ,
[0035] Among them, L WIoUv1 is the attention-based Wise-IoU v1 bounding box loss function between the predicted bounding box and the true bounding box, L IoU is the bounding box loss between the predicted bounding box and the true bounding box, R WIoU is the distance attention, x and y are the horizontal and vertical coordinates of the center point of the predicted bounding box, respectively. gt ,y gt are the horizontal and vertical coordinates of the center point of the real bounding box, W g , H g are the width and height of the minimum bounding rectangle of the predicted bounding box and the true bounding box, respectively. * indicates the separation operation from the ship detection model calculation graph. For L IoU The sliding average of , k is the non-monotonic focusing coefficient, β is the outlier degree, α and δ are hyperparameters, For L IoU The exponentially weighted moving average of WIoUv3 is the outlier-based Wise-IoUv3 loss function between the predicted bounding box and the true bounding box.
[0036] This specification provides a ship detection device based on synthetic aperture radar images, including:
[0037] An acquisition module, used to acquire synthetic aperture radar ship images collected at historical moments as sample images, and to mark the real bounding box of each ship in the sample image;
[0038] A construction module is used to replace the C2f module in the Backbone module of the YOLOv8 network with the ECC2f module and the SPPF module with the Mini-DenseASPP module, and to construct an improved YOLOv8 network by combining the Backbone module after the module replacement with the Neck module and the Prediction module in the YOLOv8 network;
[0039] The training module is used to input the sample image into the improved YOLOv8 network to obtain the predicted bounding box of each ship in the sample image; and to train the improved YOLOv8 network with the optimization goal of minimizing the deviation loss between the predicted bounding box and the true bounding box to obtain a ship detection model;
[0040] The detection module is used to perform ship detection on the synthetic aperture radar ship image to be detected through the ship detection model, identify the synthetic aperture radar ship image to be detected through the Backbone module, and obtain the preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected; extract features from the preliminary feature map through the Neck module to obtain the enhanced feature map of each ship structure; detect the enhanced feature map through the Prediction module to obtain each ship target in the synthetic aperture radar ship image to be detected;
[0041] The real bounding box of each ship in the labeled sample image includes:
[0042] By marking the center point coordinates of each ship in the sample image and the width and height of the bounding box, the real bounding box of each ship is formed;
[0043] The method of replacing the C2f module in the backbone network of the YOLOv8 network with the ECC2f module includes:
[0044] The BottleNeck module in the C2f module in the backbone network of the YOLOv8 network is replaced with the ECBottleNeck module; the ECBottleNeck module is obtained by embedding the ECA attention mechanism into the residual structure of the BottleNeck module;
[0045] The method of identifying the synthetic aperture radar ship image to be detected by the Backbone module and obtaining a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected includes:
[0046] The Conv module in the Backbone module performs a convolution operation on the synthetic aperture radar ship image to be detected, and the obtained feature map is input into the first convolution layer of the ECBottleneck module in the Backbone module, and a convolution operation is performed through a 1×1 convolution kernel to obtain the ship features at the first scale;
[0047] The ship features at the first scale are input into the second convolutional layer of the ECBottleneck module, and a convolution operation is performed through a 3×3 convolution kernel to obtain a ship feature map at the second scale;
[0048] The ship features at the first scale are input into the ECA attention mechanism of the ECBottleneck module to generate the attention weights of each feature channel, and the features of each feature channel are weighted by the attention weights to obtain a weighted feature map;
[0049] The weighted feature map and the ship feature map at the second scale are spliced in the output channel dimension to obtain a spliced feature map; multiple rounds of alternating feature extraction are performed through the Conv module and the Backbone module to obtain a first feature map, and the first feature map is input into the Mini-DenseASPP module for multi-scale ship feature extraction to obtain a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected;
[0050] The first feature map is input into the Mini-DenseASPP module to extract multi-scale ship features, and a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected is obtained, including:
[0051] The first convolution branch in the Mini-DenseASPP module convolves the preliminary feature map with a 1×1 convolution kernel to extract the ship features at the first scale to obtain the first branch feature map;
[0052] The second convolution branch in the Mini-DenseASPP module convolves the first branch feature map with a 3×3 convolution kernel to extract the ship features at the second scale to obtain the second branch feature map;
[0053] The second convolution branch in the Mini-DenseASPP module convolves the second branch feature map with a 5×5 convolution kernel to extract the ship features at the third scale to obtain the third branch feature map;
[0054] The first branch feature map, the second branch feature map and the third branch feature map are spliced in the output channel dimension through the Mini-DenseASPP module to obtain a multi-scale spliced feature map;
[0055] The SE attention mechanism module in the Mini-DenseASPP module performs global average pooling on the multi-scale spliced feature map, generates the attention weight of each feature channel, and weights the features of each feature channel in the multi-scale spliced feature map through the attention weight;
[0056] The weighted multi-scale spliced feature map is convolved with a 1×1 convolution kernel through the Mini-DenseASPP module to extract the ship features and obtain a preliminary feature map.
[0057] The deviation loss between the predicted bounding box and the true bounding box includes:
[0058] The attention-based bounding box loss function Wise-IoU v1 between the predicted bounding box and the true bounding box is determined by the following formula:
[0059] L WIoUv1 =R WIoU L IoU ,
[0060] The outlier degree is used to determine the quality of the predicted bounding box by the following formula:
[0061]
[0062] The non-monotonic focusing function is constructed based on the outlier degree by the following formula to determine the deviation loss Wise-IoU v3 between the predicted bounding box and the true bounding box:
[0063] L WIoUv3 =kL WIoUv1 ,
[0064] Among them, L WIoUv1 is the attention-based Wise-IoUv1 bounding box loss function between the predicted bounding box and the true bounding box, L IoU is the bounding box loss between the predicted bounding box and the true bounding box, R WIoU is the distance attention, x and y are the horizontal and vertical coordinates of the center point of the predicted bounding box, respectively. gt ,y gt are the horizontal and vertical coordinates of the center point of the real bounding box, W g , H g are the width and height of the minimum bounding rectangle of the predicted bounding box and the true bounding box, respectively. * indicates the separation operation from the ship detection model calculation graph. For L IoU The sliding average of , k is the non-monotonic focusing coefficient, β is the outlier degree, α and δ are hyperparameters, For L IoU The exponentially weighted moving average of WIoUv3is the outlier-based Wise-IoU v3 loss function between the predicted bounding box and the true bounding box.
[0065] The present specification provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned ship detection method based on synthetic aperture radar images is implemented.
[0066] The present specification provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned ship detection method based on synthetic aperture radar images when executing the program.
[0067] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:
[0068] Firstly, synthetic aperture radar ship images are obtained as sample images and the true bounding boxes of each ship are marked. Then, the C2f module in the backbone network of the YOLOv8 network is replaced by the ECC2f module and the SPPF module is replaced by the Mini-DenseASPP module to construct an improved YOLOv8 network. Then, the sample images are input into the improved YOLOv8 network for training to obtain a ship detection model that can identify ships. The trained ship detection model is used to perform ship detection on the synthetic aperture radar ship images to be detected.
[0069] The present invention replaces the C2f module in the backbone network of the YOLOv8 network with the ECC2f module and the SPPF module with the Mini-DenseASPP module. The ECC2f module is used to obtain more image information while ensuring the parameter amount and the model size, thereby enhancing the ability of the ship detection model to obtain ship features. Even if there are a large number of small ships in the synthetic aperture radar ship image, the effective features of each small ship can be obtained. The multi-scale adaptability of the Mini-DenseASPP module is used to overcome the deviation of the ship detection model to the small ship target, thereby improving the accuracy and precision of SAR image ship detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0071] Figure 1 A schematic diagram of a C2f module provided in this specification;
[0072] Figure 2 A schematic diagram of a process flow of a ship detection method based on synthetic aperture radar images provided in this specification;
[0073] Figure 3 A schematic diagram of the overall design architecture of the MASS-YOLO model provided in this manual;
[0074] Figure 4 A schematic diagram of the ECC2f module structure provided in this specification;
[0075] Figure 5 A schematic diagram of the Mini-DenseASPP structure provided in this manual;
[0076] Figure 6 A schematic diagram for comparing a ship detection method based on synthetic aperture radar images provided in this specification with other methods;
[0077] Figure 7 A schematic diagram of a ship detection device based on synthetic aperture radar images provided in this specification;
[0078] Figure 8 A schematic diagram of a computer device for implementing a ship detection method based on synthetic aperture radar images provided in this specification. DETAILED DESCRIPTION
[0079] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this application will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in the specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0080] However, the existing SAR image ship target detection methods still have some challenges in practical applications, including but not limited to the problem that a large number of small ships are blurred due to low resolution and effective features cannot be obtained; the model is offset to small ship targets and large ship targets are under-fitted; SAR images are affected by clutter, reflections or other interferences in the ocean, islands and reefs, coastal ports, which affects the image quality; there are problems with the diversity and size changes of ship targets in the marine environment and the low accuracy of SAR image ship targets.
[0081] For the YOLOv8 model, YOLOv8 (You Only Look Once, Version 8) is an advanced real-time target detection algorithm. It is currently the latest version of the YOLO series of algorithms. Compared with previous versions, YOLOv8 has significant improvements in accuracy and speed.
[0082] YOLOv8 uses a deep neural network called "Darknet", which consists of multiple convolutional layers, pooling layers, and fully connected layers. The main idea of YOLOv8 is to divide the input image into an SxS grid, each grid predicts B bounding boxes, each bounding box contains the coordinates of its center point (x, y) and width and height (w, h). In addition, each grid also predicts C category probabilities, where C is the predefined number of categories.
[0083] In YOLOv8, each grid cell extracts features through convolutional and pooling layers, and then generates predictions through fully connected layers. The predictions include the coordinates, width, and height of the bounding box, as well as the class probability of each grid cell.
[0084] Compared with the previous YOLO version, YOLOv8 has been improved in many aspects. First, it adopts a deeper network structure, which improves the ability of feature extraction. Secondly, YOLOv8 adopts multi-scale prediction, that is, predicting the target at multiple different scales, thereby improving the accuracy of detection. In addition, YOLOv8 also adopts a new loss function and training strategy, which improves the generalization ability of the model.
[0085] As for the C2f module, C2f is a module proposed in YOLOv8, which can obtain richer gradient flow information while ensuring lightweight. The C2f module uses 1x1 convolution and bottleneck blocks with residual connections to effectively capture and process features from input data. This design aims to improve the feature extraction capability in the YOLOv8 architecture. The C2f module is as follows Figure 1 As shown, Figure 1 This is a schematic diagram of a C2f module in this specification.
[0086] For the SE attention mechanism (Squeeze-and-Excitation), the main idea of SE is to improve the performance of the model by compressing and exciting the input features. Specifically, the SE attention mechanism consists of two steps: Squeeze and Excitation. In the Squeeze step, the input feature map is compressed into a vector through a global average pooling operation, and then mapped to a smaller vector through a fully connected layer. In the Excitation step, a sigmoid function is used to compress each element in this vector between 0 and 1, and it is multiplied with the original input feature map to obtain a weighted feature map. Through the SE attention mechanism, the model can adaptively learn the importance of each feature channel, thereby improving the performance of the model. The specific derivation process of the SE module is as follows:
[0087] (1) Given an input feature map X, let it pass through F trThe operation generates a feature map U.
[0088] (2) In this step, the feature map is globally averaged pooled to generate a 1*1*C vector, so that each feature channel is represented by a numerical value. Global low-dimensional embedding of U is achieved, which is equivalent to a numerical value having the global receptive field of the feature channel.
[0089]
[0090] Among them, H and W are the height and width of the feature map respectively.
[0091] (3) This step is completed through two fully connected layers, and the required weight information is generated through the weight W, where W is obtained through learning and is used to show the feature correlation required for modeling. The formula is as follows:
[0092] s=F ex (z,W)=σ(g(z,W))=σ(W2δ(W1z))
[0093] The vector z obtained in the previous step is processed by two fully connected layers W1 and W2 to obtain the desired feature channel weight value s. After two fully connected layers, different values in s represent the weight information of different feature channels, giving different weights to the feature channels.
[0094] (4) The fourth step is to assign weights to the feature map U using the weight vector s generated in the third step to obtain the desired feature map. Its size is exactly the same as the feature map, and the SE module does not change the size of the feature map.
[0095]
[0096] The generated feature vector is multiplied by the feature map and the corresponding feature channel, that is, the value of each feature channel in the feature map U is multiplied by the weight of the corresponding feature channel in s.
[0097] As for the ECA attention mechanism (Efficient Channel Attention), the ECA attention mechanism is an attention mechanism for deep learning models, which aims to improve the performance and efficiency of the model. The ECA attention mechanism is proposed mainly to solve the problems of high computational complexity and large memory usage in the traditional SE attention mechanism.
[0098] The ECA attention mechanism effectively reduces the computation and memory requirements by introducing the ideas of locality and parameter efficiency. The attention mechanism is mainly implemented by introducing attention weights in the feature channel dimension, rather than in the spatial dimension, thereby reducing the computational complexity. Specifically, the ECA attention mechanism weights the features of each feature channel by summing them, so that each feature channel can adaptively learn its importance in the entire feature map.
[0099] As for the Spatial Pyramid Pooling (SPPF) module, the SPPF module is a commonly used module in deep learning, especially in computer vision tasks such as object detection and semantic segmentation. Spatial Pyramid Pooling is a pooling method that can obtain different levels of feature information based on input feature maps of different sizes. The purpose of this is to extract multi-scale features and enhance the representation ability of the model. The key to the SPPF module lies in its Spatial Pyramid Pooling operation. This operation allows the network to pool feature maps at multiple scales to capture feature information at different scales. This means that no matter what the size of the input image is, the network can extract and pool features at different scales, thereby improving the model's ability to detect objects of different sizes.
[0100] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0101] Figure 2 The following is a flow chart of a ship detection method based on synthetic aperture radar images in this specification, which specifically includes the following steps:
[0102] S101: Acquire synthetic aperture radar ship images collected at historical moments as sample images, and annotate real bounding boxes of each ship in the sample images.
[0103] Generally, when performing ship detection on synthetic aperture radar ship images, the server of the business platform can first obtain pre-collected synthetic aperture radar ship images as sample images, and train the selected model with the sample images, and perform ship detection based on synthetic aperture radar ship images through the trained model.
[0104] Of course, the sample images may be divided into training sample images and test sample images according to a preset ratio, and the preset ratio may be 8: 2. For the training sample images, the server may pre-label the ships in the images, and specifically label them by real bounding boxes.
[0105] Specifically, in one or more embodiments of the present specification, the server may mark each ship in the sample image by the center point coordinates of each ship and the width and height of the bounding box to form a real bounding box.
[0106] The server mentioned in this specification can be a server set up on a business platform, or a device such as a desktop computer, a laptop computer, etc. that can execute the solution of this specification. For the convenience of description, the following description is based on the server as the execution subject.
[0107] S102: Replace the C2f module in the Backbone module of the YOLOv8 network with the ECC2f module and replace the SPPF module with the Mini-DenseASPP module, and construct an improved YOLOv8 network with the Neck module and the Prediction module in the YOLOv8 network.
[0108] S103: Input the sample image into the improved YOLOv8 network to obtain the predicted bounding box of each ship in the sample image; and train the improved YOLOv8 network with minimizing the deviation loss between the predicted bounding box and the true bounding box as the optimization goal to obtain a ship detection model.
[0109] S104: Perform ship detection on the synthetic aperture radar ship image to be detected through the ship detection model, recognize the synthetic aperture radar ship image to be detected through the Backbone module, and obtain a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected; perform feature extraction on the preliminary feature map through the Neck module to obtain an enhanced feature map of each ship structure; detect the enhanced feature map through the Prediction module to obtain each ship target in the synthetic aperture radar ship image to be detected.
[0110] After obtaining the sample images as described above, the server can further construct a ship detection model and use it to perform ship detection on the synthetic aperture radar ship images to be detected, and determine the boundary box of each ship in the synthetic aperture radar ship images to be detected.
[0111] This manual proposes a MASS-YOLO model obtained by improving the YOLOv8 network and training it to obtain a ship detection model. Figure 3 This is a schematic diagram of the overall design architecture of a MASS-YOLO model in this manual. Figure 3 It can be seen that MASS-YOLO mainly consists of three parts: the backbone network SAR-SHIP-NET, the neck network and the detection part.
[0112] The backbone network is based on the YOLOv8 backbone network, and the SAR-SHIP-NET backbone network is proposed, which has higher feature extraction capabilities and stronger multi-scale semantic perception capabilities. In the BackBone part, MASS-YOLO consists of Conv module, ECC2f module and DenseASPP module. Conv is a convolution module that encapsulates three functions, including convolution (Conv2d), BN layer and SiLU activation function. The ECC2f module combines the advantages of C2f and ECA attention mechanisms, improves the semantic perception ability of the model, and allows MASS-YOLO to obtain richer gradient flow information while ensuring lightweight.
[0113] In the Neck part of the model, the MASS-YOLO model uses the same model structure as YOLOv8n. In this part, YOLOv8 uses the idea of PAN-FPN structure. Compared with YOLOv5, YOLOv8 replaces the C3 module and RepBlock module with the C2f module, further improving the feature extraction capability of the model.
[0114] The detection part (Dectect) uses the idea of anchor-free box, separates the classification head and the detection head, and determines the positive and negative samples according to the weighted scores of classification and regression, effectively improving the model performance.
[0115] Specifically, for the ECC2f module, the BottleNeck module in the C2f module in the backbone network of the YOLOv8 network can be replaced with the ECBottleNeck module, which is obtained by embedding the ECA (Efficient Channel Attention) attention mechanism into the residual structure of the BottleNeck module. Combining the ECA attention mechanism with the C2f module of YOLOv8 brings significant advantages to the target detection task. This fused module improves model performance in many aspects. First, through the ECA attention mechanism, the model can learn the weight of each feature channel in a more efficient way, so that it can pay more attention to information that is important for the target detection task. This feature adaptive modeling helps to improve the model's perception of targets of different scales, shapes, and background changes. The schematic diagram of the ECC2f module is shown below. Figure 4 As shown, Figure 4 This is a schematic diagram of the ECC2f module structure in this specification.
[0116] ECBottleNeck provides an efficient attention enhancement method for deep neural networks by integrating the ECA attention mechanism into the BottleNeck module. In this module, the ECA attention mechanism is embedded in the traditional BottleNeck structure to fully utilize the correlation between feature channels and perform adaptive feature weighting in the feature channel dimension. This combination enables the network to better capture important features in the data while maintaining high efficiency, thereby improving the performance and generalization ability of the model.
[0117] For the Mini-DenseASPP module, DenseASPP (Dense Atrous Spatial Pyramid Pooling) is an advanced module for semantic segmentation that combines the advantages of dense connections and atrous convolutions. This module can capture feature information at different scales and improve the model's perception of the target through multiple parallel convolution branches with different atrous rates. Usually, the DenseASPP module contains multiple densely connected branches, each of which uses a different atrous rate to obtain contextual information at different scales.
[0118] The present invention proposes a Mini-DenseASPP module based on the DenseASPP module. Compared with the traditional DenseASPP module, the Mini-DenseASPP module is more concise, with only three nodes separated, and convolution operations with dilated convolution rates of 1, 3, and 5 respectively. This simplified structure can still effectively capture features at different scales while reducing the complexity of the model. Figure 5 As shown, Figure 5 This is a schematic diagram of a Mini-DenseASPP structure in this manual.
[0119] Moreover, compared with the original module, Mini-DenseASPP also introduces the SE attention mechanism. Through this mechanism, the module can weight the feature map and highlight important features to enhance the model's ability to learn key information.
[0120] After inputting the sample image into the improved YOLOv8 network and obtaining the predicted bounding box of each ship in the sample image, the server can determine the deviation loss between the predicted bounding box and the true bounding box based on the annotation of the sample image in step S101, and train the improved YOLOv8 network with the goal of minimizing the deviation loss to obtain a ship detection model capable of identifying ships.
[0121] For the loss function of the MASS-YOLO model, due to the use of the anchor-free idea, the loss function of YOLOv8 has changed greatly compared with the YOLOv5 series. It is mainly composed of two losses: classification and regression. The classification loss still uses the binary cross entropy loss (Binary CrossEntropy Loss), and the regression part uses the distribution focal loss DFL (Distribution Focal Loss) and regression loss (Bounding Box Regression Loss). Since there is only one type of SAR ship images, the binary cross entropy loss, that is, the category loss, is 0. The final total loss is the sum of the distribution focal loss DFL and the regression loss through a certain weight ratio. The final total loss function can be expressed as:
[0122] f loss =λ1f DFL +λ2f BBRL
[0123] DFL (Distribution Focal Loss) is an optimization of the focal loss function, which generalizes the discrete results of classification to continuous results through integration. The expression is:
[0124] f DFL (S i ,S i+1 )=-((y i+1 -y)log(s i )+(yy i )log(S i+1 ))
[0125] Among them, y i ,y i+1 represents the value close to the continuous label y from the left and right, satisfying y i <y<y i+1 ,and In the equation, P can be realized through a softmax layer P(y i ), that is, S i .
[0126] As an important part of the target detection loss function, the bounding box loss function will bring significant performance improvements to the target detection model if it is well defined. Most of the research in recent years assumes that the examples in the training data have high quality and is committed to strengthening the fitting ability of the bounding box loss.
[0127] However, the training data inevitably contains low-quality images. Geometric metrics such as distance and aspect ratio will aggravate the error of low-quality images and reduce the generalization ability of the model. A good loss function should reduce the penalty of geometric dimensions when the anchor box and the target box overlap well, without interfering too much with the training results, so that the model has better generalization ability.
[0128] Since SAR ship images have large changes in ship size and shape caused by interference from the environment and geographical location, there is a problem of low image quality. Therefore, the present invention adopts the Wise-IoU v3 loss function. Compared with the former, Wise-IoU v3 does not introduce the calculation of the aspect ratio, but adopts a dynamic non-monotonic focusing mechanism based on the attention-based bounding box loss Wise-IoU v1, and uses "outlier degree" to describe the quality of the anchor box, so that Wise-IoU can more accurately evaluate the target detection results and avoid the deviation problem of traditional IoU.
[0129] First, the attention-based bounding box loss function Wise-IoU v1 between the predicted bounding box and the true bounding box is expressed as follows:
[0130] L WIoUv1 =R WIoU L IoU
[0131]
[0132] Among them, L WIoUv1 is the attention-based Wise-IoUv1 bounding box loss function between the predicted bounding box and the true bounding box, L IoU is the bounding box loss between the predicted bounding box and the true bounding box, R WIoU is the distance attention, x and y are the horizontal and vertical coordinates of the center point of the predicted bounding box, respectively. gt ,y gt are the horizontal and vertical coordinates of the center point of the real bounding box, W g , H g are the width and height of the minimum enclosing rectangle of the predicted bounding box and the true bounding box, respectively. * represents the separation operation from the ship detection model calculation graph to make it a constant without gradient.
[0133] Next, the outlier degree β is used to describe the quality of the anchor box, which is defined as follows:
[0134]
[0135] The definition of outlier represents the quality of the anchor box. A small outlier means a high quality anchor box. A small gradient gain is assigned to it so that the bounding box regression focuses on the anchor box of normal quality. In the formula, For L IoU The sliding average of For L IoU The exponentially weighted moving average of .
[0136] Finally, the non-monotonic focusing coefficient is constructed using the outlier degree to obtain the bounding box deviation loss Wise-IoU v3 between the predicted bounding box and the true bounding box. The calculation formula is as follows:
[0137] L WIoUv3 =kL WIoUv1
[0138] Non-monotonic focusing coefficient:
[0139]
[0140] α and δ are hyperparameters, which are set to 1.9 and 3 respectively in one or more embodiments of the present invention; L WIoUv3 is the outlier-based Wise-IoU v3 loss function between the predicted bounding box and the true bounding box.
[0141] The server can obtain a ship detection model after performing multiple rounds of iterative training on the improved YOLOv8 network based on the deviation loss between the predicted bounding box and the true bounding box.
[0142] Based on this, the server can perform ship detection on the SAR ship images to be detected through the trained ship detection model.
[0143] First, the server can perform a convolution operation on the SAR ship image to be detected through the Conv module in the Backbone module, input the obtained feature map into the first convolution layer of the ECBottleneck module in the Backbone module, and perform a convolution operation through a 1×1 convolution kernel to obtain the ship features at the first scale.
[0144] Then, the server can input the ship features at the first scale into the second convolution layer of the ECBottleneck module, perform a convolution operation through a 3×3 convolution kernel, and obtain a ship feature map at the second scale.
[0145] Secondly, the ship features at the first scale are input into the ECA attention mechanism of the ECBottleneck module to generate the attention weights of each feature channel, and the features of each feature channel are weighted by the attention weights to obtain a weighted feature map.
[0146] Finally, the weighted feature map and the ship feature map at the second scale are spliced in the output channel dimension to obtain a spliced feature map. Multiple rounds of alternating feature extraction are performed through the Conv module and the Backbone module to obtain the first feature map. The first feature map is input into the Mini-DenseASPP module for multi-scale ship feature extraction to obtain the preliminary feature map of each ship structure in the SAR ship image to be detected.
[0147] The C2f module combined with the ECA attention mechanism not only helps improve feature modeling capabilities, but also reduces redundant information, allowing the network to focus more on key information that helps detect targets. This helps reduce the risk of false detection and improves model accuracy. During training, the ECA attention mechanism may also help accelerate model convergence and reduce training time.
[0148] When the ECA attention mechanism is introduced into the feature extraction stage of ship detection in Synthetic Aperture Radar (SAR) images, its effectiveness can be attributed to the following aspects:
[0149] Feature enhancement and importance emphasis: SAR ship images have characteristics such as noise interference and complex scattering. The ECA attention mechanism helps to reduce interference and highlight important ship structure features by focusing on learning and enhancing the most representative ship features, thereby improving detection performance.
[0150] Adaptive feature adjustment: The ECA mechanism is adaptive and can effectively learn the correlation between feature channels and adjust the weights of different output channels, so that the network pays more attention to the key features required for ship detection, which is conducive to suppressing irrelevant features and noise information.
[0151] Improve model learning ability: The ECA attention mechanism helps improve the learning ability of the ship detection model for ship detection tasks by learning the channel correlation between features. This mechanism enables the network to better adapt to different lighting conditions, ship size and posture changes, thereby enhancing the robustness and adaptability of the detection algorithm.
[0152] Improved generalization ability: The ECA mechanism helps the network to better generalize to new, unseen data samples, reduces the risk of overfitting of the model, and improves the practicality and reliability of the ship detection algorithm.
[0153] Therefore, the addition of the ECA attention mechanism in SAR image ship detection effectively optimizes the feature representation, highlights the key information, and improves the robustness and generalization ability of the model, thereby improving the accuracy and reliability of ship detection.
[0154] For the Mini-DenseASPP module, the input data is Where B is the batch size, Cin is the number of input channels, H and W are the height and width of the input SAR ship image to be detected, respectively. The process of the Mini-DenseASPP module is as follows:
[0155] First, the first convolution branch in the Mini-DenseASPP module convolves the preliminary feature map with a 1×1 convolution kernel to extract the ship features at the first scale to obtain the first branch feature map, that is, the input data x is convolved with a 1×1 convolution kernel to generate a feature map x1. This operation changes the number of channels of the input data or extracts different features through a small convolution kernel. is the convolution kernel of Conv1, is the bias term, and the formula is as follows:
[0156] x1=ReLU(W1*x+b1)
[0157] ReLU(x)=max(0,x)
[0158] After the first convolution, the second convolution branch in the Mini-DenseASPP module convolves the first branch feature map with a 3×3 convolution kernel to extract the ship features at the second scale to obtain the second branch feature map, that is, the obtained feature map x1 is convolved again, this time using a 3×3 convolution kernel. This step can capture feature information in a wider range. is the convolution kernel of Conv2, is the bias term, and the formula is as follows:
[0159] x2=RELU(W2*x1+b2)
[0160] After the second convolution, the second branch feature map is convolved with a 5×5 convolution kernel through the second convolution branch in the Mini-DenseASPP module to extract the ship features at the third scale to obtain the third branch feature map, that is, the obtained feature map x2 is convolved again, this time using a 5×5 convolution kernel. This step can capture feature information in a wider range. is the convolution kernel of Conv3, is the bias term, and the formula is as follows:
[0161] x3=RELU(W2*x1+W3*x2+b3)
[0162] Afterwards, the feature maps x1, x2, and x3 obtained by the first, second, and third convolutions are concatenated along the channel dimension to form a richer feature map x catThat is, the first branch feature map, the second branch feature map and the third branch feature map are spliced in the output channel dimension through the Mini-DenseASPP module to obtain a multi-scale spliced feature map.
[0163]
[0164] Next, the SE attention mechanism module in the Mini-DenseASPP module performs global average pooling on the multi-scale spliced feature map, generates the attention weight of each feature channel, and weights the features of each feature channel in the multi-scale spliced feature map by the attention weight. cat Perform global average pooling (average the values on each channel), and then use two fully connected layers and activation functions to generate an attention weight z. This weight weights each feature channel in the input feature map to highlight the more important features.
[0165]
[0166] z=f SE (y)=Sidmoid(ReLU(W4·ReLU(W4·y)))
[0167]
[0168] Where W4 and W5 are linear weight matrices. cat Each feature channel in is weighted according to z:
[0169] x cat =z⊙x cat
[0170] where ⊙ represents element-wise multiplication.
[0171] The last step is to use the Mini-DenseASPP module to perform a convolution operation on the weighted multi-scale spliced feature map with a 1×1 convolution kernel to extract the ship features and obtain a preliminary feature map. That is, use a 1×1 convolution kernel to convolve the feature map x after SEAttention processing. cat A convolution operation is performed to generate the preliminary feature map x4 of the final output. This operation can be understood as another feature transformation or dimensionality reduction of the feature map after the weighting of the attention mechanism. is the convolution kernel of Conv4, is the bias term, and the formula is as follows:
[0172] x4=ReLU(W6*x cat +b4)
[0173] These improvements enable the Mini-DenseASPP module to extract multi-scale features more effectively while maintaining simplicity, and optimize feature fusion by introducing an attention mechanism, which can improve model performance and effects in ship detection based on SAR ship images.
[0174] After that, the Neck module can be used to extract features from the preliminary feature map to obtain enhanced feature maps of each ship structure, and the Prediction module can be used to detect the enhanced feature map to obtain each ship target in the synthetic aperture radar ship image to be detected, for example, the ship target can be identified by a bounding box.
[0175] based on Figure 2 The ship detection method based on synthetic aperture radar images shown in the figure first obtains synthetic aperture radar ship images as sample images and marks the real bounding boxes of each ship, then replaces the C2f module in the backbone network of the YOLOv8 network with the ECC2f module and replaces the SPPF module with the Mini-DenseASPP module to construct an improved YOLOv8 network, and then inputs the sample images into the improved YOLOv8 network for training to obtain a ship detection model capable of identifying ships, and applies the trained ship detection model to perform ship detection on the synthetic aperture radar ship images to be detected.
[0176] The present invention replaces the C2f module in the backbone network of the YOLOv8 network with the ECC2f module and the SPPF module with the Mini-DenseASPP module. The ECC2f module is used to obtain more image information while ensuring the parameter amount and the model size, and the ability of the ship detection model to obtain ship features is enhanced. Even if there are a large number of small ships in the synthetic aperture radar ship image, the effective features of each small ship can be obtained. The multi-scale adaptability of the Mini-DenseASPP module is used to overcome the deviation of the ship detection model to the small ship target, thereby improving the accuracy and precision of SAR image ship detection.
[0177] When applying the ship detection method based on synthetic aperture radar images provided in this specification, it is not necessary to Figure 2 The steps are executed in the order shown. The specific execution order of the steps can be determined according to needs, and this manual does not limit this.
[0178] In addition, in this specification, a schematic diagram comparing the ship detection method based on synthetic aperture radar images in this specification with other methods is also provided, such as Figure 6As shown in Figure 1, in actual applications, due to the influence of shooting height, environmental noise, day and night changes, ship size and other factors, the semantic representation of ship details in SAR ship images is different. Therefore, this paper selects SAR ship images of different sizes in different scenes.
[0179] Depend on Figure 6 As can be seen in part (a), when the ship outline is obvious, both the initial model (YOLOv8) and the MASS-YOLO ship detection model (Ours) of the present invention achieve good results. Figure 6 (b), as shown in Part 6(c), in the dense case, both the initial model and the MASS-YOLO model perform well without false detection or missed detection, but the MASS-YOLO model has a higher confidence level. Figure 6 (d) represents the situation of near-shore ships, and the image quality is low and the noise is high, which is difficult for the model. It can be seen that the initial model has a false detection here, while the MASS-YOLO model has no false detection. This represents the adaptation of the MASS-YOLO model to low-quality SAR ship images. This is because the Mini-DenseASPP module obtains contextual information of different receptive fields by dilating convolutions with different dilation convolution rates, and integrates information of different scales through the SE attention mechanism, which improves the MASS-YOLO model's ability to extract ship features of different scales, which enables it to extract sufficient semantic information for both large and small targets, and improves the generalization ability of the MASS-YOLO model.
[0180] The above is a ship detection method based on synthetic aperture radar images provided by one or more embodiments of this specification. Based on the same idea, this specification also provides a corresponding ship detection device based on synthetic aperture radar images, such as Figure 7 shown.
[0181] Figure 7 A schematic diagram of a ship detection device based on synthetic aperture radar images provided in this specification includes:
[0182] An acquisition module 201 is used to acquire synthetic aperture radar ship images collected at historical moments as sample images, and to mark the real boundary box of each ship in the sample image;
[0183] A construction module 202 is used to replace the C2f module in the Backbone module of the YOLOv8 network with the ECC2f module and replace the SPPF module with the Mini-DenseASPP module, and construct an improved YOLOv8 network by combining the Backbone module after the module replacement with the Neck module and the Prediction module in the YOLOv8 network;
[0184] The training module 203 is used to input the sample image into the improved YOLOv8 network to obtain the predicted bounding box of each ship in the sample image; and to train the improved YOLOv8 network with minimizing the deviation loss between the predicted bounding box and the true bounding box as the optimization goal to obtain a ship detection model;
[0185] The detection module 204 is used to perform ship detection on the synthetic aperture radar ship image to be detected through the ship detection model, identify the synthetic aperture radar ship image to be detected through the Backbone module, and obtain the preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected; extract features from the preliminary feature map through the Neck module to obtain the enhanced feature map of each ship structure; detect the enhanced feature map through the Prediction module to obtain each ship target in the synthetic aperture radar ship image to be detected.
[0186] Optionally, the acquisition module 201 forms a real bounding box of each ship by marking the coordinates of the center point of each ship in the sample image and the width and height of the bounding box.
[0187] Optionally, the construction module 202 replaces the BottleNeck module in the C2f module in the backbone network of the YOLOv8 network with an ECBottleNeck module; the ECBottleNeck module is obtained by embedding the ECA attention mechanism into the residual structure of the BottleNeck module.
[0188] Optionally, the detection module 204 performs a convolution operation on the synthetic aperture radar ship image to be detected through the Conv module in the Backbone module, inputs the obtained feature map into the first convolution layer of the ECBottleneck module in the Backbone module, performs a convolution operation through a 1×1 convolution kernel to obtain ship features at a first scale, inputs the ship features at the first scale into the second convolution layer of the ECBottleneck module, performs a convolution operation through a 3×3 convolution kernel to obtain a ship feature map at a second scale, inputs the ship features at the first scale into the ECA attention mechanism of the ECBottleneck module, generates attention weights for each feature channel, and weights the features of each feature channel by the attention weight to obtain a weighted feature map, and splices the weighted feature map and the ship feature map at the second scale in the output channel dimension to obtain a spliced feature map; performs multiple rounds of alternating feature extraction through the Conv module and the Backbone module to obtain a first feature map, and inputs the first feature map into the Mini-DenseASPP module to perform multi-scale ship feature extraction to obtain a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected.
[0189] Optionally, the detection module 204 convolves the preliminary feature map with a 1×1 convolution kernel through the first convolution branch in the Mini-DenseASPP module to extract ship features at the first scale to obtain a first branch feature map, convolves the first branch feature map with a 3×3 convolution kernel through the second convolution branch in the Mini-DenseASPP module to extract ship features at the second scale to obtain a second branch feature map, convolves the second branch feature map with a 5×5 convolution kernel through the second convolution branch in the Mini-DenseASPP module to extract ship features at a third scale to obtain a third branch feature map, and The first branch feature map, the second branch feature map and the third branch feature map are spliced in the output channel dimension through the Mini-DenseASPP module to obtain a multi-scale spliced feature map. The multi-scale spliced feature map is globally averaged pooled through the SE attention mechanism module in the Mini-DenseASPP module, and the attention weight of each feature channel is generated. The features of each feature channel in the multi-scale spliced feature map are weighted by the attention weight. The weighted multi-scale spliced feature map is convolved with a 1×1 convolution kernel through the Mini-DenseASPP module to extract the ship features and obtain a preliminary feature map.
[0190] Optionally, the training module 203 determines an attention-based bounding box loss function Wise-IoU v1 between the predicted bounding box and the true bounding box by the following formula:
[0191] L WIoUv1 =R WIoU L IoU ,
[0192] The outlier degree is used to determine the quality of the predicted bounding box by the following formula:
[0193]
[0194] The non-monotonic focusing function is constructed based on the outlier degree by the following formula to determine the deviation loss Wise-IoU v3 between the predicted bounding box and the true bounding box:
[0195] L WIoUv3 =kL WIoUv1 ,
[0196] Among them, L WIoUv1 is the attention-based bounding box loss function between the predicted bounding box and the ground-truth bounding box, L IoU is the bounding box loss between the predicted bounding box and the true bounding box, R WIoU is the distance attention, x and y are the horizontal and vertical coordinates of the center point of the predicted bounding box, respectively. gt,y gt are the horizontal and vertical coordinates of the center point of the real bounding box, W g , H g are the width and height of the minimum bounding rectangle of the predicted bounding box and the true bounding box, respectively. * indicates the separation operation from the ship detection model calculation graph. For L IoU is the sliding average of , k is the non-monotonic focusing coefficient, β is the outlier degree, and α and δ are hyperparameters.
[0197] For the specific definition of the ship detection device based on synthetic aperture radar images, please refer to the definition of the ship detection method based on synthetic aperture radar images in the above text, which will not be repeated here. Each module in the above-mentioned ship detection device based on synthetic aperture radar images can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0198] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 2 A ship detection method based on synthetic aperture radar images is provided.
[0199] This manual also provides Figure 8 The structural diagram of the computer device shown in FIG. Figure 8 As shown in the figure, at the hardware level, the computer device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 2 A ship detection method based on synthetic aperture radar images is provided.
[0200] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0201] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
Claims
1. A ship detection method based on synthetic aperture radar images, characterized in that: include: Acquire synthetic aperture radar ship images collected at historical moments as sample images, and annotate the true bounding box of each ship in the sample images; The C2f module in the Backbone module of the YOLOv8 network is replaced with the ECC2f module, and the SPPF module is replaced with the Mini-DenseASPP module. The Backbone module after the module replacement is combined with the Neck module and the Prediction module in the YOLOv8 network to construct an improved YOLOv8 network. The sample image is input into the improved YOLOv8 network to obtain the predicted bounding box of each ship in the sample image; and the improved YOLOv8 network is trained with the minimization of the deviation loss between the predicted bounding box and the true bounding box as the optimization goal to obtain the ship detection model; The ship detection model is used to detect the synthetic aperture radar ship image to be detected, and the synthetic aperture radar ship image to be detected is recognized through the Backbone module to obtain the preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected; the Neck module is used to extract the features of the preliminary feature map to obtain the enhanced feature map of each ship structure; the Prediction module is used to detect the enhanced feature map to obtain each ship target in the synthetic aperture radar ship image to be detected; The real bounding box of each ship in the labeled sample image includes: By marking the center point coordinates of each ship in the sample image and the width and height of the bounding box, the real bounding box of each ship is formed; The method of replacing the C2f module in the backbone network of the YOLOv8 network with the ECC2f module includes: The BottleNeck module in the C2f module in the backbone network of the YOLOv8 network is replaced with the ECBottleNeck module; the ECBottleNeck module is obtained by embedding the ECA attention mechanism into the residual structure of the BottleNeck module; The method of identifying the synthetic aperture radar ship image to be detected by the Backbone module and obtaining a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected includes: The Conv module in the Backbone module performs a convolution operation on the synthetic aperture radar ship image to be detected, and the obtained feature map is input into the first convolution layer of the ECBottleneck module in the Backbone module, and a convolution operation is performed through a 1×1 convolution kernel to obtain the ship features at the first scale; The ship features at the first scale are input into the second convolutional layer of the ECBottleneck module, and a convolution operation is performed through a 3×3 convolution kernel to obtain a ship feature map at the second scale; The ship features at the first scale are input into the ECA attention mechanism of the ECBottleneck module to generate the attention weights of each feature channel, and the features of each feature channel are weighted by the attention weights to obtain a weighted feature map; The weighted feature map and the ship feature map at the second scale are spliced in the output channel dimension to obtain a spliced feature map; multiple rounds of alternating feature extraction are performed through the Conv module and the Backbone module to obtain a first feature map, and the first feature map is input into the Mini-DenseASPP module for multi-scale ship feature extraction to obtain a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected; The first feature map is input into the Mini-DenseASPP module to extract multi-scale ship features to obtain a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected, including: The first convolution branch in the Mini-DenseASPP module convolves the preliminary feature map with a 1×1 convolution kernel to extract the ship features at the first scale to obtain the first branch feature map; The second convolution branch in the Mini-DenseASPP module convolves the first branch feature map with a 3×3 convolution kernel to extract the ship features at the second scale to obtain the second branch feature map; The second convolution branch in the Mini-DenseASPP module convolves the second branch feature map with a 5×5 convolution kernel to extract the ship features at the third scale to obtain the third branch feature map; The first branch feature map, the second branch feature map and the third branch feature map are spliced in the output channel dimension through the Mini-DenseASPP module to obtain a multi-scale spliced feature map; The SE attention mechanism module in the Mini-DenseASPP module performs global average pooling on the multi-scale spliced feature map, generates the attention weight of each feature channel, and weights the features of each feature channel in the multi-scale spliced feature map through the attention weight; The weighted multi-scale spliced feature map is convolved with a 1×1 convolution kernel through the Mini-DenseASPP module to extract the ship features and obtain a preliminary feature map. The deviation loss between the predicted bounding box and the true bounding box includes: The attention-based bounding box loss function Wise-IoU v1 between the predicted bounding box and the true bounding box is determined by the following formula: L WIoUv1 =R WIoU L IoU , The outlier degree is used to determine the quality of the predicted bounding box by the following formula: The non-monotonic focusing function is constructed based on the outlier degree by the following formula to determine the deviation loss Wise-IoU v3 between the predicted bounding box and the true bounding box: L WIoUv3 =kL WIoUv1 , Among them, L WIoUv1 is the attention-based Wise-IoU v1 bounding box loss function between the predicted bounding box and the true bounding box, L IoU is the bounding box loss between the predicted bounding box and the true bounding box, R WIoU is the distance attention, x and y are the horizontal and vertical coordinates of the center point of the predicted bounding box, respectively. gt ,y gt are the horizontal and vertical coordinates of the center point of the real bounding box, W g , H g are the width and height of the minimum bounding rectangle of the predicted bounding box and the true bounding box, respectively. * indicates the separation operation from the ship detection model calculation graph. For L IoU The sliding average of , k is the non-monotonic focusing coefficient, β is the outlier degree, α and δ are hyperparameters, For L IoU The exponentially weighted moving average of WIoUv3 is the outlier-based Wise-IoU v3 loss function between the predicted bounding box and the true bounding box.
2. A ship detection device based on synthetic aperture radar images, characterized in that: include: An acquisition module, used to acquire synthetic aperture radar ship images collected at historical moments as sample images, and to mark the real bounding box of each ship in the sample image; A construction module is used to replace the C2f module in the Backbone module of the YOLOv8 network with the ECC2f module and the SPPF module with the Mini-DenseASPP module, and to construct an improved YOLOv8 network by combining the Backbone module after the module replacement with the Neck module and the Prediction module in the YOLOv8 network; The training module is used to input the sample image into the improved YOLOv8 network to obtain the predicted bounding box of each ship in the sample image; and to train the improved YOLOv8 network with the optimization goal of minimizing the deviation loss between the predicted bounding box and the true bounding box to obtain a ship detection model; The detection module is used to perform ship detection on the synthetic aperture radar ship image to be detected through the ship detection model, identify the synthetic aperture radar ship image to be detected through the Backbone module, and obtain the preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected; extract features from the preliminary feature map through the Neck module to obtain the enhanced feature map of each ship structure; detect the enhanced feature map through the Prediction module to obtain each ship target in the synthetic aperture radar ship image to be detected; The real bounding box of each ship in the labeled sample image includes: By marking the center point coordinates of each ship in the sample image and the width and height of the bounding box, the real bounding box of each ship is formed; The method of replacing the C2f module in the backbone network of the YOLOv8 network with the ECC2f module includes: The BottleNeck module in the C2f module in the backbone network of the YOLOv8 network is replaced with the ECBottleNeck module; the ECBottleNeck module is obtained by embedding the ECA attention mechanism into the residual structure of the BottleNeck module; The method of identifying the synthetic aperture radar ship image to be detected by the Backbone module and obtaining a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected includes: The Conv module in the Backbone module performs a convolution operation on the synthetic aperture radar ship image to be detected, and the obtained feature map is input into the first convolution layer of the ECBottleneck module in the Backbone module, and a convolution operation is performed through a 1×1 convolution kernel to obtain the ship features at the first scale; The ship features at the first scale are input into the second convolutional layer of the ECBottleneck module, and a convolution operation is performed through a 3×3 convolution kernel to obtain a ship feature map at the second scale; The ship features at the first scale are input into the ECA attention mechanism of the ECBottleneck module to generate the attention weights of each feature channel, and the features of each feature channel are weighted by the attention weights to obtain a weighted feature map; The weighted feature map and the ship feature map at the second scale are spliced in the output channel dimension to obtain a spliced feature map; multiple rounds of alternating feature extraction are performed through the Conv module and the Backbone module to obtain a first feature map, and the first feature map is input into the Mini-DenseASPP module for multi-scale ship feature extraction to obtain a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected; The first feature map is input into the Mini-DenseASPP module to extract multi-scale ship features to obtain a preliminary feature map of each ship structure in the synthetic aperture radar ship image to be detected, including: The first convolution branch in the Mini-DenseASPP module convolves the preliminary feature map with a 1×1 convolution kernel to extract the ship features at the first scale to obtain the first branch feature map; The second convolution branch in the Mini-DenseASPP module convolves the first branch feature map with a 3×3 convolution kernel to extract the ship features at the second scale to obtain the second branch feature map; The second convolution branch in the Mini-DenseASPP module convolves the second branch feature map with a 5×5 convolution kernel to extract the ship features at the third scale to obtain the third branch feature map; The first branch feature map, the second branch feature map and the third branch feature map are spliced in the output channel dimension through the Mini-DenseASPP module to obtain a multi-scale spliced feature map; The SE attention mechanism module in the Mini-DenseASPP module performs global average pooling on the multi-scale spliced feature map, generates the attention weight of each feature channel, and weights the features of each feature channel in the multi-scale spliced feature map through the attention weight; The weighted multi-scale spliced feature map is convolved with a 1×1 convolution kernel through the Mini-DenseASPP module to extract the ship features and obtain a preliminary feature map. The deviation loss between the predicted bounding box and the true bounding box includes: The attention-based bounding box loss function Wise-IoU v1 between the predicted bounding box and the true bounding box is determined by the following formula: L WIoUv1 =R WIoU L IoU , The outlier degree is used to determine the quality of the predicted bounding box by the following formula: The non-monotonic focusing function is constructed based on the outlier degree by the following formula to determine the deviation loss Wise-IoU v3 between the predicted bounding box and the true bounding box: L WIoUv3 =kL WIoUv1 , Among them, L WIoUv1 is the attention-based Wise-IoU v1 bounding box loss function between the predicted bounding box and the true bounding box, L IoU is the bounding box loss between the predicted bounding box and the true bounding box, R WIoU is the distance attention, x and y are the horizontal and vertical coordinates of the center point of the predicted bounding box, respectively. gt ,y gt are the horizontal and vertical coordinates of the center point of the real bounding box, W g , H g are the width and height of the minimum bounding rectangle of the predicted bounding box and the true bounding box, respectively. * indicates the separation operation from the ship detection model calculation graph. For L IoU The sliding average of , k is the non-monotonic focusing coefficient, β is the outlier degree, α and δ are hyperparameters, For L IoU The exponentially weighted moving average of WIoUv3 is the outlier-based Wise-IoU v3 loss function between the predicted bounding box and the true bounding box.
3. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to claim 1 is implemented.
4. A computer device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the method according to claim 1 is implemented when the processor executes the program.
Citation Information
Patent Citations
Ship behavior analysis method based on YOLO model
CN110610165A
Marine ship detection method based on synthetic aperture radar data
CN116665148A
YOLO-Ships lightweight ship target detection method based on feature enhancement
CN117576372A
Remote sensing image ship small target detection method and system
CN117789030A