Underwater target detection method and system based on enhanced YOLOv9 model

By introducing the enhanced variable kernel module and space-to-depth denoising module into the YOLOv9 model, combined with the channel compression architecture, the problem of information loss and computational complexity in underwater target detection is solved, and high-precision and efficient underwater target detection is achieved. detection.

CN118587569APending Publication Date: 2024-09-03SHANGHAI MARITIME UNIVERSITY
View PDF 0 Cites 8 Cited by

Patent Information

Application Number
CN202410652686.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

Existing underwater target detection methods have problems such as information loss, gradient unreliability, computational complexity and insufficient generalization ability in complex underwater environments, which limits detection accuracy and real-time performance.

Method used

The underwater target detection method based on the YOLOv9 model is adopted, and high-frequency features are extracted through the enhanced variable kernel module and space-to-depth denoising module. Combined with the channel compression architecture, the detection accuracy and adaptability are improved, and it is suitable for complex underwater environments.

Benefits of technology

The accuracy and stability of underwater target detection are improved, the computational overhead is reduced, and the detection efficiency and accuracy of the system in complex underwater environments are significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587569A
    Figure CN118587569A
Patent Text Reader

Abstract

The invention relates to an underwater target detection method and system based on an enhanced YOLOv9 model, and the method comprises the following steps: obtaining image data in an underwater environment in real time, carrying out the preprocessing and data enhancement operation, and obtaining the enhanced image data; and inputting the enhanced image data into a pre-trained underwater target detection model, and outputting an underwater target detection result, the underwater target detection model being constructed by using a YOLOv9 network, the underwater target detection model comprises an enhanced variable kernel module, and a space-to-depth denoising module, a feature fusion module and a prediction integration module which are sequentially connected with the enhanced variable kernel module. Compared with the prior art, the method has the advantages that the efficiency of complex underwater environment target detection is improved, and the accuracy, the recall rate and the average precision are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of underwater target detection, and in particular to an underwater target detection method and system based on an enhanced YOLOv9 model. Background Art

[0002] The wide application of underwater object detection technology in the fields of naval coastal defense, fisheries, aquaculture, seabed debris recovery, and marine ecosystem research has highlighted its key role in solving key challenges and advancing diverse applications. As the technology gains prominence, it is important to recognize the inherent complexity of the underwater environment, which will greatly affect the effectiveness of object detection. The complex underwater environment poses great challenges, including factors such as complex marine life, unique underwater environmental conditions, and the impact of noise. These factors constitute a huge obstacle and complicate the extraction of relevant features. Achieving a delicate balance between high accuracy and real-time performance is essential for the successful application of underwater object detection and meeting the stringent requirements of practical scenarios. Traditional image processing detection algorithms, originally tailored for terrestrial scenes, encounter limitations when applied to underwater object detection, restricting the widespread application of machine vision technology. This limitation emphasizes the need for innovative methods, especially for the unique conditions of underwater object detection, and promotes the need for further research and advancement in this critical area. With these factors in mind, this paper delves into the multifaceted challenges of underwater object detection and explores innovative methods to improve the efficiency of underwater object detection, which will help the development of this technology towards practical applications.

[0003] Existing object detection methods have many deficiencies in various aspects. First, the large amount of information loss in deep networks poses a major challenge. As the input data undergoes layer-by-layer feature extraction and spatial transformation, a large amount of information is lost, forming an information bottleneck, which adversely affects the gradient flow and, in turn, the prediction accuracy of the model. In addition, the unreliability of gradients is another issue of information loss during training. Deep networks may produce unreliable gradients, which hinder the effective learning of correct feature representations. In addition, some network architectures, such as ResNet and CSPNet, perform well in specific tasks but may lack optimal performance in all tasks, especially in terms of information preservation and gradient information reliability. To address the information loss problem, reversible architectures, while alleviating the problem, introduce additional layers to combine repeated input data, thereby increasing the inference cost. In addition, deep supervision methods tailored for very deep neural network architectures have proven to be unsuitable for lightweight models, resulting in unstable performance or insufficient parameters. The reliance on pre-trained models represents another constraint, limiting the adaptability to new domains or small datasets. In addition, some object detection methods, such as transformer-based models, have demonstrated performance improvements at the expense of high computational complexity, making them unsuitable for real-time applications. Finally, although some methods may perform proficiently on a specific dataset, their generalization ability will be weakened when applied to new or different datasets. Summary of the invention

[0004] The purpose of the present invention is to provide an underwater target detection method and system based on an enhanced YOLOv9 model to improve the accuracy of underwater target detection.

[0005] The purpose of the present invention can be achieved by the following technical solutions:

[0006] An underwater target detection method based on an enhanced YOLOv9 model comprises the following steps:

[0007] Acquire image data in underwater environment in real time, perform preprocessing and data enhancement operations, and obtain enhanced image data;

[0008] Inputting the enhanced image data into a pre-trained underwater target detection model, and outputting an underwater target detection result, wherein the underwater target detection model is constructed using a YOLOv9 network, and the underwater target detection model includes an enhanced variable kernel module and a space-to-depth denoising module, a feature fusion module, and a prediction integration module connected thereto in sequence;

[0009] The steps performed by the underwater target detection model include:

[0010] Inputting the enhanced image data into the enhanced variable kernel module for feature extraction to obtain a high-frequency feature map;

[0011] Inputting the high-frequency feature map into the space-to-depth denoising module for downsampling and denoising to obtain a denoised downsampled feature map;

