Multi-scale ship detection method for complex sea surface scene
By introducing technologies such as convolutional block attention module and MPDIoU Loss in ship detection, a multi-scale ship detection network model is built, which solves the problem of low detection accuracy in complex sea surface scenarios, and realizes high-precision and high-speed ship detection. Adapt to multi-scale changes and optimize resource usage.
Patent Information
- Application Number
- CN202411287309.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-01-14
AI Technical Summary
In complex sea surface scenarios, existing ship detection methods have problems such as low detection accuracy and inability to adapt to multi-scale changes and equipment resource limitations. Especially under the influence of meteorological conditions and obstacles, it is difficult to achieve high-precision and high-speed detection.
Using multi-scale ship detection method, a multi-scale ship detection network model is constructed by introducing a convolutional block attention module, a new bounding box similarity comparison measurement MPDIoU Loss based on the minimum point distance, and a lightweight module VoV-GSCSP, to enhance feature extraction and multi-scale feature fusion capability, combined with data enhancement and supervised learning of meteorological condition, optimize the model to improve detection accuracy and speed.
It realizes high-precision and high-speed ship detection and classification in complex sea surface scenarios, improves detection accuracy and efficiency, reduces model complexity and computing resource requirements, and significantly improves the performance of multi-scale object detection.
Smart Images

