Oil-immersed transformer fault diagnosis method, system, device and medium

By combining the improved SMOTE algorithm and feature attention mechanism with the Bi-LSTM model, the problems of data missingness and parameter optimization in fault diagnosis of oil-immersed transformers are solved, achieving more accurate fault diagnosis and improving the reliability of power grid safe operation.

CN120832567BActive Publication Date: 2026-07-10ECONOMIC TECH RES INST OF STATE GRID HENAN ELECTRIC POWER

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ECONOMIC TECH RES INST OF STATE GRID HENAN ELECTRIC POWER
Filing Date
2025-06-30
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing fault diagnosis methods for oil-immersed transformers become less accurate when data is missing, and parameter optimization methods are prone to getting trapped in local optima, ignoring the differences in the influence of gas on fault diagnosis.

Method used

An improved SMOTE algorithm and feature attention mechanism are combined with a Bi-LSTM model. Data is completed by using adversarial neural networks, the sparrow search algorithm is optimized to find the optimal parameters, and the feature attention mechanism is used for fault diagnosis.

Benefits of technology

It improves the accuracy of fault diagnosis, avoids information loss caused by missing data, dynamically captures the differences in the impact of gas on fault diagnosis, and prevents parameter optimization from getting stuck in local optima.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120832567B_ABST
    Figure CN120832567B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of oil-immersed transformer fault diagnosis, and discloses an oil-immersed transformer fault diagnosis method, system, device and medium. The method comprises the following steps: obtaining an initial data set of dissolved gas in oil of an oil-immersed transformer and filling and expanding the initial data set to obtain a target data set; finding the optimal value of the Bi-LSTM model parameter according to the optimized sparrow search algorithm; combining the optimal parameter Bi-LSTM model with a feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism; and performing transformer fault diagnosis based on the Bi-LSTM model under the feature attention mechanism and the target data set. The feature attention mechanism can dynamically capture the nonlinear relationship between the input features and the target variables, and accurately quantify the differences in the influence of different gases on fault diagnosis. The improved sparrow search algorithm prevents falling into a local optimal solution. After filling the missing data, fault diagnosis is performed, which avoids the loss of effective information and improves the accuracy of fault diagnosis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of oil-immersed transformer fault diagnosis technology, and in particular to a method, system, equipment and medium for oil-immersed transformer fault diagnosis. Background Technology

[0002] As a key piece of equipment in the power grid, transformers play a vital role in converting and transmitting electrical energy. When a transformer fails, it not only fails to perform its function of converting and transmitting electrical energy, but also causes significant economic losses and may even lead to safety accidents. Therefore, real-time monitoring of transformer operating status and the establishment of accurate and stable transformer fault diagnosis models are of great significance.

[0003] The current research progress on fault diagnosis of oil-immersed transformers is as follows:

[0004] For example, the Borderline-SMOTE algorithm is used to balance the collected imbalanced dataset and enhance the features of minority fault class samples. However, the prediction scheme mentioned in this approach has the following problems: ① While the Borderline-SMOTE algorithm can enhance the features of minority fault class samples, it lacks a clear discriminative strategy when selecting minority class samples, which may lead to a lack of specificity and marginalization in the process of generating new samples. ② Using the Optuna hyperparameter automatic optimizer to search for the optimal parameters of the gradient boosting decision tree is prone to getting trapped in local optima. ③ When data is missing, using this method will significantly reduce the accuracy of fault diagnosis.

[0005] For example, a weak classifier model based on a classification and regression tree is constructed and trained using additive learning. The classifier parameters are then optimized using a sparrow search algorithm to obtain an XGBoost fault diagnosis model for oil-immersed transformers. This model is then used to predict fault diagnoses based on the test data. However, this prediction method has the following problems: ① Although the sparrow search algorithm has good global search capabilities, it is still prone to getting trapped in local optima. ② The optimized XGBoost model is used to construct the model, but the differences in the importance of each gas are not considered, affecting the accuracy of the fault diagnosis results. ③ When data is missing, using this method will significantly reduce the accuracy of fault diagnosis.

[0006] In summary, with the rapid development of artificial intelligence and big data technologies in recent years, AI-based transformer fault diagnosis methods have gradually become a research hotspot in the field of transformer fault diagnosis. However, current research often suffers from the following common problems: 1. When data is missing, using this method significantly reduces the accuracy of fault diagnosis. 2. Existing parameter optimization methods are prone to getting trapped in local optima. 3. Current algorithms for fault diagnosis based on gas content ignore the differences in the impact of gases on fault diagnosis. Summary of the Invention

[0007] The main objective of this invention is to provide a method, system, device, and medium for diagnosing faults in oil-immersed transformers, aiming to solve at least one of the aforementioned technical problems.

[0008] To achieve the above objectives, the present invention provides a fault diagnosis method for oil-immersed transformers, comprising:

[0009] An initial dataset of dissolved gases in oil-immersed transformer oil is obtained, and the initial dataset is filled and expanded to obtain the target dataset.

[0010] The optimal values ​​of the Bi-LSTM model parameters are found using the optimized sparrow search algorithm, and the optimal parameter Bi-LSTM model is obtained.

[0011] The optimal parameter Bi-LSTM model is combined with the feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism;

[0012] The Bi-LSTM model based on the feature attention mechanism performs transformer fault diagnosis based on the target dataset.

[0013] In some embodiments, obtaining an initial dataset of dissolved gases in oil-immersed transformer oil, and then filling and expanding the initial dataset to obtain a target dataset, includes:

[0014] Obtain the dissolved gas content data in the oil of an oil-immersed transformer, and generate an initial dataset based on the content data;

[0015] The initial dataset is subjected to outlier removal, missing value labeling, and standardization to obtain sample data;

[0016] Classify the transformer fault types and assign a unique number to each category;

[0017] The sample data is filled in using an adversarial neural network to obtain a complete dataset with missing data.

[0018] The complete dataset after supplementing the missing data is scaled to the same scale to obtain the sample dataset;

[0019] The sample dataset is expanded using the improved SMOTE algorithm to obtain the target dataset.

[0020] In some embodiments, the step of expanding the sample dataset according to the improved SMOTE algorithm to obtain the target dataset includes:

[0021] The data in the sample dataset are clustered according to a clustering algorithm to identify minority class and majority class samples;

[0022] The minority class samples are divided into a core area and a boundary area, and the samples within the boundary area are further divided into dangerous samples, noise samples, and safe samples.

[0023] The core region, boundary region, and dangerous sample are expanded according to the improved SMOTE algorithm to obtain a synthetic sample;

[0024] The target dataset is generated based on the synthesized sample.

[0025] In some embodiments, the step of expanding the core region, boundary region, and hazardous sample according to the improved SMOTE algorithm to obtain a synthetic sample includes:

[0026] The core region of the minority class samples is expanded using the SMOTE algorithm to obtain the first synthetic sample;

[0027] The dangerous samples within the boundary region are expanded using the Borderline-SMOTE algorithm to obtain a second synthetic sample;

[0028] The dangerous samples were augmented using the Kernel-ADASYN algorithm to obtain a third synthetic sample;

[0029] A synthetic sample is obtained by fusing the first synthetic sample, the second synthetic sample, and the third synthetic sample.

[0030] In some embodiments, the step of finding the optimal values ​​of the Bi-LSTM model parameters according to the optimized sparrow search algorithm to obtain the optimal parameter Bi-LSTM model includes:

[0031] Initialize the parameters of the sparrow search algorithm and the Bi-LSTM model;

[0032] The sparrow search algorithm is optimized based on the sine and cosine strategies and the Cauchy mutation strategy, resulting in the optimized sparrow search algorithm.

[0033] The optimal values ​​of the Bi-LSTM model parameters are found using the optimized sparrow search algorithm, resulting in the optimal parameter Bi-LSTM model.

[0034] In some embodiments, combining the optimal parameter Bi-LSTM model with a feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism includes:

[0035] The attention score of each gas generated by a fault in an oil-immersed transformer is calculated based on a weighted function.

[0036] The weighted feature vectors of each gas generated by the fault in the oil-immersed transformer are calculated based on the attention score.

[0037] The final weighted eigenvector is calculated based on the weighted eigenvectors of all gases.

[0038] Based on the optimal parameter Bi-LSTM model and the final weighted feature vector, the Bi-LSTM model under the feature attention mechanism is obtained.

[0039] In some embodiments, the Bi-LSTM model based on the feature attention mechanism performs transformer fault diagnosis according to the target dataset, including:

[0040] The embedding vectors are obtained by mapping the target dataset to the word embedding space;

[0041] Based on the Bi-LSTM model bidirectional long short-term memory network under the feature attention mechanism and the embedding vector, the final feature representation is obtained;

[0042] Fault diagnosis is performed based on the fully connected layer classifier and the final feature representation to obtain the fault prediction results of the oil-immersed transformer.

[0043] Furthermore, to achieve the above objectives, the present invention also proposes an oil-immersed transformer fault diagnosis system, comprising:

[0044] The data acquisition module is used to acquire an initial dataset of dissolved gases in oil-immersed transformer oil, and to fill and expand the initial dataset to obtain a target dataset.

[0045] The parameter optimization module is used to find the optimal values ​​of the Bi-LSTM model parameters based on the optimized sparrow search algorithm, and obtain the optimal parameter Bi-LSTM model.

[0046] The model building module is used to combine the optimal parameter Bi-LSTM model with the feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism.

[0047] The fault diagnosis module is used to perform transformer fault diagnosis based on the target dataset using the Bi-LSTM model under the feature attention mechanism.

[0048] Furthermore, to achieve the above objectives, the present invention also proposes an electronic device comprising: a memory, a processor, and an oil-immersed transformer fault diagnosis program stored in the memory and executable on the processor, the oil-immersed transformer fault diagnosis program being configured to implement the oil-immersed transformer fault diagnosis method as described above.

[0049] Furthermore, to achieve the above objectives, the present invention also proposes a storage medium storing an oil-immersed transformer fault diagnosis program, which is used to enable a processor to implement the oil-immersed transformer fault diagnosis method as described above when executed.

[0050] This invention provides a fault diagnosis method for oil-immersed transformers, comprising: acquiring an initial dataset of dissolved gases in the transformer oil; imputing and expanding the initial dataset to obtain a target dataset; finding the optimal values ​​of Bi-LSTM model parameters using an optimized sparrow search algorithm to obtain an optimal parameter Bi-LSTM model; combining the optimal parameter Bi-LSTM model with a feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism; and performing transformer fault diagnosis based on the target dataset using the Bi-LSTM model under the feature attention mechanism. In this invention, the Bi-LSTM model under the feature attention mechanism can dynamically capture the nonlinear relationship between input features and target variables, thereby more accurately quantifying the differences in the impact of different gases on fault diagnosis. The sparrow search algorithm is improved to prevent it from getting trapped in local optima. By imputing missing data and then using the fault diagnosis algorithm, i.e., the Bi-LSTM model under the feature attention mechanism, for fault diagnosis, the loss of effective information can be avoided, the accuracy of fault diagnosis can be improved, and accurate fault diagnosis of transformers can be achieved, providing strong support for the safe operation of the power grid. Attached Figure Description

[0051] Figure 1 This is a schematic diagram of the structure of an electronic device in the hardware operating environment involved in the embodiments of the present invention;

[0052] Figure 2 This is a flowchart illustrating an embodiment of the oil-immersed transformer fault diagnosis method of the present invention;

[0053] Figure 3 This is an overall flowchart of the Bi-LSTM model algorithm based on the fusion-improved SMOTE algorithm and the feature self-attention mechanism involved in the embodiments of the present invention;

[0054] Figure 4 The image shows the fault diagnosis results of the Bi-LSTM model algorithm based on the fusion improved SMOTE algorithm and the feature self-attention mechanism involved in the embodiments of the present invention.

[0055] Figure 5 This is a graph showing the accuracy results of fault diagnosis for various types of transformers involved in the embodiments of the present invention.

[0056] Figure 6 This is a comparison chart of the accuracy of various algorithms involved in the embodiments of the present invention;

[0057] Figure 7 This is a structural block diagram of an embodiment of the oil-immersed transformer fault diagnosis system of the present invention.

[0058] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0059] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0060] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.

[0061] Furthermore, the use of terms such as "first" and "second" in this invention is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Additionally, the technical solutions of the various embodiments can be combined with each other, but only on the basis of being achievable by those skilled in the art. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention. It should be understood that the specific embodiments described herein are only for explaining the invention and are not intended to limit the invention.

[0062] Reference Figure 1 , Figure 1 This is a schematic diagram of the electronic device structure of the hardware operating environment involved in the embodiments of the present invention.

[0063] like Figure 1As shown, the electronic device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be high-speed random access memory (RAM) or stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.

[0064] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0065] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and an oil-immersed transformer fault diagnosis program.

[0066] exist Figure 1 In the electronic device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the electronic device of the present invention can be set in the electronic device, and the electronic device calls the oil-immersed transformer fault diagnosis program stored in the memory 1005 through the processor 1001 and executes the oil-immersed transformer fault diagnosis method provided in the embodiment of the present invention.

[0067] This invention proposes a method, system, equipment, and medium for fault diagnosis of oil-immersed transformers.

[0068] This invention provides a fault diagnosis method for oil-immersed transformers, referring to... Figure 2 , Figure 2 This is a flowchart illustrating an embodiment of the oil-immersed transformer fault diagnosis method of the present invention.

[0069] like Figure 2As shown, the fault diagnosis method for oil-immersed transformers includes:

[0070] Step S100: Obtain an initial dataset of dissolved gases in oil-immersed transformer oil, and fill and expand the initial dataset to obtain the target dataset;

[0071] Step S200: Find the optimal values ​​of the Bi-LSTM model parameters according to the optimized sparrow search algorithm, and obtain the optimal parameter Bi-LSTM model;

[0072] Step S300: Combine the optimal parameter Bi-LSTM model with the feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism;

[0073] Step S400: Based on the Bi-LSTM model under the feature attention mechanism, perform transformer fault diagnosis according to the target dataset.

[0074] It should be noted that the execution subject in this embodiment can be an electronic device, which can be a computer device with data processing function, or other devices that can achieve the same or similar functions. This embodiment does not limit this. In this embodiment, a computer device is used as an example for explanation.

[0075] Understandably, current research often suffers from the following common problems: 1. When data is missing, this method significantly reduces the accuracy of fault diagnosis. 2. Existing parameter optimization methods are prone to getting trapped in local optima. 3. Current algorithms for fault diagnosis based on gas content ignore the differences in the impact of gases on fault diagnosis. To fully address the shortcomings of existing research, this embodiment proposes a fault diagnosis method for oil-immersed transformers based on a fusion of the improved SMOTE algorithm and a Bi-LSTM model with a feature self-attention mechanism. The aim is to achieve accurate fault diagnosis of transformers by fusing the improved SMOTE algorithm and the Bi-LSTM model with a feature self-attention mechanism, thereby providing strong support for the safe operation of the power grid.

[0076] The following are the improvement ideas of this embodiment: Regarding problem 1, firstly, this embodiment considers that the relationship between gas content and different fault types is often highly nonlinear and complex. The feature attention mechanism, through the adaptive learning capability of neural networks, can dynamically capture the nonlinear relationship between input features and target variables, thereby more accurately quantifying the differences in the impact of different gases on fault diagnosis. Regarding problem 2, this embodiment uses sine and cosine strategies and Cauchy mutation strategies to improve the sparrow search algorithm, preventing it from getting trapped in local optima. Regarding problem 3, when data is missing, the method described in this embodiment will significantly reduce the accuracy of fault diagnosis. This embodiment considers using a generative adversarial neural network to complete the missing data, and then using the fault diagnosis algorithm to diagnose the fault. Compared to directly deleting missing data, this method in this embodiment can avoid the loss of effective information and improve the accuracy of fault diagnosis.

[0077] like Figure 3 As shown, firstly, data on the content of various gases in the oil of oil-immersed transformers were collected, with a focus on the concentrations of hydrogen, methane, acetylene, ethylene, and ethane. This data was then preprocessed. A neural network adversarial algorithm was used to supplement missing data, ensuring data integrity and reliability, and providing sufficient foundational data for subsequent analysis. Secondly, to address the imbalance problem of different types of fault data, an improved SMOTE algorithm was used to balance the data, achieving a more balanced dataset and avoiding the negative impact of data imbalance on model training, thus enhancing the model's ability to identify various faults. Next, the SCSSA algorithm was used to optimize the hyperparameters of the Bi-LSTM model, ensuring optimal performance on complex data. Then, a feature self-attention mechanism was employed, automatically assigning different weights to different input variables, enabling the model to more accurately capture key features related to faults, improving the model's learning effect and diagnostic accuracy. Finally, real-time data from oil-immersed transformers was fed into the Bi-LSTM model under the feature attention mechanism for fault diagnosis, promptly and accurately detecting fault types, and evaluating the diagnostic results to ensure the reliability and accuracy of fault detection. The method described in this embodiment effectively solves the problems of data imbalance, insufficient feature extraction, and low diagnostic accuracy in existing transformer fault diagnosis technologies. It provides an efficient and intelligent fault diagnosis scheme for oil-immersed transformers, which has strong engineering application value and broad prospects for promotion. It can play an important role in fault prediction and maintenance optimization in power systems. The following describes the method in detail with specific implementation steps.

[0078] In one embodiment, obtaining an initial dataset of dissolved gases in oil-immersed transformer oil, and imputing and expanding the initial dataset to obtain a target dataset includes: obtaining dissolved gas content data in oil-immersed transformer oil; generating an initial dataset based on the content data; performing outlier removal, missing value labeling, and standardization on the initial dataset to obtain sample data; classifying transformer fault types and assigning a unique number to each category; imputing the sample data based on an adversarial neural network to obtain a complete dataset with missing data; scaling the complete dataset with missing data to the same scale to obtain a sample dataset; and expanding the sample dataset according to an improved SMOTE algorithm to obtain the target dataset.

[0079] Specifically, such as Figure 3 As shown, data collection involves first collecting the content of various gases in the oil-immersed transformer oil. This embodiment uses dissolved gases in oil-immersed transformer oil, including hydrogen (H2), methane (CH4), acetylene (C2H2), ethylene (C2H4), and ethane (C2H6), as an example. This content data can typically be obtained from transformer oil samples using an oil chromatography analyzer, forming an initial dataset D. raw .