[0012] Inputting the denoised downsampled feature map into the feature fusion module to perform feature fusion at each level to obtain a fused feature map;

[0013] The fused feature map is input into the prediction integration module to output the underwater target detection result.

[0014] Furthermore, the data enhancement operation includes rotation, flipping, scaling and introducing artificial noise to amplify the variability of the pre-processed image data.

[0015] Furthermore, the enhanced variable kernel module includes an ideal high-pass filter, a first convolution layer, a first multi-scale resampling layer, a second multi-scale resampling layer, a second convolution layer, a feature map normalization layer and a SiLU activation layer, and the step of obtaining a high-frequency feature map by the enhanced variable kernel module includes:

[0016] Performing an ideal high-pass filter processing on the enhanced data set to remove low-frequency information and retain high-frequency information, thereby obtaining an initial high-frequency feature map;

[0017] Based on the initial high-frequency feature map, convolution is performed using an initial sampling shape of a convolution kernel to generate a corresponding kernel offset, the first convolution layer adjusts the initial sampling shape according to the offset, and multi-scale resampling is performed on the initial high-frequency feature map using the first multi-scale resampling layer according to the adjusted initial sampling shape, so as to convert the initial high-frequency feature map into a multi-dimensional tensor;

[0018] The multidimensional tensor is processed sequentially through the second multi-scale resampling layer, the second convolution layer, the feature map normalization layer and the SiLU activation layer to obtain a high-frequency feature map.

[0019] Furthermore, the expression of the ideal high-pass filter is:

[0020]

[0021] Where h(f) is the frequency response, f is the frequency, and f c is the cutoff frequency of an ideal high-pass filter.

[0022] Furthermore, the step of obtaining the denoised downsampled feature map by the space-to-depth denoising module includes:

[0023] The high-frequency feature map X is spatially downsampled to downsample the high-frequency feature map X with a dimension of (S, S, C1) into multiple dimensions of ( C1) and connect the subgraphs to get a subgraph with dimension ( 4C1) feature map X′, where S is the spatial dimension of the original feature map, including height and width, and C1 is the number of channels of the original feature map;

[0024] The feature map X′ is subjected to a two-dimensional discrete Fourier transform, converted to the frequency domain for frequency filtering, and denoised using a triangular filter to obtain denoised frequency domain data, wherein the expressions of the two-dimensional discrete Fourier transform and the triangular filter are respectively:

[0025]

[0026]

[0027] The denoised frequency domain data is subjected to inverse discrete Fourier transform and non-sliding convolution is applied to obtain a dimension of ( C2) after denoising, where C2 is the number of channels of the feature map after non-sliding convolution processing, and the expression of the inverse discrete Fourier transform is:

[0028]

[0029] Where F(u,v) is the discrete Fourier transform, u and v represent the horizontal and vertical positions in the frequency domain, respectively, with values ​​ranging from u = 0, 1, ..., M-1 and v = 0, 1, ..., N-1, j is the imaginary unit, f(x,y) is the inverse discrete Fourier transform, H(f) is the frequency response of the triangular filter, f is the frequency, and f c is the center frequency of the filter.

[0030] Furthermore, the underwater target detection model also includes an input processing module, a loss function calculation module, a channel compression architecture and a parameter optimization and weight update module. The training steps of the underwater target detection model include:

[0031] Step 1: Acquire image data in an underwater environment to generate a data set, and perform preprocessing and enhancement operations on the data set to obtain an enhanced data set;

[0032] Step 2, the input processing module inputs the enhanced data set into the enhanced variable kernel module for upsampling, so as to extract features by using the dynamically adjusted sampling shape and offset, remove low-frequency information, retain high-frequency information, and obtain a high-frequency feature map;

[0033] Step 3: Input the high-frequency feature map into the space-to-depth denoising module for downsampling and denoising to obtain a denoised downsampled feature map;

[0034] Step 4: input the denoised downsampled feature map into the feature fusion module for feature fusion, and pass the obtained fused feature map to the prediction integration module to output the prediction result;

[0035] Step 5: Based on the loss function calculation module, the loss is calculated according to the output prediction result and the corresponding actual label, and the channel compression architecture is used to reduce the parameter amount;

[0036] Step 6: Based on the loss, the parameter optimization and weight update module uses a back propagation algorithm to update the network weights and uses an optimization algorithm to optimize the parameters;

[0037] Step 7: Repeat steps 2 to 6 until the underwater target detection model achieves the expected goal.

[0038] Furthermore, the prediction integration module uses a Softmax function to output a prediction result, and the prediction result includes a target category probability and a target frame position, which is used as the underwater target detection result. The expression of the Softmax function is:

[0039]

[0040] z=[z1,z2,...,z C ]

[0041] In the formula, softmax(z) i represents the calculation result of the Softmax function on the i-th element of vector z, where e is the base of the natural logarithm, i.e., Euler's constant, and z i is the i-th element of the vector z, It is the sum of all elements in the vector z after performing the exponential function operation. C is the length of the vector z, and j is the loop variable.

[0042] Furthermore, the loss function in the loss function calculation module includes multiple loss components, each loss component is weighted and summarized into a total loss function, and the loss components include a classification loss component, a box loss component, a target confidence loss component, and a deep feature loss component, and the expressions are respectively:

[0043]

[0044]

[0045]

[0046]

