Turnout current fault detection method, system and equipment based on Transform model and medium

By proposing a turnout current fault detection method based on the Transformer model, and utilizing the multi-head self-attention mechanism and cosine similarity calculation, the accuracy and efficiency problems of turnout current fault detection in the prior art are solved, and efficient and accurate judgment of turnout health status and timely identification of fault types are achieved.

CN121859017APending Publication Date: 2026-04-14CASCO SIGNAL LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CASCO SIGNAL LTD
Filing Date
2025-12-31
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing turnout current fault detection methods rely on human experience, which can easily lead to lag, misjudgment, and missed judgment. Intelligent diagnostic methods such as wavelet analysis and traditional machine learning are difficult to effectively capture long-distance dependencies and deep time-series information, affecting the accuracy and generalization ability of fault identification.

Method used

A turnout current fault detection method based on the Transformer model is adopted. By constructing feature vectors through multi-head self-attention mechanism and cosine similarity calculation, feature extraction and health status judgment of turnout current curves are realized. The model is optimized by combining cross-entropy loss function.

Benefits of technology

It improves the accuracy and efficiency of turnout fault diagnosis, reduces reliance on staff experience, significantly reduces delays and misjudgments, and enables timely and accurate identification of fault types.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121859017A_ABST
    Figure CN121859017A_ABST
Patent Text Reader

Abstract

The invention discloses a turnout current fault detection method based on a Transform model. The method comprises the steps that S1, a turnout current curve is collected and preprocessed; s2, a Transform model of the turnout current curve is constructed, the Transform model comprises an encoder, the encoder is composed of a plurality of identical layers, and each layer comprises a multi-head self-attention mechanism; s3, inputting the turnout current curve and the reference current curve which are preprocessed in the step S1 into a Transform model, and performing feature extraction on the turnout current curve and the reference current curve through the multi-head self-attention mechanism; and S4, constructing a feature vector, performing cosine similarity calculation on the turnout current curve, and distinguishing the turnout health state according to the cosine similarity of the turnout current curve and the reference current curve. According to the method, the health condition and the fault type of the turnout can be timely and accurately identified, and the problems of delay, misjudgment or missed judgment and the like caused by manual identification are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of rail transit, and in particular to a method, system, device and medium for detecting turnout current faults based on the Transformer model. Background Technology

[0002] As a crucial signaling device in urban rail transit systems, the safety and reliability of turnouts directly impact the stable operation of trains and the personal safety of passengers. Therefore, monitoring the health status of turnouts and quickly locating faults is of great significance. Currently, there are two main methods for judging turnout faults using turnout operating current. One is the traditional manual observation method, where individuals judge the type of turnout fault based on the turnout operating current and power curves provided by microcomputer monitoring software, combined with their personal experience. The other is intelligent diagnostics, which involves extracting features from the turnout operating current curve to determine the type of fault.

[0003] The first method of manual observation is easily affected by factors such as the staff's on-site experience and knowledge level, which may lead to delayed results, misjudgments, and omissions.

[0004] Compared to the first approach, intelligent diagnostic methods have significant advantages. However, current intelligent diagnostic methods mainly rely on feature extraction based on wavelet analysis and fault classification based on machine learning algorithms, which still have obvious limitations. For example, wavelet analysis depends on the selection of basis functions for feature extraction and has limited ability to capture local waveform features; traditional machine learning methods usually rely on manually constructed features, making it difficult to fully mine the deep time-series information related to faults in the current curve, especially in handling long-distance dependencies in long-sequence data, affecting the accuracy and generalization ability of fault identification.

[0005] The statements herein provide only background information in relation to this invention and do not necessarily constitute prior art. Summary of the Invention

[0006] The purpose of this invention is to provide a turnout current fault detection method based on the Transformer model, so as to overcome the shortcomings of the prior art, take advantage of the significant advantages of the Transformer model in processing sequential data, better capture long-distance dependencies, and improve feature extraction capability through self-attention mechanism, so as to provide a more accurate and efficient solution for turnout fault diagnosis.

