Fault diagnosis method based on additive adaptive LSTM-Transformer

By introducing the additive attention mechanism and adaptive attention mechanism into LSTM-Transformer, the problem of difficult to capture long-range feature dependencies in chemical process fault diagnosis is solved, and the accuracy and accuracy of fault diagnosis are improved, especially in processing Complex and similar fault types.

CN118690789APending Publication Date: 2024-09-24CHONGQING UNIVERSITY OF SCIENCE AND TECHNOLOGY

Patent Information

Application Number
CN202410839109.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

The existing LSTM-MHA fault diagnosis method has attention drift and long-range modeling difficulties when capturing the long-range feature dependencies of chemical process fault sequences, resulting in low diagnostic accuracy, especially insufficient ability to distinguish similar fault features.

Method used

Adopt a fault diagnosis method based on additive adaptive LSTM-Transformer, replace the dot product scaling attention mechanism in the Transformer with an additive attention mechanism, and introduce an adaptive attention mechanism in the encoder and decoder to dynamically allocate attention Force weights are used to focus on the connections between fault features and enhance the model's ability to extract long-range dependencies in sequences.

Benefits of technology

The model's ability to extract long-range features of the sequence is significantly improved, and the accuracy and accuracy of TE process fault diagnosis are enhanced. Especially when dealing with complex and similar fault types, the misclassification and missed diagnosis rates are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118690789A
    Figure CN118690789A
Patent Text Reader

Abstract

The invention relates to the technical field of chemical process fault diagnosis, and discloses a fault diagnosis method based on additive adaptive LSTM-Transformer, comprising the following steps: step 1, replacing a dot product scaling attention mechanism in a multi-head attention mechanism in Transformer with an additive attention mechanism, calculating attention weight by using a feedforward network, getting rid of the limitation of sequence length, and calculating attention weight by using the additive attention mechanism; the attention is more suitable for processing sequence data than the dot product scaling attention; and step 2, adding an adaptive attention mechanism into an additive attention mechanism in an encoder and a decoder of a Transformer, and then dynamically allocating weights according to the importance of different positions of the sequence, so that the model focuses on related features among fault features when the sequence is processed. According to the method, the longer-range feature dependency relationship of the fault sequence can be captured, so that the capability of extracting the dependency features of the model on the long range of the sequence is enhanced, and the method is more suitable for performing fault diagnosis on the TE process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of chemical process fault diagnosis, and in particular to a fault diagnosis method based on additive adaptive LSTM-Transformer. Background Art

[0002] Chemical processes play a core role in key industries such as petroleum, pharmaceuticals, and food processing, and are an indispensable foundation of modern society. Fault diagnosis in chemical processes is a key link to ensure production safety, improve efficiency, and maintain the normal operation of equipment. With the increase in industrial automation and complexity, the technology for fault diagnosis of chemical processes has become more and more stringent. Among many chemical processes, the Tennessee Eastman process is a typical chemical process model (TE process for short), which has always been the object of research in industry and academia. Although traditional statistical-based methods, signal processing-based methods, and machine learning-based methods can better understand the characteristics of sequence data, they are easily affected by data noise and affect diagnostic performance. In order to solve this problem, LSTM is introduced to diagnose chemical processes. Because LSTM can model long fault sequences through a gated structure, it is suitable for processing long sequence data, which is expected to improve fault diagnosis performance, enhance production safety, and improve production efficiency.

[0003] Transformer is a deep learning model architecture used for natural language processing (NLP) and other sequence-to-sequence tasks. It explicitly marks the position information of each sequence position through position encoding, so that the model can identify the relative and absolute positions in the sequence, thereby capturing the long-range information of the sequence. The attention mechanism extracts and combines key features of different positions, which is suitable for establishing long-range dependencies between sequences.

[0004] As a model completely based on the self-attention mechanism, Transformer has a strong ability to extract nonlinear sequence features. Jin et al. will propose a Transformer fault diagnosis method based on time series to identify various rotating machinery faults. Wang et al. proposed a non-cyclic sequence model based on convolution and attention operations. The multi-head attention mechanism in the model is extremely efficient in capturing long-term dependencies in various sequence modeling tasks. Therefore, it is applied to the processing of chemical process fault sequences to solve the modeling problems caused by its long-term dependencies.

[0005] Although the fault diagnosis model based on LSTM-MHA can effectively extract the features of most types of faults to a certain extent and classify them effectively, there are still some fault types whose features overlap and are difficult to distinguish. The main reasons are:

[0006] (1) Attention Drift:

[0007] When the model focuses on some irrelevant or noisy features, and there are some features that are unrelated to the noise, the multi-head attention mechanism will cause the problem of attention drift, ignoring key features and causing some performance degradation.

[0008] (2) Difficulty in long-term modeling:

[0009] The LSTM-MHA fault diagnosis method greatly improves the categories with extremely low diagnostic accuracy, improves the overall prediction accuracy, and reduces the number of incorrect predictions for other categories. However, its diagnostic accuracy is still very low, indicating that although the LSTM-MHA method pays more attention to the characteristics of sequence faults, the improvement in accuracy is limited. It can be seen that the characteristics of the fault sequence need to be further extracted, and the long-range dependencies of the sequence are difficult to extract. Summary of the invention

[0010] In order to make up for the above shortcomings, the present invention provides a fault diagnosis method based on additive adaptive LSTM-Transformer, which aims to capture the longer-term feature dependencies of the fault sequence to enhance the model's ability to extract long-term dependency features of the sequence.

