YOLOv8 improved model training method and ship detection method

The improved YOLOv8 model addresses the challenges of ship detection in complex marine environments by integrating an OBB rotation detection model and attention mechanisms, enhancing feature extraction and fusion, thereby improving detection accuracy and robustness.

CN119131580APending Publication Date: 2024-12-13SOUTHWEST JIAOTONG UNIV YANTAI NEW GENERATION INFORMATION TECH RES INST +1
View PDF 0 Cites 9 Cited by

Patent Information

Application Number
CN202411149231.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

Existing ship detection methods face challenges in accurately detecting ships of varying scales, shapes, and orientations in complex marine environments due to factors like waves, clouds, and resolution issues in remote sensing images, leading to reduced accuracy and increased false or missed detections.

Method used

An improved YOLOv8 model training method incorporating an OBB rotation detection model, a feature extraction network with a receptive field attention mechanism, a dynamic attention scale sequence feature fusion network, and a large separable kernel attention mechanism to enhance feature extraction and detection accuracy.

Benefits of technology

The method effectively handles the diversity of ship characteristics, improving detection accuracy and robustness in complex marine environments by capturing angle features, enhancing feature extraction, and fusing multi-scale information to accurately identify ships.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119131580A_ABST
    Figure CN119131580A_ABST
Patent Text Reader

Abstract

The invention discloses a YOLOv8 improved model training method and a ship detection method, and belongs to the technical field of target detection. According to the method, on the basis of a sample ship remote sensing image and a sample ship labeling remote sensing image, a YOLOv8 improved model comprising an OBB rotation detection model, a feature extraction network RFAnet, a dynamic attention scale sequence feature fusion network DSASS F and an SPPFLSKA module is trained. The method can effectively cope with the diversity of the target ship in scale, shape, direction and attitude, accurately captures the characteristics of the ship, and improves the ship detection precision and robustness in a complex marine environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of target detection technology, and in particular to an improved YOLOv8 model training method and a ship detection method. Background Art

[0002] In the field of ocean monitoring, the detection and recognition of ship targets has always been an important research hotspot. Due to the characteristics of ships at sea, such as large scale, variable shape and arbitrary direction, and in complex ocean environments, factors such as waves, clouds and wave reflections will seriously affect the visibility and recognition accuracy of ship targets. In addition, the resolution and quality of remote sensing images also directly affect the effect of target detection.

[0003] At present, the ship detection methods in related technologies include visual detection methods based on feature matching and template matching and target detection methods based on convolutional neural networks (CNN). Visual detection methods based on feature matching and template matching usually require manual feature selection, which is not only labor-intensive, but also has poor robustness under complex backgrounds and different lighting conditions; although the target detection algorithm based on convolutional neural networks (CNN) performs well in some scenarios, it has poor recognition effect on target ships of various scales, shapes, postures and directions, and this method often introduces unnecessary background information, reduces the accuracy of detection, and increases the risk of false detection and missed detection. Therefore, it is urgent to develop a ship detection method to solve the above problems. Summary of the invention

[0004] In view of this, the present application provides an improved YOLOv8 model training method and a ship detection method, which can effectively cope with the diversity of target ships in scale, shape, direction and posture, accurately capture the characteristics of ships, and improve the accuracy and robustness of ship detection in complex marine environments.

[0005] Specifically, the following technical solutions are included:

[0006] In a first aspect, the present application provides a YOLOv8 improved model training method, the method comprising:

[0007] Acquire a sample ship remote sensing image, a sample ship annotated remote sensing image and a YOLOv8 improved model, wherein the sample ship annotated image is an image after the sample ship remote sensing image is classified and annotated, and the sample ship annotated image is an image after classification and annotation with four types of labels, and the four types of labels are ship, aircraft carrier, warship and merchant ship, respectively, and the YOLOv8 improved model includes an OBB rotation detection model suitable for angle features, a feature extraction network RFAnet improved by a receptive field attention mechanism, an SPPF_LSKA module improved by a large separable kernel attention mechanism, and a dynamic attention scale sequence feature fusion network DSASSF;

[0008] Based on the sample ship remote sensing image and the sample ship annotated remote sensing image, the YOLOv8 improved model is trained to obtain a target ship detection model.

[0009] In some embodiments, the training of the YOLOv8 improved model based on the sample ship remote sensing image and the sample ship annotated remote sensing image to obtain the target ship detection model specifically includes:

[0010] Based on the sample ship remote sensing image and the sample ship annotated remote sensing image, training a YOLOv8 improved model to obtain an intermediate YOLOv8 improved model;

[0011] In response to the performance of the intermediate YOLOv8 improved model reaching a preset standard, the intermediate YOLOv8 improved model reaching the preset standard is used as the target ship detection model; in response to the performance of the intermediate YOLOv8 improved model not reaching the preset standard, the training parameters of the intermediate YOLOv8 improved model are adjusted until the performance of the intermediate YOLOv8 improved model reaches the preset standard, the training parameters including one or more parameters of an initial learning rate and a number of training iterations.

