[go: up one dir, main page]

CN116680639A - Deep-learning-based anomaly detection method for sensor data of deep-sea submersible - Google Patents

Deep-learning-based anomaly detection method for sensor data of deep-sea submersible Download PDF

Info

Publication number
CN116680639A
CN116680639A CN202310699555.9A CN202310699555A CN116680639A CN 116680639 A CN116680639 A CN 116680639A CN 202310699555 A CN202310699555 A CN 202310699555A CN 116680639 A CN116680639 A CN 116680639A
Authority
CN
China
Prior art keywords
noise
data
matrix
deep
training
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.)
Granted
Application number
CN202310699555.9A
Other languages
Chinese (zh)
Other versions
CN116680639B (en
Inventor
王洪君
赵元琪
赵朋辉
张笑晗
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong University
Original Assignee
Shandong University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shandong University filed Critical Shandong University
Priority to CN202310699555.9A priority Critical patent/CN116680639B/en
Publication of CN116680639A publication Critical patent/CN116680639A/en
Application granted granted Critical
Publication of CN116680639B publication Critical patent/CN116680639B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Testing Or Calibration Of Command Recording Devices (AREA)

Abstract

本发明涉及一种基于深度学习的深海潜水器传感器数据的异常检测方法,包括:将待检测的深海潜水器的传感器数据预处理后输入训练好的异常检测模型中进行多分类异常检测;异常检测模型包括扩散模型、多头自注意力机制层、全连接层;扩散模型输出提取到的特征信息,并经过自注意力机制层为每一个输入项分配权重,通过权重大小从众多特征信息中选择出对当前任务目标更为关键的信息,并通过全连接层进行分类,判断是否存在异常。本发明更好地关注数据的重要特征;注意力机制可以帮助模型更好地关注数据中的重要特征,从而提高模型的准确性和性能。

The present invention relates to an abnormality detection method for deep-sea submersible sensor data based on deep learning, comprising: preprocessing the sensor data of the deep-sea submersible to be detected and inputting it into a trained abnormality detection model to perform multi-category abnormality detection; abnormality detection The model includes a diffusion model, a multi-head self-attention mechanism layer, and a fully connected layer; the diffusion model outputs the extracted feature information, and assigns weights to each input item through the self-attention mechanism layer, and selects the The information that is more critical to the current task goal is classified through the fully connected layer to determine whether there is an abnormality. The present invention pays better attention to the important features of the data; the attention mechanism can help the model to better pay attention to the important features in the data, thereby improving the accuracy and performance of the model.

Description

一种基于深度学习的深海潜水器传感器数据的异常检测方法Anomaly detection method for deep-sea submersible sensor data based on deep learning

技术领域technical field

本发明涉及一种基于深度学习的深海潜水器传感器数据的异常检测方法,属于传感器设备检测技术领域。The invention relates to a method for abnormality detection of sensor data of a deep-sea submersible based on deep learning, and belongs to the technical field of sensor equipment detection.

背景技术Background technique

载人潜水器是一种用于海洋勘探和海洋科学研究的重要装备。其传感器系统可以实时采集海底环境数据和潜水器状态数据,对潜水器的运行监控和故障诊断起到重要作用。然而,由于海洋环境复杂多变,传感器数据受到噪声和干扰的影响,存在数据异常的情况,需要进行实时的异常检测和定位。Manned submersible is an important equipment for ocean exploration and marine scientific research. Its sensor system can collect seabed environmental data and submersible status data in real time, which plays an important role in the operation monitoring and fault diagnosis of submersibles. However, due to the complex and changeable marine environment, the sensor data is affected by noise and interference, and there are data anomalies, which require real-time anomaly detection and positioning.

深度学习作为一种基于人工神经网络的机器学习技术,可以从数据中自动学习特征表示,并在无需人工干预的情况下进行异常检测。深度学习在图像识别、语音识别、自然语言处理等领域取得了重大进展,并逐渐应用于海洋科学和技术领域。近年来,深度学习技术在潜水器传感器数据异常检测中也获得了广泛关注和应用。其优点在于可以自动学习特征表示和判别标准,对非线性和复杂数据具有较强的建模能力,能够提高异常检测的准确性和效率。As a machine learning technique based on artificial neural networks, deep learning can automatically learn feature representation from data and perform anomaly detection without human intervention. Deep learning has made significant progress in image recognition, speech recognition, natural language processing and other fields, and is gradually being applied to marine science and technology. In recent years, deep learning technology has also gained widespread attention and application in the abnormal detection of submersible sensor data. Its advantage is that it can automatically learn feature representation and discriminant criteria, has strong modeling ability for nonlinear and complex data, and can improve the accuracy and efficiency of anomaly detection.

虽然基于深度学习的载人潜水器传感器数据异常检测算法具有较强的建模能力和高精度的检测效果,但仍存在一些缺陷和不足,包括以下几个方面:Although the manned submersible sensor data anomaly detection algorithm based on deep learning has strong modeling ability and high-precision detection effect, there are still some defects and deficiencies, including the following aspects:

1.数据量不足:基于深度学习的异常检测算法需要大量的数据进行训练和验证,但在实际应用中,由于传感器数据获取成本较高,数据量通常较小,这会影响算法的性能和泛化能力。1. Insufficient data volume: Anomaly detection algorithms based on deep learning require a large amount of data for training and verification. However, in practical applications, due to the high cost of sensor data acquisition, the data volume is usually small, which will affect the performance and generality of the algorithm. ability.

2.标签获取困难:深度学习算法需要标注的数据集,通常需要手动标注,成本较高,且难以获取完整和准确的标签数据集,这也影响了算法的性能。2. Difficulty in obtaining labels: Data sets that need to be labeled by deep learning algorithms usually require manual labeling, which is costly and difficult to obtain complete and accurate label data sets, which also affects the performance of the algorithm.

3.依赖于硬件:深度学习算法需要大量的计算资源和高性能的硬件设备,这增加了算法的成本和复杂度。3. Dependence on hardware: Deep learning algorithms require a large amount of computing resources and high-performance hardware devices, which increases the cost and complexity of the algorithm.

4.模型过拟合:由于深度学习模型具有很强的拟合能力,如果训练数据集和测试数据集的分布不一致,可能会导致模型的过拟合,影响算法的性能和泛化能力。4. Model overfitting: Due to the strong fitting ability of the deep learning model, if the distribution of the training data set and the test data set are inconsistent, it may lead to overfitting of the model and affect the performance and generalization ability of the algorithm.

因此,基于深度学习的载人潜水器传感器数据异常检测方法仍然需要进一步的优化和改进,以提高其性能和可靠性,增强其在实际应用中的可行性和可持续性。Therefore, the anomaly detection method for sensor data of manned submersibles based on deep learning still needs further optimization and improvement to improve its performance and reliability, and enhance its feasibility and sustainability in practical applications.

扩散模型在异常检测中可以用于检测信息传播中的异常行为。具体来说,扩散模型可以使用基于传播行为的统计分析方法来监测信息传播过程中异常的节点和事件,从而发现潜在的异常行为。例如,在社交网络中,扩散模型可以用来检测虚假信息、网络钓鱼、僵尸粉丝等异常行为,帮助社交平台提高信息安全性和信誉度。在金融领域,扩散模型可以用于检测异常交易、洗钱等金融犯罪行为。总的来说,扩散模型在异常检测中有着广泛的应用前景。Diffusion models can be used in anomaly detection to detect abnormal behavior in information dissemination. Specifically, the diffusion model can use statistical analysis methods based on propagation behavior to monitor abnormal nodes and events in the process of information dissemination, so as to discover potential abnormal behaviors. For example, in social networks, diffusion models can be used to detect abnormal behaviors such as false information, phishing, and zombie fans, helping social platforms improve information security and credibility. In the financial field, diffusion models can be used to detect financial crimes such as abnormal transactions and money laundering. Overall, diffusion models have broad application prospects in anomaly detection.

但由于扩散模型的数学描述比较复杂,在处理高维数据时可能会出现维数灾难,这会导致计算量大大增加,同时也会影响模型的准确性和性能。扩散模型在处理非线性问题时可能会出现局部最优解的问题,这会影响模型的优化和训练效果。However, due to the complex mathematical description of the diffusion model, the curse of dimensionality may occur when dealing with high-dimensional data, which will greatly increase the amount of calculation and affect the accuracy and performance of the model. Diffusion models may have local optimal solutions when dealing with nonlinear problems, which will affect the optimization and training effects of the model.

扩散模型对数据的平滑处理可能会导致信息的损失,特别是对于某些特征明显的异常点,可能会被平滑掉,影响检测的效果。The smoothing of the data by the diffusion model may lead to the loss of information, especially for some abnormal points with obvious characteristics, which may be smoothed out, which will affect the detection effect.

扩散模型通常需要大量的计算资源和时间,尤其是在处理大规模数据时,可能需要使用分布式计算等技术来加速计算,这也会增加计算成本和复杂度。Diffusion models usually require a lot of computing resources and time, especially when dealing with large-scale data, it may be necessary to use distributed computing and other technologies to speed up the calculation, which will also increase the computational cost and complexity.

综上所述,虽然扩散模型在很多领域都有着广泛的应用,但在实际应用中也需要根据具体情况选择合适的模型和算法来解决问题,避免出现不足之处造成的影响。To sum up, although the diffusion model is widely used in many fields, it is also necessary to select the appropriate model and algorithm according to the specific situation in practical application to solve the problem and avoid the influence caused by the inadequacy.

发明内容Contents of the invention

针对现有技术的不足,本发明提供了一种基于深度学习的深海潜水器传感器数据的异常检测方法;Aiming at the deficiencies in the prior art, the present invention provides a method for abnormal detection of sensor data of deep-sea submersibles based on deep learning;

本发明基于深度学习,提出一种将注意力机制与扩散模型结合的新算法,从而优化扩散模型的性能并提升扩散模型对数据处理的准确性。Based on deep learning, the present invention proposes a new algorithm combining the attention mechanism and the diffusion model, thereby optimizing the performance of the diffusion model and improving the accuracy of the diffusion model for data processing.

本发明利用多头自注意力机制生成随机步长,从而模拟传感器数据的变化过程。首先定义一个初始时间步长,再引入多头自注意力机制,具体地,对于每个节点,根据其邻居节点的权重和扩散系数,计算出一个随机步长值,用于更新该节点的值。同时,考虑到滑窗中不同节点之间的关联关系,可以根据节点之间的边权重调整步长的大小,从而更好地模拟数据的变化过程。The invention utilizes a multi-head self-attention mechanism to generate a random step size, thereby simulating the change process of sensor data. First define an initial time step, and then introduce a multi-head self-attention mechanism. Specifically, for each node, a random step value is calculated according to the weight and diffusion coefficient of its neighbor nodes to update the value of the node. At the same time, considering the association relationship between different nodes in the sliding window, the step size can be adjusted according to the edge weight between nodes, so as to better simulate the data change process.

本发明将多头注意力机制与扩散模型中反向扩散网络结合,将预测的去噪声的数据矩阵与对应的时间步长的原始数据矩阵进行对照,根据其相邻节点的权重调整扩散系数去除噪声,进行异常检测。The present invention combines the multi-head attention mechanism with the reverse diffusion network in the diffusion model, compares the predicted denoised data matrix with the corresponding time step original data matrix, and adjusts the diffusion coefficient to remove noise according to the weight of its adjacent nodes , for anomaly detection.

本发明的技术方案为:Technical scheme of the present invention is:

一种基于深度学习的深海潜水器传感器数据的异常检测方法,包括:A method for anomaly detection of deep-sea submersible sensor data based on deep learning, comprising:

将待检测的深海潜水器的传感器数据预处理后输入训练好的异常检测模型中进行多分类异常检测;Preprocess the sensor data of the deep-sea submersible to be detected and input it into the trained anomaly detection model for multi-category anomaly detection;

异常检测模型包括扩散模型、多头自注意力机制层、全连接层;扩散模型输出提取到的特征信息,并经过自注意力机制层,自注意力机制层为每一个输入项分配权重,通过权重大小从众多特征信息中选择出对当前任务目标更为关键的信息,并通过全连接层进行分类,判断是否存在异常。The anomaly detection model includes a diffusion model, a multi-head self-attention mechanism layer, and a fully connected layer; the diffusion model outputs the extracted feature information, and passes through the self-attention mechanism layer. The self-attention mechanism layer assigns weights to each input item. Through the weight The size selects the information that is more critical to the current task goal from many feature information, and classifies it through the fully connected layer to determine whether there is an abnormality.

根据本发明优选的,预处理,包括:Preferably according to the present invention, pretreatment comprises:

对传感器数据进行挑选,去掉传感器入水前和出水后的干扰数据,形成初始数据矩阵Xs(n),n∈R;Select the sensor data, remove the interference data before and after the sensor enters the water, and form the initial data matrix X s (n), n∈R;

对初始数据矩阵Xs(n)中每个点进行归一化处理并得到矩阵Xnomal(n),归一化处理如式(I)所示:Perform normalization processing on each point in the initial data matrix X s (n) and obtain the matrix X normal (n) , and the normalization processing is shown in formula (I):

对归一化处理后的传感器数据Xnormal(n)进行切片处理,构成m×6×6的矩阵形式X′s={x0,x1,...,xm},其中xm为6×6的矩阵。Slice the normalized sensor data X normal(n) to form an m×6×6 matrix X′ s ={x 0 , x 1 ,...,x m }, where x m is 6x6 matrix.

根据本发明优选的,异常检测模型的训练过程包括:Preferably according to the present invention, the training process of the abnormality detection model includes:

搭建数据集:采集深海潜水器的油箱压力传感器、VP2油箱温度传感器、10LPM补偿器位移传感器、15LPM补偿器位移传感器、VP1油箱温度传感器、24V电流检测传感器这6个传感器采集的传感数据,并进行所述预处理,得到训练数据集,当深海潜水器发生故障时对应的传感器数据标为异常,反之标为正常;Build a data set: collect the sensing data collected by six sensors, namely, the fuel tank pressure sensor of the deep-sea submersible, the VP2 fuel tank temperature sensor, the 10LPM compensator displacement sensor, the 15LPM compensator displacement sensor, the VP1 fuel tank temperature sensor, and the 24V current detection sensor. Carry out the preprocessing to obtain the training data set, when the deep-sea submersible breaks down, the corresponding sensor data is marked as abnormal, otherwise it is marked as normal;

将训练数据集输入至异常检测模型进行训练,具体包括:Input the training data set to the anomaly detection model for training, including:

使用优选后的数据集X′s训练扩散模型,扩散模型分为正向扩散过程和反向扩散过程:正向扩散过程是不断往切片后的数据矩阵X′s中添加高斯噪声,反向扩散过程则是不断去噪,期望将其最终还原成原始数据矩阵X′sUse the optimized data set X 's to train the diffusion model. The diffusion model is divided into forward diffusion process and reverse diffusion process: the forward diffusion process is to continuously add Gaussian noise to the sliced data matrix X 's , and the reverse diffusion process The process is to continuously denoise, expecting to finally restore it to the original data matrix X′ s ;

在正向扩散每一轮的训练过程中,为训练样本选择一个随机时间步长t,t∈[0,T],将时间步长t对应的高斯噪声应用到优选后的数据矩阵中,将时间步长转化为对应的时间步长嵌入E(t);对优选后的数据集X′s不断加入高斯噪声,形成噪声矩阵Xnoise(t);In the training process of each round of forward diffusion, a random time step t is selected for the training sample, t∈[0, T], and the Gaussian noise corresponding to the time step t is applied to the optimized data matrix. The time step is converted into the corresponding time step embedding E(t); Gaussian noise is continuously added to the optimized data set X' s to form a noise matrix X noise (t);

在反向扩散过程中,在每一轮训练中,把噪声矩阵Xnoise(t)与编码后的时间步长嵌入E(t)同作为输入,用以训练扩散模型中的Unet网络;每轮训练后,Unet网络将预测出从噪声矩阵中要去掉的噪声,形成新的矩阵Xrnoise(t),将Unet网络的预测结果与正向扩散过程中对应的时间步长嵌入E(t)添加的高斯噪声作比较,计算预测的损失率Loss(t),将这一结果通过多头自注意力机制层,来随机生成下一轮训练中的时间步长嵌入E(t+1);In the back diffusion process, in each round of training, the noise matrix X noise (t) and the encoded time step embedding E(t) are used as input to train the Unet network in the diffusion model; each round After training, the Unet network will predict the noise to be removed from the noise matrix to form a new matrix X rnoise (t), and add the prediction result of the Unet network and the corresponding time step in the forward diffusion process to E(t) Gaussian noise for comparison, calculate the predicted loss rate Loss(t), and pass this result through the multi-head self-attention mechanism layer to randomly generate the time step embedding E(t+1) in the next round of training;

训练的扩散模型将输出提取到的特征,将特征信息通过多头自注意力机制层,对每一个输入项分配权重,通过权重大小从众多特征信息中选择出对当前任务目标更为关键的信息,并通过全连接层进行分类,根据分类结果是否存在异常来判断是否存在深海潜水器是否出现故障。The trained diffusion model will output the extracted features, pass the feature information through the multi-head self-attention mechanism layer, assign weights to each input item, and select the information that is more critical to the current task goal from many feature information through the weight size. And classify through the fully connected layer, and judge whether there is a deep-sea submersible or not according to whether there is an abnormality in the classification result.

根据本发明优选的,多分类异常检测的过程包括:Preferably according to the present invention, the process of multi-category anomaly detection includes:

1)生成随机步长,包括:1) Generate a random step size, including:

定义初始时间步长t0Define the initial time step t 0 ;

对初始时间步长t0进行相位编码,得到初始时间步长嵌入E(0);一个时间周期内的模拟量的值用一个脉冲时间表示,将所有时间周期连接起来得到的脉冲序列表示整个时间过程中模拟量的变化;Perform phase encoding on the initial time step t 0 to obtain the initial time step embedding E(0); the value of the analog quantity within a time period is represented by a pulse time, and the pulse sequence obtained by connecting all time periods represents the entire time The change of analog quantity in the process;

在对Unet网络训练的过程中,每一次迭代产生的损失率Loss(t)值将作为负反馈,和时间步长嵌入E(t)作为输入通过多头自注意力机制层,生成下一轮训练迭代的时间步长嵌入E(t+1);In the process of training the Unet network, the loss rate Loss(t) value generated by each iteration will be used as negative feedback, and the time step embedding E(t) will be used as input through the multi-head self-attention mechanism layer to generate the next round of training Iterated time step embedding E(t+1);

2)正向扩散,包括:2) Forward diffusion, including:

在每一轮的训练过程中,对数据矩阵X′s添加时间步长嵌入E(t)对应的噪声,每一轮训练结束后得到与时间步长t对应的噪声矩阵Xnoise(t),训练结束后得到最终的噪声矩阵Xnoise(T);During each round of training, the noise corresponding to the time step embedding E(t) is added to the data matrix X′ s , and the noise matrix X noise (t) corresponding to the time step t is obtained after each round of training. After the training, the final noise matrix X noise (T) is obtained;

对于数据矩阵Xnoise(t),在每个时间步长内,q(Xnoise(t)|Xnoise(t-1))表示为一个服从均值为方差为(1-αt)I的正态分布,I是单位矩阵:如式(II)所示:q(Xnoise(t)|Xnoise(t-1))=m(Xnoise(t);/> For the data matrix X noise (t), in each time step, q(X noise (t)|X noise (t-1)) is expressed as a subject to the mean Normal distribution with variance (1-α t )I, I is the identity matrix: as shown in formula (II): q(X noise (t)|X noise (t-1))=m(X noise (t );/>

αt作为超参数,根据时间步长t来调整加入的噪声量;α t is used as a hyperparameter to adjust the amount of noise added according to the time step t;

由式(III),即:By formula (III), namely:

推导得到式(IV):The formula (IV) is derived:

3)反向扩散,包括:3) Backdiffusion, including:

在每一轮的训练中,将时间步入嵌入E(t)和噪声矩阵Xnoise(T)输入扩散模型中的UNet网络,通过网络训练得到预测去除的噪声,得到矩阵Xrnoise(t),将这一预测结果与对应时间步长嵌入下E(t)添加的噪声进行比较,计算出损失Loss(t);In each round of training, the time is stepped into the UNet network embedded in E(t) and the noise matrix X noise (T) input into the diffusion model, and the predicted and removed noise is obtained through network training, and the matrix X rnoise (t) is obtained, Comparing this prediction result with the noise added by E(t) under the corresponding time step embedding, the loss Loss(t) is calculated;

对于每轮训练后生成的矩阵Xrnoise(t),在时间步长嵌入E(t)下有式(V):For the matrix X rnoise (t) generated after each round of training, there is formula (V) under the time step embedding E(t):

式(V)中,εθ(Xrnoise(t),t)代表预测去除的噪声,ε为时间步长嵌入E(t)对应的高斯噪声;In formula (V), ε θ (X rnoise (t), t) represents the noise removed by prediction, and ε is the Gaussian noise corresponding to the time step embedding E(t);

反向扩散过程结束后,最终还原形成矩阵Xrnoise(0);After the back-diffusion process is over, the final reduction forms the matrix X rnoise (0);

4)在扩散模型训练结束后,将输出原始数据矩阵X′s的向量特征矩阵4) After the diffusion model training is over, the vector feature matrix of the original data matrix X 's will be output

Xfeature={xfeature0,xfeature1,...,xfeaturem},其中xfeaturem为6×6的矩阵,对于每个切片的特征结果xfeaturem单独计算自注意力值hm,每个节点表示一个数据样本,每条边表示两个节点之间的关联关系,对于每个节点,根据其邻居节点的权重更新该节点的值,增加对于任务目标影响较大的节点的权重,反之则降低权重,再通过式(VI)计算得到多头自注意力机制MultiHead(Xfeature),最终得到对于检测深海潜水器传感器是否存在异常现象的影响较大的特征:X feature ={x feature0 ,x feature1 ,...,x featurem }, where x featurem is a 6×6 matrix, and the self-attention value h m is calculated separately for the feature result x featurem of each slice, and each node represents A data sample, each edge represents the relationship between two nodes, for each node, update the value of the node according to the weight of its neighbor nodes, increase the weight of the node that has a greater impact on the task goal, and vice versa reduce the weight , and then calculate the multi-head self-attention mechanism MultiHead(X feature ) through formula (VI), and finally get the feature that has a great influence on detecting whether there is an abnormal phenomenon in the deep-sea submersible sensor:

MultiHead(Xfeature)=Concat(h0,h1,...,hm) (VI)MultiHead(X feature )=Concat(h 0 , h 1 , . . . , h m ) (VI)

通过全连接层实现对数据的分类,将对应异常状态的数据标为1,对应正常状态的数据标为0。The classification of data is realized through the fully connected layer, and the data corresponding to the abnormal state is marked as 1, and the data corresponding to the normal state is marked as 0.

