Improved deep learning ship detection method for SAR image
By introducing a multi-level attention mechanism and a cross-layer feature fusion module in the deep learning model, combined with the normalized Gaussian Wasserstein distance loss function, the problem of poor detection effect of small-size ships in SAR images is solved, and higher detection accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202411829276.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has poor detection effect on small-sized ship targets in SAR images, especially under complex backgrounds and noise interference, making it difficult to effectively identify and distinguish ship targets.
An improved deep learning ship detection method is proposed. By introducing a multi-level attention mechanism and a cross-layer feature fusion module in the existing deep learning model, the feature extraction and fusion capabilities are improved, the impact of background noise is reduced, and the normalized Gaussian Wasserstein distance is used as the bounding box regression loss function, and the model training is optimized.
It significantly improves the detection accuracy of small-sized ship targets in SAR images, reduces the missed detection rate and false detection rate, and enhances the robustness of the model and anti-interference ability to complex backgrounds.
Smart Images

Figure CN119784693A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to an improved deep learning ship detection method for SAR images. Background Art
[0002] With the continuous development of Synthetic Aperture Radar (SAR) technology, its application in the fields of ocean monitoring, military reconnaissance, environmental monitoring, etc. is becoming more and more extensive. SAR system can penetrate clouds and fog, provide all-weather and all-day high-resolution images, especially suitable for monitoring surface ship targets.
[0003] However, the SAR imaging principle brings a series of processing challenges, especially in the detection of small-sized ship targets. The coherent speckle noise interference in the SAR imaging process often leads to blurred edges and reduced resolution of objects in the image, which brings difficulties to image interpretation. In particular, the size of ship targets in SAR images is usually less than 32×32 pixels, and the background of the nearshore area is complex, which further increases the difficulty of the detection task. Therefore, developing a detection method that can efficiently identify ship targets in SAR images is not only of great practical significance, but also has significant application value.
[0004] Previous work on this challenge can be roughly divided into traditional methods and deep learning-based methods. Traditional detection methods mainly rely on hand-designed features and limited shallow learning representations, and often include three steps: land and sea segmentation, CFAR (Constant False Alarm Rate) detection, and discriminator discrimination, such as "SAR image filtering based on the heavy-tailed Rayleighmodel" published in "IEEE Transactions on Image Processing" and "An Efficient and Flexible Statistical Model Based on Generalized Gamma Distribution for Amplitude SAR Images" published in "IEEE Transactions on Geoscience and Remote Sensing". Although traditional detection algorithms are popular for their simplicity and effectiveness, their performance often fails to meet expectations in the face of complex backgrounds and noise interference.
[0005] In recent years, with the rise of deep learning technology, target detection methods based on deep neural networks have shown great potential in the field of SAR image ship detection. Deep learning models, such as "You Only LookOnce: Unified, Real-Time Object Detection" published in "Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition.2016" and subsequent improved series, can automatically learn image features through end-to-end training, improving the accuracy and efficiency of detection. However, existing deep learning models are mainly designed for conventional optical images. When directly applied to SAR images, the performance of these models is not ideal due to the unique imaging mechanism and noise characteristics of SAR images.
[0006] Especially in SAR images, small-sized ship targets occupy fewer pixels in the image, and the coherent speckle noise of SAR images makes the feature extraction and recognition of these targets extremely difficult. In addition, ship targets in SAR images often present irregular shapes and various orientations, which further increases the complexity of detection. Summary of the invention
[0007] In order to overcome the detection difficulties of small-sized ship targets in SAR images mentioned in the above background, the present invention proposes an improved deep learning ship detection method for SAR images. The method is implemented based on an improved deep learning ship detection model. The improved deep learning ship detection model is an efficient SAR image ship target detection model. It innovatively improves the existing deep learning model to solve the problems of complex network of existing detection methods and poor detection effect for a large number of small-scale ship targets, reduce the false detection rate and missed detection rate, and improve the detection accuracy.
[0008] In order to achieve the above object, the present invention adopts the following technical solutions:
[0009] An improved deep learning ship detection method for SAR images is implemented based on an improved deep learning ship detection model. The SAR image to be detected is input into a trained improved deep learning ship detection model for detection to obtain a SAR ship target detection result. The training process of the improved deep learning ship detection model specifically includes the following steps:
[0010] S1: collecting an original SAR image ship dataset, wherein the original SAR image ship dataset includes SAR ship images in a nearshore area and an offshore area; and preprocessing the SAR ship images in the original SAR image ship dataset;
[0011] S2: Construct an improved deep learning ship detection model; the improved deep learning ship detection model includes a feature extraction backbone network, a feature fusion neck network and a target detection network; the feature extraction backbone network is used to extract ship target feature maps of different scales based on a multi-level attention mechanism, improve the model's ability to extract ship target features, and ignore the influence of background noise; the feature fusion neck network is used to first increase the dimension and then reduce the dimension of ship target feature maps of different scales, and perform cross-layer fusion in the process of dimensionality increase and dimensionality reduction, integrating low-level detail features with high-level semantic features to form a multi-scale feature representation of the target, and further strengthen the characteristics of small-scale ship targets; the target detection network is used to perform target detection on the features after cross-layer fusion.
[0012] S3: Iteratively training the improved deep learning ship detection model;
[0013] The preprocessed SAR image ship dataset is input into the improved deep learning ship detection model for training. During the training process, the normalized Gaussian Wasserstein distance is introduced as the bounding box regression loss function to supervise the performance of the model during the training process. The training is iterated until the specified number of iterations is reached to obtain the trained improved deep learning ship detection model.
[0014] In the above technical solution, further, in step S2, the feature extraction backbone network introduces a multi-level attention module based on the original feature extraction backbone network of YOLOv5; the multi-level attention module includes at least two levels of attention modules from coarse to fine, and each attention module is used to enhance the model's attention to features of different scales.
[0015] Furthermore, the feature extraction backbone network specifically includes six layers of CBS modules, four layers of C3 modules, one SPPF module and one BRA module.
[0016] The CBS module consists of three basic structures: a convolutional layer, which is responsible for extracting features; a batch normalization layer, which is used to adjust data distribution; and an activation function SiLU, which introduces nonlinear factors into the model by performing specific mathematical transformations on the input data, thereby enhancing the model's expressive power and learning effect.
[0017] The C3 module consists of three CBS modules and several BottleNeck modules. After the feature map enters C3, it is divided into two paths, one of which is calculated only by one CBS module, and the other is first calculated by a CBS module and then by multiple groups of BottleNeck with residual connections. The use of the residual structure in BottleNeck can well avoid the problem of gradient disappearance. Finally, the two features are merged and then passed through a CBS module for feature map dimensionality reduction.
[0018] The SPPF module uses three serial pooling layers to reduce the dimension of the feature map. After each pooling layer, the dimension of the feature map is reduced to half of the previous one, and finally the feature maps of four scales are fused.
[0019] The BRA module is the multi-level attention module introduced in the present invention. The core advantage of the attention mechanism in this module lies in its global perception ability, which allows the model to capture and process long-distance dependencies in the image and optimizes the feature extraction ability of the model. Its mathematical expression is as follows:
[0020]
[0021] Among them, Attention (Q, K, V) represents the calculation result of the attention score, which is an output tensor obtained after the attention operation; Q represents the query tensor, which is used to retrieve (match) the key-value pair information related to itself in the attention mechanism; K represents the key tensor, which is matched with the query tensor Q to determine the weights of different positions; V represents the value tensor, which contains the feature information to be extracted and fused; Softmax is an activation function that is used to adjust the input value. Perform normalization to convert the input value into a probability distribution (the value of each element ranges from 0 to 1, and the sum of all elements is 1); represents the transpose of the query tensor Q and the key tensor K ( represents the transpose operation) to perform matrix multiplication.
[0022] The Softmax function is defined as follows:
[0023]
[0024] Among them, Softmax(x i ) represents the output result of the Softmax function, specifically the probability value obtained after the Softmax function calculates the i-th element in the input vector; x i represents the i-th element in the input vector; exp(x i ) means that the base is the natural constant e, x iis the result of the exponential function operation of the exponent; j exp(x j ) represents the sum of all elements in the input vector after exponential operation. Here j traverses all dimensions of the input vector, that is, from the first element to the last element, and the result of this sum is used as the denominator to normalize the exponential operation result of each element.
[0025] However, the comprehensive calculation of the attention mechanism at all spatial positions in the image inevitably brings high computational complexity and memory consumption, which may have an adverse impact on the detection speed and real-time performance in the ship target detection task. The first-level BRA module first divides the input feature map into S×S non-overlapping regions, and then performs regional average calculation. The specific method is to average the pixel values in all regions and obtain the regional query tensor Q based on the average pixel value. r and the key tensor K r After that, the attention score is calculated. According to the scores calculated by the first-level BRA module, the input feature map is pruned, and the top k regions that are most relevant to each region are retained to obtain a more refined pixel-level query, key, and value vector Q g , K g and V g , and then perform more refined attention calculations (i.e., second-level calculations) on these selected k regions to obtain feature maps of different scales.
[0026] Furthermore, in step S2, the feature fusion neck network introduces multiple cross-layer feature fusion modules based on the original feature fusion neck network of YOLOv5. The cross-layer feature fusion module is used to adopt a learnable dynamic weight allocation mechanism to perform weighted fusion on feature maps of different scales, thereby enhancing the characteristics of small-scale ship targets.
[0027] Furthermore, the feature fusion neck network consists of five C3 modules, four CBS modules, three upsampling modules and four cross-layer feature fusion modules (ie, BIFPN_ADD).
[0028] The C3 module and CBS module have the same structure as the C3 module and CBS module in the feature extraction backbone network. The upsampling module is used to increase the dimension of the feature map. The cross-layer feature fusion module performs cross-layer fusion on feature maps of different scales to construct a multi-scale feature map of the target.
[0029] The feature map obtained after processing the nth layer of the feature extraction backbone network (all feature maps of the same scale are considered to be the same layer) is denoted as P n , the fused feature map output by the cross-layer feature fusion module of the nth layer in the bottom-up path is recorded as P n′ , the fused feature map output by the n-th cross-layer feature fusion module in the top-down path is recorded as Among them, the two C3 modules + CBS modules in the bottom-up path do not change the dimension of the feature map, the first layer of C3 modules + CBS modules in the top-down path do not change the dimension of the feature map, and the second layer of C3 modules + CBS modules are used to reduce the dimension of the feature map. By setting the step size parameter, it can be determined whether the C3 module and CBS module will reduce the dimension of the input feature map or maintain the input dimension.
[0030] The calculation method of the cross-layer feature fusion module is as follows:
[0031] (1) The output of the first-layer cross-layer feature fusion module is the feature map P2 output by the second-layer cross-layer feature fusion module in the bottom-up path. ′ After the upsampling module, we get:
[0032]
[0033] (2) The output of the second-layer cross-layer feature fusion module is:
[0034]
[0035] (3) The output of the third-layer cross-layer feature fusion module is:
[0036]
[0037] In these five formulas, w and w′ represent the learnable weights when the feature maps are fused (the subscripts are independent of the number of layers), where w1 and w2 are used to measure the relative importance of feature map P2 and feature map Upsample (P′3) when calculating feature map P′2; w′1, w′2, and w′3 are used to measure the relative importance of feature map P2 and feature map Upsample (P′3) when calculating feature map P′2. When the feature map P3, feature map P′3 and feature map The relative importance of feature map P3 and feature map Upsample (P4) when calculating feature map P′3; w′4 and w′5 are used to measure the relative importance of feature map P3 and feature map Upsample (P4) when calculating feature map P′3; w′4 and w′5 are used to measure the relative importance of feature map P3 and feature map Upsample (P4) when calculating feature map P′3. When feature map P4 and feature map The relative importance of the input feature map; Upsample means that the input feature map is increased in dimension through the upsampling module; Resize means that the input feature map is reduced in dimension through the C3 module and the CBS module; ∈ is a constant to avoid numerical instability, usually a very small positive number (such as 10 -5 ).
[0038] The key to the cross-layer feature fusion module is its learnable weight mechanism. When fusion is performed, features of different resolutions are first mapped to the same resolution. For ship targets of different sizes, these features of different resolutions have different contributions. Through the dynamically learnable weight mechanism, the network can learn and emphasize features that are more important to the current task. By dynamically adjusting the contribution of features of different resolutions, the features of small-scale ship targets can be strengthened.
[0039] Furthermore, in step S3, the bounding box regression loss function is specifically:
[0040] For a rectangular bounding box, the pixels of the object to be detected are generally concentrated in the center of the bounding box. It can be considered that the probability of the target pixel x in the bounding box is related to the distance from the center of the bounding box. This relationship is simplified to a normal distribution, with the mean vector u taking the coordinates of the center of the bounding box; the standard deviation Σ taking the width and height of the bounding box, then the Wasserstein distance can be used to calculate the overlap between the two boxes through probability distribution. The probability density function of the two-dimensional normal distribution is defined as follows:
[0041]
[0042] Use (cx, cy, w, h) to represent a rectangular bounding box, where the first two items are the coordinates of the center point of the box, and the last two items are the width and height of the box. For any bounding boxes A and B, their overlap is calculated using the Wasserstein distance based on the probability distribution. The Wasserstein distance is defined as follows:
[0043]
[0044] Among them, N a , N b They are the two-dimensional normal distributions corresponding to the predicted bounding box A and the true bounding box B respectively (obtained by integrating the probability density function of the two-dimensional normal distribution); cx a and cx b are the horizontal coordinates of the center points of the predicted bounding box A and the real bounding box B respectively; cy a andcy b are the ordinates of the center points of the predicted bounding box A and the true bounding box B respectively; w a and w b are the widths of the predicted bounding box A and the true bounding box B respectively; h a and h b are the heights of the predicted bounding box A and the true bounding box B, respectively.
[0045] The Wasserstein distance is normalized by exponential calculation, which is the normalized Gaussian Wasserstein distance of the present invention. It is used as the bounding box regression loss function to monitor the performance of the model during training. The calculation formula of the bounding box regression loss function is:
[0046]
[0047] Among them, Loss represents the bounding box regression loss, exp represents the result of the exponential function operation with the natural constant e as the base and the input value as the exponential; C is a constant, which is set to the average size of the targets in the preprocessed SAR image ship dataset.
[0048] The beneficial effects of the present invention are:
[0049] The purpose of the present invention is to provide an improved deep learning ship detection method for SAR images to complete the efficient recognition of small-sized ship targets in SAR image monitoring. The method described in the present invention not only has good robustness, but also can be fine-tuned for different data sets and new data sets to expand the existing deep network model. Through the deep learning method provided by the present invention, the accuracy of ship target recognition in SAR images is improved, and the missed detection rate and false detection rate are reduced. The present invention makes innovative improvements to the existing deep learning model, introduces a multi-level attention mechanism to improve the feature extraction backbone network, improves the model's ability to extract ship target features, and ignores the influence of background noise; introduces multiple cross-layer feature fusion modules on the basis of the original feature fusion neck network, fuses low-level detail features with high-level semantic features, forms a multi-scale feature representation of the target, further strengthens the features of small-scale ship targets, and optimizes the feature fusion ability of the model; and introduces the normalized Gaussian Wasserstein distance as the loss function to supervise the model training process, thereby significantly improving the model's detection performance for small-sized ship targets in SAR images. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a training flow chart of the improved deep learning ship detection model of the present invention.
[0051] Figure 2 It is a schematic diagram of the SAR image ship target detection model of the present invention.
[0052] Figure 3 It is the workflow diagram of the C3 module in the present invention.
[0053] Figure 4 The figure is a schematic diagram comparing the detection effects of the present invention and the original YOLOv5 model.
[0054] Figure 5Schematic diagram of the positioning confidence loss function curve of the present invention and the original YOLOv5 model. DETAILED DESCRIPTION
[0055] The present invention is further described below in conjunction with the accompanying drawings.
[0056] The present invention provides an improved deep learning ship detection method for SAR images, which is based on an improved deep learning ship detection model and shows excellent performance in detecting small-scale ship targets in SAR images. The model of the present invention can effectively distinguish ship targets from background noise, thereby reducing the occurrence of false detection and missed detection and enhancing the reliability of the detection results.
[0057] like Figure 1 The training process of the improved deep learning ship detection model specifically includes the following steps:
[0058] S1: collecting an original SAR image ship dataset, wherein the original SAR image ship dataset includes SAR ship images in a nearshore area and an offshore area; and preprocessing the SAR ship images in the original SAR image ship dataset;
[0059] The preprocessed data set can be divided into training set, validation set and test set, which will be used for model training, validation and testing later, and the proportion of SAR images of nearshore and offshore areas in each data set should be kept consistent.
[0060] S2: Construct an improved deep learning ship detection model; the improved deep learning ship detection model includes a feature extraction backbone network, a feature fusion neck network and a target detection network; the feature extraction backbone network is specifically: according to the YOLOv5 architecture, a multi-level attention mechanism is introduced to improve the feature extraction backbone network, so as to enhance the model's ability to extract ship target features and ignore the influence of background noise; the feature fusion neck network is specifically: a pyramid network of a cross-layer feature fusion module is introduced to construct the model's feature fusion neck network, and cross-layer fusion is performed in the process of dimensionality increase and dimensionality reduction, so as to fuse low-level detail features with high-level semantic features, form a multi-scale feature representation of the target, and further strengthen the features of small-scale ship targets; the target detection network is used to perform target detection on the features after cross-layer fusion.
[0061] S3: Iteratively training the improved deep learning ship detection model;
[0062] The training dataset is input into the improved deep learning ship detection model for iterative training. During the training process, the normalized Gaussian Wasserstein distance is introduced as the bounding box regression loss function (the loss function also includes the object classification loss and the confidence loss of whether the box contains the object) to supervise the performance of the model during the training process. The iterative training is performed until the specified number of iterations is reached to obtain the trained improved deep learning ship detection model. After verification and testing, the model can be used for target detection of small-sized ships in SAR images.
[0063] When detecting small-sized ship targets in SAR images, the SAR image to be detected is input into the trained improved deep learning ship detection model for detection to obtain the SAR ship target detection result.
[0064] In step S2, the improved deep learning ship detection model is as follows: Figure 2 As shown, the improved deep learning ship detection model is specifically:
[0065] (a) Feature extraction backbone network, including six CBS layers, four C3 layers, one SPPF module and one BRA module.
[0066] The CBS layer consists of three basic structures: a convolutional layer, which is responsible for extracting features; a batch normalization layer, which is used to adjust data distribution; and an activation function SiLU, which introduces nonlinear factors into the model by performing specific mathematical transformations on the input data, thereby enhancing the model's expressive power and learning effect.
[0067] The C3 module is composed of three CBS modules and several BottleNeck modules. After the feature map enters C3, it is divided into two paths (such as Figure 3 ), one of which is calculated only by one CBS module, and the other is first calculated by one CBS module, and then by multiple sets of BottleNeck with residual connections. The use of the residual structure in BottleNeck can effectively avoid the problem of gradient disappearance. Finally, the two features are merged and then passed through a CBS module for feature map dimensionality reduction.
[0068] The SPPF module uses three serial pooling layers to reduce the dimension of the feature map. After each pooling layer, the dimension of the feature map is reduced to half of the previous one, and finally the feature maps of four scales are fused.
[0069] The BRA module is the multi-level attention module introduced in the present invention. The core advantage of the attention mechanism in this module lies in its global perception ability, which allows the model to capture and process long-distance dependencies in the image and optimizes the feature extraction ability of the model. Its mathematical expression is as follows:
[0070]
[0071] Among them, Attention (Q, K, V) represents the calculation result of the attention score, which is an output tensor obtained after the attention operation; Q represents the query tensor, which is used to retrieve (match) the key-value pair information related to itself in the attention mechanism; K represents the key tensor, which is matched with the query tensor Q to determine the weights of different positions; V represents the value tensor, which contains the feature information to be extracted and fused; Softmax is an activation function that is used to adjust the input value. Perform normalization to convert the input value into a probability distribution (the value of each element ranges from 0 to 1, and the sum of all elements is 1); represents the transpose of the query tensor Q and the key tensor K ( represents the transpose operation) to perform matrix multiplication.
[0072] The Softmax function is defined as follows:
[0073]
[0074] Among them, Softmax(x i ) represents the output result of the Softmax function, specifically the probability value obtained after the Softmax function calculates the i-th element in the input vector; x i represents the i-th element in the input vector; exp(x i ) means that the base is the natural constant e, x i is the result of the exponential function operation of the exponent; j exp(x j ) represents the sum of all elements in the input vector after exponential operation. Here j traverses all dimensions of the input vector, that is, from the first element to the last element, and the result of this sum is used as the denominator to normalize the exponential operation result of each element.
[0075] However, the comprehensive calculation of the attention mechanism at all spatial positions in the image inevitably brings high computational complexity and memory consumption, which may have an adverse impact on the detection speed and real-time performance in the ship target detection task. The first-level BRA module first divides the input feature map into S×S non-overlapping regions, and then performs regional average calculation. The specific method is to average the pixel values in all regions and obtain the regional query tensor Q based on the average pixel value. r and the key tensor K rAfter that, the attention score is calculated. According to the scores calculated by the first-level BRA module, the input feature map is pruned, and the top k regions that are most relevant to each region are retained to obtain a more refined pixel-level query, key, and value vector Q g , K g and V g , and then perform more refined attention calculations (i.e., second-level calculations) on these selected k regions to obtain feature maps of different scales.
[0076] (b) Feature fusion neck network, which consists of five C3 modules, four CBS modules, three upsampling modules and four cross-layer feature fusion modules (i.e., BIFPN_ADD).
[0077] The C3 module and CBS module have the same structure as the C3 module and CBS module in the feature extraction backbone network. The upsampling module is used to increase the dimension of the feature map. The cross-layer feature fusion module performs cross-layer fusion on feature maps of different scales to construct a multi-scale feature map of the target.
[0078] The feature map obtained after processing the nth layer of the feature extraction backbone network (all feature maps of the same scale are considered to be the same layer) is denoted as P n , the fused feature map output by the cross-layer feature fusion module of the nth layer in the bottom-up path is recorded as P n ′ , the fused feature map output by the n-th cross-layer feature fusion module in the top-down path is recorded as Among them, the two C3 modules + CBS modules in the bottom-up path do not change the dimension of the feature map, the first layer of C3 modules + CBS modules in the top-down path do not change the dimension of the feature map, and the second layer of C3 modules + CBS modules are used to reduce the dimension of the feature map. By setting the step size parameter, it can be determined whether the C3 module and CBS module will reduce the dimension of the input feature map or maintain the input dimension.
[0079] The calculation method of the cross-layer feature fusion module is as follows:
[0080] (1) The output of the first-layer cross-layer feature fusion module is the feature map P2 output by the second-layer cross-layer feature fusion module in the bottom-up path. ′ After the upsampling module, we get:
[0081]
[0082] (2) The output of the second-layer cross-layer feature fusion module is:
[0083]
[0084] (3) The output of the third-layer cross-layer feature fusion module is:
[0085]
[0086] In these five formulas, w and w′ represent the learnable weights when the feature maps are fused (the subscripts are independent of the number of layers), where w1 and w2 are used to measure the relative importance of feature map P2 and feature map Upsample (P′3) when calculating feature map P′2; w′1, w′2, and w′3 are used to measure the relative importance of feature map P2 and feature map Upsample (P′3) when calculating feature map P′2. When the feature map P3, feature map P′3 and feature map The relative importance of feature map P3 and feature map Upsample (P4) when calculating feature map P′3; w′4 and w′5 are used to measure the relative importance of feature map P3 and feature map Upsample (P4) when calculating feature map P′3; w′4 and w′5 are used to measure the relative importance of feature map P3 and feature map Upsample (P4) when calculating feature map P′3. When feature map P4 and feature map The relative importance of the input feature map; Upsample means that the input feature map is increased in dimension through the upsampling module; Resize means that the input feature map is reduced in dimension through the C3 module and the CBS module; ∈ is a constant to avoid numerical instability, usually a very small positive number (such as 10 -5 ).
[0087] The key to the cross-layer feature fusion module is its learnable weight mechanism. When fusion is performed, features of different resolutions are first mapped to the same resolution. For ship targets of different sizes, these features of different resolutions have different contributions. Through the dynamically learnable weight mechanism, the network can learn and emphasize features that are more important to the current task. By dynamically adjusting the contribution of features of different resolutions, the features of small-scale ship targets can be strengthened.
[0088] In step S3, the bounding box regression loss function is specifically:
[0089] For a rectangular bounding box, the pixels of the object to be detected are generally concentrated in the center of the bounding box. It can be considered that the probability of the target pixel x in the bounding box is related to the distance from the center of the bounding box. This relationship is simplified to a normal distribution, with the mean vector u taking the coordinates of the center of the bounding box; the standard deviation Σ taking the width and height of the bounding box. Then the Wasserstein distance can be used to calculate the overlap between the two boxes based on the probability distribution. The probability density function of the two-dimensional normal distribution is defined as follows:
[0090]
[0091] Use (cx, cy, w, h) to represent a rectangular bounding box, where the first two items are the coordinates of the center point of the box, and the last two items are the width and height of the box. For any bounding boxes A and B, their overlap degree Wasserstein distance is calculated based on the probability distribution. The Wasserstein distance is defined as follows:
[0092]
[0093] Among them, N a , N b They are the two-dimensional normal distributions corresponding to the predicted bounding box A and the true bounding box B respectively (obtained by integrating the probability density function of the two-dimensional normal distribution); cx a and cx b are the horizontal coordinates of the center points of the predicted bounding box A and the real bounding box B respectively; cy a andcy b are the ordinates of the center points of the predicted bounding box A and the true bounding box B respectively; w a and w b are the widths of the predicted bounding box A and the true bounding box B respectively; h a and h b are the heights of the predicted bounding box A and the true bounding box B, respectively.
[0094] The Wasserstein distance is normalized by exponential calculation, which is the normalized Gaussian Wasserstein distance of the present invention. It is used as the bounding box regression loss function to monitor the performance of the model during training. The calculation formula of the bounding box regression loss function is:
[0095]
[0096] Among them, Loss represents the bounding box regression loss, exp represents the result of the exponential function operation with the natural constant e as the base and the input value as the exponential; C is a constant, which is set to the average size of the targets in the preprocessed SAR image ship dataset.
[0097] like Figure 4Schematic diagram for comparing the detection effects of the present invention and the original YOLOv5 model. Wherein, (a1) and (b1) are SAR images of nearshore and farshore areas, respectively, (a2) and (a3) are respectively the prediction results of the SAR image in (a1) using the YOLOv5 model and the method of the present invention, (b2) and (b3) are respectively the prediction results of the SAR image in (b1) using the YOLOv5 model and the method of the present invention, (a4) and (b4) are respectively the true labels of the positions of the ships in (a1) and (b1). As can be seen from the figure, when the original YOLOv5 model detects the nearshore (a2) and farshore areas (b2), two false detections occur due to the interference of islands and reefs, while the present invention can correctly detect the ship target in the image, indicating that the detection method of the present invention effectively improves the recognition ability and anti-interference of the model for specific targets under complex backgrounds. By utilizing the multi-level attention mechanism of the BRA module to accurately focus on the ship target features and weaken the influence of interference factors such as islands and reefs, and then using the cross-layer feature fusion module to integrate multi-scale feature information, the model can understand the image content more comprehensively and accurately, thereby avoiding the false detection problem caused by background interference in the original YOLOv5 model and significantly improving the accuracy and reliability of ship target detection.
[0098] like Figure 5 Schematic diagram of the positioning confidence loss function curve of the present invention and the original YOLOv5 model. Among them, (a) is a schematic diagram of the truth box A and the prediction box B, the two boxes are simplified into square boxes, and the prediction box moves in the offset direction as shown in the figure; (b) is the normalized Gaussian Wasserstein distance loss function curve of the truth box A and the prediction box B at different sizes, and the independent variable is the offset distance between the two boxes; (c) is the boundary box positioning loss function curve of the YOLOv5 model loss function with the truth box A and the prediction box B at different sizes, and the independent variable is the offset distance between the two boxes. Figure 5 As shown in (c), for the four bounding boxes of different sizes, when the bounding box size is extremely small, even if the predicted box and the true box differ by only a few pixels, the value of the bounding box positioning loss function of the original YOLOv5 model will drop sharply; while the normalized Gaussian Wasserstein distance loss function used in the present invention can completely overlap the function curve regardless of how the target box size changes ( Figure 5 (b) in the figure means that the loss function can measure the positioning error of targets of different sizes with a more consistent and stable standard, is not restricted by the size of the target box, and is more helpful to accurately optimize the positioning performance of the model. Therefore, when detecting and positioning ship targets of different sizes, more accurate and reliable result output can be achieved, further improving the effectiveness and robustness of the entire target detection model in practical application scenarios.
Claims
1. An improved deep learning ship detection method for SAR images, characterized in that: The method is implemented based on an improved deep learning ship detection model. The SAR image to be detected is input into the trained improved deep learning ship detection model for detection to obtain the SAR ship target detection result. The training process of the improved deep learning ship detection model specifically includes the following steps: S1: collecting an original SAR image ship dataset, wherein the original SAR image ship dataset includes SAR ship images in a nearshore area and an offshore area; and preprocessing the SAR ship images in the original SAR image ship dataset; S2: Build an improved deep learning ship detection model; The improved deep learning ship detection model includes a feature extraction backbone network, a feature fusion neck network and a target detection network; the feature extraction backbone network is used to extract ship target feature maps of different scales based on a multi-level attention mechanism; the feature fusion neck network is used to first increase the dimension and then reduce the dimension of the ship target feature maps of different scales, and perform cross-layer fusion in the process of increasing the dimension and reducing the dimension; the target detection network is used to perform target detection on the features after cross-layer fusion; S3: Iteratively training the improved deep learning ship detection model; The preprocessed SAR image ship dataset is input into the improved deep learning ship detection model for training. During the training process, the normalized Gaussian Wasserstein distance is introduced as the bounding box regression loss function to supervise the performance of the model during the training process. The training is iterated until the specified number of iterations is reached to obtain the trained improved deep learning ship detection model.
2. The improved deep learning ship detection method for SAR images according to claim 1, characterized in that: In step S2, the feature extraction backbone network introduces a multi-level attention module based on the original feature extraction backbone network of YOLOv5; the multi-level attention module includes at least two levels of attention modules from coarse to fine, and each attention module is used to enhance the model's attention to features of different scales.
3. The improved deep learning ship detection method for SAR images according to claim 2, characterized in that: The working method of the multi-level attention module is as follows: the first-level attention module first divides the input feature map into S×S non-overlapping regions, then performs regional average calculation, averages the pixel values in all regions, and obtains the region-level query tensor and key tensor based on the obtained average pixel values, and then calculates the attention score; then, according to the attention score calculated by the first-level module, the input feature map is pruned, and the top k regions most relevant to each region are retained to obtain more refined pixel-level query, key and value vectors, and then a more refined attention calculation is performed on the selected k regions to obtain feature maps of different scales.
4. The improved deep learning ship detection method for SAR images according to claim 1, characterized in that: The feature fusion neck network in step S2 introduces multiple cross-layer feature fusion modules on the basis of the original feature fusion neck network of YOLOv5. The cross-layer feature fusion module is used to adopt a learnable dynamic weight allocation mechanism to perform weighted fusion on feature maps of different scales, thereby enhancing the characteristics of small-scale ship targets.
5. The improved deep learning ship detection method for SAR images according to claim 1, characterized in that: In step S3, the bounding box regression loss function is used to measure the similarity between the predicted bounding box and the true bounding box, and the degree of overlap between the two boxes is calculated through probability distribution.
6. The improved deep learning ship detection method for SAR images according to claim 5, characterized in that: The bounding box regression loss function is specifically: Among them, Loss represents the bounding box regression loss; exp represents the result of the exponential function operation with the natural constant e as the base and the input value as the exponent; is the Wasserstein distance between the predicted bounding box A and the true bounding box B, N a , N b are the two-dimensional normal distributions corresponding to the predicted bounding box A and the true bounding box B respectively; C is a constant, which is set to the average size of the target in the preprocessed SAR image ship dataset; cx a and cx b are the horizontal coordinates of the center points of the predicted bounding box A and the true bounding box B respectively; cy a andcy b are the ordinates of the center points of the predicted bounding box A and the true bounding box B respectively; w a and w b The widths of frame A and frame B respectively; h a and h b are the heights of the predicted bounding box A and the true bounding box B, respectively.
Citation Information
Patent Citations
Unmanned aerial vehicle image target detection method based on multiple scales and Gaussian Wasserstein distance
CN116469020A
Generative adversarial network voice conversion method based on dynamic parameter adjustment
CN118486313A