[0007] To achieve the above objectives, this invention provides a turnout current fault detection method based on the Transformer model, comprising: S1. Collect the turnout current curve and perform preprocessing; S2. Construct a Transformer model of the turnout current curve. The Transformer model includes an encoder, which consists of multiple identical layers, each of which includes a multi-head self-attention mechanism. S3. Input the turnout current curve and reference current curve preprocessed in step S1 into the Transformer model, and extract features from the turnout current curve and reference current curve through the multi-head self-attention mechanism. S4. Construct feature vectors, calculate cosine similarity between turnout current curves, and identify turnout health status based on the cosine similarity between turnout current curves and reference current curves.

[0008] Optionally, the turnout current fault detection method further includes: S5. Train and optimize the Transformer model, select the cross-entropy loss function to train the Transformer model, and select the Adam optimizer to update the weights of the Transformer model. S6. Evaluate and validate the Transformer model using precision, recall, and F1 score.

[0009] Optionally, step S1 specifically includes the following steps: S1.1 Collect turnout current data from the turnout equipment. The turnout current data includes the current data of the turnout equipment under normal operation and fault conditions. The current data is the current value continuously sampled over time, and the recording result is represented as a current curve. S1.2 Data cleaning: Remove outliers and fill in missing values ​​on the current curve, and ensure data consistency and integrity; S1.3 Data normalization or standardization: converting current data of different dimensions and magnitudes into a unified format; S1.4. Perform time alignment processing on the collected current data; S1.5 Time series segmentation: The continuous current curve data is segmented into a fixed-length sequence. For sequences that are not long enough, padding is used to make them reach the fixed length.

[0010] Optionally, each layer of the encoder further includes a feedforward network connected to the multi-head self-attention mechanism; The multi-head self-attention mechanism is used to extract features from the current curve sequence input to the Transformer model. By segmenting the input current curve sequence into multiple heads, each head learns different aspects of the current curve sequence, and then the information captured by each head is merged to obtain a feature representation. The feedforward network is used to further transform and process the features extracted by the multi-head self-attention mechanism to generate a higher-level feature representation.

[0011] Optionally, the reference current curve includes a healthy state current curve and various typical fault current curves.

[0012] Optionally, step S4 includes: S4.1 Construct feature vectors and perform normalization: For each turnout current curve or reference current curve, the multiple feature values ​​extracted in step S3 that reflect the physical characteristics of each stage of the current curve are combined into a feature vector. If n features are extracted, the current curve is represented as an n-dimensional feature vector. S4.2 Calculate cosine similarity and determine the health status of the turnout: The formula for calculating cosine similarity is as follows: ; In the formula, It is the current turnout current curve vector. It is the reference current curve vector; The cosine similarity score between the current turnout current curve and the reference current curve is obtained by the above calculation formula. Then, it is compared with the set threshold to determine whether the overall waveform of the current turnout current curve deviates from the normal mode.

[0013] Optionally, the determination of the turnout's health status specifically includes: First, the reference current curve is selected as the healthy state current curve. When the cosine similarity between the current turnout current curve and the healthy state current curve is lower than the set threshold, it is directly marked as "suspected abnormal". When the cosine similarity between the current turnout current curve and the healthy state current curve is higher than or equal to the set threshold, it indicates that the current turnout current curve is normal. Furthermore, if the current turnout current curve is marked as "suspected abnormal", then the reference current curves are selected in sequence as various typical fault current curves, and the similarity between the current turnout current curve and various typical fault current curves is analyzed to confirm the fault type of the current turnout current curve.

[0014] Optionally, step S5 includes: The collected turnout current curves are preprocessed and then input into the Transformer model for model training. The turnout current curve is classified into multiple categories using a cross-entropy loss function, including normal, fault type 1, fault type 2, etc. The cross-entropy loss function is as follows: In the formula, For the true label of sample i, Here, N represents the class probability predicted by the model, N is the number of current curve samples, and c is the number of fault categories. The cross-entropy loss function is used to measure the difference between the probability distribution predicted by the model and the true label distribution, by minimizing the loss value. To optimize model parameters.

