An underwater target detection model and a detection method thereof

By improving the YOLOv9s model and combining it with the D-Mixer module and attention mechanism, underwater target detection is optimized, solving the problem of poor detection performance of traditional methods in complex underwater environments, and achieving efficient and accurate underwater target detection.

CN119579860BActive Publication Date: 2026-01-13NAVAL UNIV OF ENG PLA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411614428.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-13
Publication Date
2026-01-13
Estimated Expiration
2044-11-13

AI Technical Summary

Technical Problem

Traditional underwater target detection technologies are ineffective in complex underwater environments. They are affected by factors such as changes in lighting and water turbidity, have high computational requirements and poor real-time performance, making it difficult to meet the needs of rapid response.

Method used

An improved YOLOv9s model is adopted, which combines the D-Mixer module, local and global attention mechanisms, and auxiliary reversible branch network. Through feature extraction and preprocessing optimization, the feature fusion capability is enhanced, information loss is mitigated, and detection accuracy and real-time performance are improved.

Benefits of technology

It significantly improves the accuracy and real-time performance of target detection in complex underwater environments, enhances the ability to identify and detect targets, and has small and efficient model weights, making it suitable for underwater target detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119579860B_ABST
    Figure CN119579860B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of target detection methods, and particularly relates to an underwater target detection model and a detection method thereof. In this paper, the YOLOv9s model is improved, and a detection model is proposed. The model integrates a double dynamic token mixer module, enhancing the feature extraction capability. A channel attention and spatial attention network is designed, using the channel attention module and the spatial attention module to guide 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 token allocation in the feature extraction process is dynamically adjusted to improve the model's ability to recognize targets in complex environments. At the same time, the introduction of the channel attention and spatial attention mechanism effectively enhances the feature fusion effect, improves the accuracy and reliability of target detection, and has small weight, ensuring the efficiency and portability of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of target detection methods, and particularly relates to an underwater target detection model and its detection method. Background Technology

[0002] Traditional underwater target detection techniques primarily rely on feature extraction and image processing methods to identify and locate targets. These methods include edge detection, shape matching, and optical flow to analyze dynamic and static objects in underwater videos and images. However, these techniques are often sensitive to environmental conditions, especially in complex underwater environments where factors such as drastic changes in lighting and water turbidity can negatively impact detection performance. Furthermore, traditional methods are often computationally intensive and lack real-time performance, making them unsuitable for applications requiring rapid response. These limitations significantly reduce the usability and reliability of traditional underwater target detection methods in practical operation.

[0003] YOLOv9 introduced groundbreaking techniques such as Programmable Gradient Information (PGI) and Generalized Efficient Layer Aggregation Network (GELAN), marking a significant advancement in real-time object detection. The model achieved substantial improvements in efficiency, accuracy, and adaptability, setting a new benchmark on the MS COCO dataset. However, object detection in underwater environments still faces numerous challenges. Underwater conditions such as insufficient light, image quality issues caused by water scattering and refraction, low contrast, and visual interference significantly impact the effectiveness of object detection techniques. Summary of the Invention

[0004] The purpose of this invention is to provide an improved underwater target detection model and method based on practical needs. This model and method improve the accuracy and real-time performance of underwater target detection, while ensuring the target identification capability and the accuracy and reliability of target detection.

[0005] To achieve the above objectives, the present invention adopts the following technical solution.

[0006] An underwater target detection model, with the following specific structure:

[0007] Based on the YOLOv9s backbone network, a generalized efficient layer aggregation network is used as the feature extraction unit, where the basic convolutional module is the RepConv network; feature map downsampling and feature extraction are achieved using a convolutional module with a stride of 2, and feature extraction and downsampling are performed through 3 generalized efficient layer aggregation network modules and 5 ordinary convolutional modules;

[0008] A D-Mixer module is inserted after the 8th layer of the backbone network. It uses self-attention to increase the proportion of key feature information in the feature map and improve the feature extraction capability of the network. The input and output modules of the D-Mixer module are kept consistent to maintain the dimensionality 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 convolutional module (IDConv) respectively. Then the two outputs are concatenated together, and local token aggregation is achieved through a squeezed token enhancer module.