[0011] To achieve the above object, the present invention provides the following technical solution: a fault diagnosis method based on additive adaptive LSTM-Transformer, comprising the following steps:

[0012] Step 1: Replace the dot product scaling attention mechanism in the multi-head attention mechanism in Transformer with the additive attention mechanism, use the feedforward network to calculate the attention weight, get rid of the limitation of sequence length, and make it more suitable for processing sequence data than dot product scaling attention;

[0013] Step 2: After adding the adaptive attention mechanism to the additive attention mechanism in the Transformer encoder and decoder, weights are dynamically assigned according to the importance of different positions in the sequence, so that the model focuses on features that are related between fault features when processing the sequence.

[0014] As a further description of the above technical solution: the Transformer includes an encoder and a decoder, wherein the encoder is used to convert the input sequence into a series of high-level feature representations, which is stacked by multiple layers, each layer consisting of two sub-layers, namely a multi-head self-attention mechanism and a fully connected feedforward neural network;

[0015] The multi-head self-attention mechanism allows the encoder to pay attention to all positions in the input sequence, thereby capturing the dependencies between positions;

[0016] The fully connected feedforward neural network performs nonlinear transformation on the hidden representation of each position. The decoder is also composed of multiple identical layers stacked together. Each layer includes three sublayers, each of which is a multi-head self-attention mechanism, an encoder-decoder attention mechanism, and a fully connected feedforward neural network. The encoder-decoder attention mechanism pays attention to the output of the encoder to obtain information interaction and alignment.

[0017] The Transformer also includes an embedding layer, which includes word embedding and position encoding, replacing the input language with data that the model can recognize for subsequent processing.

[0018] As a further description of the above technical solution: the position encoding includes sending the data to the attention layer to add the sine-cosine encoding operation so that the input data contains information. The mathematical calculation process of the sine-cosine position encoding is as follows:

[0019]

[0020] Among them, pos represents the specific position of the feature vector dimension, d model is the dimension of the eigenvector, 2i is the even dimension of the eigenvector, and 2i+1 is the odd dimension of the eigenvector.

[0021] As a further description of the above technical solution: the multi-head attention mechanism calculates the attention weight of the input sequence by scaling the dot product attention operation, specifically including the following steps:

[0022] First, the input sequence matrix is ​​mapped to three different subspaces to form three different feature matrices, namely the query matrix, key matrix and value matrix. The specific calculation process is as follows:

[0023] Q=XW Q =Linear(X) (3)

[0024] K=XW K =Linear(X) (4)

[0025] V=XW V =Linear(X) (5)

[0026] Among them, X is the input sequence matrix, Q, K, V are the feature matrices after mapping, and W Q , W K , W V All are randomly generated weight matrices;

[0027] The query matrix and the key matrix are scaled dot product operations to obtain the attention weight score value. The attention weight score probability matrix after Softmax is multiplied by the value matrix so that the output sequence matrix contains the attention weight score. The calculation process is shown in the following formula, where d k is the mapping dimension of the value matrix, d q =d k ;

[0028]

[0029] By adding multiple self-attention mechanism operations, the Transformer's ability to focus on feature information of different dimensions is enhanced. Multiple self-attention mechanisms are spliced, and the output sequences of multiple self-attention heads are spliced ​​and linearly mapped to obtain the final output sequence matrix. The specific calculation process is as follows:

[0030] MultiHead(Q,K,V)=Concat(head1,…,head h )W O (7)

[0031] where head i =Attention(Q i ,K i ,V i ) (8)

[0032] Among them, W O is a randomly generated multi-head attention weight matrix, h is the number of self-attention heads, Q i , K i , V is the Q of the i-th head i , K i 、V.

[0033] As a further description of the above technical solution: the fully connected feedforward neural network relies on its internal activation function to enhance the expression ability of new features and improve the generalization ability of the model. The fully connected feedforward neural network is composed of two linear mapping layers, and a Relu activation function is added to the two linear mapping layers. Its mathematical expression (9) is shown, where X is the output sequence matrix of the multi-head self-attention layer;

[0034] FFN(X)=Linear2(Relu(Linear1(X))) (9)

[0035] At the same time, residual connections are added to each sub-layer inside the Transformer, and layer normalization is added after the residual connection to improve the training speed and generalization ability of the model. The operation process is as follows:

[0036] Sublayer_Output=LayerNorm(X+Sublayer(X)) (10)

[0037] Where X is the input sequence matrix, and Sublayer is the internal operation function of each sublayer.

[0038] As a further description of the above technical solution: the additive attention mechanism determines the output state of the decoder by calculating the similarity between the encoder and the decoder under the encoding-decoding structure.

[0039] As a further description of the above technical solution: in the step 2, the adaptive attention mechanism consists of a channel attention mechanism and a spatial attention mechanism, which are used to weight each channel and highlight the channel features; and the spatial attention mechanism is used to weight each spatial position of the feature map to highlight important spatial features; these two attention mechanisms are connected in series to form an adaptive attention mechanism to perform adaptive optimization of feature weights.

[0040] As a further description of the above technical solution: the channel attention mechanism keeps the channel dimension unchanged and compresses the spatial dimension, specifically including the following steps:

[0041] First, the feature map is processed using global maximum pooling and global average pooling to obtain the maximum feature map and the average feature map, which are then sent to the multi-layer perceptron for processing respectively. Finally, the feature is activated by the Sigmoid function to complete the entire channel attention operation.