根据本发明优选的,根据交叉熵损失函数计算预测噪声与实际噪声的差距,作为损失Loss,用以评估异常检测模型的性能,衡量异常检测模型预测结果的优劣,并将其作为负反馈项;损失Loss如式(VII)所示:Preferably, according to the present invention, the difference between the predicted noise and the actual noise is calculated according to the cross-entropy loss function, which is used as a loss Loss to evaluate the performance of the abnormality detection model, measure the pros and cons of the prediction results of the abnormality detection model, and use it as a negative feedback item ; Loss Loss is shown in formula (VII):

式(VII)中,yi表示样本的标签,异常数据标志为1,正常数据标志为0,pi表示样本预测为异常数据的概率。In formula (VII), y i represents the label of the sample, the flag of abnormal data is 1, and the flag of normal data is 0, and p i represents the probability that the sample is predicted to be abnormal data.

一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现基于深度学习的深海潜水器传感器数据的异常检测方法的步骤。A computer device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps of the abnormality detection method based on deep-sea submersible sensor data are realized.

一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现基于深度学习的深海潜水器传感器数据的异常检测方法的步骤。A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the deep-learning-based abnormality detection method for deep-sea submersible sensor data are realized.

本发明的有益效果为:The beneficial effects of the present invention are:

本发明采用图注意力机制计算节点之间的权重,可以带来以下好处:The present invention uses the graph attention mechanism to calculate the weights between nodes, which can bring the following benefits:

1.更好地关注数据的重要特征:注意力机制可以帮助模型更好地关注数据中的重要特征,从而提高模型的准确性和性能。1. Better focus on important features of data: The attention mechanism can help the model to better focus on important features in the data, thereby improving the accuracy and performance of the model.

2.强化模型的区分能力:注意力机制可以使模型更加注重不同特征之间的区别和差异,从而使模型具有更强的区分能力和判别能力。2. Strengthen the discrimination ability of the model: the attention mechanism can make the model pay more attention to the differences and differences between different features, so that the model has stronger discrimination and discrimination ability.

3.提高模型的鲁棒性:注意力机制可以使模型更加灵活和鲁棒,能够更好地适应不同数据分布和噪声干扰,从而提高模型的泛化能力和鲁棒性。3. Improve the robustness of the model: the attention mechanism can make the model more flexible and robust, and can better adapt to different data distributions and noise interference, thereby improving the generalization ability and robustness of the model.

4.可解释性更强:注意力机制可以使模型更加可解释,从而更好地理解模型的决策过程和结果,有助于进一步优化模型的性能和效果。4. Stronger interpretability: The attention mechanism can make the model more interpretable, so as to better understand the decision-making process and results of the model, and help to further optimize the performance and effect of the model.

5.可以处理更复杂的数据:注意力机制可以使扩散模型更加适用于处理更为复杂的高维数据,从而扩展了扩散模型的应用范围和潜力。5. Can handle more complex data: The attention mechanism can make the diffusion model more suitable for processing more complex high-dimensional data, thus expanding the application range and potential of the diffusion model.

附图说明Description of drawings

图1为本发明基于深度学习的深海潜水器传感器数据的异常检测方法的流程示意图:Fig. 1 is the schematic flow chart of the anomaly detection method of the deep-sea submersible sensor data based on the present invention:

图2为扩散模型的网络结构示意图:Figure 2 is a schematic diagram of the network structure of the diffusion model:

图3为本发明异常检测模型的网络结构示意图。Fig. 3 is a schematic diagram of the network structure of the anomaly detection model of the present invention.

具体实施方式Detailed ways

下面结合说明书附图和实施例对本发明作进一步限定,但不限于此。The present invention will be further limited below in conjunction with the accompanying drawings and embodiments, but not limited thereto.

实施例1Example 1

一种基于深度学习的深海潜水器传感器数据的异常检测方法,包括:A method for anomaly detection of deep-sea submersible sensor data based on deep learning, including:

将待检测的深海潜水器的传感器数据预处理后输入训练好的异常检测模型中进行多分类异常检测;深海潜水器传感器数据包括深海潜水器的油箱压力传感器、VP2油箱温度传感器、10LPM补偿器位移传感器、15LPM补偿器位移传感器、VP1油箱温度传感器、24V电流检测传感器这6个传感器采集的传感数据;Preprocess the sensor data of the deep-sea submersible and input it into the trained anomaly detection model for multi-classification anomaly detection; the sensor data of the deep-sea submersible includes the fuel tank pressure sensor of the deep-sea submersible, the VP2 fuel tank temperature sensor, and the displacement of the 10LPM compensator Sensor, 15LPM compensator displacement sensor, VP1 fuel tank temperature sensor, 24V current detection sensor, the sensing data collected by these 6 sensors;

如图3所示,异常检测模型包括扩散模型、多头自注意力机制层、全连接层;扩散模型输出提取到的特征信息,并经过自注意力机制层,自注意力机制层为每一个输入项分配权重,通过权重大小从众多特征信息中选择出对当前任务目标更为关键的信息,并通过全连接层进行分类,判断是否存在异常。As shown in Figure 3, the anomaly detection model includes a diffusion model, a multi-head self-attention mechanism layer, and a fully-connected layer; the diffusion model outputs the extracted feature information, and passes through the self-attention mechanism layer, and the self-attention mechanism layer is for each input Items are assigned weights, and the information that is more critical to the current task goal is selected from a large number of feature information through the weight, and is classified through the fully connected layer to determine whether there is an abnormality.

本发明将注意力机制引入扩散模型是一种有效的方法,可以充分利用节点之间的关系,提高模型的精度和效率,可以进一步提高扩散模型的准确性和性能,有助于更好地应用于各种数据分析和处理任务中。与传统的欧拉法或隐式欧拉法相比,本发明能够更好地处理复杂的图数据,具有更好的适用性和普适性。It is an effective method to introduce the attention mechanism into the diffusion model in the present invention, which can make full use of the relationship between nodes, improve the accuracy and efficiency of the model, further improve the accuracy and performance of the diffusion model, and contribute to better application in various data analysis and processing tasks. Compared with the traditional Euler method or implicit Euler method, the present invention can better handle complex graph data, and has better applicability and universality.

本发明提出在扩散模型中引入注意力机制生成随机步长,可以使模型更加关注重要的节点和边,从而生成更加逼真和准确的随机步长,有助于更好地模拟传感器数据的变化过程,注意力机制可以使模型更加灵活和鲁棒,能够更好地适应不同数据分布和噪声干扰,从而提高模型的泛化能力和鲁棒性,可以进一步提高模型的准确性,有助于进一步优化模型的性能和效果。The invention proposes to introduce an attention mechanism into the diffusion model to generate a random step size, which can make the model pay more attention to important nodes and edges, thereby generating a more realistic and accurate random step size, which helps to better simulate the change process of sensor data , the attention mechanism can make the model more flexible and robust, and can better adapt to different data distributions and noise interference, thereby improving the generalization ability and robustness of the model, which can further improve the accuracy of the model and help further optimization Model performance and effects.

实施例2Example 2

根据实施例1所述的一种基于深度学习的深海潜水器传感器数据的异常检测方法,其区别在于:According to the anomaly detection method of a deep-sea submersible sensor data based on deep learning described in embodiment 1, the difference is that:

预处理,包括:preprocessing, including:

对传感器数据进行挑选,去掉传感器入水前和出水后的干扰数据,形成初始数据矩阵Xs(n),n∈R;传感器数据包括:传感器中VP1油箱温度、VP2油箱温度、24V电流、油箱压力、10LPM补偿器位移、15LPM补偿器位移的各项数据。Select the sensor data, remove the interference data before and after the sensor enters the water, and form the initial data matrix X s (n), n∈R; the sensor data includes: VP1 fuel tank temperature in the sensor, VP2 fuel tank temperature, 24V current, fuel tank pressure , 10LPM compensator displacement, 15LPM compensator displacement data.