[0015] Optionally, step S6 includes: Faulty current curves are defined as the "positive" class, and normal current curves are defined as the "negative" class; the precision, recall, and F1 score are all based on four basic statistics in the confusion matrix: TP: The number of samples that are actually positive and predicted to be positive; FP: The number of samples that were actually negative but predicted to be positive; TN: The number of samples that are actually negative and predicted to be negative; FN: The number of samples that were actually positive but predicted to be negative; The accuracy rate focuses on how many samples predicted as positive by the model are actually true positives, and its calculation formula is as follows: ; The recall rate measures the model's ability to identify all true positive classes, and its calculation formula is as follows: ; The F1 score is the harmonic mean of precision and recall, used to strike a balance between the two, and is calculated as follows: ; After obtaining the calculated results of precision, recall, and F1 score, they are compared with preset indicators. If the target is not met, the process returns to step S5 to further train the Transformer model until precision, recall, and F1 score all meet the target.

[0016] To achieve the above objectives, the present invention also provides a turnout current fault detection system for implementing the aforementioned turnout current fault detection method; the system includes: The data acquisition module is used to perform the data acquisition part in step S1, is connected to the turnout equipment, monitors the status of the turnout equipment, and collects current data that changes over time. The data preprocessing module is used to perform the data preprocessing part in step S1. It is connected to the data acquisition module, receives the current data acquired by the data acquisition module, and preprocesses it. The model building and training module is used to execute steps S2 and S5, and is connected to the data preprocessing module to receive preprocessed current data, build and train the Transformer model. The feature extraction module is used to execute step S3 and is connected to the data preprocessing module and the model building and training module. It inputs the preprocessed current data into the Transformer model and extracts features from the current curve through the encoder of the Transformer model. The fault diagnosis module is used to execute step S4. It is connected to the model building and training module, calls the pre-trained Transformer model, and calculates the similarity of the current curves. The model validation module is used to execute step S6 and is connected to the model building and training module. Before the model is put into formal application, it evaluates the model's precision, recall and F1 score performance indicators to verify the model's reliability.

[0017] To achieve the above objectives, the present invention also provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the above-described turnout current fault detection method.

[0018] To achieve the above objectives, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the above-described turnout current fault detection method is implemented.

[0019] Compared with existing technologies, this invention uses deep learning technology to train and learn, automatically detects and distinguishes the similarity of turnout current curves, and can analyze the operating current in a timely and accurate manner after the turnout operates to identify the health status of the turnout; when a fault occurs, it can accurately locate the fault type; it significantly reduces the reliance on the experience and knowledge level of the staff in the fault diagnosis process, and reduces problems such as delays, misjudgments or omissions caused by manual identification. Attached Figure Description

[0020] Figure 1 This is a flowchart of the turnout current fault detection method of the present invention. Detailed Implementation

[0021] The following detailed description, in conjunction with the accompanying drawings and specific embodiments, further illustrates the present invention's method, system, equipment, and medium for detecting turnout current based on the Transformer model. The advantages and features of the present invention will become clearer from the following description. It should be noted that the accompanying drawings are in a very simplified form and use non-precise scales, used only to facilitate and clarify the illustration of the embodiments of the present invention. Please refer to the accompanying drawings to make the objectives, features, and advantages of the present invention more apparent and understandable. It should be understood that the structures, scales, sizes, etc., depicted in the accompanying drawings are only for illustrative purposes to aid those skilled in the art and are not intended to limit the implementation conditions of the present invention. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportional relationships, or adjustments to the size, without affecting the effects and objectives achieved by the present invention, should still fall within the scope of the technical content disclosed in the present invention.

[0022] This invention provides a turnout current fault detection method based on the Transformer model, such as... Figure 1 As shown, the method includes the following steps: S1. Collect turnout current data and perform preprocessing, including data acquisition, data cleaning, and data standardization.

[0023] Step S1 specifically includes the following steps: S1.1 During turnout operation, turnout current data is collected from the turnout equipment. The turnout current data includes current data of the turnout equipment under normal operation and fault conditions. The current data is the current value continuously sampled over time, and the recording result is represented as a current curve.

[0024] In this step, it is necessary to monitor the turnout operating current and record the current data that changes continuously over time. The current data of the turnout equipment under normal operating conditions refers to the turnout being able to be operated to the correct or reverse position according to commands, at which time the collected current curve is normal. The current data of the turnout equipment under fault conditions refers to the turnout being able to be operated to the correct or reverse position according to commands, or being unable to be operated to the correct or reverse position according to commands, and at this time the collected current curve is abnormal, such as large fluctuations in the current curve during turnout switching, or the turnout being in a four-way open state, in which case the current curve is obviously abnormal.

[0025] S1.2 Data cleaning, which involves removing outliers and filling in missing values ​​on the current curve, and ensuring the consistency and integrity of the data.

[0026] The method for filling missing values ​​is as follows: the acquired current curve consists of a series of discrete data, which are evenly distributed on the time axis according to a fixed period. If there are missing values, they are filled by linear interpolation based on adjacent points.

[0027] Outliers may be caused by data acquisition sensor malfunctions, environmental interference, or operational errors, and need to be identified and processed through statistical analysis. The method for identifying and processing outliers is as follows: segmented detection. Based on the changing trend of the current curve and the key feature points (such as peak points and inflection points) in the current curve waveform, each current curve is divided into three stages: unlocking, conversion, and locking. Specific empirical thresholds are set for each stage. If the current data continuously exceeds or falls below the empirical threshold, such as all values ​​being 0 or more than twice the historical data, it should be considered an outlier and cleared.

[0028] S1.3 Data normalization or standardization: Convert current data of different dimensions and magnitudes into a unified format to facilitate subsequent model training and processing.

[0029] By using data normalization or standardization to process current data, the dimensionality differences of current data can be effectively reduced, thereby improving the training efficiency of the model.

[0030] S1.4 Data Alignment. Since the turnout operation may be slightly off-time, the collected current data needs to be time-aligned to ensure that different current curves can be effectively compared.

[0031] S1.5 Time Series Segmentation. Continuous current curve data is segmented into fixed-length sequences to facilitate model processing. For sequences that are too short, padding is used to bring them to the fixed length.

[0032] The padding process is as follows: for sequences that have not reached a fixed length, zero padding is performed at the end of the sequence to make its length complete and reach a fixed length.

[0033] In a preferred embodiment, the fixed length is set to 128, which ensures that the complete waveform characteristics of the turnout operating current can be effectively captured while improving the computational efficiency of the model.

[0034] S2. Construct the Transformer model of the turnout current curve.

[0035] The Transformer model consists of two parts: an Encoder and a Decoder. In this invention, the Encoder part of the Transformer model can be used to perform the feature extraction and similarity analysis of the turnout current curves.

[0036] Furthermore, the Encoder consists of multiple identical layers, each including a multi-head attention mechanism and a connected feedforward network. The multi-head attention mechanism extracts features from the sequence input to the Transformer model. This mechanism allows the Transformer model to capture information simultaneously in different representation subspaces by segmenting the input sequence into multiple heads, each head learning different aspects of the input sequence. The information captured by each head is then merged to obtain a richer feature representation. The feedforward network further transforms and processes the features extracted by the multi-head attention mechanism, generating higher-level feature representations.

[0037] S3. Feature extraction of turnout current curve.