[0047] In the formula, Class Loss is the classification loss component, N is the total number of samples, C is the total number of categories, and yi,c is the true label of the i-th sample belonging to category c, is the probability that the model predicts that the i-th sample belongs to category c, ∈ i,c is additive white Gaussian noise, which is used to introduce randomness between model predictions and true labels. Box Loss is the box loss component, and λ coord is a weight parameter used to balance the target box position loss and other loss parts, S 2 represents the number of grid cells, B is the number of bounding boxes predicted for each grid cell, is an indicator function, indicating that the i-th grid and the j-th border are responsible for detecting the object, x i ,y i ,w i ,h i is the position parameter of the i-th target box, is the position parameter of the i-th target box predicted by the model, ∈ x ,∈ y ,∈ w ,∈ h is the phase noise, corresponding to the X, Y direction and width, height prediction in the box coordinate prediction, Objectness Loss is the target confidence loss component, y i is the true target confidence label of the i-th sample, is the target confidence of the i-th sample predicted by the model, It has a mean of 0 and a variance of σ 2 Gaussian random noise, DFL is the deep feature loss component, L is the number of deep feature layers, which is used to control the importance of the deep feature loss of the lth layer, H l and W l Represent the height and width of the deep feature of the lth layer, feature target,l is the lth layer deep feature of the target feature map, feature reference,l is the lth layer depth feature of the reference feature map, noise represents the additive noise term, and its dimension and feature feature target,l and feature reference,l same.

[0048] Furthermore, the optimization algorithm adopted by the parameter optimization and weight update module includes one of the SGD optimization algorithm and the Adam optimization algorithm, wherein the step of using the Adam optimization algorithm to perform parameter optimization includes:

[0049] Initialization: Initialize the parameters, including the model parameters w t , first-order moment estimate m t , second-order moment estimate v t, adjustable hyperparameters β1 and β2 that control the weights of the first-order and second-order moment estimates, numerical stability parameter ∈, and the standard deviation noise_std of the additive white Gaussian noise;

[0050] Compute the gradient: Where f(w t ) is the objective function, g t is the gradient;

[0051] Update the first moment estimate: in is the random noise sampled from a Gaussian distribution with a mean of 0 and a standard deviation of noise_std;

[0052] Update the second moment estimate:

[0053] Correction of the corrected first-order moment estimate: in is the first-order moment estimate after correcting the bias, is the t-th power of the exponentially weighted moving average coefficient of the first-order moment estimate;

[0054] Correct the bias in the second moment estimate: in is the second-order moment estimate after correcting the bias, is the t-th power of the exponentially weighted moving average coefficient of the second-order moment estimate;

[0055] Update parameters: Where α is the learning rate.

[0056] The present invention also provides an underwater target detection system based on an enhanced YOLOv9 model, comprising:

[0057] Underwater imaging subsystem: used to obtain real-time image data in underwater environment;

[0058] Data enhancement subsystem: used for performing preprocessing and data enhancement operations on the image data to obtain enhanced image data;

[0059] Real-time monitoring subsystem: used to input the enhanced image data into a pre-trained underwater target detection model for real-time detection and processing;

[0060] Performance evaluation subsystem: used to evaluate the performance of the underwater target detection model;

[0061] Result output subsystem: used to output real-time detection and processing results.

[0062] Compared with the prior art, the present invention has the following beneficial effects:

[0063] (1) Aiming at the limitations of the existing YOLOv9 network in underwater environments, the present invention constructs an underwater target detection model based on the YOLOv9 network. An enhanced variable kernel module and a space-to-depth denoising module are designed in the model to extract high-frequency features. The spatial dimension can be effectively reduced without affecting information loss, while retaining channel information, which helps to improve the detection performance of convolutional neural networks for low-resolution images and small objects and improve the accuracy of detection results.

[0064] (2) The enhanced variable kernel module of the present invention adapts to different target shapes and sizes of different data sets, improves the flexibility of convolution kernel parameters and sampling shapes, removes low-frequency information, and retains high-frequency information, thereby highlighting the high-frequency features of the data set to improve the accuracy and stability of underwater target detection.

[0065] (3) The channel compression architecture of the present invention aims to reduce the computational overhead of convolutional neural networks, making them more suitable for deployment on underwater embedded devices.

[0066] (4) The space-to-depth denoising module, enhanced variable kernel module and channel compression architecture designed in the present invention improve the efficiency of the system in target detection in complex underwater environments, and enhance the accuracy, recall rate and average precision. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 It is a schematic diagram of the method flow of the present invention;

[0068] Figure 2 is a system structure diagram of the present invention;

[0069] Figure 3 It is a schematic diagram of the specific structure of the enhanced variable core module of the present invention;

[0070] Figure 4 It is a schematic diagram of the specific structure of the space-to-depth denoising module of the present invention;

[0071] Figure 5 It is a specific structural schematic diagram of the channel compression architecture of the present invention;

[0072] Figure 6 It is a detection effect diagram of the present invention. DETAILED DESCRIPTION

[0073] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.

[0074] This embodiment provides an underwater target detection method based on an enhanced YOLOv9 model. Figure 2As shown, the detection method of this embodiment is integrated in the detection system corresponding to the method. The detection system is divided into five subsystems, including an underwater imaging subsystem, a data enhancement subsystem, a real-time detection subsystem, a performance evaluation subsystem, and a result output subsystem:

[0075] 1) Underwater imaging subsystem: responsible for capturing images in underwater environments and generating data sets, connected to the data enhancement subsystem, and passing the captured data sets to the latter;

[0076] 2) Data enhancement subsystem: It plays a key role in expanding the data set by preprocessing and enhancing the data set. The processed data set is then passed to the real-time detection subsystem to provide sufficient data support for subsequent processing;