对初始数据矩阵Xs(n)中每个点进行归一化处理并得到矩阵Xnormal(n),归一化处理如式(I)所示:Perform normalization processing on each point in the initial data matrix X s (n) and obtain the matrix X normal (n) , and the normalization processing is shown in formula (I):

对归一化处理后的传感器数据Xnomal(n)进行切片处理,构成m×6×6的矩阵形式X′s={x0,x1,...,xm},其中xm为6×6的矩阵。Slice the normalized sensor data X normal(n) to form an m×6×6 matrix form X′ s ={x 0 , x 1 ,...,x m }, where x m is 6x6 matrix.

异常检测模型的训练过程包括:The training process of the anomaly detection model includes:

搭建数据集:采集深海潜水器的油箱压力传感器、VP2油箱温度传感器、10LPM补偿器位移传感器、15LPM补偿器位移传感器、VP1油箱温度传感器、24V电流检测传感器这6个传感器采集的传感数据,并进行所述预处理,得到训练数据集,当深海潜水器发生故障时对应的传感器数据标为异常,反之标为正常;Build a data set: collect the sensing data collected by six sensors, namely, the fuel tank pressure sensor of the deep-sea submersible, the VP2 fuel tank temperature sensor, the 10LPM compensator displacement sensor, the 15LPM compensator displacement sensor, the VP1 fuel tank temperature sensor, and the 24V current detection sensor. Carry out the preprocessing to obtain the training data set, when the deep-sea submersible breaks down, the corresponding sensor data is marked as abnormal, otherwise it is marked as normal;

将训练数据集输入至异常检测模型进行训练,具体包括:Input the training data set to the anomaly detection model for training, including:

使用优选后的数据集X′s训练扩散模型,扩散模型分为正向扩散过程和反向扩散过程:正向扩散过程是不断往切片后的数据矩阵X′s中添加高斯噪声,反向扩散过程则是不断去噪,期望将其最终还原成原始数据矩阵X′sUse the optimized data set X 's to train the diffusion model. The diffusion model is divided into forward diffusion process and reverse diffusion process: the forward diffusion process is to continuously add Gaussian noise to the sliced data matrix X 's , and the reverse diffusion process The process is to continuously denoise, expecting to finally restore it to the original data matrix X′ s ;

在正向扩散每一轮的训练过程中,为训练样本选择一个随机时间步长t,t∈[0,T],将时间步长t对应的高斯噪声应用到优选后的数据矩阵中,将时间步长转化为对应的时间步长嵌入E(t);对优选后的数据集X′s不断加入高斯噪声,形成噪声矩阵Xnoise(t);正向扩散过程结束后,最终形成噪声矩阵Xnoise(T);In the training process of each round of forward diffusion, a random time step t is selected for the training sample, t∈[0, T], and the Gaussian noise corresponding to the time step t is applied to the optimized data matrix. The time step is converted into the corresponding time step embedding E(t); Gaussian noise is continuously added to the optimized data set X′ s to form a noise matrix X noise (t); after the forward diffusion process is completed, the noise matrix is finally formed X noise (T);

在反向扩散过程中,在每一轮训练中,把噪声矩阵Xnoise(t)与编码后的时间步长嵌入E(t)同作为输入,用以训练扩散模型中的Unet网络;每轮训练后,Unet网络将预测出从噪声矩阵中要去掉的噪声,形成新的矩阵Xrnoise(t),将Unet网络的预测结果与正向扩散过程中对应的时间步长嵌入E(t)添加的高斯噪声作比较,计算预测的损失率Loss(t),将这一结果通过多头自注意力机制层,来随机生成下一轮训练中的时间步长嵌入E(t+1);In the back diffusion process, in each round of training, the noise matrix X noise (t) and the encoded time step embedding E(t) are used as input to train the Unet network in the diffusion model; each round After training, the Unet network will predict the noise to be removed from the noise matrix to form a new matrix X rnoise (t), and add the prediction result of the Unet network and the corresponding time step in the forward diffusion process to E(t) Gaussian noise for comparison, calculate the predicted loss rate Loss(t), and pass this result through the multi-head self-attention mechanism layer to randomly generate the time step embedding E(t+1) in the next round of training;

训练的扩散模型将输出提取到的特征,将特征信息通过多头自注意力机制层,对每一个输入项分配权重,通过权重大小从众多特征信息中选择出对当前任务目标更为关键的信息,并通过全连接层进行分类,根据分类结果是否存在异常来判断是否存在深海潜水器是否出现故障。The trained diffusion model will output the extracted features, pass the feature information through the multi-head self-attention mechanism layer, assign weights to each input item, and select the information that is more critical to the current task goal from many feature information through the weight size. And classify through the fully connected layer, and judge whether there is a deep-sea submersible or not according to whether there is an abnormality in the classification result.

如图1所示,多分类异常检测的过程包括:As shown in Figure 1, the process of multi-category anomaly detection includes:

1)生成随机步长,包括:1) Generate a random step size, including:

定义初始时间步长t0Define the initial time step t 0 ;

对初始时间步长t0进行相位编码,得到初始时间步长嵌入E(0);一个时间周期内的模拟量的值用一个脉冲时间表示,将所有时间周期连接起来得到的脉冲序列表示整个时间过程中模拟量的变化;Perform phase encoding on the initial time step t 0 to obtain the initial time step embedding E(0); the value of the analog quantity within a time period is represented by a pulse time, and the pulse sequence obtained by connecting all time periods represents the entire time The change of analog quantity in the process;

在对Unet网络训练的过程中,每一次迭代产生的损失率Loss(t)值将作为负反馈,和时间步长嵌入E(t)作为输入通过多头自注意力机制层,生成下一轮训练迭代的时间步长嵌入E(t+1);In the process of training the Unet network, the loss rate Loss(t) value generated by each iteration will be used as negative feedback, and the time step embedding E(t) will be used as input through the multi-head self-attention mechanism layer to generate the next round of training Iterated time step embedding E(t+1);

2)如图2的实线部分所示,正向扩散,包括:2) As shown in the solid line part of Figure 2, forward diffusion includes:

在每一轮的训练过程中,对数据矩阵X′s添加时间步长嵌入E(t)对应的噪声,每一轮训练结束后得到与时间步长t对应的噪声矩阵Xnoise(t),训练结束后得到最终的噪声矩阵Xnoise(T);During each round of training, the noise corresponding to the time step embedding E(t) is added to the data matrix X′ s , and the noise matrix X noise (t) corresponding to the time step t is obtained after each round of training. After the training, the final noise matrix X noise (T) is obtained;

对于数据矩阵Xnoise(t),在每个时间步长内,q(Xnoise(t)|Xnoise(t-1))表示为一个服从均值为方差为(1-αt)I的正态分布,I是单位矩阵:如式(II)所示:For the data matrix X noise (t), in each time step, q(X noise (t)|X noise (t-1)) is expressed as a subject to the mean Normal distribution with variance (1-α t )I, I is the identity matrix: as shown in formula (II):

αt作为超参数,根据时间步长t来调整加入的噪声量;α t is used as a hyperparameter to adjust the amount of noise added according to the time step t;

由式(III),即:By formula (III), namely:

推导得到式(IV):The formula (IV) is derived:

3)如图2的虚线部分所示,反向扩散,包括:3) As shown in the dotted line part of Figure 2, backdiffusion includes:

在每一轮的训练中,将时间步入嵌入E(t)和噪声矩阵Xnoise(T)输入扩散模型中的UNet网络,通过网络训练得到预测去除的噪声,得到矩阵Xrnoise(t),将这一预测结果与对应时间步长嵌入下E(t)添加的噪声进行比较,计算出损失Loss(t);In each round of training, the time is stepped into the UNet network embedded in E(t) and the noise matrix X noise (T) input into the diffusion model, and the predicted and removed noise is obtained through network training, and the matrix X rnoise (t) is obtained, Comparing this prediction result with the noise added by E(t) under the corresponding time step embedding, the loss Loss(t) is calculated;

对于每轮训练后生成的矩阵Xrnoise(t),在时间步长嵌入E(t)下有式(V):For the matrix X rnoise (t) generated after each round of training, there is formula (V) under the time step embedding E(t):

式(V)中,εθ(Xrnoise(t),t)代表预测去除的噪声,ε为时间步长嵌入E(t)对应的高斯噪声;In formula (V), ε θ (X rnoise (t), t) represents the noise removed by prediction, and ε is the Gaussian noise corresponding to the time step embedding E(t);

反向扩散过程结束后,最终还原形成矩阵Xrnoise(0);After the back-diffusion process is over, the final reduction forms the matrix X rnoise (0);

4)在扩散模型训练结束后,将输出原始数据矩阵X′s的向量特征矩阵4) After the diffusion model training is over, the vector feature matrix of the original data matrix X 's will be output

Xfeature={xfeature0,xfeature1,...,xfeaturem},其中xfeaturem为6×6的矩阵,对于每个切片的特征结果xfeaturem单独计算自注意力值hm,每个节点表示一个数据样本,每条边表示两个节点之间的关联关系,对于每个节点,根据其邻居节点的权重更新该节点的值,增加对于任务目标影响较大的节点的权重,反之则降低权重,再通过式(VI)计算得到多头自注意力机制MultiHead(Xfeature),最终得到对于检测深海潜水器传感器是否存在异常现象的影响较大的特征:X feature ={x feature0 ,x feature1 ,...,x featurem }, where x featurem is a 6×6 matrix, and the self-attention value h m is calculated separately for the feature result x featurem of each slice, and each node represents A data sample, each edge represents the relationship between two nodes, for each node, update the value of the node according to the weight of its neighbor nodes, increase the weight of the node that has a greater impact on the task goal, and vice versa reduce the weight , and then calculate the multi-head self-attention mechanism MultiHead(X feature ) through formula (VI), and finally get the feature that has a great influence on detecting whether there is an abnormal phenomenon in the deep-sea submersible sensor:

MultiHead(Xfeature)=Concat(h0,h1,...,hm) (VI)MultiHead(X feature )=Concat(h 0 , h 1 , . . . , h m ) (VI)

通过全连接层实现对数据的分类,将对应异常状态的数据标为1,对应正常状态的数据标为0。The classification of data is realized through the fully connected layer, and the data corresponding to the abnormal state is marked as 1, and the data corresponding to the normal state is marked as 0.

通过将扩散模型和图注意力机制相结合,可以生成更加准确的随机步长,有助于更好地模拟传感器数据的变化过程,从而提高异常检测的性能和效果。By combining the diffusion model and the graph attention mechanism, a more accurate random step size can be generated, which helps to better simulate the change process of sensor data, thereby improving the performance and effect of anomaly detection.

根据交叉熵损失函数计算预测噪声与实际噪声的差距,作为损失Loss,用以评估异常检测模型的性能,衡量异常检测模型预测结果的优劣,并将其作为负反馈项;损失Loss如式(VII)所示:According to the cross-entropy loss function, the difference between the predicted noise and the actual noise is calculated as the loss Loss, which is used to evaluate the performance of the anomaly detection model, measure the pros and cons of the prediction results of the anomaly detection model, and use it as a negative feedback item; the loss Loss is as follows: VII) as shown:

式(VII)中,yi表示样本的标签,异常数据标志为1,正常数据标志为0,pi表示样本预测为异常数据的概率。In formula (VII), y i represents the label of the sample, the flag of abnormal data is 1, and the flag of normal data is 0, and p i represents the probability that the sample is predicted to be abnormal data.

实施例3Example 3

一种计算机设备,包括存储器和处理器,存储器存储有计算机程序,处理器执行计算机程序时实现实施例1或2所述基于深度学习的深海潜水器传感器数据的异常检测方法的步骤。A computer device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps of the deep learning-based deep-sea submersible sensor data abnormality detection method described in Embodiment 1 or 2 are realized.

实施例4Example 4

一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现实施例1或2所述基于深度学习的深海潜水器传感器数据的异常检测方法的步骤。A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method for abnormality detection of deep-sea submersible sensor data based on deep learning described in Embodiment 1 or 2 are realized.

Claims (7)