[0012] In some embodiments, the YOLOv8 improved model is a model improved on the basis of the YOLOv8 model, and the improvement method includes:

[0013] The OBB rotation detection model suitable for angle features is introduced, and the Head part of the YOLOv8 model is replaced with the OBB rotation detection model as the Head part of the YOLOv8 improved model;

[0014] Improve the feature extraction network CSPDarknet-53 of the YOLOv8 model, replace the Conv convolution layer in the feature extraction network CSPDarknet-53 with the RFCBAM_Conv module improved by the receptive field attention mechanism, and replace the C2f module in the feature extraction network CSPDarknet-53 with the RFCBAM_C2f module improved by the receptive field attention mechanism, so as to obtain the feature extraction network RFAnet improved by the receptive field attention mechanism;

[0015] Improve the fast spatial pyramid pooling layer SPPF in the YOLOv8 model, replace the fast spatial pyramid pooling layer SPPF with the SPPF_LSKA module improved by the large separable kernel attention mechanism, and obtain the SPPF_LSKA module improved by the large separable kernel attention mechanism;

[0016] The PANet feature fusion network in the YOLOv8 model is improved by adding the DSASSF structure. At the same time, the Conv convolution layer in the PANet feature fusion network is replaced with the RFCBAM_Conv improved by the receptive field attention mechanism, and the C2f module in the PANet feature fusion network is replaced with the RFCBAM_C2f improved by the receptive field attention mechanism to obtain the dynamic attention scale sequence feature fusion network DSASSF.

[0017] In some embodiments, the YOLOv8 improved model training method further includes:

[0018] The label format in the sample ship annotated image is converted into the YOLO-OBB format that supports the OBB rotation detection model.

[0019] In some embodiments, the RFCBAM_Conv module improved by the receptive field attention mechanism is used to expand the feature map size, and utilizes the spatial and channel attention mechanisms to enhance the feature representation, including a grouped convolution layer Group Conv, a shape adjustment layer Adjust Shape, a channel attention module SE, a spatial attention module, a standard convolution layer Conv, and a Sigmoid activation function;

[0020] The RFCBAM_C2f module improved by the receptive field attention mechanism includes multiple Bottleneck_RFCBAMConvs, each Bottleneck_RFCBAMConv is used to perform a convolution operation with an attention mechanism.

[0021] In some embodiments, the Bottleneck_RFCBAMConv is improved on the basis of the Bottleneck module, and the specific improvement includes: replacing the second convolutional layer in the Bottleneck module with the RFCBAM_Conv module.

[0022] In some embodiments, the SPPF_LSKA module is specifically improved in the following ways:

[0023] The LSKA module is added after the pooling operation of each scale in the SPPF module to aggregate spatial information and enhance the expressiveness of features through the attention mechanism.

[0024] In some embodiments, the dynamic attention scale sequence feature fusion network DSASSF has a DSASSF structure, which is used to fuse spatial features, multi-scale features, and global or high-level semantic information of images of multiple scales to capture local details of the ship. The dynamic attention scale sequence feature fusion network DSASSF includes a DynamicScalSeq module and multiple MSFE multi-scale feature encoding modules.

[0025] In some embodiments, the OBB rotation detection model includes a convolutional layer, a classification layer, and a regression layer, which are used to rotate and classify the multi-scale enhanced feature map output by the dynamic attention scale sequence feature fusion network DSASSF, and output the ship detection result. The OBB rotation detection model includes a ProbIoU loss function.

[0026] In a second aspect, the present application provides a ship detection method, the method comprising:

[0027] Obtain the target ship detection model in the YOLOv8 improved model training method as described in the first aspect;

[0028] The remote sensing image of the ship to be detected is input into the target ship detection model to obtain a ship detection result, which includes the position of the ship detection boundary box, the ship category, the confidence level and the category probability.

[0029] The beneficial effects of the technical solution provided by the embodiments of the present application include at least:

[0030] The embodiment of the present application provides a YOLOv8 improved model training method and a ship detection method. The method is based on sample ship remote sensing images and sample ship annotated remote sensing images, and trains a YOLOv8 improved model including an OBB rotation detection model suitable for angle features, a feature extraction network RFAnet improved by a receptive field attention mechanism, a dynamic attention scale sequence feature fusion network DSASSF, and an SPPF_LSKA module improved by a large separable kernel attention mechanism. The introduction of the OBB rotation detection model suitable for angle features can avoid random interference of the ship's orientation, the introduction of the feature extraction network RFAnet improved by a receptive field attention mechanism can improve the extraction performance of ship features, the SPPF_LSKA module improved by a large separable kernel attention mechanism can capture long-distance dependencies in images, and further enhance the extraction capability of multi-scale features, and the dynamic attention scale sequence feature fusion network DSASSF can fuse spatial features, multi-scale features, and global or high-level semantic information of images of multiple scales to capture local details of ships and improve detection accuracy. The present application can effectively cope with the diversity of target ships in scale, shape, direction and posture, accurately capture the characteristics of ships, and improve the accuracy and robustness of ship detection in complex marine environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0032] Figure 1 A method flow chart of a YOLOv8 improved model training method provided in an embodiment of the present application;