[0038] Specifically, the turnout current curves acquired and preprocessed in step S1 are input into the Transformer model. The multi-head self-attention mechanism of the Transformer model's Encoder is used to extract features from all acquired turnout current curves. Simultaneously, a reference current curve is input into the Transformer model and its features are extracted to obtain the feature vectors of the current curves in subsequent steps. The reference current curves include healthy state current curves and several typical fault current curves.

[0039] Based on the changing trend of the current curve and the key feature points in the current waveform, each current curve is divided into three stages: unlocking, transition, and latching. In the unlocking stage, the extracted features are the rising edge slope and the unlocking peak value; in the transition stage, the extracted features are the mean of the steady segment and the standard deviation of the fluctuation; and in the latching stage, the extracted feature is the latching area.

[0040] The above features are used for subsequent feature vector construction and model training.

[0041] S4. Calculate the similarity of the turnout current curves and identify the health status of the turnout based on the similarity.

[0042] Specifically, the cosine similarity algorithm is used to determine the correlation between the collected turnout current curves and reference current curves (healthy state current curves and typical fault current curves), including the following steps: S4.1 Current curves are a type of time series data, composed of current values ​​at multiple time points. To use cosine similarity, the current curves must first be converted into vector form, including the following steps: 1) Vector Construction: For each current curve (including the turnout current curve and the reference current curve), the multiple feature values ​​(e.g., rising slope, unlocking peak value, mean of the steady segment, standard deviation of fluctuation, and locking area) extracted in step S3 that reflect the physical characteristics of each stage of the current curve are directly combined into a feature vector. For example, if n features are extracted, the current curve can be represented as an n-dimensional feature vector: ; 2) Normalization: Since cosine similarity only focuses on direction and is not sensitive to absolute value, in order to eliminate the influence of amplitude, the feature vector is usually normalized, for example, by using min-max scaling or Z-score normalization, to convert the vector into a unit vector or a vector with zero mean and unit variance.

[0043] Once the current curve is represented as a vector, the cosine similarity between the current turnout current curve vector and the reference current curve vector can be calculated.

[0044] S4.2 Calculate the cosine similarity and determine the health status of the turnout.

[0045] The cosine similarity formula is the dot product of two vectors divided by the product of their magnitudes, as follows: In the formula, It is the current turnout current curve vector. It is the reference current curve vector.

[0046] The cosine similarity score between the current turnout current curve and the reference current curve is obtained by the above calculation formula. Then, it is compared with the preset threshold to quickly determine whether the overall waveform of the current turnout current curve deviates from the normal mode.

[0047] Specifically, the reference current curve is first selected as the healthy state current curve. When the cosine similarity between the current turnout current curve and the healthy state current curve is lower than a set threshold, it is directly marked as "suspected abnormality". When the cosine similarity between the current turnout current curve and the healthy state current curve is higher than or equal to the set threshold, it indicates that the current turnout current curve is normal, and no further analysis is needed, saving time. Further, if the current turnout current curve is marked as "suspected abnormality", then various typical fault current curves are selected as reference current curves in sequence, and the similarity between the current turnout current curve and various typical fault current curves is analyzed to confirm the fault type of the current turnout current curve.

[0048] If no similar typical fault current curve can be found for the "suspected abnormal" current curve, then the current curve is further marked as "unknown fault type" and awaits manual investigation of the cause.

[0049] S5. The Transformer model is trained and optimized based on massive turnout current data. The cross-entropy loss function is selected to train the Transformer model, and the Adam optimizer is selected to update the weights of the Transformer model.

[0050] Specifically, the following strategies are adopted during model training and optimization: 1) Model input: Input the sequences obtained from the preprocessing of a large number of turnout current curves in steps S1.2 to S1.5 into the Transformer model, and perform feature extraction and vector construction on each sequence as described in steps S3 and S4.1 respectively.

[0051] 2) Model Structure: As described in step S2, this model uses a multi-layer Transformer Encoder, with each layer containing a multi-head self-attention network (Multi-Head Self-Attention) and a feedforward network (FFN). The self-attention mechanism is able to capture long-range dependencies in the current curve.

