A method and device for fault diagnosis of pump equipment based on knowledge graph
By building the fault database and knowledge graph of the machine and pump equipment, and using deep learning models for real-time fault location, the low accuracy and missed detection problems caused by manual data acquisition in traditional fault diagnosis methods are solved, and the accuracy and efficiency of fault detection are improved.
Patent Information
- Application Number
- CN202410078499.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-19
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-01-19
AI Technical Summary
Traditional machine pump equipment fault diagnosis methods rely on manual data collection, resulting in untimely and low accuracy of fault detection, inability to effectively utilize operating samples, resulting in missed inspection and unplanned downtime losses.
Using a fault diagnosis method based on knowledge graph, by constructing a fault database of machine pump equipment, using a entity recognition model combined with a bidirectional long and short-term memory network and a bidirectional gating recurrent network, an improved multi-head self-attention mechanism and a 3-dimensional convolutional layer are introduced. Build a fault diagnosis knowledge graph to achieve real-time fault location.
It improves the accuracy of fault detection, reduces unplanned downtime losses caused by sudden failures of machine pump equipment, and enhances the accuracy and efficiency of fault positioning.
Smart Images

Figure CN118861308B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of machine pump equipment fault diagnosis, and specifically relates to a machine pump equipment fault diagnosis method and device based on a knowledge graph. Background Art
[0002] In recent years, driven by modern industrial technology, the operating structure of pump equipment has become more reasonable and perfect. At the same time, the combination of traditional theoretical methods and new theoretical technologies has also enriched the fault diagnosis methods of pump equipment. Pump equipment failures can be divided into common failures and special failures. Among them, the causes of common failures mainly include abnormal operation of parts and temperature and humidity reasons. The abnormal operation of parts is due to the aging of the components of electromechanical equipment after long-term operation, which causes the structural parts to fall off and loosen, thereby greatly reducing the stability of the pump equipment. In addition, when operating in an environment with poor ventilation conditions, the pump equipment will short-circuit due to excessive humidity, thereby damaging related components and affecting the overall operation of the equipment.
[0003] In the process of pump equipment fault diagnosis, since the early stage mainly relied on manual data collection, and less automatic data collection and real-time diagnosis were carried out, the sample data of some time periods lacked labels, resulting in the omission of pump faults, and the inability to effectively utilize some of the pump equipment operation samples obtained. Summary of the invention
[0004] In view of the deficiencies in the prior art, the purpose of this application is to provide a machine pump equipment fault diagnosis method based on a knowledge graph. By constructing a knowledge graph, this method can locate the cause of the failure of the machine pump equipment in a timely manner, thereby improving the accuracy of fault detection.
[0005] To achieve the above objectives, this application provides the following technical solutions:
[0006] A method for diagnosing pump equipment faults based on a knowledge graph, the method comprising the following steps:
[0007] S100: Build a pump equipment failure database;
[0008] S200: performing entity recognition on the fault data in the pump equipment fault database based on an entity recognition model to identify entities and their attributes;
[0009] The entity recognition model includes a bidirectional long short-term memory network BiLSTM and a bidirectional gated recurrent network BiGRU, and the output of the bidirectional long short-term memory network BiLSTM is used as the input of the bidirectional gated recurrent network BiGRU;
[0010] S300: extracting the relationship between entities identified by the entity recognition model based on the entity relationship extraction model;
[0011] The entity relationship extraction model introduces an improved multi-head self-attention mechanism, which additionally introduces a 3D convolution layer and an average pooling layer to enable the model to obtain more feature interaction information.
[0012] S400: constructing a knowledge graph for fault diagnosis of pump equipment based on the identified entities and the relationships between the extracted entities;
[0013] S500: Inputting the operation data of the machine pump equipment to be tested into the machine pump equipment fault diagnosis knowledge graph to implement fault diagnosis of the machine pump equipment to be tested.
[0014] Preferably, in step S200, the entity recognition model is trained by the following steps:
[0015] S201: manually marking the fault data in the pump equipment fault database to mark out entity information in the fault data;
[0016] S202: dividing the fault data in the annotated machine pump equipment fault database into a training set and a validation set, setting training parameters, and training the entity recognition model through the training set. During the training process, when the cross entropy loss function converges, the model training is completed;
[0017] S203: Verify the entity recognition model after each training through the validation set, and evaluate the model with the F1 score as the evaluation indicator. If the F1 score does not increase within a certain number of model training times, the model verification is passed; otherwise, adjust the training parameters and re-train the model until the verification is passed.
[0018] Preferably, in step S300, the entity relationship extraction model is trained by the following steps:
[0019] S301: combining entity information in the fault data annotated in step S201 and annotating relationships to obtain an entity-relationship data set;
[0020] S302: Divide the entity-relationship dataset into a training set and a validation set;
[0021] S303: Setting training parameters, training the entity relationship extraction model through the training set, and completing the model training when the maximum number of training times is reached;
[0022] S304: Verify the entity recognition model after each training through the validation set, and evaluate the model with the F1 score as the evaluation indicator. If the F1 score does not increase within a certain number of model training times, the model verification is passed; otherwise, adjust the training parameters and retrain the model until the verification is passed.
[0023] Preferably, in step S400, constructing a pump equipment fault diagnosis knowledge graph includes the following steps:
[0024] S401: performing entity recognition on the fault data in the pump equipment fault database based on the entity recognition model to identify entities; performing relationship extraction on the identified entities based on the entity relationship extraction model to obtain the relationship between the entities;
[0025] S402: Generate entity-relationship-entity triples according to entities and relationships between entities;
[0026] S403: Construct a knowledge graph for fault diagnosis of pump equipment based on entity-relationship-entity triples.
[0027] The present application also provides a pump equipment fault diagnosis device based on a knowledge graph, the device comprising:
[0028] Acquisition module, used to build a pump equipment fault database;
[0029] An entity recognition module, used for performing entity recognition on the fault data in the pump equipment fault database based on an entity recognition model to identify entities and their attributes; wherein the entity recognition model includes a bidirectional long short-term memory network BiLSTM and a bidirectional gated recurrent network BiGRU, and the output of the bidirectional long short-term memory network BiLSTM is used as the input of the bidirectional gated recurrent network BiGRU;
[0030] An entity relationship extraction module, used for extracting the relationship between entities identified by the entity recognition model based on an entity relationship extraction model; wherein the entity relationship extraction model introduces an improved multi-head self-attention mechanism, and the improved multi-head self-attention mechanism additionally introduces a 3D convolution layer and an average pooling layer to enable the model to obtain more feature interaction information;
[0031] A knowledge graph construction module is used to construct a knowledge graph for fault diagnosis of pump equipment based on the identified entities and the relationships between the extracted entities;
[0032] The fault diagnosis module is used to input the operating data of the machine pump equipment to be tested into the machine pump equipment fault diagnosis knowledge map to realize the fault diagnosis of the machine pump equipment to be tested.
[0033] The present application also provides a system for fault diagnosis of pump equipment based on knowledge graph, including:
[0034] Problem input module, used to input user fault description;
[0035] The entity extraction module is used to extract entities and entity relationships from the fault description input by the user;
[0036] A query module, used to construct query statements based on the extracted entities and entity relationships to query the causes of faults and solutions in the knowledge graph of machine pump equipment fault diagnosis;
[0037] The answer output module is used to output the fault causes and solutions found.
[0038] The present application also provides an electronic device, the electronic device comprising:
[0039] A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein:
[0040] When the processor executes the program, any of the above methods is implemented.
[0041] The present application also provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute any of the above methods.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] This application constructs a knowledge graph based on the collected machine pump data, which can easily and timely locate the cause of the failure of the machine pump equipment, increase the accuracy of fault detection, enable staff to discover and solve problems in a timely manner, and reduce unplanned downtime losses caused by sudden failures of the machine pump equipment. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a flow chart of a method for diagnosing a fault of a pump device based on a knowledge graph provided by an embodiment of the present application;
[0045] Figure 2 is a structural diagram of an entity recognition model provided by another embodiment of the present application;
[0046] Figure 3 is a structural diagram of an entity relationship extraction model provided by another embodiment of the present application;
[0047] Figure 4 is a schematic diagram of the structure of a multi-head self-attention mechanism provided by another embodiment of the present application;
[0048] Figure 5 is a schematic diagram of the structure of an improved multi-head self-attention mechanism provided by another embodiment of the present application;
[0049] Figure 6 It is a schematic diagram of the question answering process based on the langchain-ChatGLM2 model provided by another embodiment of the present application. DETAILED DESCRIPTION
[0050] The following will refer to the attached Figures 1 to 6 The specific embodiments of the present application are described in detail. Although the specific embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0051] It should be noted that certain words are used in the specification and claims to refer to specific components. Those skilled in the art should understand that technicians may use different nouns to refer to the same component. This specification and claims do not use the difference in nouns as a way to distinguish components, but use the difference in the functions of the components as the criterion for distinction. As mentioned throughout the specification and claims, "including" or "comprising" is an open term, so it should be interpreted as "including but not limited to". The subsequent description of the specification is a preferred embodiment of the implementation of the present application, but the description is based on the general principles of the specification and is not used to limit the scope of the present application. The scope of protection of the present application shall be determined by the attached claims.
[0052] To facilitate understanding of the embodiments of the present application, further explanation will be given below using specific embodiments as examples in conjunction with the accompanying drawings, and the various drawings do not constitute a limitation on the embodiments of the present application.
[0053] In one embodiment, if Figure 1 As shown, the present application proposes a method for diagnosing pump equipment faults based on a knowledge graph, comprising the following steps:
[0054] S100: Build a pump equipment failure database;
[0055] S200: performing entity recognition on the fault data in the pump equipment fault database based on an entity recognition model to identify entities and their attributes;
[0056] S300: extracting the relationship between entities identified by the entity recognition model based on the entity relationship extraction model;
[0057] S400: Constructing a knowledge graph for fault diagnosis of pump equipment based on the entities and the relationships between the entities;
[0058] S500: Inputting the operation data of the machine pump equipment to be tested into the machine pump equipment fault diagnosis knowledge graph to implement fault diagnosis of the machine pump equipment to be tested.
[0059] In another embodiment, in step S200, the entity recognition model uses an M3E-BiLSTM-BiGRU-MultiHeadSelfAttention-CRF network, such as Figure 2 As shown, the M3E-BiLSTM-BiGRU-MultiHeadSelfAttention-CRF network includes a pre-trained open source Chinese embedding model M3E, a bidirectional long short-term memory network BiLSTM, a bidirectional gated recurrent network BiGRU, a multi-head self-attention mechanism MultiHeadSelfAttention and a conditional random field CRF.
[0060] Among them, the bidirectional long short-term memory network BiLSTM includes multiple horizontally connected forward LSTM layers (i.e. Figure 2 The first row of LSTM in the bidirectional long short-term memory network BiLSTM) and multiple horizontally connected reverse LSTM layers (i.e. Figure 2 The second row of LSTM in the bidirectional long short-term memory network BiLSTM in the figure), and the output of each forward LSTM layer and the output of the corresponding reverse LSTM layer are superimposed and input into the bidirectional gated recurrent network BiGRU (that is, the output of the first forward LSTM layer in the bidirectional long short-term memory network BiLSTM and the output of the first reverse LSTM layer are superimposed and input into the first forward GRU layer of the bidirectional gated recurrent network BiGRU, the output of the second forward LSTM layer in the bidirectional long short-term memory network BiLSTM and the output of the second reverse LSTM layer are superimposed and input into the second forward GRU layer of the bidirectional gated recurrent network BiGRU, and so on). Figure 2 As shown in the figure, assuming that the input fault text is "machine pump fault diagnosis", the fault text is encoded by M3E to generate a 6×768 vector (each word in the text is encoded by M3E to obtain a 1×768 vector, such as: machine (x11, x12, ..., x1n), pump (x21, x22, ..., x2n)..., the fault text includes 6 words, then after M3E encoding, 6 1×768 vectors are obtained, and after conversion, a 6×768 vector is generated). After the vector is input into the BiLSTM, it first passes through the forward LSTM layer and the word vector of "machine" is input into the first The forward LSTM layer obtains and returns a hidden sequence 1, and then inputs the hidden sequence 1 and the word vector of "pump" into the second forward LSTM layer to obtain and return a hidden sequence 2, inputs the hidden sequence 2 and the word vector of "cause" into the third forward LSTM layer to obtain and return a hidden sequence 3, inputs the hidden sequence 3 and the word vector of "disorder" into the fourth forward LSTM layer to obtain and return a hidden sequence 4, inputs the hidden sequence 4 and the word vector of "diagnosis" into the fifth forward LSTM layer to obtain and return a hidden sequence 5, and inputs the hidden sequence 5 and the word vector of "break" into the sixth forward LSTM layer to obtain a hidden sequence 6.
[0061] Then, the fault text is input in reverse, that is, the word vector of "broken" is input into the first reverse LSTM layer to obtain and return the hidden layer sequence 1. The hidden layer sequence 1 and the word vector of "diagnosis" are input into the second reverse LSTM layer, and so on, until the word vector of "machine" is input into the sixth reverse LSTM layer to obtain the hidden layer sequence 6.
[0062] The structure of BiGRU is similar to that of BiLSTM, including multiple forward GRU layers connected horizontally (i.e., Figure 2 the first row of GRU in the bidirectional gated recurrent network BiGRU) and multiple backward GRU layers connected horizontally (i.e., Figure 2 the second row of GRU in the bidirectional gated recurrent network BiGRU). The output of BiLSTM is used as the input of BiGRU. The processing flow is similar to that of BiLSTM. BiGRU also first passes through each forward GRU layer to obtain different hidden layer sequences, and then passes through each backward GRU layer to obtain different hidden layer sequences.
[0063] The output of BiGRU is used as the input of the multi-head self-attention mechanism MultiHeadSelfAttention. As Figure 4 shown, the multi-head self-attention mechanism includes an input sequence layer. The input sequence layer includes three outputs. Among them, the first output and the second output are jointly input into the first matmul function layer and the softmax function layer in sequence to obtain the fourth output. The third output and the fourth output are jointly input into the second matmul function layer to obtain the fifth output. The fifth output is input into the concatenation function layer concat for concatenation (there are multiple results for the fifth output because there are multiple outputs generated by multiple heads, so the fifth output needs to be concatenated) and input into the linear function layer Linear for linear transformation (that is, if the input sequence is X, after linear transformation: Q = XW Q , K = XW K , V = XW V , where W Q , W K , W V represent different mapping weight matrices).
[0064] After the output of BiGRU enters the multi-head self-attention mechanism MultiHeadSelfAttention, it first undergoes linear transformation to generate Q, K, and V (Q is the query, K is the key, and V is the value), and then is divided into multiple heads respectively (Q is divided into Q1, Q2,..Qh; K is divided into K1, K2,.., Kh; V is divided into V1....). Here, three outputs of the input sequence are obtained, namely the first output: Q1, Q2,..Q n 、the second output: K1, K2,.., K n、Third output: V1, V2, ..., V n The first and second outputs are input into the first matmul function layer together and then pass through the softmax activation function to obtain the fourth output (the fourth output is: , ,..., Then, the third output and the fourth output are input into the second matmul function layer to obtain the fifth output (the fifth output is: , ,..., , the fifth output is abbreviated as: Head1, Head2, ..., Head n ), the fifth output vector is concatenated through the concatenation function layer concat (concat(Head1,Head2,...,Head n )), and then undergoes a linear transformation through the linear function layer Linear (i.e., the fifth output × weight matrix) to obtain the final output S of the multi-head self-attention mechanism.
[0065] Among them, attention operations are performed on these heads of Q, K and V respectively:
[0066]
[0067] Among them, d k represents the dimension of the target vector Q and the context information vector K; i represents the i-th head and T represents transpose.
[0068] Get multiple outputs Head1, Head2 and Head n , concatenated into [Head1, Head2, Headn], and finally used as the output of the multi-head self-attention mechanism.
[0069] The above attention mechanism first calculates the similarity between the target vector Q and the context information vector K to obtain the attention weight ASM. The calculation formula is as follows:
[0070]
[0071] Among them, K T represents the transpose of K, d k Represents the dimension of the target vector Q and the context information vector K;
[0072] Furthermore, the original vector V is reconstructed according to the attention weight ASM to obtain a new vector. The calculation formula is as follows:
[0073]
[0074] Among them, Attention(Q,K,V) represents the reconstructed V vector.
[0075] The multi-head self-attention mechanism is used to obtain multiple features of the text and represent the dependencies between multiple characters. The trained weight matrix is used to map Q, K, and V k times, and the results representing different features are concatenated to obtain the final feature representation vector S of the character. The calculation formula of the multi-head attention is shown below:
[0076]
[0077]
[0078] Among them, i represents the i-th head, W i Q , W i K , W i V Represents query Q i , key K i Sum value V i The mapping matrix.
[0079] In this embodiment, by combining BiLSTM and BiGRU and utilizing the forward and backward information flows of the two, more powerful modeling capabilities can be provided, and the contextual dependencies of sequence data can be better captured and the information asymmetry problem can be alleviated. BiLSTM and BiGRU are variants of recurrent neural networks (RNNs), and both have forward and backward characteristics when processing sequence data. By concatenating or merging the hidden states of the two directions, BiLSTM and BiGRU can capture past and future contextual information at the same time.
[0080] The working mechanism of the combination of BiLSTM and BiGRU is as follows:
[0081] 1. Capturing contextual dependencies: Traditional unidirectional RNNs can only make predictions based on past information, while BiLSTM and BiGRU can more comprehensively capture dependencies in sequence data by considering both past and future contextual information. The forward part is responsible for the flow of information from the past to the present moment, while the backward part is responsible for the flow of information from the future to the present moment. In this way, the model can comprehensively consider the contextual information before and after at each moment, allowing the model to better understand the semantics and structure in the sequence.
[0082] 2. Reduction of information asymmetry problem: In some sequence data, the prediction of the current moment may depend on future information. The traditional unidirectional RNN is limited by information asymmetry when dealing with such situations because it can only use past information. By using a bidirectional structure, BiLSTM and BiGRU can solve this problem. The backward part is able to capture information of future moments, thus providing a more comprehensive context and reducing the information asymmetry problem.
[0083] 3. More powerful modeling capabilities: The bidirectional structure of BiLSTM and BiGRU enables the model to better learn the feature representation of sequence data. By splicing or merging the forward and backward hidden states, the model can fuse information from different directions and generate richer feature representations. This enables the model to better capture the complex relationships and patterns in sequence data and provide more powerful modeling capabilities.
[0084] In addition, by introducing the multi-head self-attention mechanism, the entity recognition model can focus on different positions and correlations in the input sequence. Through the parallel calculation of multi-head attention, the model can learn different attention representations on different subspaces. This means that different heads can independently learn and capture different semantic information, thereby improving the expressiveness and generalization ability of the model.
[0085] Furthermore, the introduction of the multi-head self-attention mechanism can also bring the following technical effects:
[0086] Multi-level information extraction: The multi-head self-attention mechanism allows the model to perform self-attention calculations on different attention heads. Each attention head can learn and focus on different contextual information, thereby capturing semantic relationships at different levels and granularities. In this way, the model can consider local details and global semantics at the same time, allowing the model to better understand the structure and importance of the input sequence.
[0087] Improve model stability and generalization ability: The multi-head self-attention mechanism helps improve the stability of the model, especially when processing long sequences. Traditional attention mechanisms may be affected by problems such as attention bottlenecks or gradient vanishing / exploding. By introducing the multi-head mechanism, the model can learn different attention patterns from different subspaces, alleviating the problem of attention bottlenecks, while also increasing the model's ability to model input sequences and improving generalization ability.
[0088] Solve the position bias problem: In the traditional attention mechanism, the attention calculation is based on the absolute position and is easily affected by the position bias. By introducing the multi-head self-attention mechanism, the model can learn the relationship between relative positions and alleviate the problem of position bias. Each attention head can learn different position relationships, thereby improving the model's ability to model the correlation between different positions in the input sequence.
[0089] In another embodiment, in step S200, the entity recognition model is trained by the following steps:
[0090] S201: Manually label the fault data in the machine pump equipment fault database to mark out the entity information in the fault data, wherein the entity includes machine pump components, fault type, fault cause and solution. Take a certain fault data "Multi-stage centrifugal pump group has excessive vibration due to rotor imbalance" as an example for labeling, and obtain the labeling result "B-Device M-Device M-Device M-Device E-Device OO B-Reason M-ReasonM-Reason M-Reason E-Reason OOO B-Bug M-Bug M-Bug E-Bug", wherein Device represents the device, Reason represents the reason, Bug represents the fault, E- is the word at the beginning of the entity, M- is the word in the middle of the entity, E- is the word at the end of the entity, and O is the rest of the content;
[0091] S202: dividing the fault data in the annotated machine pump equipment fault database into a training set and a validation set, and training the entity recognition model through the training set. During the training process, when the cross entropy loss function converges, the model training is completed;
[0092] In this step, the cross entropy loss function Loss(i) is expressed as follows:
[0093]
[0094] Among them, i represents the i-th sample, K represents the number of categories, and y ij represents the true label of sample i, p ij It represents the model's predicted probability that sample i belongs to category j.
[0095] When the data in the training set is input into the model, the model performs entity recognition on the data in the training set through the following steps:
[0096] S2021: Set training parameters, for example, set Epoch (training round) to 150, Batch Size (1 batch of 32 data) to 32, Learning Rate to 0.0001, and Dropout Prob (randomly set a certain proportion of neuron outputs of the neural network to 0 to prevent overfitting) to 0.5; the training set data is positionally encoded and input into the M3E pre-trained model to generate word vectors. The M3E pre-trained model has strong language understanding capabilities and can capture complex semantic relationships in fault data;
[0097] S2022: Input the word vector into BiLSTM to capture the contextual semantic information in the word vector;
[0098] S2023: further enhances semantic information through BiGRU;
[0099] S2024: Enhanced feature representation through Multi-Head Self-Attention;
[0100] S2025: Adding constraints to the predicted labels through CRF to ensure the accuracy of the predicted labels, wherein the constraints include:
[0101] The first word in a sentence always starts with the label "B-" and ends with "E-", and the middle content is always "M-"; the labels "B-label1 M-label2 M-label3 E-label4", label1, label2, label3, label4 belong to the same type of entity, for example, "B-Device M-Device M-Device E-Device" is a legal sequence, but "B-Device E-Reason" is an illegal label sequence.
[0102] S203: Verify the entity recognition model after each training through the validation set, and evaluate the model with the F1 score as the evaluation indicator. If the F1 score does not improve within a certain number of model training times (for example, the number is set to 5 times), the model verification is passed; otherwise, adjust the training parameters (for example, adjust the Epoch to 200, or adjust the Batch Size to 40) and re-train the model until the verification is passed.
[0103] For example, by using the trained model to perform entity recognition on the above-mentioned fault data "Multi-stage centrifugal pump group has excessive vibration due to rotor imbalance", the following entities can be obtained: {"equipment": "multi-stage centrifugal pump group", "fault": "excessive vibration", "cause": "rotor imbalance"}. Further, after the above extraction of the fault text, the entities shown in Table 1 can be obtained:
[0104] Table 1
[0105]
[0106] In this embodiment, by fusing M3E, BiLSTM, BiGRU, MultiHead SelfAttention and CRF to obtain the M3E-BiLSTM-BiGRU-MultiHeadSelfAttention-CRF network, significant results can be achieved in the fault data entity recognition task.
[0107] This application compares the training effects of the M3E-BiLSTM-BiGRU-MultiHeadSelfAttention-CRF network with classic networks such as LSTM-CRF, BiLSM, BiLSM-CRF and IDCNN-CRF on a certain data set. The comparison results are shown in Table 2:
[0108] Table 2
[0109]
[0110] As can be seen from Table 2, the scores of the three indicators of precision, recall and F1 score of the M3E-BiLSTM-BiGRU-MultiHeadSelfAttention-CRF network are better than those of other classic networks, indicating that the M3E-BiLSTM-BiGRU-MultiHeadSelfAttention-CRF network has better detection performance than other classic networks.
[0111] In another embodiment, if Figure 3 As shown, the entity relationship extraction model includes an input layer, an M3E layer, a bidirectional long short-term memory network BiLSTM, an improved multi-head self-attention mechanism, a linear layer and a SoftMax function layer.
[0112] The input of the model is 'entity 1', 'entity 2', 'the corresponding text of the paragraph where entity 1 and entity 2 are located', and the output is the relationship between entity 1 and entity 2.
[0113] For example, entity 1 is 'multi-stage centrifugal pump group', entity 2 is 'excessive vibration', and the corresponding text of the paragraph where entity 1 and entity 2 are located is 'the multi-stage centrifugal pump group has excessive vibration failure due to rotor imbalance'. Entity 1 and entity 2 and the corresponding text are simultaneously input into the entity relationship extraction model, and the following processing is performed:
[0114] 1. Entity 1, entity 2 and the corresponding text are encoded by M3E to generate word vectors, where each word generates a 1×768 vector through the M3E model. If entity 1, entity 2 and the corresponding text include 100 words, 100 1×768 vectors are generated after M3E encoding.
[0115] 2. The generated word vectors are enhanced by a bidirectional long short-term memory network (BiLSTM) to capture context semantic information and enhance the expressive ability.
[0116] The bidirectional long short-term memory network (BiLSTM) includes multiple horizontally connected forward LSTM layers (i.e., the first row of LSTM in the BiLSTM of Figure 3 the bidirectional long short-term memory network (BiLSTM)) and multiple horizontally connected backward LSTM layers (i.e., the second row of LSTM in the BiLSTM of Figure 3 the bidirectional long short-term memory network (BiLSTM)), and the output of each forward LSTM layer and the output of the corresponding backward LSTM layer are superimposed and then input into an improved multi-head self-attention mechanism.
[0117] Taking the four word vectors of "relation extraction" as an example, first, the word vector corresponding to '关' passes through the first forward LSTM layer to obtain and return a hidden layer sequence 1. Then, the hidden layer sequence 1 and the word vector of '系' are input into the second forward LSTM layer to obtain and return the hidden layer sequence 2. The hidden layer sequence 2 and the word vector of '抽' are input into the third forward LSTM layer to obtain and return the hidden layer sequence 3. The hidden layer sequence 3 and the word vector of '取' are input into the fourth forward LSTM layer to obtain and return the hidden layer sequence 4.
[0118] Then, the four word vectors are input in reverse, that is, the word vector of '取' is input into the first backward LSTM layer to obtain and return the hidden layer sequence 1. The hidden layer sequence 1 and the word vector of '抽' are input into the second backward LSTM layer, and so on, until the word vector of '关' is input into the fourth backward LSTM layer to obtain the hidden layer sequence 4.
[0119] 3. Through an improved multi-head self-attention mechanism.
[0120] This application improves the Figure 4 shown multi-head self-attention mechanism to obtain the improved multi-head self-attention mechanism shown in Figure 5 Specifically, the improved multi-head self-attention mechanism includes an input sequence layer. After the input sequence layer, there is a first matmul function layer. After the first matmul function layer, there are two branches. The first branch includes a softmax function layer, a second matmul function layer, a first concatenation layer (concat), and an average-taking layer (mean). The second branch includes a 3D convolutional layer (3Dconv) and an average pooling layer (AvgPool). The first branch and the second branch are jointly connected to a second concatenation layer (concat).
[0121] After the output of the BiLSTM network is input into the improved multi-head self-attention mechanism, it first undergoes a linear transformation to generate Q, K, and V (Q is the query, K is the key, and V is the value), and then divides the multi-heads (Q is divided into Q1, Q2, ..Q n ; K is divided into K1, K2, .., K n ; V is divided into V1, V2, ..., V n Here we get three outputs of the input sequence layer (the first output: Q1, Q2, ..Q n , Second output: K1, K2, .., K n 、Third output: V1, V2, ..., V n ), the first output and the second output are input into the first matmul function layer to obtain ASM (ASM1, ASM2, ..., ASM n ) Then the fourth output is obtained through softmax (the fourth output is: , ,..., Then the third output and the fourth output are input into the second matmul function layer to get the fifth output (the fifth output is: , ,..., Assume that the fifth output is abbreviated as: Head1, Head2, ..., Head n ), concatenate the fifth output vector ([Head1, Head2, ..., Head n ]), and then after a layer of linear transformation (i.e., the fifth output × weight matrix), the output S of the original multi-head self-attention mechanism is obtained.
[0122] After the first dimension of S is averaged by the Mean layer, the output S' of the first branch after the first matmul function layer is obtained. The second branch first converts the ASM (ASM1, ASM2, ..., ASM n ) are stacked to obtain Such a three-dimensional tensor T is used for feature extraction, and the output of the second branch C' is obtained by connecting the output of three layers (3D convolution, normalization, ReLU activation function, maximum pooling) and three-dimensional adaptive average pooling. S' and C' are concatenated to obtain the output of the improved multi-head self-attention mechanism.
[0123] The output of the improved multi-head self-attention mechanism is transformed by the linear layer and used as the input of the conditional random field CRF. After the constraint of the conditional random field CRF, the final most suitable output sequence is obtained. For example, assuming that the output of the improved multi-head self-attention mechanism is a 6×10 tensor (6 means the sentence is 6 characters long, and 10 is the number of categories labeled in the sequence), after the CRF output, a 6×1 tensor can be obtained.
[0124] Each head in the improved multi-head self-attention mechanism produces an attention score matrix:
[0125]
[0126] Stack these attention score matrices to get a 3D tensor T:
[0127]
[0128] Furthermore, the 3D tensor T is subjected to feature extraction through three layers of (3D convolution, normalization, ReLU activation function, maximum pooling), and the output is then subjected to 3D adaptive average pooling to obtain the final output C'. The output result is averaged with S ’ Improved attention input for splicing:
[0129]
[0130] By introducing an improved multi-head self-attention mechanism, the entity relationship extraction model is allowed to learn representations under different attention focuses. By mapping the input sequence to multiple attention heads, each head can focus on different semantic information. In this way, the model can simultaneously focus on different parts of the input sequence, thereby capturing richer features. In addition, the improved multi-head self-attention mechanism also converts the attention matrix [h1,h2,…,h n ]The features extracted by 3D convolution are used to enhance the text representation by directly concatenating with the attention output, so that it can focus not only on semantic information but also on interaction information.
[0131] Compared with the unimproved multi-head self-attention mechanism, the n attention matrices [h1,h2,…,h n ] for feature extraction, more feature interaction information can be obtained, and the semantic representation ability is improved. Compared with the case without the introduction of the multi-head self-attention mechanism: the improved multi-head self-attention mechanism has special effects in many aspects such as parallel computing, interactive information extraction, multi-level information extraction, improved stability and solving position bias, which improves the expression and generalization ability of the model, enabling the model to better capture the semantic relationship and importance in the input sequence.
[0132] 4. After the SoftMax function, the relationship category between entity 1 and entity 2 is obtained, that is, "failure occurs".
[0133] In another embodiment, the entity relationship extraction model is trained by the following steps:
[0134] S301: combining the entity information in the fault data annotated in step S201 and annotating the relationships to obtain an entity-relationship data set;
[0135] S302: Divide the entity-relationship dataset into a training set and a validation set;
[0136] S303: Setting training parameters, for example, setting the number of training times to 300 and the learning rate to 0.0001, training the entity relationship extraction model through the training set, and when the maximum number of training times is reached, the model training is completed;
[0137] S304: Verify the entity recognition model after each training through the validation set, and evaluate the model with the F1 score as the evaluation indicator. If the F1 score does not increase within a certain number of model training times, the model verification is passed; otherwise, adjust the training parameters (for example, the number of training times is adjusted to 350, and the learning rate is set to 0.001) and re-train the model until the verification is passed.
[0138] In another embodiment, in step S400, constructing a pump equipment fault diagnosis knowledge graph includes the following steps:
[0139] S401: extracting entities from fault data in a pump equipment fault database based on an entity recognition model, and extracting entities based on an entity relationship extraction model to obtain relationships between entities;
[0140] S402: Generate entity-relationship-entity triples according to entities and relationships between entities;
[0141] In this step, the entity-relationship-entity triplet can be exemplarily represented as:
[0142] (Multi-stage centrifugal pump set, failure, excessive vibration)
[0143] (Excessive vibration, cause, bearing damage)
[0144] (Bearing damage, solutions, bearing replacement)
[0145] S403: Construct a knowledge graph for fault diagnosis of pump equipment based on entity-relationship-entity triples.
[0146] In this step, take the ternary array (multi-stage centrifugal pump group, failure, excessive vibration) as an example, first create two entity nodes "multi-stage centrifugal pump group" and "excessive vibration", then link these two entity nodes, and the relationship between the two entity nodes is "failure". Finally, merge the same entity. If there are two ternary arrays ('excessive vibration', 'cause', 'bearing damage') and ('excessive vibration', 'cause', 'rotor imbalance'), creating entities and relationships will result in two links: 'excessive vibration'->'cause'->'bearing damage' and 'excessive vibration'->'cause'->'rotor imbalance'. It needs to be merged into 'rotor imbalance'-<'cause'-<'excessive vibration'->'cause'->'bearing damage'.
[0147] In another embodiment, the present application also provides a pump equipment fault diagnosis device based on a knowledge graph, comprising:
[0148] Acquisition module, used to build a pump equipment fault database;
[0149] An entity recognition module, used for performing entity recognition on the fault data in the pump equipment fault database based on an entity recognition model to identify entities and their attributes;
[0150] An entity relationship extraction module, used for extracting the relationship between entities identified by the entity recognition model based on the entity relationship extraction model;
[0151] A knowledge graph construction module is used to construct a knowledge graph for fault diagnosis of pump equipment based on the identified entities and the relationships between the extracted entities;
[0152] The fault diagnosis module is used to input the operating data of the machine pump equipment to be tested into the machine pump equipment fault diagnosis knowledge map to realize the fault diagnosis of the machine pump equipment to be tested.
[0153] In another embodiment, the present application also provides a system for fault diagnosis of pump equipment based on knowledge graph, including:
[0154] Problem input module, used to input user fault description;
[0155] The entity extraction module is used to extract entities and entity relationships from the fault description input by the user;
[0156] A query module, used to construct query statements based on the extracted entities and entity relationships to query the causes of faults and solutions in the knowledge graph of machine pump equipment fault diagnosis;
[0157] The answer output module is used to output the fault causes and solutions found.
[0158] This embodiment generates new instructions based on the content queried by the knowledge graph and the instruction template and inputs them into the ChatGLM2 model to answer the questions asked by the user. The specific process is as follows: Figure 6 As shown:
[0159] 1. Identify relevant fault entities in the fault description input by the user and extract the relationships between entities to obtain entities and entity relationships;
[0160] 2. Query the knowledge graph for troubleshooting causes and solutions through entities and entity relationships;
[0161] 3. Send the query solution to the fault question and answer instruction template to obtain the fault question and answer instruction;
[0162] 4. Send the fault question and answer command to the ChatGLM2 model to obtain the fault solution.
[0163] The present application also provides an electronic device, the electronic device comprising:
[0164] A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein:
[0165] When the processor executes the program, any of the above methods is implemented.
[0166] The present application also provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute any of the above methods.
[0167] The above embodiments are only for illustrating the technical concept and features of the present application, and their purpose is to enable people familiar with the technology to understand the content of the present application and implement it accordingly, and they cannot be used to limit the protection scope of the present application. Any equivalent changes or modifications made according to the spirit of the present application should be included in the protection scope of the present application.
Claims
1. A method for fault diagnosis of pump equipment based on knowledge graph, characterized in that: The method comprises the following steps: S100: Build a pump equipment failure database; S200: performing entity recognition on the fault data in the pump equipment fault database based on an entity recognition model to identify entities and their attributes; The entity recognition model includes a bidirectional long short-term memory network BiLSTM and a bidirectional gated recurrent network BiGRU, and the output of the bidirectional long short-term memory network BiLSTM is used as the input of the bidirectional gated recurrent network BiGRU; The entity recognition model is trained by the following steps: S201: manually marking the fault data in the pump equipment fault database to mark out entity information in the fault data; S202: dividing the fault data in the annotated machine pump equipment fault database into a training set and a validation set, setting training parameters, and training the entity recognition model through the training set. During the training process, when the cross entropy loss function converges, the model training is completed; S203: Verify the entity recognition model after each training through the verification set, and evaluate the model with the F1 score as the evaluation index. If the F1 score does not improve within a certain number of model training times, the model verification is passed; otherwise, adjust the training parameters to retrain the model until the verification is passed; S300: extracting the relationship between entities identified by the entity recognition model based on the entity relationship extraction model; The entity relationship extraction model introduces an improved multi-head self-attention mechanism, which additionally introduces a 3D convolution layer and an average pooling layer to enable the model to obtain more feature interaction information. The entity relationship extraction model is trained through the following steps: S301: combining entity information in the fault data annotated in step S201 and annotating relationships to obtain an entity-relationship data set; S302: Divide the entity-relationship dataset into a training set and a validation set; S303: Setting training parameters, training the entity relationship extraction model through the training set, and completing the model training when the maximum number of training times is reached; S304: Verify the entity recognition model after each training through the validation set, and evaluate the model with the F1 score as the evaluation index. If the F1 score does not improve within a certain number of model training times, the model verification is passed; otherwise, adjust the training parameters to retrain the model until the verification is passed; S400: constructing a knowledge graph for fault diagnosis of pump equipment based on the identified entities and the relationships between the extracted entities; The construction of the pump equipment fault diagnosis knowledge graph comprises the following steps: S401: performing entity recognition on the fault data in the pump equipment fault database based on the entity recognition model to identify entities; performing relationship extraction on the identified entities based on the entity relationship extraction model to obtain the relationship between the entities; S402: Generate entity-relationship-entity triples according to entities and relationships between entities; S403: constructing a knowledge graph for fault diagnosis of pump equipment according to entity-relationship-entity triples; S500: Inputting the operation data of the machine pump equipment to be tested into the machine pump equipment fault diagnosis knowledge graph to implement fault diagnosis of the machine pump equipment to be tested.
2. A machine pump equipment fault diagnosis device based on knowledge graph, characterized in that: The device is used to implement the method according to claim 1, comprising: Acquisition module, used to build a pump equipment fault database; An entity recognition module is used to perform entity recognition on the fault data in the pump equipment fault database based on an entity recognition model to identify entities and their attributes; wherein, the entity recognition model includes a bidirectional long short-term memory network BiLSTM and a bidirectional gated recurrent network BiGRU, and the output of the bidirectional long short-term memory network BiLSTM is used as the input of the bidirectional gated recurrent network BiGRU; An entity relationship extraction module, used for extracting the relationship between entities identified by the entity recognition model based on an entity relationship extraction model; wherein the entity relationship extraction model introduces an improved multi-head self-attention mechanism, and the improved multi-head self-attention mechanism additionally introduces a 3D convolution layer and an average pooling layer to enable the model to obtain more feature interaction information; A knowledge graph construction module is used to construct a knowledge graph for fault diagnosis of pump equipment based on the identified entities and the relationships between the extracted entities; The fault diagnosis module is used to input the operating data of the machine pump equipment to be tested into the machine pump equipment fault diagnosis knowledge map to realize the fault diagnosis of the machine pump equipment to be tested.
3. An electronic device, characterized in that: The electronic device comprises: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to claim 1 is implemented.
4. A computer storage medium, characterized in that: The computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the method of claim 1.
Citation Information
Patent Citations
Machine pump superposition fault detection method and system based on knowledge graph
CN114897056A
Drilling pump motor state online monitoring method based on LSTM neural network
CN116680607A