[0033] Figure 2 A rendering of the HRSC2016 data set in a YOLOv8 improved model training method provided in an embodiment of the present application;

[0034] Figure 3 A schematic diagram of the structure of a YOLOv8 improved model of a YOLOv8 improved model training method provided in an embodiment of the present application;

[0035] Figure 4 A schematic diagram of the structure of the RFCBAM_Conv module improved by the receptive field attention mechanism in the feature extraction network RFAnet in the YOLOv8 improved model of the YOLOv8 improved model training method provided in an embodiment of the present application;

[0036] Figure 5 A schematic diagram of the structure of the SPPF_LSKA module in the YOLOv8 improved model of the YOLOv8 improved model training method provided in an embodiment of the present application;

[0037] Figure 6 A schematic diagram of the structure of a dynamic attention scale sequence feature fusion network DSASSF in a YOLOv8 improved model of a YOLOv8 improved model training method provided in an embodiment of the present application;

[0038] FIG7( a) is a schematic diagram of an accuracy curve of a training effect of a YOLOv8 improved model training method provided in an embodiment of the present application;

[0039] FIG7( b ) is a schematic diagram of a recall rate curve in the training effect of a YOLOv8 improved model training method provided in an embodiment of the present application;

[0040] Figure 7(c) is a schematic diagram of the mAP curve of the training effect of an improved YOLOv8 model training method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0042] In order to make the technical solutions and advantages of the present application more clear, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0043] In the first aspect, the present application provides a YOLOv8 improved model training method, such as Figure 1 As shown, the method includes:

[0044] Step 101, obtain a sample ship remote sensing image, a sample ship annotated remote sensing image and a YOLOv8 improved model, the sample ship annotated image is an image after the sample ship remote sensing image is classified and annotated, the sample ship annotated image is an image after classification and annotation with four types of labels, the four types of labels are ship, aircraft carrier, warship and merchant ship, the YOLOv8 improved model includes an OBB rotation detection model suitable for angle features, a feature extraction network RFAnet improved by a receptive field attention mechanism, an SPPF_LSKA module improved by a large separable kernel attention mechanism and a dynamic attention scale sequence feature fusion network DSASSF.

[0045] Introducing the OBB rotation detection model suitable for angle features can avoid the random interference of the ship's orientation. Introducing the feature extraction network RFAnet improved by the receptive field attention mechanism can improve the extraction performance of ship features. The SPPF_LSKA module improved by the large separable kernel attention mechanism can capture the long-distance dependency in the image and further enhance the extraction ability of multi-scale features. The dynamic attention scale sequence feature fusion network DSASSF can fuse spatial features, multi-scale features and the global or high-level semantic information of images at multiple scales to capture the local details of the ship and improve detection accuracy.

[0046] In some embodiments, the sample ship annotated images may come from the HRSC2016 (High Resolution Ship Collection 2016) dataset, which is a high-resolution remote sensing image dataset specifically used for marine ship detection. It was released by Northwestern Polytechnical University in 2016 and extracted from six important port sets in Google Earth. Figure 2As shown in the figure, the HRSC2016 dataset has many challenges in the detection task, such as complex ocean background, huge differences in ship scales, arbitrary orientation of ships, and small target detection, which increase the difficulty of the detection task. The classification level of the dataset is four categories: ships, aircraft carriers, warships, and merchant ships.

[0047] Since the annotation format of the HRSC2016 dataset is an xml format file, it needs to be converted into a txt label file format supported by the YOLOv8 improved model. In some embodiments, the YOLOv8 improved model training method also includes: converting the label format in the sample ship annotated image into a YOLO-OBB format that supports the OBB rotation detection model.

