Underwater target detection method based on YOLOv8
By improving the underwater target detection method of YOLOv8, using the RFCF module, SD-Head and WIS-IoU loss functions, the problems of deformation and background complexity in underwater target detection are solved, and the detection accuracy and robustness are improved, especially the detection effect of small targets and fuzzy targets.
Patent Information
- Application Number
- CN202510312940.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-07-04
AI Technical Summary
When facing complex underwater environments, existing underwater target detection methods have problems such as serious target deformation, complex background, and dense targets, resulting in insufficient detection accuracy and robustness, especially poor detection effects for small and fuzzy targets.
采用基于YOLOv8的改进方法,通过构建感受野卷积融合模块RFCF、平滑动态检测头SD-Head和WIS-IoU损失函数,增强模型对水下目标的特征提取能力和检测精度。 Specific steps include: constructing an underwater image dataset, introducing the receptive field attention convolution module RFCF, designing a smooth dynamic detection head SD-Head, and optimizing the model using the WIS-IoU loss function.
It improves the accuracy and robustness of underwater target detection, especially the detection capabilities of small targets and fuzzy targets, which can better adapt to the complex deformation and background interference of the underwater environment, and improves the accuracy and stability of the detection.
Smart Images

Figure CN120259860A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of object detection, and mainly relates to an underwater object detection method based on YOLOv8. Background Technique
[0002] Underwater object detection plays an important role in many key fields such as marine ecological protection, resource development, and archaeological exploration. However, due to the absorption and scattering of light by the water environment, the image contrast decreases and the detailed information is lost, making the image blurred. In addition, the light refraction caused by water body fluctuations will distort the shape and size of the target, further reducing the accuracy of object detection. At the same time, the high-density aggregation characteristics of underwater organisms increase the difficulty of the detection task. Therefore, carrying out high-precision underwater object detection research has important theoretical and application values.
[0003] With the development of deep learning technology, object detection algorithms have made remarkable progress. Detection methods based on deep learning use Convolutional Neural Network (CNN) to automatically learn image features and complete object recognition. Current object detection algorithms are mainly divided into single-stage detection and two-stage detection. Single-stage detection methods (such as the YOLO series) directly extract information from the image feature map and perform object localization, with a relatively fast inference speed; two-stage detection methods (such as Faster R-CNN) first generate candidate regions and then perform fine classification and position regression, with relatively high detection accuracy. In addition, the application of Transformer in computer vision has made detection methods based on global attention mechanisms gradually attract attention, which can effectively capture the context information of the target and improve the detection ability in complex scenarios.
[0004] For underwater object detection, scholars at home and abroad have proposed a series of improvement schemes. For example, the dynamic YOLO detector fuses different scale features through channel, scale, and spatial attention to enhance the small object detection ability; the improved CenterNet introduces a bottleneck attention module to enhance feature expression in the spatial and channel dimensions and improve the detection accuracy; automatic color level combines a bidirectional feature fusion strategy to improve the recognizability of underwater blurred images; Faster R-CNN based on the adversarial attention mechanism adopts three-stage training to enhance the detection ability for occluded targets and optimizes feature extraction through a multi-scale pooling branch. These methods have achieved certain results in improving the performance of underwater object detection, but there are still certain limitations in the face of problems such as serious target deformation, complex background, and dense targets in underwater scenes. These limitations include that the convolutional operation with a fixed receptive field is difficult to adapt to the complex deformation of underwater targets; the traditional detection head has insufficient feature response to blurred targets, resulting in a high missed detection rate for small targets; the loss function does not fully balance the localization accuracy and shape consistency, affecting the detection effect of complex targets.
[0005] To solve the above problems, this paper optimizes based on YOLOv8 and proposes an underwater target detection method based on YOLOv8. Aiming at the problems of deformation, blurring of underwater targets and the difficulty of detecting small targets, targeted improvements are made to improve the detection accuracy and robustness. Summary of the Invention
[0006] In view of this, the technical problem to be solved by the present invention is to provide an underwater target detection method based on YOLOv8, which can improve the detection accuracy of the model for underwater targets in a complex underwater environment.
[0007] To achieve the above object, the present invention provides the following technical solutions:
[0008] An underwater target detection method based on YOLOv8, which specifically includes the following steps:
[0009] Step 1) Construct an underwater image dataset, preprocess the images in the dataset, annotate the position information and category of the targets, and generate a high-quality training sample set;
[0010] Step 2) Input the preprocessed images into the improved target detection model, extract features of the underwater images through the improved backbone network, design a Receptive Field Convolutional Fusion (RFCF) module, and improve the multi-scale adaptation ability of the original C2F (channel to pixel) module from two aspects: adjusting the receptive field range and aggregating feature randomness, so as to enhance the feature extraction ability for underwater targets;
[0011] Step 3) Input the fused high-quality feature maps into the improved detection head, design a Smoothed Dynamic Detection Head (SD-Head), enhance the feature extraction ability of the detection head for blurred targets and small targets by introducing the multi-scale attention mechanism of DyHead and the smoothing characteristics of the Softplus activation function, process the feature maps, locate the positions of the targets and determine the categories, thereby completing the detection of the targets;
[0012] Step 4) The model further performs error calculation and parameter optimization. A WIS-IoU loss function is designed. The quality of the anchor boxes is evaluated through the dynamic non-monotonic focusing mechanism of Wise-IoU. Shape-IoU considers the shape and scale information of the target boxes, and then introduces the concept of Inner-IoU to assist the bounding boxes, balancing the localization accuracy and shape consistency, more accurately evaluating the model, guiding the training and optimization of the model, and obtaining the optimal target detection result.
[0013] Furthermore, step 1) specifically includes the following steps:
[0014] Step 11) Obtain underwater image data, download the dataset URPC of the public underwater target detection optical competition, which covers different water environments and lighting conditions, and perform data cleaning to remove waterweeds and pictures with illogical marked x and y;
[0015] Step 12) Preprocess the obtained dataset, including image normalization, size adjustment, color correction, etc., construct a high-quality training sample set, and convert the original label file into YOLO format for model training.
[0016] Furthermore, step 2) specifically includes the following steps:
[0017] Step 21) Input the preprocessed underwater image into the target detection backbone network improved based on YOLOv8. Improve C2f in the backbone feature extraction network to the RFCF module, and introduce the receptive field attention convolution (RFAConv) module. The RFAConv module dynamically adjusts the action range of the convolution kernel through the receptive field attention mechanism, enabling the model to adaptively adjust the receptive field size according to the scale and shape of the target, thereby achieving efficient capture of fine-grained local features.
[0018] Furthermore, step 3) specifically includes the following steps:
[0019] Step 31) Input the fused high-quality feature map into the improved detection head. Design the improved SD-Head detection head based on the Dynamic Head (DyHead), which retains the core structure of DyHead, an object detection head framework based on the attention mechanism, aiming to unify the object detection head and the attention mechanism. By coherently combining the multi-head self-attention mechanism within the scale-aware feature layer, the space-aware spatial position, and the task-aware output channels, the detection ability of the model for small targets and dense scenes is optimized;
[0020] Step 32) On the basis of the DyHead module, introduce the Softplus activation function to replace the original ReLU activation function to construct the SD-Head detection head. Softplus has a smoother non-linear characteristic. Compared with ReLU, its output is more continuously differentiable in the region close to zero, which shows better feature capture ability when dealing with fuzzy features. The class, bounding box, and confidence output of each prediction box are obtained through the improved detection head.
[0021] Furthermore, step 4) specifically includes the following steps:
[0022] Step 41) Compare the output of the detection head with the true label and calculate the loss function. The model will use the WIS-IoU loss function for error calculation and parameter optimization. The dynamic non-monotonic focusing mechanism of Wise-IoU suppresses the negative impact of low-quality samples, and Shape-IoU is used to calculate the width-to-height ratio difference and the center point distance to optimize the shape fitting effect of the bounding box. The concept of Inner-IoU is introduced to assist the bounding box, enabling the model to adaptively select an appropriate scale according to the characteristics of the target.
[0023] Step 42) After the optimization of the loss function and parameter update, the model gradually improves the accuracy of object detection during training. After multiple rounds of training, the model outputs the category, location, and confidence of each object, and redundant bounding boxes are removed through post-processing methods such as non-maximum suppression to obtain the final object detection result. Description of the Drawings
[0024] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings, where:
[0025] Figure 1 is the flowchart of the present invention;
[0026] Figure 2 is the overall model framework diagram of the present invention;
[0027] Figure 3 is the structural diagram of the RFAConv module mentioned in the present invention;
[0028] Figure 4 is the structural diagram of the RFCF module proposed by the present invention;
[0029] Figure 5 is the structural diagram of the SD-Head module proposed by the present invention. Detailed Embodiments
[0030] To make the technical solutions, advantages, and objectives of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and the accompanying drawings.
[0031] An underwater object detection method based on YOLOv8 provided by the present invention, the method flowchart is as Figure 1 shown, the overall model framework diagram proposed by this method is as Figure 2 shown, and the method includes the following steps:
[0032] Step 1) Construct an underwater image object detection dataset;
[0033] Step 2) Construct a receptive field convolutional fusion module (RFCF);
[0034] Step 3) Construct a Smooth Dynamic Detection Head module (SD-Head);
[0035] Step 4) Design the WIS-IoU loss function;
[0036] Step 5) Construct an underwater target detection network based on YOLOv8;
[0037] Step 6) Train the target detection network;
[0038] Step 7) Test the target detection network.
[0039] Furthermore, the specific content of Step 1) includes the following steps:
[0040] Step 11) Use the underwater biological image targets obtained from the publicly available dataset URPC. This dataset contains a large number of underwater images, covering four types of underwater organisms: sea cucumbers, sea urchins, scallops, and starfish, with 5543 training sets and 2000 test sets. Clean the URPC data, removing waterweeds and images with illogical x and y annotations;
[0041] Step 12) Preprocess the cleaned dataset, including image normalization, size adjustment, and color correction, to construct a high-quality training sample set, and convert the original label file into an annotation file in YOLO format to ensure that the data is suitable for model training.
[0042] Furthermore, the specific content of Step 2) includes the following steps:
[0043] Step 21) Combine the attachment Figure 2 Detailed description: During the underwater image imaging process, the light corresponding to different objects passes through multiple media with different refractive indices during propagation. At the same time, affected by complex environmental factors such as water flow and light, the underwater images will undergo varying degrees of deformation. To solve this problem, the RFAConv module is introduced to improve the performance of underwater target detection. The RFAConv module dynamically adjusts the effective range of the convolution kernel through the receptive field attention mechanism, enabling the model to adaptively adjust the receptive field size according to the scale and shape of the target, thereby achieving efficient capture of fine-grained local features and global context information. Compared with traditional convolution, RFAConv exhibits more flexible and efficient characteristics. In terms of design, RFAConv uses Group Conv to efficiently extract receptive field spatial features, and at the same time aggregates global information through AvgPool to achieve the fusion of global and local features. Subsequently, 1×1 Group Conv is used for lightweight information interaction to effectively reduce the computational complexity. Finally, further feature extraction is performed through 1×1 convolution to reduce the number of parameters while retaining key information. The calculation of RFA can be expressed as:
[0044] F = Softmax(g i×i (AvgPool(x))) × ReLU(Norm(g k×k (x))) = A rf × F rf
[0045] where g i×i represents grouped convolution of size i×i, k represents the size of the convolution kernel, Norm represents normalization, x represents the input feature map, and F is obtained by multiplying the attention map A rf with the transformed receptive field spatial feature F rf ;
[0046] Step 22) Incorporate RFAConv into C2f for improvement to obtain the RFCF module. The module retains the multi-branch characteristics of C2f. The input feature map is divided into two parts through the split operation. One part directly performs a short-circuit connection, and the other part undergoes deep feature extraction through a series of Bottleneck_RFAConv stacking layers (with a quantity of n). Finally, all branch features are merged and output through the ConvBN activation function. The introduction of the RFCF module enables the model to perform more excellently in underwater target detection tasks. Such a design enables the model to more accurately extract key information when detecting underwater targets with complex shapes and imaging deformations, while reducing the impact of environmental interference.
[0047] Furthermore, step 3) specifically includes the following steps:
[0048] Step 31) Combine the appendix Figure 3Detailed description: The DyHead module can more effectively extract the features of underwater small targets and blurred targets through the scale-aware and spatial-aware attention mechanisms. DyHead adopts dynamic deformable convolution (DyDCNv2) to enhance the feature expression ability at different spatial positions. For each input feature map, first, an offset and a mask are predicted through a convolutional layer, and then these offsets are used to perform deformable convolution transformation on the original features to adapt to targets of different shapes and scales. The spatial attention acts on the features at three different scales. The high-level features extract the spatial information from the higher-level features; the middle-level features extract the spatial information of the current level for processing. The low-level features extract the spatial information from the lower-level features. The results of these spatial transformations are fused in the subsequent stages to enhance the feature expression ability. To effectively fuse multi-scale features, DyHead designs a scale attention mechanism. First, global average pooling (AdaptiveAvgPool2d) is performed on the feature map, and then a weight coefficient is calculated through a 1×1 convolutional layer and the ReLU activation function. Finally, it is normalized by HSigmoid. This weight coefficient is used to adjust the contributions of features at different scales, enabling the model to adaptively adjust the weights of features according to the sizes of different targets. DyHead adopts DyReLU (Dynamic ReLU) as the task attention module. DyReLU allows the model to dynamically adjust the activation function between different tasks (such as classification, regression, etc.), enabling the features of different tasks to be better optimized.
[0049] During the forward propagation process, the features of each level not only depend on themselves but also interact with the features of adjacent levels. The features of the current layer are adjusted through dynamic convolution and scale attention; the low-level features are subjected to dynamic convolution and then fused with the features of the current layer after being adjusted by scale attention; the high-level features are first upsampled (bilinear interpolation), then subjected to dynamic convolution, and then fused with the features of the current layer after being adjusted by scale attention. Finally, all the fused features are further adjusted through the task attention module (DyReLU) to form the final detection features. To make the learning of the offsets more stable, DyHead adopts zero initialization of the offsets to ensure that the network does not undergo excessive deformation in the initial stage. The weights of all convolutional layers are initialized with a normal distribution to ensure the stability of training;
[0050] Step 32): Based on the DyHead module, a Softplus activation function is introduced to replace the original ReLU activation function to construct the SD-Head detection head, where:
[0051] ReLU(x) = max(0, x)
[0052] Softplus(x) = log2(1 + ex )
[0053] Softplus still has small output values and gradients in the negative interval, thus maintaining the activity of neurons and improving the stability of the training process. In addition, Softplus has a smoother non-linear characteristic. Compared with ReLU, its output is more continuously differentiable in the region near zero. Therefore, when dealing with fuzzy targets and small targets, the model can better capture their subtle features and improve the detection accuracy.
[0054] Furthermore, the specific content of step 4) includes the following steps:
[0055] Step 41): The WIS-IoU loss function introduces three loss functions, namely Inner-IoU, Wise-IoU, and Shape-IoU, to better balance the localization accuracy and shape consistency, effectively improving the overall performance of underwater target detection.
[0056] Wise-IoU uses "outlier degree" to replace IoU to evaluate the quality of anchor boxes through a dynamic non-monotonic focusing mechanism and provides a wise gradient gain allocation strategy. This strategy reduces the competitiveness of high-quality anchor boxes while also reducing the harmful gradients generated by low-quality examples. In this paper, the loss function is improved based on Wise-IoU v3, and the calculation formula of Wise-IoU v3 is as follows:
[0057]
[0058] L WIoUv3 =rR WIoU L IoU
[0059] where the variables in R WIoU are defined as follows: x and y are the expected center coordinates of the predicted box, and x gt , y gt are the center coordinates of the actual box. W g , H g represent the sizes of the GT box respectively. r represents the non-monotonic focusing coefficient, δ and α are hyperparameters for adjusting to different models, β is the outlier, and L * IoU is the monotonic focus coefficient.
[0060] Inner-IoU considers the particularity of the target and flexibly uses supplementary bounding boxes of different scales for different samples, improving the regression convergence efficiency. By using smaller auxiliary bounding boxes for samples with high IoU and larger auxiliary bounding boxes for samples with low IoU, the generalization ability of the model to complex samples is enhanced. The calculation formula of Inner-IoU is as follows:
[0061]
[0062]
[0063]
[0064]
[0065] Among them, the GT box and the anchor box are denoted as b gt and b, represents the center point of the GT box, and (x c , y c ) represents the center point of the anchor box. The widths and heights of the GT box and the anchor box are w gt 、h gt and w, h respectively. The variable ratio is a scale factor, and its usual value range is [0.5, 1.5].
[0066] Shape-IoU focuses on the matching degree of the target shape, taking into account the aspect ratio of the target box and the center point offset, to ensure that the model not only pays attention to the position of the target, but also pays attention to its shape consistency. The formula of Shape-IoU is as follows:
[0067]
[0068] L shape-IoU = 1 - IoU + d shape + 0.5Ω shape
[0069] where scale represents the scale factor, which is related to the scale of the defects in the dataset. In addition, "ww" and "hh" represent the weight coefficients in two directions respectively, and their values are determined by the shape of the ground truth box.
[0070] Design the WIS-IoU loss function by combining the advantages of the above-mentioned Wise-IoU, Shape-IoU, and Inner-IoU. First, Wise-IoU uses the "degree of outlier" to evaluate the quality of anchor boxes through a dynamic non-monotonic focusing mechanism, dynamically focusing on high-quality samples and suppressing the negative impact of low-quality samples. This is particularly important when dealing with the detection of low-contrast and blurred targets in the underwater environment, helping to reduce the interference of noise samples on the model performance. Second, Shape-IoU improves the localization accuracy by considering the shape and scale information of the target box. In underwater target detection, due to the complex and variable shapes and significant size differences of targets, the shape similarity constraint is crucial for accurately fitting the target boundary, especially when detecting small targets and targets with special shapes. Finally, Inner-IoU introduces the concept of an auxiliary bounding box, enabling the model to adaptively select an appropriate scale according to the characteristics of the target. This is particularly important in underwater target detection tasks because underwater targets often have significant scale differences, and the model needs to be flexibly adjusted to effectively cope with these changes. The final WIS-IoU calculation formula is as follows:
[0071] L WIS-IoU = r(1 - IoU inner + d shape + 0.5Ω shape )
[0072] Furthermore, the specific content of step 5) includes the following steps:
[0073] Step 51): Use the receptive field convolution fusion module constructed in the above steps, smooth the dynamic detection head module and the WIS-IoU loss function, improve the YOLOv8 network structure, and form the underwater target detection network proposed by the present invention;
[0074] Furthermore, the specific content of step 6) includes the following steps:
[0075] Step 61): Load the preprocessed multi-underwater image dataset into the target detection network architecture, deploy the training environment and define hyperparameters, and perform the end-to-end model optimization task;
[0076] Step 62): This experiment is carried out on the Windows 11 operating system, equipped with an Intel 12th generation Core i5-12600KF processor, the main memory is 32GB, a deep learning computing platform is constructed based on the PyTorch 2.2.2 architecture, and the programming language is Python 3.10.14;
[0077] Step 63) In the configuration of training parameters, the SGD is used as the optimization function to train the model during the training phase. The training period is 300 epochs, the initial learning rate is set to 0.01, the momentum is set to 0.973, and the number of samples for single training is 16.
[0078] Further, step 7) specifically includes the following steps:
[0079] Step 71) Load the trained weight file into the object detection network, randomly select pictures from the test dataset for detection, and return the annotated pictures with the position and category information of the objects to be detected.
[0080] The above embodiments are intended to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that modifications or equivalent replacements can still be made without departing from the core idea and scope of the technical solutions of the present invention, and these adjustments should be covered within the scope of the claims of the present invention.
Claims
1. An underwater target detection method based on YOLOv8, characterized in that, It includes the following steps: Step 1: Construct a dataset of small underwater organisms and preprocess the dataset. Use the underwater biological image targets obtained from the public dataset URPC. This dataset contains a large number of underwater images, covering four types of underwater organisms: sea cucumbers, sea urchins, scallops, and starfish, including 5543 training sets and 2000 test sets. Clean the URPC data, removing waterweeds and images with illogical x and y annotations. Preprocess the cleaned dataset, including image normalization, size adjustment, and color correction, to construct a high-quality training sample set, and convert the original label file into an annotation file in YOLO format to ensure that the data is suitable for model training; Step 2: Construct a receptive field convolutional fusion module. Improve the C2f in the backbone feature extraction network to a receptive field convolutional fusion (RFCF) module, introduce the RFAConv module, and dynamically adjust the scope of the convolutional kernel through the receptive field attention mechanism, enabling the model to adaptively adjust the receptive field size according to the scale and shape of the target, thereby achieving efficient capture of fine-grained local features. The RFCF module processes the input data in two branches. One branch is directly passed to the output, and the other branch is processed through multiple Bottleneck modules that fuse RFAConv. Finally, the features of different branches are concatenated in the channel dimension to achieve feature fusion. The concatenated features contain information from different branches, enriching the feature expression ability, and the RFCF module can effectively extract the features of underwater deformed targets; Step 3: Construct a smooth dynamic detection head module. The SD-Head detection head is constructed based on the dynamic detection head DyHead, adopting an object detection head framework with an attention mechanism, aiming to unify the object detection head and the attention mechanism. By coherently combining the multi-head self-attention mechanism within the scale-aware feature layer, the space-aware spatial position, and the task-aware output channels, the detection ability of the model for small targets and dense scenes is optimized. On the basis of the DyHead module, introduce the Softplus activation function to replace the original ReLU activation function to construct the SD-Head detection head. Softplus has a smoother non-linear characteristic. Compared with ReLU, its output is more continuously differentiable in the region close to zero, which shows better feature capture ability when dealing with fuzzy features. The class, bounding box, and confidence output of each prediction box are obtained through the improved detection head; Step 4, design the WIS-IoU loss function: First, Wise-IoU uses "outlier degree" to evaluate the quality of anchor boxes through a dynamic non-monotonic focusing mechanism, dynamically focusing on high-quality samples and suppressing the negative impact of low-quality samples, which is particularly important when dealing with the detection of low-contrast and blurred targets in the underwater environment, and helps to reduce the interference of noise samples on the model performance. Second, Shape-IoU improves the localization accuracy by considering the shape and scale information of the target box. In underwater target detection, due to the complex and variable shapes and significant size differences of targets, the shape similarity constraint is crucial for accurately fitting the target boundary, especially when detecting small targets and targets with special shapes. Finally, Inner-IoU introduces the concept of an auxiliary bounding box, enabling the model to adaptively select an appropriate scale according to the characteristics of the target. The WIS-IoU loss function can better handle the diversity of target scales, shapes, and internal features in the underwater target detection task, thus achieving higher-precision target localization and detection; Step 5, construct an underwater target detection network based on YOLOv8: Use the receptive field convolutional fusion module, smooth dynamic detection head module, and WIS-IoU loss function constructed in the above steps to improve the YOLOv8 network structure and form the underwater target detection network proposed by the present invention; Step 6, train the target detection network model: Input the dataset into the target detection network model, configure the Windows 11 operating system and the PyTorch 2.2.2 deep learning framework, and build a training environment based on Python 3.10.14 and CUDA 12.
1. During the training phase, use SGD as the optimization function to train the model for 300 epochs, set the initial learning rate to 0.01, the momentum to 0.973, and the number of samples per training to 16 to ensure efficient convergence of the model and improve the detection performance, and fully train the underwater target detection network based on YOLOv8 to obtain the weights of the trained network model; Step 7, test the target detection network model: Load the trained weight file into the target detection network, randomly select samples from the test set for inference, and output the detection result image marked with the target position and class information. Evaluate the target detection performance of the model in the underwater image dataset, including detection accuracy, inference speed, and overall average precision.
2. The underwater target detection method according to claim 1, characterized in that, The receptive field convolution fusion module constructed in step 2. This module introduces RFAConv, which dynamically adjusts the scope of action of the convolution kernel through the receptive field attention mechanism, enabling the model to adaptively adjust the receptive field size according to the scale and shape of the target, thereby achieving efficient capture of fine-grained local features and global context information. RFAConv uses Group Conv to efficiently extract receptive field spatial features, and at the same time aggregates global information through AvgPool to achieve the fusion of global and local features. Subsequently, 1×1 Group Conv is used for lightweight information interaction, effectively reducing the computational complexity. Finally, further feature extraction is performed through 1×1 convolution, retaining key information while reducing the number of parameters. The calculation of RFA is as follows: F = Softmax(g i×i (AvgPool(x))) × ReLU(Norm(g k×k (x))) = A rf × F rf where g i×i represents grouped convolution of size i×i, k represents the size of the convolution kernel, Norm represents normalization, x represents the input feature map, and F is the attention map A rf multiplied by the transformed receptive field spatial feature F rf to obtain the result. Integrate RFAConv into C2f for improvement to obtain the RFCF module. The module retains the multi-branch characteristics of C2f, divides the input feature map into two parts through the split operation, one part directly performs a shortcut connection, and the other part passes through a series of Bottleneck_RFAConv stacked layers (with a quantity of n) for deep feature extraction. Finally, all branch features are merged through concat and output through the ConvBN activation function. The introduction of the RFCF module makes the model perform more excellently in dealing with underwater target detection tasks. Such a design enables the model to more accurately extract key information when detecting underwater targets with complex shapes and imaging deformations, while reducing the impact of environmental interference.
3. The underwater target detection method according to claim 1, wherein, The smooth dynamic detection head module constructed in step 3. This module uses dynamic deformable convolution (DyDCNv2) to enhance the feature expression ability at different spatial positions. For each input feature map, first, a convolutional layer is used to predict the offset and mask, and then these offsets are used to perform deformable convolution transformation on the original features to adapt to targets of different shapes and scales. Spatial attention acts on features at three different scales, and high-level features extract Spatial information from higher-level features; Mid-level features extract spatial information processing at the current level. Low-level features extract spatial information from lower-level features. The results of these spatial transformations are fused in subsequent stages to enhance the feature expression ability. To effectively fuse multi-scale features, a scale attention mechanism is designed. First, global average pooling is performed on the feature map, then a weight coefficient is calculated through a 1×1 convolutional layer and the Softplus activation function, and finally, HSigmoid normalization is performed. This weight coefficient is used to adjust the contribution of features at different scales, enabling the model to adaptively adjust the weights of features according to the size of different targets. During the forward propagation process, the features at each level not only depend on themselves but also interact with the features at adjacent levels. The features of the current layer are adjusted through dynamic convolution and scale attention; After the low-level features pass through dynamic convolution and are adjusted through scale attention, they are fused with the features of the current layer; The high-level features are first upsampled, then dynamically convolved, and after being adjusted by scale attention, they are fused with the features of the current layer. Finally, all the fused features are further adjusted by the task attention module to form the final detection features. To make the learning of the offset more stable, SD-Head adopts zero initialization of the offset to ensure that the network will not undergo excessive deformation in the initial stage. The weights of all convolutional layers are initialized with a normal distribution to ensure the stability of training. The SD-Head detection head is particularly suitable for multi-scale object detection in underwater scenarios, capable of more effectively capturing the features of small and blurred objects, while maintaining a high detection accuracy and robustness in complex environments.
4. The underwater target detection method according to claim 1, wherein Step 4 designs the WIS-IoU loss function. The WIS-IoU loss function optimizes the accuracy of underwater object detection by introducing three different loss calculation methods, namely Inner-IoU, Wise-IoU, and Shape-IoU. Among them, Wise-IoU adopts a dynamic non-monotonic focusing mechanism to measure the quality of the anchor box by evaluating the deviation degree between the predicted box and the true target box, and adjusts the distribution strategy of the gradient gain. This strategy reduces the influence of low-quality samples and suppresses the excessive competition among high-quality anchor boxes, thus improving the learning effect of the model. Inner-IoU mainly targets objects of different scales and adopts an auxiliary bounding box mechanism, using smaller auxiliary boxes for objects with high-quality matches and larger auxiliary boxes for objects with lower matching degrees to optimize the regression convergence speed. This mechanism enhances the generalization ability of the model for complex samples, enabling it to more stably detect objects of different scales. Shape-IoU focuses on the matching degree of the object shape, considering the aspect ratio of the target box and the offset of the center point to ensure that the model not only pays attention to the position of the target but also to its shape consistency. This method is particularly suitable for detecting objects with large shape variations or small scales, improving the adaptability of the model to complex underwater environments. Finally, the WIS-IoU calculation formula is obtained as follows: L WIS-IoU = r(1 - IoU inner + d shape + 0.5Ω shape ) The WIS-IoU loss function combines the quality evaluation ability of Wise-IoU, the scale adaptability ability of Inner-IoU, and the shape matching optimization ability of Shape-IoU, enabling the model to more accurately detect and identify targets in complex underwater scenarios, improving the detection accuracy and stability.
Citation Information
Cited By
Underwater small biological target detection method and system based on deep learning
CN121033649A
ICW-YOLO-based lightweight high-efficiency warehouse logistics environment target detection method
CN121095548A
An ICW-YOLO-based lightweight and efficient warehouse logistics environment target detection method
CN121095548B
Digital twin screw hole positioning and tracking method based on improved YOLOv8-Seg drive
CN121170011A
Infrared target detection method based on bidirectional receptive field attention feature network
CN121305046A