[0080] Specifically, data preprocessing involves: first, inspecting the initial dataset and removing outliers, such as negative values ​​or values ​​outside the physical range; missing values ​​are marked as NaN. Then, the transformer fault types are categorized and assigned unique numbers. For example, the numbering is as follows: low-temperature overheating is numbered 1; medium-temperature overheating is numbered 2; high-temperature overheating is numbered 3; and partial discharge is numbered 4.

[0081] Specifically, data processing and standardization: The gas content data is standardized to eliminate the influence of dimensions. The standardization formula is:

[0082]

[0083] Where x is the original gas content; μ is the mean; σ is the standard deviation; x norm This represents the standardized value.

[0084] In one example, the sample data is imputed using an adversarial neural network (GAN) to obtain a complete dataset with missing data: the GAN is used to impute the missing data. The specific steps are as follows:

[0085] (1) Using a generator to generate data: The goal of the generator is to maximize the error of the discriminator, that is, to make the generated fake data as likely as possible to be considered as real data by the discriminator. The generator's loss function... Defined as:

[0086]

[0087] Where z is the noise vector or the known portion of the missing data input to the generator, in this case referring to the known gas concentration data of the oil-immersed transformer; p z G(z) represents the distribution of the noise vector z, which is usually uniform or normal. G(z) is the generator, which generates fake data by inputting noise z, usually used to fill in missing gas data. D(G(z)) is the discriminator's judgment on the generated data G(z), representing the probability that the data is real data.

[0088] (2) The goal of the discriminator: The discriminator's task is to distinguish whether the input data is real data or generated data. Its loss function... Defined in two parts:

[0089]

[0090] Where x represents the actual data, specifically the actual gas concentration data of the oil-immersed transformer, derived from data distribution p. data (x); p data (x) represents the data distribution, indicating the true probability distribution; D(x) is the discriminator's judgment of the true data x, representing the probability of that data; G(z) is the fake data generated by the generator, where z is the input noise; D(G(z)) is the discriminator's judgment of the generated data G(z), representing the probability that the data is the true data.

[0091] (3) Optimization of the generator and discriminator: The generator and discriminator are optimized alternately. The generator attempts to generate increasingly realistic fake data, while the discriminator attempts to better distinguish between real data and generated data. 1) Optimization goal of the generator: The generator aims to minimize To optimize, the generator's parameters can be updated using gradient descent, making the generated data increasingly closer to the real data. 2) Discriminator optimization objective: The discriminator aims to minimize... This can be optimized. The optimization process can update the discriminator's parameters using the gradient descent algorithm, enabling it to distinguish between real and generated data.

[0092] (4) Filling in missing data: Assuming some parts of the original dataset X are missing, this embodiment uses a generator to fill in these missing data. The completed dataset X after filling in the missing data. completed for:

[0093]

[0094] Among them, X completed To complete the dataset after supplementing missing data; x knownThe gas capacity of the known oil-immersed transformer is given.

[0095] In this embodiment, by employing an adversarial neural network algorithm to supplement the missing values ​​in the transformer fault data, the accuracy of fault diagnosis can be significantly improved.

[0096] In one embodiment, the complete dataset after supplementing the missing data is scaled to the same scale to obtain a sample dataset. Exemplarily, data partitioning involves scaling all data to the same scale to eliminate the impact of dimensional differences on the model. The data can then be divided into training and test sets, typically in a 7:3 or 8:2 ratio. For example, the sample dataset can be divided into training and test sets in a 7:3 ratio. The training set can be used to train a Bi-LSTM model with a feature attention mechanism, and the test set can be used to evaluate the accuracy of the Bi-LSTM model with a feature attention mechanism for fault diagnosis of oil-immersed transformers. The resulting trained Bi-LSTM model with a feature attention mechanism can then be used for transformer fault diagnosis. For example... Figure 4 As shown, the algorithm proposed in this embodiment has an accuracy of up to 97.992%.

[0097] In one embodiment, the sample dataset is expanded according to the improved SMOTE algorithm to obtain the target dataset, including: clustering the data of the sample dataset according to the clustering algorithm to identify minority class samples and majority class samples; dividing the minority class samples into core regions and boundary regions, and dividing the samples in the boundary regions into dangerous samples, noisy samples and safe samples; expanding the core region, boundary region and dangerous samples respectively according to the improved SMOTE algorithm to obtain synthetic samples; and generating the target dataset according to the synthetic samples.

[0098] In one embodiment, the core region, boundary region, and hazardous samples are expanded according to the improved SMOTE algorithm to obtain a synthetic sample, including: expanding the core region of minority class samples according to the SMOTE algorithm to obtain a first synthetic sample; expanding the hazardous samples in the boundary region according to the Borderline-SMOTE algorithm to obtain a second synthetic sample; expanding the hazardous samples according to the Kernel-ADASYN algorithm to obtain a third synthetic sample; and fusing the first synthetic sample, the second synthetic sample, and the third synthetic sample to obtain a synthetic sample.

[0099] Specifically, firstly, clustering algorithms are used to cluster the sample data to identify minority and majority class samples. Then, the minority class samples are further divided into core and boundary regions. Samples in the boundary region are further divided into dangerous, noisy, and safe samples. The core, boundary, and dangerous samples are expanded respectively. Multiple algorithms are then integrated to generate new samples.

[0100] For example, to perform sample clustering, first, the sample data (e.g., data from a sample dataset) is clustered to identify minority and majority class samples. The cluster centers are calculated as follows:

[0101]

[0102] in, Let the cluster center be the sample of class k. Let n be the sample points and n be the number of samples.

[0103] For example, dangerous samples in the core region and boundary region of minority class samples respectively:

[0104] (1) The SMOTE algorithm is used to expand the sample core area of ​​the minority class samples to generate new synthetic samples (the first synthetic sample), which are calculated by the following formula:

[0105]

[0106] in, This represents the generated synthetic sample; This represents the existing minority class samples and their nearest neighbor samples; This represents the randomly generated expansion factor.

[0107] (2) For dangerous samples in the boundary region, the Borderline-SMOTE algorithm is used to expand the samples, gradually moving them closer to the core region and improving the data distribution in the boundary region. First, the decision boundary is estimated using a classifier, and the decision function is as follows:

[0108]

[0109] in, This refers to the normal vector of the hyperplane; This refers to the feature vector of the input sample; This refers to the bias term. Data values ​​greater than 0 are classified as boundary values. Data values ​​less than 0 are categorized as core values.