[0052] 3) Training objective (loss function): The current curves are classified into multiple categories, including normal, fault type 1, fault type 2, etc., using the cross-entropy loss function as follows: In the formula, The true label (one-hot) for sample i. Here, N represents the predicted class probability; N is the number of current curve samples, and c is the number of fault categories. This loss function measures the difference between the model's predicted probability distribution and the true label distribution. Minimizing this loss value... To optimize model parameters.

[0053] 4) Optimizer and learning rate scheduling: The optimizer uses Adam or AdamW, and the initial learning rate is usually set to... ~ ; The learning rate is scheduled using Warmup and Cosine Decay to help the model converge stably.

[0054] 5) Regularization and Enhancement: Dropout regularization is used between the attention weights and the intermediate layer of the feedforward network to prevent overfitting. Data augmentation is performed, including adding noise, scaling, and shifting the current curves to improve model robustness.

[0055] 6) Evaluation metrics: Evaluation metrics include accuracy, precision, recall, and F1 score.

[0056] S6. Evaluate, validate, and apply the Transformer model.

[0057] The performance of the Transformer model was evaluated on the validation set using metrics such as precision, recall, and F1 score.

[0058] Precision, recall, and F1 score are commonly used metrics for evaluating the performance of classification models. They are all based on four basic statistics in the confusion matrix: TP (True Positive): The number of samples that are actually positive and predicted to be positive; FP (False Positive): The number of samples that are actually negative but predicted to be positive; TN (True Negative): The number of samples that are actually negative and predicted to be negative; FN (False Negative): The number of samples that are actually positive but predicted to be negative.

[0059] In this invention, abnormal or faulty current curves are defined as "positive" and normal current curves are defined as "negative".

[0060] Whether the actual value is positive or negative depends on the actual situation and is usually determined based on historical data. A positive actual value indicates that a fault has actually occurred in the corresponding current curve; a negative actual value indicates that the corresponding current curve is operating well and no fault has occurred.

[0061] The prediction is positive or negative, calculated in step S4 using the Transformer model to determine the similarity between the current curves. A positive prediction indicates that the similarity between the corresponding current curve and the healthy state current curve is below a set threshold, while a negative prediction indicates that the similarity between the corresponding current curve and the healthy state current curve is above or equal to the set threshold.

[0062] The precision focuses on how many samples predicted as positive by the model are actually true positives; therefore, the precision is calculated using the following formula: The recall rate measures the model's ability to identify all true positive classes; therefore, the formula for calculating the recall rate is: The F1 score is the harmonic mean of precision and recall, used to strike a balance between the two, and is calculated as follows: .

[0063] The above metrics are used to quantify the model's performance in identifying current curve faults, serving as a basis for improving the Transformer model. Optimizing precision can reduce false positives, optimizing recall can reduce false negatives, and optimizing the F1 score can balance precision and recall.

[0064] After obtaining the calculated results of precision, recall and F1 score, they are compared with preset indicators. If the target is not met, it is necessary to return to step S5 to further train the Transformer model until all the above indicators are met.

[0065] Furthermore, the present invention also provides a turnout current fault detection system for implementing the above-mentioned turnout current fault detection method. The system includes at least: a data acquisition module, used to execute the data acquisition part in step S1, the data acquisition module being connected to the turnout equipment, capable of monitoring the status of the turnout equipment and acquiring current data changing over time; a data preprocessing module, used to execute the data preprocessing part in step S1, the data preprocessing module being connected to the data acquisition module, receiving the current data acquired by the data acquisition module and preprocessing it; a model building and training module, used to execute steps S2 and S5, the model building and training module being connected to the data preprocessing module, receiving the preprocessed current data, building and training the Transformer model; and a feature extraction module, used to execute step S3, the feature extraction module... The feature extraction module is connected to the data preprocessing module and the model building and training module. It is used to input the preprocessed current data into the Transformer model and extract features from the current curve through the encoder of the Transformer model. The fault diagnosis module is used to execute step S4. This fault diagnosis module is connected to the model building and training module and calls the pre-trained Transformer model to calculate the similarity of the current curve. The model validation module is used to execute step S6. This model validation module is connected to the model building and training module and evaluates the model's precision, recall, and F1 score before the model is put into formal application to verify the reliability of the model.