[0048] In some embodiments, the YOLOv8 improved model is a model improved on the basis of the YOLOv8 model, such as Figure 3As shown in the figure, the improvement methods include: (1) Introducing the OBB rotation detection model suitable for angle features, replacing the Head part of the YOLOv8 model with the OBB rotation detection model as the Head part of the YOLOv8 improved model. Since the ship may have different directions and postures, the OBB rotation detection model is used to rotate the ship to avoid the random interference of the ship's orientation. (2) Improving the feature extraction network CSPDarknet-53 of the YOLOv8 model, replacing the Conv convolution layer in the feature extraction network CSPDarknet-53 with the RFCBAM_Conv module improved by the receptive field attention mechanism, and replacing the C2f module in the feature extraction network CSPDarknet-53 with the RFCBAM_C2f module improved by the receptive field attention mechanism, and obtaining the feature extraction network RFAnet improved by the receptive field attention mechanism. The receptive field attention mechanism not only pays attention to the receptive field spatial features, but also provides effective attention weights for subsequent large-size convolution kernels, providing almost negligible computational cost and parameter increment, while significantly improving network performance. (3) Improve the fast spatial pyramid pooling layer SPPF in the YOLOv8 model, replace the fast spatial pyramid pooling layer SPPF with the SPPF_LSKA module improved by the large separable kernel attention mechanism, and obtain the SPPF_LSKA module improved by the large separable kernel attention mechanism, which can effectively capture the long-distance dependency in the image and enhance the multi-scale feature extraction capability. (4) Improve the PANet feature fusion network in the YOLOv8 model, add the DSASSF structure, replace the Conv convolution layer in the PANet feature fusion network with the RFCBAM_Conv improved by the receptive field attention mechanism, and replace the C2f module in the PANet feature fusion network with the RFCBAM_C2f improved by the receptive field attention mechanism, and obtain the dynamic attention scale sequence feature fusion network DSASSF. The dynamic attention scale sequence feature fusion network DSASSF is a feature fusion network based on the dynamic attention scale sequence, which combines spatial, multi-scale features, and global or high-level semantic information from images of multiple scales. It can also capture the local fine details of small target objects of ships, thereby better acquiring the shape and scale of ships and improving detection capabilities.

[0049] In some embodiments, the YOLOv8 improved model includes a Backbone part, a Neck part and a Head part. The Backbone part is used to extract features and convert the image into a feature representation with rich semantic information; the Neck part is used to fuse the features from the Backbone part to improve the performance of the model; and the Head part is used to output the detection results.

[0050] In some embodiments, the feature extraction network RFAnet improved by the receptive field attention mechanism and the SPPF_LSKA module improved by the large separable kernel attention mechanism are located in the Backbone part of the YOLOv8 improved model, the dynamic attention scale sequence feature fusion network DSASSF is located in the Neck part of the Backbone part, and the OBB rotation detection model is located in the Head part of the YOLOv8 improved model.

[0051] In some embodiments, the RFCBAM_Conv module improved with the receptive field attention mechanism is used to expand the feature map size, and the spatial and channel attention mechanisms are used to enhance the feature representation, including a grouped convolution layer Group Conv, a grouped convolution layer Group Conv, a channel attention module SE, a spatial attention module, a standard convolution layer Conv and a Sigmoid activation function; the RFCBAM_C2f module improved with the receptive field attention mechanism includes multiple Bottleneck_RFCBAMConv, each Bottleneck_RFCBAMConv is used to perform a convolution operation with an attention mechanism.

[0052] The RFCBAM_Conv module is a convolutional module combined with receptive field attention (RFA), which first expands the feature map size and then uses spatial and channel attention mechanisms to enhance feature representation. Figure 4 As shown in the figure, the group convolution layer Group Conv and the group convolution layer Group Conv expand the input feature map to adapt to the convolution kernel size, the channel attention module SE provides channel-level importance adjustment, and the spatial attention module includes a combination of the maximum pooling layer and the average pooling layer, the convolution layer and the sigmoid activation function. Finally, the weighted feature maps of these attention mechanisms are passed to the standard convolution layer Conv to generate the output feature map. The RFCBAM_Conv module can adapt to the feature extraction of ships of different scales, improve the perception and capture capabilities of the key area features of the ship, and thus improve the recognition accuracy and efficiency.

[0053] The RFCBAM_C2f module creates multiple Bottleneck_RFCBAMConv to replace the original Bottleneck and uses the receptive field attention mechanism. Each Bottleneck_RFCBAMConv performs a convolution operation with an attention mechanism, which helps to improve the expression of important parts in the feature map and reduce attention to unimportant parts.

[0054] In some embodiments, Bottleneck_RFCBAMConv is improved on the basis of Bottleneck module, and the specific improvement includes: replacing the second convolution layer in Bottleneck module with RFCBAM_Conv module. Bottleneck_RFCBAMConv still has shortcut structures of two organizational structures of True and False.

[0055] See also Figure 5 In some embodiments, the SPPF_LSKA module is specifically improved in the following ways:

[0056] The LSKA module is added after the pooling operation of each scale in the SPPF module to aggregate spatial information and enhance the expressiveness of features through the attention mechanism.

[0057] After the traditional SPPF module performs pooling operations at different scales, the results are directly connected for subsequent feature fusion. In the SPPF module improved by the LSKA (Large Separable Kernel Attention) module, the LSKA module is added after the pooling operation at each scale. This setting not only aggregates spatial information, but also strengthens the expressiveness of features through the attention mechanism. In the LSKA module, the attention weight is calculated through large-size separable convolution and subsequent softmax layers. This weight adjustment mechanism enables the YOLOv8 improved model to adaptively focus on more informative areas and ignore unimportant parts.

