CN118587569A - Underwater target detection method and system based on enhanced YOLOv9 model - Google Patents
Underwater target detection method and system based on enhanced YOLOv9 model Download PDFInfo
- Publication number
- CN118587569A CN118587569A CN202410652686.6A CN202410652686A CN118587569A CN 118587569 A CN118587569 A CN 118587569A CN 202410652686 A CN202410652686 A CN 202410652686A CN 118587569 A CN118587569 A CN 118587569A
- Authority
- CN
- China
- Prior art keywords
- feature map
- enhanced
- target detection
- model
- module
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/05—Underwater scenes
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/30—Noise filtering
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/80—Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
- G06V10/806—Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level of extracted features
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Software Systems (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- General Engineering & Computer Science (AREA)
- Molecular Biology (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Biophysics (AREA)
- Databases & Information Systems (AREA)
- Medical Informatics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Image Analysis (AREA)
Abstract
Description
技术领域Technical Field
本发明涉及水下目标检测技术领域,尤其是涉及一种基于增强YOLOv9模型的水下目标检测方法及系统。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
水下目标检测技术在海军海防、渔业、水产养殖、海底残骸回收和海洋生态系统研究等领域的广泛应用,强调了其在解决关键挑战和推进多样化应用方面的关键作用。随着该技术的日益突出,必须认识到水下环境的固有复杂性,这将极大地影响目标检测的有效性。复杂的水下环境带来了巨大的挑战,包括复杂的海洋生物、独特的水下环境条件和噪音的影响等因素。这些因素构成了巨大的障碍,使相关特征的提取复杂化。实现高精度和实时性之间的微妙平衡对于水下目标探测的成功应用至关重要,满足实际场景的严格要求。传统的图像处理检测算法原本是为地面场景量身定制的,在应用于水下目标检测时遇到了局限性,制约了机器视觉技术的广泛应用。这一限制强调了创新方法的必要性,特别是针对水下目标探测的独特条件,推动了对这一关键领域进一步研究和进步的需求。考虑到这些因素,本文深入研究了水下目标检测的多方面挑战,并探索了提高水下目标检测效率的创新方法,有助于该技术向实际应用的发展。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.
现有的目标检测方法在各个方面都存在许多缺陷。首先,深度网络中的大量信息丢失构成了一个重大挑战。由于输入数据经过逐层特征提取和空间变换,大量信息丢失,形成信息瓶颈,对梯度流产生不利影响,进而影响模型的预测精度。此外,梯度的不可靠性是训练过程中信息丢失的另一个问题。深度网络可能产生不可靠的梯度,阻碍正确特征表示的有效学习。此外,某些网络架构,如ResNet和CSPNet,在特定任务中表现出色,但在所有任务中可能缺乏最佳性能,特别是在信息保留和梯度信息可靠性方面。为了解决信息丢失问题,可逆架构在缓解问题的同时,引入了额外的层来组合重复输入数据,从而增加了推理成本。此外,为非常深度的神经网络架构量身定制的深度监督方法被证明不适合轻量级模型,导致性能不稳定或参数不足。对预训练模型的依赖代表了另一个约束,限制了对新领域或小数据集的适应性。此外,某些对象检测方法,如基于transformer的模型,以牺牲高计算复杂性为代价证明了性能的提高,使它们不适合实时应用。最后,尽管某些方法可能在特定数据集上表现得很熟练,但当应用于新的或不同的数据集时,它们的泛化能力会减弱。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
本发明的目的就是为了提供一种提高水下目标检测准确性的基于增强YOLOv9模型的水下目标检测方法及系统。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.
本发明的目的可以通过以下技术方案来实现:The purpose of the present invention can be achieved by the following technical solutions:
一种基于增强YOLOv9模型的水下目标检测方法,包括以下步骤:An underwater target detection method based on an enhanced YOLOv9 model comprises the following steps:
实时获取水下环境中的图像数据,进行预处理和数据增强操作,得到增强后的图像数据;Acquire image data in underwater environment in real time, perform preprocessing and data enhancement operations, and obtain enhanced image data;
将所述增强后的图像数据输入至预先训练好的水下目标检测模型中,输出水下目标检测结果,所述水下目标检测模型采用YOLOv9网络进行构建,所述水下目标检测模型包括增强型可变核模块和与其依次连接的空间到深度去噪模块、特征融合模块和预测集成模块;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.
进一步地,所述数据增强操作包括旋转、翻转、缩放和引入人工噪声,以放大预处理后的图像数据的可变性。Furthermore, the data enhancement operation includes rotation, flipping, scaling and introducing artificial noise to amplify the variability of the pre-processed image data.
进一步地,所述增强型可变核模块包括理想高通滤波器、第一卷积层、第一多尺度重采样层、第二多尺度重采样层、第二卷积层、特征图归一化层和SiLU激活层,所述增强型可变核模块得到高频特征图的步骤包括: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:
对所述增强后的数据集进行理想高通滤波器处理,以去除低频信息并保留高频信息,得到初始高频特征图;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;
将所述多维张量依次经过所述第二多尺度重采样层、第二卷积层、特征图归一化层和SiLU激活层进行处理,得到高频特征图。The multidimensional tensor is processed sequentially through the second multi-scale resampling layer, the second convolutional layer, the feature map normalization layer and the SiLU activation layer to obtain a high-frequency feature map.
进一步地,所述理想高通滤波器的表达式为:Furthermore, the expression of the ideal high-pass filter is:
式中,h(f)是频率响应,f是频率,fc是理想高通滤波器的截止频率。Where h(f) is the frequency response, f is the frequency, and fc is the cutoff frequency of the ideal high-pass filter.
进一步地,所述空间到深度去噪模块得到去噪后的下采样特征图的步骤包括:Furthermore, the step of obtaining the denoised downsampled feature map by the space-to-depth denoising module includes:
对所述高频特征图X进行空间深度降采样,以将维度为(S,S,C1)的高频特征图X降采样为多个维度为(C1)的子图,并将子图进行连接,得到维度为(4C1)的特征图X′,其中S为原始特征图的空间维度,包括高度和宽度,C1为原始特征图的通道数;The high-frequency feature map X is spatially downsampled to downsample the high-frequency feature map X with a dimension of (S, S, C 1 ) into multiple dimensions of ( C 1 ) and connect the subgraphs to get a subgraph with dimension ( 4C 1 ), where S is the spatial dimension of the original feature map, including height and width, and C 1 is the number of channels of the original feature map;
将所述特征图X′进行二维离散傅立叶变换,将其转换到频域进行频率滤波处理,并使用三角滤波器进行去噪处理,得到去噪处理后的频域数据,其中所述二维离散傅立叶变换和三角滤波器的表达式分别为:The feature graph 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:
将去噪处理后的频域数据进行逆离散傅立叶变换,并应用非滑动卷积处理,得到维度为(C2)的去噪后的下采样特征图X″,其中C2为经过非滑动卷积处理后特征图的通道数,所述逆离散傅立叶变换的表达式为:The denoised frequency domain data is subjected to inverse discrete Fourier transform and non-sliding convolution is applied to obtain a dimension of ( C 2 ) after denoising, where C 2 is the number of channels of the feature map after non-sliding convolution processing, and the expression of the inverse discrete Fourier transform is:
式中,F(u,v)为离散傅立叶变换,u和v分别表示频域的水平和垂直位置,取值范围为u=0,1,...,M-1和v=0,1,...,N-1,j是虚数单位,f(x,y)为逆离散傅立叶变换,H(f)为三角滤波器的频率响应,f是频率,fc是滤波器的中心频率。Where F(u,v) is the discrete Fourier transform, u and v represent the horizontal and vertical positions in the frequency domain, respectively, 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 fc is the center frequency of the filter.
进一步地,所述水下目标检测模型还包括输入处理模块、损失函数计算模块、通道压缩架构和参数优化与权值更新模块,所述水下目标检测模型的训练步骤包括: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:
步骤1、获取水下环境中的图像数据生成数据集,并对所述数据集进行预处理和增强操作,得到增强后的数据集;Step 1: acquiring image data in an underwater environment to generate a data set, and performing preprocessing and enhancement operations on the data set to obtain an enhanced data set;
步骤2、所述输入处理模块将增强后的数据集输入增强型可变核模块中进行上采样,以利用动态调整的采样形状和偏移来提取特征,去除低频信息,保留高频信息,得到高频特征图;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;
步骤3、将所述高频特征图输入至所述空间到深度去噪模块中进行下采样和去噪处理,得到去噪后的下采样特征图;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;
步骤4、将所述去噪后的下采样特征图输入所述特征融合模块中进行特征融合,并将得到的融合特征图传递给所述预测集成模块输出预测结果;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;
步骤5、基于所述损失函数计算模块,根据输出的预测结果和对应的实际标签计算损失,并利用所述通道压缩架构降低参数量;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;
步骤6、基于所述损失,所述参数优化与权值更新模块采用反向传播算法更新网络权重,并采用优化算法进行参数优化;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;
步骤7、重复步骤2-步骤6,直至水下目标检测模型达到预期目标。Step 7: Repeat steps 2 to 6 until the underwater target detection model achieves the expected goal.
进一步地,所述预测集成模块采用Softmax函数输出预测结果,所述预测结果包括目标类别概率和目标框位置,将其作为所述水下目标检测结果,所述Softmax函数的表达式为: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:
z=[z1,z2,...,zC]z=[z 1 ,z 2 ,...,z C ]
式中,softmax(z)i表示Softmax函数对向量z的第i个元素的计算结果,e是自然对数的底,即欧拉常数,zi是向量z的第i个元素,是对向量z中所有元素进行指数函数运算后求和得到的总和,C为向量z的长度,j为循环变量。In the formula, softmax(z) i represents the calculation result of the Softmax function on the i-th element of the vector z, e is the base of the natural logarithm, that is, the Euler 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.
进一步地,所述损失函数计算模块中的损失函数包括多个损失分量,每个损失分量被加权并汇总成总损失函数,所述损失分量包括分类损失分量、盒损失分量、目标置信度损失分量和深度特征损失分量,表达式分别为: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:
式中,Class Loss为分类损失分量,N是样本总数,C是类别总数,yi,c是第i个样本属于类别c的真实标签,是模型预测第i个样本属于类别c的概率,∈i,c是加性白色高斯噪声,用于在模型预测和真实标签之间引入随机性因素,Box Loss为盒损失分量,λcoord是用于平衡目标框位置损失和其他损失部分的权重参数,S2表示网格单元的数量,B是每个网格单元预测的边框数量,是指示函数,表示第i个网格、第j个边框负责检测物体,xi,yi,wi,hi是第i个目标框的位置参数,是模型预测的第i个目标框的位置参数,∈x,∈y,∈w,∈h是相位噪声,分别对应盒坐标预测中的X、Y方向和宽度、高度预测,Objectness Los为目标置信度损失分量,yi是第i个样本的真实目标置信度标签,是模型预测的第i个样本的目标置信度,是服从均值为0,方差为σ2的高斯随机噪声,DFL为深度特征损失分量,L是深度特征层的数量,用于控制第l层深度特征损失的重要性,Hl和Wl分别表示第l层深度特征的高度和宽度,featuretarget,l是目标特征图的第l层深度特征,featurereference,l是参考特征图的第l层深度特征,noise表示加性噪声项,其维度和特征featuretarget,l和featurereference,l相同。Where Class Loss is the classification loss component, N is the total number of samples, C is the total number of categories, 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 the model prediction and the true label, Box Loss is the box loss component, λ coord is the 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 borders predicted for each grid cell, is the indicator function, indicating that the i-th grid and the j-th frame are responsible for detecting the object. x i , y i , w i , h i are the position parameters of the i-th target frame. is the position parameter of the i-th target box predicted by the model, ∈ x ,∈ y ,∈ w ,∈ h are phase noises, corresponding to the X, Y directions and width, height predictions in the box coordinate prediction, respectively, Objectness Loss is the target confidence loss component, yi is the true target confidence label of the i-th sample, is the target confidence of the i-th sample predicted by the model, is a Gaussian random noise with mean 0 and variance σ 2 , DFL is the deep feature loss component, L is the number of deep feature layers, which is used to control the importance of the loss of the deep features of the lth layer, H l and W l represent the height and width of the deep features of the lth layer, respectively, 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, and its dimension is the same as the features feature target,l and feature reference,l .
进一步地,所述参数优化与权重更新模块采用的优化算法包括SGD优化算法和Adam优化算法中的一种,其中采用Adam优化算法进行参数优化的步骤包括:Furthermore, the optimization algorithm adopted by the parameter optimization and weight update module includes one of an SGD optimization algorithm and an Adam optimization algorithm, wherein the step of using the Adam optimization algorithm to perform parameter optimization includes:
初始化:对参数进行初始化,所述参数包括模型参数wt、一阶矩估计mt、二阶矩估计vt、控制一阶估计和二阶矩估计权重的可调超参数β1和β2、数值稳定参数∈和加性白色高斯噪声的标准差noise_std;Initialization: Initialize the parameters, including the model parameter w t , the first-order moment estimate m t , the second-order moment estimate v t , the adjustable hyperparameters β 1 and β 2 for controlling the weights of the first-order estimate and the second-order moment estimate, the numerical stability parameter ∈, and the standard deviation noise_std of the additive white Gaussian noise;
计算梯度:其中f(wt)是目标函数,gt为梯度;Compute the gradient: Where f(w t ) is the objective function and g t is the gradient;
更新一阶矩估计:其中为从均值为0,标准差为noise_std的高斯分布中采样得到的随机噪声;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:
纠正一阶矩估计的纠正:其中为纠正偏差后的一阶矩估计,为一阶矩估计的指数加权移动平均系数的t次幂;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;
纠正二阶矩估计的偏差:其中为纠正偏差后的二阶矩估计,为二阶矩估计的指数加权移动平均系数的t次幂;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.
本发明还提供一种基于增强YOLOv9模型的水下目标检测系统,包括:The present invention also provides an underwater target detection system based on an enhanced YOLOv9 model, comprising:
水下成像子系统:用于获取实时获取水下环境中的图像数据;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.
与现有技术相比,本发明具有以下有益效果:Compared with the prior art, the present invention has the following beneficial effects:
(1)针对现有YOLOv9网络在水下环境中表现出局限性,本发明基于YOLOv9网络构建水下目标检测模型,在该模型中设计增强型可变核模块、空间到深度去噪模块,提取高频特征,且可以在不影响信息丢失的情况下有效减小空间维度,同时保留了信道信息,有助于提高卷积神经网络对低分辨率图像和小物体的检测性能,提高检测结果的准确性。(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.
(2)本发明增强型可变核模块,适应不同数据集的不同目标形状和大小,提高了卷积核参数和采样形状的灵活性,并去除低频信息,保留高频信息,从而突出数据集的高频特征,以提升水下目标检测的准确性和稳定性(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.
(3)本发明通道压缩架构,旨在降低卷积神经网络的计算开销,使其更适合在水下嵌入式设备上部署。(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.
(4)本发明设计的空间到深度去噪模块、增强型可变核模块和通道压缩架构,提高了系统在复杂水下环境下目标检测的效率,增强了准确率、召回率和平均精度。(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
图1为本发明的方法流程示意图;FIG1 is a schematic flow chart of the method of the present invention;
图2为本发明的系统结构图;FIG2 is a system structure diagram of the present invention;
图3为本发明的增强型可变核模块的具体结构示意图;FIG3 is a schematic diagram of the specific structure of the enhanced variable core module of the present invention;
图4为本发明的空间到深度去噪模块的具体结构示意图;FIG4 is a schematic diagram of a specific structure of a space-to-depth denoising module of the present invention;
图5为本发明的通道压缩架构的具体结构示意图;FIG5 is a schematic diagram of a specific structure of a channel compression architecture of the present invention;
图6为本发明的检测效果图。FIG. 6 is a diagram showing the detection effect of the present invention.
具体实施方式DETAILED DESCRIPTION
下面结合附图和具体实施例对本发明进行详细说明。本实施例以本发明技术方案为前提进行实施,给出了详细的实施方式和具体的操作过程,但本发明的保护范围不限于下述的实施例。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.
本实施例提供一种基于增强YOLOv9模型的水下目标检测方法,如图2所示,本实施例的检测方法集成在该方法对应的检测系统中,检测系统分为5个子系统,包括水下成像子系统、数据增强子系统、实时检测子系统、性能评估子系统和结果输出子系统:This embodiment provides an underwater target detection method based on an enhanced YOLOv9 model. As shown in FIG2 , the detection method of this embodiment is integrated into a 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:
1)水下成像子系统:负责捕获水下环境中的图像并生成数据集,与数据增强子系统相连接,将捕获的数据集传递给后者;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;
2)数据增强子系统:通过对数据集进行预处理和增强,对数据集的扩展起到关键作用,处理后的数据集随后传递给实时检测子系统,为后续处理提供充足的数据支持;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;
3)实时检测子系统:包括输入处理模块、增强型可变核模块、空间到深度去噪模块、特征融合模块、预测集成模块、损失函数计算模块、通道压缩架构、参数优化与权值更新模块,这些模块协作实现输入数据的实时检测和处理,此外,实时检测子系统与性能评估子系统相连接,后者对模型的性能进行评估和监控;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;
4)性能评估子系统:通过间歇性地使用一个独立的验证集来评估模型的性能,如果模型达到了预期的目标,评估结果将被传递给结果输出子系统,否则性能评估子系统将调整学习率、批量大小和正则化强度等超参数,并将调整后的参数传递给实时检测子系统,以优化模型的性能;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.
5)结果输出子系统:是系统中的最后一环,其主要功能是将经过处理和分析后得到的最终结果进行输出,以供用户使用。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.
如图1所示,该方法包括以下步骤:As shown in FIG1 , the method comprises the following steps:
S1、获取水下环境图像数据的目标检测数据集,并进行预处理和数据增强操作。S1. Obtain a target detection dataset of underwater environment image data, and perform preprocessing and data enhancement operations.
S1.1、水下成像子系统从水下环境中获取图像数据,并随后将其转换为YOLO格式以生成用于水下目标检测的数据集。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.
S1.2、数据增强子系统将采集到的数据集划分为训练集和测试集,随后丰富训练集的多样性和丰富性,增强方法包括旋转、翻转、缩放和引入人工噪声来放大数据集的可变性,因此,该过程提高了模型性能并扩展了训练数据集。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.
本实施例也可使用使用水下光学目标检测智能算法数据集URPC 2021作为主要数据集,该数据集由7600张图像组成,其中6400张用于训练,1200张用于测试,该数据集包含四个目标检测类别:海螺、棘轮、扇贝和海星,为了创建不同的训练集和验证集,数据增强子系统使用1:1的比例对原始训练数据进行分区。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.
S2、建立水下目标检测模型。S2. Establish an underwater target detection model.
该步骤建立水下目标检测模型,增强其功能,并进行初始化:This step builds an underwater target detection model, enhances its functionality, and performs initialization:
S2.1、本实施例实时检测子系统负责通过YOLOv9网络结构构建水下目标检测模型,包括输入处理模块、增强型可变核模块、空间到深度去噪模块、特征融合模块、预测集成模块、损失函数计算模块、通道压缩架构、参数优化与权值更新模块。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.
S2.2、随后实时检测子系统增强YOLOv9,需要融合空间到深度的卷积、增强型可变核模块和通道压缩架构,采用增强型可变核模块以适应不同数据集的不同目标形状和大小,在主干网络和颈部网络的部分模块之间添加相应的空间到深度去噪模块以提高水下目标的检测精度,设计了通道压缩架构降低网络参数量和计算量以提高网络的检测性能,最终得到增强YOLOv9,即水下目标检测模型。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.
S2.3、实时检测子系统进行网络初始化。S2.3. The real-time detection subsystem performs network initialization.
S3、所述输入处理模块将数据集输入到增强型可变核模块提取高频特征,并输入至空间到深度去噪模块进行下采样并去噪,得到去噪后的下采样特征图。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.
S3.1、实时检测子系统中的输入处理模块将数据集输入到增强型可变核模块进行上采样,增强型可变核模块利用动态调整的采样形状和偏移来提取特征,去除低频信息,保留高频信息,突出数据集的高频特征。S3.1. The input processing module in the real-time detection subsystem inputs the data set to 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.
具体来说,在图3中,增强型可变核模块包括理想高通滤波器、第一卷积层、第一多尺度重采样层、第二多尺度重采样层、第二卷积层、特征图归一化层和SiLU激活层,该模块会首先对维度为(C,H,W)的输入图像进行理想高通滤波器处理,以去除低频信息并保留高频信息。随后,利用卷积核的初始采样形状对图像进行卷积,产生相应的核偏移量,其维度为(2N,H,W)。卷积层将根据学到的偏移量值调整初始采样形状,并根据调整后的采样形状对特征映射进行多尺度重采样,将特征转换为四维张量(C,5,H,W),这里的5表示卷积内核大小。随后,经过多尺度重采样、卷积和特征图归一化处理,最终通过SiLU激活函数输出结果;Specifically, in Figure 3, 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 module will first perform an ideal high-pass filter on the input image of dimension (C, H, W) to remove low-frequency information and retain high-frequency information. Subsequently, the image is convolved using the initial sampling shape of the convolution kernel to generate a corresponding kernel offset with a dimension of (2N, H, W). The convolution layer will adjust the initial sampling shape according to the learned offset value, and perform multi-scale resampling on 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;
理想高通滤波器的公式h(f)可以表示为:The formula h(f) for an ideal high-pass filter can be expressed as:
其中,h(f)是频率响应,f是频率,fc是理想高通滤波器的截止频率。Where h(f) is the frequency response, f is the frequency, and fc is the cutoff frequency of an ideal high-pass filter.
SiLU激活函数的数学表达式为:The mathematical expression of the SiLU activation function is:
SiLU(x)=x·σ(x)SiLU(x)=x·σ(x)
其中,σ(x)表示Sigmoid函数,其数学表达式为:Among them, σ(x) represents the Sigmoid function, and its mathematical expression is:
S3.2、经过增强型可变核模块处理后的数据集将被传递至空间到深度去噪模块,该模块会对数据集进行下采样并去噪,以提高图像质量,得到去噪后的下采样特征图。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.
图4展示了空间到深度去噪模块的具体结构示意图。该模块首先进行空间深度降采样,将维度为(S,S,C1)的特征图X降采样为四个维度为(C1)的子图。然后,将这些子图连接,得到维度为(4C1)的特征图X′。此后,进行二维离散傅立叶变换,将其转换到频域进行频率滤波处理,使用三角滤波器进行去噪处理,将经过三角滤波器处理后的频域数据进行逆傅立叶变换,并应用非滑动卷积层,得到维度为(C2)的最终特征图X″。Figure 4 shows the specific structural diagram of the space-to-depth denoising module. The module first performs space-depth downsampling, downsampling the feature map X with dimensions (S, S, C 1 ) into four dimensions ( C 1 ). Then, these subgraphs are connected to obtain a subgraph of dimension ( 4C 1 ) 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 ( C 2 )’s final feature map X″.
其中,离散二维傅立叶变换F(u,v)定义为:Among them, the discrete two-dimensional Fourier transform F(u,v) is defined as:
逆离散二维傅立叶变换的公式为:The formula for the inverse discrete two-dimensional Fourier transform is:
其中,u和v分别表示频域的水平和垂直位置,取值范围为u=0,1,...,M-1和v=0,1,...,N-1,j是虚数单位。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.
三角过滤器的公式H(f)可表示为:The formula of the triangular filter H(f) can be expressed as:
其中,H(f)是滤波器的频率响应,f是频率,fc是滤波器的中心频率。Where H(f) is the frequency response of the filter, f is the frequency, and fc is the center frequency of the filter.
S4、将所述去噪后的下采样特征图输入所述特征融合模块中进行各个层次的特征融合,得到融合特征图,再输入预测集成模块中,输出预测结果。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.
该步骤中特征融合模块集成来自各个层次的特征信息,将融合后的特征传递给预测集成模块,随后,该模块预测集成模块处理的输出目标的类别概率和边界框位置。具体步骤如下: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:
S4.1、特征融合模块包括不同层次特征映射的缩放和通道混合,这个过程的目的是保证每一层的特征都包含全面和多样化的信息。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.
S4.2、预测集成模块对融合特征映射上的目标帧进行预测,其中使用带有激活函数的卷积运算预测每个位置的目标框的位置和大小。S4.2, the prediction integration module predicts the target frame on the fused feature map, where the convolution operation with activation function is used to predict the position and size of the target box at each position.
S4.3、为每个目标框生成类别预测,预测集成模块使用Softmax函数将分数转换为每个类别的概率。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.
为每个目标框生成类别预测,使用Softmax函数将分数转换为每个类别的概率,其公式如下: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:
给定一个长度为C的向量z=[z1,z2,...,zC],Softmax函数的公式为:Given a vector z = [z 1 ,z 2 ,...,z C ] of length C, the formula of the Softmax function is:
其中:softmax(z)i表示Softmax函数对向量z的第i个元素的计算结果;e是自然对数的底,即欧拉常数;zi是向量z的第i个元素;分母部分是对向量z中所有元素进行指数函数运算后求和得到的总和。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, the Euler 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.
Softmax函数将输入向量z中的每个元素转换为位于0到1之间的概率值,且所有概率值的和为1,适用于多分类问题中的类别概率预测。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.
S4.4、预测集成模块统计算目标盒的置信度得分,并将类别预测结果与目标盒预测结果相结合,确定目标盒中是否包含目标。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.
S5、基于所述损失函数计算模块,根据输出的预测结果和对应的实际标签计算损失,并利用所述通道压缩架构降低参数量。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.
S5.1、损失函数计算模块使用预测结果和实际标签计算损失函数,包括分类损失(Class Loss)、盒损失(Box Loss)、目标置信度损失(Objectness Loss)和函数深度特征损失(Deep Feature Loss,DFL),这些单独的损失分量被加权并汇总成损失函数内的总损失,权重的选择取决于具体的任务要求和训练策略。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.
(1)分类损失函数通过计算真实类别标签与模型预测的概率之间的交叉熵损失,来衡量模型分类输出与真实类别之间的差异。在训练过程中,通过最小化分类损失来优化模型的分类性能,其公式如下:(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:
在这个公式中:N是样本总数,C是类别总数,yi,c是第i个样本属于类别c的真实标签,是模型预测第i个样本属于类别c的概率,∈i,c是加性白色高斯噪声,用于在模型预测和真实标签之间引入随机性因素,可以帮助模型更好地适应水下环境中的不确定性和复杂性,增强模型的鲁棒性和泛化能力。In this formula: N is the total number of samples, C is the total number of categories, 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 random factors between the model prediction and the true label, which 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.
(2)盒损失函数主要用于衡量目标框位置预测与真实目标框位置之间的差异,通过最小化盒损失来优化模型的目标框位置预测,可用平方误差损失函数来计算,其公式如下:(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:
在上述公式中:λcoord是用于平衡目标框位置损失和其他损失部分的权重参数,S2表示网格单元的数量,B是每个网格单元预测的边框数量,是指示函数,表示第i个网格、第j个边框负责检测物体,xi,yi,wi,hi是第i个目标框的位置参数,是模型预测的第i个目标框的位置参数,∈x,∈y,∈w,∈h是相位噪声,分别对应盒坐标预测中的X、Y方向和宽度、高度预测,这些相位噪声可以模拟频率漂移或相位变化,使得模型在处理盒坐标时考虑更多环境中可能存在的扰动这种调整可以增强模型的鲁棒性和泛化能力,使其更好地处理水下环境中的挑战。In the above formula: λ coord is the 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 predicted borders for each grid cell, is the indicator function, indicating that the i-th grid and the j-th frame are responsible for detecting the object. x i , y i , w i , h i are the position parameters of the i-th target frame. are the position parameters of the i-th target box predicted by the model, ∈ x ,∈ y ,∈ w ,∈ h are phase noises, corresponding to the X, Y directions and width, height predictions in the box coordinate predictions, respectively. 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.
(3)目标置信度损失函数衡量了模型对目标框内是否存在目标的预测与真实情况之间的差异,通过这种损失函数进行优化,有助于提高目标检测模型在判断目标存在与否的准确性,通常使用二元交叉熵损失函数来计算,其公式如下:(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:
在这个公式中:N是样本总数,yi是第i个样本的真实目标置信度标签,是模型预测的第i个样本的目标置信度,是服从均值为0,方差为σ2的高斯随机噪声,可以根据实际应用场景来选择合适的σ2值,以更好地模拟水下环境中的噪声情况。In this formula: N is the total number of samples, yi is the true target confidence label of the ith sample, is the target confidence of the i-th sample predicted by the model, It is a Gaussian random noise with a mean of 0 and a variance of σ 2. The appropriate σ 2 value can be selected according to the actual application scenario to better simulate the noise situation in the underwater environment.
(4)深度特征损失函数通常用于引导模型学习更具有语义信息的特征表示,其公式如下:(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:
在这个公式中:L是深度特征层的数量,用于控制第l层深度特征损失的重要性,Hl和Wl分别表示第l层深度特征的高度和宽度,featuretarget,l是目标特征图的第l层深度特征,featurereference,l是参考特征图的第l层深度特征,noise表示加性噪声项,可以是一个随机生成的向量或矩阵,其维度和特征featuretarget,l和featurereference,l相同,将噪声项添加到特征中可以帮助模型更好地处理水下环境中的不确定性和扰动,提升模型的鲁棒性和泛化能力。In this formula: L is the number of deep feature layers, which is used to control the importance of the loss of the l-th layer deep features, H l and W l represent the height and width of the l-th layer deep features respectively, feature target,l is the l-th layer deep feature of the target feature map, feature reference,l is the l-th 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 the features feature target,l and feature reference,l. Adding noise terms to the features can help the model better handle the uncertainty and disturbance in the underwater environment and improve the robustness and generalization ability of the model.
S5.2、损失函数计算模块利用通道压缩架构降低卷积神经网络的计算开销,提高效率。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.
损失函数计算模块利用通道压缩架构降低卷积神经网络的计算开销,提高效率,将上述损失项加权并汇总为损失函数内的总损失,通道压缩架构如图5所示,首先采用标准的1x1卷积对输入图片进行通道数的压缩来减少输入图像中的通道数量,然后再进行深度卷积(即Φ1,Φ2,...,Φk)生成更多的特征图,随后将不同的特征映射合并在一起,形成新的输出。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 as the total loss in the loss function. The channel compression architecture is shown in Figure 5. First, the standard 1x1 convolution is used to compress the number of channels of the input image to reduce the number of channels in the input image, and then deep convolution (i.e., Φ 1 ,Φ 2 ,...,Φ k ) is performed to generate more feature maps, and then different feature maps are merged together to form a new output.
S6、基于所述损失,所述参数优化与权值更新模块采用反向传播算法更新网络权重,并采用优化算法进行参数优化。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.
该步骤利用损失函数通过反向传播算法更新网络权重,应用优化算法(如SGD、Adam等)进行参数优化。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.
S6.1、参数优化与权重更新模块通过反向传播算法计算损失函数关于权重的梯度,以便更新网络参数,在反向传播过程中,通过计算损失函数的梯度,可以沿着梯度的反方向更新网络中的权重,使得损失函数最小化。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.
S6.2、在优化方面,可以采用常见的优化算法,例如随机梯度下降(StochasticGradient Descent,SGD)或者其改进算法,如Adam Optimizer等,优化器的选择可以根据具体实验结果和网络结构进行调整,以达到更快速和稳定的收敛。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 the specific experimental results and network structure to achieve faster and more stable convergence.
S6.3、在反向传播计算得到梯度后,使用选定的优化器进行参数更新。根据梯度下降的原理,更新参数时需要考虑梯度的方向和大小,以调整网络参数使得损失函数逐步减小。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.
本实施例中应用Adam优化算法进行参数优化,Adam算法的计算公式如下:In this embodiment, the Adam optimization algorithm is used to optimize parameters. The calculation formula of the Adam algorithm is as follows:
1)初始化参数:wt是模型参数,mt是一阶矩估计,vt是二阶矩估计,β1和β2是可调的超参数,控制一阶和二阶矩估计的权重,∈是数值稳定参数,noise_std是加性白色高斯噪声的标准差;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;
2)计算梯度:其中f(wt)是目标函数;2) Calculate the gradient: Where f(w t ) is the objective function;
3)更新一阶矩估计: 3) Update the first-order moment estimate:
4)更新二阶矩估计: 4) Update the second-order moment estimate:
5)纠正一阶矩估计的偏差: 5) Correct the bias of the first-order moment estimate:
6)纠正二阶矩估计的偏差: 6) Correct the bias of the second-order moment estimate:
7)更新参数:其中α是学习率;7) Update parameters: Where α is the learning rate;
在Adam算法中,β1控制一阶矩估计的衰减率,β2控制二阶矩估计的衰减率,∈避免除零错误。In the Adam algorithm, β1 controls the decay rate of the first-order moment estimate, and β2 controls the decay rate of the second-order moment estimate, ∈ to avoid division by zero errors.
S7、根据评估结果调整网络结构和训练策略,重复步S3至S6,直至模型性能达到预期目标。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.
S7.1、在整个训练过程中,性能评估子系统间歇性地使用一个独立的验证集来评估模型的性能,该数据集包含训练期间未遇到的数据,便于模拟真实场景;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.
S7.2、如果模型不能达到预期目标,性能评估子系统将调整学习率、batch size和正则化强度等超参数,然后将调整后的参数传递给实时检测子系统,以优化模型的性能,重复步骤S3至S6;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;
S7.3、模型训练完成后,性能评估子系统使用测试集验证最终模型的泛化能力,经过充分训练和验证的系统模型随后被部署到目标检测任务的实际应用中,在模型实际使用过程中收集的性能数据作为反馈收集,以进一步提高模型的性能;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;
S7.4、结果输出子系统负责输出经过处理和分析得到的最终结果,供用户使用。S7.4. The result output subsystem is responsible for outputting the final results obtained after processing and analysis for user use.
在本发明中,实验性能指标包括了常用的目标检测指标:准确率、召回率、平均精度和效率,具体实验结果见表1。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.
表1YOLOv9与本发明性能对比Table 1 Performance comparison between YOLOv9 and the present invention
如表1所示,本发明在所有指标上都有改进,特别是提高了小物体的检测精度,有效解决了由于物体尺寸过小而错过检测的问题,此外,检测效率提高了3.3%;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%;
本实施例中提出的水下目标探测系统和方法擅长检测不同水下环境中的多个目标。在保证高检测精度的同时,能够适应不同数据集中发现的各种目标形状和大小,从而提高了卷积核参数和采样形状的灵活性。在提高检测速度的同时,降低了卷积神经网络的计算成本,这种适应性使得在计算能力有限的水下嵌入式设备上更容易部署,从而能够实时检测不同尺寸的水下目标。本发明实施例的检测效果如图6所示,对海参“holothurian”、海胆“echinus”、扇贝“scallop”和海星“starfish”这四类水下生物进行检测和分类,分类结果显示在矩形框中。从图中可以看出,即使在图像分辨率较低且目标较小的情况下,该模型仍然能够精确地检测和分类不同的水下生物,体现出本发明实施例在水下目标检测任务中的有效性。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, the computational cost of the convolutional neural network is reduced. This adaptability makes it easier to deploy on underwater embedded devices with limited computing power, so that underwater targets of different sizes can be detected in real time. The detection effect of the embodiment of the present invention is shown in Figure 6, and four types of underwater organisms, 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 in the case of low image resolution and small targets, the model can still accurately detect and classify different underwater organisms, reflecting the effectiveness of the embodiment of the present invention in underwater target detection tasks.
综上所述,首先,为了解决与低分辨率图像和小目标检测相关的问题,本发明实施例设计的空间到深度去噪模块,可以在不影响信息丢失的情况下有效减小空间维度,同时保留了信道信息,有助于提高卷积神经网络对低分辨率图像和小物体的检测性能。为了适应不同数据集的不同目标形状和大小,本发明实施例设计了增强型可变核模块,为卷积核的参数和采样形状提供了灵活性。为了降低卷积神经网络的计算成本,设计了一种通道压缩架构使本发明实施例更适用于水下嵌入式设备,提供了健壮且自适应的解决方案。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.
上述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。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.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。本发明实施例中的方案可以采用各种计算机语言实现,例如,面向对象的程序设计语言Java和直译式脚本语言JavaScript等。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 scheme 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.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to the flowchart and/or block diagram of the method, device (system), and computer program product according to the embodiment of the present invention. It should be understood that each process and/or box in the flowchart and/or block diagram, as well as the combination of the process and/or box 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 produce a device for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。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.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。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 (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410652686.6A CN118587569A (en) | 2024-05-24 | 2024-05-24 | Underwater target detection method and system based on enhanced YOLOv9 model |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410652686.6A CN118587569A (en) | 2024-05-24 | 2024-05-24 | Underwater target detection method and system based on enhanced YOLOv9 model |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN118587569A true CN118587569A (en) | 2024-09-03 |
Family
ID=92531418
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410652686.6A Pending CN118587569A (en) | 2024-05-24 | 2024-05-24 | Underwater target detection method and system based on enhanced YOLOv9 model |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118587569A (en) |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118865091A (en) * | 2024-09-27 | 2024-10-29 | 江西农业大学 | Underwater image data processing method, system and electronic equipment |
| CN119048496A (en) * | 2024-10-30 | 2024-11-29 | 南昌工程学院 | PCB defect detection method, system, equipment and storage medium |
| CN119600483A (en) * | 2024-11-25 | 2025-03-11 | 耕宇牧星(北京)空间科技有限公司 | A remote sensing image aircraft detection method and system based on local similarity offset generator |
| CN119850647A (en) * | 2024-12-20 | 2025-04-18 | 江苏海洋大学 | Region segmentation method and system for underwater target sonar image detection |
| CN120490530A (en) * | 2025-07-17 | 2025-08-15 | 长治市水文水资源勘测站 | Portable flow measuring device for hydrologic test |
-
2024
- 2024-05-24 CN CN202410652686.6A patent/CN118587569A/en active Pending
Cited By (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118865091A (en) * | 2024-09-27 | 2024-10-29 | 江西农业大学 | Underwater image data processing method, system and electronic equipment |
| CN119048496A (en) * | 2024-10-30 | 2024-11-29 | 南昌工程学院 | PCB defect detection method, system, equipment and storage medium |
| CN119600483A (en) * | 2024-11-25 | 2025-03-11 | 耕宇牧星(北京)空间科技有限公司 | A remote sensing image aircraft detection method and system based on local similarity offset generator |
| CN119600483B (en) * | 2024-11-25 | 2025-06-13 | 耕宇牧星(北京)空间科技有限公司 | A remote sensing image aircraft detection method and system based on local similarity offset generator |
| CN119850647A (en) * | 2024-12-20 | 2025-04-18 | 江苏海洋大学 | Region segmentation method and system for underwater target sonar image detection |
| CN119850647B (en) * | 2024-12-20 | 2026-03-03 | 江苏海洋大学 | Region segmentation method and system for underwater target sonar image detection |
| CN120490530A (en) * | 2025-07-17 | 2025-08-15 | 长治市水文水资源勘测站 | Portable flow measuring device for hydrologic test |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11468262B2 (en) | Deep network embedding with adversarial regularization | |
| CN118587569A (en) | Underwater target detection method and system based on enhanced YOLOv9 model | |
| CN112800964B (en) | Remote sensing image target detection method and system based on multi-module fusion | |
| CN111767962B (en) | One-stage target detection method, system and device based on generative adversarial network | |
| CN113592060A (en) | Neural network optimization method and device | |
| CN115223033B (en) | A method and system for target classification of synthetic aperture sonar images | |
| CN112395987A (en) | SAR image target detection method based on unsupervised domain adaptive CNN | |
| US11821986B1 (en) | Target tracking method, system, device and storage medium | |
| CN116912568B (en) | Noisy Label Image Recognition Method Based on Adaptive Class Equalization | |
| CN105678284A (en) | Fixed-position human behavior analysis method | |
| CN107784288A (en) | A kind of iteration positioning formula method for detecting human face based on deep neural network | |
| CN115564983B (en) | Target detection method, device, electronic device, storage medium and application thereof | |
| CN114462490B (en) | Image target retrieval methods, retrieval devices, electronic devices and storage media | |
| CN111274981A (en) | Target detection network construction method and device, target detection method | |
| CN115375966A (en) | Image countermeasure sample generation method and system based on joint loss function | |
| CN113239860B (en) | A video-based method for detecting fireworks | |
| CN116310850B (en) | Remote sensing image target detection method based on improved RetinaNet | |
| CN115294636A (en) | Face clustering method and device based on self-attention mechanism | |
| CN114494065B (en) | Image deblurring method, device, equipment and readable storage medium | |
| WO2019234156A1 (en) | Training spectral inference neural networks using bilevel optimization | |
| CN118038277B (en) | A robot scene recognition method based on lifelong learning | |
| CN110135435B (en) | Saliency detection method and device based on breadth learning system | |
| CN117218545A (en) | Radar image detection method based on LBP features and improved Yolov5 | |
| Pal et al. | MAML-SR: Self-adaptive super-resolution networks via multi-scale optimized attention-aware meta-learning | |
| CN116597275A (en) | A High-Speed Moving Target Recognition Method Based on Data Augmentation |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |