Ship target intelligent detection method, equipment and medium
By integrating the receptive field attention mechanism and global information in the YOLOv8 model, an RFASTD ship target detection model was constructed, which solved the problem of low detection accuracy in ship target detection and achieved efficient and accurate detection of ship targets.
Patent Information
- Application Number
- CN202411010882.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-11-22
AI Technical Summary
The existing target detection algorithms perform poorly in ship target detection and have low detection accuracy, especially because the ship's target range is small and the shape is easily confused with other objects, resulting in unsatisfactory detection results.
Based on the YOLOv8 model, the receptive field attention mechanism and global information are integrated to construct the RFASTD ship object detection model, and the global maximum pooling layer and the global average pooling layer are added to the backbone network, and the internal cross-border loss function is used to update the CIOU. Loss function, optimizes the model training process to improve detection accuracy.
By integrating the receptive field attention mechanism and global information, the global perspective information and robustness of the model are enhanced, the accuracy and regression effect of ship target detection are improved, and the existing technology cannot efficiently use ship targets in the image , the problem of accurate detection.
Smart Images

Figure CN119006778A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of target detection, and in particular to a method, device and medium for intelligent detection of ship targets. Background Art
[0002] The use of deep learning-based target detection technology can effectively monitor the sea area and complete tasks such as fishery management, ship search, and marine rescue, playing a significant role in both the civil and military fields. However, in practical applications, due to the small target range of ships and the fact that their shapes are easily confused with other objects, the direct application of classic target detection methods (such as RCNN, Faster RCNN, FPN, SSD, YOLO, etc.) to ship detection often results in poor performance and low detection accuracy.
[0003] The YOLOv8 target detection model is a target detection algorithm that was released in 2023. It is an efficient, accurate and flexible target detection algorithm that supports image classification, object detection and instance segmentation tasks, and can run on various hardware platforms. However, due to the characteristics of images and ship targets, its performance in ship target detection is not ideal and has limitations in practical applications. This invention effectively solves the problem of poor performance of target detection algorithms when detecting ship targets. Summary of the invention
[0004] The purpose of this application is to provide a method, device and medium for intelligent detection of ship targets, which can accurately detect ship targets in images.
[0005] To achieve the above objectives, this application provides the following solutions:
[0006] In a first aspect, the present application provides a method for intelligent detection of ship targets, comprising:
[0007] Based on the YOLOv8 model, the receptive field attention mechanism and global information are integrated to build the RFASTD (Receptive-Field Attention Ship Target Detection) ship target detection model;
[0008] Obtain annotated ship images, and construct a training data set based on the annotated ship images;
[0009] The training data set is used to train the RFASTD ship target detection model until the set conditions are met to obtain a trained ship target detection model;
[0010] An image of a ship to be detected is obtained, and the image to be detected is input into the ship target detection model to obtain a detection result; the ship target detection result includes a ship boundary box and a confidence level.
[0011] Optionally, based on the YOLOv8 model, the receptive field attention mechanism and global information are integrated to build the RFASTD ship target detection model, which specifically includes:
[0012] Obtain a YOLOv8 algorithm model; the YOLOv8 algorithm model includes an input end, a backbone network, a neck network and a head module;
[0013] The standard convolution in the backbone network is optimized to receptive field attention convolution, a global maximum pooling layer and a global average pooling layer are added to the spatial pyramid pooling structure in the backbone network, and the CIOU loss function is updated using the internal intersection-over-union loss function to obtain the RFASTD ship target detection model; the internal intersection-over-union ratio refers to the intersection-over-union ratio between the anchor box and the target box.
[0014] Optionally, the calculation formula of the internal intersection-over-intersection ratio is:
[0015]
[0016]
[0017] Where, IoU inner represents the internal intersection-union ratio, inter represents the intersection of the predicted area and the true area, union represents the union of the predicted area and the true area, b and b gt Represent the anchor box and target box respectively, (x c ,y c ) is the center point coordinate of the anchor box, is the center point coordinate of the target box, w and h are the width and height of the anchor box, w gt and h gt is the width and height of the target box, b l , b r , b t , b b It is the coordinate of the auxiliary border generated using the scale factor, and ratio is an adjustable scale factor.
[0018] Optionally, the operation process of the receptive field attention convolution is:
[0019] After average pooling of the received information, 1×1 convolution operation is used for information interaction, and the result obtained by the information interaction is recombined with the result obtained after the standard 3×3 convolution calculation.
[0020] Optionally, the specific operation of adding a global maximum pooling layer and a global average pooling layer in the spatial pyramid pooling structure in the backbone network is:
[0021] Add a global maximum pooling layer and a global average pooling layer in parallel with the spatial pyramid pooling structure, and concatenate the output of the spatial pyramid pooling structure with the output of the global maximum pooling layer and the global average pooling layer.
[0022] Optionally, in the process of training the RFASTD ship target detection model using the training data set, a stochastic gradient descent optimizer is used to perform optimization training of the RFASTD ship target detection model.
[0023] In a second aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any one of the above-mentioned ship target intelligent detection methods.
[0024] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-mentioned ship target intelligent detection methods.
[0025] In a fourth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned ship target intelligent detection methods.
[0026] According to the specific embodiments provided in this application, this application discloses the following technical effects:
[0027] This application provides a method, device and medium for intelligent detection of ship targets. By integrating the receptive field attention mechanism on the basis of the baseline method (YOLOv8 model), the problem of parameter sharing during model training is solved, the global perspective information of the model is enhanced, and the regression effect of the model is improved. By using the trained RFASTD ship target detection model, accurate detection of ship targets in the ship image to be detected is achieved, thereby solving the problem that the existing technology cannot accurately detect ship targets in the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0029] Figure 1 This is an application environment diagram of a ship target intelligent detection method in an embodiment of the present application;
[0030] Figure 2 A schematic diagram of a process flow of a ship target intelligent detection method provided in one embodiment of the present application;
[0031] Figure 3 A schematic diagram of the structure of the RFASTD ship target detection model provided in an embodiment of the present application;
[0032] Figure 4 A schematic diagram of a first ship detection result on an SSDD data set provided in an embodiment of the present application;
[0033] Figure 5 A schematic diagram of a second ship detection result on an SSDD data set provided in an embodiment of the present application;
[0034] Figure 6 A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0036] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0037] The ship target intelligent detection method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, or it can be integrated on the server 104, or it can be placed on the cloud or other servers. The terminal 102 can send the image of the ship to be detected to the server 104. After the server 104 receives the image of the ship to be detected, it inputs the image of the ship to be detected into the ship target detection model to obtain the ship target detection result. The server 104 can feedback the obtained ship target detection result to the terminal 102. In addition, in some embodiments, the ship target intelligent detection method can also be implemented by the server 104 or the terminal 102 alone. For example, the terminal 102 can directly perform target detection processing on the image of the ship to be detected, or the server 104 can obtain the image of the ship to be detected from the data storage system and perform target detection on the image of the ship to be detected.
[0038] The terminal 102 may be, but is not limited to, various desktop computers, laptop computers, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers, or may be a cloud server.
[0039] In an exemplary embodiment, Figure 2 As shown, a method for intelligent detection of ship targets is provided. The method is executed by a computer device, and can be executed by a computer device such as a terminal or a server alone, or by a terminal and a server together. In the embodiment of the present application, the method is applied to Figure 1 The server 104 in the example is used as an example to illustrate, including the following steps: 200 to 203. Among them:
[0040] Step 200: Based on the YOLOv8 model, the receptive field attention mechanism and global information are integrated to build the RFASTD ship target detection model.
[0041] Step 201: Obtain annotated ship images, and construct a training data set based on the annotated ship images.
[0042] Step 202: Use the training data set to train the RFASTD ship target detection model until the set conditions are met to obtain a trained ship target detection model.
[0043] Step 203: Acquire the image of the ship to be detected, and input the image to be detected into the ship target detection model to obtain the detection result; the ship target detection result includes the ship boundary box and the confidence level.
[0044] By implementing the above steps 201 to 203, accurate detection of ship targets in the ship image to be detected can be achieved, thereby solving the problem that the existing technology cannot efficiently and accurately detect ship targets in the image. In addition, the present application solves the problem of parameter sharing during model training by integrating the receptive field attention mechanism with global information on the basis of the baseline method (YOLOv8 model), enhances the global perspective information of the model, and improves the regression effect of the model.
[0045] In another exemplary embodiment of the present application, the specific construction process of the RFASTD ship target detection model in the above step 200 can be described as follows:
[0046] (1) Obtain the YOLOv8 model. The YOLOv8 model includes the input end, the backbone network, the neck network, and the head module.
[0047] (2) The standard convolution in the backbone network is optimized to receptive field attention convolution, a global maximum pooling layer and a global average pooling layer are added to the spatial pyramid pooling structure in the backbone network, and the internal intersection-over-union ratio is used to update the CIOU loss function to obtain the RFASTD ship target detection model. The internal intersection-over-union ratio refers to the intersection-over-union ratio between the anchor box and the target box.
[0048] Among them, the structure of the RFASTD ship target detection model is as follows: Figure 3 shown. Figure 3 In the figure, RFAConv represents the receptive field attention convolution, SPPF_IP represents the spatial pyramid pooling structure after adding a global maximum pooling layer and a global average pooling layer. C2f means that through operations such as feature conversion, branch processing and feature fusion, the features of the input data can be extracted and converted to generate a more representative output.
[0049] In the actual application process, the receptive field attention convolution is introduced into the backbone network, the global maximum pooling layer and the global average pooling layer are added to the spatial pyramid pooling structure, and the internal intersection-over-union ratio is introduced to update the original CIOU loss function. The specific implementation steps are as follows:
[0050] 1): Use receptive field attention convolution to improve the original two-layer standard convolution of the backbone network. The specific operation process of receptive field attention convolution is to first process the received information through average pooling, then use 1×1 convolution operation for information interaction, and recombine the result with the result obtained after standard 3×3 convolution calculation.
[0051] 2): Adding global maximum pooling layer and global average pooling layer to the spatial pyramid pooling structure is to improve and reconstruct the spatial pyramid pooling structure. The actual implementation method is to connect a global maximum pooling layer and a global average pooling layer in parallel to the spatial pyramid pooling structure, and then splice the results of the spatial pyramid pooling structure and the global maximum pooling layer and the global average pooling layer to form a new spatial pyramid pooling structure.
[0052] 3): This application uses the internal intersection-over-union loss function to update the original CIOU loss function. The formula of the CIOU loss function is:
[0053]
[0054] In the formula, IoU (Intersection over Union) represents the intersection over union ratio between the anchor box and the target box, h and w represent the height and width of the anchor box respectively, and h gt and W gt Represent the height and width of the target box respectively, ρ 2 (b,b gt ) represents the Euclidean distance between the center point of the anchor box and the target box, C represents the diagonal length of the minimum circumscribed matrix of the anchor box and the target box, α represents the weight, and v represents the parameter for measuring the consistency of the aspect ratio.
[0055] Furthermore, the calculation formula of the internal intersection-and-union ratio is:
[0056]
[0057] Where, IoU inner represents the internal intersection-union ratio, inter represents the intersection of the predicted area and the true area, union represents the union of the predicted area and the true area, b and b gt Represent the anchor box and target box respectively, (x c ,y c ) is the center point coordinate of the anchor box, is the center point coordinate of the target box, w and h are the width and height of the anchor box, w gt and h gt is the width and height of the target box, b l , b r , b t , b b It is the coordinate of the auxiliary border generated using the scale factor, and ratio is an adjustable scale factor.
[0058] This application solves the problem of parameter sharing during model training by adding receptive field attention convolution. By changing the spatial pyramid pooling module structure, the global perspective information of the model is increased, effectively improving the receptive field and robustness of the model. By using the scale factor to control the generation of auxiliary borders of different scales for loss calculation, the regression effect is improved.
[0059] In another exemplary embodiment of the present application, the implementation process of the above step 201 and step 202 can be described as follows:
[0060] Step 1: Preprocess and annotate the ship image data to generate an image dataset, and divide the ship image dataset into a training set, a validation set, and a test set according to a set ratio. The training set will be used to train the model, the validation set will be used for evaluation during the training process, and the test set will be used to evaluate the performance of the model. Specifically:
[0061] Step 1.1: Perform preprocessing such as cropping and filtering on the image containing the ship, and obtain the ship image data with a pixel size of 320px×320px through cropping and filtering.
[0062] Step 1.2: Randomly divide the images and labels in the image dataset into the ratio of N1:N2:N3 to obtain the training set, test set and validation set.
[0063] Step 3: Use the training set to train the RFASTD ship target detection model, use the test set to evaluate the performance of the model, and use the test set to evaluate the model based on the evaluation results. Specifically:
[0064] Step 3.1: Input the ship images in the training set constructed in step 1 into the improved YOLOv8n model for training. Set the required training parameters, for example, epoch (the number of times the data passes through the neural network once and returns once) is set to 50, the learning rate is set to 0.01, the batchsize (the number of data used for training at a time) is set to 32, and the SGD (stochastic gradient descent) optimizer is used. Get the trained model file and weight file.
[0065] Step 3.2: Save the weight parameter file of the best performing model during the training process, and further use the weight parameter file to evaluate the RFASTD ship target detection model, and test the target after loading the prepared test set and data set. The evaluation indicators used include accuracy (P), recall (R), mean average precision (mAP), parameters, and billion floating point operations per second (GFLOPs), and a visualization of the detection results is obtained.
[0066] Among them, the formula for determining the accuracy index P is:
[0067]
[0068] The formula for determining the recall rate index R is:
[0069]
[0070] The formula for determining the average precision index mAP is:
[0071]
[0072] Where TP is the sample predicted by the model to be true and is actually true, and the model predicts it to be correct; FP is the sample predicted by the model to be true and is actually false, and the model predicts it to be wrong; FN is the sample predicted by the model to be true and is actually false, and the model predicts it to be wrong. AP is the area calculated based on the PR curve, and the size of the area is positively correlated with the excellence of the classifier. mAP is the average of APs of multiple categories.
[0073] Furthermore, the advantages of the present application are illustrated by means of experimental comparison. Figure 4 and Figure 5 The detection results of the YOLOv8 model and the RFASTD ship target detection model on the SSDD dataset are shown, where: Figure 4 Part (a) is the first detection result diagram of the baseline method. Figure 4 Part (b) is a first detection result diagram of the ship target detection model in this application. Figure 5 Part (a) is the second detection result diagram of the baseline method. Figure 5 Part (b) is the second detection result diagram of the ship target detection model in this application. Figure 4 It can be seen that this application detects more ships and has a higher confidence level in detecting ships. Figure 5 It can be seen that the baseline method has missed detections (blue boxes) and wrong detections (yellow boxes), and this application correctly detects all ships with higher confidence.
[0074] Furthermore, Table 1 shows the evaluation results of the present application and the baseline method (YOLOv8) on the SSDD dataset. The experimental results show that the ship target intelligent detection method integrating receptive field attention proposed in the present application is better than the baseline method. With the number of parameters and the amount of computation almost unchanged, the accuracy (P) remains at the original level, and the recall rate (R) and mAP are improved by 8.2% and 3% respectively, which effectively improves the detection accuracy while maintaining the algorithm efficiency.
[0075] Table 1 Comparison of evaluation indicators of this application and the baseline method (YOLOv8)
[0076] method P / % R / % mAP50 / % parameters GFLOPs YOLOv8 0.898 0.712 0.824 3005843 8.1 This application 0.897 0.794 0.854 3077043 8.3
[0077] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store ship target detection results. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a ship target intelligent detection method is implemented.
[0078] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0079] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0080] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0081] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0082] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.
[0083] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0084] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A ship target intelligent detection method, characterized in that: The ship target intelligent detection method comprises: Based on the YOLOv8 model, the receptive field attention mechanism and global information are integrated to build the RFASTD ship target detection model; Obtain annotated ship images, and construct a training data set based on the annotated ship images; The training data set is used to train the RFASTD ship target detection model until the set conditions are met to obtain a trained ship target detection model; An image of a ship to be detected is obtained, and the image to be detected is input into the ship target detection model to obtain a detection result; the ship target detection result includes a ship boundary box and a confidence level.
2. The ship target intelligent detection method according to claim 1, characterized in that: Based on the YOLOv8 model, the receptive field attention mechanism and global information are integrated to build the RFASTD ship target detection model, which includes: Obtain a YOLOv8 algorithm model; the YOLOv8 algorithm model includes an input end, a backbone network, a neck network and a head module; The standard convolution in the backbone network is optimized to receptive field attention convolution, a global maximum pooling layer and a global average pooling layer are added to the spatial pyramid pooling structure in the backbone network, and the CIOU loss function is updated using the internal intersection-over-union loss function to obtain the RFASTD ship target detection model; the internal intersection-over-union ratio refers to the intersection-over-union ratio between the anchor box and the target box.
3. The ship target intelligent detection method according to claim 2, characterized in that: The calculation formula of the internal intersection-and-combination ratio is: Where, IoU inner represents the internal intersection-union ratio, inter represents the intersection of the predicted area and the true area, union represents the union of the predicted area and the true area, b and b gt Represent the anchor box and target box respectively, (x c ,y c ) is the center point coordinate of the anchor box, is the center point coordinate of the target box, w and h are the width and height of the anchor box, w gt and h gt is the width and height of the target box, b l , b r , b t , b b It is the coordinate of the auxiliary border generated using the scale factor, and ratio is an adjustable scale factor.
4. The ship target intelligent detection method according to claim 2, characterized in that: The operation process of the receptive field attention convolution is: After average pooling of the received information, 1×1 convolution operation is used for information interaction, and the result obtained by the information interaction is recombined with the result obtained after the standard 3×3 convolution calculation.
5. The ship target intelligent detection method according to claim 2, characterized in that: The specific operation of adding a global maximum pooling layer and a global average pooling layer in the spatial pyramid pooling structure in the backbone network is: Add a global maximum pooling layer and a global average pooling layer in parallel with the spatial pyramid pooling structure, and concatenate the output of the spatial pyramid pooling structure with the output of the global maximum pooling layer and the global average pooling layer.
6. The ship target intelligent detection method according to claim 1, characterized in that: In the process of training the RFASTD ship target detection model using the training data set, a stochastic gradient descent optimizer is used to perform optimization training of the RFASTD ship target detection model.
7. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the ship target intelligent detection method according to any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the ship target intelligent detection method described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Fishing boat border crossing early warning method based on deep learning
CN117437595A
Cited By
Livestock respiratory rate monitoring method, system, equipment and medium
CN120323955A
