Transformer fault diagnosis method based on time-frequency domain feature interactive fusion network
By building a time-frequency domain feature interactive fusion network, using convolutional neural network and attention mechanism for transformer fault diagnosis, the existing methods are difficult to cope with complex fault types, and more efficient fault diagnosis and predictive maintenance are achieved.
Patent Information
- Application Number
- CN202510100085.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-05-06
AI Technical Summary
Existing transformer fault diagnosis methods rely on empirical rules and thresholds, making it difficult to cope with complex fault types, and failing to make full use of the interactive relationship of multi-dimensional information such as time domain and frequency domain, resulting in misdiagnosis and missed diagnosis.
A fault diagnosis method based on time-frequency domain feature interaction fusion network is constructed, and a convolutional neural network and attention mechanism is used to achieve efficient interaction between time-domain and frequency domain signals is achieved, and deep feature extraction and fusion is extracted and fusion through two-stage Transformer and cross-modal encoder.
It significantly improves the accuracy and efficiency of transformer fault diagnosis, can more effectively capture the time-frequency characteristics of fault signals, and improves the safety and operation efficiency of the power system.
Smart Images

Figure CN119939515A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a transformer fault diagnosis method based on a time-frequency domain feature interactive fusion network, and belongs to the technical field of transformer operation and maintenance in power systems. Background Art
[0002] Transformers are vital equipment in power systems, and their normal operation is directly related to the safety and reliability of the power grid. However, transformers are easily affected by various factors during long-term operation, leading to faults such as overheating, arc discharge, partial discharge, insulation aging, etc. If these faults are not discovered and handled in time, they may cause larger-scale power outages and even cause equipment damage and economic losses. Therefore, accurate and real-time diagnosis of transformer faults is of great significance.
[0003] At present, the commonly used transformer fault diagnosis methods mainly include those based on dissolved gas analysis (DGA), spectrum analysis and vibration analysis. Among them, DGA is a widely used technology that determines the type of internal fault by detecting the types and concentrations of different gases in transformer oil. For example, acetylene gas usually indicates that there may be arc discharge, while the increase of methane and hydrogen may mean overheating. However, these traditional methods have some obvious limitations. Most DGA methods rely on pre-defined empirical rules and thresholds, which may not be able to cope with complex fault types under different environments and working conditions, resulting in misdiagnosis and missed diagnosis. Traditional methods usually focus on a certain feature, such as spectrum or gas concentration, and fail to make full use of the interactive relationship of multi-dimensional information such as time domain and frequency domain, making it difficult to provide comprehensive fault information. With the development of deep learning and self-supervised learning, researchers combine multi-dimensional information in time domain and frequency domain for fault analysis. These new methods improve the accuracy and robustness of fault diagnosis by mining the potential features of data. In addition, self-supervised learning can mine feature relationships without labeled data, reduce the dependence on a large amount of labeled data, and provide a new technical means for transformer fault diagnosis.
[0004] Based on this background, by using deep learning networks to achieve interactive fusion of features, it is possible to fully capture the time-frequency characteristics of fault signals and accurately determine the fault state of the transformer based on these characteristics. This type of technology provides strong support for intelligent diagnosis and predictive maintenance of transformers in complex operating environments, and is expected to significantly improve the safety and operating efficiency of power systems. Summary of the invention
[0005] The present invention provides a transformer fault diagnosis method based on a time-frequency domain feature interactive fusion network, which is used to give full play to the advantages of convolutional neural networks and attention mechanisms, efficiently collect complementary features and realize efficient interaction between time domain and frequency domain signals, and realize fast and accurate transformer fault diagnosis classification.
[0006] The technical solution of the present invention is: a transformer fault diagnosis method based on a time-frequency domain feature interactive fusion network, the method comprising: constructing a time-frequency domain feature interactive fusion network model, and training it using a training set, the model output passes through a fully connected layer and performs fault classification through Softmax; the specific steps of constructing the time-frequency domain feature interactive fusion network model include:
[0007] Step 1: Process the input one-dimensional fault sequence data into time domain and frequency domain data. The two sets of data are respectively subjected to feature extraction through one-dimensional convolution blocks to extract the features X in the time domain and frequency domain. t and X f ;
[0008] Step 2: Construct a mutual attention mechanism to make the time domain and frequency domain features X t and X f Participate in each other's feature extraction process; the mutual attention mechanism includes the frequency domain feature guided time domain feature extraction block and the time domain feature guided frequency domain feature extraction block;
[0009] Step 3: Construct a two-stage Transformer, which includes a dual-branch encoder, a cross-modal encoder, and a time-frequency contrast loss function.
[0010] Furthermore, in the process of constructing the time-frequency domain feature interactive fusion network model, the dataset used is obtained in the following way:
[0011] Step 1, data collection: collect characteristic gas data sets dissolved in transformer oil with marked fault types;
[0012] Step 2, data cleaning: remove errors and invalid data in the data set through data cleaning;
[0013] Step 3, data balancing: use SMOTEENN method to oversample and downsample to process unbalanced data;
[0014] Step 4, data selection and division: Fault type judgment is performed based on the three-pair value coding combination of the gas, and then 80% of the data processed in Step 2 is randomly sampled as a training set, and 20% of the data is randomly sampled as a test set.
[0015] Furthermore, in Step 1, the characteristic gas data set dissolved in the transformer oil includes six types of fault types, namely, high temperature overheating, medium temperature overheating, low temperature overheating, arc discharge, partial discharge and low energy discharge; the data set sources include public data sets and transformer fault gas concentration data collected from databases and related literature.
[0016] Furthermore, in Step 3, the SMOTEENN method is a method that combines the SMOTE oversampling technology and the ENN downsampling technology; the process of SMOTE oversampling is: the SMOTE algorithm generates new minority class samples by interpolating minority class samples; for each minority class sample, a neighbor is randomly selected from its k nearest neighbor minority class samples, and then a point is randomly selected on the line between the two samples to generate a new minority class sample;
[0017] The ENN downsampling process is as follows: the ENN algorithm reduces noise and overfitting by deleting minority class samples surrounded by majority class samples in the k nearest neighbors. For each sample, if most of its k nearest neighbors belong to different samples, the sample is deleted.
[0018] Further, in step 1, the one-dimensional convolution block is composed of two parallel branches, which are used to gradually extract the features of the input data and perform normalization processing; the upper branch first performs preliminary feature extraction through a 4×1 convolution layer; then applies the ReLU activation function to enhance the nonlinear features; then normalizes the output through a normalization layer; then further compresses and extracts features through a 1×1 convolution layer; applies the ReLU activation function again, and passes through another normalization layer; the lower branch directly applies the ReLU activation function to the input data, and then performs normalization processing through a normalization layer; finally, the outputs of the two branches are merged and further processed through a 4×1 convolution layer; the final result passes through the ReLU activation function and the normalization layer to obtain the time domain features and frequency domain features X t ,X f ∈R m×K , where m×K means there are m samples and the dimension of each sample is K.
[0019] Furthermore, the step 2 comprises:
[0020] (1) The processing process of the frequency domain feature guided time domain feature extraction block is as follows:
[0021] For the time domain feature X t To do the transposition:
[0022] X' t =Trans(X t ),X t ,X' t ∈RK×m
[0023] Where Trans(*) represents the transposition operation;
[0024] Then X' t Multiply by the frequency domain feature X f as follows:
[0025] X=X' t ×X f ,X∈R K×K
[0026] Then input feature X into the average pooling layer for dimensionality reduction and alignment:
[0027] X'=AverPool(X),X'∈R 1×K
[0028] Among them, X' represents the input feature matrix, AverPool() represents the average pooling layer, 1×K means there is one sample, and the number of dimensions of each sample is K;
[0029] Then use a one-dimensional convolution layer and a batch normalization layer to get the attention coefficient:
[0030] W1=BN(f(b+Conv1D(w,X'))),W1∈R 1×K
[0031] Among them, BN() is a batch normalization operation, f() represents an activation function, Conv1D() is a one-dimensional convolution operation, b is the bias term in the convolution operation, and w is the weight of the convolution operation;
[0032] A padding operation is applied in the one-dimensional convolutional layer to ensure that the dimensions of the input and output are consistent. The attention coefficient W1 is then used to adjust the temporal features X t To perform weighting:
[0033] X t_out =X t ×W1
[0034] Among them, X t_out represents the output of the frequency domain feature guided time domain feature extraction block;
[0035] (2) Construct a time domain feature-guided frequency domain feature extraction block. The calculation process is the same as that of the frequency domain feature-guided time domain feature extraction block. The time domain feature X t Participated in the frequency domain feature X f The feature extraction process;
[0036] X f_out =X f ×W2
[0037] Among them, X f_out represents the output of the time domain feature guided frequency domain feature extraction block, X f represents the frequency domain feature, W2 is the attention coefficient, and the calculation process is the same as W1.
[0038] Furthermore, the step 3 comprises:
[0039] Step 3.1, construct a dual-branch encoder including a time domain encoder and a frequency domain encoder to extract features from the time domain and the frequency domain; the time domain encoder and the frequency domain encoder have the same structure, and the encoder is composed of N stacked Transformer encoder layers, and the encoder layer includes a multi-head self-attention module, layer normalization, and a feedforward network;
[0040] Step 3.2: Construct a time-frequency contrast loss function to gradually align the time and frequency domain features of the positive sample pair, while the features of the negative sample pair tend to be different, which is used to promote the subsequent time-frequency domain feature interaction; achieve the consistency of the time-frequency domain features by minimizing the time-frequency contrast loss function; use symmetric loss to compare features;
[0041] Step 3.3: Build a cross-modal encoder to enable synchronous learning and seamless fusion of time domain and frequency domain features to achieve deep feature fusion.
[0042] Step 3.4: The features finally output by the cross-modal encoder are input into the fully connected layer and fault classification is performed through Softmax.
[0043] Furthermore, the processing of the time domain encoder is as follows:
[0044] Given a time domain signal as input, we first generate an embedding representation through linear projection. Then, we add a learnable [Class] embedding and superimpose a learnable position embedding before the generated embedding representation to construct a complete time embedding sequence T0. The output state of the [Class] embedding is used to calculate the feature representation of the time-frequency contrast loss, while the position embedding gives the model the ability to capture the sequence order information. The above process is expressed as:
[0045] T0=[T class ; T 1 W; T 2 W; ...; T N W]+pos
[0046] Where T0 represents the time embedding sequence of the input temporal encoder, T class represents [Class] embedding, pos represents position embedding, W represents linear projection, T N It represents the output of the Nth layer Transformer encoder;
[0047] The processing process of the frequency domain encoder is the same as that of the time domain encoder; given the frequency domain signal as input, after processing, the frequency embedding sequence F0 is obtained;
[0048] Afterwards, the time embedding sequence T0 is input into the time encoder, and the encoding process is expressed as:
[0049] T′ n =LN(MSA(T n-1 ))+T n-1 ,n=1,2,...,N
[0050] T n =LN(FFN(T′ n ))+T′ n ,n=1,2,...,N
[0051] h t =T N
[0052] Among them, h t and T N represents the time domain output embedding sequence obtained after T0 passes through the N-layer Transformer encoder; similarly, the frequency embedding sequence F0 is input into the frequency encoder, and the frequency domain output embedding sequence h is obtained through the frequency encoder. f =F N , T' n It is the intermediate output in the nth layer of Transformer, indicating the result of the input of the current layer being processed by the multi-head self-attention module MSA and then added with residual connection; N is the number of layers of the Transformer encoder, a total of N layers; MSA is the multi-head self-attention module, LN is the layer normalization, and FFN is the feedforward network;
[0053] Output [Class] embedding in the embedding sequence is input into the projection block and prediction block to generate the temporal query q t and frequency domain query q f :
[0054]
[0055] in, After passing through N layers of time-domain Transformer encoders, the final output is T N The first element in ; After passing through N layers of frequency domain Transformer encoder, the final output is F N The first element in ; Pre() and pro() represent the projection block and the prediction block, both of which are feedforward networks, the subscript t represents the time domain, and the subscript f represents the frequency domain.
[0056] Furthermore, the time-frequency contrast loss function L TFC It is expressed as:
[0057]
[0058] Where B represents the batch size, τ is the temperature hyperparameter of l2-normalization, represents the time domain query value, the time domain feature representation of the i-th sample; represents the frequency domain query value, the frequency domain feature representation of the i-th sample; represents the time domain key value, the time domain feature representation of the i-th sample; represents the frequency domain key value, the frequency domain feature representation of the i-th sample; L t and L f They represent the time domain contrast loss and the frequency domain contrast loss respectively.
[0059] Furthermore, the cross-modal encoder is designed as a parallel structure. Different from the dual-branch encoder, the two time-domain encoders of the cross-modal encoder have an information interaction mechanism. Each time-domain encoder introduces an additional multi-head cross-attention module MCA between the multi-head self-attention module and the feedforward network. The internal structure of this module is the same as that of the multi-head self-attention, but its input comes from the time domain and frequency domain modalities, and a multi-head cross-attention mechanism is implemented.
[0060] Given h from the dual encoder t and h f , the processing of the cross-modal encoder is expressed as:
[0061] FF′ n =FFN(MSA(FF′ n-1 )),n=1,2,...,N;FF0′=h f
[0062] TT′ n =LN(MSA(TT n-1 ))+TT n-1 ,n=1,2,...,N;TT0′=h t
[0063] TT″ n =LN(MCA(TT′ n ,FF′ n ))+TT′ n ,n=1,2,...,N
[0064] TT n =LN(FFN(TT″ n ))+TT″ n ,n=1,2,...,N
[0065] Among them, FF' n is the output feature of the frequency domain encoder at layer n, FF' n It is obtained from the previous layer feature FF' through multi-head self-attention MSA and feed-forward network FFN n-1 Updated, initial value is FF'0=h f ;FF' n-1 is the output feature of the frequency domain encoder at the n-1th layer, which is used as the input of the nth layer; FF'0 is the initial input of the frequency domain encoder, which comes from the output of the frequency domain feature encoder; h f is the input feature of the frequency domain encoder; TT n Represents the final output feature of the nth layer of the time domain encoder, TT n The results of the fusion of cross attention and feedforward network, which combines the results of cross attention MCA and feedforward network FFN; TT n-1 is the final output feature of the n-1 layer of the time domain encoder, which serves as the input of the nth layer; TT' n It is the intermediate feature of the nth layer of the time domain encoder, generated after the multi-head self-attention MSA mechanism, and obtained from the previous layer TT n-1 It is obtained by extracting the global features within the time domain; TT'0 is the initial input of the time domain encoder, and the output from the time domain feature encoder. TT'0 represents the initial time domain embedding feature: TT'0 = h t ;h t Represents the input features of the time domain encoder; TT" n It is the intermediate feature of the nth layer of the time domain encoder, generated after the multi-head cross attention MCA mechanism; MSA is the multi-head self-attention module; MCA is the multi-head cross attention module.
[0066] The beneficial effects of the present invention are:
[0067] 1. The present invention constructs a novel time-frequency domain feature interactive fusion network architecture, realizes efficient interaction between different signal modes (time domain and frequency domain signals), and significantly improves the performance of transformer fault diagnosis tasks;
[0068] 2. The present invention proposes an improved mutual attention mechanism for feature extraction. By using a convolutional layer instead of a fully connected layer to achieve the conversion of attention coefficients, the importance information of different feature maps can be further mined, making the calculated coefficients more effective;
[0069] 3. This paper introduces a two-stage Transformer architecture, which can perform deep feature extraction and fusion from paired time-frequency domain data, and use time-frequency contrast loss to achieve interaction between time-frequency signals, thereby driving the model to learn richer information representation;
[0070] 4. The present invention improves the feature expression capability, reduces the risk of overfitting, and improves the accuracy and efficiency of fault diagnosis, and can be used in the field of transformer operation and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 It is a schematic diagram of the overall process of the present invention;
[0072] Figure 2 It is a schematic diagram of the structure of the network based on the interactive fusion of time-frequency domain features in the present invention;
[0073] Figure 3 Schematic diagram of the structure of a one-dimensional convolution block in the present invention;
[0074] Figure 4 It is a schematic diagram of the time-frequency contrast loss calculation process in the present invention. DETAILED DESCRIPTION
[0075] Example 1: Figure 1-Figure 4 As shown, a transformer fault diagnosis method based on a time-frequency domain feature interactive fusion network, the method steps include:
[0076] Step 1. Data collection: Collect a dataset of characteristic gases dissolved in transformer oil with marked fault types; the dataset of characteristic gases dissolved in transformer oil includes six types of fault types: high-temperature overheating, medium-temperature overheating, low-temperature overheating, arc discharge, partial discharge and low-energy discharge; the dataset sources include public datasets and transformer fault gas concentration data collected from databases and related literature.
[0077] Step 2, data cleaning: remove errors and invalid data in the data set through data cleaning; clean the data in the collected dissolved characteristic gas data set file. Use the pandas library function to process missing values, outliers, and duplicates, and delete missing values, outliers, and duplicates;
[0078] Step 3, data balancing: Use the SMOTEENN method to perform oversampling and downsampling to process unbalanced data; the SMOTEENN method is a method that combines the SMOTE oversampling technology and the ENN downsampling technology; the SMOTE oversampling process is: the SMOTE algorithm generates new minority class samples by interpolating minority class samples; for each minority class sample, randomly select a neighbor from its k nearest neighbor minority class samples, and then randomly select a point on the line between the two samples to generate a new minority class sample;
[0079] The ENN downsampling process is as follows: the ENN algorithm reduces noise and overfitting by deleting minority class samples surrounded by majority class samples in the k nearest neighbors. For each sample, if most of its k nearest neighbors belong to different samples, the sample is deleted.
[0080] Step 4, data selection and division: for the original characteristic gas H2, CH4, C2H6, C2H4, C2H2 content of the data set, the three contrast values CH4 / H2, C2H4 / C2H6, C2H2 / C2H4 coding combination of the five characteristic gases H2, CH4, C2H6, C2H4, C2H2 are used to judge the fault type. Finally, 80% of the data processed in Step 2 are randomly sampled as a training set and 20% as a test set to verify the accuracy and rationality of the analysis model.
[0081] The three ratio values of five characteristic gases H2, CH4, C2H6, C2H4, and C2H2, CH4 / H2, C2H4 / C2H6, and C2H2 / C2H4, are used to judge the fault type, effectively improving the accuracy of fault diagnosis. The three ratio method coding rules and fault type judgment methods are shown in the following table:
[0082]
[0083]
[0084] Step 5: Build a time-frequency domain feature interaction fusion network model and use the training set for training. Extract feature representations from the data and adjust the importance of features to make the model more focused on key features. Input the preprocessed and labeled data into the time-frequency domain feature interaction fusion network to learn discriminative features. Figure 2 The time-frequency domain feature interaction fusion network model includes multiple convolution modules, an improved mutual attention mechanism, and a two-stage Transformer architecture; the model output passes through a fully connected layer and performs fault classification through Softmax; the specific steps of constructing the time-frequency domain feature interaction fusion network model include:
[0085] Step 1: Process the input one-dimensional fault sequence data into time domain and frequency domain data. The two sets of data are respectively subjected to feature extraction through one-dimensional convolution blocks to extract the features X in the time domain and frequency domain. t and X f ;
[0086] Reference Figure 3In step 1, the one-dimensional convolution block consists of two parallel branches, which are used to gradually extract the features of the input data and perform normalization processing; the upper branch first performs preliminary feature extraction through a 4×1 convolution layer; then applies the ReLU activation function to enhance the nonlinear features; then normalizes the output through a normalization layer; then further compresses and extracts features through a 1×1 convolution layer; applies the ReLU activation function again, and passes through another normalization layer; the lower branch directly applies the ReLU activation function to the input data, and then performs normalization processing through a normalization layer; finally, the outputs of the two branches are merged and further processed through a 4×1 convolution layer; the final result passes through the ReLU activation function and the normalization layer to obtain the time domain features and frequency domain features X t ,X f ∈R m×K , where m×K means there are m samples and the dimension of each sample is K.
[0087] Step 2: Construct a mutual attention mechanism to make the time domain and frequency domain features X t and X f Participate in each other's feature extraction process; the mutual attention mechanism includes the frequency domain feature guided time domain feature extraction block and the time domain feature guided frequency domain feature extraction block;
[0088] Furthermore, the step 2 comprises:
[0089] (1) The processing process of the frequency domain feature guided time domain feature extraction block is as follows:
[0090] For the time domain feature X t To do the transposition:
[0091] X' t =Trans(X t ),X t ,X' t ∈R K×m
[0092] Where Trans(*) represents the transposition operation;
[0093] Then X' t Multiply by the frequency domain feature X f as follows:
[0094] X=X' t ×X f ,X∈R K×K
[0095] Then input feature X into the average pooling layer for dimensionality reduction and alignment:
[0096] X'=AverPool(X),X'∈R 1×K
[0097] Among them, X' represents the input feature matrix, AverPool() represents the average pooling layer, 1×K means there is one sample, and the number of dimensions of each sample is K;
[0098] Then use a one-dimensional convolution layer and a batch normalization layer to get the attention coefficient:
[0099] W1=BN(f(b+Conv1D(w,X'))),W1∈R 1×K
[0100] Among them, BN() is a batch normalization operation, f() represents an activation function, Conv1D() is a one-dimensional convolution operation, b is the bias term in the convolution operation, and w is the weight of the convolution operation;
[0101] A padding operation is applied in the one-dimensional convolutional layer to ensure that the dimensions of the input and output are consistent. The attention coefficient W1 is then used to adjust the temporal features X t To perform weighting:
[0102] X t_out =X t ×W1
[0103] Among them, X t_out represents the output of the frequency domain feature guided time domain feature extraction block;
[0104] Due to the mutual attention mechanism, X f Participated in X t In addition, the convolutional layer is used instead of the fully connected layer in the improved attention mechanism to realize the conversion of attention coefficients, which can more deeply explore the importance information of different feature maps and make the calculated coefficients more effective.
[0105] (2) Construct a time domain feature-guided frequency domain feature extraction block. The calculation process is the same as that of the frequency domain feature-guided time domain feature extraction block. The time domain feature X t Participated in the frequency domain feature X f The feature extraction process;
[0106] X f_out =X f ×W2
[0107] Among them, X f_out represents the output of the time domain feature guided frequency domain feature extraction block, X f represents the frequency domain feature, W2 is the attention coefficient, and the calculation process is the same as W1.
[0108] Step 3: Construct a two-stage Transformer, which includes a dual-branch encoder, a cross-modal encoder, and a time-frequency contrast loss function.
[0109] Furthermore, the step 3 comprises:
[0110] Step 3.1, construct a dual-branch encoder including a time domain encoder and a frequency domain encoder to extract features from the time domain and the frequency domain; the time domain encoder and the frequency domain encoder have the same structure, and the encoder is composed of N stacked Transformer encoder layers, and the encoder layer includes a multi-head self-attention module, layer normalization, and a feedforward network;
[0111] Step 3.2: Construct a time-frequency contrast loss function to gradually align the time and frequency domain features of the positive sample pair, while the features of the negative sample pair tend to be different, which is used to promote the subsequent time-frequency domain feature interaction; achieve the consistency of the time-frequency domain features by minimizing the time-frequency contrast loss function; use symmetric loss to compare features;
[0112] Step 3.3: Build a cross-modal encoder to enable synchronous learning and seamless fusion of time domain and frequency domain features to achieve deep feature fusion.
[0113] Step 3.4: The features finally output by the cross-modal encoder are input into the fully connected layer and fault classification is performed through Softmax.
[0114] Furthermore, the processing of the time domain encoder is as follows:
[0115] Given a time domain signal as input, we first generate an embedding representation through linear projection. Then, we add a learnable [Class] embedding and superimpose a learnable position embedding before the generated embedding representation to construct a complete time embedding sequence T0. The output state of the [Class] embedding is used to calculate the feature representation of the time-frequency contrast loss, while the position embedding gives the model the ability to capture the sequence order information. The above process is expressed as:
[0116] T0=[T class ; T 1 W; T 2 W; ...; T N W]+pos
[0117] Where T0 represents the time embedding sequence of the input temporal encoder, T class represents [Class] embedding, pos represents position embedding, W represents linear projection, T N It represents the output of the Nth layer Transformer encoder;
[0118] The processing process of the frequency domain encoder is the same as that of the time domain encoder; given the frequency domain signal as input, after processing, the frequency embedding sequence F0 is obtained;
[0119] Afterwards, the time embedding sequence T0 is input into the time encoder, and the encoding process is expressed as:
[0120] T′ n =LN(MSA(T n-1 ))+T n-1 ,n=1,2,...,N
[0121] T n =LN(FFN(T′ n ))T′ n ,n=1,2,...,N
[0122] h t =T N
[0123] Among them, h t and T N represents the time domain output embedding sequence obtained after T0 passes through the N-layer Transformer encoder; similarly, the frequency embedding sequence F0 is input into the frequency encoder, and the frequency domain output embedding sequence h is obtained through the frequency encoder. f =F N , T' n It is the intermediate output in the nth layer of Transformer, indicating the result of the input of the current layer being processed by the multi-head self-attention module MSA and then added with residual connection; N is the number of layers of the Transformer encoder, a total of N layers; MSA is the multi-head self-attention module, LN is the layer normalization, and FFN is the feedforward network;
[0124] Output [Class] embedding in the embedding sequence is input into the projection block and prediction block to generate the temporal query q t and frequency domain query q f :
[0125]
[0126] in, After passing through N layers of time-domain Transformer encoders, the final output is T N The first element in ; After passing through N layers of frequency domain Transformer encoder, the final output is F N The first element in; Pre() and pro() represent the projection block and the prediction block, both of which are feedforward networks, the subscript t represents the time domain, and the subscript f represents the frequency domain;
[0127] Further, refer to Figure 4 In order to utilize the consistency of time-frequency domain features, this is achieved by minimizing the time-frequency contrast loss function, which is improved from the InfoNCE loss. In order to better contrast features, a symmetric loss is used. The time-frequency contrast loss function L TFC It is expressed as:
[0128]
[0129] Where B represents the batch size, τ is the temperature hyperparameter of l2-normalization, represents the time domain query value, the time domain feature representation of the i-th sample; represents the frequency domain query value, the frequency domain feature representation of the i-th sample; represents the time domain key value, the time domain feature representation of the i-th sample; represents the frequency domain key value, the frequency domain feature representation of the i-th sample; L t and L f Represent the time domain contrast loss and frequency domain contrast loss respectively. Through this loss, the time domain and frequency domain features of the positive sample pairs are gradually aligned, while the features of the negative sample pairs tend to be different, which promotes the subsequent time-frequency domain feature interaction.
[0130] The cross-modal encoder is designed as a parallel structure. Such a design aims to treat the two modalities as equally important, so that the time domain and frequency domain features can be learned synchronously and seamlessly integrated. The parallel cross-modal attention mechanism can achieve deep feature fusion; unlike the dual-branch encoder, the two time domain encoders of the cross-modal encoder have an information interaction mechanism. In order to fully utilize the complementarity of time-frequency domain features, a cross-modal model is constructed to fuse features. Unlike the dual-branch encoder, the two encoders of this model have an information interaction mechanism. Specifically, each time domain encoder introduces an additional multi-head cross attention module MCA between the multi-head self-attention module and the feedforward network. The internal structure of this module is the same as that of the multi-head self-attention, but its input comes from the time domain and frequency domain modalities, and a multi-head cross attention mechanism is implemented.
[0131] Given h from the dual encoder t and h f , the processing of the cross-modal encoder is expressed as:
[0132] FF′ n =FFN(MSA(FF′ n-1 )),n=1,2,...,N;FF0′=h f
[0133] TT′ n =LN(MSA(TT n-1 ))+TTn-1 ,n=1,2,...,N;TT0′=h t
[0134] TT″ n =LN(MCA(TT′ n ,FF′ n ))+TT′ n ,n=1,2,...,N
[0135] TT n =LN(FFN(TT″ n ))+TT″ n ,n=1,2,...,N
[0136] Among them, FF' n is the output feature of the frequency domain encoder at layer n, FF' n It is obtained from the previous layer feature FF' through multi-head self-attention MSA and feed-forward network FFN n-1 Updated, initial value is FF'0=h f ;FF' n-1 is the output feature of the frequency domain encoder at the n-1th layer, which is used as the input of the nth layer; FF'0 is the initial input of the frequency domain encoder, which comes from the output of the frequency domain feature encoder; h f is the input feature of the frequency domain encoder; TT n Represents the final output feature of the nth layer of the time domain encoder, TT n The results of the fusion of cross attention and feedforward network, which combines the results of cross attention MCA and feedforward network FFN; TT n-1 is the final output feature of the n-1 layer of the time domain encoder, which serves as the input of the nth layer; TT' n It is the intermediate feature of the nth layer of the time domain encoder, generated after the multi-head self-attention MSA mechanism, and obtained from the previous layer TT n-1 It is obtained by extracting the global features within the time domain; TT'0 is the initial input of the time domain encoder, and the output from the time domain feature encoder. TT'0 represents the initial time domain embedding feature: TT'0 = h t ;h t Represents the input features of the time domain encoder; TT" n It is the intermediate feature of the nth layer of the time domain encoder, generated after the multi-head cross attention MCA mechanism; MSA is the multi-head self-attention module; MCA is the multi-head cross attention module.
[0137] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.
Claims
1. A transformer fault diagnosis method based on a time-frequency domain feature interactive fusion network, characterized in that: The method comprises: constructing a time-frequency domain feature interactive fusion network model, and using a training set for training, the model output passes through a fully connected layer and performs fault classification through Softmax; the specific steps of constructing the time-frequency domain feature interactive fusion network model include: Step 1: Process the input one-dimensional fault sequence data into time domain and frequency domain data. The two sets of data are respectively subjected to feature extraction through one-dimensional convolution blocks to extract the features X in the time domain and frequency domain. t and X f ; Step 2: Construct a mutual attention mechanism to make the time domain and frequency domain features X t and X f Participate in each other's feature extraction process; the mutual attention mechanism includes the frequency domain feature guided time domain feature extraction block and the time domain feature guided frequency domain feature extraction block; Step 3: Construct a two-stage Transformer, which includes a dual-branch encoder, a cross-modal encoder, and a time-frequency contrast loss function.
2. The transformer fault diagnosis method based on the time-frequency domain feature interactive fusion network according to claim 1 is characterized in that: In the process of building the time-frequency domain feature interactive fusion network model, the dataset used is obtained in the following way: Step 1, data collection: collect characteristic gas data sets dissolved in transformer oil with marked fault types; Step 2, data cleaning: remove errors and invalid data in the data set through data cleaning; Step 3, data balancing: use SMOTEENN method to oversample and downsample to process unbalanced data; Step 4, data selection and division: Fault type judgment is performed based on the three-pair value coding combination of the gas, and then 80% of the data processed in Step 2 is randomly sampled as a training set, and 20% of the data is randomly sampled as a test set.
3. The transformer fault diagnosis method based on the time-frequency domain feature interactive fusion network according to claim 2 is characterized in that: In Step 1, the characteristic gas data set dissolved in the transformer oil includes six types of fault types, namely, high temperature overheating, medium temperature overheating, low temperature overheating, arc discharge, partial discharge and low energy discharge; the data set sources include public data sets and transformer fault gas concentration data collected from databases and relevant literature.
4. The transformer fault diagnosis method based on the time-frequency domain feature interactive fusion network according to claim 2 is characterized in that: In the Step 3, the SMOTEENN method is a method that combines the SMOTE oversampling technology and the ENN downsampling technology; the process of SMOTE oversampling is: the SMOTE algorithm generates new minority class samples by interpolating minority class samples; for each minority class sample, a neighbor is randomly selected from its k nearest neighbor minority class samples, and then a point is randomly selected on the line between the two samples to generate a new minority class sample; The ENN downsampling process is as follows: the ENN algorithm reduces noise and overfitting by deleting minority class samples surrounded by majority class samples in the k nearest neighbors. For each sample, if most of its k nearest neighbors belong to different samples, the sample is deleted.
5. The transformer fault diagnosis method based on the time-frequency domain feature interactive fusion network according to claim 1 is characterized in that: In step 1, the one-dimensional convolution block is composed of two parallel branches, which are used to gradually extract the features of the input data and perform normalization processing; the upper branch first performs preliminary feature extraction through a 4×1 convolution layer; then applies the ReLU activation function to enhance the nonlinear features; then standardizes the output through a normalization layer; and then further compresses and extracts features through a 1×1 convolution layer; The ReLU activation function is applied again and passed through another normalization layer; the lower branch directly applies the ReLU activation function to the input data, and then normalizes it through the normalization layer; finally, the outputs of the two branches are merged and further processed through a 4×1 convolution layer; the final result passes through the ReLU activation function and the normalization layer to obtain the time domain feature and frequency domain feature X t ,X f ∈R m×K , where m×K means there are m samples and the dimension of each sample is K.
6. The transformer fault diagnosis method based on the time-frequency domain feature interactive fusion network according to claim 1 is characterized in that: The step 2 comprises: (1) The processing process of the frequency domain feature guided time domain feature extraction block is as follows: For the time domain feature X t To do the transposition: X' t =Trans(X t ),Xt,X' t ∈R K×m Where Trans(*) represents the transposition operation; Then X' t Multiply by the frequency domain feature X f as follows: X=X' t ×X f ,X∈R K×K Then input feature X into the average pooling layer for dimensionality reduction and alignment: X'=AverPool(X),X'∈R 1×K Among them, X' represents the input feature matrix, AverPool() represents the average pooling layer, 1×K means there is one sample, and the number of dimensions of each sample is K; Then use a one-dimensional convolution layer and a batch normalization layer to get the attention coefficient: W1=BN(f(b+Conv1D(w,X'))),W1∈R 1×K Among them, BN() is a batch normalization operation, f() represents an activation function, Conv1D() is a one-dimensional convolution operation, b is the bias term in the convolution operation, and w is the weight of the convolution operation; A padding operation is applied in the one-dimensional convolutional layer to ensure that the dimensions of the input and output are consistent. The attention coefficient W1 is then used to adjust the temporal features X t To perform weighting: X t_out =X t ×W1 Among them, X t_out represents the output of the frequency domain feature guided time domain feature extraction block; (2) Construct a time domain feature-guided frequency domain feature extraction block. The calculation process is the same as that of the frequency domain feature-guided time domain feature extraction block. The time domain feature X t Participated in the frequency domain feature X f The feature extraction process; X f_out =X f ×W2 Among them, X f_out represents the output of the time domain feature guided frequency domain feature extraction block, X f represents the frequency domain feature, W2 is the attention coefficient, and the calculation process is the same as W1.
7. The transformer fault diagnosis method based on the time-frequency domain feature interactive fusion network according to claim 1 is characterized in that: The step 3 comprises: Step 3.1, construct a dual-branch encoder including a time domain encoder and a frequency domain encoder to extract features from the time domain and the frequency domain; the time domain encoder and the frequency domain encoder have the same structure, and the encoder is composed of N stacked Transformer encoder layers, and the encoder layer includes a multi-head self-attention module, layer normalization, and a feedforward network; Step 3.2: Construct a time-frequency contrast loss function to gradually align the time and frequency domain features of the positive sample pair, while the features of the negative sample pair tend to be different, which is used to promote the subsequent time-frequency domain feature interaction; achieve the consistency of the time-frequency domain features by minimizing the time-frequency contrast loss function; use symmetric loss to compare features; Step 3.3: Build a cross-modal encoder to enable synchronous learning and seamless fusion of time domain and frequency domain features to achieve deep feature fusion. Step 3.4: The features finally output by the cross-modal encoder are input into the fully connected layer and fault classification is performed through Softmax.
8. The transformer fault diagnosis method based on the time-frequency domain feature interactive fusion network according to claim 7 is characterized in that: The processing of the time domain encoder is as follows: Given a time domain signal as input, we first generate an embedding representation through linear projection. Then, we add a learnable [Class] embedding and superimpose a learnable position embedding before the generated embedding representation to construct a complete time embedding sequence T0. The output state of the [Class] embedding is used to calculate the feature representation of the time-frequency contrast loss, while the position embedding gives the model the ability to capture the sequence order information. The above process is expressed as: T0=[T class ;T 1 W;T 2 W;...;T N W]+pos Where T0 represents the time embedding sequence of the input temporal encoder, T class represents [Class] embedding, pos represents position embedding, W represents linear projection, T N It represents the output of the Nth layer Transformer encoder; The processing process of the frequency domain encoder is the same as that of the time domain encoder; given the frequency domain signal as input, after processing, the frequency embedding sequence F0 is obtained; Afterwards, the time embedding sequence T0 is input into the time encoder, and the encoding process is expressed as: T′ n =LN(MSA(T n-1 ))+T n-1 ,n=1,2,...,N T n =LN(FFN(T′ n ))+T′ n ,n=1,2,...,N h t =T N Among them, h t and T N represents the time domain output embedding sequence obtained after T0 passes through the N-layer Transformer encoder; similarly, the frequency embedding sequence F0 is input into the frequency encoder, and the frequency domain output embedding sequence h is obtained through the frequency encoder. f =F N , T' n It is the intermediate output in the nth layer of Transformer, indicating the result of the input of the current layer being processed by the multi-head self-attention module MSA and then added with residual connection; N is the number of layers of the Transformer encoder, a total of N layers; MSA is the multi-head self-attention module, LN is the layer normalization, and FFN is the feedforward network; Output [Class] embedding in the embedding sequence is input into the projection block and prediction block to generate the temporal query q t and frequency domain query q f : in, After passing through N layers of time-domain Transformer encoders, the final output is T N The first element in ; After passing through N layers of frequency domain Transformer encoder, the final output is F N The first element in ; Pre() and pro() represent the projection block and the prediction block, both of which are feedforward networks, the subscript t represents the time domain, and the subscript f represents the frequency domain.
9. The transformer fault diagnosis method based on the time-frequency domain feature interactive fusion network according to claim 1 is characterized in that: Time-frequency contrast loss function L TFC It is expressed as: Where B represents the batch size, τ is the temperature hyperparameter of l2-normalization, represents the time domain query value, the time domain feature representation of the i-th sample; represents the frequency domain query value, the frequency domain feature representation of the i-th sample; represents the time domain key value, the time domain feature representation of the i-th sample; represents the frequency domain key value, the frequency domain feature representation of the i-th sample; L t and L f They represent the time domain contrast loss and the frequency domain contrast loss respectively.
10. The transformer fault diagnosis method based on the time-frequency domain feature interactive fusion network according to claim 1 is characterized in that: The cross-modal encoder is designed as a parallel structure. Different from the dual-branch encoder, the two time-domain encoders of the cross-modal encoder have an information interaction mechanism. Each time-domain encoder introduces an additional multi-head cross-attention module MCA between the multi-head self-attention module and the feedforward network. The internal structure of this module is the same as that of the multi-head self-attention, but its input comes from the time domain and frequency domain modalities, and a multi-head cross-attention mechanism is implemented. Given h from the dual encoder t and h f , the processing of the cross-modal encoder is expressed as: FF′ n =FFN(MSA(FF′ n-1 )),n=1,2,...,N;FF′0=h f TT′ n =LN(MSA(TT n-1 ))+TT n-1 ,n=1,2,...,N;TT′0=h t TT″ n =LN(MCA(TT′ n ,FF′ n ))+TT′ n ,n=1,2,...,N TT n =LN(FFN(TT″ n ))+TT″ n ,n=1,2,...,N Among them, FF' n is the output feature of the frequency domain encoder at layer n, FF' n It is obtained from the previous layer feature FF' through multi-head self-attention MSA and feed-forward network FFN n-1 Updated, initial value is FF'0=h f ;FF' n-1 is the output feature of the frequency domain encoder at the n-1th layer, which is used as the input of the nth layer; FF'0 is the initial input of the frequency domain encoder, which comes from the output of the frequency domain feature encoder; h f is the input feature of the frequency domain encoder; TT n Represents the final output feature of the nth layer of the time domain encoder, TT n The results of the fusion of cross attention and feedforward network, which combines the results of cross attention MCA and feedforward network FFN; TT n-1 is the final output feature of the n-1 layer of the time domain encoder, which serves as the input of the nth layer; TT' n It is the intermediate feature of the nth layer of the time domain encoder, generated after the multi-head self-attention MSA mechanism, and obtained from the previous layer TT n-1 It is obtained by extracting the global features within the time domain; TT'0 is the initial input of the time domain encoder, and the output from the time domain feature encoder. TT'0 represents the initial time domain embedding feature: TT'0 = h t ;h t Represents the input features of the time domain encoder; TT″ n It is the intermediate feature of the nth layer of the time domain encoder, generated after the multi-head cross attention MCA mechanism; MSA is the multi-head self-attention module; MCA is the multi-head cross attention module.
Citation Information
Cited By
Traction motor turn-to-turn short circuit fault detection method and device, medium and equipment
CN120595106A
Rotating machinery fault diagnosis method and system based on cross-modal time frequency perception
CN121580341A
A rotating machinery fault diagnosis method and system based on cross-modal time-frequency perception
CN121580341B
Partial discharge detection method based on adaptive feature extraction and cross-modal feature fusion
CN121633742A