[0110] After the boundary is determined, the SMOTE algorithm can be used to calculate and obtain a new synthetic sample (the second synthetic sample).

[0111] (3) The Kernel-ADASYN algorithm is used to expand the dangerous samples. The specific calculation method is as follows:

[0112] 1) Calculate the number of samples per class: Similar to the ADASYN algorithm, the first step of the Kernel-ADASYN algorithm calculates the number of samples to be generated based on the neighborhood density of each minority class sample. The number of minority class samples generated, N... i The difficulty depends on the sample's difficulty, specifically determined by calculating the proportion of its k-nearest neighbors belonging to the majority class. Samples with higher difficulty generate more synthetic samples. For sample x... i The generated sample N i for:

[0113]

[0114] Where K represents the number of neighbors selected; and They represent x respectively i and x j Tags; This represents an indicator function, when The value is 1 when it is active, and 0 otherwise.

[0115] 2) Selecting Hard-to-Class Samples: The difficulty of generating samples is assessed based on the distance between each sample and its neighbors. A larger distance between a sample and its neighbors indicates that it is near the class boundary, and such samples are generally more difficult to classify correctly. Therefore, the Kernel-ADASYN algorithm selects hard-to-class samples by calculating the distance between each minority class sample and its k nearest neighbors.

[0116] 3) Kernel Function Mapping: Next, the Kernel-ADASYN algorithm introduces a kernel function to map the data from the original space to a higher-dimensional space. Common kernel functions include radial basis function (RBF) kernels and multinomial kernels. The kernel function is used to calculate the similarity between samples and to generate samples in the higher-dimensional space. Let x represent... i and x j The similarity between them can be represented by the following kernel function:

[0117]

[0118] in, This represents the bandwidth parameter of the kernel function, which controls the extent of data mapping expansion.

[0119] 4) Generating synthetic samples (third synthetic samples): In high-dimensional space, the process of generating synthetic samples is similar to the ADASYN algorithm. For each hard-to-classify sample x... i A new synthetic sample is generated based on its distance to its nearest neighbor. The generated sample x new It can be represented as:

[0120]

[0121] in, The coefficient represents the randomly generated coefficient, which is usually between [0, 1] and is used to control the generation of new samples.

[0122] In this embodiment, to address the issue of data imbalance due to different types of faults, a fusion-improved SMOTE algorithm is used to process the imbalanced data and achieve data balance. Using the fusion-improved SMOTE algorithm can significantly balance the data and improve the accuracy of identifying a minority of fault types.

[0123] In one embodiment, finding the optimal values ​​of the Bi-LSTM model parameters based on the optimized sparrow search algorithm to obtain the optimal parameter Bi-LSTM model includes: initializing the parameters of the sparrow search algorithm and the Bi-LSTM model; optimizing the sparrow search algorithm according to the sine and cosine strategies and the Cauchy mutation strategy to obtain the optimized sparrow search algorithm; and finding the optimal values ​​of the Bi-LSTM model parameters based on the optimized sparrow search algorithm to obtain the optimal parameter Bi-LSTM model.

[0124] Specifically, the SCSSA algorithm (an optimized sparrow search algorithm) is used to find the optimal values ​​of the Bi-LSTM model parameters: the SCSSA algorithm (sparrow search algorithm) and Bi-LSTM parameters are initialized; first, the sine and cosine strategies are used to optimize the search factors and optimize the position update rules of individual sparrows; then, the Cauchy mutation strategy is used to update the positions; the positions of the discoverer, joiner, and watcher are updated, and it is checked whether the maximum number of iterations has been reached.

[0125] For example, the parameters of the Sparrow Search Algorithm (SSA) and the Bi-LSTM network are initialized. Specific steps include: (1) Initializing the parameters of the SSA algorithm: First, the sparrow population size is set to 10, and the maximum number of iterations is set to 20. Then, the optimization range of the search parameters is defined: the optimization range of the learning rate is [0.001, 0.1]. The optimization range of the number of hidden layer units is [1, 100]. The optimization range of the regularization parameter is [10...]. -5 10 -1 (2) Initialization of Bi-LSTM network parameters: First, assume an initial learning rate The initial value is 0.01; the initial number of hidden layer units is assumed to be 80; the initial regularization parameter is assumed to be 10. -3 Then, the optimization range is defined: the optimization range for the learning rate is [0.001, 0.1]; the optimization range for the hidden layer is [1, 100]; and the optimization range for the regularization parameter is

[10] . -5 10 -1 ].

[0126] For example, a sine / cosine strategy is used to optimize the search factors and the position update rule for individual sparrows. Then, a Cauchy mutation strategy is used to update the positions. In this embodiment, the sine / cosine strategy is used to optimize the position update of individual sparrows, thereby enhancing the global search capability. The adjustment formula for the search factors in this strategy is:

[0127]

[0128] in, This refers to the initial search factor; This refers to the updated search factors; This refers to the current iteration number. This refers to the maximum number of iterations.

[0129] This embodiment employs the Cauchy mutation strategy to enhance global search capabilities, and its position update formula is as follows:

[0130]

[0131] in, This represents the coordinates of the i-th sparrow in the j-th dimension after the update. This indicates the optimal position in the current population; This represents a random value drawn from the Cauchy distribution, used to control the intensity of position updates; This represents the current position of the i-th sparrow in the j-th dimension.

[0132] For example, during the SCSSA optimization process, the update formula for the discoverer is as follows:

[0133]

[0134] in, This represents the updated position coordinates of the i-th sparrow in the j-th dimension. This represents the position coordinates of the i-th sparrow in the j-th dimension; This represents a random factor, typically generated randomly between [0, 1], used to adjust the magnitude of position updates; This indicates the optimal position in the current population.

[0135] The formula for updating the position of newcomers is as follows:

[0136]

[0137] in, This represents the updated position coordinates of the i-th sparrow in the j-th dimension. Indicates the worst position in the current population; This represents a random factor, typically generated randomly between [0, 1], used to control the update magnitude; This indicates the optimal position in the current population.

[0138] The update formula for the vigilant is as follows:

[0139]

[0140] in, This represents the updated position coordinates of the i-th sparrow in the j-th dimension. This indicates the optimal position in the current population; This parameter controls the step size and is used to adjust the magnitude of the position update. This represents the position coordinates of the i-th sparrow in the j-th dimension.