[0077] 3) Real-time detection subsystem: including input processing module, enhanced variable kernel module, space-to-depth denoising module, feature fusion module, prediction integration module, loss function calculation module, channel compression architecture, parameter optimization and weight update module. These modules work together to achieve real-time detection and processing of input data. In addition, the real-time detection subsystem is connected to the performance evaluation subsystem, which evaluates and monitors the performance of the model;

[0078] 4) Performance evaluation subsystem: The performance of the model is evaluated by intermittently using an independent validation set. If the model achieves the expected goal, the evaluation result will be passed to the result output subsystem. Otherwise, the performance evaluation subsystem will adjust hyperparameters such as learning rate, batch size, and regularization strength, and pass the adjusted parameters to the real-time detection subsystem to optimize the performance of the model.

[0079] 5) Result output subsystem: It is the last link in the system. Its main function is to output the final result obtained after processing and analysis for user use.

[0080] like Figure 1 As shown, the method comprises the following steps:

[0081] S1. Obtain a target detection dataset of underwater environment image data, and perform preprocessing and data enhancement operations.

[0082] S1.1. The underwater imaging subsystem acquires image data from the underwater environment and then converts it into the YOLO format to generate a dataset for underwater target detection.

[0083] S1.2. The data enhancement subsystem divides the collected dataset into training and test sets, and then enriches the diversity and richness of the training set. The enhancement methods include rotation, flipping, scaling, and introducing artificial noise to amplify the variability of the dataset. Therefore, this process improves model performance and expands the training dataset.

[0084] This embodiment can also use the underwater optical target detection intelligent algorithm dataset URPC 2021 as the main dataset. The dataset consists of 7,600 images, of which 6,400 are used for training and 1,200 are used for testing. The dataset contains four target detection categories: conch, ratchet, scallop, and starfish. In order to create different training sets and validation sets, the data enhancement subsystem partitions the original training data using a 1:1 ratio.

[0085] S2. Establish an underwater target detection model.

[0086] This step builds an underwater target detection model, enhances its functionality, and performs initialization:

[0087] S2.1. The real-time detection subsystem of this embodiment is responsible for building an underwater target detection model through the YOLOv9 network structure, including an input processing module, an enhanced variable kernel module, a space-to-depth denoising module, a feature fusion module, a prediction integration module, a loss function calculation module, a channel compression architecture, and a parameter optimization and weight update module.

[0088] S2.2. Then the real-time detection subsystem enhances YOLOv9, which needs to integrate space-to-depth convolution, enhanced variable kernel module and channel compression architecture. The enhanced variable kernel module is used to adapt to different target shapes and sizes of different data sets. The corresponding space-to-depth denoising module is added between some modules of the backbone network and the neck network to improve the detection accuracy of underwater targets. The channel compression architecture is designed to reduce the number of network parameters and calculations to improve the detection performance of the network. Finally, the enhanced YOLOv9, that is, the underwater target detection model, is obtained.

[0089] S2.3. The real-time detection subsystem performs network initialization.

[0090] S3. The input processing module inputs the data set into the enhanced variable kernel module to extract high-frequency features, and inputs it into the space-to-depth denoising module for downsampling and denoising to obtain a denoised downsampled feature map.

[0091] S3.1. The input processing module in the real-time detection subsystem inputs the data set into the enhanced variable kernel module for upsampling. The enhanced variable kernel module uses dynamically adjusted sampling shape and offset to extract features, remove low-frequency information, retain high-frequency information, and highlight the high-frequency features of the data set.

[0092] Specifically, in Figure 3In the enhanced variable kernel module, an ideal high-pass filter, a first convolution layer, a first multi-scale resampling layer, a second multi-scale resampling layer, a second convolution layer, a feature map normalization layer, and a SiLU activation layer are first applied to the input image of dimension (C, H, W) using an ideal high-pass filter to remove low-frequency information and retain high-frequency information. Subsequently, the image is convolved with the initial sampling shape of the convolution kernel to generate a corresponding kernel offset with dimension (2N, H, W). The convolution layer adjusts the initial sampling shape according to the learned offset value, and performs multi-scale resampling of the feature map according to the adjusted sampling shape, converting the features into a four-dimensional tensor (C, 5, H, W), where 5 represents the convolution kernel size. Subsequently, after multi-scale resampling, convolution, and feature map normalization, the result is finally output through the SiLU activation function.

[0093] The formula h(f) for an ideal high-pass filter can be expressed as:

[0094]

[0095] Where h(f) is the frequency response, f is the frequency, and f c is the cutoff frequency of an ideal high-pass filter.

[0096] The mathematical expression of the SiLU activation function is:

[0097] SiLU(x)=x·σ(x)

[0098] Among them, σ(x) represents the Sigmoid function, and its mathematical expression is:

[0099]

[0100] S3.2. The dataset processed by the enhanced variable kernel module will be passed to the spatial to deep denoising module, which will downsample and denoise the dataset to improve the image quality and obtain the denoised downsampled feature map.

[0101] Figure 4 The specific structural diagram of the space-to-depth denoising module is shown. The module first performs spatial depth downsampling, downsampling the feature map X with dimensions (S, S, C1) into four dimensions ( C1). Then, these subgraphs are connected to obtain a subgraph of dimension ( 4C1) feature map X′. After that, a two-dimensional discrete Fourier transform is performed, which is converted to the frequency domain for frequency filtering, and a triangular filter is used for denoising. The frequency domain data processed by the triangular filter is inversely Fourier transformed, and a non-sliding convolution layer is applied to obtain a dimension of ( C2)’s final feature map X″.

