Search

CN-116502164-B - Multidimensional time series data anomaly detection method, device and medium based on countermeasure training and frequency domain improvement self-attention mechanism

CN116502164BCN 116502164 BCN116502164 BCN 116502164BCN-116502164-B

Abstract

The multidimensional time sequence data anomaly detection method based on the countermeasure training and the frequency domain improved self-attention mechanism solves the problems that the robustness of a model is poor, external interference is easy to receive, the accuracy of a detection result is reduced, the frequency domain characteristics of time sequence data are not fully considered, the model precision is limited, and an analysis structure is inaccurate. The method is integrally divided into two stages, namely a training stage and an abnormality detection stage. In the training stage, the model needs to be trained by using data collected by history, so that model parameters can be fitted to corresponding application scenes. In the anomaly detection stage, when each latest real data is generated, the model needs to reconstruct time sequence data with a fixed-length time window length ending at the latest time point, so as to perform residual calculation with the original real data, and whether the current data is the anomaly data is judged according to the residual sizes of the real data and the reconstructed data. The invention is suitable for detecting faults of industrial equipment and detecting and analyzing the running state of a production line.

Inventors

  • SONG HONGTAO
  • ZHANG ZHAO
  • HAN QILONG
  • LIU PENG

Assignees

  • 哈尔滨工程大学
  • 哈尔滨龙明科技有限公司

Dates

Publication Date
20260508
Application Date
20230424

Claims (9)

  1. 1. A method for detecting anomalies in multi-dimensional time series data based on countermeasure training and frequency domain improved self-attention mechanism, characterized in that it comprises the steps of: Step 1, acquiring an original data set and preprocessing, wherein the original data set is industrial time sequence data, and the industrial time sequence data is operation state data of key parts of industrial equipment or operation state data of a production line; step 2, constructing an anomaly detection model based on countermeasure training and a frequency domain improved self-attention mechanism, wherein the method for constructing the anomaly detection model comprises the following steps of: Step 2.1, constructing a position coding layer, calculating position coding information of an input sub-sequence, and adding the position coding information into an input; 2.2, constructing an encoder structure, wherein the encoder structure is formed by connecting a frequency domain enhanced self-attention module based on wavelet decomposition and Fourier transform, residual error links and a normalized and fully-connected neural network in series; the input of the self-attention module is zero vector with the same size as the input and is expressed as that of the input sub-sequence spelling of the additional position code obtained in the step 2.1 Wherein Is an input subsequence with position coding attached; the input subsequence with the position codes is subjected to discrete wavelet decomposition to output a high-frequency component and a low-frequency component; The high-frequency component and the low-frequency component are transformed into Q, K and V three matrixes through three MLPs, and fourier transformation operation is carried out on the three matrixes respectively to obtain an input frequency domain representation; performing random discarding on the data subjected to Fourier transformation in a frequency domain, adding zero at frequency points which are not acquired, and projecting the zero-added frequency points back to a time domain representation through Fourier inversion; Step 2.3, constructing two parallel decoder structures, wherein the decoder structures are composed of a frequency domain enhanced self-attention module based on wavelet decomposition and Fourier transformation, a residual error connection and normalization layer, a full connection layer and a Softmax layer; step3, training the anomaly detection model based on the countermeasure training and the frequency domain improved self-attention mechanism in the step 2; and step 4, inputting the time sequence data to be detected into the abnormality detection model trained in the step 3, and performing abnormality judgment.
  2. 2. The method for detecting anomalies in multi-dimensional time series data based on countermeasure training and frequency domain improved self-attention mechanism as recited in claim 1, wherein said step 1 includes the steps of: step 1.1, dividing the original data set into a training set and a testing set; step 1.2, defining a sliding window, setting the sliding step length to be 1, and setting the window size according to the original data set; step 1.3, sliding the sliding window on the original data set, and dividing the data in each sliding window into a fixed-length subsequence; and step 1.4, storing the subsequences obtained by dividing in the step 1.3 in a set for inputting model training.
  3. 3. The method for multidimensional time series data anomaly detection based on countermeasure training and frequency domain improved self-attention mechanism of claim 2, wherein the sliding window is continuous time series data with fixed length time points.
  4. 4. The method for multidimensional time series data anomaly detection based on countermeasure training and frequency domain improved self-attention mechanism of claim 2, wherein the sliding step is a distance that the sliding window moves each time on the original dataset.
  5. 5. A method according to claim 3, wherein said step3 comprises the steps of: Step 3.1, inputting the subsequences in the training set processed in the step 1 into the anomaly detection model based on the countermeasure training and the frequency domain improved self-attention mechanism in the step 2, and respectively obtaining two first-stage outputs through the two parallel decoder structures; Step 3.2, calculating a residual matrix by utilizing the output in the step 3.1, adding the residual matrix into the input subsequence, inputting the residual matrix into the encoder structure of the anomaly detection model again, and obtaining the output of the second stage training through a second decoder; and 3.3, calculating a minimized cross entropy loss function by using the subsequences of the output and the input obtained in the step 3.1 and the step 3.2, and updating the abnormality detection model parameters.
  6. 6. The method according to claim 4, wherein the step 4 comprises the steps of: Step 4.1, sequentially inputting the subsequences in the test set processed in the step 1 into an abnormality detection model, and obtaining three outputs corresponding to the input subsequences through two stages of the step 3.1 and the step 3.2; Step 4.2, calculating an anomaly score by applying the output obtained in the step 4.1; and 4.3, carrying out anomaly judgment on the current input subsequence by combining the threshold selection algorithm with the anomaly score obtained in the step 4.2.
  7. 7. A computer device comprising a memory and a processor, the memory having stored therein a computer program, which when executed by the processor performs the multi-dimensional time series data anomaly detection method based on countermeasure training and frequency domain improved self-attention mechanism of any one of claims 1-6.
  8. 8. A computer-readable storage medium storing a computer program for executing the multidimensional time series data anomaly detection method based on countermeasure training and frequency domain improved self-attention mechanism of any one of claims 1 to 6.
  9. 9. A multidimensional time series data anomaly detection system based on countermeasure training and frequency domain improved self-attention mechanism, the system comprising: The data acquisition module is used for acquiring an original data set and preprocessing the original data set, wherein the original data set is industrial time sequence data; A modeling module for constructing an anomaly detection model based on countermeasure training and frequency domain improvement self-attention mechanisms; Training module for training the anomaly detection model based on countermeasure training and frequency domain improved self-attention mechanisms, the training module performing the steps of: Step 2.1, constructing a position coding layer, calculating position coding information of an input sub-sequence, and adding the position coding information into an input; 2.2, constructing an encoder structure, wherein the encoder structure is formed by connecting a frequency domain enhanced self-attention module based on wavelet decomposition and Fourier transform, residual error links and a normalized and fully-connected neural network in series; the input of the self-attention module is zero vector with the same size as the input and is expressed as that of the input sub-sequence spelling of the additional position code obtained in the step 2.1 Wherein Is an input subsequence with position coding attached; the input subsequence with the position codes is subjected to discrete wavelet decomposition to output a high-frequency component and a low-frequency component; The high-frequency component and the low-frequency component are transformed into Q, K and V three matrixes through three MLPs, and fourier transformation operation is carried out on the three matrixes respectively to obtain an input frequency domain representation; performing random discarding on the data subjected to Fourier transformation in a frequency domain, adding zero at a frequency point which is not acquired, and projecting the zero-added evaluation rate point back to the time domain representation through Fourier inversion; Step 2.3, constructing two parallel decoder structures, wherein the decoder structures are composed of a frequency domain enhanced self-attention module based on wavelet decomposition and Fourier transformation, a residual error connection and normalization layer, a full connection layer and a Softmax layer; and the judging module is used for inputting the time sequence data to be detected into the trained abnormality detection model to judge the abnormality.