[0042] The spatial attention mechanism keeps the spatial dimension unchanged and compresses the channel dimension, specifically including the following steps:

[0043] First, the feature map is processed using global maximum pooling and global average pooling to obtain the maximum feature map and the average feature map, which are then sent to the hidden layer with only a single convolution kernel. Finally, the features are activated by the Sigmoid function to complete the entire spatial attention operation.

[0044] As a further description of the above technical solution: the network model of the additive adaptive LSTM-Transformer consists of an input layer, an LSTM layer and an improved Transformer layer. The sequence first enters the LSTM layer through the input layer for preliminary fault feature extraction, and then enters the encoder in the improved Transformer layer. After the additive attention mechanism extracts its content, position and structure information, the attention distribution of the data is generated, and the adaptive attention mechanism adjusts the parameters of the additive attention mechanism according to this distribution.

[0045] As a further description of the above technical solution: the network model of the additive adaptive LSTM-Transformer uses the additive attention mechanism to replace the multi-head attention mechanism, and adds an adaptive attention mechanism after the additive attention mechanism.

[0046] The present invention has the following beneficial effects:

[0047] 1. In the present invention, the chemical process fault diagnosis method based on additive adaptive LSTM-Transformer is proposed to capture the longer-range feature dependencies of the fault sequence to enhance the model's ability to extract long-range dependency features of the sequence.

[0048] 2. In the present invention, the additive adaptive LSTM-Transformer model can better focus on the fault features and extract feature dependencies in the long term of the sequence, and is more suitable for fault diagnosis of the TE process. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 The Transformer structure diagram of the fault diagnosis method based on additive adaptive LSTM-Transformer proposed in the present invention;

[0050] Figure 2 This is a framework diagram of the additive adaptive LSTM-Transformer model of the fault diagnosis method based on additive adaptive LSTM-Transformer proposed in the present invention. DETAILED DESCRIPTION

[0051] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] Reference Figure 1-Figure 2 , an embodiment provided by the present invention: a fault diagnosis method based on additive adaptive LSTM-Transformer, the main working steps are as follows:

[0053] (1) The dot product scaling attention mechanism in the multi-head attention mechanism in Transformer is replaced by the additive attention mechanism, and the attention weights are calculated using a feedforward network, which gets rid of the limitation of sequence length and makes it more suitable for processing sequence data than dot product scaling attention.

[0054] (2) After adding the adaptive attention mechanism to the additive attention mechanism in the encoder and decoder of the Transformer, weights are dynamically assigned according to the importance of different positions in the sequence, so that the model focuses on the features that are related between fault features when processing the sequence, thereby increasing the model's long-range modeling ability and better capturing long-range dependency information.

[0055] The chemical process fault diagnosis method based on additive adaptive LSTM-Transformer proposed in the present invention captures the longer-range feature dependencies of the fault sequence to enhance the model's ability to extract long-range dependency features of the sequence.

[0056] In one embodiment, the Transformer structure is as follows: Figure 1 As shown in the figure, its structure mainly consists of two parts, the encoder and the decoder. The encoder is used to convert the input sequence into a series of high-level feature representations. It is mainly composed of multiple stacked layers, each of which consists of two sub-layers, namely the multi-head self-attention mechanism and the fully connected feedforward neural network. The multi-head self-attention mechanism allows the encoder to pay attention to all positions in the input sequence, thereby capturing the dependencies between positions. The fully connected feedforward neural network performs a nonlinear transformation on the hidden representation of each position. The decoder is also stacked with multiple identical layers, each of which includes three sub-layers, the multi-head self-attention mechanism, the encoder-decoder attention mechanism and the fully connected feedforward neural network. The encoder-decoder attention mechanism pays attention to the output of the encoder to obtain information interaction and alignment.

[0057] Transformer is an encoder-decoder structure based entirely on the attention mechanism. It uses the attention mechanism to weight data for feature extraction. It mainly consists of three parts: embedding layer, encoder, and decoder. The embedding layer includes word embedding and position encoding. Transformer was originally designed for NLP tasks. Since the task processing objects of NLP are words, sentences, etc., word embedding operations are added to replace the input language with data that the model can recognize for subsequent processing. Both the encoder and decoder are composed of multiple identical layers stacked together. The encoder includes two sub-layers: a multi-head attention layer and a feedforward neural network. The decoder adds an encoder-decoder attention layer on the basis of the encoder.

[0058] In one embodiment, the Transformer network structure is specifically as follows:

[0059] (1) Positional encoding

[0060] Since the attention mechanism can only weight the data, it cannot provide position information for the data. However, for sequence fault data, data position information is helpful for model feature extraction. The data is sent to the attention layer and the sine-cosine encoding operation is added so that the input data contains information. The mathematical calculation process of sine-cosine position encoding is as follows:

[0061]

[0062] Among them, pos represents the specific position of the feature vector dimension, d model is the dimension of the eigenvector, 2i is the even dimension of the eigenvector, and 2i+1 is the odd dimension of the eigenvector.

[0063] (2) Multi-head attention mechanism

[0064] The essence of the self-attention layer is the self-attention mechanism, which calculates the attention weights of the input sequence by scaling the dot product attention operation.

[0065] First, the input sequence matrix is ​​mapped to three different subspaces to form three different feature matrices, namely the query matrix (Query), the key matrix (Key) and the value matrix (Value). The specific calculation process is as follows:

[0066] Q=XW Q =Linear(X) (3)

[0067] K=XW K =Linear(X) (4)

[0068] V=XW V =Linear(X) (5)

[0069] Among them, X is the input sequence matrix, Q, K, V are the feature matrices after mapping, and W Q , W K , W V The weight matrices are randomly generated.

[0070] The query matrix and the key matrix are scaled dot product operations to obtain the attention weight score value. The attention weight score probability matrix after Softmax is multiplied by the value matrix so that the output sequence matrix contains the attention weight score. The calculation process is shown in the following formula, where d k is the mapping dimension of the value matrix. For the convenience of calculation, let d q =d k .

[0071]

[0072] A self-attention mechanism can only capture relevant feature information in one representation subspace, so by adding multiple self-attention mechanism operations, the Transformer's ability to focus on feature information of different dimensions is enhanced. The multi-head attention mechanism is actually to splice multiple self-attention mechanisms, and use the output sequences of multiple self-attention heads for splicing and linear mapping to obtain the final output sequence matrix. The specific calculation process is as follows:

[0073] MultiHead(Q,K,V)=Concat(head1,…,head h )W O (7)

[0074] where head i =Attention(Q i ,K i ,V i ) (8)

[0075] Among them, W O is a randomly generated multi-head attention weight matrix, h is the number of self-attention heads, Q i , K i , V is the Q of the i-th head i , K i 、V.

[0076] (3) Fully connected feedforward neural network

[0077] Since the multi-head attention layer mainly performs matrix multiplication, i.e. linear transformation, and the learning ability of linear transformation is weaker than that of nonlinear transformation, the feature expression ability of the attention mechanism is not strong. Therefore, a feedforward neural network is added to rely on its internal activation function to enhance the expression ability of new features and improve the generalization ability of the model. The feedforward neural network layer consists of two linear mapping layers, and the Relu activation function is added to the two linear mapping layers. Its mathematical expression is shown in (9), where X is the output sequence matrix of the multi-head self-attention layer.

[0078] FFN(X)=Linear2(Relu(Linear1(X))) (9)

[0079] At the same time, in order to solve the problem that the recognition accuracy decreases as the number of network layers increases, residual connections are added to each sublayer inside the Transformer, and layer normalization is added after the residual connection to improve the training speed and generalization ability of the model. The operation process is as follows. Where X is the input sequence matrix, and Sublayer is the internal operation function of each sublayer.

[0080] Sublayer_Output=LayerNorm(X+Sublayer(X)) (10)

[0081] In one embodiment, the additive attention mechanism is as follows:

[0082] The additive attention mechanism is to determine which encoder states the decoder output should focus on by calculating the similarity between the encoder and decoder under the encoder-decoder structure.

[0083] The basic idea of ​​the additive attention mechanism is to calculate similarity weight coefficients between the hidden state of the decoder's output and all the hidden states of the encoder's output. These coefficients represent the relationship between the hidden states at different positions in the current decoder and the encoder. These weight coefficients are used to perform weighted summation on all the hidden states of the encoder to obtain a weighted representation. This weighted representation can capture important information in the input sequence related to the output sequence, allowing the model to better perform sequence-to-sequence conversion.

[0084] The specific calculation process is as follows:

[0085]

[0086] Where Q, K, V represent query, key, and value vectors respectively, and W q , W k , W v They represent the linear transformation matrices of query, key and value respectively, d represents the dimension of the key vector, and the softmax function is used to normalize the attention weights.

[0087] The additive attention mechanism not only has good flexibility, stability and reliability, but also has the following advantages:

[0088] (1) Processing long sequences. When processing sequence data, the dot product scaling attention mechanism uses a dot product operation to determine the attention weight by calculating the dot product between the query and the key. Although it can be calculated quickly for long sequences, its scaling factor needs to be adjusted according to the sequence length, so the model is greatly affected by the sequence length. The additive attention mechanism transforms the architecture query and key to the same dimension, then adds them, and calculates the attention weight through a nonlinear activation layer and a linear layer. This method does not depend on the sequence length. The specific processing process is that the additive attention mechanism compresses the global information of the sequence into a vector, and the subvector a at the i-th position i The calculation of its attention weight and global vector q is shown in the formula.

[0089]

[0090] in, is the learnable parameter vector,

[0091] In addition, different position information in long sequences will be diluted in the attention weight distribution, making it difficult for the model to capture the key information of the sequence.

[0092] (2) Visual analysis. The weight vector generated by the additive attention mechanism can be used for visual analysis to help people understand the decision-making process of the model and thus better explain the model.

[0093] (3) Improve the generalization ability of the model. Since the additive attention mechanism can flexibly adjust different weights, it can learn different weights corresponding to different parts of the input sequence, thereby improving the generalization ability of the model. Its structure is an extension of LSTM.

[0094] In a specific embodiment, the adaptive attention mechanism is as follows:

[0095] CBAM (Convolutional Block Attention Module) consists of a channel attention mechanism (CAM) and a spatial attention mechanism (SAM). CAM is used to weight each channel, mainly highlighting channel features; while SAM is used to weight each spatial position of the feature map, mainly highlighting important spatial features. These two attention mechanisms are connected in series to achieve adaptive optimization of feature weights.

[0096] CAM keeps the channel dimension unchanged while compressing the spatial dimension. First, the feature map is processed using global maximum pooling and global average pooling to obtain the maximum feature map and the average feature map, which are then sent to the multi-layer perceptron for processing respectively. Finally, the sigmoid function is activated to obtain the features, completing the entire channel attention operation.