[0102] Among them, the discrete two-dimensional Fourier transform F(u,v) is defined as:

[0103]

[0104] The formula for the inverse discrete two-dimensional Fourier transform is:

[0105]

[0106] Wherein, u and v represent the horizontal and vertical positions in the frequency domain respectively, and the value ranges are u=0,1,...,M-1 and v=0,1,...,N-1, and j is an imaginary unit.

[0107] The formula of the triangular filter H(f) can be expressed as:

[0108]

[0109] Where H(f) is the frequency response of the filter, f is the frequency, and f c is the center frequency of the filter.

[0110] S4, inputting the denoised downsampled feature map into the feature fusion module to perform feature fusion at each level to obtain a fused feature map, and then inputting the fused feature map into the prediction integration module to output a prediction result.

[0111] In this step, the feature fusion module integrates feature information from each level and passes the fused features to the prediction integration module. Subsequently, the module predicts the category probability and bounding box position of the output target processed by the integration module. The specific steps are as follows:

[0112] S4.1. The feature fusion module includes the scaling and channel mixing of feature maps at different levels. The purpose of this process is to ensure that the features of each layer contain comprehensive and diverse information.

[0113] S4.2, the prediction integration module predicts the target frame on the fused feature map, where the convolution operation with the activation function is used to predict the position and size of the target box at each position.

[0114] S4.3. Generate category predictions for each target box, and the prediction integration module uses the Softmax function to convert the scores into probabilities for each category.

[0115] Generate a category prediction for each target box and use the Softmax function to convert the score into the probability of each category, which is formulated as follows:

[0116] Given a vector z=[z1,z2,...,z C ], the formula of Softmax function is:

[0117]

[0118] Where: softmax(z) i represents the calculation result of the Softmax function on the i-th element of vector z; e is the base of the natural logarithm, that is, Euler's constant; z i is the i-th element of vector z; the denominator is the sum of all elements in vector z after performing exponential function operations.

[0119] The Softmax function converts each element in the input vector z into a probability value between 0 and 1, and the sum of all probability values ​​is 1. It is suitable for class probability prediction in multi-classification problems.

[0120] S4.4, the prediction integration module calculates the confidence score of the target box and combines the category prediction result with the target box prediction result to determine whether the target box contains the target.

[0121] S5. Based on the loss function calculation module, the loss is calculated according to the output prediction result and the corresponding actual label, and the channel compression architecture is used to reduce the number of parameters.

[0122] S5.1. The loss function calculation module uses the prediction results and actual labels to calculate the loss function, including classification loss (Class Loss), box loss (Box Loss), objectness loss (Objectness Loss) and deep feature loss (DFL). These individual loss components are weighted and aggregated into the total loss within the loss function. The choice of weights depends on the specific task requirements and training strategies.

[0123] (1) The classification loss function measures the difference between the model classification output and the true category by calculating the cross entropy loss between the true category label and the probability predicted by the model. During the training process, the classification performance of the model is optimized by minimizing the classification loss. The formula is as follows:

[0124]

[0125] In this formula: N is the total number of samples, C is the total number of categories, and y is the total number of samples. i,c is the true label of the i-th sample belonging to category c, is the probability that the model predicts that the i-th sample belongs to category c, ∈ i,c It is additive white Gaussian noise, which is used to introduce random factors between model predictions and true labels. It can help the model better adapt to the uncertainty and complexity in the underwater environment and enhance the robustness and generalization ability of the model.

[0126] (2) The box loss function is mainly used to measure the difference between the predicted target box position and the true target box position. The target box position prediction of the model is optimized by minimizing the box loss. The square error loss function can be used to calculate it. The formula is as follows:

[0127]

[0128] In the above formula: coord is a weight parameter used to balance the target box position loss and other loss parts, S 2 represents the number of grid cells, B is the number of bounding boxes predicted for each grid cell, is an indicator function, indicating that the i-th grid and the j-th border are responsible for detecting the object, x i ,y i ,w i ,h i is the position parameter of the i-th target box, is the position parameter of the i-th target box predicted by the model, ∈ x ,∈ y ,∈ w ,∈ h is the phase noise, which corresponds to the X, Y directions and width, height predictions in the box coordinate prediction. These phase noises can simulate frequency drift or phase change, so that the model can consider more possible disturbances in the environment when processing the box coordinates. This adjustment can enhance the robustness and generalization ability of the model, enabling it to better handle the challenges in underwater environments.

[0129] (3) The target confidence loss function measures the difference between the model's prediction of whether a target exists in the target box and the actual situation. Optimizing this loss function helps improve the accuracy of the target detection model in judging whether a target exists. It is usually calculated using the binary cross entropy loss function, and its formula is as follows:

[0130]

[0131] In this formula: N is the total number of samples, y is i is the true target confidence label of the i-th sample, is the target confidence of the i-th sample predicted by the model, It has a mean of 0 and a variance of σ 2 Gaussian random noise, the appropriate σ can be selected according to the actual application scenario 2 value to better simulate the noise conditions in underwater environment.

[0132] (4) The deep feature loss function is usually used to guide the model to learn feature representations with more semantic information. Its formula is as follows:

[0133]

