Ship detection method and system combining spatial explicit vision and improved big nuclear attention
By introducing a large-core attention module with explicit spatial vision and improved spatial visualization in YOLOv8, the problem of long detection time and missed target detection in ship remote sensing image detection is solved, the accuracy and detection rate of small target detection is improved, and the The robustness and adaptability of the model.
Patent Information
- Application Number
- CN202410995089.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-11-15
AI Technical Summary
YOLOv8 has problems such as long detection time, inaccurate target detection and missed target detection in ship remote sensing image detection, especially when dealing with small targets, it is difficult to accurately identify and classify.
Combining spatial explicit vision and improved large-core attention module, through the processing and feature fusion of multi-layer semantic feature maps, global remote dependencies are extracted and local information is retained, feature extraction efficiency and adaptability are enhanced, and YOLOv8 backbone network is improved. Accuracy and detection rate of small object detection.
It effectively improves the detection accuracy and detection rate of small-target ships by the model, maintains efficient inference speed, enhances the robustness and adaptability of the model in complex environments, and achieves a more comprehensive and differentiated feature representation.
Smart Images

Figure CN118968017A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of image processing and object detection, and more particularly to a ship detection algorithm combining spatial explicit vision and improved large kernel attention. Background Art
[0002] Object detection technology is an important technology in the field of computer vision. Its main goal is to accurately locate and identify the target of interest in a given image or video. Object detection technology has been widely used in many fields. In the context of today's economic globalization, ocean transportation, as the main body of international trade, carries more than 2 / 3 of international freight volume. As a major maritime country, China has a large number of water transport ships and complex waters. The rapid development of its marine economy has further expanded the scale of marine transportation. In the context of this rapid growth, higher requirements are placed on the accurate positioning and identification of ships.
[0003] Early target detection algorithms manually extracted image features. The algorithm took too long and had low detection accuracy, which caused the target detection algorithm to remain at the performance saturation stage and could not be effectively improved. In 2012, AlexNet innovatively applied convolutional neural networks to image recognition, and the actual effect was significantly better than previous methods. In 2015, Redmon J et al. proposed the YOLO algorithm, which innovatively treated the detection problem as a regression problem. YOLO divides the image into grids and then performs regression predictions on each grid. YOLOv8, released by Ultralytics in 2023, is a fusion improvement based on previous generations of YOLO. YOLOv8 has higher accuracy and faster speed in target detection while maintaining its lightweight characteristics.
[0004] However, due to the scarcity of ship-related data sets in optical images taken by satellites or high-altitude drones (aircraft), the large format, diverse scenes, and highly variable imaging characteristics of ship remote sensing images, as well as the influence of interference information such as lighting factors, foggy weather, and water surface fluctuations on ship remote sensing images, YOLOv8 still has problems such as long detection time, inaccurate target detection, and missed target detection in terms of ship detection. In addition, ship remote sensing images contain a large number of small target ships, which are difficult to extract features from, difficult to detect, and difficult to classify. The backbone network of YOLOv8 pursues lightweightness when extracting features and only uses standard convolution, which is difficult to cope with ship detection in ship remote sensing images with interference from multiple factors. In addition, when performing feature fusion, YOLOv8 still uses the idea of Path Aggregation Network-feature pyramid network (PAN-FPN), which pays too much attention to the interaction of inter-layer features and ignores the importance of intra-layer feature adjustment. The above characteristics lead to YOLOv8 being able to only locate the most discriminative target areas, which has a great impact on the detection of small targets.
[0005] The Chinese patent application, publication number CN 117830622 A, describes a ship target rotation detection method based on YOLOv8. This method solves the problem that some background pixels may be mistakenly identified as ship outlines, resulting in poor ship detection performance. However, there is still a problem of insufficient anti-interference ability of this method when there are many interference factors in the ship remote sensing image. It does not take into account the characteristics of large format and many small targets of ship remote sensing images, and there are problems of inaccurate detection and missed detection of small target ships.
[0006] The Chinese patent application, publication number CN 114241377 A, describes a ship target detection method, device, equipment and medium based on improved YOLOX. The method solves the problem that YOLOX extracts features of small targets in images to better adapt to ship target detection tasks, but there are still problems that the importance of feature fusion is ignored, too much attention is paid to the detection of small targets, and the global features are ignored, resulting in incomplete ship target detection. In addition, the method is divided into two steps for ship detection, resulting in low efficiency and insufficient timeliness. Summary of the invention
[0007] 1. Technical issues to be solved
[0008] The technical problem to be solved by the patent of this invention is: in view of the fact that YOLOv8 still has problems such as long detection time, inaccurate target detection and target missed detection in ship detection of ship remote sensing images, a ship detection algorithm combining spatial explicit vision and improved large-core attention is provided to improve the detection speed, accuracy and detection rate of small targets.
[0009] 2. Technical solution
[0010] The purpose of the present invention is achieved through the following technical solutions.
[0011] The first aspect of the present invention provides a ship detection method combining spatial explicit vision and improved large kernel attention, and the specific steps are as follows:
[0012] Step 100, constructing a ship remote sensing image data set and preprocessing the ship remote sensing image data;
[0013] Step 200, input the preprocessed ship remote sensing image into the YOLOv8 backbone network integrated with the improved large core attention module to extract ship features, and output a multi-layer semantic feature map;
[0014] Step 300, the deepest semantic feature map in the multi-layer semantic feature map is processed by a spatial explicit vision module, and the specific process is: extracting the global long-range dependency relationship, retaining the local information of the input ship remote sensing image, obtaining a new deepest semantic feature map, and adjusting the remaining shallow semantic feature maps with the new deepest semantic feature map to obtain a processed multi-layer semantic feature map;
[0015] Step 400, the processed multi-layer semantic feature graph is subjected to feature fusion through a path aggregation network-feature pyramid network to obtain a fused multi-layer semantic feature graph;
[0016] Step 500, input the fused multi-layer semantic feature map into the decoupling head of YOLOv8 to detect and predict the ship classification and ship position;
[0017] Step 600, calculating the classification loss and regression loss according to the ship classification and ship position data obtained in step 500 to train the model, and finally obtaining a ship detection model;
[0018] Step 700: Use the ship detection model to detect the remote sensing image of the ship to be detected to obtain the position and category of the ship in the remote sensing image.
[0019] Furthermore, in step 200, the ship remote sensing image is input into the YOLOv8 backbone network integrated with the improved large core attention module to extract ship features, and a multi-layer semantic feature map is output. The specific process is: the input ship remote sensing image is processed by the standard convolution and the improved cross-stage local network module to obtain a layer of semantic feature map of the ship remote sensing image, and the semantic feature map obtained by this processing is input into the standard convolution and the improved cross-stage local network module again to obtain a deeper layer of semantic feature map, and the multi-layer semantic feature map is obtained by repeating the process multiple times. Preferably, the process is repeated 5 times, and the outputs of the last three times are taken as the obtained three-layer semantic feature map.
[0020] Specifically, the improved cross-stage partial network fusion_large separable kernel attention (C2f_LSK) module is composed of a cross-stage partial network (C2f) connected to an improved large kernel attention module.
[0021] Furthermore, the improved large core attention module is obtained by splitting the two-dimensional convolution kernel of the deep convolution and deep dilated convolution of the original large core attention module into two cascaded one-dimensional separable convolution kernels. The improved large core attention module replaces the structure and function of the original large core attention module in the network; the output of the improved large core attention module The calculation method is as follows:
[0022]
[0023] A C = 1×1 * C
[0024] in, represents the output of the improved large core attention module, A C represents the attention map, ⊙ represents the Hadamard product, F C represents the input feature map, C represents the number of input channels, M 1×1 represents a 1×1 convolution kernel, * represents convolution, Z C Represents two cascaded one-dimensional separable convolution kernels and The output of the depthwise convolution of
[0025]
[0026] H represents the height of the feature map, W represents the width of the feature map, It represents the rounding down of the input parameter, represents the maximum receptive field of the convolution kernel, and d represents the expansion rate; Represents the output of the depthwise convolution of two cascaded one-dimensional separable convolution kernels and the input feature map; where,
[0027]
[0028] The number of channels of the (2 -1)×1 convolution kernel is C.
[0029] Furthermore, the spatial explicit vision module in step 300 includes two parallel modules: a lightweight MLP (Multilayer Perceptron) architecture and a learnable visual center (LVC).
[0030] Furthermore, the specific process of processing the deepest semantic feature map through the spatial explicit visual module in step 300 is as follows: the new deepest semantic feature map X output by the spatial explicit visual module is obtained by the following formula:
[0031] X=Cat(MLP(X in );VC(X in ))
[0032] X represents the new deepest semantic feature map, Cat(·) represents the connection operation of the feature map along the channel dimension, and MLP(X in )The output of the lightweight MLP architecture, LVC(X in ) represents the output of the learnable visual center mechanism; “;” represents MLP(X in ) and LVC(X in ) are input in parallel; X in represents the output feature of the Stem block. The Stem block is composed of a 7*7 convolution and batch normalization layer and a ReLU activation function. The input of the Stem block is the deepest semantic feature map. Then X in Defined as:
[0033] X in =(BN(Conv 7×7 ()))
[0034] Where σ(·) represents the ReLU activation function, BN(·) represents the batch normalization layer, and Conv 7×7 (·) represents a 7×7 convolution with a stride of 1, the channel size is set to 256, and T represents the deepest semantic feature map.
[0035] The lightweight MLP architecture includes a depth-based convolution module and a channel-based MLP module. The input information is first processed by the depth-based convolution module and then by the channel-based MLP module, and then channel scaling and DropPath operations are performed to improve feature generalization and robustness.
[0036] Among them, the output of the module based on deep convolution The calculation method is:
[0037]
[0038] DConv(·) represents depthwise separable convolution with a kernel size of 1×1, GN(·) represents group normalization, and X in Represents the features of the Stem block output;
[0039] The input is fed into the channel MLP-based module, which first undergoes a set of normalizations and then implements the channel MLP on these features; after that, channel scaling, DropPath, and The output MLP (X) of the lightweight MLP architecture is obtained after the residual connection in ):
[0040]
[0041] Among them, CMLP(·) is the channel MLP operation, and GN(·) represents group normalization.
[0042] Furthermore, X in Input to the learnable visual center, and get the output LVC(X in ) is as follows:
[0043] The feature X output by the Stem block in The shape of is C×H×W, which can learn the visual center to convert feature X in Mapped into a set of C-dimensional features in represents the first eigenvector, represents the second eigenvector, represents the i-th eigenvector, Represents the Nth feature vector, the total number of input features N = H × W;
[0044] feature Enter the inherent codebook;
[0045] The inherent codebook includes K codewords and a set of smoothing factors S, specifically:
[0046] K code words: code word B = {b1,2,…, k ,…, K}, where b1 represents the first codeword in the inherent codebook, b2 represents the second codeword in the inherent codebook, and b k represents the kth codeword in the inherent codebook, b K represents the Kth codeword in the inherent codebook.
[0047] A set of smoothing factors S = {S1,2,…,s k ,…, K}, where S1 represents the smoothing factor of the first codeword, S2 represents the smoothing factor of the second codeword, and s k represents the smoothing factor of the kth codeword, s k represents the smoothing factor of the Kth codeword.
[0048] The entire image information e of the kth codeword k The calculation is as follows:
[0049]
[0050] Among them, i represents the feature vector number, and its value range is 1 to N; represents the i-th eigenvector, b k represents the kth codeword in the intrinsic codebook, Represents a C-dimensional feature vector With the kth codeword vector b k The difference between is the learnable weight; the learnable weight is Multiply to get the position information of the pixel relative to the codeword, add these N results to get e k .
[0051] In the learnable weights, j is the serial number of the codeword and smoothing factor, ranging from 1 to K; s k represents the smoothing factor of the kth codeword, s j represents the smoothing factor of the jth codeword, b j represents the jth codeword in the intrinsic codebook; ‖·‖ represents the L2 parameter operation. The L2 regularization parameter is a technique used for regularization. Through L2 regularization, we can control the complexity of the model and prevent the occurrence of overfitting problems. The L2 regularization parameter is also called ridge regression, which is based on a simple idea: adding a regularization term as part of the objective function to penalize the complexity of the model.
[0052] represents the output value of the kth codeword, Represents the output value of the jth codeword.
[0053] Finally, use the φ operation to fuse e k , and then sum up all the K fused results to get the C-dimensional feature vector e of the entire image information about the K codewords:
[0054]
[0055] where φ represents a batch normalization layer, a ReLU activation function, and a mean layer.
[0056] Furthermore, in order to predict the features of the prominent key classes of ships, first, a fully connected layer is used to map the feature e to a size of C×1×1 as an influencing factor. Second, the input feature and the influencing factor coefficient are multiplied by channels, as follows:
[0057]
[0058] Where Z represents the local area feature, represents channel-wise multiplication, δ(·) represents the Sigmoid function, and FC represents the fully connected layer.
[0059] Finally, the feature X output by the Stem block in And the local area feature Z is added channel by channel:
[0060] LVC(X in )= in ⊕Z
[0061] Among them, LVC(X in ) represents the output features of the learnable visual center, and ⊕ represents channel-wise addition.
[0062] Furthermore, step 400 uses the new deepest semantic feature map obtained in step 300 to simultaneously adjust all front-end shallow features. For each corresponding shallow feature, the feature obtained from the deep layer is upsampled to the same spatial scale as the low-level feature and then concatenated along the channel dimension; based on this, the concatenated features are downsampled through 1×1 convolution to reduce the channel size to 256.
[0063] Another aspect of the present invention provides a ship detection system combining spatial explicit vision and improved large core attention, and applies a ship detection method combining spatial explicit vision and improved large core attention of the first aspect of the present invention.
[0064] 3. Beneficial effects
[0065] Compared with the prior art, the advantages of the present invention are:
[0066] The present invention can effectively improve the detection rate and accuracy of the model for ship targets, especially small targets, and maintain a high model reasoning speed. The main contributions are:
[0067] The spatial explicit vision is introduced to improve the feature fusion part of YOLOv8, enhance its effect on ship feature fusion, and perform global feature adjustment within the centralized layer, so as to achieve a more comprehensive and differentiated feature representation, which is helpful for the model to detect and classify small target ships.
[0068] The improved large-core attention is used to improve the YOLOv8 backbone network, so that it has the characteristics of both convolution and self-attention, improves the local structural information, long-range dependence and adaptability of ship remote sensing images, improves the efficiency of the model in extracting ship features, and realizes the adaptability of spatial dimension and channel dimension, thereby improving the detection rate of small target ships.
[0069] The comprehensive use of spatial explicit vision and large kernel attention improves the efficiency of feature extraction, allowing the model to extract more useful information. The new feature fusion strategy coordinates multi-level features, making the model more adaptable in different scenarios and scales, improving the robustness of the model in complex environments, and improving the detection rate and accuracy of small target ships. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 Flowchart of the ship detection algorithm combining spatially explicit vision and improved large-core attention;
[0071] Figure 2 The YOLOv8 backbone network structure diagram for integrating the improved large core attention module;
[0072] Figure 3 This is a schematic diagram of the spatial explicit vision module structure;
[0073] Figure 4 Schematic diagram of the improved large core attention module structure;
[0074] Figure 5 The flowchart of the information processing of ship detection combining spatial explicit vision and improved large core attention is shown in the figure. DETAILED DESCRIPTION
[0075] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. The relevant concepts involved in the present invention are described as follows:
[0076] Ship remote sensing image: The ship remote sensing image referred to in this article is an optical image taken by a satellite or a high-altitude drone (aircraft). The "image" processed in the present invention is uniformly referred to as a "ship remote sensing image", that is, a remote sensing image of a ship as the shooting target.
[0077] Small targets: The small targets referred to in this article are defined based on the relative scale of the target and the image size in the ship remote sensing image. If the ratio of the target's bounding box area to the image area is less than a certain value, such as 0.08% to 0.58%, or the ratio of the target's bounding box width and height to the image width and height is less than 0.1, such targets can be considered small targets.
[0078] HRSC2016 dataset: contains 27 types of remote sensing objects extracted from Google Earth and released by Northwestern Polytechnical University in 2016. It uses oriented bounding boxes (OBB) annotation format. HRSC2016 (Liu et al., 2016) is the data collected by Northwestern Polytechnical University for ship detection. It contains 4 major categories and 19 minor categories with a total of 2976 ship instance information. The paper specifically points out that their dataset is a high-resolution dataset with a resolution between 0.4m and 2m. All images in the dataset are from six famous ports, including ships sailing at sea and ships close to the coast. The size of the ship images ranges from 300 to 1500, and most images are larger than 1000x600.
[0079] CBL module: It consists of convolution + BN + LeakyReLU activation function. Multiple CBL modules are stacked to form a convolution layer.
[0080] Spatially Explicit Vision: A module consisting of a lightweight MLP and a learnable visual center mechanism.
[0081] Example 1
[0082] In order to solve the problems of YOLOv8 in the existing technology in ship detection of ship remote sensing images, such as long detection time, inaccurate target detection and target missed detection, Figure 1 As shown, on one hand, the present invention provides a ship detection method combining spatial explicit vision and improved large kernel attention.
[0083] Step 100, constructing a ship remote sensing image data set and preprocessing the ship remote sensing image data;
[0084] Step 200, input the preprocessed ship remote sensing image into the YOLOv8 backbone network integrated with the improved large core attention module to extract ship features, and output a multi-layer semantic feature map;
[0085] Step 300, the deepest semantic feature map in the multi-layer semantic feature map is processed by a spatial explicit visual module to extract the global long-range dependency relationship, and the local information of the input ship remote sensing image is retained to obtain a new deepest semantic feature map, and the other shallow semantic feature maps are adjusted with the new deepest semantic feature map to obtain a processed multi-layer semantic feature map. In the process of retaining local information, the damage to the original local features is minimized as much as possible, and the global long-range dependency relationship is extracted to achieve the maximum retention of local information within the achievable range.
[0086] Step 400, the processed multi-layer semantic feature graph is subjected to feature fusion through a path aggregation network-feature pyramid network to obtain a fused multi-layer semantic feature graph.
[0087] Step 500, input the fused multi-layer semantic feature map into the decoupling head of YOLOv8 to detect and predict the ship classification and ship position.
[0088] Step 600, training the model by calculating the classification loss and the regression loss, and finally obtaining a ship detection model.
[0089] Step 700, use the ship detection model to detect the remote sensing image of the ship to be tested to obtain the position and category of the ship in the remote sensing image of the ship. The images to be tested (test set) are those that the model has not seen during the training process. The main difference between the training set and the test set is their different roles and uses in model training and evaluation. The training set is used to train the model so that the model can learn the patterns in the data; the test set is used to evaluate the performance of the model to ensure that the model can generalize to new data.
[0090] Preferably, the ship dataset constructed in step 100 is mainly derived from the public dataset HRSC2016. The specific method of data preprocessing is as follows: (1) label processing, processing the labels of the ship dataset, converting the location information of the target into the coordinates of the bounding box, and performing corresponding encoding operations so that the dataset format meets the requirements of the YOLO model. (2) data enhancement, performing random hue transformation, random horizontal and random vertical flipping, rotation and scaling on the ship dataset to increase the number of datasets; adding Gaussian blur noise interference to the ship dataset to reduce the model's sensitivity to the image.
[0091] Those skilled in the art may adopt other conventional means to achieve the same purpose of data expansion in the data preprocessing stage.
[0092] Preferably, the YOLOv8 backbone network structure integrating the improved large core attention module in step 200 is as follows: Figure 2 As shown in the figure, the backbone network of the original YOLOv8 is based on the Darknet-53 structure, which consists of 5 convolution modules, 4 C2f modules and a fast spatial pyramid pooling (Spatial Pyramid Pooling Fast, SPPF) module; the present invention improves C2f by introducing improved large-core attention to obtain an improved cross-stage local network C2f_LSK; it has the characteristics of convolution and self-attention at the same time, improves the local structural information, long-range dependence and adaptability of ship remote sensing images, improves the efficiency of the model in extracting ship features, realizes the adaptability of spatial dimension and channel dimension, and improves the detection rate of small target ships.
[0093] like Figure 4 As shown in FIG. 1 , the improved large core attention module is obtained by splitting the two-dimensional convolution kernel of the depth convolution and depth expansion convolution of the original large core attention module into two cascaded one-dimensional separable convolution kernels. The improved large core attention module replaces the structure and function of the original large core attention module in the network; the output of the improved large core attention module is The calculation method is as follows:
[0094]
[0095] A C =M 1×1 *Z C
[0096] in, represents the output of the improved large-core attention module, ⊙ represents the Hadamard product, A C represents the attention map, F C represents the input feature map, C represents the number of input channels, M 1×1 represents a 1×1 convolution kernel, * represents convolution, Z C Represents two cascaded one-dimensional separable convolution kernels and The output of the depthwise convolution of
[0097]
[0098] H represents the height of the feature map, W represents the width of the feature map, It represents the rounding down of the input parameter ·, μ represents the maximum receptive field of the convolution kernel, and d represents the expansion rate; Represents the output of the depthwise convolution of two cascaded one-dimensional separable convolution kernels and the input feature map; where,
[0099]
[0100] The number of channels of the (2 -1)×1 convolution kernel is C.
[0101] After processing the ship remote sensing images with the improved YOLOv8 backbone network, a multi-layer semantic feature map of the ship can be obtained. The shallow features mainly contain spatial information, while the deep features contain rich semantic information.
[0102] Preferably, in step 300, the deepest semantic feature map in the multi-layer semantic feature map of the ship obtained in step 200 is input into the spatial explicit vision for processing to obtain a semantic feature map having global long-range dependencies and local information of the ship remote sensing image.
[0103] like Figure 3As shown in Figure 3, the spatially explicit vision module mainly consists of two parallel modules: a lightweight MLP architecture and a learnable visual center mechanism (LVC).
[0104] The specific process of step 300 processing the deepest semantic feature map through the spatial explicit vision module is as follows: the new deepest semantic feature map X output by the spatial explicit vision module is obtained by the following formula:
[0105] X=Cat(MLP(X in );VC(X in ))
[0106] X represents the new deepest semantic feature map, Cat(·) represents the connection operation of the feature map along the channel dimension, and MLP(X in ) Output features of the lightweight MLP architecture, LVC(X in ) represents the output features of the learnable visual center mechanism; “;” represents MLP(X in ) and LVC(X in ) are input in parallel; X in represents the output feature of the Stem block. The Stem block is composed of a 7*7 convolution and batch normalization layer and a ReLU activation function. The input of the Stem block is the deepest semantic feature map. Then X in Defined as:
[0107] X in =(BN(Conv 7×7 ()))
[0108] Where σ(·) represents the ReLU activation function, BN(·) represents the batch normalization layer, and Conv 7×7 (·) represents a 7×7 convolution with a stride of 1, the channel size is set to 256, and T represents the deepest semantic feature map.
[0109] The lightweight MLP architecture includes a depth-based convolution module and a channel-based MLP module. The input information is first processed by the depth-based convolution module and then by the channel-based MLP module, and then channel scaling and DropPath operations are performed to improve feature generalization and robustness.
[0110] Among them, the output of the module based on deep convolution The calculation method is:
[0111]
[0112] DConv(·) represents depthwise separable convolution with a kernel size of 1×1, GN(·) represents group normalization, and X in Represents the features of the Stem block output;
[0113] The input is fed into the channel MLP-based module, which first undergoes a set of normalizations and then implements the channel MLP on these features; after that, channel scaling, DropPath, and The output MLP (X) of the lightweight MLP architecture is obtained after the residual connection in ):
[0114]
[0115] Among them, CMLP(·) is the channel MLP operation, and GN(·) represents group normalization.
[0116] Furthermore, X in Input to the learnable visual center, and get the output LVC(X in ) is as follows:
[0117] The feature X output by the Stem block in The shape of is C×H×W, which can learn the visual center to convert feature X in Mapped into a set of C-dimensional features in represents the first eigenvector, represents the second eigenvector, represents the i-th eigenvector, Represents the Nth feature vector, the total number of input features N = H × W;
[0118] feature Enter the inherent codebook;
[0119] The inherent codebook includes K codewords and a set of smoothing factors S, specifically:
[0120] K code words: code word B = {b1, b2, ..., b k ,…,b K}, where b1 represents the first codeword in the inherent codebook, b2 represents the second codeword in the inherent codebook, and b k represents the kth codeword in the inherent codebook, b K represents the Kth codeword in the inherent codebook. If the input feature data X inWith high complexity and diversity, a larger K value is needed to capture more patterns and features. In general, the minimum value of K can be set to 8 and the maximum value can be set to 256. Preset a candidate set of K values, and then use grid search to find the best K value. For example, K = {8, 16, 32, 64, 128, 256}, and then evaluate the model performance corresponding to each K value. K = 64 is preferred to balance the relationship between computing resources and performance
[0121] A set of smoothing factors S = {s1, s2, ..., s k ,…,s K}, where s1 represents the smoothing factor of the first codeword, s2 represents the smoothing factor of the second codeword, and s k represents the smoothing factor of the kth codeword, s K represents the smoothing factor of the Kth codeword;
[0122] The entire image information e of the kth codeword k The calculation is as follows:
[0123]
[0124] Among them, i represents the feature vector number, and its value range is 1 to N; represents the i-th eigenvector, b k represents the kth codeword in the intrinsic codebook, Represents a C-dimensional feature vector With the kth codeword vector b k The difference between is the learnable weight; the learnable weight is Multiply to get the position information of the pixel relative to the codeword, add these N results to get e k .
[0125] In the learnable weights, j is the serial number of the codeword and smoothing factor, ranging from 1 to K; s k represents the smoothing factor of the kth codeword, s j represents the smoothing factor of the jth codeword, b j represents the jth codeword in the intrinsic codebook; ‖·‖ represents the L2 parameter operation. The L2 regularization parameter is a technique used for regularization. Through L2 regularization, we can control the complexity of the model and prevent the occurrence of overfitting problems. The L2 regularization parameter is also called ridge regression, which is based on a simple idea: adding a regularization term as part of the objective function to penalize the complexity of the model.
[0126] represents the output value of the kth codeword, represents the output value of the jth codeword;
[0127] Finally, use the φ operation to fuse e k , and then sum up all the K fused results to get the C-dimensional feature vector e of the entire image information about the K codewords:
[0128]
[0129] where φ represents a batch normalization layer, a ReLU activation function, and a mean layer.
[0130] Furthermore, in order to predict the features of the prominent key classes of ships, first, a fully connected layer is used to map the feature e to a size of C×1×1 as an influencing factor. Second, the input feature and the influencing factor coefficient are multiplied by channels, as follows:
[0131]
[0132] Where Z represents the local area feature, represents channel multiplication, δ(·) represents the Sigmoid function, and FC represents the fully connected layer; finally, the feature X output by the Stem block is in And the local area feature Z is added channel by channel:
[0133] LVC(X in )= in ⊕Z
[0134] Among them, LVC(X in ) represents the output features of the learnable visual center, and ⊕ represents channel-wise addition.
[0135] Preferably, step 400 uses the new ship semantic feature map obtained in step 300 to simultaneously adjust all front-end shallow features. For each corresponding low-level feature, the feature obtained from the deep layer is upsampled to the same spatial scale as the low-level feature, and then concatenated along the channel dimension; based on this, the concatenated features are downsampled by 1×1 convolution to reduce the channel size to 256, thereby obtaining a fused multi-layer semantic feature map.
[0136] In this way, the spatial weight of the global representation can be explicitly increased in the top-down path of the feature pyramid, so that the feature pyramid can effectively achieve a comprehensive and discriminative feature representation. The feature fusion operation is performed through the path aggregation network-feature pyramid network to effectively extract and fuse multi-scale features, thereby improving the performance and robustness of ship detection. This enables the model to better adapt to ships of different scales and sizes and achieve more accurate detection results in complex scenarios.
[0137] Preferably, step 500 inputs the multi-layer semantic feature map of the ship obtained in step 400 into the decoupling head for prediction, the detection head contains 4 3×3 convolutions and 2 1×1 convolutions, and at the same time adds a dynamic non-monotonic focusing mechanism (Wise Intersection over Union, WIoU) loss function in the regression branch of the detection head, the regression head calculates the position offset between the predicted box and the real box, and then sends the offset to the regression head for loss calculation, and outputs a four-dimensional vector, which respectively represents the upper left corner coordinates x, y and the lower right corner coordinates x, y of the target box. The classification head performs region of interest pooling and convolution operations on each candidate box extracted without a priori anchor box (Anchor Free) to obtain a classifier output tensor, and the value at each position of this tensor represents the probability that the candidate box belongs to a ship or a non-ship. The ship probability value at each position in the classifier output tensor and the position offset output by the regression head are used to calculate the score of each detection box, and the redundant boxes are removed by maximum suppression to obtain the final ship position and category detection results.
[0138] Preferably, the classification loss defined in step 600 is used to measure the accuracy of the predicted category, and the regression loss is used to measure the position offset of the predicted bounding box. The classification loss is calculated using the binary cross entropy loss function, and the regression loss is calculated using the distribution focus loss function and the complete intersection-over-union loss function. After the loss value is obtained, the gradient of the loss function is calculated by the back propagation algorithm, and the gradient is propagated to each parameter of the model to update the model parameters, thus completing a round of training. Generally, a ship detection model is obtained after 100-300 rounds of training.
[0139] like Figure 5 As shown, step 700 uses the ship detection model to detect the remote sensing image of the ship to be detected to obtain the position and category of the ship in the remote sensing image.
[0140] Example 2
[0141] The second aspect of the present invention further provides a ship detection system combining spatial explicit vision and improved large core attention, applying the ship detection method combining spatial explicit vision and improved large core attention of the first aspect of the present invention.
[0142] The present invention proposes a ship detection method that combines spatial explicit vision and an improved large-core attention module, which improves the application of the existing YOLOv8 algorithm in the field of ship detection. First, an improved large-core attention module is added to the feature extraction part of the ship remote sensing image to improve the model's extraction of local structural information, increase its long-range dependence and adaptability, so that it can effectively deal with various adverse interference factors and quickly and accurately extract the effective features of the ship. In addition, the improved large-core attention also realizes the adaptability of the spatial dimension and the adaptability of the channel dimension, which greatly improves the detection rate of small target ships. At the same time, the improved large-core attention also has the advantages of lower computation and memory usage, maintaining the lightweight characteristics of YOLOv8.
[0143] Secondly, the multi-scale feature fusion scheme in YOLOv8 is improved by using spatial explicit vision to enhance the effect of feature fusion on ship features, and global centralized intra-layer feature adjustment is performed to solve the problem of over-focusing on the interaction of inter-layer features, and enable it to perform all-round and discriminative intra-layer feature adjustment, thereby achieving a more comprehensive and differentiated feature representation, which helps the model detect and classify small target ships. These steps involve processing and fusing multiple layers of semantic feature maps to make the feature representation more comprehensive and differentiated, thereby improving the model's ability to detect and classify small target ships. The global centralized intra-layer feature adjustment is mainly achieved through the following specific steps: 1) Extracting global long-range dependencies: ensuring that the model understands the relationship between distant regions in the image, which helps to distinguish small target ships in complex backgrounds. 2) Preserving local information: while extracting global features, local details can be retained to ensure that the detail information of small targets is not lost. 3) Intra-layer feature adjustment: adjusting the shallow feature map through the new deepest feature map makes the information between feature maps more coordinated, thereby achieving a more comprehensive and differentiated feature representation. 4) Feature fusion: Feature fusion is performed through the path aggregation network-feature pyramid network to further enhance the expression ability of multi-level features.
[0144] In summary, by comprehensively applying spatial explicit vision and large kernel attention, the efficiency of feature extraction is improved, allowing the model to extract more useful information. The new feature fusion strategy coordinates multi-level features, making the model more adaptable in different scenarios and scales, improving the robustness of the model in complex environments, and improving the detection rate and accuracy of small target ships.
[0145] The above schematically describes the invention and its implementation methods, which is not restrictive. Without departing from the spirit or basic features of the invention, the invention can be implemented in other specific forms. What is shown in the accompanying drawings is only one of the implementation methods of the invention. The actual structure is not limited thereto, and any figure mark in the claims should not limit the claims involved. Therefore, if a person of ordinary skill in the art is inspired by it, without departing from the purpose of the invention, a structural method and an embodiment similar to the technical solution are designed without creativity, which should all belong to the protection scope of the present invention. In addition, the word "including" does not exclude other elements or steps, and the word "one" before the element does not exclude the inclusion of "multiple" elements. The multiple elements stated in the product claim can also be implemented by one element through software or hardware. The words first, second, etc. are used to indicate the name, and do not indicate any specific order.
Claims
1. A ship detection method combining spatial explicit vision and improved large kernel attention, characterized in that, The steps include: Step 100, constructing a ship remote sensing image data set and preprocessing the ship remote sensing image data; Step 200, input the preprocessed ship remote sensing image into the YOLOv8 backbone network integrated with the improved large core attention module to extract ship features, and output a multi-layer semantic feature map; Step 300, the deepest semantic feature map in the multi-layer semantic feature map is processed by a spatial explicit vision module, and the specific process is: extracting the global long-range dependency relationship, retaining the local information of the input ship remote sensing image, obtaining a new deepest semantic feature map, and adjusting the remaining shallow semantic feature maps with the new deepest semantic feature map to obtain a processed multi-layer semantic feature map; Step 400, the processed multi-layer semantic feature graph is subjected to feature fusion through a path aggregation network-feature pyramid network to obtain a fused multi-layer semantic feature graph; Step 500, input the fused multi-layer semantic feature map into the decoupling head of YOLOv8 to detect and predict the ship classification and ship position; Step 600, calculating the classification loss and regression loss according to the ship classification and ship position data obtained in step 500 to train the model, and finally obtaining a ship detection model; Step 700: Use the ship detection model to detect the remote sensing image of the ship to be detected to obtain the position and category of the ship in the remote sensing image.
2. A ship detection method combining spatial explicit vision and improved large kernel attention according to claim 1, characterized in that: In step 200, the ship remote sensing image is input into the YOLOv8 backbone network integrated with the improved large-core attention module to extract ship features, and a multi-layer semantic feature map is output. The specific process is as follows: the input ship remote sensing image is processed by standard convolution and the improved cross-stage local network module to obtain a layer of semantic feature map of the ship remote sensing image, and the semantic feature map obtained by this processing is input into the standard convolution and the improved cross-stage local network module again for processing to obtain a deeper semantic feature map, and this is repeated multiple times to obtain a multi-layer semantic feature map.
3. A ship detection method combining spatial explicit vision and improved large kernel attention according to claim 2, characterized in that: The spatially explicit vision module in step 300 includes two parallel modules: a lightweight MLP architecture and a learnable visual center.
4. A ship detection method combining spatial explicit vision and improved large kernel attention according to claim 3, characterized in that: The improved large core attention module is obtained by splitting the two-dimensional convolution kernel of the deep convolution and deep dilated convolution of the original large core attention module into two cascaded one-dimensional separable convolution kernels. The improved large core attention module replaces the structure and function of the original large core attention module in the network; the output of the improved large core attention module The calculation method is as follows: in, represents the output of the improved large core attention module, A C represents the attention map, ⊙ represents the Hadamard product, F C represents the input feature map, C represents the number of input channels, M 1×1 represents a 1×1 convolution kernel, * represents convolution, Z C Represents two cascaded one-dimensional separable convolution kernels and The output of the depthwise convolution of H represents the height of the feature map, W represents the width of the feature map, It represents the rounding down of the input parameter, represents the maximum receptive field of the convolution kernel, and d represents the expansion rate; Represents the output of the depthwise convolution of two cascaded one-dimensional separable convolution kernels and the input feature map; where, Indicates that the number of channels of the (2-1)×1 convolution kernel is C.
5. A ship detection method combining spatial explicit vision and improved large kernel attention according to claim 4, characterized in that: In step 300, the new deepest semantic feature map X output by the spatial explicit vision module is obtained by the following formula: X=Cat(MLP(X in );VC(X in )) X represents the new deepest semantic feature map, Cat(·) represents the connection operation of the feature map along the channel dimension, and MLP(X in ) represents the output of the lightweight MLP architecture, LVC(X in ) represents the output of the learnable visual center mechanism; ";" represents MLP(X in ) and LVC(X in ) are input in parallel; X in represents the output feature of the Stem block. The Stem block is composed of a 7*7 convolution and batch normalization layer and a ReLU activation function. The input of the Stem block is the deepest semantic feature map. Then X in Defined as: X in =(BN(Conv 7×7 ())) Where σ(·) represents the ReLU activation function, BN(·) represents the batch normalization layer, and Conv 7×7 (·) represents a 7×7 convolution with a stride of 1, the channel size is set to 256, and T represents the deepest semantic feature map.
6. A ship detection method combining spatial explicit vision and improved large kernel attention according to claim 5, characterized in that: The lightweight MLP architecture includes a module based on deep convolution and a module based on channel MLP. The input information is first processed by the module based on deep convolution and then by the module based on channel MLP, and then channel scaling and DropPath operations are performed. The output of the module based on deep convolution is The calculation method is: DConv(·) represents depthwise separable convolution with a kernel size of 1×1, GN(·) represents group normalization, and X im Represents the features of the Stem block output; The input is fed into the channel MLP-based module, which first undergoes a set of normalizations and then implements the channel MLP on these features; after that, channel scaling, DropPath, and The output MLP (X) of the lightweight MLP architecture is obtained after the residual connection in ): Among them, CMLP(·) is the channel MLP operation, and GN(·) represents group normalization.
7. A ship detection method combining spatial explicit vision and improved large kernel attention according to claim 6, characterized in that: The following steps are also included: in Input to the learnable visual center and get the output C-dimensional feature vector e; the specific process is: The feature X output by the Stem block in The shape of is C×H×W, which can learn the visual center to convert feature X in Mapped into a set of C-dimensional features in represents the first eigenvector, represents the second eigenvector, represents the i-th eigenvector, Represents the Nth feature vector, the total number of input features N = H × W; feature Enter the inherent codebook; The inherent codebook includes K codewords and a set of smoothing factors S, specifically: K code words: code word B = {b1,2,…, k ,…, K }, where b1 represents the first codeword in the inherent codebook, b2 represents the second codeword in the inherent codebook, and b k represents the kth codeword in the inherent codebook, b K represents the Kth codeword in the inherent codebook; A set of smoothing factors S = {s1,2,…,s k ,…, K }, where s1 represents the smoothing factor of the first codeword, S2 represents the smoothing factor of the second codeword, and s k represents the smoothing factor of the kth codeword, s K represents the smoothing factor of the Kth codeword; The entire image information e of the kth codeword k The calculation is as follows: Among them, i represents the sequence number of the feature vector, and its value range is 1 to N; represents the i-th eigenvector, b k represents the kth codeword in the intrinsic codebook, Represents a C-dimensional feature vector With the kth codeword vector b k The difference between is the learnable weight; the learnable weight is Multiply to get the position information of the pixel relative to the codeword, add these N results to get e k ; In the learnable weights, j is the serial number of the codeword and smoothing factor, ranging from 1 to K; s k represents the smoothing factor of the kth codeword, s j represents the smoothing factor of the jth codeword, b j represents the jth codeword in the intrinsic codebook; ‖·‖ represents the L2 parameter operation, represents the output value of the kth codeword, represents the output value of the jth codeword; Finally, use the φ operation to fuse e k , and then sum up all the K fused results to get the C-dimensional feature vector e of the entire image information about the K codewords: where φ represents a batch normalization layer, a ReLU activation function, and a mean layer.
8. A ship detection method combining spatial explicit vision and improved large kernel attention according to claim 7, characterized in that: Get the output of the learnable visual center LVC(X in ), further comprising the steps of: Use a fully connected layer to map the C-dimensional feature vector e to a size of C×1×1 as an influencing factor, so that the input feature and the influencing factor coefficient are multiplied by channels, as follows: Where Z represents the local area feature, represents channel multiplication, δ(·) represents the Sigmoid function, and FC represents the fully connected layer; finally, the feature X output by the Stem block is in And the local area feature Z is added channel by channel: LVC(X in )= in ⊕Z Among them, LVC(X in ) represents the output features of the learnable visual center, and ⊕ represents channel-wise addition.
9. A ship detection method combining spatial explicit vision and improved large kernel attention according to claim 7, characterized in that: Step 400 uses the new deepest semantic feature map obtained in step 300 to simultaneously adjust all front-end shallow features. For each corresponding shallow feature, the feature obtained from the deep layer is upsampled to the same spatial scale as the low-level feature and then concatenated along the channel dimension; based on this, the concatenated features are downsampled through 1×1 convolution to reduce the channel size to 256.
10. A ship detection system combining spatial explicit vision and improved large core attention, applying a ship detection method combining spatial explicit vision and improved large core attention as described in any one of claims 1-9.
Citation Information
Patent Citations
SAR (Synthetic Aperture Radar) image ship target detection method and system and computer equipment
CN118135202A
Satellite image ship rapid detection method based on large kernel selective attention mechanism
CN118196652A
Cited By
Vision-language combined ocean ship positioning method based on Transform
CN119169096A
Semantic enhancement-based marine ship positioning method
CN119228897A
Image recognition method based on point cloud-oriented local semantics and cross-level dependence
CN120147655A
Road defect detection method and system based on unmanned aerial vehicle inspection image
CN120853006A
Remote sensing image ship target detection method and system based on graph semantic redirection module
CN122116128A
