A SAR ship target detection method based on outer rectangular projection generation and tilt correction.
By using external rectangular projection encoding and convex quadrilateral correction technology, the problems of boundary discontinuity and inaccurate tilt box direction in SAR ship target detection are solved, achieving high-precision and low-complexity detection results.
Patent Information
- Application Number
- CN202311089838.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2043-08-28
AI Technical Summary
Existing SAR ship target detection methods based on OBB suffer from boundary discontinuities caused by angle periodicity and edge commutativity, as well as the problem of losing features during tilt box correction, and have high computational complexity.
The outer rectangular projection method is used to encode the OBB bounding box, six parameters are used to represent the tilted box, and the deformed tilted box is corrected by the convex quadrilateral correction technique. A two-stage object detection network is constructed to generate and correct the tilted box candidate region.
It effectively solves the problems of boundary discontinuity and inaccurate tilt box direction, reduces computational complexity, improves detection accuracy, and reduces background interference.
Smart Images

Figure CN117078554B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, and more specifically relates to a synthetic aperture radar (SAR) ship target detection method based on generating and correcting tilted frames using outer rectangular projection within the field of image target detection technology. This invention can be applied to detect ship targets in SAR images from any direction. Background Technology
[0002] Ship target detection in SAR images is a unique and crucial target detection task, applicable to maritime traffic monitoring, maritime safety assurance, and marine environmental protection. To effectively detect ship targets in SAR images, a common approach is based on Oriented Bounding Boxes (OBBs), which accurately represents the shape and orientation of ship targets while preventing target overlap and background redundancy. However, existing OBB-based methods still have some drawbacks. Anchor-based methods directly predict the target's orientation angle, leading to boundary discontinuities caused by Periodicity of Angle (POA) and Edge of Exchangeability (EOE), as well as mismatches between labeled and predicted regions. Tilt box correction is typically based on affine transformations of rotation or translation, which alters the shape of the tilt box, affecting subsequent feature extraction and classification. To mitigate this, some methods transform angles or add extra modules, but these methods are often complex and over-parameterized, increasing computational costs.
[0003] Sichuan University disclosed a method for detecting ships in any direction using the YOLOv3 network in its patent application "A Method for Detecting Ships in Any Direction Based on Improved YOLOv3" (Patent Application No.: CN 202011331077.9, Publication No.: CN 112487912 A). The method involves adding residual modules, attention modules, and dilated convolutions at various scales of the YOLOv3 network, thereby improving the network's feature extraction capability and receptive field while reducing network parameters and computational load. The preprocessed SAR image is then input into the improved YOLOv3 network to obtain the detection results of horizontal bounding boxes (HBBs). Next, candidate region extraction and feature extraction are performed on the HBB detection results. A rotated bounding box detection method based on a rotated region convolutional neural network (R-CNN) is then incorporated. The R-CNN structure transfers the strong localization information of the HBBs to the OBBs, enhancing the directional information of the entire pyramid to obtain the final ship detection result in any direction. However, the method still has shortcomings. It still relies on a pre-defined anchor box. Although it reduces the boundary discontinuity problem caused by angular periodicity and edge commutativity to some extent, it also introduces a large amount of computation. The correction of the tilted box is to convert the box into a horizontal bounding box and then restore it to a rotated bounding box based on the center coordinates, width, height and rotation angle of the horizontal bounding box. This method can lead to inaccurate orientation of the tilted box, loss of features and redundant background. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of the prior art by proposing a SAR ship target detection method based on generating and correcting tilted boxes using external rectangular projection. This method aims to solve the boundary discontinuity problem caused by angular periodicity and edge commutativity in tilted box representation methods, as well as the problem of easily losing features during tilted box correction, while reducing computational complexity.
[0005] The technical approach to achieving the objectives of this invention is as follows: This invention proposes a target representation method based on external rectangular projection. It uses six parameters to encode the OBB bounding box, including the x-coordinate and y-coordinate of the center position of its horizontal circumscribed rectangle, its length, width, and two projection lengths obtained by projecting onto the corresponding sides of the horizontal circumscribed rectangle. This avoids directly predicting the target's orientation angle. This method effectively constrains the predicted tilted box while reducing the number of preset anchor points. It can improve detection accuracy while reducing computational complexity, effectively solving the problem of boundary discontinuity caused by direct angle prediction in existing technologies. This invention also proposes a convex quadrilateral correction technique, which can correct tilted boxes deformed into parallelograms by finding the minimum area of the convex quadrilateral's external rectangular box, ensuring the correct orientation and removing redundant background information. It can eliminate background interference while maintaining the target features, effectively solving the problems of insufficient background suppression and feature loss due to over-enhancement of high-contrast images in existing technologies. The two methods described above are applied to a two-stage object detection network, which consists of OrpRPN (OuterRectangular Projection Region Proposal Network), which is responsible for generating high-quality tilted box candidate regions, and OrpReg (Outer Rectangular Projection Regression Network), which is responsible for refining the position of these candidate regions.
[0006] The specific steps of this invention are as follows:
[0007] Step 1, Generate the training set:
[0008] Step 1.1: Collect at least 1,100 SAR ship image samples to form a sample set. Each sample contains at least one ship target. Use directed bounding boxes (OBB) to annotate the bounding box of each ship target in each sample.
[0009] Step 1.2: Encode the bounding box of the ship target in each sample of the sample set using the outer rectangle projection method to obtain the tilted box of the sample. Use the k-means algorithm to obtain the anchor box of the horizontal bounding rectangle of each sample's tilted box.
[0010] Step 1.3: Perform preprocessing on the pixel values in each sample image, including normalization, image size adjustment, and random flipping, to obtain samples of size 608×608 pixels.
[0011] Step 1.4: Combine all preprocessed samples and their corresponding tilt boxes and anchor boxes into a training set;
[0012] Step 2: Construct a two-stage object detection network consisting of a feature extraction module, an OrpRPN sub-network, and an OrpReg sub-network connected in series.
[0013] Step 3, train a two-stage object detection network:
[0014] Step 3.1: Input the training set into the two-stage object detection network, and the OrpRPN sub-network outputs the predicted tilt box for each sample;
[0015] Step 3.2: After decoding the predicted tilted box of the ship target in each sample output by the OrpRPN subnetwork in the current iteration using the external rectangular projection method, the convex quadrilateral correction technique is used to correct it.
[0016] Step 3.3: Input the corrected predicted tilted box into the OrpReg subnetwork, calculate the smoothed L1 loss value of the OrpRPN subnetwork and the KLD loss value of the OrpReg subnetwork at the current iteration, and update the network parameters with the two loss values;
[0017] Step 3.4: Determine whether the smoothed L1 loss function and the KLD loss function converge simultaneously. If they do, proceed to step 4 after obtaining the trained two-stage object detection network; otherwise, proceed to step 3.2.
[0018] Step 4: Detect ship targets in SAR images:
[0019] Using the same method as in step 1, the synthetic aperture radar (SAR) image to be detected is processed, and the processed image is input into the trained two-stage target detection network to output the detected ship area.
[0020] Compared with existing technologies, the present invention has the following advantages:
[0021] First, this invention proposes an outer rectangle projection encoding and decoding scheme. By projecting the lengths of the long and short sides of the OBB onto its horizontally bounding rectangle, the OBB is encoded, thus avoiding direct prediction of the target's orientation angle. Because it provides strict boundary constraints, the predicted tilted box more closely approximates the true target shape and orientation, overcoming the boundary discontinuity defect of existing technologies. Furthermore, it reduces the number of preset anchor points, giving this invention the advantage of low computational complexity while improving detection accuracy.
[0022] Secondly, this invention proposes a convex quadrilateral correction technique, which can find a circumscribed rectangle with the smallest area to replace the tilted frame, more accurately aligning it with the actual direction of the object, correcting the deformed tilted frame, and overcoming the difficulty of inaccurate tilted frame orientation and loss of features in existing technologies. This invention ensures the correct tilted frame orientation and removes redundant background, further improving detection accuracy. Attached Figure Description
[0023] Figure 1 This is a flowchart of the present invention;
[0024] Figure 2 This is a schematic diagram of the external rectangular projection method encoding of the present invention;
[0025] Figure 3 This is a schematic diagram of the overall network structure of the two-stage model of this invention;
[0026] Figure 4 This is a schematic diagram of the feature extraction module of the present invention;
[0027] Figure 5 This is a schematic diagram of the OrpRPN subnetwork of the present invention;
[0028] Figure 6 This is a schematic diagram of the tilted frame optimization module of the present invention;
[0029] Figure 7 This is a schematic diagram of the decoding method using the outer rectangular projection method of the present invention;
[0030] Figure 8 This is a schematic diagram of the convex quadrilateral correction technology of the present invention;
[0031] Figure 9 This is a schematic diagram of the visualized target detection results from the simulation experiment of this invention. Detailed Implementation
[0032] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0033] Reference Figure 1 The implementation steps of the embodiments of the present invention will be described in further detail below.
[0034] Step 1: Generate training and test sets.
[0035] Step 1.1: The SAR image samples used in the embodiments of the present invention are derived from the RSSDD dataset. This dataset is a publicly available SAR ship detection dataset, containing SAR images of multiple resolutions, polarizations, and scenes, totaling 1,160 images. Each image is labeled with the coordinates of the four corner points of the OBB and contains at least one ship target. The SAR images in the dataset range in size from a maximum of 526×646 to a minimum of 217×214. The average image size is 481×331.
[0036] Step 1.2: Encode the ship targets in each sample in the sample set using the outer rectangle projection method to obtain the tilted box of the target. Use the k-means algorithm to obtain the anchor box of the horizontal bounding rectangle of the tilted box of each target.
[0037] Now combine Figure 2 The encoding process of the external rectangular projection method is illustrated by the following formula:
[0038]
[0039] in, These represent the offsets of the horizontal bounding rectangle relative to the center coordinate position, respectively. Let x, y, width, height, and angle represent the center position of the OBB-form bounding box of the j-th ship target in the i-th sample, respectively. Let x, y, width, and height represent the center position of the horizontal bounding rectangle of the j-th ship target in the i-th sample, respectively. Let represent the projected lengths of the OBB-form bounding box of the j-th ship target in the i-th sample, projected onto the corresponding sides of the horizontal circumscribed rectangle. The encoded tilted box is represented as... This avoids the boundary discontinuity problem caused by angle parameters.
[0040] Step 1.3: Perform preprocessing on the pixel values in each sample image, including normalization, image size adjustment, and random flipping, to obtain samples of size 608×608 pixels.
[0041] Step 1.4: The 928 samples in the preprocessed sample set and their corresponding tilt boxes and anchor boxes are used to form the training set, and the remaining 232 samples in the sample set and their corresponding tilt boxes and anchor boxes are used to form the test set.
[0042] Step 2: Construct a two-stage object detection network including the OrpRPN sub-network and the OrpReg sub-network.
[0043] Reference Figure 3 The two-stage object detection network structure is further described.
[0044] The two-stage object detection network consists of three parts connected in series: a feature extraction module, an OrpRPN subnetwork, and an OrpReg subnetwork.
[0045] Step 2.1, build the feature extraction module, its overall structure is as follows: Figure 4As shown, the feature extraction module consists of a ResNet branch and an FPN feature fusion branch connected in series. The ResNet branch is structured as follows: a first convolutional layer, a first convolutional group, a second convolutional group, a third convolutional group, and a fourth convolutional group connected in series. Each of the first to fourth convolutional groups is implemented using multiple bottlenecks, with the number of bottlenecks being 3, 4, 23, and 3, respectively. Each bottleneck consists of a 1×1 convolutional layer, a 3×3 convolutional layer, and a 1×1 convolutional layer connected in series. The input size of the first convolutional layer in ResNet is set to 608×608, the number of input channels is set to 3, the kernel size is set to 7×7, and the stride is set to 2. The input image is processed through the first, second, third, and fourth convolutional groups of the ResNet branch, respectively, outputting four feature maps C2, C3, C4, and C5.
[0046] The FPN feature fusion branch consists of the second to ninth convolutional layers, the first to third upsampling layers, the first to third summing layers, and a max pooling layer. Specifically, feature map C5 output from the fourth convolutional group passes through the second convolutional layer, the third convolutional layer, and the max pooling layer to obtain feature maps M5, P5, and P6, respectively. Feature map C4 output from the third convolutional group passes through the fourth convolutional layer to obtain feature map M4. The output of M5 after passing through the first upsampling layer is added to the output of M4 after passing through the first summing layer, and then passes through the fifth convolutional layer to obtain feature map P4. Feature map C3 output from the second convolutional group passes through the sixth convolutional layer to obtain feature map M3. The output of M4 after passing through the first summing layer and the second upsampling layer is added to the output of M3 after passing through the second summing layer, and then passes through the seventh convolutional layer to obtain feature map P3. Feature map C2 output from the first convolutional group passes through the eighth convolutional layer to obtain M2. The output of M3 after passing through the second summing layer and the third upsampling layer is added to the output of M2 after passing through the third summing layer, and then passes through the ninth convolutional layer to obtain feature map P2.
[0047] The input channels of the second, fourth, sixth, and eighth convolutional layers in the FPN feature fusion branch are set to 256, 512, 1024, and 2048, respectively, with a kernel size of 1×1 and a stride of 1. The input channels of the third, fifth, seventh, and ninth convolutional layers are all set to 256, with a kernel size of 3×3 and a stride of 1. The output channels of the second to ninth convolutional layers are all set to 256, and the upsampling rate of the first to third upsampling layers is set to 2. The window size of the max pooling layer is set to 1×1, the stride is set to 2, and the output channels are set to 256.
[0048] Step 2.2, build the OrpRPN subnetwork, its structure is as follows: Figure 5As shown, the OrpRPN subnetwork consists of a first convolutional layer, a ReLU activation layer, and a parallel structure connected in series to generate tilted boxes. One branch of the parallel structure is the second convolutional layer, and the other branch is a third convolutional layer connected in series with a softmax classification layer. The kernel sizes of the first, second, and third convolutional layers are set to 3×3, 1×1, and 1×1, respectively, with a stride of 1 for each. The number of input channels is set to 256, 64, and 64, respectively, and the number of output channels is set to 64, 6, and 1, respectively.
[0049] Step 2.3, build the OrpReg subnet, as follows: Figure 3 The OrpReg subnetwork is shown in the overall network structure. The tilted bounding boxes output by the OrpRPN subnetwork and the feature maps at five different scales output by the feature extraction module are input into the OrpReg subnetwork. The OrpReg subnetwork consists of a feature alignment layer and a tilted bounding box optimization module connected in series. The feature alignment layer extracts rotation-invariant features from the tilted bounding boxes output by the OrpRPN subnetwork and the feature maps at five different scales output by the feature extraction module using the RoIAlign rotation method, outputting aligned 512×7×7 tilted bounding boxes and feature maps.
[0050] Reference Figure 6 The structure of the tiltbox optimization module is further described below. The tiltbox optimization module consists of a first fully connected layer, a second fully connected layer, and a parallel structure connected in series. One branch of the parallel structure is a third fully connected layer connected in series with a softmax classification layer, and the other branch is a fourth fully connected layer. The input dimension and output dimension of the first and second fully connected layers are set to 4096, the input dimension of the third fully connected layer is set to 4096, the output dimension is set to 2, and the input dimension of the fourth fully connected layer is set to 4096, the output dimension is set to 5.
[0051] Step 3: Generate the target detection loss function.
[0052] Step 3.1, the smooth L1 loss function used by the OrpRPN subnetwork is as follows:
[0053]
[0054]
[0055] in, This represents the sum of the coordinate differences between the j-th ship target bounding box in the i-th sample and the corresponding coordinates of the j-th ship target bounding box in the i-th sample, as output by the OrpRPN sub-network. Let x, y, width, height, and two projection lengths represent the center position of the tilted bounding box of the j-th ship target in the i-th sample, respectively. These represent the x-coordinate, y-coordinate, width, height, and two projection lengths of the center position of the tilted bounding box of the j-th ship target in the i-th sample output by the OrpRPN subnetwork.
[0056] Step 3.2, the OrpReg subnetwork uses the KLD loss function as follows:
[0057]
[0058]
[0059]
[0060]
[0061] Where τ represents the hyperparameter used to adjust the loss value, and τ is greater than or equal to 1. The Kullback-Leibler distance represents the distance between the two-dimensional Gaussian distribution of the tilted bounding box of the j-th ship target in the i-th sample predicted by the network and the two-dimensional Gaussian distribution of the tilted bounding box of the j-th ship target in the i-th sample. Let represent the mean and variance matrices of the two-dimensional Gaussian distribution of the tilted bounding box of the j-th ship target in the i-th sample predicted by the network, respectively. Tr(·) represents the operation of finding the trace of the matrix. -1 This represents the operation of finding the inverse of a matrix. Let x, y, width, height, and angle represent the center position of the tilted bounding box of the j-th ship target in the i-th sample output by the OrpReg subnetwork, respectively. Let and represent the mean and variance matrices of the two-dimensional Gaussian distribution of the tilted bounding box of the j-th ship target in the i-th sample, respectively. Let x, y, width, height, and angle represent the center position of the tilted bounding box of the j-th ship target in the i-th sample, respectively.
[0062] Step 4: Train the two-stage object detection network.
[0063] Step 4.1: Input the training set into the two-stage object detection network, and the OrpRPN sub-network outputs the predicted tilt box for each sample.
[0064] Step 4.2: After decoding the predicted tilted box of the ship target in each sample output by the OrpRPN subnetwork in the current iteration using the external rectangular projection method, the convex quadrilateral correction technique is used to correct it.
[0065] Now combine Figure 7 The following formula illustrates the decoding process of the outer rectangle projection method:
[0066]
[0067] in, Let x and y be the coordinates of the center of the tilted bounding box of the j-th ship target in the i-th sample, output by the OrpRPN subnetwork. Let x, y, width, height, and two projected lengths be the relative anchor frame offsets of the j-th ship target in the i-th sample, output by the second convolutional layer in the OrpRPN subnetwork, at its center position. a ,y a ,w a ,h a These represent the x-coordinate, y-coordinate, width, and height of the anchor frame, respectively. (·) This indicates an exponential operation with the natural constant e as the base. Let represent the width and height of the tilted bounding box output by the OrpRPN subnetwork for the j-th ship target in the i-th sample, respectively. Let represent the projection lengths of the corresponding sides of the tilted bounding box of the j-th ship target in the i-th sample onto the horizontal bounding rectangle output by the OrpRPN subnetwork. These represent the coordinates of the four vertices of the tilted bounding box output by the OrpRPN subnetwork for the j-th ship target in the i-th sample.
[0068] Now combine Figure 8 The process of the convex quadrilateral correction technique is explained using relevant formulas.
[0069] The first step is to decode the outer rectangle projection method to obtain the coordinates of the four vertices of the tilted frame. The edge vector is obtained by subtracting the coordinates of two adjacent vertices. The diagonal vector is obtained by subtracting the coordinates of non-adjacent vertices.
[0070] The second step is to calculate the width, height, and angle of the corrected tilt box output by the OrpRPN subnetwork for each ship target in each sample, according to the following formula:
[0071]
[0072]
[0073]
[0074] in, Let |·| represent the projection length of the k-th diagonal vector in the tilted bounding box of the j-th ship target in the i-th sample onto the k-th edge vector, and |·| represent the operation of calculating the vector magnitude. Let represent the projection length of the k-th diagonal vector in the tilted frame of the j-th ship target in the i-th sample onto the normal vector. Let represent the normal vector of the k-th edge vector in the tilted bounding box of the j-th ship target in the i-th sample. Represents the unit vector along the x-direction of the coordinate system. These represent the two edge vectors within the tilted frame of the j-th ship target in the i-th sample; Let represent the width, height, and angle of the correction rectangle for the j-th ship target in the i-th sample output by the OrpRPN subnetwork, respectively.
[0075] The third step is to combine the width, height, and angle of the corrected rectangle of each ship target in each sample output by the OrpRPN subnetwork to form the predicted tilt box of that sample.
[0076] Step 4.3: Input the corrected predicted tilted box into the OrpReg subnetwork, calculate the smoothed L1 loss value of the OrpRPN subnetwork and the KLD loss value of the OrpReg subnetwork at the current iteration, and update the network parameters with the two loss values.
[0077] Step 4.4: Determine whether the smoothed L1 loss function and the KLD loss function converge simultaneously. If they do, proceed to step 5 after obtaining the trained two-stage object detection network; otherwise, proceed to step 4.2.
[0078] Step 5: Inspect the SAR ship.
[0079] The images from the test set are input into the trained two-stage object detection network, which outputs the detected ship regions.
[0080] The effectiveness of this invention can be further demonstrated through the following simulation.
[0081] 1. Simulation experimental conditions:
[0082] The hardware platform for the simulation experiment of this invention is NVIDIA RTX3090. The software platform for the simulation experiment is Ubuntu 18.04.6 operating system, based on the PyTorch deep learning framework.
[0083] 2. Simulation Experiment Content and Result Analysis:
[0084] The simulation experiment of this invention uses the method of this invention and a prior art S2ANet to perform target detection on the test set, and the detection results are as follows. Figure 9 As shown.
[0085] In the simulation experiment, the existing technology S2ANet refers to the network proposed by Han et al. in "Align deep features for oriented object detection. IEEE Transactions on Geoscience and Remote Sensing, 60:1-11, 2021." for detecting ships in SAR images.
[0086] The following is combined with Figure 9 The simulation diagrams further illustrate the effects of the present invention.
[0087] Figure 9 This is a comparison chart of the detection performance of S2ANet and the present invention on the test set. Five representative images were selected from the test set for comparison. Figure 9 The first column shows the detection results of S2ANet on 5 images, the second column shows the detection results of this invention on 5 images, and the third row shows the correct results of object detection and annotation on 5 images.
[0088] from Figure 9 As can be seen from the first, fourth, and fifth lines, S2ANet easily identifies interfering targets such as sea reefs as ship targets, causing false alarms when there is a lot of noise interference, while the present invention can accurately distinguish ships. From Figure 9 As can be seen from the second line, the tilted box coordinates predicted by this invention are more accurate than those predicted by S2ANet. From Figure 9 As can be seen from the third line, in the near-shore background where ships are densely packed, S2ANet has difficulty correctly identifying closely packed ships due to background interference and insufficient ship detail features. However, the present invention can better distinguish closely packed ships. Figure 9 The demonstrated detection results show that the network designed in this invention has better detection performance under conditions of noise interference and complex background.
[0089] To verify the simulation effect of the present invention, the evaluation index mAP was used to evaluate S2ANet and the method of the present invention, and the area enclosed by the precision recall curve and the coordinate axis for all categories was calculated using the integral method.
[0090]
[0091]
[0092]
[0093] In this context, TP, FP, and FN refer to the number of correctly detected vessels, false alarms, and missing vessels, respectively. N represents the number of categories, AP is the area under the precision and recall curves, and mAP is the average AP across all categories. Since this invention targets only one type of target, mAP is equal to AP.
[0094] Table 1. Comparison of mAP of different methods on the RSSDD dataset in simulation experiments.
[0095] method mAP(%) S2ANet 83.21 This invention 89.15
[0096] Table 2. Comparison of Ablation Experiments
[0097] method mAP(%) Baseline 85.14 This invention 89.15
[0098] As shown in Table 1, the SAR image ship target detection method of the present invention achieves an average detection accuracy (mAP) of 89.15% on the RSSDD dataset, which is 5.94% higher than that of the S2ANet network, proving that the present invention can achieve higher SAR ship target detection accuracy. As shown in Table 2, the present invention achieves a 4.01% improvement over the baseline, demonstrating the effectiveness of the present invention in improving SAR ship target detection accuracy.
[0099] The simulation experiments above demonstrate that this invention proposes a SAR ship target detection method based on generating and correcting tilted frames using external rectangular projection. This invention proposes an external rectangular projection encoding and decoding scheme, using six parameters to represent the tilted frame, making the predicted tilted frame closer to the actual target shape and orientation, reducing the number of preset anchor points, and lowering computational costs. This invention uses predefined anchor points with different aspect ratios, adjusting the aspect ratio of the anchor points according to the size of the horizontal outer rectangle of the tilted frame to match the actual distribution of targets in the dataset. The proposed convex quadrilateral correction method corrects the deformed tilted frame, removes redundant background, and further improves detection accuracy. This invention has significant effects in reducing computational costs and improving detection accuracy, and has important practical application value.
Claims
1. A SAR ship target detection method based on generating and correcting tilted frames using external rectangular projection, characterized in that, The bounding box of the ship target in each sample is encoded using the external rectangular projection method, and the predicted tilted box is corrected using the convex quadrilateral correction technique; this detection method includes the following steps: Step 1, Generate training set: Step 1.1: Collect at least 1,100 SAR ship image samples to form a sample set. Each sample contains at least one ship target. Use directed bounding boxes (OBB) to annotate the bounding box of each ship target in each sample. Step 1.2: Encode the bounding box of the ship target in each sample of the sample set using the outer rectangle projection method to obtain the tilted box of the sample. Use the k-means algorithm to obtain the anchor box of the horizontal bounding rectangle of each sample's tilted box. Step 1.3: Perform preprocessing on the pixel values in each sample image, including normalization, image size adjustment, and random flipping, to obtain samples of size 608×608 pixels. Step 1.4: Combine all preprocessed samples and their corresponding tilt boxes and anchor boxes into a training set; Step 2: Construct a two-stage object detection network consisting of a feature extraction module, an OrpRPN sub-network, and an OrpReg sub-network connected in series. Step 3, train a two-stage object detection network: Step 3.1: Input the training set into the two-stage object detection network, and the OrpRPN sub-network outputs the predicted tilt box for each sample; Step 3.2: After decoding the predicted tilted box of the ship target in each sample output by the OrpRPN subnetwork in the current iteration using the external rectangular projection method, the convex quadrilateral correction technique is used to correct it. Step 3.3: Input the corrected predicted tilted box into the OrpReg subnetwork, calculate the smoothed L1 loss value of the OrpRPN subnetwork and the KLD loss value of the OrpReg subnetwork at the current iteration, and update the network parameters with the two loss values; Step 3.4: Determine whether the smoothed L1 loss function and the KLD loss function converge simultaneously. If they do, proceed to step 4 after obtaining the trained two-stage object detection network; otherwise, proceed to step 3.
2. Step 4: Detect ship targets in SAR images: Using the same method as in step 1, the synthetic aperture radar (SAR) image to be detected is processed, and the processed image is input into the trained two-stage target detection network to output the detected ship area.
2. The SAR ship target detection method based on generating and correcting tilted frames according to claim 1, characterized in that, The outer rectangular projection encoding method described in step 1.2 is obtained by the following formula: in, These represent the offsets of the horizontal bounding rectangle relative to the center coordinate position, respectively. Let x, y, width, height, and angle represent the center position of the OBB-form bounding box of the j-th ship target in the i-th sample, respectively. Let x, y, width, and height represent the center position of the horizontal bounding rectangle of the j-th ship target in the i-th sample, respectively. Let represent the projected lengths of the OBB-form bounding box of the i-th ship target in the i-th sample, projected onto the corresponding sides of the horizontal circumscribed rectangle. The encoded tilted box is represented as...
3. The SAR ship target detection method based on generating and correcting tilted frames according to claim 1, characterized in that, The steps described in step 1.2 for obtaining the anchor box of the horizontal bounding rectangle of the tilted box for each sample using the k-means algorithm are as follows: The first step is to randomly select three horizontal bounding rectangles of ship targets as reference anchor frames; The second step is to use the intersection-union ratio (IUU) to measure the overlap between the horizontal bounding rectangle of each ship target and each reference anchor frame, and assign each horizontal bounding rectangle to the anchor frame with the highest overlap, resulting in 3 groups of horizontal bounding rectangles; calculate the mean of the width and height of all horizontal bounding rectangles in each group, and update the width and height of the reference anchor frames in that group with the mean of each group. The third step is to determine whether the width and height of the updated anchor frame are the same as those of the original anchor frame. If so, the updated anchor frame is used as the anchor frame of the horizontal bounding rectangle of the sample tilted frame. Otherwise, the updated anchor frame is used as the reference anchor frame before proceeding to the second step.
4. The SAR ship target detection method based on generating and correcting tilted frames according to claim 1, characterized in that, The feature extraction module described in step 2 consists of a ResNet branch and an FPN feature fusion branch connected in series. The ResNet branch is composed of a first convolutional layer, a first convolutional group, a second convolutional group, a third convolutional group, and a fourth convolutional group connected in series. Each of the first to fourth convolutional groups is implemented by multiple Bottlenecks, with the number of Bottlenecks being 3, 4, 23, and 3, respectively. Each Bottleneck consists of a 1×1 convolutional layer, a 3×3 convolutional layer, and a 1×1 convolutional layer connected in series. The input size of the first convolutional layer in ResNet is set to 608×608, the number of input channels is set to 3, the kernel size is set to 7×7, and the stride is set to 2. The input image is processed by the first, second, third, and fourth convolutional groups of the ResNet branch to output four feature maps C2, C3, C4, and C5, respectively. The FPN feature fusion branch consists of the second to ninth convolutional layers, the first to third upsampling layers, the first to third summing layers, and a max pooling layer. Specifically, the feature map C5 output from the fourth convolutional group passes through the second convolutional layer, the third convolutional layer, and the max pooling layer to obtain feature maps M5, P5, and P6, respectively. The feature map C4 output from the third convolutional group passes through the fourth convolutional layer to obtain feature map M4. M5 is then added to the output of the first upsampling layer and M4 in the first summing layer, and then passed through the fifth convolutional layer to obtain feature map P4. The feature map C3 output from the second convolutional group passes through the sixth convolutional layer to obtain feature map M3. M4 is then added to the output of the first summing layer and the second upsampling layer and M3 in the second summing layer, and then passed through the seventh convolutional layer to obtain feature map P3. The feature map C2 output from the first convolutional group passes through... The eighth convolutional layer produces M2. M3 is then passed through the second summing layer and the third upsampling layer, and its output is added to the output of M2 in the third summing layer. This summation is then passed through the ninth convolutional layer to obtain the feature map P2. The number of input channels in the second, fourth, sixth, and eighth convolutional layers of the FPN feature fusion branch are set to 256, 512, 1024, and 2048, respectively. The kernel size is set to 1×1, and the stride is set to 1. The number of input channels in the third, fifth, seventh, and ninth convolutional layers is set to 256, the kernel size is set to 3×3, and the stride is set to 1. The number of output channels in the second to ninth convolutional layers is set to 256, and the upsampling rate in the first to third upsampling layers is set to 2. The window size of the max pooling layer is set to 1×1, the stride is set to 2, and the number of output channels is set to 256.
5. The SAR ship target detection method based on generating and correcting tilted frames according to claim 1, characterized in that, The OrpRPN subnetwork described in step 2 consists of a first convolutional layer, a ReLU activation layer, and a parallel structure connected in series to generate tilted boxes. One branch of the parallel structure is the second convolutional layer, and the other branch is the third convolutional layer connected in series with the softmax classification layer. The kernel sizes of the first, second, and third convolutional layers are set to 3×3, 1×1, and 1×1, respectively, with a stride of 1 for each. The number of input channels are set to 256, 64, and 64, respectively, and the number of output channels are set to 64, 6, and 1, respectively.
6. The SAR ship target detection method based on generating and correcting tilted frames according to claim 1, characterized in that, The OrpReg subnetwork described in step 2 consists of a feature alignment layer and a tilt box optimization module connected in series. The feature alignment layer extracts feature maps using the RoIAlign rotation method, extracting rotation-invariant features from the tilt boxes output by the OrpRPN subnetwork and the feature maps of five different scales output by the feature extraction module, and outputs aligned 512×7×7 tilt boxes and feature maps. The tilt box optimization module consists of a first fully connected layer, a second fully connected layer, and a parallel structure connected in series. One branch of the parallel structure is a third fully connected layer connected in series with a softmax classification layer, and the other branch is a fourth fully connected layer. The input dimension and output dimension of the first and second fully connected layers are set to 4096, the input dimension of the third fully connected layer is set to 4096, the output dimension is set to 2, and the input dimension of the fourth fully connected layer is set to 4096, the output dimension is set to 5.
7. The SAR ship target detection method based on generating and correcting tilted frames according to claim 2, characterized in that, The outer rectangle projection method decoding described in step 3.2 refers to decoding the offsets of the anchor frame and the output of the second convolutional layer in the OrpRPN subnetwork according to the following formula: in, Let x and y be the x and y coordinates of the center position of the tilted bounding box output by the OrpRPN subnetwork for the i-th ship target in the i-th sample, respectively. Let x, y, width, height, and two projected lengths be the relative anchor frame offsets of the i-th ship target in the i-th sample, output by the second convolutional layer in the OrpRPN subnetwork, at its center position. a ,y a ,w a ,h a These represent the x-coordinate, y-coordinate, width, and height of the anchor frame, respectively. (·) This indicates an exponential operation with the natural constant e as the base. Let represent the width and height of the tilted bounding box output by the OrpRPN subnetwork for the j-th ship target in the i-th sample, respectively. Let represent the projection lengths of the corresponding sides of the tilted bounding box of the j-th ship target in the i-th sample onto the horizontal bounding rectangle output by the OrpRPN subnetwork. These represent the coordinates of the four vertices of the tilted bounding box output by the OrpRPN subnetwork for the j-th ship target in the i-th sample.
8. The SAR ship target detection method based on generating and correcting tilted frames according to claim 7, characterized in that, The steps for implementing the convex quadrilateral correction technique described in step 3.2 are as follows: The first step is to decode the outer rectangle projection method to obtain the coordinates of the four vertices of the tilted frame. The edge vector is obtained by subtracting the coordinates of two adjacent vertices. The diagonal vector is obtained by subtracting the coordinates of non-adjacent vertices. The second step is to calculate the width, height, and angle of the corrected tilt box output by the OrpRPN subnetwork for each ship target in each sample, according to the following formula: in, Let |·| represent the projection length of the k-th diagonal vector in the tilted bounding box of the j-th ship target in the i-th sample onto the k-th edge vector, and |·| represent the operation of calculating the vector magnitude. Let represent the projection length of the k-th diagonal vector in the tilted frame of the j-th ship target in the i-th sample onto the normal vector. Let represent the normal vector of the k-th edge vector in the tilted bounding box of the j-th ship target in the i-th sample. Represents the unit vector along the x-direction of the coordinate system. These represent the two edge vectors within the tilted frame of the j-th ship target in the i-th sample; Let represent the width, height, and angle of the correction rectangle for the j-th ship target in the i-th sample output by the OrpRPN subnetwork, respectively; The third step is to combine the width, height, and angle of the corrected rectangle of each ship target in each sample output by the OrpRPN subnetwork to form the predicted tilt box of that sample.
9. The SAR ship target detection method based on generating and correcting tilted frames according to claim 8, characterized in that, The smoothing L1 loss function described in step 3.4 is as follows: in, This represents the sum of the coordinate differences between the j-th ship target bounding box in the i-th sample and the corresponding coordinates of the j-th ship target bounding box in the i-th sample, as output by the OrpRPN sub-network. Let x, y, width, height, and two projection lengths represent the center position of the tilted bounding box of the j-th ship target in the i-th sample, respectively. These represent the x-coordinate, y-coordinate, width, height, and two projection lengths of the center position of the tilted bounding box of the j-th ship target in the i-th sample output by the OrpRPN subnetwork.
10. The SAR ship target detection method based on generating and correcting tilted frames according to claim 9, characterized in that, The KLD loss function described in step 3.4 is as follows: Where τ represents the hyperparameter used to adjust the loss value, and τ is greater than or equal to 1. This represents the Kullback-Leibler distance between the two-dimensional Gaussian distribution of the tilted bounding box of the i-th ship target in the i-th sample predicted by the network and the two-dimensional Gaussian distribution of the tilted bounding box of the j-th ship target in the i-th sample. Let represent the mean and variance matrices of the two-dimensional Gaussian distribution of the tilted bounding box of the j-th ship target in the i-th sample predicted by the network, respectively. Tr(·) represents the operation of finding the trace of the matrix. -1 This represents the operation of finding the inverse of a matrix. Let x, y, width, height, and angle represent the center position of the tilted bounding box of the j-th ship target in the i-th sample output by the OrpReg subnetwork, respectively. Let and represent the mean and variance matrices of the two-dimensional Gaussian distribution of the tilted bounding box of the j-th ship target in the i-th sample, respectively. Let x, y, width, height, and angle represent the center position of the tilted bounding box of the j-th ship target in the i-th sample, respectively.
Citation Information
Patent Citations
Improved YOLOv3-based ship detection method in any direction
CN112487912A
Arbitrary direction ship detection method based on improved YOLOv3
CN112487912B
Ship remote sensing target detection method based on boundary optimization neural network
CN112347895A
SAR ship target detection method based on mask network fusion image features
CN115965862A