[0134] In this formula: L is the number of deep feature layers, which is used to control the importance of the loss of the deep feature at the lth layer, H l and W l Represent the height and width of the deep feature of the lth layer, feature target,l is the lth layer deep feature of the target feature map, feature reference,l is the lth layer deep feature of the reference feature map, noise represents the additive noise term, which can be a randomly generated vector or matrix with the same dimension as feature target,l and feature reference,l Similarly, adding noise terms to the features can help the model better handle uncertainties and disturbances in underwater environments and improve the robustness and generalization ability of the model.

[0135] S5.2. The loss function calculation module uses the channel compression architecture to reduce the computational overhead of the convolutional neural network and improve efficiency.

[0136] The loss function calculation module uses the channel compression architecture to reduce the computational overhead of the convolutional neural network and improve efficiency. The above loss terms are weighted and summarized into the total loss in the loss function. The channel compression architecture is as follows: Figure 5 As shown in the figure, we first use a standard 1x1 convolution to compress the number of channels of the input image to reduce the number of channels in the input image, and then perform a depth convolution (i.e. Φ1, Φ2, ..., Φ k ) generates more feature maps, and then merges different feature maps together to form a new output.

[0137] S6. Based on the loss, the parameter optimization and weight updating module uses a back propagation algorithm to update the network weights and uses an optimization algorithm to optimize the parameters.

[0138] This step uses the loss function to update the network weights through the back-propagation algorithm and applies an optimization algorithm (such as SGD, Adam, etc.) to optimize the parameters.

[0139] S6.1. The parameter optimization and weight update module calculates the gradient of the loss function with respect to the weight through the back-propagation algorithm in order to update the network parameters. During the back-propagation process, by calculating the gradient of the loss function, the weights in the network can be updated in the opposite direction of the gradient to minimize the loss function.

[0140] S6.2. In terms of optimization, common optimization algorithms can be used, such as Stochastic Gradient Descent (SGD) or its improved algorithms, such as Adam Optimizer. The choice of optimizer can be adjusted according to specific experimental results and network structure to achieve faster and more stable convergence.

[0141] S6.3. After back propagation calculates the gradient, use the selected optimizer to update the parameters. According to the principle of gradient descent, the direction and size of the gradient need to be considered when updating the parameters to adjust the network parameters so that the loss function is gradually reduced.

[0142] In this embodiment, the Adam optimization algorithm is used to optimize parameters. The calculation formula of the Adam algorithm is as follows:

[0143] 1) Initialization parameters: w t is the model parameter, m t is the first-order moment estimate, v t is the second-order moment estimate, β1 and β2 are adjustable hyperparameters that control the weights of the first-order and second-order moment estimates, ∈ is a numerical stability parameter, and noise_std is the standard deviation of the additive white Gaussian noise;

[0144] 2) Calculate the gradient: Where f(w t ) is the objective function;

[0145] 3) Update the first-order moment estimate:

[0146] 4) Update the second-order moment estimate:

[0147] 5) Correct the bias of the first-order moment estimate:

[0148] 6) Correct the bias of the second-order moment estimate:

[0149] 7) Update parameters: Where α is the learning rate;

[0150] In the Adam algorithm, β1 controls the decay rate of the first-order moment estimate, β2 controls the decay rate of the second-order moment estimate, and ∈ avoids division by zero errors.

[0151] S7. Adjust the network structure and training strategy according to the evaluation results, and repeat steps S3 to S6 until the model performance reaches the expected target.

[0152] S7.1. Throughout the training process, the performance evaluation subsystem intermittently uses an independent validation set to evaluate the performance of the model. This data set contains data that was not encountered during training, which is convenient for simulating real-world scenarios.

[0153] S7.2, if the model cannot achieve the expected goal, the performance evaluation subsystem will adjust the hyperparameters such as learning rate, batch size and regularization strength, and then pass the adjusted parameters to the real-time detection subsystem to optimize the performance of the model, and repeat steps S3 to S6;

[0154] S7.3,After the model training is completed, the performance evaluation subsystem verifies the generalization ability of the final model using the test set. The fully trained and verified system model is then deployed to the actual application of the object detection task. The performance data collected during the actual use of the model is collected as feedback to further improve the performance of the model;

[0155] S7.4. The result output subsystem is responsible for outputting the final results obtained after processing and analysis for user use.

[0156] In the present invention, the experimental performance indicators include commonly used target detection indicators: accuracy, recall, average precision and efficiency. The specific experimental results are shown in Table 1.

[0157] Table 1 Performance comparison between YOLOv9 and the present invention

[0158] Comparison Items YOLOv9 Embodiments of the present invention Accuracy 0.51 0.71(+0.20) Recall 0.476 0.485(+0.009) Average precision 0.476 0.482(+0.006) efficiency 3.312h 3.203(-0.109)h

[0159] As shown in Table 1, the present invention has improvements in all indicators, especially improving the detection accuracy of small objects, effectively solving the problem of missed detection due to small object size. In addition, the detection efficiency is improved by 3.3%;

[0160] The underwater target detection system and method proposed in this embodiment are good at detecting multiple targets in different underwater environments. While ensuring high detection accuracy, it can adapt to various target shapes and sizes found in different data sets, thereby improving the flexibility of convolution kernel parameters and sampling shapes. While improving the detection speed, it reduces the computational cost of the convolutional neural network. This adaptability makes it easier to deploy on underwater embedded devices with limited computing power, thereby enabling real-time detection of underwater targets of different sizes. The detection effect of the embodiment of the present invention is as follows: Figure 6As shown in the figure, four types of underwater creatures, namely, sea cucumber "holothurian", sea urchin "echinus", scallop "scallop" and starfish "starfish", are detected and classified, and the classification results are displayed in the rectangular box. It can be seen from the figure that even when the image resolution is low and the target is small, the model can still accurately detect and classify different underwater creatures, reflecting the effectiveness of the embodiment of the present invention in the underwater target detection task.