[0058] like Figure 6 As shown, in some embodiments, the dynamic attention scale sequence feature fusion network DSASSF has a DSASSF structure, which is used to fuse spatial features, multi-scale features, and global or high-level semantic information of images of multiple scales to capture local details of the ship. The dynamic attention scale sequence feature fusion network DSASSF includes a DynamicScalSeq module and multiple MSFE multi-scale feature encoding modules.

[0059] In some embodiments, the number of MSFE multi-scale feature encoding modules may be two, see Figure 3 MSFE|CSP, Figure 3 The first MSFE|CSP from the bottom is the first MSFE multi-scale feature encoding module, and the first MSFE|CSP from the top is the second MSFE multi-scale feature encoding module.

[0060] See also Figure 3 , feature extraction is performed on the sample ship remote sensing image to obtain feature maps of four different output scales, among which the first scale feature map and the second scale feature map Figure 1The second scale feature map and the third scale feature map are input into the second MSFE multi-scale feature encoding module. Figure 1 The second, third, and fourth features are input into the first MSFE multi-scale feature encoding module. Figure 3 Scale Features Figure 1 The fourth scale feature map is input into the DynamicScalSeq module. The fourth scale feature map is pooled by the SPPF_LSKA module and then output to the first MSFE multi-scale feature encoding module.

[0061] Compared with the original feature fusion network of YOLOv8, the dynamic attention scale sequence feature fusion network DSASSF not only changes the connection relationship between modules, but also makes the connection between the upper and lower pyramids closer. The DynamicScalSeq module combines multi-scale input processing and three-dimensional convolution technology, and has a dynamic scale feature fusion structure. Multiple MSFE multi-scale feature encoding modules mainly include two parts: size adjustment and feature splicing, which receive feature maps of three scales respectively, divided into three levels: large, medium and small.

[0062] The dynamic attention scale sequence feature fusion network DSASSF is a dynamic scale feature fusion structure that combines multi-scale input processing and three-dimensional convolution technology. In some embodiments, the processing process of each part of the dynamic attention scale sequence feature fusion network DSASSF is as follows:

[0063] (1) In the feature map adjustment part, the number of channels of the second scale feature map (hereinafter referred to as p3), the third scale feature map (p4) and the fourth scale feature map (p5) of different scales are unified. In response to the input channel number inc[0] not being equal to the specified channel number channel, the channel numbers of p3, p4 and p5 are adjusted through the self.conv0 layer, the self.conv1 layer and the self.conv2 layer respectively.

[0064] (2) In the dynamic sampling part, p4 and p5 are dynamically sampled through self.dysample1 and self.dysample2, and feature processing is dynamically adjusted according to the content of the feature to improve the expressiveness of the feature and the adaptability of the network.

[0065] (3) In the three-dimensional feature fusion part, torch.unsqueeze is used to add a new dimension and convert the processed feature map into a format suitable for three-dimensional convolution. The three feature maps are concatenated in the new dimension, and deep feature fusion is performed through the three-dimensional convolution layer self.conv3d, the batch normalization layer self.bn, the self.act activation function and the three-dimensional pooling layer self.pool_3d. Among them, the self.act activation function uses LeakyReLU. Finally, the unsqueeze layer is used to regress the shape of the data from three-dimensional data to two-dimensional data to adapt it to the subsequent layers or output requirements of the network.

[0066] (4) After 3D convolution and related operations, the shape of the feature map is converted to batch_size, channels, depth, height, width. In the DynamicScalSeq module, the depth dimension is added by torch.unsqueeze to convert the 2D feature map to a 3D feature map for 3D convolution operations. After 3D pooling, if the size of the depth dimension is 1, which usually means that this dimension is no longer needed after 3D convolution and pooling, torch.squeeze(x,2) is used to remove this single-element dimension and convert the shape of the feature map from (batch_size, channels, 1, height, width) to (batch_size, channels, height, width).

[0067] (5) In the resizing part of the MSFE multi-scale feature encoding module, the large-scale feature map L in the feature map is adjusted to the size of the medium-scale feature map M using the adaptive maximum pooling layer F.adaptive_max_pool2d and the adaptive average pooling layer F.adaptive_avg_pool2d, and the results of the two are added together. This method combines the ability of maximum pooling to capture significant features and the ability of average pooling to retain background information, providing a comprehensive feature representation. The small-scale feature map S in the feature map is adjusted to the size of the medium-scale feature map M through the nearest neighbor interpolation layer F.interpolate. The nearest neighbor interpolation layer F.interpolate can maintain the original features of the small-scale feature map S, avoid introducing too much smoothing during the upsampling process, and is conducive to capturing the local details of the ship.