[0066] Furthermore, the present invention also provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the above-described turnout current fault detection method.

[0067] Furthermore, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the above-described turnout current fault detection method is implemented.

[0068] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0069] In the description of this invention, it should be understood that the terms "center," "height," "thickness," "upper," "lower," "vertical," "horizontal," "top," "bottom," "inner," "outer," "axial," "radial," and "circumferential," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.

[0070] In the description of this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0071] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can include direct contact between the first and second features, or contact between the first and second features through another feature between them. Furthermore, "above," "over," and "on top" of the second feature includes the first feature directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature includes the first feature directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.

[0072] Although the present invention has been described in detail through the preferred embodiments above, it should be understood that the above description should not be considered as a limitation of the present invention. Various modifications and substitutions to the present invention will be apparent to those skilled in the art after reading the above description. Therefore, the scope of protection of the present invention should be defined by the appended claims.

Claims

1. A method for detecting turnout current faults based on the Transformer model, characterized in that, include: S1. Collect the turnout current curve and perform preprocessing; S2. Construct a Transformer model of the turnout current curve. The Transformer model includes an encoder, which consists of multiple identical layers, each of which includes a multi-head self-attention mechanism. S3. Input the turnout current curve and reference current curve preprocessed in step S1 into the Transformer model, and extract features from the turnout current curve and reference current curve through the multi-head self-attention mechanism. S4. Construct feature vectors, calculate cosine similarity between turnout current curves, and identify turnout health status based on the cosine similarity between turnout current curves and reference current curves.

2. The turnout current fault detection method as described in claim 1, characterized in that, Also includes: S5. Train and optimize the Transformer model, select the cross-entropy loss function to train the Transformer model, and select the Adam optimizer to update the weights of the Transformer model. S6. Evaluate and validate the Transformer model using precision, recall, and F1 score.

3. The turnout current fault detection method as described in claim 1, characterized in that, Step S1 specifically includes the following steps: S1.1 Collect turnout current data from the turnout equipment. The turnout current data includes the current data of the turnout equipment under normal operation and fault conditions. The current data is the current value continuously sampled over time, and the recording result is represented as a current curve. S1.2 Data cleaning: Remove outliers and fill in missing values ​​on the current curve, and ensure data consistency and integrity; S1.3 Data normalization or standardization: converting current data of different dimensions and magnitudes into a unified format; S1.

4. Perform time alignment processing on the collected current data; S1.5 Time series segmentation: The continuous current curve data is segmented into a fixed-length sequence. For sequences that are not long enough, padding is used to make them reach the fixed length.

4. The turnout current fault detection method as described in claim 1, characterized in that, Each layer of the encoder also includes a feedforward network connected to the multi-head self-attention mechanism; The multi-head self-attention mechanism is used to extract features from the current curve sequence input to the Transformer model. By segmenting the input current curve sequence into multiple heads, each head learns different aspects of the current curve sequence, and then the information captured by each head is merged to obtain a feature representation. The feedforward network is used to further transform and process the features extracted by the multi-head self-attention mechanism to generate a higher-level feature representation.

5. The turnout current fault detection method as described in claim 1, characterized in that, The reference current curves include healthy state current curves and various typical fault current curves.

6. The turnout current fault detection method as described in claim 5, characterized in that, Step S4 includes: S4.1 Construct feature vectors and perform normalization: For each turnout current curve or reference current curve, the multiple feature values ​​extracted in step S3 that reflect the physical characteristics of each stage of the current curve are combined into a feature vector. If n features are extracted, the current curve is represented as an n-dimensional feature vector. S4.2 Calculate cosine similarity and determine the health status of the turnout: The formula for calculating cosine similarity is as follows: ; In the formula, It is the current turnout current curve vector. It is the reference current curve vector; The cosine similarity score between the current turnout current curve and the reference current curve is obtained by the above calculation formula. Then, it is compared with the set threshold to determine whether the overall waveform of the current turnout current curve deviates from the normal mode.

7. The turnout current fault detection method as described in claim 6, characterized in that, The specific steps for determining the health status of the turnout are as follows: First, the reference current curve is selected as the healthy state current curve. When the cosine similarity between the current turnout current curve and the healthy state current curve is lower than the set threshold, it is directly marked as "suspected abnormal". When the cosine similarity between the current turnout current curve and the healthy state current curve is higher than or equal to the set threshold, it indicates that the current turnout current curve is normal. Furthermore, if the current turnout current curve is marked as "suspected abnormal", then the reference current curves are selected in sequence as various typical fault current curves, and the similarity between the current turnout current curve and various typical fault current curves is analyzed to confirm the fault type of the current turnout current curve.

8. The turnout current fault detection method as described in claim 2, characterized in that, Step S5 includes: The collected turnout current curves are preprocessed and then input into the Transformer model for model training. The turnout current curve is classified into multiple categories using a cross-entropy loss function, including normal, fault type 1, fault type 2, etc. The cross-entropy loss function is as follows: In the formula, For the true label of sample i, Here, N represents the class probability predicted by the model, N is the number of current curve samples, and c is the number of fault categories. The cross-entropy loss function is used to measure the difference between the probability distribution predicted by the model and the true label distribution, by minimizing the loss value. To optimize model parameters.

9. The turnout current fault detection method as described in claim 2, characterized in that, Step S6 includes: The faulty current curve is defined as the "positive" class, and the normal current curve is defined as the "negative" class; the precision, recall, and F1 score are all based on four basic statistics in the confusion matrix: TP: The number of samples that are actually positive and predicted to be positive; FP: The number of samples that were actually negative but predicted to be positive; TN: The number of samples that are actually negative and predicted to be negative; FN: The number of samples that were actually positive but predicted to be negative; The accuracy rate focuses on how many samples predicted as positive by the model are actually true positives, and its calculation formula is as follows: ; The recall rate measures the model's ability to identify all true positive classes, and its calculation formula is as follows: ; The F1 score is the harmonic mean of precision and recall, used to strike a balance between the two, and is calculated as follows: ; After obtaining the calculated results of precision, recall, and F1 score, they are compared with preset indicators. If the target is not met, the process returns to step S5 to further train the Transformer model until precision, recall, and F1 score all meet the target.

10. A turnout current fault detection system, characterized in that, A system for implementing the turnout current fault detection method as described in any one of claims 1-9; the system comprises: The data acquisition module is used to perform the data acquisition part in step S1, is connected to the turnout equipment, monitors the status of the turnout equipment, and collects current data that changes over time. The data preprocessing module is used to perform the data preprocessing part in step S1. It is connected to the data acquisition module, receives the current data acquired by the data acquisition module, and preprocesses it. The model building and training module is used to execute steps S2 and S5, and is connected to the data preprocessing module to receive preprocessed current data, build and train the Transformer model. The feature extraction module is used to execute step S3 and is connected to the data preprocessing module and the model building and training module. It inputs the preprocessed current data into the Transformer model and extracts features from the current curve through the encoder of the Transformer model. The fault diagnosis module is used to execute step S4. It is connected to the model building and training module, calls the pre-trained Transformer model, and calculates the similarity of the current curves. The model validation module is used to execute step S6 and is connected to the model building and training module. Before the model is put into formal application, it evaluates the model's precision, recall and F1 score performance indicators to verify the model's reliability.

11. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the turnout current fault detection method as described in any one of claims 1-9.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the turnout current fault detection method as described in any one of claims 1-9.