[0161] In summary, first of all, in order to solve the problems related to low-resolution images and small target detection, the space-to-depth denoising module designed in the embodiment of the present invention can effectively reduce the spatial dimension without affecting the information loss, while retaining the channel information, which helps to improve the detection performance of the convolutional neural network for low-resolution images and small objects. In order to adapt to the different target shapes and sizes of different data sets, the embodiment of the present invention designs an enhanced variable kernel module, which provides flexibility for the parameters and sampling shape of the convolution kernel. In order to reduce the computational cost of the convolutional neural network, a channel compression architecture is designed to make the embodiment of the present invention more suitable for underwater embedded devices, providing a robust and adaptive solution.

[0162] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program code.

[0163] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The schemes in the embodiments of the present invention may be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.

[0164] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0165] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0166] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0167] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0168] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. An underwater target detection method based on an enhanced YOLOv9 model, characterized in that: The following steps are involved: Acquire image data in underwater environment in real time, perform preprocessing and data enhancement operations, and obtain enhanced image data; Inputting the enhanced image data into a pre-trained underwater target detection model, and outputting an underwater target detection result, wherein the underwater target detection model is constructed using a YOLOv9 network, and the underwater target detection model includes an enhanced variable kernel module and a space-to-depth denoising module, a feature fusion module, and a prediction integration module connected thereto in sequence; The steps performed by the underwater target detection model include: Inputting the enhanced image data into the enhanced variable kernel module for feature extraction to obtain a high-frequency feature map; Inputting the high-frequency feature map into the space-to-depth denoising module for downsampling and denoising to obtain a denoised downsampled feature map; Inputting the denoised downsampled feature map into the feature fusion module to perform feature fusion at each level to obtain a fused feature map; The fused feature map is input into the prediction integration module to output the underwater target detection result.

2. The underwater target detection method based on the enhanced YOLOv9 model according to claim 1, characterized in that: The data augmentation operations include rotation, flipping, scaling, and introducing artificial noise to amplify the variability of the pre-processed image data.

3. The underwater target detection method based on the enhanced YOLOv9 model according to claim 1, characterized in that: The enhanced variable kernel module includes an ideal high-pass filter, a first convolution layer, a first multi-scale resampling layer, a second multi-scale resampling layer, a second convolution layer, a feature map normalization layer and a SiLU activation layer. The step of obtaining a high-frequency feature map by the enhanced variable kernel module includes: Performing an ideal high-pass filter processing on the enhanced data set to remove low-frequency information and retain high-frequency information, thereby obtaining an initial high-frequency feature map; Based on the initial high-frequency feature map, convolution is performed using an initial sampling shape of a convolution kernel to generate a corresponding kernel offset, the first convolution layer adjusts the initial sampling shape according to the offset, and multi-scale resampling is performed on the initial high-frequency feature map using the first multi-scale resampling layer according to the adjusted initial sampling shape, so as to convert the initial high-frequency feature map into a multi-dimensional tensor; The multidimensional tensor is processed sequentially through the second multi-scale resampling layer, the second convolution layer, the feature map normalization layer and the SiLU activation layer to obtain a high-frequency feature map.

4. The underwater target detection method based on the enhanced YOLOv9 model according to claim 3 is characterized in that: The expression of the ideal high-pass filter is: Where h(f) is the frequency response, f is the frequency, and f c is the cutoff frequency of an ideal high-pass filter.

5. The underwater target detection method based on the enhanced YOLOv9 model according to claim 1, characterized in that: The step of obtaining the denoised downsampled feature map by the space-to-depth denoising module comprises: The high-frequency feature map X is spatially downsampled to downsample the high-frequency feature map X with a dimension of (S, S, C1) into multiple dimensions of , and connect the subgraphs to get a subgraph of dimension The feature map X′ of , where S is the spatial dimension of the original feature map, including height and width, and C1 is the number of channels of the original feature map; The feature map X′ is subjected to a two-dimensional discrete Fourier transform, converted to the frequency domain for frequency filtering, and denoised using a triangular filter to obtain denoised frequency domain data, wherein the expressions of the two-dimensional discrete Fourier transform and the triangular filter are respectively: The denoised frequency domain data is subjected to inverse discrete Fourier transform and non-sliding convolution is applied to obtain a dimension of The denoised downsampled feature map X″, where C2 is the number of channels of the feature map after non-sliding convolution processing, and the expression of the inverse discrete Fourier transform is: Where F(u,v) is the discrete Fourier transform, u and v represent the horizontal and vertical positions in the frequency domain, respectively, with values ​​ranging from u = 0, 1, ..., M-1 and v = 0, 1, ..., N-1, j is the imaginary unit, f(x,y) is the inverse discrete Fourier transform, H(f) is the frequency response of the triangular filter, f is the frequency, and f c is the center frequency of the filter.