[0009] The IDConv module is used to introduce inductive bias in a dynamic input-related manner and perform local feature aggregation. The IDConv module aggregates spatial context by using adaptive average pooling, then generates attention maps through two convolutional layers, and finally produces input-dependent deep convolutional kernels.

[0010] Based on the YOLOv9s neck network, the feature maps of each channel are averaged and pooled as channel average features. The GELU function is used for activation to provide non-linear transformation and help the network learn the complex distribution of the data. The sigmoid activation function is used to generate attention weights and ensure that they are between 0 and 1.

[0011] Finally, the attention weights are multiplied by the number of features at the corresponding location to obtain the LocalChannel Attention module;

[0012] The local channel attention module uses the channel relationships between features to generate a channel attention map, but replaces the activation function in it with GELU instead of ReLU;

[0013] The local spatial attention module utilizes the spatial relationships between features by calculating...

[0014] Local and global features are extracted, and finally weighted and fused 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 average pooling of the feature map;

[0018] MLP(AvgPool(F) refers to the average activation feature of fully connected layers;

[0019] σ(MLP(AvgPool(F))) refers to applying a sigmoid mapping to average pooling;

[0020] σ([MLP(AvgPool(F)); MLP(F)]) refers to spatial attention obtained by weighted fusion activation after splicing;

[0021] The output end uses three different prediction boxes to include the target's classification, location, and confidence information. Finally, redundant boxes are removed through non-maximum suppression, and the information fusion process is improved by assisting the information flow of reversible branches.

[0022] Further improvements or specific implementations of the aforementioned underwater target detection model include the following basic structure of the auxiliary reversible branch network module: a two-level channel separation convolution block, a reversible residual block, and a cyclic asymmetric convolution enhancement network module.

[0023] The two-level channel-separating convolutional block is used to increase the receptive field of the model and improve the expressive power of features. The channel-separating convolutional block performs two operations: channel separation and convolution. Channel separation refers to dividing the input feature map into two parts according to channels, performing different convolution operations on each part, and then concatenating the results. Convolution refers to performing convolution operations on the input feature map to extract feature information. The use of depthwise separable convolution reduces the amount of computation and improves the accuracy of the model.

[0024] Reversible residual blocks utilize residual structures to ensure that information is not lost during forward propagation;

[0025] The recurrent asymmetric convolution enhancement network module captures multi-scale features in images by recurrently processing feature maps using asymmetric convolution.

[0026] This 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] An underwater target detection model network was established based on the YOLOv9s model. A D-Mixer module was added to the backbone network, and a local channel attention mechanism module was added to the neck network.

[0029] The input end employs Mosaic data augmentation, adaptive anchor box calculation, and adaptive image scaling to preprocess the input image in order to improve the data quality of the input model.

[0030] Configure an auxiliary reversible branch to insert an ensemble network between the main branch networks to realize gradient information aggregation and flow, ensure that deep features retain the key information required for target detection, and alleviate the problem of information loss during network feedforward.

[0031] The output (Prediction) continues to include the target's classification, location, and confidence information through three different prediction boxes. Finally, redundant boxes are removed through non-maximum suppression, and the information flow of the auxiliary reversible branch is used to detect the target.

[0032] Step 2: Create a training dataset;

[0033] A dataset for training, validation, and testing of an underwater target detection network is established. The dataset consists of underwater target images and their annotation information. All image samples are merged and randomly distributed proportionally to obtain a training set, a validation set, and a test set.

[0034] Step 3: Image preprocessing steps;

[0035] The input process involves resizing the original image to 640x640 pixels to ensure the input size is suitable for the model's processing requirements. Next, the image pixel values ​​are normalized, scaling them from 0-255 to 0-1. Data augmentation, adaptive anchor box calculation, and adaptive image scaling are used to preprocess the input image to improve the data quality of the input model.

[0036] Step 4: Input Feature Extraction;