[0097]

[0098] Among them, M c (F) represents the weight coefficient, σ represents the Sigmoid function, and W0 and W1 represent the coefficients of the two layers in the multilayer perceptron.

[0099] SAM keeps the spatial dimension unchanged while compressing the channel dimension. First, the feature map is processed using global maximum pooling and global average pooling to obtain the maximum feature map and the average feature map, which are then sent to the hidden layer with only a single convolution kernel. Finally, the feature is activated by the Sigmoid function to complete the entire spatial attention operation.

[0100]

[0101] Among them, f represents the convolution kernel size, and σ represents the Sigmoid function.

[0102] In one embodiment, the network structure of the additive adaptive LSTM-Transformer is as follows:

[0103] Transformer can basically complete general fault diagnosis tasks. However, due to the strong correlation between the features of sequence data, it increases the difficulty of the model to extract long-distance relationships. Therefore, the LSTM-TF model is improved.

[0104] (1) Fault diagnosis framework based on additive adaptive LSTM-Transformer

[0105] The additive adaptive LSTM-Transformer fault diagnosis model mainly consists of an input layer, an LSTM layer and an improved Transformer layer.

[0106] The sequence first enters the LSTM layer through the input layer for preliminary fault feature extraction, and then enters the encoder in the improved Transformer layer. After the additive attention mechanism extracts its content, position, structure and other information, it generates the attention distribution of the data, and the adaptive attention mechanism adjusts the parameters of the additive attention mechanism according to this distribution to make the model more suitable for this fault diagnosis task. The combination of the additive attention mechanism and the adaptive attention mechanism in two places on the decoder is also to adjust the parameters of the additive attention mechanism.

[0107] This model makes the following two improvements based on LSTM-Transformer.

[0108] ① Use the additive attention mechanism to replace the multi-head attention mechanism, because the dot product scaling factor of the multi-head attention mechanism is affected by the sequence length. When the scaling factor remains unchanged and the sequence is too long, the attention to the sequence features is dispersed, and the long-range dependency of the features in the sequence cannot be well obtained. The additive attention mechanism calculates the features at each position of the sequence separately, without losing the feature relationship.

[0109] ② Add an adaptive attention mechanism after the additive attention mechanism. Although the additive adaptive mechanism can extract more specific fault feature relationships, it requires more attention to important feature relationships. In this case, the adaptive attention mechanism is used to focus on sequence channels and spatial features, and to capture more complete relationships between sequence features by increasing the understanding of important features and further interpreting feature relationships.

[0110] For ease of implementation, the pseudo code of the additive adaptive LSTM-Transformer algorithm for fault diagnosis is shown in Table 1, which is the pseudo code of the additive adaptive LSTM-Transformer for fault diagnosis of the TE process.

[0111] Table 1:

[0112]

[0113]

[0114] In an experimental example, a program is written according to the pseudo code of the fault diagnosis algorithm based on additive adaptive LSTM-Transformer and experiments are conducted to verify the performance of the proposed algorithm.

[0115] (1) Experimental design:

[0116] ① Data set selection: In order to ensure the effectiveness of the comparative experiment, the data set used in this chapter is the same as that in the previous chapter.

[0117] ② Data preprocessing: The data is divided into a training set and a validation set in a ratio of 7:3, and mean normalization is used to eliminate the influence of different dimensions of variables on the model. Since all faults are diagnosed, the data itself has few features and dimensionality reduction is not conducive to diagnosing all faults, so this experiment does not perform feature dimensionality reduction.

[0118] ③ Training parameter settings: Table 2 shows the main parameter settings for fault diagnosis based on additive adaptive LSTM-Transformer.

[0119] Table 2 Model parameter settings based on additive adaptive LSTM-Transformer:

[0120]

[0121] ④Testing and evaluation: Use confusion matrix, precision, recall and F1 score indicators on the test set to evaluate the model performance.

[0122] In order to verify the performance of the additive adaptive LSTM-Transformer fault diagnosis model proposed in this invention, experiments were conducted on the TE data set, and compared with the LSTM-Transformer, additive LSTM-Transformer and adaptive LSTM-Transformer models in terms of confusion matrix, precision, recall and F1 score. Although the LSTM-Transformer-based fault diagnosis model has a high diagnostic accuracy for faults 0, 1, 3, 4, 5, etc., all exceeding 362, its diagnostic accuracy for faults 2, 9, and 14 is surprisingly low, with 2, 77, and 0 correctly diagnosed, especially for fault 14, which LSTM-Transformer cannot diagnose at all. Faults 2, 9, 14, 15, and 18 have 266, 103, 33, 282, and 124 samples misclassified as fault 8, respectively, reflecting that the fault characteristics of these faults and fault 8 are similar to varying degrees, and LSTM-Transformer cannot diagnose these similar faults well.

[0123] The adaptive LSTM-Transformer improved the faults 2, 9, and 14 that were difficult for LSTM-Transformer to identify to 145, 165, and 164, which is a 50% improvement compared to LSTM-Transformer. In particular, the fault 14 went from being completely unrecognizable by LSTM-Transformer to being able to identify half of the samples. The number of samples of faults 2, 9, 14, 15, and 18 that were misclassified as fault 8 also decreased to 63, 16, 85, and 10. This shows that the adaptive LSTM-Transformer has greatly improved the performance of distinguishing similar features between similar fault sequences, but there is still some confusion. The model is not accurate enough in extracting the feature relationship between similar sequences and needs further optimization.