6. The underwater target detection method based on the enhanced YOLOv9 model according to claim 1, characterized in that: The underwater target detection model further includes an input processing module, a loss function calculation module, a channel compression architecture, and a parameter optimization and weight update module. The training steps of the underwater target detection model include: Step 1: Acquire image data in an underwater environment to generate a data set, and perform preprocessing and enhancement operations on the data set to obtain an enhanced data set; Step 2, the input processing module inputs the enhanced data set into the enhanced variable kernel module for upsampling, so as to extract features by using the dynamically adjusted sampling shape and offset, remove low-frequency information, retain high-frequency information, and obtain a high-frequency feature map; Step 3: Input the high-frequency feature map into the space-to-depth denoising module for downsampling and denoising to obtain a denoised downsampled feature map; Step 4: input the denoised downsampled feature map into the feature fusion module for feature fusion, and pass the obtained fused feature map to the prediction integration module to output the prediction result; Step 5: Based on the loss function calculation module, the loss is calculated according to the output prediction result and the corresponding actual label, and the channel compression architecture is used to reduce the parameter amount; Step 6: Based on the loss, the parameter optimization and weight update module uses a back propagation algorithm to update the network weights and uses an optimization algorithm to optimize the parameters; Step 7: Repeat steps 2 to 6 until the underwater target detection model achieves the expected goal.

7. The underwater target detection method based on the enhanced YOLOv9 model according to claim 6 is characterized in that: The prediction integration module uses the Softmax function to output the prediction result, which includes the target category probability and the target frame position, and uses it as the underwater target detection result. The expression of the Softmax function is: z=[z1,z2,...,z C ] In the formula, softmax(z) i represents the calculation result of the Softmax function on the i-th element of vector z, where e is the base of the natural logarithm, i.e., Euler's constant, and z i is the i-th element of the vector z, It is the sum of all elements in the vector z after performing the exponential function operation. C is the length of the vector z, and j is the loop variable.

8. The underwater target detection method based on the enhanced YOLOv9 model according to claim 6, characterized in that: The loss function in the loss function calculation module includes multiple loss components, each of which is weighted and summarized into a total loss function. The loss components include a classification loss component, a box loss component, a target confidence loss component, and a deep feature loss component, and the expressions are respectively: In the formula, Class Loss is the classification loss component, N is the total number of samples, C is the total number of categories, and y i,c is the true label of the i-th sample belonging to category c, is the probability that the model predicts that the i-th sample belongs to category c, ∈ i,c is additive white Gaussian noise, which is used to introduce randomness between model predictions and true labels. Box Loss is the box loss component, and λ coord is a weight parameter used to balance the target box position loss and other loss parts, S 2 represents the number of grid cells, B is the number of bounding boxes predicted for each grid cell, is an indicator function, indicating that the i-th grid and the j-th border are responsible for detecting the object, x i ,y i ,w i ,h i is the position parameter of the i-th target box, is the position parameter of the i-th target box predicted by the model, ∈ x ,∈ y ,∈ w ,∈ h is the phase noise, corresponding to the X, Y direction and width, height prediction in the box coordinate prediction, Objectness Loss is the target confidence loss component, y i is the true target confidence label of the i-th sample, is the target confidence of the i-th sample predicted by the model, It has a mean of 0 and a variance of σ 2 Gaussian random noise, DFL is the deep feature loss component, L is the number of deep feature layers, which is used to control the importance of the deep feature loss of the lth layer, H l and W l Represent the height and width of the deep feature of the lth layer, feature target,l is the lth layer deep feature of the target feature map, feature reference,l is the lth layer depth feature of the reference feature map, noise represents the additive noise term, and its dimension and feature feature target,l and feature reference,l same.

9. The underwater target detection method based on the enhanced YOLOv9 model according to claim 6, characterized in that: The optimization algorithm used by the parameter optimization and weight update module includes one of the SGD optimization algorithm and the Adam optimization algorithm, wherein the step of using the Adam optimization algorithm to perform parameter optimization includes: Initialization: Initialize the parameters, including the model parameters w t , first-order moment estimate m t , second-order moment estimate v t , adjustable hyperparameters β1 and β2 that control the weights of the first-order and second-order moment estimates, numerical stability parameter ∈, and the standard deviation noise_std of the additive white Gaussian noise; Compute the gradient: Where f(w t ) is the objective function, g t is the gradient; Update the first moment estimate: in is the random noise sampled from a Gaussian distribution with a mean of 0 and a standard deviation of noise_std; Update the second moment estimate: Correction of the corrected first-order moment estimate: in is the first-order moment estimate after correcting the bias, is the t-th power of the exponentially weighted moving average coefficient of the first-order moment estimate; Correct the bias in the second moment estimate: in is the second-order moment estimate after correcting the bias, is the t-th power of the exponentially weighted moving average coefficient of the second-order moment estimate; Update parameters: Where α is the learning rate.

10. An underwater target detection system based on an enhanced YOLOv9 model, characterized in that: include: Underwater imaging subsystem: used to obtain real-time image data in underwater environment; Data enhancement subsystem: used for performing preprocessing and data enhancement operations on the image data to obtain enhanced image data; Real-time monitoring subsystem: used to input the enhanced image data into a pre-trained underwater target detection model for real-time detection and processing; Performance evaluation subsystem: used to evaluate the performance of the underwater target detection model; Result output subsystem: used to output real-time detection and processing results.

Citation Information

Cited By

  • Underwater image data processing method and system and electronic equipment

    CN118865091A

  • PCB defect detection method, system and equipment and storage medium

    CN119048496A

  • Remote sensing image aircraft detection method and system based on local similarity migration generator

    CN119600483A

  • A Remote Sensing Image Aircraft Detection Method and System Based on a Local Similarity Offset Generator

    CN119600483B

  • Region segmentation method and system for underwater target sonar image detection

    CN119850647A