[0141] It should be noted that in this embodiment, the optimized sparrow search algorithm, namely the SCSSA algorithm, is used to find the optimal values ​​of the Bi-LSTM model parameters, thus avoiding getting trapped in local optima. The optimized sparrow search algorithm in this embodiment improves the search strategy: traditional sparrow search algorithms may have problems with fixed or singular search directions and step sizes when updating sparrow positions. This embodiment optimizes the search factors through a sine and cosine strategy, dynamically adjusting the search factors based on the periodicity and volatility of the sine and cosine functions, allowing sparrows to explore the search space more flexibly. For example, in the early stages of the search, the sine and cosine strategy can give the search factors a larger fluctuation range, prompting the algorithm to perform a global search and expand the search scope; in the later stages of the search, the fluctuation range of the search factors gradually decreases, and the algorithm tends to perform a more refined local search, improving convergence accuracy. Furthermore, this embodiment also employs a Cauchy mutation strategy to enhance the global search. The Cauchy mutation strategy is used to update the sparrow positions. The Cauchy distribution has a wider tail, which, compared to the Gaussian distribution, can produce larger mutation values. When individual sparrows get stuck in a local optimum, Cauchy mutation can enable them to escape the local optimum with a higher probability and continue searching for better solutions in a wider search space, thereby enhancing the algorithm's global search capability. This embodiment of the SCSSA algorithm improves the position update formulas for the discoverer, joiner, and watcher in the sparrow search algorithm. In the discoverer's position update formula, more adaptive parameters or random factors are introduced, allowing the discoverer to more flexibly adjust its search direction and step size based on the current search situation. Similar improvements are made to the position update formulas for joiners and watchers to improve the search efficiency and quality of the entire population.

[0142] In one embodiment, the optimal parameter Bi-LSTM model is combined with a feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism, including: calculating the attention score of each gas generated by the oil-immersed transformer fault according to the weighting function; calculating the weighted feature vector of each gas generated by the oil-immersed transformer fault according to the attention score; calculating the final weighted feature vector according to the weighted feature vector of all gases; and obtaining the Bi-LSTM model under the feature attention mechanism according to the optimal parameter Bi-LSTM model and the final weighted feature vector.

[0143] Specifically, a feature attention mechanism is used to assign different weights to different input variables: calculate the attention score of each gas generated by the transformer fault; calculate the weighted feature vector of each gas generated by the transformer fault; and calculate the final weighted feature vector.

[0144] For example, in this embodiment, the attention score for each feature is calculated using a weighting function. Before calculating the attention score, it is usually necessary to first calculate an intermediate scalar e. i To measure the importance of each input feature, the calculation method is as follows:

[0145]

[0146] in, This represents the intermediate score of the i-th gas, which is used to calculate the attention score later. This represents the attention parameter vector, which is typically a set of learnable parameters. This represents the transpose of the attention parameter vector; This represents the hyperbolic tangent activation function, used to introduce nonlinear relationships; This represents the weight matrix, used to map input features to the dimension of attention scores; This represents the original feature vector of the i-th gas; This represents the bias vector, which is also a learnable parameter.

[0147] The intermediate scalar e was calculated i Then the softmax function can be used to divide each e i The attention score is obtained by normalization, and the calculation method is as follows:

[0148]

[0149] Among them, e i This represents the i-th intermediate scalar; This refers to performing an exponential operation on the intermediate score to convert it into a positive number.

[0150] For example, using the attention score obtained in the previous step, the feature vector of the i-th gas after attention weighting can be calculated:

[0151]

[0152] in, This represents the feature vector of the i-th gas after being weighted by attention weights; This represents the attention score for the i-th gas; This represents the original feature vector of the i-th gas.

[0153] For example, the final feature vector can be obtained by further attention-weighting the feature vector after the attention weights are applied. The specific calculation method is as follows:

[0154]

[0155] in, This represents the final feature vector obtained by summing all gases after attention weighting; This represents the feature vector obtained by attention weighting for the i-th gas; This represents the summation of the weighted eigenvectors of all n gases.

[0156] In this embodiment, the feature attention mechanism enables the model to distinguish the importance of features for fault diagnosis. This attention mechanism assigns different weights to different input gas features, thereby highlighting key features and facilitating subsequent transformer fault diagnosis.

[0157] In one embodiment, the Bi-LSTM model based on the feature attention mechanism performs transformer fault diagnosis based on the target dataset, including: mapping the target dataset to a word embedding space to obtain an embedding vector; obtaining a final feature representation based on the bidirectional long short-term memory network of the Bi-LSTM model under the feature attention mechanism and the embedding vector; and performing fault diagnosis based on a fully connected layer classifier and the final feature representation to obtain a fault prediction result for the oil-immersed transformer.

[0158] Specifically, the data of oil-immersed transformers (target dataset or real-time detection data) are substituted into the Bi-LSTM model under the feature attention mechanism, and the model (Bi-LSTM model under the feature attention mechanism) is used for transformer fault diagnosis: input sample data and map the sample data to the word embedding space; use a bidirectional long short-term memory network to extract contextual information in the sequence; connect the hidden states of the forward and backward LSTMs to form the final feature representation.

[0159] For example, suppose there are T samples, each containing n features, X = {x t1 ,x t2 ,x t3 ,…,x tn} represents the included samples, where x ti ∈R d Let x represent the i-th feature vector of the t-th sample. Let each feature vector x... ti Mapping to the word embedding space, assuming a dimension of k, the formula is:

[0160]

[0161] in, Represents each feature vector The embedding vector obtained after the embedding layer; E∈R k×d The embedding matrix represents the feature vectors used to map to the embedding space; b e ∈R k This represents the bias vector of the embedding layer.

[0162] For example, a bidirectional long short-term memory network is used to extract contextual information from a sequence. The calculation method for the backpropagation formula is as follows:

[0163]

[0164] in, This represents the hidden state vector obtained through the forward LSTM; This represents the computation process of the forward LSTM.

[0165] The backpropagation formula is:

[0166]

[0167] in, This represents the hidden state vector obtained through the backward LSTM; This represents the computation process of the backward LSTM.

[0168] The hidden state merging method concatenates the hidden states of the forward and backward LSTMs to form the final feature representation. The calculation formula is as follows:

[0169]

[0170] Among them, h ti ∈R 2h Let represent the final representation of the i-th feature vector of the t-th sample, where h is the number of hidden units in the LSTM.

[0171] For example, using the feature vector hti (Final feature representation) is used for fault diagnosis, and a fully connected layer classifier is used to process the feature vector h. ti The process is then performed to obtain the final fault prediction result. The specific calculation method is as follows:

[0172]

[0173] in, W represents the fault diagnosis output for the t-th sample; c ∈R m×2h and b c ∈R m These two are the weight matrix and bias vector of the classifier, respectively.

[0174] The oil-immersed transformer fault diagnosis method proposed in this embodiment, based on the BI-LSTM model with fusion improved SMOTE algorithm and feature self-attention mechanism, has the following technical effects:

[0175] 1. An improved SMOTE algorithm is adopted to balance imbalanced data and improve fault diagnosis accuracy: Considering the imbalanced nature of data from different faulty transformer oils, while the traditional SMOTE algorithm performs well in handling boundary regions, it does not fully consider the distribution within sample classes and potential noise contamination. This embodiment uses an improved SMOTE algorithm to overcome the shortcomings of traditional algorithms in generating new samples blindly and marginalizing them, significantly optimizing the performance of traditional classifiers when handling imbalanced datasets.

[0176] 2. Improving the Sparrow Search Algorithm using Sine / Cosine and Cauchy Mutation Strategies to Prevent It from Getting Trapped in Local Optimum: The Bi-LSTM algorithm has good judgment capabilities, but multiple parameters need to be determined. If these parameters are selected manually based on experience, the diagnostic results are often poor. The traditional Sparrow Search Algorithm optimizes by simulating the foraging and anti-predation behaviors of sparrows, boasting fast convergence and strong optimization capabilities, making it well-suited for transformer fault diagnosis. However, the SSA algorithm (Sparrow Search Algorithm) suffers from susceptibility to local optima and insufficient global search capability. To address this issue, this embodiment improves the SSA algorithm using Sine / Cosine and Cauchy Mutation Strategies, thereby enhancing its performance.

[0177] 3. Employing a Feature Attention Mechanism to Quantify the Differences in the Impact of Different Gases on Fault Diagnosis: Traditional methods use the Bi-LSTM model for transformer fault diagnosis. This model utilizes two LSTM layers connected in reverse to fully extract the correlations between sequences and the inverse correlations within the sequences themselves. However, this algorithm neglects the differences in the impact of gases on fault diagnosis. This embodiment considers that the relationship between gas content and different fault types is often highly nonlinear and complex. The feature attention mechanism, through the adaptive learning capability of neural networks, can dynamically capture the nonlinear relationship between input features and target variables, thereby more accurately quantifying the differences in the impact of different gases on fault diagnosis.

[0178] In summary, this embodiment proposes a fault diagnosis method for oil-immersed transformers based on a fusion of the improved SMOTE algorithm and a Bi-LSTM model with a feature self-attention mechanism. The aim is to achieve accurate fault diagnosis of transformers by fusing the improved SMOTE algorithm and the Bi-LSTM model with a feature self-attention mechanism, effectively addressing the shortcomings of existing research and providing strong support for safe power grid operation and refined scheduling. The method described in this embodiment not only effectively solves common problems in existing research, such as data imbalance, insufficient feature extraction, and poor model generalization ability, but also provides an innovative solution for accurate transformer fault diagnosis. (References) Figure 5 The accuracy results graph shown and Figure 6 As shown in the accuracy comparison chart, this embodiment effectively solves the problem of insufficient minority class samples by introducing the improved SMOTE algorithm, thus enhancing the model's ability to identify different fault types. The feature self-attention mechanism further strengthens the model's feature extraction capability in complex data, enabling more accurate capture of multi-dimensional information about transformer faults, thereby improving the accuracy of fault diagnosis. The algorithm proposed in this embodiment achieves an accuracy rate of up to 97.99% in transformer fault diagnosis (e.g., ...). Figure 6 (As shown). The method described in this embodiment not only theoretically promotes the development of the field of transformer fault diagnosis, but also provides substations and power companies with an efficient and reliable fault diagnosis means in practical applications, with significant engineering application value and economic benefits.

[0179] This embodiment provides a fault diagnosis method for oil-immersed transformers, including: acquiring an initial dataset of dissolved gases in the transformer oil; imputing and expanding the initial dataset to obtain a target dataset; finding the optimal values ​​of the Bi-LSTM model parameters using an optimized sparrow search algorithm to obtain an optimal parameter Bi-LSTM model; combining the optimal parameter Bi-LSTM model with a feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism; and performing transformer fault diagnosis based on the target dataset using the Bi-LSTM model under the feature attention mechanism. In this embodiment, the Bi-LSTM model under the feature attention mechanism can dynamically capture the nonlinear relationship between input features and target variables, thereby more accurately quantifying the differences in the impact of different gases on fault diagnosis. The sparrow search algorithm is improved to prevent it from getting trapped in local optima. By imputing missing data and then using the fault diagnosis algorithm, i.e., the Bi-LSTM model under the feature attention mechanism, for fault diagnosis, the loss of effective information can be avoided, improving the accuracy of fault diagnosis and achieving accurate fault diagnosis of transformers, thus providing strong support for the safe operation of the power grid.

[0180] Furthermore, this embodiment of the invention also proposes a storage medium storing an oil-immersed transformer fault diagnosis program, which, when executed by a processor, implements the steps of the oil-immersed transformer fault diagnosis method described above.

[0181] Reference Figure 7 , Figure 7 This is a structural block diagram of an embodiment of the oil-immersed transformer fault diagnosis system of the present invention.

[0182] like Figure 7 As shown, the oil-immersed transformer fault diagnosis system includes:

[0183] Data acquisition module 10 is used to acquire an initial dataset of dissolved gases in oil-immersed transformer oil, and to fill and expand the initial dataset to obtain a target dataset;

[0184] The parameter optimization module 20 is used to find the optimal values ​​of the Bi-LSTM model parameters according to the optimized sparrow search algorithm, and obtain the optimal parameter Bi-LSTM model.

[0185] The model building module 30 is used to combine the optimal parameter Bi-LSTM model with the feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism.

