Underwater target detection model and detection method thereof
By introducing the D-Mixer module and attention mechanism in the YOLOv9s model, the problem of insufficient accuracy and real-time performance of traditional underwater object detection technology in complex environments is solved, and higher detection accuracy and real-time performance are achieved.
Patent Information
- Application Number
- CN202411614428.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-13
AI Technical Summary
Traditional underwater target detection technology shows low accuracy, low real-time and sensitivity to environmental conditions in complex underwater environments, especially in cases of severe light changes and turbid water quality.
Based on the YOLOv9s model, the D-Mixer module, local channel and spatial attention mechanism are introduced, and the ability of feature extraction and feature fusion is improved through feature extraction, attention mechanism and calculation of channel and spatial attention map.
It improves the accuracy and real-time nature of underwater target detection, enhances the target recognition ability and detection accuracy, adapts to complex underwater environments, reduces information loss and improves the portability of the model.
Smart Images

Figure CN119579860A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of target detection methods, and in particular relates to an underwater target detection model and a detection method thereof. Background Art
[0002] Traditional underwater target detection technologies mainly rely on feature extraction and image processing methods to identify and locate targets. These methods include the use of edge detection, shape matching, optical flow and other techniques to analyze dynamic and static objects in underwater videos and images. However, these technologies are usually sensitive to environmental conditions, especially in complex underwater environments, where factors such as drastic changes in lighting and turbid water can have a negative impact on detection results. In addition, traditional methods often have large computational complexity and poor real-time performance, making them unsuitable for application scenarios that require rapid response. These limitations significantly reduce the availability and reliability of traditional underwater target detection methods in actual operations.
[0003] YOLOv9 introduced groundbreaking technologies such as Programmable Gradient Information (PGI) and Generalized Efficient Layer Aggregation Network (GELAN), marking a major advancement in the field of real-time object detection. The model has significantly improved efficiency, accuracy, and adaptability, setting a new benchmark on the MS COCO dataset. However, object detection in underwater environments still faces many challenges. Underwater conditions such as insufficient light, image quality problems caused by water scattering and refraction, low contrast and visual interference greatly affect the effectiveness of object detection technology. Summary of the invention
[0004] The purpose of the present invention is to provide an improved underwater target detection model and a detection method thereof based on actual needs, which improves the accuracy and real-time performance of underwater target detection while ensuring the target recognition capability as well as the precision and reliability of target detection.
[0005] To achieve the above purpose, the present invention adopts the following technical solution.
[0006] An underwater target detection model, the specific structure is as follows:
[0007] Based on the YOLOv9s backbone network, the medium generalized efficient layer aggregation network is used as the feature extraction unit, in which the basic convolution module is the RepConv network; the convolution module with a step size of 2 is used to realize the downsampling and feature extraction of the feature map, and the feature extraction and downsampling are carried out through 3 generalized efficient layer aggregation network modules and 5 ordinary convolution modules;
[0008] A D-Mixer module is inserted after the 8th layer of the backbone network, and self-attention is used to increase the proportion of key feature information in the feature map to improve the feature extraction capability of the network. The input and output modules of the D-Mixer module remain consistent to maintain the dimension size of the feature map. The D-Mixer module divides the input features into two parts, which are processed by a global self-attention module and an input-dependent deep convolution module (IDConv) respectively, and then the two outputs are connected together to achieve local token aggregation through a squeezed token enhancement module (Squeezed Token Enhancer).
[0009] The IDConv module is used to introduce inductive bias in a dynamic input-dependent manner and perform local feature aggregation. The IDConv module aggregates spatial context by using adaptive average pooling, then generates an attention map through two convolutional layers, and finally generates a deep convolution kernel that depends on the input.
[0010] Based on the YOLOv9s neck network, the feature maps in each channel are averaged and pooled as channel average features. The GELU function is used for activation to provide nonlinear transformation and help the network learn the complex distribution of data. The sigmoid activation function is used to generate attention weights and ensure that they are between 0 and 1.
[0011] Finally, the attention weight is multiplied by the feature number of the corresponding position to obtain the local channel attention mechanism module (LocalChannel Attention);
[0012] The local channel attention module uses the channel relationship between features to generate a channel attention map, but replaces the activation function from ReLU to GELU;
[0013] The local spatial attention module uses the spatial relationship between features by separately
[0014] Take local and global features, and finally weighted fusion activation to obtain the spatial attention map; the calculation process of the channel attention map and the spatial attention map is as follows:
[0015] Channel attention map: M c (F) = σ(MLP(AvgPool(F)));
[0016] Spatial Attention Map: M s (F)=σ([MLP(AvgPool(F));MLP(F)]);
[0017] Where AvgPool(F) refers to the average pooling of the feature map;
[0018] MLP (AvgPool (F) refers to the average feature of the fully connected layer activation;
[0019] σ(MLP(AvgPool(F))) refers to the sigmoid mapping of average pooling;
[0020] σ([MLP(AvgPool(F)); MLP(F)]) refers to the weighted fusion activation after splicing to obtain spatial attention;
[0021] The output end contains the classification, location, and confidence information of the target through three different prediction boxes. Finally, redundant boxes are eliminated through non-maximum suppression, and the information flow of auxiliary reversible branches is combined to improve the information fusion process.
[0022] Further improvement or specific implementation of the aforementioned underwater target detection model, wherein the basic structure of the auxiliary reversible branch network module includes: a two-stage channel separation convolution block, a reversible residual block and a cyclic asymmetric convolution enhancement network module;
[0023] The two-stage channel separation convolution block is used to increase the receptive field of the model and improve the expressiveness of the features. The channel separation convolution block completes two operations: channel separation and convolution; channel separation refers to dividing the input feature map into two parts according to the channel, performing different convolution operations respectively, and then splicing the results; convolution refers to performing a convolution operation on the input feature map to extract feature information, and using deep separable convolution to reduce the amount of calculation while improving the accuracy of the model;
[0024] The reversible residual block uses the residual structure to ensure that the information of the forward propagation is not lost;
[0025] The cyclic asymmetric convolution enhanced network module captures multi-scale features in the image by cyclically processing the feature map in an asymmetric convolution manner.
[0026] The present application also provides an underwater target detection method based on claim 1, comprising the following steps:
[0027] Step 1: Establish an underwater target detection model;
[0028] Based on the YOLOv9s model, an underwater target detection model network is established, a D-Mixer module is added to the backbone network, and a local channel attention mechanism module is added to the neck network;
[0029] The input end (Input) uses Mosaic data enhancement, adaptive anchor box calculation and adaptive image scaling to preprocess the input image to improve the data quality of the input model;
[0030] Configure the auxiliary reversible branch to insert the integrated network between the main branch networks to realize the aggregation and transfer of gradient information, ensure that the deep features retain the key information required for target detection, and alleviate the problem of information loss in the network feedforward process;
[0031] The output end (Prediction) continues to include the classification, location, and confidence information of the target through three different prediction boxes, and finally removes redundant boxes through non-maximum suppression, and cooperates with the information flow of the auxiliary reversible branch to detect the target;
[0032] Step 2: Create a training data set;
[0033] Establishing a data set for training, verification and testing of an underwater target detection network, wherein the data set consists of underwater target images and their annotation information; all image samples are merged and randomly allocated in proportion to obtain a training set, a verification set and a test set;
[0034] Step 3: Image preprocessing step;
[0035] The input end resizes the original image to 640x640 to ensure that the input size is suitable for the processing requirements of the model. Then the image pixel values are normalized from 0-255 to 0-1. The input image is preprocessed using data enhancement, adaptive anchor box calculation, and adaptive image scaling to improve the data quality of the input model.
[0036] Step 4: Input feature extraction;
[0037] The features of the input image are extracted based on the backbone network, and the input features are divided into two parts using the D-Mixer module. One part is constrained by the global self-attention module of the object self-representation attention, and the other part is processed by the input-dependent deep convolution module (IDConv); the output results of the two parts are combined and input into the squeezed token enhancer (STE) module;
[0038] Step 5: Attention mechanism and channel attention feature map generation;
[0039] Based on the neck network, channel attention adjustment and channel attention feature map generation are completed. The local spatial attention module is introduced into the 11th, 14th and 16th layers of the network, and the local channel attention module is introduced into the 19th, 23rd and 27th layers of the network.
[0040] The local channel attention module generates a channel attention feature map using the inter-channel relationship of features;
[0041] The local spatial attention module utilizes the spatial relationship between features to extract and integrate local and global features through a weighted fusion activation process to achieve spatial attention;
[0042] Step 6: Underwater target detection model training optimization;
[0043] The training set and the validation set in the target data set in step 2 are sent to the underwater target detection model constructed by steps 4 and 5 for training, thereby obtaining the optimal training weights;
[0044] Step 7: Perform target detection based on the trained underwater target detection model;
[0045] The underwater target image to be detected is sent to the trained improved underwater target detection model to complete the target detection.
[0046] As a further improvement or specific implementation of the aforementioned underwater target detection method, the data enhancement is specifically implemented based on the following steps:
[0047] a1. Randomly select the coordinates of the image stitching reference points, and randomly select four other images;
[0048] a2. The four images are resized and scaled according to the reference points and placed at the upper left, upper right, lower left and lower right positions of the large image of the specified size;
[0049] a3. According to the size transformation method of each picture, the mapping relationship is mapped to the picture label;
[0050] a4. According to the specified horizontal and vertical coordinates, stitch the large image and process the coordinates of the detection frame that exceeds the boundary.
[0051] A further improvement or specific implementation of the aforementioned underwater target detection method, wherein the adaptive anchor frame calculation refers to dynamically adjusting the size and proportion of the anchor frame according to the target size distribution in the training set to adapt to the characteristics of the targets in different images, thereby improving the accuracy of target detection; the process is implemented based on the following steps:
[0052] b1. Target size analysis: By analyzing the width-to-height ratio and distribution of targets in the training set, common target sizes are statistically analyzed;
[0053] Iteratively analyze the target bounding boxes in the training data and use a clustering algorithm to find the most suitable anchor box size;
[0054] b2. Anchor box generation: Generate adaptive anchor box groups based on clustering results to ensure that these anchor boxes can cover the sizes of different types of objects;
[0055] b3. Anchor frame adjustment: During the training process, the quality of the anchor frame is judged based on the loss function of the model. If the anchor frame does not match the true target frame well, the parameters of the anchor frame are further fine-tuned. During training, iterative optimization is performed until the loss value stabilizes or reaches the preset threshold or the number of iterations reaches the upper limit.
[0056] In a further improvement or specific implementation of the aforementioned underwater target detection method, the adaptive image scaling refers to: adjusting the size of the input image according to the specific requirements of the image and the underwater target detection model while minimizing distortion or loss of image information, which is specifically implemented based on the following steps:
[0057] c1. Image analysis: Analyze the size of the original image, determine its aspect ratio, and decide whether it needs to be scaled proportionally or non-proportionally based on the image resolution and content;
[0058] c2. Image scaling: adjust the image size to the model input requirement; if the image does not match the model input size, first scale it proportionally, and use padding technology if necessary to avoid image deformation;
[0059] c3. Image normalization: Normalize the image pixel values to meet the computing requirements of the model and enhance the training effect of the model;
[0060] c4. Judgment criteria: After the scaling is completed, check the pixel integrity and size conformity of the image to determine whether the image scaling meets the criteria; or determine the termination condition based on the number of iterations and the image distortion threshold.
[0061] As a further improvement or specific implementation of the aforementioned underwater target detection method, step six further includes an evaluation method for verifying the detection accuracy of the optimized underwater target detection model: specifically,
[0062] The average precision and the mean average precision are used to determine whether the trained underwater target detection model meets the requirements;
[0063] The calculation formula is as follows:
[0064]
[0065] Where Pr represents the detection accuracy; Re represents the recall level of the model; TP represents the number of true positives; FP represents the number of false positives; FN represents the number of false negatives; N represents the number of detected categories; i is an integer and iε[0,100]; AP represents the average precision, and mAP represents the mean average precision.
[0066] Its beneficial effects are:
[0067] In order to meet the above challenges, this paper improves the YOLOv9s model and proposes a detection model. The model enhances the feature extraction capability by integrating the dual dynamic token mixer module. The channel attention and spatial attention networks are designed, and the channel attention module and the spatial attention module are used to guide the feature fusion, thereby improving the accuracy and real-time performance of underwater target detection. The particularity of the underwater environment is fully considered, and the model's ability to recognize targets in complex environments is improved by dynamically adjusting the token allocation in the feature extraction process. At the same time, the introduction of the channel attention and spatial attention mechanisms effectively enhances the effect of feature fusion and improves the accuracy and reliability of target detection. Although the model introduces multiple improved modules, its weight size is still only 9.3M, ensuring the efficiency and portability of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 It is a schematic diagram of target detection results. DETAILED DESCRIPTION
[0069] The present invention is described in detail below in conjunction with specific embodiments.
[0070] The underwater target detection model and underwater target detection method of the present application are mainly used to address the problems of poor visibility and many interference factors encountered in the process of underwater target detection, and provide a solution with better detection effect, higher detection accuracy and good portability.
[0071] In this application, the D-Mixer module is introduced to enhance the feature extraction capability and further optimize the underwater target recognition process. By designing a feature fusion network, the channel attention and spatial attention mechanisms are used to enhance the importance of different feature channels and different spatial positions of feature maps to optimize and guide feature fusion, thereby achieving better underwater target detection effects.
[0072] The following is an explanation of the underwater target detection model of the present application in combination with a specific scheme, and the specific structure is as follows:
[0073] Based on the YOLOv9s backbone network, the medium generalized efficient layer aggregation network is used as the feature extraction unit, in which the basic convolution module is the RepConv network; by using RepConv as the basic convolution module, the reparameterization technology is used to further improve the feature extraction capability, and the convolution module with a step size of 2 is used to realize the downsampling and feature extraction of the feature map. After feature extraction and downsampling of 3 generalized efficient layer aggregation network modules and 5 ordinary convolution modules, the feature map contains a large amount of feature information. At this time, the D-Mixer module is inserted after the 8th layer of the backbone network, and the self-attention is used to increase the proportion of key feature information in the feature map, thereby improving the feature extraction capability of the network. To ensure the versatility of the network, the input and output modules of the D-Mixer module remain consistent, and the dimension size of the feature map is not changed.
[0074] Mixer module It divides the input features into two parts, which are processed by a global self-attention module and an input-dependent deep convolution module (IDConv) respectively. D-Mixer divides the input features into two parts, each of which undergoes a different processing stage. One part is constrained by a global self-attention module called object self-representation attention, while the other part is processed by an input-dependent deep convolution module (IDConv); the two outputs are then connected together, and local token aggregation is achieved through a squeezed token enhancement module (Squeezed Token Enhancer) to effectively integrate local tokens. Finally, global and local information are dynamically utilized, while a large receptive field and a strong inductive bias are injected to improve the object detection module's ability to extract relational information; this simple structure enables the network to capture global and local information at the same time, thereby enhancing its inductive bias.
[0075] The DConv module is used to introduce inductive bias in a dynamic input-dependent manner and perform local feature aggregation. It aggregates spatial context by using adaptive average pooling, then generates an attention map through two convolutional layers, and finally generates a deep convolution kernel that depends on the input. This module provides improved dynamic local feature encoding capabilities and is more computationally efficient.
[0076] In this application, the backbone network (Backbone) combines the characteristics of CSPNet and ELAN networks to design a generalized efficient layer aggregation network. Combining the advantages of CSPNet and ELAN, a network structure is designed to enhance inter-layer information flow and feature fusion. The principle is to efficiently fuse multi-scale features through a specific aggregation mechanism between network layers of different depths. This structure fuses feature maps of different layers at multiple levels, while reducing redundant calculations, improving overall computational efficiency and feature expression capabilities. The feature extraction unit uses the reparameterization module (RepConv) as the basic convolution module and further improves the feature extraction capability by using reparameterization; based on the CBNet composite backbone network, an integrated network is inserted between it and the main branch network to realize gradient information aggregation and flow, ensuring that deep features retain the key information required for target detection and alleviating the problem of information loss in the network feedforward process.
[0077] S2. Establish an optimized neck network for underwater target detection model. Specifically:
[0078] Based on the YOLOv9s neck network, the feature maps in each channel are averaged and pooled as channel average features. The GELU function is used for activation to provide nonlinear transformation and help the network learn the complex distribution of data. The sigmoid activation function is used to generate attention weights and ensure that they are between 0 and 1.
[0079] Finally, the attention weight is multiplied by the feature number of the corresponding position to obtain the local channel attention mechanism module (LocalChannel Attention);
[0080] The local channel attention module uses the channel relationship between features to generate a channel attention map, but replaces the activation function from ReLU to GELU;
[0081] The local spatial attention module uses the spatial relationship between features to obtain local and global features respectively, and finally obtains the spatial attention map by weighted fusion activation; the calculation process of the channel attention map and the spatial attention map is as follows:
[0082] Channel attention map: M c (F) = σ(MLP(AvgPool(F)));
[0083] Spatial Attention Map: M s ( F )=σ([MLP(AvgPool(F));MLP(F)]);
[0084] Where AvgPool(F) refers to the average pooling of the feature map;
[0085] MLP (AvgPool (F) refers to the average feature of the fully connected layer activation;
[0086] σ(MLP(AvgPool(F))) refers to the sigmoid mapping of average pooling;
[0087] σ([MLP(AvgPool(F)); MLP(F)]) refers to the weighted fusion activation after splicing to obtain spatial attention.
[0088] In this application, the main part of the neck continues to use the path aggregation network structure of the FPN+PAN structure, but the E-ELAN module is replaced by the GELAN layer; the output end (Prediction) continues to retain the classification, position, and confidence information of the target through three different prediction boxes, and finally eliminates redundant boxes through non-maximum suppression, but cooperates with the information flow of auxiliary reversible branches to improve the information fusion process.
[0089] Further improvement or specific implementation steps of the aforementioned underwater target detection model, the basic structure of the auxiliary reversible branch network module includes: a two-stage channel separation convolution block, a reversible residual block and a cyclic asymmetric convolution enhancement network module;
[0090] The two-stage channel separation convolution block is used to increase the receptive field of the model and improve the expressiveness of the features. The channel separation convolution block completes two operations: channel separation and convolution; channel separation refers to dividing the input feature map into two parts according to the channel, performing different convolution operations respectively, and then splicing the results; convolution refers to performing a convolution operation on the input feature map to extract feature information, and using deep separable convolution to reduce the amount of calculation while improving the accuracy of the model;
[0091] The reversible residual block uses the residual structure to ensure that the information of the forward propagation is not lost;
[0092] The cyclic asymmetric convolution enhanced network module captures multi-scale features in the image by cyclically processing the feature map in an asymmetric convolution manner.
[0093] The present application also provides an underwater target detection method, comprising the following steps:
[0094] Step 1: Establish an underwater target detection model based on the above basic structure, including establishing an underwater target detection model network based on the YOLOv9s model, adding a D-Mixer module to the backbone network, and adding a local channel attention mechanism module to the neck network;
[0095] The input end (Input) uses Mosaic data enhancement, adaptive anchor box calculation and adaptive image scaling to preprocess the input image to improve the data quality of the input model;
[0096] Configure the auxiliary reversible branch to insert the integrated network between the main branch networks to realize the aggregation and transfer of gradient information, ensure that the deep features retain the key information required for target detection, and alleviate the problem of information loss in the network feedforward process;
[0097] The output end (Prediction) continues to include the classification, location, and confidence information of the target through three different prediction boxes, and finally removes redundant boxes through non-maximum suppression, and cooperates with the information flow of the auxiliary reversible branch to detect the target;
[0098] Step 2: Create a training dataset
[0099] Establishing a data set for training, verification and testing of an underwater target detection network, wherein the data set consists of underwater target images and their annotation information; all image samples are merged and randomly allocated in proportion to obtain a training set, a verification set and a test set;
[0100] The training and validation datasets for the target detection network in this example come from the publicly accessible URPC2019 underwater target dataset. This dataset includes underwater objects of different categories, namely sea cucumbers, sea urchins, scallops, starfish, and aquatic plants, with a total of 3765 training samples and 942 validation samples. Subsequently, all samples were assigned to training, validation, and test sets, and this classification was used to evaluate the algorithm network and its effectiveness.
[0101] Step 3: Image preprocessing steps
[0102] The input end resizes the original image to 640x640 to ensure that the input size is suitable for the processing requirements of the model. Then the image pixel values are normalized from 0-255 to 0-1. The input image is preprocessed using data enhancement, adaptive anchor box calculation, and adaptive image scaling to improve the data quality of the input model.
[0103] Data enhancement is implemented based on the following steps:
[0104] a1. Randomly select the coordinates of the image stitching reference points, and randomly select four other images;
[0105] a2. The four images are resized and scaled according to the reference points and placed at the upper left, upper right, lower left and lower right positions of the large image of the specified size;
[0106] a3. According to the size transformation method of each picture, the mapping relationship is mapped to the picture label;
[0107] a4. According to the specified horizontal and vertical coordinates, stitch the large image and process the coordinates of the detection frame that exceeds the boundary.
[0108] Adaptive anchor box calculation refers to dynamically adjusting the size and proportion of the anchor box according to the target size distribution in the training set to adapt to the characteristics of the targets in different images, thereby improving the accuracy of target detection; this process is implemented based on the following steps:
[0109] b1. Target size analysis: By analyzing the width-to-height ratio and distribution of targets in the training set, common target sizes are statistically analyzed;
[0110] Iteratively analyze the target bounding boxes in the training data and use a clustering algorithm to find the most suitable anchor box size;
[0111] b2. Anchor box generation: Generate adaptive anchor box groups based on clustering results to ensure that these anchor boxes can cover the sizes of different types of objects;
[0112] b3. Anchor frame adjustment: During the training process, the quality of the anchor frame is judged based on the loss function of the model. If the anchor frame does not match the true target frame well, the parameters of the anchor frame are further fine-tuned. During training, iterative optimization is performed until the loss value stabilizes or reaches the preset threshold or the number of iterations reaches the upper limit.
[0113] Adaptive image scaling is the process of adjusting the size of the input image to the specific needs of the image and underwater object detection model while minimizing distortion or loss of image information. This is accomplished by the following steps:
[0114] c1. Image analysis: Analyze the size of the original image, determine its aspect ratio, and decide whether it needs to be scaled proportionally or non-proportionally based on the image resolution and content;
[0115] c2. Image scaling: adjust the image size to the model input requirement; if the image does not match the model input size, first scale it proportionally, and use padding technology if necessary to avoid image deformation;
[0116] c3. Image normalization: Normalize the image pixel values to meet the computing requirements of the model and enhance the training effect of the model;
[0117] c4. Judgment criteria: After the scaling is completed, check the pixel integrity and size conformity of the image to determine whether the image scaling meets the criteria; or determine the termination condition based on the number of iterations and the image distortion threshold.
[0118] Step 4: Input feature extraction
[0119] The features of the input image are extracted based on the backbone network, and the input features are divided into two parts using the D-Mixer module. One part is constrained by the global self-attention module of the object self-representation attention, and the other part is processed by the input-dependent deep convolution module (IDConv); the output results of the two parts are combined and input into the squeezed token enhancer (STE) module;
[0120] Step 5: Attention mechanism and channel attention feature map generation
[0121] Based on the neck network, channel attention adjustment and channel attention feature map generation are completed. The local spatial attention module is introduced into the 11th, 14th and 16th layers of the network, and the local channel attention module is introduced into the 19th, 23rd and 27th layers of the network.
[0122] The local channel attention module generates a channel attention feature map using the inter-channel relationship of features;
[0123] The local spatial attention module utilizes the spatial relationship between features to extract and integrate local and global features through a weighted fusion activation process to achieve spatial attention;
[0124] Step 6: Underwater target detection model training optimization
[0125] The training set and the validation set in the target data set in step 2 are sent to the underwater target detection model constructed by steps 4 and 5 for training, thereby obtaining the optimal training weights;
[0126] In order to provide a reference for the quality of the optimized model and the training progress, this embodiment also includes an evaluation method for verifying the detection accuracy of the optimized underwater target detection model: specifically,
[0127] The average precision and the mean average precision are used to determine whether the trained underwater target detection model meets the requirements;
[0128] The calculation formula is as follows:
[0129]
[0130] Where Pr represents the detection accuracy; Re represents the recall level of the model; TP represents the number of true positives; FP represents the number of false positives; FN represents the number of false negatives; N represents the number of detected categories; i is an integer and iε[0,100]; AP represents the average precision, and mAP represents the mean average precision.
[0131] According to the above evaluation indicators, the detection results based on the improved underwater target detection method are compared with the original YOLOv9s model. The results show that the improved YOLOv9s model is better than the original YOLOv9s model in underwater target detection. The comparison results are shown in Table 1:
[0132] Table 1 Evaluation and parameter comparison of different underwater target detection models
[0133] Detection Methods Precision Recall mAP@0.5 mAP@0.5:0.95 FPS InferenceTime YOLOv9s 72.62% 78.51% 77.79% 48.01% 32.97 14254ms This application 75.68% 80.20% 78.12% 48.74% 32.25 14573ms
[0134] Step 7: Target detection based on the trained underwater target detection model
[0135] The underwater target image to be detected is sent to the trained improved underwater target detection model to complete the target detection. Figure 1 As shown, the detection results include the category, confidence level and location of the underwater target.
[0136] Further analysis shows that the model shows significant improvement in detection results of different categories compared to the original YOLOv9s model, and can detect some element categories that are difficult to detect by the original network, indicating that the improved network has better effect on feature extraction and enhancement, and the detection accuracy of unclassified categories is significantly improved, showing significant improvement in recognition and positioning capabilities of unclassified features, while effectively reducing the phenomenon of repeated detection of some categories. Therefore, it can provide more effective means when dealing with overlapping or dense objects and reduce false detection or repeated detection.
[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, rather than to limit the scope of protection of the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the essence and scope of the technical solution of the present invention.
Claims
1. An underwater target detection model, characterized in that: The specific structure is as follows: Based on the YOLOv9s backbone network, the medium generalized efficient layer aggregation network is used as the feature extraction unit, in which the basic convolution module is the RepConv network; the convolution module with a step size of 2 is used to realize the downsampling and feature extraction of the feature map, and the feature extraction and downsampling are carried out through 3 generalized efficient layer aggregation network modules and 5 ordinary convolution modules; A D-Mixer module is inserted after the 8th layer of the backbone network, and self-attention is used to increase the proportion of key feature information in the feature map to improve the feature extraction capability of the network. The input and output modules of the D-Mixer module remain consistent to maintain the dimension size of the feature map. The D-Mixer module divides the input features into two parts, which are processed by a global self-attention module and an input-dependent deep convolution module respectively, and then the two outputs are connected together to achieve local token aggregation through a compressed token enhancement module. The IDConv module is used to introduce inductive bias in a dynamic input-dependent manner and perform local feature aggregation; The IDConv module aggregates spatial context by using adaptive average pooling, then generates an attention map through two convolutional layers, and finally generates a deep convolution kernel that depends on the input; Based on the YOLOv9s neck network, the feature maps in each channel are averaged and pooled as channel average features. The GELU function is used for activation to provide nonlinear transformation and help the network learn the complex distribution of data. The sigmoid activation function is used to generate attention weights and ensure that they are between 0 and 1. Finally, the attention weight is multiplied by the feature number of the corresponding position to obtain the local channel attention mechanism module; The local channel attention module uses the channel relationship between features to generate a channel attention map, but replaces the activation function from ReLU to GELU. The local spatial attention module uses the spatial relationship between features to obtain local and global features respectively, and finally obtains the spatial attention map by weighted fusion activation; the calculation process of the channel attention map and the spatial attention map is as follows: Channel attention map: M c (F) = σ(MLP(Avg P ool( F ))); Spatial Attention Map: Ms ( F )= σ ([ MLP ( A vgPool(F)); MLP(F)]); Among them, Avg P ool(F) refers to the average pooling of feature maps; MLP (AvgPool (F) refers to the average feature of the fully connected layer activation; σ(MLP(AvgPool(F))) refers to the sigmoid mapping of average pooling; σ([MLP(AvgPool(F)); MLP(F)]) refers to the weighted fusion activation after splicing to obtain spatial attention; The output end contains the classification, location, and confidence information of the target through three different prediction boxes. Finally, redundant boxes are eliminated through non-maximum suppression, and the information flow of auxiliary reversible branches is combined to improve the information fusion process.
2. The underwater target detection model according to claim 1, characterized in that: The basic structure of the auxiliary reversible branch network module includes: a two-stage channel separation convolution block, a reversible residual block and a cyclic asymmetric convolution enhancement network module; The two-stage channel separation convolution block is used to increase the receptive field of the model and improve the expressiveness of the features. The channel separation convolution block completes two operations: channel separation and convolution; channel separation refers to dividing the input feature map into two parts according to the channel, performing different convolution operations respectively, and then splicing the results; convolution refers to performing a convolution operation on the input feature map to extract feature information, and using deep separable convolution to reduce the amount of calculation while improving the accuracy of the model; The reversible residual block uses the residual structure to ensure that the information of the forward propagation is not lost; The cyclic asymmetric convolution enhanced network module captures multi-scale features in the image by cyclically processing the feature map in an asymmetric convolution manner.
3. An underwater target detection method based on claim 1, characterized in that: The steps include: Step 1: Build an underwater target detection model Based on the YOLOv9s model, an underwater target detection model network is established, a D-Mixer module is added to the backbone network, and a local channel attention mechanism module is added to the neck network; The input end (Input) uses Mosaic data enhancement, adaptive anchor box calculation and adaptive image scaling to preprocess the input image to improve the data quality of the input model; Configure the auxiliary reversible branch to insert the integrated network between the main branch networks to realize the aggregation and transfer of gradient information, ensure that the deep features retain the key information required for target detection, and alleviate the problem of information loss in the network feedforward process; The output end (Prediction) continues to include the classification, location, and confidence information of the target through three different prediction boxes, and finally removes redundant boxes through non-maximum suppression, and cooperates with the information flow of the auxiliary reversible branch to detect the target; Step 2: Build a dataset Establishing a data set for training, verification and testing of an underwater target detection network, wherein the data set consists of underwater target images and their annotation information; all image samples are merged and randomly allocated in proportion to obtain a training set, a verification set and a test set; Step 3: Image preprocessing steps The input end resizes the original image to 640x640 to ensure that the input size is suitable for the processing requirements of the model. Then the image pixel values are normalized from 0-255 to 0-1. The input image is preprocessed using data enhancement, adaptive anchor box calculation, and adaptive image scaling to improve the data quality of the input model. Step 4: Input feature extraction The backbone network extracts features of the input image and uses the D-Mixer module to divide the input features into two parts, one of which is constrained by the global self-attention module that pays attention to the object's self-representation, and the other is processed by the input-dependent deep convolution module; the output results of the two parts are combined and input into the squeeze token enhancer module; Step 5: Attention mechanism and channel attention feature map generation Based on the neck network, channel attention adjustment and channel attention feature map generation are completed. The local spatial attention module is introduced into the 11th, 14th and 16th layers of the network, and the local channel attention module is introduced into the 19th, 23rd and 27th layers of the network. The local channel attention module generates a channel attention feature map using the inter-channel relationship of features; The local spatial attention module utilizes the spatial relationship between features to extract and integrate local and global features through a weighted fusion activation process to achieve spatial attention; Step 6: Underwater target detection model training optimization The training set and the validation set in the target data set in step 2 are sent to the underwater target detection model constructed by steps 4 and 5 for training, thereby obtaining the optimal training weights; Step 7: Test based on the trained underwater target detection model The test data set in the target data set is sent to the trained improved underwater target detection model to complete the test.
4. The underwater target detection method according to claim 3, characterized in that: The data enhancement is specifically implemented based on the following steps: a1. Randomly select the coordinates of the image stitching reference points, and randomly select four other images; a2. The four images are resized and scaled according to the reference points and placed at the upper left, upper right, lower left and lower right positions of the large image of the specified size; a3. According to the size transformation method of each picture, the mapping relationship is mapped to the picture label; a4. According to the specified horizontal and vertical coordinates, stitch the large image and process the coordinates of the detection frame that exceeds the boundary.
5. The underwater target detection method according to claim 3, characterized in that: The adaptive anchor box calculation refers to dynamically adjusting the size and proportion of the anchor box according to the target size distribution in the training set to adapt to the characteristics of the targets in different images, thereby improving the accuracy of target detection; this process is implemented based on the following steps: b1. Target size analysis: By analyzing the width-to-height ratio and distribution of targets in the training set, common target sizes are statistically analyzed; Iteratively analyze the target bounding boxes in the training data and use a clustering algorithm to find the most suitable anchor box size; b2. Anchor box generation: Generate adaptive anchor box groups based on clustering results to ensure that these anchor boxes can cover the sizes of different types of objects; b3. Anchor frame adjustment: During the training process, the quality of the anchor frame is judged based on the loss function of the model. If the anchor frame does not match the true target frame well, the parameters of the anchor frame are further fine-tuned. During training, iterative optimization is performed until the loss value stabilizes or reaches the preset threshold or the number of iterations reaches the upper limit.
6. The underwater target detection method according to claim 3, characterized in that: Adaptive image scaling refers to adjusting the size of the input image according to the specific requirements of the image and underwater object detection model while minimizing distortion or loss of image information, which is specifically achieved based on the following steps: c1. Image analysis: Analyze the size of the original image, determine its aspect ratio, and decide whether it needs to be scaled proportionally or non-proportionally based on the image resolution and content; c2. Image scaling: adjust the image size to the model input requirement; if the image does not match the model input size, first scale it proportionally, and use padding technology if necessary to avoid image deformation; c3. Image normalization: Normalize the image pixel values to meet the computing requirements of the model and enhance the training effect of the model; c4. Judgment criteria: After the scaling is completed, check the pixel integrity and size conformity of the image to determine whether the image scaling meets the criteria; or determine the termination condition based on the number of iterations and the image distortion threshold.
7. The underwater target detection method according to claim 3, characterized in that: The step six also includes an evaluation method for verifying the detection accuracy of the optimized underwater target detection model: specifically, The average precision and the mean average precision are used to determine whether the trained underwater target detection model meets the requirements; The calculation formula is as follows: Where Pr represents the detection accuracy; Re represents the recall level of the model; TP represents the number of true positives; FP stands for the number of false positives; FN stands for the number of false negatives; N stands for the number of detected categories; i is an integer and iε[0,100]; AP stands for average precision, and mAP stands for mean average precision.
Citation Information
Patent Citations
Image processing method and device, electronic equipment and storage medium
CN111368849A
Radar or sonar image target detection and classification method based on automatic deep learning
CN113989655A
Deep learning-based crop lodging level prediction method and system
CN117197668A
Hardware codec accelerators for high-performance video encoding
US20230063062A1
Cited By
Rapid detection method for roadbed retaining structure diseases based on YOLOv9
CN120673306A