Knowledge graph and text fused railway equipment fault diagnosis method and system
By fusing knowledge graphs and text, and using BERT and BiLSTM models to extract semantic features of railway equipment fault descriptions, this approach solves the semantic understanding and scalability problems of railway traffic equipment fault diagnosis in existing technologies, achieving efficient, accurate, and interpretable fault diagnosis.
Patent Information
- Application Number
- CN202511780869.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-03-24
AI Technical Summary
Existing fault diagnosis methods for railway operating equipment rely on human experience and rule bases, which make it difficult to handle complex and diverse fault descriptions, lack semantic understanding capabilities, and fail to effectively integrate textual information with professional knowledge, resulting in missed diagnoses, misdiagnoses, and poor scalability.
By employing a knowledge graph and text fusion approach, semantic features of the text are extracted using BERT and BiLSTM models, and entity embedding fusion is performed using a multi-head attention mechanism and the TransH algorithm to achieve intelligent diagnosis of railway equipment faults.
It significantly improves the accuracy and interpretability of fault diagnosis for railway operating equipment. The system can return diagnostic results within 2.3 seconds with an accuracy of no less than 85%, and has wide applicability and scalability.
Smart Images

Figure CN121723294A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of railway transportation and intelligent diagnostic technology; specifically, it relates to a railway equipment fault diagnosis method and system that integrates knowledge graphs and text. Background Technology
[0002] The reliability and safety of railway operating equipment are crucial to ensuring the efficiency and safe operation of railway transportation. Existing fault diagnosis methods mainly rely on human experience or rule-based fault diagnosis systems. Rule-based fault diagnosis systems typically depend on fixed rule bases developed by human experts. These rules are often expressed in the form of "IF-THEN," such as: "If 'motor does not turn' and 'control cabinet has no output,' then it is judged as a 'motor control circuit fault.'" These rule bases are mainly built based on existing fault manuals, expert experience, and historical cases, and their knowledge update cycle is long and their structure is rigid.
[0003] However, fault descriptions of railway operating equipment are often unstructured, semantically complex, and diverse in expression, making it difficult for pure rule-based fault diagnosis systems to handle such complex and diverse fault descriptions. This results in significant limitations of pure rule-based systems in the following aspects:
[0004] (1) Existing rule matching relies on strict keywords or patterns. Most rules rely on fixed keywords, rule templates, or manually set feature triggering conditions. For example, a rule may require certain precise words to appear in the description (such as "relay stuck" or "poor contact"), while the actual text may contain expressions such as "relay malfunctions occasionally" or "suspected loose contacts." These semantically similar but different descriptions often cannot be effectively matched by the rule, leading to missed diagnoses or misdiagnoses.
[0005] (2) Pure rules are difficult to handle combinations of multiple factors or implicit relationships. Railway equipment failures often have multi-cause coupling characteristics, such as simultaneous involvement of component aging, environmental factors, and operating processes. Pure rule-based systems struggle to capture implicit logical dependencies across sentences and concepts, and cannot identify relational chains in complex semantics, such as: "slow braking → train coasting → suspected insufficient air supply → possibly related to intermittent air compressor failure". Traditional rule bases are difficult to cover such multi-hop logical chains.
[0006] (3) Pure rules cannot understand contextual semantics and implicit knowledge. Some important clues in the text are not directly expressed, but are implied through the context. For example: "After hearing an abnormal metallic friction sound, the train's acceleration fluctuated." These implicit semantics require joint reasoning of professional knowledge and natural language context, while existing pure rule systems can usually only handle surface patterns and lack semantic understanding capabilities.
[0007] (4) Rules are difficult to maintain and expand comprehensively. There are many types of railway operation equipment and complex scenarios. The failure modes vary greatly depending on the line and the season. Maintaining a comprehensive rule base requires a lot of manual input, and the rules are prone to contradictions. As business scenarios change, rules need to be updated frequently, but traditional systems have poor scalability and it is difficult to quickly introduce new failure modes.
[0008] In recent years, with the development of natural language processing and machine learning technologies, text-based intelligent fault diagnosis methods have gradually emerged. However, these methods generally suffer from the following drawbacks:
[0009] (1) The lack of structured expression of domain knowledge leads to insufficient interpretability of diagnostic results;
[0010] (2) The model has poor scalability across different devices or scenarios;
[0011] (3) It is difficult to effectively integrate text information with the professional knowledge base of railway equipment, thus limiting the accuracy and practicality of fault identification. Summary of the Invention
[0012] Therefore, the purpose of this invention is to propose a railway equipment fault diagnosis method and system that integrates knowledge graphs and text. It develops an intelligent diagnostic model that integrates domain knowledge and natural language semantic information. By introducing a knowledge graph, it achieves interpretability and knowledge reusability in the railway equipment fault diagnosis process. Employing multi-source information fusion and attention mechanisms significantly improves the accuracy of railway equipment fault diagnosis. The intelligent diagnostic model can be integrated into a networked diagnostic system and directly applied to actual operating scenarios, demonstrating wide applicability. The system can adapt to diagnostic tasks for different types of railway equipment, improving the scalability of railway equipment fault diagnosis.
[0013] This invention provides a railway equipment fault diagnosis method that integrates knowledge graphs and text, comprising the following steps:
[0014] S1. Receive natural language fault descriptions input by railway maintenance personnel, parse the natural language fault descriptions into fault phenomenon text, and perform text cleaning, word segmentation, noise reduction, word form restoration, entity recognition and standardization preprocessing to obtain a text sequence;
[0015] S2. Input the text sequence into the pre-trained language model BERT, extract the contextual semantic feature vector of each word in the text, input the contextual semantic feature vector into the bidirectional long short-term memory network BiLSTM, capture the contextual dependency and time series features, and generate a sequence feature vector with fused semantics.
[0016] Specifically, the BERT model is an equivalent semantic encoding model such as BERT-Base, RoBERTa, or ERNIE. In this embodiment of the invention, the BERT model outputs a sequence-level semantic representation matrix:
[0017] ;
[0018] in, This represents the contextual semantic feature vector of the i-th word.
[0019] BiLSTM networks utilize their bidirectional structure to capture contextual dependencies and time-series features, generating context vector representations that fuse semantics.
[0020] ;
[0021] The hidden layer dimension (number of hidden units) of the BiLSTM network used to capture forward and backward dependency information of text sequences is set to 128 to 512, which can be adjusted according to the data scale and computing resources.
[0022] S3. Construct a knowledge graph containing entities and relationships of equipment components, fault types, causes, and handling measures based on knowledge of railway equipment domain, and enhance the sequence features with structured knowledge; retrieve relevant entity and relationship information from the knowledge graph, fuse text semantic features with entities and relationships of the knowledge graph through token-level embedding, use BiLSTM to model the sequence relationships of the fused features, use a multi-head attention mechanism to calculate the importance weight of each feature in the fused semantic features, obtain a weighted global semantic vector, perform Softmax function classification on the weighted semantic vector, and output fault category labels and their confidence scores;
[0023] Specifically, the knowledge graph includes entities such as railway equipment, components, fault phenomena, causes, and maintenance measures, and generates knowledge embeddings through the TransH algorithm; token-level fusion adopts a weighted strategy that combines linear transformation functions with attention weights to achieve deep fusion of knowledge embeddings and text semantics.
[0024] Multi-head attention mechanisms are used to compute importance weights for different semantic subspaces in parallel.
[0025] S4. Output the corresponding diagnostic results, possible causes, and recommended maintenance measures according to the fault category. Display the diagnostic results in a visual image interface and provide explanation paths for relevant knowledge nodes to achieve interpretable intelligent diagnosis.
[0026] Specifically, the output fault categories include category number, standard fault phenomenon and recommended handling measures, and the optimal result is selected based on the confidence threshold.
[0027] In this embodiment of the invention, the diagnostic result is returned within 2.3 seconds, and the diagnostic accuracy is not less than 85%. When the knowledge graph has a noise ratio of 5%, the diagnostic performance decreases by no more than 0.02 Macro F1 value.
[0028] Furthermore, the method for performing Softmax function classification on the weighted semantic representation in step S3 includes:
[0029] The fused joint semantic feature vector The input is fed into the classification layer of the BiLSTM; where, This represents the fused joint semantic feature vector; d is the dimension of the input feature vector. It is a global semantic representation obtained by fusing text semantic features with knowledge graph entity relationships and multi-head attention weighting; the classification layer of BiLSTM refers to the fully connected classification layer set after the BiLSTM network, which is used to map the input feature vector to the fault category space;
[0030] The unnormalized score for each fault type i is calculated using a linear transformation. :
[0031] ;
[0032] in, and These are the parameters used for model training. Let represent the trainable weight matrix corresponding to the i-th fault category, used to map vector c to the category score space; Let represent the bias term corresponding to the i-th type of fault, which is a trainable parameter;
[0033] right Perform Softmax normalization:
[0034] ;;
[0035] in, Indicates that the sample belongs to the first The unnormalized score (logit) of the fault class is obtained by linear transformation;
[0036] This represents the probability that the model determines an input sample belongs to the nth type of fault, satisfying the following condition: , 𝐾 represents the total number of fault types;
[0037] The fault category corresponding to the highest probability is used as the diagnostic result, and this highest probability is used as the diagnostic result. As a confidence level for fault diagnosis:
[0038] ;
[0039] in, To determine the probability that an input sample belongs to the k-th type of fault for the model.
[0040] Preferably, to facilitate reliability assessment by maintenance personnel, the confidence level can be divided into the following confidence level intervals:
[0041] High confidence level (≥0.85): The model's judgment is relatively reliable;
[0042] Medium confidence level (0.60–0.85): It is recommended to confirm this information in conjunction with the knowledge graph explanation.
[0043] Low confidence level (<0.60): Manual review or additional description is recommended.
[0044] This invention uses the Softmax function to output a probability value for each type of fault, and uses the probability value as the confidence level for fault prediction. The calculation method of this confidence level is clear and reproducible, and it is suitable for production-level diagnostic systems.
[0045] Furthermore, the method for token-level embedding and fusion of text semantic features and knowledge graph entities in step S3 includes:
[0046] The TransH algorithm is used to embed entities and relations in the knowledge graph, resulting in a knowledge embedding matrix: It consists of vector representations of all entities and relations; where, This represents the total number of entities and relations in the knowledge graph; Represents the first in a knowledge graph An entity or relationship The 3D embedding vector is obtained through TransH training. An embedding vector is an embedding vector for a specific entity (such as "train braking system") or relation (such as "belongs to component") in a knowledge graph. It is a semantic representation of the entity or relation and is used to fuse with text semantics. It provides structured semantic information for entities such as equipment parts, fault types, and causes appearing in the text, enabling the model to utilize prior relationships and engineering semantics provided by the knowledge graph during fusion.
[0047] By employing a token-level fusion strategy, each word vector is weighted and fused with its corresponding knowledge entity embedding vector to obtain the fused representation:
[0048] ;
[0049] Where f is the fusion function of linear transformation and attention weight.
[0050] Furthermore, the method for calculating the importance weights of each feature in the fused semantic features in step S3 to obtain the weighted global semantic vector includes:
[0051] Based on contextual importance, key fault description terms (such as "power outage" and "signal loss") are highlighted, redundant information is suppressed, and a global context vector is generated.
[0052] ;
[0053] in, , These are the attention weights, obtained by normalizing the attention scores at all positions using the softmax function; It is the global context vector, which contains all feature vectors. With its attention weight It is a weighted sum of coefficients.
[0054] Furthermore, the method for outputting the fault category label and its confidence level in step S3 includes:
[0055] The weighted global semantic vector is input into the classification layer of the BiLSTM to determine the fault type. The Softmax classifier uses the Softmax function to output the probability distribution of each fault type.
[0056] ;
[0057] Where W and b are the trainable parameter matrix and the bias term, respectively. To output the probability distribution, each element Confidence level corresponding to the fault category (e.g., G1-G16);
[0058] Output the most likely fault category label (e.g., G1 to G16) and its confidence level.
[0059] Preferably, the classification threshold can be set between 0.6 and 0.9 to balance recall and precision.
[0060] Preferably, the Softmax classifier outputs a Top-N candidate fault list for manual review.
[0061] This invention also provides a railway equipment fault diagnosis system that integrates knowledge graphs and text, used to execute the railway equipment fault diagnosis method that integrates knowledge graphs and text as described above, including:
[0062] Text input and preprocessing module: used to receive natural language fault descriptions input by railway maintenance personnel, parse the natural language fault descriptions into fault phenomenon text, and perform text cleaning, word segmentation, noise reduction, word form restoration, entity recognition and standardization preprocessing to obtain a text sequence;
[0063] Semantic analysis module: used to input the text sequence into the pre-trained language model BERT, extract the contextual semantic feature vector of each word in the text, input the contextual semantic feature vector into the bidirectional long short-term memory network BiLSTM, capture contextual dependencies and time series features, and generate a sequence feature vector with fused semantics;
[0064] The knowledge fusion module is used to construct a knowledge graph containing entities and relationships of equipment components, fault types, causes, and handling measures based on knowledge in the railway equipment field, and to perform structured knowledge enhancement on sequence features. It retrieves relevant entity and relationship information from the knowledge graph, performs token-level embedding fusion of text semantic features with entities and relationships in the knowledge graph, uses BiLSTM to model sequence relationships of the fused features, uses a multi-head attention mechanism to calculate the importance weights of each feature in the fused semantic features, obtains a weighted global semantic vector, performs Softmax function classification on the weighted semantic vector, and outputs fault category labels and their confidence scores.
[0065] The results output and display module is used to output the corresponding diagnostic results, possible causes, and recommended maintenance measures according to the fault category, and to display the diagnostic results in a visual image interface, providing an explanation path for relevant knowledge nodes.
[0066] Furthermore, the knowledge fusion module includes:
[0067] Classification and reasoning unit: used to classify the fused joint semantic feature vector The input is fed into the classification layer of the BiLSTM, where, This represents the fused joint semantic feature vector; d is the dimension of the input feature vector. It is a global semantic representation obtained by fusing text semantic features with knowledge graph entity relationships and weighting with multi-head attention; through linear transformation, the unnormalized score of each fault type i is calculated. : ;in, and These are the parameters used for model training. Let represent the trainable weight matrix corresponding to the i-th fault category, used to map vector c to the category score space; The bias term corresponding to the i-th type of fault is a trainable parameter; for Perform Softmax normalization: ;in, Indicates that the sample belongs to the first The unnormalized score (logit) of the fault class is obtained by linear transformation; Let represent the probability that the model determines the input sample belongs to the nth type of fault, and let represent the total number of fault types. The fault category corresponding to the highest probability is taken as the diagnostic result, and this highest probability is... As a confidence level for fault diagnosis: ;in, To determine the probability that an input sample belongs to the k-th type of fault for the model.
[0068] Furthermore, the knowledge fusion module also includes:
[0069] Attention computation unit: used to highlight key fault description words based on contextual importance, suppress redundant information, and generate a global context vector. ;in, , These are the attention weights, obtained by normalizing the attention scores at all positions using the softmax function; It is the global context vector, which contains all feature vectors. With its attention weight It is a weighted sum of coefficients.
[0070] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the steps of the railway equipment fault diagnosis method that integrates knowledge graphs and text as described above.
[0071] The present invention also provides a computer device, the computer device including a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements the steps of the railway equipment fault diagnosis method of knowledge graph and text fusion as described above.
[0072] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0073] This invention provides a railway equipment fault diagnosis method and system that integrates knowledge graphs and text. By developing an intelligent diagnostic model that fuses domain knowledge with natural language semantic information and introducing a knowledge graph, the system achieves interpretability and knowledge reusability in the railway equipment fault diagnosis process. Employing multi-source information fusion and attention mechanisms significantly improves the accuracy of railway equipment fault diagnosis. The system is adaptable to diagnostic tasks of different types of railway equipment, enhancing the scalability of fault diagnosis. Actual test results show that the method returns diagnostic results within 2.3 seconds with an accuracy of no less than 85%. On a real railway bureau dataset, the Macro-F1 score is improved by approximately 16.44 percentage points. Even with 5% noise in the knowledge graph, the diagnostic performance decreases by no more than 0.02 Macro-F1 scores. This intelligent diagnostic model has been integrated into a networked diagnostic system and can be directly applied to actual operating scenarios, demonstrating good applicability and broad application prospects. Attached Figure Description
[0074] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention.
[0075] In the attached diagram:
[0076] Figure 1 , Figure 2 This is a schematic diagram of the overall architecture of the railway equipment fault diagnosis system that integrates knowledge graphs and text according to an embodiment of the present invention;
[0077] Figure 3 This is a flowchart of the knowledge graph construction process according to an embodiment of the present invention;
[0078] Figure 4 This is a schematic diagram of entities and relationships in a knowledge graph according to an embodiment of the present invention;
[0079] Figure 5 This is a structural diagram of the text-knowledge fusion model according to an embodiment of the present invention;
[0080] Figure 6 This is a schematic diagram of the classification output layer architecture of BiLSTM according to an embodiment of the present invention;
[0081] Figure 7 This is a schematic diagram of the fault diagnosis process according to an embodiment of the present invention;
[0082] Figure 8 This is a schematic diagram of the configuration of a computer device according to an embodiment of the present invention. Detailed Implementation
[0083] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and products consistent with some aspects of this disclosure as detailed in the appended claims.
[0084] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0085] It should be understood that although the terms first, second, third, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, without departing from the scope of this disclosure, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0086] The embodiments of the present invention will be described in further detail below.
[0087] This invention provides a method for diagnosing railway equipment faults by fusing knowledge graphs and text, comprising the following steps:
[0088] S1. Receive natural language fault descriptions input by railway maintenance personnel, parse the natural language fault descriptions into fault phenomenon text, and perform text cleaning, word segmentation, noise reduction, word form restoration, entity recognition and standardization preprocessing to obtain a text sequence;
[0089] S2. Input the text sequence into the pre-trained language model BERT, extract the contextual semantic feature vector of each word in the text, input the contextual semantic feature vector into the bidirectional long short-term memory network BiLSTM, capture the contextual dependency and time series features, and generate a sequence feature vector with fused semantics.
[0090] The BERT model outputs a sequence-level semantic representation matrix:
[0091] ;
[0092] in, This represents the contextual semantic feature vector of the i-th word.
[0093] BiLSTM networks utilize their bidirectional structure to capture contextual dependencies and time-series features, generating context vector representations that fuse semantics.
[0094]
[0095] The hidden layer dimension (number of hidden units) of the BiLSTM network is set to 256 to capture forward and backward dependency information of the text sequence.
[0096] S3. Construct a knowledge graph based on railway equipment domain knowledge, including entities and relationships related to equipment components, fault types, causes, and handling measures (e.g., ...). Figure 3 , Figure 4 As shown), structured knowledge enhancement is performed on sequence features; relevant entity and relation information is retrieved from the knowledge graph, and the text semantic features are fused with the entities and relations of the knowledge graph through token-level embedding. BiLSTM is then used to model the sequence relations of the fused features (e.g., ...). Figure 5 As shown, the importance weights of each feature in the fused semantic features are calculated using a multi-head attention mechanism to obtain a weighted global semantic vector. The Softmax function is then applied to the weighted semantic vector for classification, and the fault category label and its confidence level are output.
[0097] A multi-head attention mechanism is used to compute importance weights for different semantic subspaces in parallel. The knowledge graph includes entities such as railway equipment, components, fault phenomena, causes, and maintenance measures, and knowledge embeddings are generated using the TransH algorithm. Token-level fusion employs a weighted strategy combining linear transformation functions and attention weights to achieve deep fusion of knowledge embeddings and textual semantics.
[0098] In this embodiment, the "fault category" is defined according to the Chinese railway operating equipment fault classification standard, including the following 16 types:
[0099] (1) G1 locomotive malfunction.
[0100] (2) G2 vehicle malfunction.
[0101] (3) G3 EMU malfunction.
[0102] (4) G4 railway ferry equipment malfunction.
[0103] (5) G5 self-propelled special equipment malfunction.
[0104] (6) G6 line, bridge and tunnel equipment failure.
[0105] (7) G7 signal equipment failure.
[0106] (8) G8 communication equipment failure.
[0107] (9) G9 power supply equipment failure.
[0108] (10) G10 water supply equipment malfunction.
[0109] (11) G11 information system equipment failure.
[0110] (12) G12 train tail device malfunction.
[0111] (13) G13 monitoring and surveillance equipment failure.
[0112] (14) The safety protection equipment and facilities of G14 line are damaged.
[0113] (15) G15 water damage, landslides, rockfalls, fallen trees.
[0114] (16) Other equipment failures in G16.
[0115] Methods for classifying weighted semantic representations using the Softmax function include:
[0116] The fused joint semantic feature vector The input is fed into the classification layer of the BiLSTM; where, This represents the fused joint semantic feature vector; d is the dimension of the input feature vector. It is a global semantic representation obtained by fusing text semantic features with knowledge graph entity relationships and multi-head attention weighting;
[0117] The unnormalized score for each fault type i is calculated using a linear transformation. :
[0118] ;
[0119] in, and These are the parameters used for model training.
[0120] right Perform Softmax normalization:
[0121] ;
[0122] in, Indicates that the sample belongs to the first The unnormalized score (logit) of the fault class is obtained by linear transformation;
[0123] This represents the probability that the model determines the input sample to belong to the nth type of fault, and 𝐾 represents the total number of fault types;
[0124] The fault category corresponding to the highest probability is used as the diagnostic result, and this highest probability is used as the diagnostic result. As a confidence level for fault diagnosis:
[0125] ;
[0126] in, To determine the probability that an input sample belongs to the k-th type of fault for the model.
[0127] The confidence level is divided into the following confidence level intervals to facilitate the assessment of reliability by operations and maintenance personnel:
[0128] High confidence level (≥0.85): The model's judgment is relatively reliable;
[0129] Medium confidence level (0.60–0.85): It is recommended to confirm this information in conjunction with the knowledge graph explanation.
[0130] Low confidence level (<0.60): Manual review or additional description is recommended.
[0131] The Softmax function is used to output a probability value for each type of fault, and the probability value is used as the confidence level for fault prediction. The calculation method of the confidence level is clear and reproducible, and it is suitable for production-level diagnostic systems.
[0132] Methods for token-level embedding and fusion of text semantic features and knowledge graph entities include:
[0133] The TransH algorithm is used to embed entities and relations in the knowledge graph, resulting in a knowledge embedding matrix: It consists of vector representations of all entities and relations; where, This represents the total number of entities and relations in the knowledge graph; Represents the first in a knowledge graph An entity or relationship The 3D embedding vector is obtained through TransH training. It provides structured semantic information for entities such as equipment parts, fault types, and causes appearing in the text, enabling the model to utilize prior relationships and engineering semantics provided by the knowledge graph during fusion.
[0134] By employing a token-level fusion strategy, each word vector is weighted and fused with its corresponding knowledge entity embedding vector to obtain the fused representation:
[0135] ;
[0136] Where f is the fusion function of linear transformation and attention weight.
[0137] Methods for calculating the importance weights of each feature in the fused semantic features to obtain the weighted global semantic vector include:
[0138] Based on contextual importance, key fault description terms ("power outage", "signal loss", etc.) are highlighted, redundant information is suppressed, and a global context vector is generated.
[0139] ;
[0140] in, , These are the attention weights, obtained by normalizing the attention scores at all positions using the softmax function; It is the global context vector, which contains all feature vectors. With its attention weight It is a weighted sum of coefficients.
[0141] Methods for outputting fault category labels and their confidence scores include:
[0142] The weighted global semantic vector is input into the classification layer of the BiLSTM to determine the fault type. The Softmax classifier uses the Softmax function to output the probability distribution of each fault type.
[0143] ;
[0144] Where W and b are the trainable parameter matrix and the bias term, respectively. To output the probability distribution, each element Confidence level for the corresponding fault categories (G1-G16);
[0145] Output the most likely fault category labels (G1~G16) and their confidence scores. Set the classification threshold between 0.6 and 0.9 to balance recall and precision.
[0146] Figure 6 The classification output layer architecture of BiLSTM in this embodiment is shown.
[0147] S4. Output the corresponding diagnostic results, possible causes, and recommended maintenance measures according to the fault category. Display the diagnostic results in a visual image interface and provide an explanation path for relevant knowledge nodes.
[0148] This embodiment displays diagnostic results and maintenance suggestions via a web graphical user interface, or returns them to the operation and maintenance management system in JSON format. The output fault category includes the category number, standard fault symptoms, and recommended handling measures, and the optimal result is filtered based on a confidence threshold.
[0149] Figure 7The fault diagnosis process of this embodiment is illustrated. In this embodiment, the diagnosis result is returned within 2.3 seconds, and the diagnosis accuracy is not less than 85%. When there is a 5% noise ratio in the knowledge graph, the diagnostic performance decreases by no more than 0.02 Macro F1 value.
[0150] This invention also provides a railway equipment fault diagnosis system that integrates knowledge graphs and text, used to execute the railway equipment fault diagnosis method that integrates knowledge graphs and text as described above, including:
[0151] Text input and preprocessing module: used to receive natural language fault descriptions input by railway maintenance personnel, parse the natural language fault descriptions into fault phenomenon text, and perform text cleaning, word segmentation, noise reduction, word form restoration, entity recognition and standardization preprocessing to obtain a text sequence;
[0152] Semantic analysis module: used to input the text sequence into the pre-trained language model BERT, extract the contextual semantic feature vector of each word in the text, input the contextual semantic feature vector into the bidirectional long short-term memory network BiLSTM, capture contextual dependencies and time series features, and generate a sequence feature vector with fused semantics;
[0153] The knowledge fusion module is used to construct a knowledge graph containing entities and relationships of equipment components, fault types, causes, and handling measures based on knowledge in the railway equipment domain. It performs structured knowledge enhancement on sequence features; retrieves relevant entity and relationship information from the knowledge graph; fuses textual semantic features with the entities and relationships in the knowledge graph through token-level embedding; models sequence relationships using BiLSTM on the fused features; calculates the importance weights of each feature in the fused semantic features using a multi-head attention mechanism to obtain a weighted global semantic vector; performs Softmax function classification on the weighted semantic vector; and outputs fault category labels and their confidence scores. The knowledge fusion module includes:
[0154] Attention computation unit: used to highlight key fault description words based on contextual importance, suppress redundant information, and generate a global context vector. ;in, , These are the attention weights, obtained by normalizing the attention scores at all positions using the softmax function; It is the global context vector, which contains all feature vectors. With its attention weight This is a weighted sum of coefficients;
[0155] Classification and reasoning unit: used to classify the fused joint semantic feature vector The input is fed into the classification layer of the BiLSTM, where, This represents the fused joint semantic feature vector; d is the dimension of the input feature vector. It is a global semantic representation obtained by fusing text semantic features with knowledge graph entity relationships and weighting with multi-head attention; through linear transformation, the unnormalized score of each fault type i is calculated. : ;in, and These are the parameters used for model training. Let represent the trainable weight matrix corresponding to the i-th fault category, used to map vector c to the category score space; The bias term corresponding to the i-th type of fault is a trainable parameter; for Perform Softmax normalization: ;in, Indicates that the sample belongs to the first The unnormalized score (logit) of the fault class is obtained by linear transformation; Let represent the probability that the model determines the input sample belongs to the nth type of fault, and let represent the total number of fault types. The fault category corresponding to the highest probability is taken as the diagnostic result, and this highest probability is... As a confidence level for fault diagnosis: ;in, To determine the probability that an input sample belongs to the k-th type of fault for the model;
[0156] The results output and display module is used to output the corresponding diagnostic results, possible causes, and recommended maintenance measures according to the fault category, and to display the diagnostic results in a visual image interface, providing an explanation path for relevant knowledge nodes.
[0157] Figure 1 , Figure 2 The overall architecture of the railway equipment fault diagnosis system that integrates knowledge graphs and text is shown in this embodiment.
[0158] This embodiment of the railway equipment fault diagnosis method and system that integrates knowledge graph and text fusion combines BERT semantic model and BiLSTM sequence modeling, effectively integrating natural language text information with structured knowledge graph. It achieves knowledge graph embedding and fusion at the token level, introduces an attention mechanism, and enhances the interpretability of the diagnosis process. It has strong noise resistance and real-time diagnostic capabilities, enabling high-precision automatic identification and cause analysis of railway operation equipment faults.
[0159] This invention also provides a computer device. Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention; see the accompanying drawings. Figure 8As shown, the computer device includes: an input device 23, an output device 24, a memory 22, and a processor 21; the memory 22 is used to store one or more programs; when the one or more programs are executed by the one or more processors 21, the one or more processors 21 implement the railway equipment fault diagnosis method based on knowledge graph and text fusion as provided in the above embodiments; wherein the input device 23, the output device 24, the memory 22, and the processor 21 can be connected via a bus or other means. Figure 8 Taking the example of a connection between China and Israel via a bus.
[0160] The memory 22, as a read / write storage medium for computing devices, can be used to store software programs and computer-executable programs, such as the program instructions corresponding to the railway equipment fault diagnosis method that fuses knowledge graphs and text as described in this embodiment of the invention. The memory 22 may mainly include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the device. Furthermore, the memory 22 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 22 may further include memory remotely located relative to the processor 21, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0161] Input device 23 can be used to receive input digital or character information, and generate key signal inputs related to user settings and function control of the device; output device 24 may include display devices such as a display screen.
[0162] The processor 21 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 22, thereby realizing the above-mentioned railway equipment fault diagnosis method that integrates knowledge graph and text.
[0163] The computer equipment provided above can be used to execute the railway equipment fault diagnosis method that integrates knowledge graphs and text provided in the above embodiments, and has corresponding functions and beneficial effects.
[0164] This invention also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the railway equipment fault diagnosis method based on knowledge graph and text fusion as provided in the above embodiments. The storage medium can be any type of memory device or storage device, including: mounting media such as CD-ROM, floppy disk, or magnetic tape; computer system memory or random access memory such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements; the storage medium may also include other types of memory or combinations thereof; furthermore, the storage medium may reside in a first computer system in which the program is executed, or it may reside in a different second computer system connected to the first computer system via a network (such as the Internet); the second computer system can provide program instructions to the first computer for execution. The storage medium includes two or more storage media that can reside in different locations (e.g., in different computer systems connected via a network). The storage medium can store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.
[0165] Of course, the computer-executable instructions provided in the embodiments of the present invention are not limited to the railway equipment fault diagnosis method of knowledge graph and text fusion as described in the above embodiments, but can also perform related operations in the railway equipment fault diagnosis method of knowledge graph and text fusion provided in any embodiment of the present invention.
[0166] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.
[0167] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A railway equipment fault diagnosis method based on knowledge graph and text fusion, characterized in that, The method comprises the following steps: S1, receiving a natural language fault description input by a railway maintenance personnel, analyzing the natural language fault description into a fault phenomenon text, performing cleaning, word segmentation, denoising, morphological restoration, entity recognition and standardization preprocessing on the text to obtain a text sequence; S2, inputting the text sequence into a pre-trained language model BERT, extracting a context semantic feature vector of each word in the text, inputting the context semantic feature vector into a bidirectional long short-term memory network BiLSTM, capturing context dependency and time sequence features to generate a sequence feature vector fused with semantics; S3, constructing a knowledge graph containing entities and relationships of device components, fault types, causes and treatment measures based on the knowledge of the railway equipment field, structurally enhancing the sequence features; retrieving related entity and relationship information from the knowledge graph, performing token-level embedding fusion of the text semantic features and the entities and relationships of the knowledge graph, modeling the fused features by using BiLSTM, calculating the importance weights of each feature in the fused semantic features by using a multi-head attention mechanism, obtaining a weighted global semantic vector, performing Softmax function classification on the weighted semantic vector, and outputting a fault category label and its confidence; S4, outputting corresponding diagnostic results, possible causes and recommended maintenance measures according to the fault category, displaying the diagnostic results in a visual image interface, and providing an explanation path of related knowledge nodes. 2.The railway equipment fault diagnosis method based on knowledge graph and text fusion according to claim 1, characterized in that, The method of performing Softmax function classification on the weighted semantic representation in the S3 step comprises: The fused joint semantic feature vector is input to a classification layer of the BiLSTM, wherein, represents the fused joint semantic feature vector; d is the dimension of the input feature vector, is a global semantic expression obtained after fusion of the text semantic feature and the knowledge graph entity relationship and multi-head attention weighting. By linear transformation, compute the unnormalized score for each failure type i : ; wherein, and are parameters for model training, represents the trainable weight matrix corresponding to the i-th failure class, used to map the vector c to the class score space; represents the bias term corresponding to the i-th class of failure, which is a trainable parameter; To perform Softmax normalization: ; wherein, represents the non-normalized score that the sample belongs to the class of faults, obtained by a linear transformation; The model represents the probability that the input sample belongs to the i-th class of faults, satisfying , K represents the total number of fault types; The fault category corresponding to the highest probability is taken as the diagnosis result, and the highest probability is taken as the confidence level of the diagnosis The confidence level of the diagnosis is taken as the confidence level of the diagnosis ; wherein, is the probability that the model judges the input sample to belong to the kth class of faults. 3.The railway equipment fault diagnosis method based on knowledge graph and text fusion according to claim 1, characterized in that, The method of performing token-level embedding fusion of the text semantic features and the knowledge graph entities in the S3 step comprises: The TransH algorithm is used to embed and map entities and relationships in the knowledge graph to obtain a knowledge embedding matrix: , which is composed of vector representations of all entities and relationships; wherein, represents the total number of entities and relationships in the knowledge graph; represents the embedding vector of the th entity or relationship in the knowledge graph, which is obtained by TransH training; dimensional embedding vector; is structured semantic information provided for the device components, fault types and reasons of entities appearing in the text; Each word vector is fused with the corresponding knowledge entity embedding vector by a token-level fusion strategy to obtain a fused representation: ; Wherein, f is a linear transformation and attention weight fusion function. 4.The railway equipment fault diagnosis method based on knowledge graph and text fusion according to claim 1, characterized in that, The method of calculating the importance weights of each feature in the fused semantic features to obtain the weighted global semantic vector in the S3 step comprises: According to the context importance, highlight the key fault description words, suppress the redundant information, and generate a global context vector: ; where, , is the attention weight, which is normalized by the softmax function over all positions; is the global context vector, which is the weighted sum of all feature vectors with their attention weights as coefficients. 5.The railway equipment fault diagnosis method based on knowledge graph and text fusion according to claim 4, characterized in that, The method of outputting the fault category label and its confidence in the S3 step comprises: The weighted global semantic vector is input into the classification layer of BiLSTM for fault type discrimination, and the Softmax classifier outputs the probability distribution of each fault by using a Softmax function: ; where W and b are trainable parameter matrix and bias term, respectively, is the output probability distribution, each element corresponding to the confidence of the failure class. Output the most possible fault category label and its confidence. 6.A railway equipment fault diagnosis system based on knowledge graph and text fusion, configured to perform the railway equipment fault diagnosis method based on knowledge graph and text fusion according to any one of claims 1-5, characterized in that, The method comprises the following steps: A text input and preprocessing module is configured to receive a natural language fault description input by a railway maintenance personnel, analyze the natural language fault description into a fault phenomenon text, perform cleaning, word segmentation, denoising, morphological restoration, entity recognition and standardization preprocessing on the text to obtain a text sequence; A semantic analysis module is configured to input the text sequence into a pre-trained language model BERT, extract a context semantic feature vector of each word in the text, input the context semantic feature vector into a bidirectional long short-term memory network BiLSTM, capture context dependency and time sequence features to generate a sequence feature vector fused with semantics; The knowledge fusion module is configured to construct a knowledge graph including entities and relationships of equipment components, fault types, causes and treatment measures based on domain knowledge of railway equipment, and to perform structured knowledge enhancement on sequence features; to retrieve relevant entity and relationship information from the knowledge graph, to perform token-level embedding fusion of text semantic features and entities and relationships of the knowledge graph, to perform sequence relationship modeling on the fused features by using BiLSTM, to calculate importance weights of each feature in the fused semantic features by using a multi-head attention mechanism, to obtain a weighted global semantic vector, to perform a Softmax function on the weighted semantic vector, and to output fault category labels and confidence levels thereof; The result output and display module is configured to output corresponding diagnostic results, possible causes and recommended maintenance measures according to the fault categories, and to display the diagnostic results in a visual image interface and provide an explanation path of relevant knowledge nodes.
7. The knowledge graph and text fusion railway equipment fault diagnosis system according to claim 6, characterized in that, The knowledge fusion module comprises: Classification and reasoning unit: used to classify the fused joint semantic feature vector The input is fed into the classification layer of the BiLSTM, where, This represents the fused joint semantic feature vector; d is the dimension of the input feature vector. It is a global semantic representation obtained by fusing text semantic features with knowledge graph entity relationships and weighting with multi-head attention; through linear transformation, the unnormalized score of each fault type i is calculated. : ;in, and These are the parameters used for model training. Let represent the trainable weight matrix corresponding to the i-th fault category, used to map vector c to the category score space; The bias term corresponding to the i-th type of fault is a trainable parameter; for Perform Softmax normalization: ;in, Indicates that the sample belongs to the first The unnormalized score (logit) of the fault class is obtained by linear transformation; Let represent the probability that the model determines the input sample belongs to the nth type of fault, and let represent the total number of fault types. The fault category corresponding to the highest probability is taken as the diagnostic result, and this highest probability is... As a confidence level for fault diagnosis: ;in, To determine the probability that an input sample belongs to the k-th type of fault for the model. 8.The railway equipment fault diagnosis system based on knowledge graph and text fusion according to claim 6, characterized in that, The knowledge fusion module comprises: The attention computing unit is used for highlighting key fault description words and suppressing redundant information according to context importance, and generating a global context vector. ; wherein, , is an attention weight, and the attention weights of all positions are normalized by a softmax function; is the global context vector, and the global context vector is a weighted sum of all feature vectors with attention weights as coefficients.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The program, when executed by the processor, implements the steps of the railway equipment fault diagnosis method based on knowledge graph and text fusion according to any one of claims 1-5.
10. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor, when executing the program, implements the steps of the railway equipment fault diagnosis method based on knowledge graph and text fusion according to any one of claims 1-5.
Citation Information
Cited By
Vehicle fault named entity recognition method, device, equipment, medium and product
CN122221859A