Description

Multidimensional time series data anomaly detection method, device and medium based on countermeasure training and frequency domain improvement self-attention mechanism Technical Field The invention belongs to the technical field of intelligent fault diagnosis, and particularly relates to a method for detecting time sequence data abnormality. Background Time series data anomaly detection is the most mature method in time series data analysis. Efficient anomaly detection techniques are widely used in various areas of real life. Under the large background of comprehensive informatization of industrial production, the variety of sensors on industrial equipment is more various, the sampling frequency is higher, and the data accumulation speed is very high. This further increases the difficulty of anomaly detection in situations where anomalies are otherwise very rare. In the face of industrial time series data with huge monitoring data and more indexes, traditional completely manual anomaly detection becomes impractical. Modern industrial anomaly detection has gradually moved toward artificial intelligence. The traditional statistical and machine learning methods are mainly used for modeling historical data, performing dimension reduction detection on input data or detecting based on classification or clustering methods. But there is a direct or indirect relationship between data in complex industrial processes. Traditional machine learning models have difficulty extracting direct links between objects from high-dimensional data. The advent of deep learning techniques has alleviated this problem. However, there are two general problems with deep learning models in the field of anomaly detection: 1. The model is less robust and is susceptible to noise. The robustness of the current time series data anomaly detection model has a certain degree of deficiency, which means that some challenges may be faced in practical application. Meanwhile, the models are also easily interfered and influenced by external factors such as noise and the like, so that the accuracy of detection results is reduced. 2. The frequency domain characteristics of the time series data are not well considered. In the analysis of time series data, frequency domain characteristics are very important in addition to time domain characteristics. However, in current time series data analysis, frequency domain characteristics are often not well considered, which may lead to inaccurate analysis results in some complex scenarios. In particular, frequency domain features typically include indicators of frequency, amplitude, phase, power spectral density, etc. of the signal, which can provide more in-depth signal analysis and diagnostic information. However, in the conventional time series data analysis method, only features in the time domain, such as a mean, a variance, a maximum value, a minimum value, and the like, are generally focused on, and frequency domain features are not fully utilized. This makes it easy to ignore some potential information, resulting in a limited accuracy of the model. In order to better utilize the frequency domain features of the time-series data, some advanced analysis techniques, such as fourier transform, wavelet transform, etc., may be used to convert the time-domain signal into a frequency-domain signal and extract the important features therein. In addition, a method based on machine learning or deep learning can be adopted to perform model training and optimization by combining frequency domain features. Disclosure of Invention The invention aims to solve the problem of abnormal detection of time sequence data, overcome the defects of the prior art, combine the advantage of good robustness of countermeasure training on the basis of fully utilizing the frequency domain characteristics of the time sequence data through discrete wavelet decomposition and Fourier transformation, and provide a multidimensional time sequence data abnormal detection method based on the countermeasure training and a frequency domain improved self-attention mechanism, so that the problems of poor robustness of a model, easy external interference receiving, low accuracy of a detection result and inaccurate analysis structure caused by insufficient consideration of the frequency domain characteristics of the time sequence data are solved. The invention is realized by the following technical scheme, and provides a multidimensional time sequence data anomaly detection method, equipment and medium based on countermeasure training and a frequency domain improved self-attention mechanism. The method specifically comprises the following steps: Step 1, acquiring an original data set and preprocessing; step 2, constructing an anomaly detection model based on countermeasure training and a frequency domain improved self-attention mechanism; step3, training the anomaly detection model based on the countermeasure training and the frequency domain improved