[0068] (6) In the feature concatenation part of the MSFE multi-scale feature encoding module, the feature maps are fused, and the adjusted large-scale feature map L, the unadjusted medium-scale feature map M, and the adjusted small-scale feature map S are concatenated along the channel dimension through torch.cat. In this way, the ship information of different scales can be integrated, so that the fused feature map contains multi-level information from coarse to detailed.

[0069] Therefore, the dynamic attention scale sequence feature fusion network DSASSF can achieve rapid fusion of multi-scale features through a simple and effective feature fusion strategy, improving the YOLOv8 improved model's ability to process multi-scale features, especially in scenes with complex backgrounds or multi-scale targets. The YOLOv8 improved model can still accurately capture and quickly fuse multi-scale features. This feature fusion strategy is of great significance for improving the generalization ability of the YOLOv8 improved model and the recognition accuracy of ships.

[0070] like Figure 3 As shown in Figure 2, after being processed by the feature extraction network RFAnet improved by the receptive field attention mechanism and the dynamic attention scale sequence feature fusion network DSASSF, the fused feature map is passed to the Head part (i.e. Figure 3 The prediction head OBB_head in the image is used, and the Head part then outputs the ship detection result.

[0071] In object detection, traditional loss functions (such as IoU loss, GIoU loss, etc.) are mainly used to process horizontal rectangular boxes HBB. However, when processing rotated targets with diverse directions and postures (such as rotated rectangular boxes OBB), these loss functions may not be able to effectively capture the geometric characteristics of the rotated targets, resulting in reduced detection accuracy. The ProbIoU loss function introduces probability and geometric characteristics and is specifically designed for rotated rectangular boxes. It combines the parameters of the rotated rectangle and considers the angle and position deviation of the rotation when calculating the loss. It considers the characteristics of the 2D Gaussian distribution, meets all distance metrics, can represent the true distance between different distributions, and is differentiable everywhere, which can improve the detection accuracy of the OBB rotation detection model. The ProbIoU loss function shows high stability and robustness when dealing with complex backgrounds and multi-target detection tasks.

[0072] It should be noted that the ProbIoU (Probabilistic Intersection over Union) loss function combines the ideas of IoU and probability distribution to provide more accurate target detection results. It better reflects the degree of match between the predicted box and the true box by treating them as probability distributions and calculating the intersection over union ratio between them.

[0073] In some embodiments, the first scale may be 20×20, the second scale may be 40×40, the third scale may be 80×80, and the fourth scale may be 160×160.

[0074] In some embodiments, the Head part of the YOLOv8 improved model, that is, the OBB rotation detection model, includes a classification branch and a regression branch. The classification branch can perform a convolution operation on the feature map, and then output the ship category, the category probability and the confidence of each bounding box through a fully connected layer or a convolution layer; the regression branch can output the coordinate offset (x, y, w, h) of each bounding box, which is used for regression to obtain the precise ship detection bounding box position.

[0075] In some embodiments, the YOLOv8 improved model training method may also include a non-maximum suppression module and a threshold filtering module to post-process the ship detection results, so that the final ship detection results are more accurate. The non-maximum suppression module eliminates duplicate bounding boxes and can screen out the bounding boxes with the highest confidence and non-overlapping. The threshold filtering module filters out detection results with lower confidence according to the set confidence threshold.

[0076] Step 102: Based on the sample ship remote sensing image and the sample ship annotated remote sensing image, train the YOLOv8 improved model to obtain a target ship detection model.

[0077] By training the improved YOLOv8 model, the performance of the target ship detection model meets the requirements.

[0078] In some embodiments, step 102 specifically includes:

[0079] (1) Based on the sample ship remote sensing images and the sample ship annotated remote sensing images, the YOLOv8 improved model is trained to obtain the intermediate YOLOv8 improved model.

[0080] (2) in response to the performance of the intermediate YOLOv8 improved model reaching a preset standard, using the intermediate YOLOv8 improved model reaching the preset standard as a target ship detection model; in response to the performance of the intermediate YOLOv8 improved model not reaching the preset standard, adjusting training parameters of the intermediate YOLOv8 improved model until the performance of the intermediate YOLOv8 improved model reaches the preset standard, the training parameters including one or more parameters of an initial learning rate and a number of training iterations.

[0081] When the performance of the intermediate YOLOv8 improved model reaches the preset standard, the training of the intermediate YOLOv8 improved model is completed and can be used as the final target ship detection model. When the performance of the intermediate YOLOv8 improved model does not reach the preset standard, it means that one or more parameters of the initial learning rate and the number of training iterations of the intermediate YOLOv8 improved model need to be adjusted until the performance of the intermediate YOLOv8 improved model reaches the preset standard.

[0082] In some embodiments, the preset standard may be that the accuracy, mean average precision (mAP), and recall rate are significantly improved for 60 consecutive training rounds.

[0083] In some embodiments, SGD stochastic gradient descent is selected as the optimization strategy, and the learning rate adjustment strategy adopts the cosine annealing strategy.

[0084] In some embodiments, the initial learning rate can be set to 0.01 and the number of training iterations can be set to 300 epochs.

[0085] In some embodiments, intermediate YOLOv8 is continuously optimized to improve model performance through loss calculation, back propagation, and training parameter adjustment.

[0086] Table 1 Performance comparison between YOLOv8 improved model and YOLOv8 model

[0087]

[0088] As shown in Table 1, baseline represents the YOLOv8 model before improvement, the check marks represent the introduction of different modules, and no check marks mean that the module is not introduced. RFA is the feature extraction network RFAnet with the introduction of the receptive field attention mechanism, LSKA is the SPPF_LSKA module with the introduction of the large separable kernel attention mechanism, and DSASSF is the dynamic attention scale sequence feature fusion network DSASSF. The ablation experiment results show that the mAP (MeanAverage Precision) of the YOLOv8 model on the HRSC2016 (four-classification) dataset is 76.7%; after introducing the feature extraction network RFAnet with the introduction of the receptive field attention mechanism, the mAP on the HRSC2016 dataset (four-classification) can be improved by 2.2% to 78.9%; on this basis, after introducing the SPPF_LSKA module with the introduction of the large separable kernel attention mechanism, the mAP can be improved by 2.5% to 79.2%; after further introducing the dynamic attention scale sequence feature fusion network DSASSF, the mAP can be improved by 3.9% to 80.6%.

[0089] The training effect diagram of the YOLOv8 improved model training method provided in the embodiment of the present application on the HRSC2016 dataset is as follows: Figure 7(a) to Figure 7(c) As shown, the accuracy of the target ship detection model can reach 77.9%, the recall rate can reach 79.4%, and the mAP can reach 80.6%. This shows that the YOLOv8 improved model training method proposed in this application has high detection accuracy for marine ships in complex scenes and has important application value for marine monitoring.

[0090] In summary, the improved YOLOv8 model training method provided in the embodiment of the present application detects ships through the target ship detection model, introduces the OBB rotation detection model suitable for angle features to avoid random interference of the ship's orientation, introduces the feature extraction network RFAnet improved by the receptive field attention mechanism to improve the extraction performance of ship features, and uses the SPPF_LSKA module improved by the large separable kernel attention mechanism to capture long-distance dependencies in the image, further enhancing the ability to extract multi-scale features. The dynamic attention scale sequence feature fusion network DSASSF can fuse spatial features, multi-scale features, and global or high-level semantic information of images at multiple scales, capture local details of ships, and improve detection accuracy. The present application can effectively cope with the diversity of target ships in scale, shape, direction, and posture, accurately capture the characteristics of ships, and improve the accuracy and robustness of ship detection in complex marine environments.

[0091] In a second aspect, the present application provides a ship detection method, the method comprising:

[0092] Step 201: Obtain a target ship detection model in the YOLOv8 improved model training method of the first aspect.

[0093] Step 202, input the remote sensing image of the ship to be detected into the target ship detection model to obtain the ship detection result, which includes the position of the ship detection boundary box, the ship category, the confidence and the category probability.

[0094] In summary, the embodiments of the present application provide a ship detection method that can effectively cope with the diversity of target ships in scale, shape, direction and posture, accurately capture the characteristics of ships, and improve the accuracy and robustness of ship detection in complex marine environments.

[0095] In the present application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The term "plurality" refers to two or more than two, unless otherwise clearly defined.

[0096] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the present application disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only.

[0097] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. YOLOv8 improved model training method, characterized by: The method comprises: Acquire a sample ship remote sensing image, a sample ship annotated remote sensing image and a YOLOv8 improved model, wherein the sample ship annotated image is an image after the sample ship remote sensing image is classified and annotated, and the sample ship annotated image is an image after classification and annotation with four types of labels, and the four types of labels are ship, aircraft carrier, warship and merchant ship, respectively, and the YOLOv8 improved model includes an OBB rotation detection model suitable for angle features, a feature extraction network RFAnet improved by a receptive field attention mechanism, an SPPF_LSKA module improved by a large separable kernel attention mechanism, and a dynamic attention scale sequence feature fusion network DSASSF; Based on the sample ship remote sensing image and the sample ship annotated remote sensing image, the YOLOv8 improved model is trained to obtain a target ship detection model.

2. The YOLOv8 improved model training method according to claim 1, characterized in that: The step of training the YOLOv8 improved model based on the sample ship remote sensing image and the sample ship annotated remote sensing image to obtain the target ship detection model specifically includes: Based on the sample ship remote sensing image and the sample ship annotated remote sensing image, training a YOLOv8 improved model to obtain an intermediate YOLOv8 improved model; In response to the performance of the intermediate YOLOv8 improved model reaching a preset standard, the intermediate YOLOv8 improved model reaching the preset standard is used as the target ship detection model; in response to the performance of the intermediate YOLOv8 improved model not reaching the preset standard, the training parameters of the intermediate YOLOv8 improved model are adjusted until the performance of the intermediate YOLOv8 improved model reaches the preset standard, the training parameters including one or more parameters of an initial learning rate and a number of training iterations.

3. The YOLOv8 improved model training method according to claim 1, characterized in that: The YOLOv8 improved model is a model that is improved on the basis of the YOLOv8 model. The improvements include: The OBB rotation detection model suitable for angle features is introduced, and the Head part of the YOLOv8 model is replaced with the OBB rotation detection model as the Head part of the YOLOv8 improved model; Improve the feature extraction network CSPDarknet-53 of the YOLOv8 model, replace the Conv convolution layer in the feature extraction network CSPDarknet-53 with the RFCBAM_Conv module improved by the receptive field attention mechanism, and replace the C2f module in the feature extraction network CSPDarknet-53 with the RFCBAM_C2f module improved by the receptive field attention mechanism, so as to obtain the feature extraction network RFAnet improved by the receptive field attention mechanism; Improve the fast spatial pyramid pooling layer SPPF in the YOLOv8 model, replace the fast spatial pyramid pooling layer SPPF with the SPPF_LSKA module improved by the large separable kernel attention mechanism, and obtain the SPPF_LSKA module improved by the large separable kernel attention mechanism; The PANet feature fusion network in the YOLOv8 model is improved by adding the DSASSF structure. At the same time, the Conv convolution layer in the PANet feature fusion network is replaced with the RFCBAM_Conv improved by the receptive field attention mechanism, and the C2f module in the PANet feature fusion network is replaced with the RFCBAM_C2f improved by the receptive field attention mechanism to obtain the dynamic attention scale sequence feature fusion network DSASSF.

4. The YOLOv8 improved model training method according to claim 1, characterized in that: The YOLOv8 improved model training method also includes: The label format in the sample ship annotated image is converted into the YOLO-OBB format that supports the OBB rotation detection model.

5. The YOLOv8 improved model training method according to claim 3, characterized in that: The RFCBAM_Conv module improved by the receptive field attention mechanism is used to expand the feature map size, and utilizes the spatial and channel attention mechanisms to enhance the feature representation, including a grouped convolution layer Group Conv, a shape adjustment layer Adjust Shape, a channel attention module SE, a spatial attention module, a standard convolution layer Conv, and a Sigmoid activation function; The RFCBAM_C2f module improved by the receptive field attention mechanism includes multiple Bottleneck_RFCBAMConvs, each Bottleneck_RFCBAMConv is used to perform a convolution operation with an attention mechanism.

6. The YOLOv8 improved model training method according to claim 5, characterized in that: The Bottleneck_RFCBAMConv is improved on the basis of the Bottleneck module, and the specific improvement method includes: replacing the second convolutional layer in the Bottleneck module with the RFCBAM_Conv module.

7. The YOLOv8 improved model training method according to claim 3, characterized in that: The SPPF_LSKA module is specifically improved as follows: The LSKA module is added after the pooling operation of each scale in the SPPF module to aggregate spatial information and enhance the expressiveness of features through the attention mechanism.

8. The YOLOv8 improved model training method according to claim 3, characterized in that: The dynamic attention scale sequence feature fusion network DSASSF has a DSASSF structure, which is used to fuse spatial features, multi-scale features and global or high-level semantic information of images of multiple scales to capture local details of the ship. The dynamic attention scale sequence feature fusion network DSASSF includes a DynamicScalSeq module and multiple MSFE multi-scale feature encoding modules.

9. The YOLOv8 improved model training method according to claim 3, characterized in that: The OBB rotation detection model includes a convolution layer, a classification layer and a regression layer, which are used to rotate and classify the multi-scale enhanced feature map output by the dynamic attention scale sequence feature fusion network DSASSF, and output the ship detection result. The OBB rotation detection model includes a ProbIoU loss function.

10. A ship detection method, characterized in that: The method comprises: Obtain a target ship detection model in the YOLOv8 improved model training method as described in any one of claims 1 to 9; The remote sensing image of the ship to be detected is input into the target ship detection model to obtain a ship detection result, which includes the position of the ship detection boundary box, the ship category, the confidence level and the category probability.

Citation Information

Cited By

  • Method and device for detecting aircraft target in SAR remote sensing image

    CN119942380A

  • Method and device for detecting aircraft targets in SAR remote sensing images

    CN119942380B

  • Contact network dropper state detection method based on improved YOLOv11s

    CN120451064A

  • Urban scale solid waste landfill site identification method based on artificial intelligence target identification algorithm

    CN120544041A

  • Surface defect detection method and system based on deep learning

    CN121032953A