[0124] Additive LSTM-Transformer correctly classified more fault types such as faults 2, 9, and 14 that were difficult to identify, with 168, 336, and 197 respectively, which was a significant improvement compared to the corresponding fault type diagnoses of 2, 77, and 0 on LSTM-Transformer. For fault types that were easy to identify, Additive LSTM-Transformer increased fault 10 from 259 to 283, indicating that the model not only strengthened the fault features that were easy to extract, but also extracted the sequence separately, which was more conducive to extracting the deep fault features of complex faults and effectively connecting the features in the long run of the sequence.

[0125] The additive adaptive LSTM-Transformer performs at a high level on all fault types, among which the number of correct diagnoses for fault 11 reaches 401. For the difficult-to-identify faults 2, 9, 14, 15, and 18, the number of correct classifications increases from 266, 103, 33, 282, and 124 to 234, 369, 189, 310, and 334, reflecting the feature extraction advantages of the additive attention mechanism for vector calculation of sequence features and the effectiveness of the adaptive attention mechanism in adjusting parameters to extract key features of the sequence, thereby further enhancing the ability to extract complex fault features of the sequence, improving the model diagnosis accuracy, and reducing the misdiagnosis rate.

[0126] In order to further verify the performance of the additive adaptive LSTM-Transformer model in processing TE data set fault diagnosis tasks, this paper compares the performance of the LSTM-Transformer, additive LSTM-Transformer and adaptive LSTM-Transformer models in three key performance indicators: precision, recall and F1-Score. These indicators will be systematically analyzed below to evaluate and verify the diagnostic effect of the additive adaptive LSTM-Transformer model.

[0127] The accuracy of additive adaptive LSTM-Transformer on faults 4, 5, 6, and 7 is close to 98%, which is higher than other models. The additive LSTM-Transformer and adaptive LSTM-Transformer models have improved to a certain extent compared with LSTM-Transformer. The accuracy of LSTM-Transformer on the overall fault type is average, and the accuracy on faults 4, 5, 6, and 7 is stable at 97%. However, the performance on fault 2 and fault 8 is lower, at 41% and 39% respectively. The additive LSTM-Transformer has improved to a certain extent compared with LSTM-Transformer, but it is insufficient when dealing with complex fault features such as fault 14, at 38%. The accuracy of adaptive LSTM-Transformer is further improved compared with additive LSTM-Transformer, especially on faults 6 and 10, exceeding LSTM-Transformer and reaching 98%. This shows that the dynamic adjustment of parameters by the adaptive attention mechanism is conducive to the extraction of long-range connections in sequences. This shows that the additive adaptive LSTM-Transformer has a significant advantage in capturing long-range relationships in sequences. In addition, for faults such as Fault 2 and Fault 8 that contain complex long-range relationships, the additive adaptive LSTM-Transformer has the greatest improvement on this type of fault, which fully demonstrates the effectiveness of extracting long-range dependencies in sequences.

[0128] Overall, the recall rate of the additive adaptive LSTM-Transformer model on most fault types is better than that of other models. LSTM-Transformer performs poorly on the recall rate of most fault types, especially on faults 2 and 8, which are only 38% and 41%. This shows that it is not capable of identifying such fault samples. The recall rate of additive LSTM-Transformer for fault 2 is increased to 42%, but it decreases for fault 8, indicating that it is unstable in extracting complex faults. The recall rate of adaptive LSTM-Transformer is significantly improved compared with additive LSTM-Transformer, and it is increased to 98% for faults 3, 4, 5, 6, and 7, indicating that the adaptive mechanism dynamically adjusts parameters to help the model extract long-range dependencies of the sequence. The recall rate of additive adaptive LSTM-Transformer is significantly higher than that of other models for faults 2 and 8, which are difficult to identify, at 48% and 58% respectively. This shows that the additive attention mechanism and the adaptive attention mechanism help the model reduce missed samples, showing the excellent performance of the additive attention mechanism and the adaptive attention mechanism in capturing long-range dependencies of the sequence. The model can identify more positive fault samples and reduce the false negative rate. In addition, the recall rate of the additive adaptive LSTM-Transformer model is still the highest in the types of complex fault features such as fault 9 and fault 11, reaching 90% and 98%, and it can effectively identify most fault samples, further proving its effectiveness in processing complex fault types.

[0129] Overall, the additive adaptive LSTM-Transformer performs well in F1 scores for most faults, which are generally higher than or close to other comparison models. LSTM-Transformer has the largest change range. Among them, the balancing ability for fault 0 is the weakest, close to 0, while the balance for faults 3, 4, and 5 is relatively high, reaching 98%, and is relatively stable. This shows that different fault types have different balancing capabilities for recall and precision. The F1 scores of the additive adaptive LSTM-Transformer in faults 2 and 8 are significantly higher than those of other models, reaching 50%, indicating that the model performs well in capturing long-range dependencies. The additive attention mechanism helps the model better identify and focus on long-range related features, thereby improving the model's ability to accurately and comprehensively identify fault samples in a balanced manner. The overall balanced performance of the adaptive LSTM-Transformer is in the middle. The F1 scores of the additive adaptive LSTM-Transformer model in the diagnosis of faults 4 and 10 are significantly better than those of other models, at 98% and 90% respectively, showing the ability of sequence features to work together. The adaptive mechanism adjusts parameters according to different inputs, increases the ability to extract complex relationships between long-range features of the sequence, and enables the model to more accurately capture important features when faced with complex relationships between long-range features, thereby balancing the recognition accuracy and recall rate. In complex fault types such as fault 9 and fault 11, the high recall rate of the additive adaptive LSTM-Transformer model further proves its effectiveness in handling and diagnosing complex fault types, and can provide more accurate and comprehensive fault diagnosis performance.