1.一种基于深度学习的深海潜水器传感器数据的异常检测方法,其特征在于,包括:1. A method for anomaly detection of deep-sea submersible sensor data based on deep learning, characterized in that, comprising: 将待检测的深海潜水器的传感器数据预处理后输入训练好的异常检测模型中进行多分类异常检测;Preprocess the sensor data of the deep-sea submersible to be detected and input it into the trained anomaly detection model for multi-category anomaly detection; 异常检测模型包括扩散模型、多头自注意力机制层、全连接层;扩散模型输出提取到的特征信息,并经过自注意力机制层,自注意力机制层为每一个输入项分配权重,通过权重大小从众多特征信息中选择出对当前任务目标更为关键的信息,并通过全连接层进行分类,判断是否存在异常。The anomaly detection model includes a diffusion model, a multi-head self-attention mechanism layer, and a fully connected layer; the diffusion model outputs the extracted feature information, and passes through the self-attention mechanism layer. The self-attention mechanism layer assigns weights to each input item. Through the weight The size selects the information that is more critical to the current task goal from many feature information, and classifies it through the fully connected layer to determine whether there is an abnormality. 2.根据权利要求1所述的一种基于深度学习的深海潜水器传感器数据的异常检测方法,其特征在于,预处理,包括:2. a kind of anomaly detection method based on the deep-sea submersible sensor data of deep learning according to claim 1, is characterized in that, preprocessing comprises: 对传感器数据进行挑选,去掉传感器入水前和出水后的干扰数据,形成初始数据矩阵Xs(n),n∈R;Select the sensor data, remove the interference data before and after the sensor enters the water, and form the initial data matrix X s (n),n∈R; 对初始数据矩阵Xs(n)中每个点进行归一化处理并得到矩阵Xnormal(n),归一化处理如式(I)所示:Perform normalization processing on each point in the initial data matrix X s (n) and obtain the matrix X normal (n) , and the normalization processing is shown in formula (I): 对归一化处理后的传感器数据Xnormal(n)进行切片处理,构成m×6×6的矩阵形式X′s={x0,x1,…,xm},其中xm为6×6的矩阵。Slice the normalized sensor data X normal(n) to form an m×6×6 matrix X′ s ={x 0 ,x 1 ,…,x m }, where x m is 6× 6 matrix. 3.根据权利要求1所述的一种基于深度学习的深海潜水器传感器数据的异常检测方法,其特征在于,异常检测模型的训练过程包括:3. the abnormal detection method of a kind of deep-sea submersible sensor data based on deep learning according to claim 1, is characterized in that, the training process of abnormal detection model comprises: 搭建数据集:采集深海潜水器的油箱压力传感器、VP2油箱温度传感器、10LPM补偿器位移传感器、15LPM补偿器位移传感器、VP1油箱温度传感器、24V电流检测传感器这6个传感器采集的传感数据,并进行所述预处理,得到训练数据集,当深海潜水器发生故障时对应的传感器数据标为异常,反之标为正常;Build a data set: collect the sensing data collected by six sensors, namely, the fuel tank pressure sensor of the deep-sea submersible, the VP2 fuel tank temperature sensor, the 10LPM compensator displacement sensor, the 15LPM compensator displacement sensor, the VP1 fuel tank temperature sensor, and the 24V current detection sensor. Carry out the preprocessing to obtain the training data set, when the deep-sea submersible breaks down, the corresponding sensor data is marked as abnormal, otherwise it is marked as normal; 将训练数据集输入至异常检测模型进行训练,具体包括:Input the training data set to the anomaly detection model for training, including: 使用优选后的数据集x′s训练扩散模型,扩散模型分为正向扩散过程和反向扩散过程:正向扩散过程是不断往切片后的数据矩阵x′s中添加高斯噪声,反向扩散过程则是不断去噪,期望将其最终还原成原始数据矩阵x′sUse the optimized data set x 's to train the diffusion model. The diffusion model is divided into forward diffusion process and reverse diffusion process: the forward diffusion process is to continuously add Gaussian noise to the sliced data matrix x 's , and the reverse diffusion process The process is to continuously denoise, expecting to finally restore it to the original data matrix x′ s ; 在正向扩散每一轮的训练过程中,为训练样本选择一个随机时间步长t,t∈[0,T],将时间步长t对应的高斯噪声应用到优选后的数据矩阵中,将时间步长转化为对应的时间步长嵌入E(t);对优选后的数据集X′s不断加入高斯噪声,形成噪声矩阵xnoise(t);In the training process of each round of forward diffusion, a random time step t,t∈[0,T] is selected for the training sample, and the Gaussian noise corresponding to the time step t is applied to the optimized data matrix. The time step is converted into the corresponding time step embedding E(t); Gaussian noise is continuously added to the optimized data set X' s to form a noise matrix x noise (t); 在反向扩散过程中,在每一轮训练中,把噪声矩阵nnoise(t)与编码后的时间步长嵌入E(t)同作为输入,用以训练扩散模型中的Ut网络;每轮训练后,Unet网络将预测出从噪声矩阵中要去掉的噪声,形成新的矩阵Xrnoise(t),将Unet网络的预测结果与正向扩散过程中对应的时间步长嵌入)(t)添加的高斯噪声作比较,计算预测的损失率Loss(t),将这一结果通过多头自注意力机制层,来随机生成下一轮训练中的时间步长嵌入E(t+1);In the back diffusion process, in each round of training, the noise matrix n noise (t) and the encoded time step embedding E(t) are used as input to train the Ut network in the diffusion model; each round After training, the Unet network will predict the noise to be removed from the noise matrix to form a new matrix X rnoise (t), and add the prediction result of the Unet network to the corresponding time step in the forward diffusion process)(t) Gaussian noise for comparison, calculate the predicted loss rate Loss(t), and pass this result through the multi-head self-attention mechanism layer to randomly generate the time step embedding E(t+1) in the next round of training; 训练的扩散模型将输出提取到的特征,将特征信息通过多头自注意力机制层,对每一个输入项分配权重,通过权重大小从众多特征信息中选择出对当前任务目标更为关键的信息,并通过全连接层进行分类,根据分类结果是否存在异常来判断是否存在深海潜水器是否出现故障。The trained diffusion model will output the extracted features, pass the feature information through the multi-head self-attention mechanism layer, assign weights to each input item, and select the information that is more critical to the current task goal from many feature information through the weight size. And classify through the fully connected layer, and judge whether there is a deep-sea submersible or not according to whether there is an abnormality in the classification result. 4.根据权利要求1所述的一种基于深度学习的深海潜水器传感器数据的异常检测方法,其特征在于,多分类异常检测的过程包括:4. a kind of abnormal detection method based on the deep-sea submersible sensor data of deep sea according to claim 1, it is characterized in that, the process of multi-category abnormal detection comprises: 1)生成随机步长,包括:1) Generate a random step size, including: 定义初始时间步长t0Define the initial time step t 0 ; 对初始时间步长t0进行相位编码,得到初始时间步长嵌入E(0);一个时间周期内的模拟量的值用一个脉冲时间表示,将所有时间周期连接起来得到的脉冲序列表示整个时间过程中模拟量的变化;Perform phase encoding on the initial time step t 0 to obtain the initial time step embedding E(0); the value of the analog quantity within a time period is represented by a pulse time, and the pulse sequence obtained by connecting all time periods represents the entire time The change of analog quantity in the process; 在对Unet网络训练的过程中,每一次迭代产生的损失率Loss(t)值将作为负反馈,和时间步长嵌入E(t)作为输入通过多头自注意力机制层,生成下一轮训练迭代的时间步长嵌入E(t+1);In the process of training the Unet network, the loss rate Loss(t) value generated by each iteration will be used as negative feedback, and the time step embedding E(t) will be used as input through the multi-head self-attention mechanism layer to generate the next round of training Iterated time step embedding E(t+1); 2)正向扩散,包括:2) Forward diffusion, including: 在每一轮的训练过程中,对数据矩阵X′s添加时间步长嵌入E(t)对应的噪声,每一轮训练结束后得到与时间步长t对应的噪声矩阵Xnoise(t),训练结束后得到最终的噪声矩阵Xnoise(T);During each round of training, the noise corresponding to the time step embedding E(t) is added to the data matrix X′ s , and the noise matrix X noise (t) corresponding to the time step t is obtained after each round of training. After the training, the final noise matrix X noise (T) is obtained; 对于数据矩阵Xnoise(t),在每个时间步长内,q(Xnoise(t)|Xnoise(t-1))表示为一个服从均值为方差为(1-αt)I的正态分布,I是单位矩阵:如式(II)所示:For the data matrix X noise (t), in each time step, q(X noise (t)|X noise (t-1)) is expressed as a subject to the mean Normal distribution with variance (1-α t )I, I is the identity matrix: as shown in formula (II): αt作为超参数,根据时间步长t来调整加入的噪声量;α t is used as a hyperparameter to adjust the amount of noise added according to the time step t; 由式(III),即:By formula (III), namely: 推导得到式(IV):The formula (IV) is derived: 3)反向扩散,包括:3) Backdiffusion, including: 在每一轮的训练中,将时间步入嵌入E(t)和噪声矩阵Xnoise(T)输入扩散模型中的UNet网络,通过网络训练得到预测去除的噪声,得到矩阵Xrnoise(t),将这一预测结果与对应时间步长嵌入下E(t)添加的噪声进行比较,计算出损失Loss(t);In each round of training, the time is stepped into the UNet network embedded in E(t) and the noise matrix X noise (T) input into the diffusion model, and the predicted and removed noise is obtained through network training, and the matrix X rnoise (t) is obtained, Comparing this prediction result with the noise added by E(t) under the corresponding time step embedding, the loss Loss(t) is calculated; 对于每轮训练后生成的矩阵Xrnoise(t),在时间步长嵌入E(t)下有式(V):For the matrix X rnoise (t) generated after each round of training, there is formula (V) under the time step embedding E(t): 式(V)中,εθ(Xrnoise(t),t)代表预测去除的噪声,ε为时间步长嵌入E(t)对应的高斯噪声;In formula (V), ε θ (X rnoise (t), t) represents the noise removed by prediction, and ε is the Gaussian noise corresponding to the time step embedding E(t); 反向扩散过程结束后,最终还原形成矩阵Xrnoise(0);After the back-diffusion process is over, the final reduction forms the matrix X rnoise (0); 4)在扩散模型训练结束后,将输出原始数据矩阵X′s的向量特征矩阵Xfeature={xfeature0,xfeature1,…,xfeaturem},其中xfeaturem为6×6的矩阵,对于每个切片的特征结果xfeaturem单独计算自注意力值hm,每个节点表示一个数据样本,每条边表示两个节点之间的关联关系,对于每个节点,根据其邻居节点的权重更新该节点的值,增加对于任务目标影响较大的节点的权重,反之则降低权重,再通过式(VI)计算得到多头自注意力机制MuktiHead(XfeatureQ,最终得到对于检测深海潜水器传感器是否存在异常现象的影响较大的特征:4) After the diffusion model training is over, the vector feature matrix X feature of the original data matrix X′ s will be output = {x feature0 , x feature1 ,…, x featurem }, where x featurem is a 6×6 matrix, for each The feature result x featurem of the slice calculates the self-attention value h m separately, each node represents a data sample, and each edge represents the association relationship between two nodes. For each node, update the node according to the weight of its neighbor nodes value, increase the weight of the node that has a greater impact on the task target, and vice versa, reduce the weight, and then calculate the multi-head self-attention mechanism MuktiHead(X feature Q through formula (VI), and finally get the detection of whether there is an abnormality in the deep-sea submersible sensor Characteristics of a phenomenon with greater influence: MultiHead(xfeature)=Concat(h0,h1,…,hm) (VI)MultiHead(x feature )=Concat(h 0 , h 1 ,...,h m ) (VI) 通过全连接层实现对数据的分类,将对应异常状态的数据标为1,对应正常状态的数据标为0。The classification of data is realized through the fully connected layer, and the data corresponding to the abnormal state is marked as 1, and the data corresponding to the normal state is marked as 0. 5.根据权利要求1-4任一所述的一种基于深度学习的深海潜水器传感器数据的异常检测方法,其特征在于,根据交叉熵损失函数计算预测噪声与实际噪声的差距,作为损失Loss,用以评估异常检测模型的性能,衡量异常检测模型预测结果的优劣,并将其作为负反馈项;损失Loss如式(VII)所示:5. according to claim 1-4 arbitrary described a kind of abnormal detection method based on deep-sea submersible sensor data, it is characterized in that, according to cross-entropy loss function calculation prediction noise and the gap of actual noise, as loss Loss , used to evaluate the performance of the anomaly detection model, measure the pros and cons of the prediction results of the anomaly detection model, and use it as a negative feedback item; the loss Loss is shown in formula (VII): 式(VII)中,yi表示样本的标签,异常数据标志为1,正常数据标志为0,pi表示样本预测为异常数据的概率。In formula (VII), y i represents the label of the sample, the flag of abnormal data is 1, and the flag of normal data is 0, and p i represents the probability that the sample is predicted to be abnormal data. 6.一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1-5任一所述的基于深度学习的深海潜水器传感器数据的异常检测方法的步骤。6. A computer device, comprising a memory and a processor, the memory stores a computer program, wherein when the processor executes the computer program, the computer program based on deep learning according to any one of claims 1-5 is realized. Steps of a method for anomaly detection of bathyscaphe sensor data. 7.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1-5任一所述的基于深度学习的深海潜水器传感器数据的异常检测方法的步骤。7. A computer-readable storage medium, on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the deep-sea submersible sensor data based on deep learning described in any one of claims 1-5 is realized The steps of the anomaly detection method.
CN202310699555.9A 2023-06-13 2023-06-13 A deep learning-based anomaly detection method for deep-sea submersible sensor data Active CN116680639B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310699555.9A CN116680639B (en) 2023-06-13 2023-06-13 A deep learning-based anomaly detection method for deep-sea submersible sensor data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310699555.9A CN116680639B (en) 2023-06-13 2023-06-13 A deep learning-based anomaly detection method for deep-sea submersible sensor data