Figure CN119313941A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of ship target recognition, and in particular to a multi-scale ship detection method for complex sea surface scenes. Background Art
[0002] With the advancement of globalization, the maritime shipping industry has flourished, and the number of cargo transport ships has continued to increase, resulting in a sharp increase in maritime traffic. Especially near ports, traffic pressure has increased significantly. In order to ensure the smooth passage of ships in the port, regulatory authorities must reasonably dispatch the berthing positions of ships in the port according to the operating performance, size and characteristics of the transported goods of different types of ships. This not only helps to reduce traffic congestion, but also reduces unnecessary economic losses. Therefore, it is crucial to ensure maritime traffic safety and improve management efficiency by identifying ships of different sizes and facilitating traffic dispatch.
[0003] In recent years, the application of image processing technology in the field of ship target detection has been increasing. According to the source of the image, the ship target detection methods based on image processing can be roughly divided into three categories: visible light visual images, radar images, and remote sensing images. Most of the current ship detection methods are based on radar images and remote sensing images, but they rely on expensive professional equipment, and the output results cannot directly express rich visual information. In comparison, the acquisition cost of ship visible light visual images is lower, and the image display is more intuitive. Therefore, ship detection based on visible light visual images is an effective and feasible method for ship detection, tracking, and classification.
[0004] Ship target detection is the basis of real-time monitoring of ships. Although some progress has been made in ship target detection using deep learning methods, this task still faces some challenges under natural conditions. First, in ship target detection, the scale, distance and viewing angle of the ship may change. The traditional single-scale detection method often cannot effectively adapt to various situations, resulting in a decrease in the accuracy of ship detection. Secondly, the complexity of the sea surface conditions is affected by a variety of interference factors, including meteorological conditions and occlusion of obstacles, which affect the accuracy of ship detection. Finally, in practical applications, the limited memory and computing power of the device must be taken into account when deploying the ship detection model. It is still a challenge to ensure both the accuracy of detection and the speed of detection. Summary of the invention
[0005] In view of this, the purpose of the present invention is to propose a multi-scale ship detection method for complex sea surface scenes, which can achieve high-precision and high-speed detection, identification and classification of ships in complex sea surface scenes by enhancing the feature extraction capability and the feature fusion capability of multi-scale targets, so as to solve the technical problem of inaccurate detection accuracy of the prior art in complex sea surface scenes.
[0006] The technical means adopted by the present invention are as follows:
[0007] A multi-scale ship detection method for complex sea surface scenes includes the following steps:
[0008] S1. Acquire sea surface ship images and process and screen the sea surface ship images to form a sea surface ship data set; perform meteorological condition data enhancement on the sea surface ship images in the sea surface ship data set, perform ship annotation on each sea surface ship image in the sea surface ship data set, and after annotation, use a random division method to divide the sea surface ship data set into a training set and a test set;
[0009] S2. Based on YOLOv8n, the convolutional block attention module, the new bounding box similarity comparison metric MPDIoULoss and the lightweight module VoV-GSCSP are introduced to build a multi-scale ship detection network model;
[0010] S3. Use the training set to train the multi-scale ship detection network model. The model extracts multi-scale features through a convolutional neural network and uses a supervised learning method to minimize the classification loss and positioning loss in target detection.
[0011] S4. Use the trained model to detect and identify ships in complex sea scenes, and output ship target detection frames, ship types and their probabilities.
[0012] Furthermore, in S1, the meteorological condition-like data enhancement uses Gaussian blur to simulate real and complex sea surface conditions.
[0013] Furthermore, in S1, the ratio of the training set to the test set is 8:2.
[0014] Furthermore, in S1, the method for labeling each sea surface ship image in the sea surface ship dataset is specifically as follows:
[0015] The image annotation tool LableImg is used to annotate the following six labels on each sea surface ship image in the established sea surface ship dataset: fishing boat, passenger ship, general cargo ship, bulk carrier, ore carrier, and container ship, and the position information and label information of the annotated anchor frame are saved as a text file.
[0016] Furthermore, the Gaussian blur concept density function calculation formula is as follows:
[0017]
[0018] In the formula, x represents the grayscale value of the image pixel, μ represents the average value of the pixel value, σ represents the standard deviation of the pixel value, and the square of the standard deviation σ 2 is the variance.
[0019] Furthermore, in S2, the multi-scale ship detection network model uses YOLOv8n as the basic network model, introduces the convolutional block attention module and the new bounding box similarity comparison metric MPDIoU Loss based on the minimum point distance, and introduces the lightweight module VoV-GSCSP into the YOLOv8n neck network part to construct a slim-neck lightweight network structure;
[0020] The convolution block attention module is a CBAM attention mechanism and an EMA attention mechanism. The CBAM attention mechanism is introduced into the backbone network of YOLOv8n, and the EMA attention mechanism is introduced into the head network of YOLOv8n. The slim-neck lightweight module replaces the neck network of YOLOv8n.
[0021] Furthermore, the CBAM attention mechanism includes a channel attention mechanism and a spatial attention mechanism;
[0022] The calculation formula of the channel attention mechanism is as follows:
[0023] M c (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F)))
[0024] =σ(W1(W0(F c avg ))+W1(W0(F c max )))
[0025] Where M c is the output channel value, F is the input feature value, MLP is the multi-layer perceptron, AvgPool is the average pooling operation, MaxPool is the maximum pooling operation, W is the MLP output result, and σ is the Sigmoid function mapping;
[0026] The calculation formula of the spatial attention mechanism is as follows:
[0027]
[0028] Where M s is the output spatial attention value, F is the input channel attention value, AvgPool is the average pooling, MaxPool is the maximum pooling, f is the convolution operation, and σ is the Sigmoid function mapping.
[0029] Furthermore, the EMA attention mechanism encodes global information to adjust the channel weights in each parallel branch. The EMA attention mechanism deeply integrates the output features of the two parallel branches through cross-dimensional interaction to enhance the extraction efficiency of multi-dimensional perception and multi-scale features, and introduces them into the network structure to improve the multi-scale feature extraction capability of the model. In the attention mechanism module of YOLOv8n, the EMA attention mechanism is embedded in the network structure, and accurate detection of the target ship is achieved by adjusting the weight of the feature map.
[0030] Furthermore, the calculation formula of the new bounding box similarity comparison metric MPDIoU Loss based on the minimum point distance is as follows:
[0031] d1 2 =(x1 B -x1 A ) 2 +(y1 B -y1 A ) 2
[0032] d2 2 =(x2 B -x2 A ) 2 +(y2 B -y2 A ) 2
[0033]
[0034] Where A is the prediction box, B is the prediction box and the true value box, w is the width of the input image, h is the height of the input image, (x1 A ,y1 A ) represent the coordinate points of the upper left corner and lower right corner of the real box, (x1 B ,y1 B ) represent the coordinate points of the upper left corner and lower right corner of the prediction box respectively.
[0035] Furthermore, the slim-neck network is a lightweight neck network composed of GSConv and VoV-GSCSP. In the neck network of YOLOv8n, two GSConv modules are cascaded, and VoV-GSCSP is used to replace the C2f structure to form a slim-neck.
[0036] Compared with the prior art, the present invention has the following advantages:
[0037] The present invention introduces the CBAM attention mechanism and the EMA attention mechanism to enhance the feature extraction capability and multi-scale feature fusion capability of the overall network;
[0038] The present invention adopts MPDIoU Loss to replace CIoU Loss to solve the problems of missed detection, false detection and low accuracy of multi-scale targets in ship detection in actual complex sea scenes;
[0039] The present invention uses the slim-neck lightweight module to solve the problem that the introduction of the attention mechanism leads to increased model complexity and slower running speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0041] Figure 1 The figure is a flow chart of the algorithm of the present invention.
[0042] Figure 2 This is the network structure diagram of the algorithm of the present invention.
[0043] Figure 3 This is a diagram showing the enhanced effect of meteorological condition data according to the present invention.
[0044] Figure 4 This is the network structure diagram of the CBAM attention mechanism of the present invention.
[0045] Figure 5 This is the network structure diagram of the EMA attention mechanism of the present invention.
[0046] Figure 6 This is a diagram of the slim-neck network structure of the present invention.
[0047] Figure 7 This is a comparison chart of the mAP@50 results between the present invention and YOLOv8n.
[0048] Figure 8 This is a comparison chart of the PR curve results of the present invention and YOLOv8n.
[0049] Fig. 9 This is a diagram of the actual detection effect of the present invention.
[0050] Fig.10 This is a detection effect diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0052] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0053] like Figure 1 As shown, the present invention provides a multi-scale ship detection method for complex sea surface scenes, comprising the following steps:
[0054] S1. Process and screen the sea surface ship images to form a sea surface ship dataset. Use meteorological condition-like data enhancement to simulate complex sea surface conditions, annotate each image with ships, and then use random division to divide the dataset into a training set and a test set.
[0055] The background of actual ship detection is a complex sea scene, while the images in the experimental data set are relatively clear. In order to make the model and algorithm more in line with the actual application scenario, a method of enhancing quasi-weather conditions is proposed in the image preprocessing stage. Based on the meteorological conditions that may be encountered on the actual sea surface, such as rainy days, foggy days, and dark days, Gaussian blur, fogging operations, and low-contrast processing modules are introduced into the traditional image processing algorithm to simulate the actual ship detection scene, providing support for the expansion of the data set, and the improvement of the generalization and robustness of the model. Its specific effects are as follows: Figure 2 As shown, a is a rainy day, b is a foggy day, and c is a cloudy day.
[0056] Gaussian blur is a linear smoothing filter that can blur the information around the pixel. The blurred pixel value is obtained by the weighted average of the surrounding pixel values, where the weight is weighted by a Gaussian function. The visual effect is like observing the image through a frosted glass. This effect is different from the out-of-focus imaging of the lens and the shadow effect under normal lighting conditions, but is similar to the image effect on a rainy day. Therefore, the present invention introduces it into image data enhancement to analogize the rainy day environment.
[0057] The core idea of Gaussian blur is to use Gaussian kernel to perform convolution processing on the image, where the Gaussian kernel is composed of a two-dimensional Gaussian function. Gaussian function is a probability density function that can control the degree of blur. The size and standard deviation of the Gaussian kernel are two important parameters that control the degree of blur. Generally speaking, the larger the standard deviation, the greater the blur, but at the same time, it will also cause more image detail information to be lost. The conceptual density function calculation formula of Gaussian blur is as follows:
[0058]
[0059] In the formula, x represents the grayscale value of the image pixel, μ represents the average value of the pixel value, σ represents the standard deviation of the pixel value, and the square of the standard deviation (σ 2 ) is the variance.
[0060] S2. Build a multi-scale ship detection network model, in which YOLOv8n is used as the basic network model. To address the problem of inaccurate identification and classification of ships in complex sea scenes, a convolutional block attention module is introduced to achieve more effective identification and classification; to address the problem of inaccurate identification when identifying multiple overlapping ships, a new bounding box similarity comparison metric MPDIoU Loss based on minimum point distance is introduced to further improve the detection effect; to address the problem of complex network structure and slow operation speed, a lightweight module VoV-GSCSP is introduced and introduced into the YOLOv8n neck network part to construct a slim-neck lightweight network structure to achieve optimized performance. The convolutional block attention module is a CBAM attention mechanism and an EMA attention mechanism. The CBAM attention mechanism is introduced into the backbone network, and the EMA attention mechanism is introduced into the head network. The slim-neck lightweight module replaces the traditional neck network of YOLOv8n. The specific network structure diagram is as follows: Figure 3 shown.
[0061] The ship target identification objects near the port may contain a large number of non-ship target areas such as the sky, islands, reefs, lighthouses, etc., which makes it extremely difficult to correctly identify the ship target. The core function of the attention mechanism is to filter out the information that is crucial to the current task from a large amount of input information, while reducing the attention to secondary information, and even filtering out irrelevant content. This mechanism not only improves the efficiency and accuracy of task processing, but also effectively solves the problem of information overload. To this end, the present invention introduces an attention mechanism to enable the model to better focus on the target area that needs to be identified.
[0062] The present invention adds a CBAM attention mechanism module to the backbone network to solve the problem of identifying small targets in complex situations. The traditional YOLOv8n backbone network has ten layers, including convolutional layers, CSPLayer_Conv2 (C2f) modules, and Spatial Pyramid Pooling Fast (SPPF) modules. The present invention uses a lightweight attention mechanism Convolutional Block Attention Module (CBAM) to add to each C2f module to increase the ability to extract small target features and expand the original ten layers to thirteen layers;
[0063] The network architecture of the CBAM attention mechanism is as follows Figure 4 As shown in the figure, it contains two modules, one of which is the channel attention mechanism, and its calculation formula is as follows:
[0064] M c (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F)))
[0065] =σ(W1(W0(F c avg ))+W1(W0(F c max )))
[0066] Where M c is the output channel value, F is the input feature value, MLP is the multi-layer perceptron, AvgPool is the average pooling operation, MaxPool is the maximum pooling operation, W is the MLP output result, σ Mapping for the Sigmoid function.
[0067] The other is the spatial attention mechanism, which is calculated as follows:
[0068]
[0069] Where M sis the output spatial attention value, F is the input channel attention value, AvgPool is the average pooling, MaxPool is the maximum pooling, and f is the convolution operation. σ Mapping for the Sigmoid function.
[0070] Since the CBAM attention mechanism takes the maximum and average values of multiple channels at each position as weight coefficients, this weighting only considers local range information and ignores distant ship targets in the image, thereby reducing the performance of the model. Therefore, the present invention introduces a new efficient multi-scale attention (EMA) module to compensate for this local range information, which can more effectively focus on ships of different scales.
[0071] The EMA attention mechanism aims to retain information on each channel and reduce computational overhead. Some channels are rescaled to the batch dimension, and the channel dimension is divided into multiple sub-feature groups to ensure that spatial semantic features are evenly distributed in each group. In addition to encoding global information to adjust the channel weights in each parallel branch, the attention mechanism also deeply integrates the output features of the two parallel branches through cross-dimensional interactions to enhance the efficiency of multi-dimensional perception and multi-scale feature extraction. The network structure diagram is shown below: Figure 5 shown.
[0072] The present invention introduces the EMA attention mechanism module to improve the neck of YOLOv8n and inserts it in front of the Head part to enhance the feature expression of the location of the ship target in the feature map obtained after processing by the backbone network and the neck network, further improve the ability to distinguish ships from other irrelevant information in complex backgrounds, and effectively improve the detection performance of the overall model.
[0073] YOLOv8n uses CIoU Loss as the bounding box regression loss function, which cannot effectively handle the situation of multiple ship overlaps, and the model performs poorly when detecting overlapping ships. Therefore, the present invention introduces MPDIoU Loss into the model to enhance the robustness and accuracy of the model in overlapping target detection.
[0074] The calculation formula of MPDIoU Loss is as follows:
[0075] d1 2 =(x1 B -x1 A ) 2 +(y1 B -y1 A ) 2
[0076] d2 2 =(x2B -x2 A ) 2 +(y2 B -y2 A ) 2
[0077]
[0078] Where A and B are the predicted box and the true value box, respectively, w and h represent the width and height of the input image, (x1 A ,y1 A ) represent the coordinate points of the upper left corner and lower right corner of the real box, (x1 B ,y1 B ) represent the coordinate points of the upper left corner and lower right corner of the prediction box respectively.
[0079] Due to the introduction of two attention mechanisms and the improvement of the loss function, the number of model parameters and the amount of calculation increase, the overall network complexity increases, resulting in a decrease in the network operation speed. Therefore, the present invention adopts a slim-neck lightweight module to reduce the complexity of the overall network to speed up the network operation speed.
[0080] Slim-neck is a network structure that reduces the number of parameters by reducing the number of channels in the middle layer of the model. It is a product of further expansion and fusion based on GSConv and VoV-GSCSP. In the neck network of YOLOv8n, two GSConv modules are cascaded, and VoV-GSCSP is used to replace the C2f structure to form slim-neck. Its structure is shown in the figure below. Figure 6 .
[0081] S3, using the training set and validation set generated by S1 to train the multi-scale ship detection network model, to obtain a trained multi-scale ship detection network model. The multi-scale ship detection network model is trained using the training set, the model extracts multi-scale features through a convolutional neural network, and uses a supervised learning method to minimize the classification loss and positioning loss in target detection. The purpose of the training is to optimize the model so that it can accurately detect ships of various sizes at different scales and strike a balance between detection speed and accuracy.
[0082] S4. Use the trained model to detect and identify ships in complex sea scenes.
[0083] In order to verify the detection effect of this invented method on different types of ships, the average accuracy (mAP@50 and mAP@50-95), precision and recall were used to evaluate the detection effect of the model.
[0084] Among them, mAP@50 represents the average accuracy when the IoU threshold is 0.5, which means that as long as the overlap between the predicted bounding box and the true bounding box reaches or exceeds 50%, the detection is considered correct. And mAP@50-95 means that the IoU threshold changes from 0.5 to 0.95 with a step size of 0.05, calculates the mAP under each threshold, and then takes the average of these mAPs. mAP@50 is suitable for preliminary evaluation of model performance, while mAP@50-95 is a more comprehensive and accurate evaluation of model performance. The following is a detailed analysis and summary of the results of this paper on the detection effects of different types of ships as shown in Table 1:
[0085] Table 1 Detailed analysis and result summary of the detection effects of different types of ships
[0086]
[0087] The various evaluation indicators of the present invention are shown in Table 1. The experiment uses the method of the present invention to analyze the evaluation indicators such as precision, recall, mAP@50, and mAP@50-95 for the six types of ships in the Seaships data set. It can be calculated from the table that when the IoU threshold is 0.5, the average precision and average accuracy calculated for the six types of ships, the average precision of the improved model reaches 98.2%, when the IoU threshold is 0.5, the average precision and average accuracy calculated for the six types of ships, the average precision of the improved model reaches 98.2%, and when the IoU threshold varies from 0.5 to 0.95, the average precision reaches 77.1%. It shows that the model has a relatively good effect in the detection performance of different types of ships.
[0088] To further verify the effectiveness of the invented method, the PR curve and average precision (mAP@50 and mAP@50-95) are used for comparison, and the specific results are shown in the figure. The PR curve can be used to reflect the performance of the model, P represents precision, and R represents recall. When P=R, it is the balance point (BEP). The larger the area under the PR curve, the larger the value of the balance point, and the better the overall performance of the model.
[0089] The comparison of mAP@50 and mAP@50-95 between the present invention and the YOLOv8n model is shown in the figure below: Figure 7 As shown, the improved model has a more stable improvement in mAP@50 compared to the original model, and has increased from 97.1% to 98.2%. The improvement in mAP@50-95 is more obvious, from 74.2% to 77.1%, which can highlight that the algorithm model of the present invention is effective.
[0090] Figure 8 (a) and Figure 8 (b) compares the PR curves of the present invention and the YOLOv8n model, Figure 8(a) is the PR curve of the YOLOv8n model. Figure 8 (b) is the PR curve of the present invention. The area of the graph enclosed by the PR curve of the present invention and the x-axis and y-axis is larger, and its BEP is closer to the coordinate point (1,1). Based on the above comparison results, it can be concluded that the present invention has better overall system performance.
[0091] In order to solve the task of ship targets in reality, the model is verified using actual ship image data. The effect diagram is shown in the figure below. Fig. 9 As shown in the figure, YOLOv8n failed to identify the target ship in the three groups of examples, and the second group of examples misdetected the fishing boat, while the present invention has obvious improvements, and the three groups of examples all detected the target ship and classified it correctly. This shows that the algorithm can solve the task of ship target identification in actual situations to a certain extent.
[0092] In order to better verify the effectiveness of the present invention, YOLOv3, YOLOv5s, YOLOv7, Faster R-CNN and SSD algorithms are compared and the experimental results are shown in the following table:
[0093] Table 2 Comparative experimental results
[0094] Model Parameter quantity / M Calculation Amount / GFLPs Accuracy / % mAP@50 / % YOLOv3 61.5 65.6 95.1 97.5 YOLOv5s 7.0 16.0 96.4 96.8 YOLOv7 3.7 105.2 96.8 97.2 Faster R-CNN 137.1 370.4 97.0 97.3 SSD 26.3 62.8 96.8 97.1 The present invention 2.89 7.5 97.3 98.2
[0095] According to the comparative experiments in Table 2, it can be seen that the present invention has significantly reduced the number of parameters and the amount of calculation compared with these traditional algorithms. According to the detection accuracy and mAP@50 values in the table, it can also be seen that the detection method proposed in the present invention also has advantages in accuracy.
[0096] Compared with the traditional YOLOv8n method, the multi-scale ship detection method for complex sea scenes provided by the present invention has three main differences: the CBAM attention mechanism and the EMA attention mechanism are introduced to enhance the feature extraction capability and multi-scale feature fusion capability of the overall network; the slim-neck lightweight module is used to solve the problem that the introduction of the attention mechanism leads to increased model complexity and slower running speed; MPDIoU Loss is used to replace CIoULoss to solve the problems of multi-scale target missed detection, false detection and low precision in ship detection in actual complex sea scenes. The specific results are as follows Fig. 9 , as shown in 10, a is a rendering of seaships, b is a rendering of YOLOv8n, and c is a rendering of the present invention.
[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-scale ship detection method for complex sea scenes, characterized in that: The steps include: S1. Acquire sea surface ship images and process and screen the sea surface ship images to form a sea surface ship data set; perform meteorological condition data enhancement on the sea surface ship images in the sea surface ship data set, perform ship annotation on each sea surface ship image in the sea surface ship data set, and after annotation, use a random division method to divide the sea surface ship data set into a training set and a test set; S2. Based on YOLOv8n, the convolutional block attention module, the new bounding box similarity comparison metric MPDIoU Loss and the lightweight module VoV-GSCSP are introduced to build a multi-scale ship detection network model; S3. Use the training set to train the multi-scale ship detection network model. The model extracts multi-scale features through a convolutional neural network and uses a supervised learning method to minimize the classification loss and positioning loss in target detection. S4. Use the trained model to detect and identify ships in complex sea scenes, and output ship target detection frames, ship types and their probabilities.
2. The multi-scale ship detection method for complex sea scenes according to claim 1 is characterized in that: In S1, the meteorological condition data enhancement adopts Gaussian blur to simulate the real complex sea surface conditions.
3. The multi-scale ship detection method for complex sea scenes according to claim 1 is characterized in that: In S1, the ratio of the training set to the test set is 8:
2.
4. The multi-scale ship detection method for complex sea scenes according to claim 1 is characterized in that: In S1, the method for labeling each sea surface ship image in the sea surface ship dataset is as follows: The image annotation tool LableImg is used to annotate the following six labels on each sea surface ship image in the established sea surface ship dataset: fishing boat, passenger ship, general cargo ship, bulk carrier, ore carrier, and container ship, and the position information and label information of the annotated anchor frame are saved as a text file.
5. The multi-scale ship detection method for complex sea scenes according to claim 2 is characterized in that: The Gaussian blur concept density function calculation formula is as follows: In the formula, x represents the grayscale value of the image pixel, μ represents the average value of the pixel value, σ represents the standard deviation of the pixel value, and the square of the standard deviation σ 2 is the variance.
6. The multi-scale ship detection method for complex sea scenes according to claim 1 is characterized in that: In S2, the multi-scale ship detection network model uses YOLOv8n as the basic network model, introduces the convolutional block attention module and the new bounding box similarity comparison metric MPDIoU Loss based on the minimum point distance, and introduces the lightweight module VoV-GSCSP into the YOLOv8n neck network part to construct a slim-neck lightweight network structure; The convolution block attention module is a CBAM attention mechanism and an EMA attention mechanism. The CBAM attention mechanism is introduced into the backbone network of YOLOv8n, and the EMA attention mechanism is introduced into the head network of YOLOv8n. The slim-neck lightweight module replaces the neck network of YOLOv8n.
7. The multi-scale ship detection method for complex sea scenes according to claim 6 is characterized in that: The CBAM attention mechanism includes a channel attention mechanism and a spatial attention mechanism; The calculation formula of the channel attention mechanism is as follows: M c (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F))) =σ(W1(W0(F c avg ))+W1(W0(F c max ))) Where M c is the output channel value, F is the input feature value, MLP is the multi-layer perceptron, AvgPool is the average pooling operation, MaxPool is the maximum pooling operation, W is the MLP output result, and σ is the Sigmoid function mapping; The calculation formula of the spatial attention mechanism is as follows: Where M s is the output spatial attention value, F is the input channel attention value, AvgPool is the average pooling, MaxPool is the maximum pooling, f is the convolution operation, and σ is the Sigmoid function mapping.
8. The multi-scale ship detection method for complex sea scenes according to claim 6 is characterized in that: The EMA attention mechanism encodes global information to adjust the channel weights in each parallel branch. The EMA attention mechanism deeply integrates the output features of two parallel branches through cross-dimensional interaction to enhance the extraction efficiency of multi-dimensional perception and multi-scale features, and introduces them into the network structure to improve the multi-scale feature extraction capability of the model. In the attention mechanism module of YOLOv8n, the EMA attention mechanism is embedded in the network structure, and accurate detection of the target ship is achieved by adjusting the weight of the feature map.
9. The multi-scale ship detection method for complex sea scenes according to claim 6, characterized in that: The calculation formula of the new bounding box similarity comparison metric MPDIoU Loss based on the minimum point distance is as follows: d1 2 =(x1 B -x1 A ) 2 +(y1 B -y1 A ) 2 <h2 style=";text-align:left;direction:ltr">d2<h2 style=";text-align:left;direction:ltr"> 2 <h2 style=";text-align:left;direction:ltr"> (x2)<h2 style=";text-align:left;direction:ltr"> B <h2 style=";text-align:left;direction:ltr"> -x2<h2 style=";text-align:left;direction:ltr"> A <h2 style=";text-align:left;direction:ltr"> )<h2 style=";text-align:left;direction:ltr"> 2 <h2 style=";text-align:left;direction:ltr"> +(y2<h2 style=";text-align:left;direction:ltr"> B <h2 style=";text-align:left;direction:ltr"> -y2<h2 style=";text-align:left;direction:ltr"> A <h2 style=";text-align:left;direction:ltr"> )<h2 style=";text-align:left;direction:ltr"> 2 Where A is the prediction box, B is the prediction box and the true value box, w is the width of the input image, h is the height of the input image, (x1 A ,y1 A ) represent the coordinate points of the upper left corner and lower right corner of the real box, (x1 B ,y1 B ) represent the coordinate points of the upper left corner and lower right corner of the prediction box respectively.
10. The multi-scale ship detection method for complex sea scenes according to claim 6, characterized in that: The slim-neck network is a lightweight neck network composed of GSConv and VoV-GSCSP. In the neck network of YOLOv8n, two GSConv modules are cascaded, and VoV-GSCSP is used to replace the C2f structure to form a slim-neck.
Citation Information
Cited By
Intelligent sensing method for automatic driving of small ship
CN119693922A
Shielding ship positioning identification method and system for shore monitoring
CN120088491A
A Method and System for Occluded Ship Positioning and Recognition for Shore Monitoring
CN120088491B
SAR image ship target detection method based on improved YOLOv8
CN120673229A
Marine ship target identification method
CN121213901A