[0130] In order to further evaluate the fault diagnosis performance of the additive adaptive LSTM-Transformer model in the TE process, the present invention uses t-SNE technology to visualize the feature representation of the additive adaptive LSTM-Transformer model and the LSTM-MHA model. This high-dimensional data dimensionality reduction technology is used to intuitively observe and analyze the classification effect of the model on the characteristics of different fault types.

[0131] LSTM-Transformer clearly classifies a small number of faults such as 0, 1, 4, and 5, but shows a lot of overlap in other fault types, indicating that the model can only diagnose fault types that are easy to distinguish, but cannot accurately diagnose faults with unclear features or similar features.

[0132] The classification boundaries of faults 0, 1, 4, and 5 are clearer, and the overlap in faults 2, 9, 13, and 14, where it is difficult to extract fault features, is reduced, indicating that the additive attention mechanism can deeply extract sequence fault features and improve the model's diagnostic performance.

[0133] Fault pairs 0, 1, 4, 5 and other most fault types can be separated well, the number of diagnosed fault types increases, the overlap on a few fault types such as 13 and 14 decreases, and its ability to capture complex fault feature relationships is enhanced. The clustering compactness is relatively high, reflecting that the model can more accurately capture the relationship between complex features.

[0134] There is a clear separation between the fault types, and the clustering is relatively more compact, indicating that the additive adaptive LSTM-Transformer combines the advantages of the additive attention mechanism and the adaptive attention mechanism in focusing on and connecting fault features, effectively enhancing the capture and expression of long-range feature relationships of the sequence.

[0135] It can be concluded that the additive adaptive LSTM-Transformer model significantly improves the ability to capture long-range dependencies of sequences by integrating the advantages of additive attention mechanism and adaptive attention mechanism. This not only strengthens the model's understanding of long-range sequence data, but also enhances its ability to separate features in high-dimensional space, which is directly related to the accuracy of fault type diagnosis in practical applications. Among them, the clearer category boundaries obtained mean that the model can more accurately identify and classify various faults in actual operation, thereby improving the reliability and safety of the system.

[0136] Aiming at the problem that LSTM-MHA is difficult to extract deep fault features in chemical processes, a chemical process fault diagnosis method based on additive adaptive LSTM-Transformer is proposed, aiming to extract the feature connections in the long-range of fault sequences, so as to comprehensively improve the diagnostic accuracy of various faults in chemical processes. Through experimental comparison with LSTM-Transformer, additive LSTM-Transformer and adaptive LSTM-Transformer models, it is concluded that the additive adaptive LSTM-Transformer model can better focus on the fault features in the long-range of sequences and extract feature dependencies, and is more suitable for fault diagnosis of TE processes.

[0137] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A fault diagnosis method based on additive adaptive LSTM-Transformer, characterized by: The steps include: Step 1: Replace the dot product scaling attention mechanism in the multi-head attention mechanism in Transformer with the additive attention mechanism, use the feedforward network to calculate the attention weight, get rid of the limitation of sequence length, and make it more suitable for processing sequence data than dot product scaling attention; Step 2: After adding the adaptive attention mechanism to the additive attention mechanism in the Transformer encoder and decoder, weights are dynamically assigned according to the importance of different positions in the sequence, so that the model focuses on features that are related between fault features when processing the sequence.

2. The fault diagnosis method based on additive adaptive LSTM-Transformer according to claim 1, characterized in that: The Transformer includes an encoder and a decoder. The encoder is used to convert the input sequence into a series of high-level feature representations. The encoder is composed of multiple stacked layers, each of which consists of two sublayers, namely a multi-head self-attention mechanism and a fully connected feedforward neural network. The multi-head self-attention mechanism allows the encoder to pay attention to all positions in the input sequence, thereby capturing the dependencies between positions; The fully connected feedforward neural network performs nonlinear transformation on the hidden representation of each position. The decoder is also composed of multiple identical layers stacked together. Each layer includes three sublayers, each of which is a multi-head self-attention mechanism, an encoder-decoder attention mechanism, and a fully connected feedforward neural network. The encoder-decoder attention mechanism pays attention to the output of the encoder to obtain information interaction and alignment. The Transformer also includes an embedding layer, which includes word embedding and position encoding, replacing the input language with data that the model can recognize for subsequent processing.

3. The fault diagnosis method based on additive adaptive LSTM-Transformer according to claim 2 is characterized in that: The position encoding includes sending the data to the attention layer and adding the sine-cosine encoding operation so that the input data contains information. The mathematical calculation process of the sine-cosine position encoding is as follows: Among them, pos represents the specific position of the feature vector dimension, d model is the dimension of the eigenvector, 2i is the even dimension of the eigenvector, and 2i+1 is the odd dimension of the eigenvector.