[0037] The backbone network extracts features from the input image. The D-Mixer module divides the input features into two parts. One part is constrained by the global self-attention module with object self-representation attention, and the other part is processed by the input-dependent deep convolution module (IDConv). The outputs of the two parts are combined and input into the squeeze token enhancer (STE) module.

[0038] Step 5: Attention mechanism and generation of channel attention feature maps;

[0039] Channel attention adjustment and channel attention feature map generation are completed based on the neck network. The local spatial attention module is introduced to the back of the 11th, 14th and 16th layers of the network, and the local channel attention module is introduced to the back of the 19th, 23rd and 27th layers of the network.

[0040] The local channel attention module generates a channel attention feature map by utilizing the inter-channel relationships of the features;

[0041] The local spatial attention module utilizes the spatial relationships between features to extract and integrate local and global features through a weighted fusion activation process to achieve spatial attention.

[0042] Step Six: Training and Optimization of the Underwater Target Detection Model;

[0043] The training and validation sets from the target dataset in step two are fed into the underwater target detection model constructed in steps four and five 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 fed into a trained underwater target detection model to complete the target detection.

[0046] A further improvement or specific implementation of the aforementioned underwater target detection method, wherein the data enhancement is specifically achieved based on the following steps:

[0047] a1. Randomly select the coordinates of the image stitching reference point, and then randomly select four more images;

[0048] a2. Based on the reference point, the four images are adjusted in size and scaled proportionally, and then placed in the upper left, upper right, lower left, and lower right positions of the large image of the specified size.

[0049] a3. Based on the size transformation method of each image, map the relationship to the image tag;

[0050] a4. Based on the specified horizontal and vertical coordinates, stitch the large image together and process the coordinates of the detection boxes that exceed the boundaries.

[0051] A further improvement or specific implementation of the aforementioned underwater target detection method involves adaptive anchor frame calculation, which refers to dynamically adjusting the size and proportion of the anchor frame based on the target size distribution in the training set to adapt to the characteristics of targets in different images, thereby improving the accuracy of target detection. This process is implemented based on the following steps:

[0052] b1. Target size analysis: By analyzing the aspect ratio and distribution of targets in the training set, common target sizes are statistically identified;

[0053] Iteratively analyze the target bounding boxes in the training data and use clustering algorithms to find the most suitable anchor box size;

[0054] b2. Anchor box generation: Based on the clustering results, generate adaptive anchor box groups to ensure that these anchor boxes can cover the size of different types of targets;

[0055] b3. Anchor box adjustment: During training, the quality of anchor boxes is judged based on the model's loss function. If the anchor box does not match the real target box well, the parameters of the anchor box are further fine-tuned. Iterative optimization is performed during training until the loss value stabilizes or reaches a preset threshold or the number of iterations reaches the upper limit.

[0056] A further improvement or specific implementation of the aforementioned underwater target detection method, wherein 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, specifically achieved based on the following steps:

[0057] c1. Image Analysis: Analyze the dimensions of the original image, determine its aspect ratio, and decide whether proportional scaling or non-proportional scaling is required based on the image's resolution and content.

[0058] c2. Image scaling: Adjust the image size to meet the input requirements of the model; if the image size does not match the input size of the model, first scale it proportionally, and use padding techniques if necessary to avoid image distortion;

[0059] c3. Image normalization: Normalizes the pixel values ​​of an image to suit the computational needs of the model and enhance the training effect of the model;

[0060] c4. Judgment criteria: After scaling is completed, check the pixel integrity and size conformity of the image to determine whether the image scaling meets the standard; or determine the termination condition based on the number of iterations and the image distortion threshold.

[0061] In a further improvement or specific implementation of the aforementioned underwater target detection method, step six also includes an evaluation method for verifying the detection accuracy of the optimized underwater target detection model: specifically, it refers to:

[0062] The average accuracy and mean of average accuracy 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 detection precision; Re represents the model's recall level; 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 average precision, and mAP represents the mean average precision.

[0066] Its beneficial effects are as follows:

[0067] To address the aforementioned challenges, this paper proposes an improved detection model based on the YOLOv9s model. This model enhances feature extraction capabilities by integrating a dual dynamic token mixer module. Channel attention and spatial attention networks are designed, and these modules guide feature fusion, thereby improving the accuracy and real-time performance of underwater target detection. Taking into full account the unique characteristics of the underwater environment, the model's ability to identify targets in complex environments is improved by dynamically adjusting token allocation during feature extraction. Furthermore, the introduction of channel attention and spatial attention mechanisms effectively enhances feature fusion, improving the accuracy and reliability of target detection. Despite the inclusion of several improved modules, the model's weight size remains only 9.3M, ensuring its efficiency and portability. Attached Figure Description

[0068] Figure 1 This is a schematic diagram of the target detection results. Detailed Implementation

[0069] The present invention will be described in detail below with reference to specific embodiments.

[0070] The underwater target detection model and method of this application are mainly intended to address the problems of poor visibility and numerous interference factors encountered in the underwater target detection process, and to provide a solution with better detection effect, higher detection accuracy and good portability.

[0071] This application enhances feature extraction capabilities by introducing a D-Mixer module, further optimizing underwater target recognition. By designing a feature fusion network, channel attention and spatial attention mechanisms are used to enhance the importance of different feature channels and different spatial positions of feature maps, thereby optimizing and guiding feature fusion and achieving better underwater target detection results.

[0072] The following describes the specific solution. The underwater target detection model of this application has the following structure:

[0073] Based on the YOLOv9s backbone network, a generalized efficient layer aggregation network is used as the feature extraction unit, with the RepConv network as the basic convolutional module. By using RepConv as the basic convolutional module, reparameterization technology is used to further improve the feature extraction capability. A convolutional module with a stride of 2 is used to downsample and extract features from the feature map. After feature extraction and downsampling by three generalized efficient layer aggregation network modules and five ordinary convolutional modules, the feature map contains a large amount of feature information. At this point, a D-Mixer module is inserted after the 8th layer of the backbone network. Self-attention is used to increase the proportion of key feature information in the feature map, thereby improving the network's feature extraction capability. To ensure the network's generality, the input and output modules of the D-Mixer module remain consistent, without changing the dimensionality of the feature map.

[0074] The Mixer module divides the input features into two parts, which are processed separately by a global self-attention module and an input-dependent deep convolutional module (IDConv). The D-Mixer divides the input features into two parts, each undergoing 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 the input-dependent deep convolutional module (IDConv). The two outputs are then concatenated, and a Squeezed Token Enhancer is used to aggregate local tokens, effectively integrating them. Ultimately, it dynamically utilizes global and local information, injecting a large receptive field and strong inductive bias to improve the object detection module's ability to extract relational information. This simple structure allows the network to capture both global and local information simultaneously, thereby enhancing its inductive bias.

[0075] The DConv module is used to introduce inductive biases in a dynamically input-relevant manner and perform local feature aggregation. It aggregates spatial context by employing adaptive average pooling, then generates attention maps through two convolutional layers, ultimately producing input-dependent deep convolutional kernels. This module provides improved dynamic local feature encoding capabilities with higher computational efficiency.

[0076] In this application, the backbone network combines the characteristics of CSPNet and ELAN to design a generalized and efficient layer aggregation network. This network structure leverages the advantages of both CSPNet and ELAN to enhance inter-layer information flow and feature fusion. The principle is to efficiently fuse multi-scale features across different network depths through a specific aggregation mechanism. This structure fuses feature maps from different layers at multiple levels, reducing redundant computation and improving overall computational efficiency and feature representation capabilities. The feature extraction unit uses a reparameterization module (RepConv) as the basic convolutional module, further enhancing feature extraction capabilities through reparameterization. Based on the CBNet composite backbone network, an ensemble network is inserted between it and the main branch networks to achieve gradient information aggregation and flow, ensuring that deep features retain the key information required for object detection and mitigating information loss during network feedforward.

[0077] S2. Establish an optimized neck network for the underwater target detection model, specifically:

[0078] Based on the YOLOv9s neck network, the feature maps of each channel are averaged and pooled as channel average features. The GELU function is used for activation to provide non-linear transformation and help the network learn the complex distribution of the data. The sigmoid activation function is used to generate attention weights and ensure that they are between 0 and 1.

[0079] Finally, the attention weights are multiplied by the number of features at the corresponding location to obtain the LocalChannel Attention module;

[0080] The local channel attention module uses the channel relationships between features to generate a channel attention map, but replaces the activation function in it with GELU instead of ReLU;

[0081] The local spatial attention module utilizes the spatial relationships between features, separately extracting local and global features, and finally weighted fusion activation to obtain a spatial attention map; 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 average pooling of the feature map;

[0085] MLP(AvgPool(F) refers to the average activation feature of fully connected layers;

[0086] σ(MLP(AvgPool(F))) refers to applying a sigmoid mapping to average pooling;

[0087] σ([MLP(AvgPool(F));MLP(F)]) refers to obtaining spatial attention through weighted fusion activation after splicing.

[0088] In this application, the main body of the neck continues to use the path aggregation network structure of FPN+PAN, but the E-ELAN module is replaced with the GELAN layer; the output (Prediction) continues to retain the approach of including the classification, location and confidence information of the target through three different prediction boxes, and finally eliminating redundant boxes through non-maximum suppression, but the information fusion process is improved by combining the information flow of the auxiliary reversible branch.

[0089] For further improvement or specific implementation steps of the aforementioned underwater target detection model, the basic structure of the auxiliary reversible branch network module includes, in sequence: a two-level channel separation convolution block, a reversible residual block, and a cyclic asymmetric convolution enhancement network module;

[0090] The two-level channel-separating convolutional block is used to increase the receptive field of the model and improve the expressive power of features. The channel-separating convolutional block performs two operations: channel separation and convolution. Channel separation refers to dividing the input feature map into two parts according to channels, performing different convolution operations on each part, and then concatenating the results. Convolution refers to performing convolution operations on the input feature map to extract feature information. The use of depthwise separable convolution reduces the amount of computation and improves the accuracy of the model.

[0091] Reversible residual blocks utilize residual structures to ensure that information is not lost during forward propagation;

[0092] The recurrent asymmetric convolution enhancement network module captures multi-scale features in images by recurrently processing feature maps using asymmetric convolution.

[0093] This application also provides a method for underwater target detection, including the following steps:

[0094] Step 1: Establish an underwater target detection model based on the aforementioned 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 employs Mosaic data augmentation, adaptive anchor box calculation, and adaptive image scaling to preprocess the input image in order to improve the data quality of the input model.

[0096] Configure an auxiliary reversible branch to insert an ensemble network between the main branch networks to realize gradient information aggregation and flow, ensure that deep features retain the key information required for target detection, and alleviate the problem of information loss during network feedforward.

[0097] The output (Prediction) continues to include the target's classification, location, and confidence information through three different prediction boxes. Finally, redundant boxes are removed through non-maximum suppression, and the information flow of the auxiliary reversible branch is used to detect the target.

[0098] Step 2: Create a training dataset

[0099] A dataset for training, validation, and testing of an underwater target detection network is established. The dataset consists of underwater target images and their annotation information. All image samples are merged and randomly distributed proportionally to obtain a training set, a validation set, and a test set.

[0100] In this embodiment, the training and validation datasets for the object detection network are derived from the publicly accessible URPC2019 underwater object dataset. This dataset includes different categories of underwater objects, namely sea cucumbers, sea urchins, scallops, starfish, and aquatic plants, totaling 3765 training samples and 942 validation samples. Subsequently, all samples were assigned to training, validation, and test sets; this classification was used to evaluate the algorithm network and its effectiveness.

[0101] Step 3: Image Preprocessing Steps

[0102] The input process involves resizing the original image to 640x640 pixels to ensure the input size is suitable for the model's processing requirements. Next, the image pixel values ​​are normalized, scaling them from 0-255 to 0-1. Data augmentation, adaptive anchor box calculation, and adaptive image scaling are used to preprocess the input image to improve the data quality of the input model.

[0103] Data augmentation is achieved based on the following steps:

[0104] a1. Randomly select the coordinates of the image stitching reference point, and then randomly select four more images;

[0105] a2. Based on the reference point, the four images are adjusted in size and scaled proportionally, and then placed in the upper left, upper right, lower left, and lower right positions of the large image of the specified size.

[0106] a3. Based on the size transformation method of each image, map the relationship to the image tag;

[0107] a4. Based on the specified horizontal and vertical coordinates, stitch the large image together and process the coordinates of the detection boxes that exceed the boundaries.

[0108] Adaptive anchor box calculation refers to dynamically adjusting the size and proportion of anchor boxes based on the target size distribution in the training set to adapt to the characteristics of targets in different images, thereby improving the accuracy of target detection. This process is based on the following steps:

[0109] b1. Target size analysis: By analyzing the aspect ratio and distribution of targets in the training set, common target sizes are statistically identified;

[0110] Iteratively analyze the target bounding boxes in the training data and use clustering algorithms to find the most suitable anchor box size;

[0111] b2. Anchor box generation: Based on the clustering results, generate adaptive anchor box groups to ensure that these anchor boxes can cover the size of different types of targets;

[0112] b3. Anchor box adjustment: During training, the quality of anchor boxes is judged based on the model's loss function. If the anchor box does not match the real target box well, the parameters of the anchor box are further fine-tuned. Iterative optimization is performed during training until the loss value stabilizes or reaches a preset threshold or the number of iterations reaches the upper limit.

[0113] Adaptive image scaling refers to adjusting the size of the input image according to the specific needs of the image and the underwater target detection model, while minimizing distortion or loss of image information. This is achieved through the following steps:

[0114] c1. Image Analysis: Analyze the dimensions of the original image, determine its aspect ratio, and decide whether proportional scaling or non-proportional scaling is required based on the image's resolution and content.

[0115] c2. Image scaling: Adjust the image size to meet the input requirements of the model; if the image size does not match the input size of the model, first scale it proportionally, and use padding techniques if necessary to avoid image distortion;

[0116] c3. Image normalization: Normalizes the pixel values ​​of an image to suit the computational needs of the model and enhance the training effect of the model;

[0117] c4. Judgment criteria: After scaling is completed, check the pixel integrity and size conformity of the image to determine whether the image scaling meets the standard; or determine the termination condition based on the number of iterations and the image distortion threshold.

[0118] Step 4: Input Feature Extraction

[0119] The backbone network extracts features from the input image. The D-Mixer module divides the input features into two parts. One part is constrained by the global self-attention module with object self-representation attention, and the other part is processed by the input-dependent deep convolution module (IDConv). The outputs of the two parts are combined and input into the squeeze token enhancer (STE) module.

[0120] Step 5: Attention Mechanism and Channel Attention Feature Map Generation

[0121] Channel attention adjustment and channel attention feature map generation are completed based on the neck network. The local spatial attention module is introduced to the back of the 11th, 14th and 16th layers of the network, and the local channel attention module is introduced to the back of the 19th, 23rd and 27th layers of the network.

[0122] The local channel attention module generates a channel attention feature map by utilizing the inter-channel relationships of the features;

[0123] The local spatial attention module utilizes the spatial relationships between features to extract and integrate local and global features through a weighted fusion activation process to achieve spatial attention.

[0124] Step Six: Training and Optimization of Underwater Target Detection Model

[0125] The training and validation sets from the target dataset in step two are fed into the underwater target detection model constructed in steps four and five for training, thereby obtaining the optimal training weights.

[0126] To facilitate the assessment of the optimized model's quality and training progress, this embodiment also includes an evaluation method for verifying the detection accuracy of the optimized underwater target detection model: specifically, it refers to:

[0127] The average accuracy and mean of average accuracy 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 detection precision; Re represents the model's recall level; 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 average precision, and mAP represents the mean average precision.

[0131] Based on the above evaluation indicators, the detection results of the improved underwater target detection method are compared with those of the original YOLOv9s model. The results show that the improved YOLOv9s model performs 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: Perform target detection based on the trained underwater target detection model.

[0135] The underwater target image to be detected is fed into a trained, improved underwater target detection model to complete the target detection. For example... Figure 1 As shown, the detection results include the underwater target's category, confidence level, and location.

[0136] Further analysis reveals that the improved model demonstrates significant improvements over the original YOLOv9s model in detection results across different categories. It is able to detect some element categories that the original network struggles to detect, indicating that the improved network performs better in feature extraction and enhancement. The accuracy for unclassified detection is significantly improved, showing a marked improvement in feature recognition and localization capabilities across categories. At the same time, it effectively reduces duplicate detections of some categories, thus providing a more effective means to handle overlapping or dense objects and reducing false positives or duplicate detections.

[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit the scope of protection of the present invention. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the essence and scope of the technical solutions of the present invention.

Claims

1. An underwater target detection model, characterized in that, The specific structure is as follows: YOLOv9s backbone network is taken as a basis, and a generalized efficient layer aggregation network is taken as a feature extraction unit, wherein a basic convolution module is a RepConv network; a convolution module with a step of 2 is used to realize feature map downsampling and feature extraction, and feature extraction and downsampling are performed 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, the proportion of key feature information in the feature map is increased by using self-attention, and the feature extraction capability of the network is improved, the input and output modules of the D-Mixer module are kept consistent to maintain the size of the feature map dimension; the D-Mixer module divides the input features into two parts, processes them through a global self-attention module and a deep convolution module dependent on the input respectively, then connects the two outputs together, and realizes local token aggregation through a compression token enhancement module; The IDConv module is used to introduce inductive bias in a dynamic input related manner and perform local feature aggregation; The IDConv module aggregates spatial context by using an adaptive average pool, then generates an attention map through two convolution layers, and finally generates a deep convolution kernel dependent on the input; YOLOv9s neck network is taken as a basis, the feature map in each channel is average-pooled as a channel average feature, a GELU function is used for activation to provide a nonlinear transformation and help the network learn the complex distribution of data, and a sigmoid activation function is used to generate attention weights and ensure that the attention weights are located between 0 and 1; Finally, the attention weights are multiplied by the corresponding position feature number to obtain a local channel attention mechanism module; The local channel attention mechanism module generates a channel attention map by using the channel relationship between features, but replaces the activation function in the channel attention map with GELU instead of ReLU; The local spatial attention module uses the spatial relationship between features to finally obtain a spatial attention map by weighting and fusing the activations of local and global features respectively; the calculation processes of the channel attention map and the spatial attention map are as follows: Channel attention map: ; spatial attention map: ; wherein denotes an average pooling of the feature map; is referred to as the fully connected layer activation average feature; denotes sigmoid mapping of the average pooling; is referred to as concatenating and then obtaining spatial attention by weighted fusion and activation; The output end contains classification, position and confidence information of the target through three different prediction boxes, and finally redundant boxes are removed through non-maximum suppression, and the information flow of the auxiliary reversible branch is used to improve the information fusion process; The basic structure of the auxiliary reversible branch comprises, in sequence, 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 expression ability of the features; the channel separation convolution block completes two operations: channel separation and convolution; wherein the channel separation refers to separating the input feature map into two parts according to the channel, performing different convolution operations on the two parts respectively, and then splicing the results; wherein the convolution refers to performing convolution operation on the input feature map to extract feature information, and deep separable convolution is used to reduce the amount of calculation and improve the accuracy of the model; The reversible residual block uses a residual structure to ensure that the information of forward propagation is not lost; The cyclic asymmetric convolution enhancement network module captures multi-scale features in the image by cyclic processing of the feature map in an asymmetric convolution manner.

2. An underwater target detection method based on the underwater target detection model of claim 1, characterized in that, It comprises the following steps: Step one, establish an underwater target detection model An underwater target detection model network is established based on a YOLOv9s model, 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; An auxiliary reversible branch (Auxiliary Reversible Branch) is configured to insert an integrated network between the main branch network to realize gradient information aggregation and flow, ensure that the deep features retain the key information required for target detection, and alleviate the information loss problem in the network feedforward process; The output end (Prediction) continues to include the classification, position, 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 two, build a data set A data set for training, verifying, and testing the underwater target detection network is established, which is composed of underwater target images and their labeled information; all image samples are randomly allocated in proportion to obtain a training set, a verification set, and a test set; Step three, image preprocessing step The input end resizes the original image to 640x640 to ensure that the input size meets the processing requirements of the model; then normalizes the image pixel values, scaling the pixel values from 0-255 to 0-1; data enhancement, adaptive anchor box calculation, and adaptive image scaling are used to preprocess the input image to improve the data quality of the input model; Step four, input feature extraction Based on the backbone network, the features of the input image are extracted, and the D-Mixer module is used to divide the input features into two parts, 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; the output results of the two parts are combined and input into the squeeze token enhancer module; Step five, attention mechanism and channel attention feature map generation Based on the neck network, the channel attention adjustment and channel attention feature map generation are completed, the local spatial attention module is introduced to the back side of the 11th, 14th, and 16th layers of the network, and the local channel attention module is introduced to the back side of 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 the features; The local spatial attention module uses the spatial relationship between features to extract and integrate local and global features through a weighted fusion activation process to realize spatial attention; Step six, underwater target detection model training and optimization Step six, training the underwater target detection model based on the training data set in step two and the validation set in step three, and obtaining the optimal training weight; Step seven, testing the underwater target detection model based on the training weight Step eight, testing the improved underwater target detection model based on the test data set in step four.

3. The underwater target detection method according to claim 2, characterized in that, The data enhancement is implemented based on the following steps: a1. Randomly select the picture splicing reference point coordinates, and randomly select four pictures; a2. After adjusting the size and scaling the four pictures according to the reference points, place them in the upper left, upper right, lower left, and lower right positions of the large picture with the specified size; a3. According to the size transformation of each picture, the mapping relationship is corresponded to the picture label; a4. According to the specified horizontal and vertical coordinates, the large picture is spliced, and the detection box coordinates exceeding the boundary are processed.

4. The underwater target detection method according to claim 2, 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, so as to adapt to the characteristics of the target in different images and improve the accuracy of target detection; this process is based on the following steps: b1. Target size analysis: by analyzing the width-height ratio and distribution of targets in the training set, the common target size is counted; Iterative analysis of target bounding box in training data, using clustering algorithm to find the most suitable anchor box size; b2. Anchor box generation: according to the clustering results, generate adaptive anchor box group to ensure that these anchor boxes can cover different types of target size; b3. Anchor box adjustment: in the training process, the anchor box quality is judged based on the loss function of the model, if the anchor box and the real target box do not match well, the parameters of the anchor box are further adjusted; iterative optimization is performed during training until the loss value is stable or reaches the preset threshold or the iteration number reaches the upper limit.

5. The underwater target detection method of claim 2, wherein, The adaptive picture scaling refers to adjusting the size of the input image according to the specific needs of the image and the underwater target detection model, while trying to avoid distortion or loss of image information, which is implemented based on the following steps: c1. Image analysis: analyze the size of the original image to determine its aspect ratio, and decide whether to scale proportionally or non-proportionally according to the resolution and content of the image; c2. Picture scaling: adjust the image size to meet the input requirements of the model; if the image size does not match the model input size, first perform proportional scaling, and if necessary, use padding technology to avoid image distortion; c3. Image normalization: normalize the image pixel value to adapt to the model's calculation needs and enhance the model's training effect; c4. Judgment standard: after scaling, check the pixel integrity and size compliance of the image to determine whether the image scaling meets the requirements; or determine the termination condition according to the iteration number and image distortion threshold.

6. 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, Use the average precision and average precision mean to judge whether the trained underwater target detection model meets the requirements; The calculation formula is as follows: ; ; ; ; where Pr denotes the precision of detection; Re denotes 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 classes detected; i is an integer and ; AP represents the average precision, and mAP represents the mean average precision.