[0186] The fault diagnosis module 40 is used to perform transformer fault diagnosis based on the target dataset using the Bi-LSTM model under the feature attention mechanism.

[0187] This embodiment provides a fault diagnosis system for oil-immersed transformers. This system utilizes a Bi-LSTM model with a feature attention mechanism to dynamically capture the nonlinear relationship between input features and target variables, thereby more accurately quantifying the differences in the impact of different gases on fault diagnosis. The sparrow search algorithm is improved to prevent it from getting trapped in local optima. Missing data is filled in before the Bi-LSTM model with the feature attention mechanism is used for fault diagnosis, avoiding the loss of effective information, improving the accuracy of fault diagnosis, and achieving accurate fault diagnosis of transformers, thus providing strong support for the safe operation of the power grid.

[0188] It should be noted that technical details not described in detail in this embodiment of the oil-immersed transformer fault diagnosis system can be found in any embodiment of the present invention applied to the oil-immersed transformer fault diagnosis method as described above, and will not be repeated here.

[0189] It should be understood that the above are merely illustrative examples and do not constitute any limitation on the technical solutions of the present invention. In specific applications, those skilled in the art can make settings as needed, and the present invention does not impose any restrictions on this.

[0190] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of this invention. In practical applications, those skilled in the art can select some or all of the workflow to achieve the purpose of this embodiment according to actual needs, and no restrictions are imposed here.

[0191] Furthermore, 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 system 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 system. 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 system that includes that element.

[0192] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0193] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0194] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A fault diagnosis method for an oil-immersed transformer, characterized in that, include: An initial dataset of dissolved gases in oil-immersed transformer oil is obtained, and the initial dataset is filled and expanded to obtain the target dataset. The optimal values ​​of the Bi-LSTM model parameters are found using the optimized sparrow search algorithm, and the optimal parameter Bi-LSTM model is obtained. The optimal parameter Bi-LSTM model is combined with the feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism; Based on the Bi-LSTM model with the aforementioned feature attention mechanism, transformer fault diagnosis is performed using the target dataset. The process of obtaining an initial dataset of dissolved gases in oil-immersed transformer oil, and then imputing and expanding the initial dataset to obtain a target dataset includes: obtaining dissolved gas content data in oil-immersed transformer oil; generating an initial dataset based on the content data; performing outlier removal, missing value labeling, and standardization on the initial dataset to obtain sample data; classifying transformer fault types and assigning a unique number to each category; imputing the sample data using an adversarial neural network to obtain a complete dataset with missing data; scaling the complete dataset with missing data to the same scale to obtain a sample dataset; and expanding the sample dataset using an improved SMOTE algorithm to obtain the target dataset. The sample dataset is expanded using the improved SMOTE algorithm to obtain the target dataset, including: clustering the data in the sample dataset using a clustering algorithm to identify minority class samples and majority class samples; dividing the minority class samples into core regions and boundary regions, and further dividing the samples within the boundary regions into dangerous samples, noisy samples, and safe samples; expanding the core regions, boundary regions, and dangerous samples using the improved SMOTE algorithm to obtain synthetic samples; and generating the target dataset based on the synthetic samples. The core region, boundary region, and hazardous samples are expanded using the improved SMOTE algorithm to obtain a synthetic sample, including: expanding the core region of minority class samples using the SMOTE algorithm to obtain a first synthetic sample; expanding the hazardous samples within the boundary region using the Borderline-SMOTE algorithm to obtain a second synthetic sample; expanding the hazardous samples using the Kernel-ADASYN algorithm to obtain a third synthetic sample; and fusing the first, second, and third synthetic samples to obtain a final synthetic sample. Finding the optimal values ​​of the Bi-LSTM model parameters based on the optimized sparrow search algorithm to obtain the optimal parameter Bi-LSTM model includes: initializing the sparrow search algorithm and the parameters of the Bi-LSTM model; optimizing the sparrow search algorithm according to the sine and cosine strategies and the Cauchy mutation strategy to obtain the optimized sparrow search algorithm; and finding the optimal values ​​of the Bi-LSTM model parameters based on the optimized sparrow search algorithm to obtain the optimal parameter Bi-LSTM model. The optimal parameter Bi-LSTM model is combined with the feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism, including: calculating the attention score of each gas generated by the oil-immersed transformer fault according to the weighting function; calculating the weighted feature vector of each gas generated by the oil-immersed transformer fault according to the attention score; calculating the final weighted feature vector according to the weighted feature vector of all gases; and obtaining the Bi-LSTM model under the feature attention mechanism according to the optimal parameter Bi-LSTM model and the final weighted feature vector.

2. The method as described in claim 1, characterized in that, The Bi-LSTM model based on the feature attention mechanism performs transformer fault diagnosis according to the target dataset, including: The embedding vectors are obtained by mapping the target dataset to the word embedding space; Based on the Bi-LSTM model bidirectional long short-term memory network under the feature attention mechanism and the embedding vector, the final feature representation is obtained; Fault diagnosis is performed based on the fully connected layer classifier and the final feature representation to obtain the fault prediction results of the oil-immersed transformer.

3. A fault diagnosis system for an oil-immersed transformer based on the method described in claim 1 or 2, characterized in that, include: The data acquisition module is used to acquire an initial dataset of dissolved gases in oil-immersed transformer oil, and to fill and expand the initial dataset to obtain a target dataset. The parameter optimization module is used to find the optimal values ​​of the Bi-LSTM model parameters based on the optimized sparrow search algorithm, and obtain the optimal parameter Bi-LSTM model. The model building module is used to combine the optimal parameter Bi-LSTM model with the feature attention mechanism to construct a Bi-LSTM model under the feature attention mechanism. The fault diagnosis module is used to perform transformer fault diagnosis based on the target dataset using the Bi-LSTM model under the feature attention mechanism.

4. An electronic device, characterized in that, The electronic device includes: a memory, a processor, and an oil-immersed transformer fault diagnosis program stored in the memory and executable on the processor, the oil-immersed transformer fault diagnosis program being configured to implement the oil-immersed transformer fault diagnosis method as described in claim 1 or 2.

5. A storage medium, characterized in that, The storage medium stores an oil-immersed transformer fault diagnosis program, which is used to enable the processor to implement the oil-immersed transformer fault diagnosis method as described in claim 1 or 2 when executed.