4. The fault diagnosis method based on additive adaptive LSTM-Transformer according to claim 1, characterized in that: The multi-head attention mechanism calculates the attention weights of the input sequence by scaling the dot product attention operation, specifically including the following steps: First, the input sequence matrix is ​​mapped to three different subspaces to form three different feature matrices, namely the query matrix, key matrix and value matrix. The specific calculation process is as follows: Q=XW Q =Linear(X) (3) K=XW K =Linear(X) (4) V=XW V =Linear(X) (5) Among them, X is the input sequence matrix, Q, K, V are the feature matrices after mapping, and W Q , W K , W V All are randomly generated weight matrices; The query matrix and the key matrix are scaled dot product operations to obtain the attention weight score value. The attention weight score probability matrix after Softmax is multiplied by the value matrix so that the output sequence matrix contains the attention weight score. The calculation process is shown in the following formula: where d k is the mapping dimension of the value matrix, d q =d k ; By adding multiple self-attention mechanism operations, the Transformer's ability to focus on feature information of different dimensions is enhanced. Multiple self-attention mechanisms are spliced, and the output sequences of multiple self-attention heads are spliced ​​and linearly mapped to obtain the final output sequence matrix. The specific calculation process is as follows: MultiHead(Q,K,V)=Concat(head1,…,head h )W O (7) where head i =Attention(Q i ,K i ,V i ) (8) Among them, W O is a randomly generated multi-head attention weight matrix, h is the number of self-attention heads, Q i , K i , V is the Q of the i-th head i , K i 、V.

5. The fault diagnosis method based on additive adaptive LSTM-Transformer according to claim 2, characterized in that: The fully connected feedforward neural network relies on its internal activation function to enhance the expression ability of new features and improve the generalization ability of the model. The fully connected feedforward neural network consists of two linear mapping layers, and the Relu activation function is added to the two linear mapping layers. Its mathematical expression (9) is shown as follows: FFN(X)=Linear2(Relu(Linear1(X))) (9) Where X is the output sequence matrix of the multi-head self-attention layer; At the same time, residual connections are added to each sub-layer inside the Transformer, and layer normalization is added after the residual connection to improve the training speed and generalization ability of the model. The operation process is as follows: Sublayer_Output=LayerNorm(X+Sublayer(X)) (10) Where X is the input sequence matrix, and Sublayer is the internal operation function of each sublayer.

6. The fault diagnosis method based on additive adaptive LSTM-Transformer according to claim 1, characterized in that: The additive attention mechanism determines the output state of the decoder by calculating the similarity between the encoder and the decoder under the encoding-decoding structure.

7. The fault diagnosis method based on additive adaptive LSTM-Transformer according to claim 2, characterized in that: In step 2, the adaptive attention mechanism consists of a channel attention mechanism and a spatial attention mechanism, which are used to weight each channel and highlight the channel features; The spatial attention mechanism is used to weight each spatial position of the feature map to highlight important spatial features; These two attention mechanisms are connected in series to form an adaptive attention mechanism to perform adaptive optimization of feature weights.

8. The fault diagnosis method based on additive adaptive LSTM-Transformer according to claim 7 is characterized in that: The channel attention mechanism keeps the channel dimension unchanged and compresses the spatial dimension, specifically including the following steps: First, the feature map is processed using global maximum pooling and global average pooling to obtain the maximum feature map and the average feature map, which are then sent to the multi-layer perceptron for processing respectively. Finally, the feature is activated by the Sigmoid function to complete the entire channel attention operation. The spatial attention mechanism keeps the spatial dimension unchanged and compresses the channel dimension, specifically including the following steps: First, the feature map is processed using global maximum pooling and global average pooling to obtain the maximum feature map and the average feature map, which are then sent to the hidden layer with only a single convolution kernel. Finally, the features are activated by the Sigmoid function to complete the entire spatial attention operation.

9. The fault diagnosis method based on additive adaptive LSTM-Transformer according to claim 1, characterized in that: The network model of the additive adaptive LSTM-Transformer consists of an input layer, an LSTM layer and an improved Transformer layer. The sequence first enters the LSTM layer through the input layer for preliminary fault feature extraction, and then enters the encoder in the improved Transformer layer. After the additive attention mechanism extracts its content, position and structure information, the attention distribution of the data is generated, and the adaptive attention mechanism adjusts the parameters of the additive attention mechanism according to this distribution.

10. The fault diagnosis method based on additive adaptive LSTM-Transformer according to claim 9, characterized in that: The network model of the additive adaptive LSTM-Transformer uses an additive attention mechanism to replace the multi-head attention mechanism, and adds an adaptive attention mechanism after the additive attention mechanism.

Citation Information

Patent Citations

  • Gas prediction method based on EMD-BiLSTM-Attention mechanism transformer digital twinborn model

    CN115964932A

  • Multi-attention mechanism gearbox fault diagnosis method, system and device

    CN116124449A

  • Wind turbine generator data processing method and device

    CN118193967A

  • Method for temporal knowledge graph reasoning based on distributed attention

    US20230401466A1

  • Dam defect time-sequence image description method based on local self-attention mechanism

    WO2023217163A1

Cited By

  • Off-grid photovoltaic array fault diagnosis method based on ConvTran

    CN119988873A

  • A method for off-grid photovoltaic array fault diagnosis based on ConvTran

    CN119988873B

  • Cable fault detection method and system

    CN120372256A

  • Transform fault diagnosis interpretation method and system based on multilayer attention fusion

    CN122196703A

  • A Transformer Fault Diagnosis and Interpretation Method and System Based on Multi-Level Attention Fusion

    CN122196703B