Publications (2)

Publication Number Publication Date
CN116680639A true CN116680639A (en) 2023-09-01
CN116680639B CN116680639B (en) 2025-06-17

Family

ID=87788767

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310699555.9A Active CN116680639B (en) 2023-06-13 2023-06-13 A deep learning-based anomaly detection method for deep-sea submersible sensor data

Country Status (1)

Country Link
CN (1) CN116680639B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117710759A (en) * 2024-02-06 2024-03-15 青岛哈尔滨工程大学创新发展中心 System and method for predicting faults and service lives of manned submersible vehicles
CN118797352A (en) * 2024-09-11 2024-10-18 山东大学 Deep-sea sensor signal fault diagnosis method and system based on diffusion contrast learning
CN118917389A (en) * 2024-10-11 2024-11-08 南京信息工程大学 Diffusion model architecture searching method and system based on attention mechanism

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113807616A (en) * 2021-10-22 2021-12-17 重庆理工大学 Information Diffusion Prediction System Based on Spatiotemporal Attention and Heterogeneous Graph Convolutional Networks

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113807616A (en) * 2021-10-22 2021-12-17 重庆理工大学 Information Diffusion Prediction System Based on Spatiotemporal Attention and Heterogeneous Graph Convolutional Networks

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WILLIAM PEEBLES等: "Scalable Diffusion Models with Transformers", ARXIV, 2 March 2023 (2023-03-02) *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117710759A (en) * 2024-02-06 2024-03-15 青岛哈尔滨工程大学创新发展中心 System and method for predicting faults and service lives of manned submersible vehicles
CN117710759B (en) * 2024-02-06 2024-04-26 青岛哈尔滨工程大学创新发展中心 System and method for predicting faults and service lives of manned submersible vehicles
CN118797352A (en) * 2024-09-11 2024-10-18 山东大学 Deep-sea sensor signal fault diagnosis method and system based on diffusion contrast learning
CN118917389A (en) * 2024-10-11 2024-11-08 南京信息工程大学 Diffusion model architecture searching method and system based on attention mechanism

Also Published As

Publication number Publication date
CN116680639B (en) 2025-06-17

Similar Documents

Publication Publication Date Title
CN115618296B (en) Dam monitoring time sequence data anomaly detection method based on graph attention network
CN117290800B (en) Timing sequence anomaly detection method and system based on hypergraph attention network
CN109858390B (en) Human skeleton behavior recognition method based on end-to-end spatiotemporal graph learning neural network
CN110490249B (en) Structural damage identification method based on attribute category relation and few-sample meta-learning
CN111292195A (en) Risk account identification method and device
CN114676742B (en) A method for detecting abnormal power consumption in power grid based on attention mechanism and residual network
CN116680639A (en) Deep-learning-based anomaly detection method for sensor data of deep-sea submersible
CN116579616A (en) A risk identification method based on deep learning
CN113343123B (en) A Generative Adversarial Multi-Relational Graph Network Training Method and Detection Method
CN114398992A (en) An Intelligent Fault Diagnosis Method Based on Unsupervised Domain Adaptation
CN118469158B (en) Equipment maintenance cost estimation method and equipment
CN116596136A (en) A real-time detection method for abnormal power consumption based on double prediction error
CN118152901B (en) Equipment failure prediction method and system based on data drive
CN117909881A (en) Fault diagnosis method and device for multi-source data fusion pumping unit
CN112714130A (en) Big data-based adaptive network security situation sensing method
CN117072891B (en) A real-time intelligent leakage monitoring and positioning method for hydrogen pipeline network without abnormal samples
CN118981684B (en) A method and system for out-of-distribution fault detection based on energy propagation and graph learning
CN109581339A (en) A kind of sonar recognition methods based on brainstorming adjust automatically autoencoder network
CN113987910A (en) Method and device for identifying load of residents by coupling neural network and dynamic time planning
CN118228613B (en) Soft measurement method for improving TSO optimization deep learning model
CN119418338A (en) A pseudo-labeling method for images based on virtual adversarial training
CN117150402A (en) Power data anomaly detection method and model based on generative adversarial network
CN107689015A (en) A kind of improved power system bad data recognition method
CN113746813B (en) Network attack detection system and method based on two-stage learning model
CN111858343A (en) An Adversarial Sample Generation Method Based on Attack Capability

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
GR01 Patent grant
GR01 Patent grant