Waveform data set completion method and system based on self-attention generative adversarial network

Through the self-attention generation adversarial network, the self-attention layer captures the global dependence of power waveforms, the problem of scarcity and imbalance in the power system is solved, high-quality waveform data that conforms to physical laws is generated, and the training data quality of the fault positioning algorithm is improved.

CN120256843APending Publication Date: 2025-07-04GUANGDONG ELECTRIC POWER SCI RES INST ENERGY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510414501.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-03
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

In the fault location and classification algorithm of power system, distribution network waveform data is scarce and unbalanced. The traditional generative adversarial network cannot capture the global dependence of power waveforms, resulting in poor physical regularity of the generated data. The few types of samples generated by existing methods lack diversity and violate the dynamic response laws of the power system.

Method used

The method of generating adversarial network based on self-attention is adopted. By obtaining a power waveform data set of uniform length and type tags, the self-attention layer captures the waveform global dependence, and combining the adaptive learning rate and adversarial loss function, high-quality waveform data that conforms to physical laws is generated.

Benefits of technology

The data scarcity and imbalance problems are solved, and the authenticity and physical regularity of the generated waveform data are improved, and the scarce category data is directly completed and the data set distribution is balanced, providing high-quality training data for the fault location algorithm.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256843A_ABST
    Figure CN120256843A_ABST
Patent Text Reader

Abstract

The invention discloses a waveform data set completion method and system based on a self-attention generative adversarial network. The method comprises the steps of obtaining a to-be-completed power waveform data set; wherein the lengths of the power waveforms in the power waveform data set are consistent, and the power waveforms are provided with corresponding type labels; according to the power waveform data set, training a preset original self-attention generative adversarial network model to obtain a self-attention generative adversarial network model; wherein a generator of the original self-attention generative adversarial network model comprises at least one self-attention layer; and inputting a preset random noise vector and a type label into the self-attention generative adversarial network model, outputting a target power waveform, and complementing the power waveform data set based on the target power waveform. According to the invention, a high-quality power waveform data set of a power grid line is generated through expansion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of power system fault diagnosis, and relates to a waveform data set completion method and system based on a self-attention generative adversarial network. Background Art

[0002] In the development of power system fault location and classification algorithms, the scarcity of waveform data in the distribution network (35 kV and below) and the imbalance of waveform data categories in the transmission network (above 35 kV) are two core challenges. Existing technologies highly rely on real power grid waveform data. However, due to insufficient deployment of waveform recording devices in the distribution network, the available data is extremely scarce, making it difficult to support algorithm development. Although a large amount of data has been accumulated in the transmission network, the significant difference in the occurrence frequencies of fault types has led to a serious imbalance in sample categories.

[0003] In traditional solutions, the conventional generative adversarial network (GAN) expands the data set by generating synthetic data. However, the pure convolutional structure it relies on can only capture local features of the waveform (such as a single spike, the steepness of the rising edge), and cannot model the global dependencies across time steps in the power waveform (such as the phase correlation between the fault point and subsequent oscillations, the propagation path of the traveling wave head), resulting in poor physical regularity of the generated data. The traditional oversampling method expands the data by copying or simple interpolation, and the generated minority class samples lack diversity and violate the dynamic response law of the power system, making it difficult to improve the generalization ability of the classification algorithm for complex waveforms. Summary of the Invention

[0004] Aiming at the deficiencies of the existing technology, the present application provides a waveform data set completion method and system based on a self-attention generative adversarial network, which realizes the expansion and generation of a high-quality power waveform data set of the power grid line.

[0005] To achieve the above object, in the first aspect, the present invention provides a waveform data set completion method based on a self-attention generative adversarial network, including:

[0006] Obtain a power waveform data set to be completed; wherein, the lengths of the power waveforms in the power waveform data set are the same, and each is equipped with a corresponding type label;

[0007] According to the power waveform data set, train a preset original self-attention generative adversarial network model to obtain a self-attention generative adversarial network model; wherein, the generator of the original self-attention generative adversarial network model includes at least one self-attention layer;

[0008] Input a preset random noise vector and type label into the self-attention generative adversarial network model, output a target power waveform, and complete the power waveform data set based on the target power waveform.

[0009] Compared with the prior art, the embodiments of the present application have the following beneficial effects: By obtaining a power waveform data set with a unified length and type tags, the consistency and class controllability of the input data are ensured, avoiding model training errors or performance degradation caused by mismatched data dimensions; Training is performed based on a generative adversarial network model containing a self-attention layer, and the self-attention mechanism is used to capture the global dependencies in the waveform, solving the problem of poor physical regularity of the generated waveform caused by the insufficient local feature modeling ability of the conventional convolutional network; Finally, the trained model combines noise and type tags to generate more realistic and physically regular waveform data, directly complementing scarce category data and balancing the dataset distribution, providing high-quality training data for the fault location algorithm.

[0010] In some embodiments of the first aspect of the present application, the obtaining of the power waveform data set to be complemented includes:

[0011] Obtain the original power waveform data set;

[0012] Perform denoising processing on the original power waveform data set to obtain a second power waveform data set;

[0013] Screen and extract the power waveforms in the second power waveform data set that meet the preset waveform quantity range to obtain a third power waveform data set;

[0014] According to the preset target waveform length, unify the lengths of the power waveforms in the third power waveform data set to obtain the power waveform data set to be complemented.

[0015] Compared with the prior art, the above embodiments have the following beneficial effects: The noise interference (such as sensor noise) in the original data is removed through denoising processing, improving the data quality; The power waveforms that meet the waveform quantity range are screened, redundant samples are removed, and the core data distribution is focused; Unifying the waveform length avoids training errors and performance degradation problems caused by inconsistent input dimensions for the model, laying a foundation for the efficient training of the subsequent generative adversarial network.

[0016] In some embodiments of the first aspect of the present application, the according to the preset target waveform length, unifying the lengths of the power waveforms in the third power waveform data set to obtain the power waveform data set to be complemented includes:

[0017] According to the preset interpolation sampling algorithm, perform interpolation processing on the power waveforms in the third power waveform data set whose waveform lengths are less than the target waveform length to obtain the first power waveform to be complemented;

[0018] According to the preset downsampling algorithm, perform downsampling on the power waveforms in the third power waveform data set whose waveform lengths are greater than the target waveform length to obtain the second power waveform to be complemented;

[0019] Merge the power waveforms in the third power waveform dataset whose waveform lengths are equal to the target waveform length, as well as the first power waveform to be complemented and the second power waveform to be complemented, to obtain a power waveform dataset to be complemented.

[0020] Compared with the prior art, the above embodiments have the following beneficial effects: For waveforms of different lengths, interpolation and downsampling are respectively used. On the one hand, it avoids training errors caused by inconsistent input dimensions of the model; on the other hand, it avoids the problem of model performance degradation caused by potential waveform data truncation.

[0021] In some embodiments of the first aspect of the present application, training the preset original self-attention generative adversarial network model includes:

[0022] Train the original self-attention generative adversarial network model according to a preset adaptive learning rate adjustment algorithm; wherein, the adaptive learning rate adjustment algorithm is:

[0023] where η t represents the current learning rate, η max and η min represent the maximum and minimum values of the learning rate respectively, T cur represents the current training round, and T max represents the total number of training rounds.

[0024] Compared with the prior art, the above embodiments have the following beneficial effects: Dynamically adjust the learning rate through the adaptive learning rate adjustment algorithm, use a larger learning rate at the beginning of training to accelerate convergence, and reduce the learning rate in the later stage to finely optimize the parameters, solving the problems of training oscillation or insufficient convergence speed caused by a fixed learning rate, and improving the training efficiency and stability of the model.

[0025] In some embodiments of the first aspect of the present application, training the preset original self-attention generative adversarial network model further includes:

[0026] Iteratively update the generator parameters and discriminator parameters according to the discriminant results of the discriminator of the original self-attention generative adversarial network model until the model converges;

[0027] wherein, the discriminant result is obtained by the discriminator processing the first waveform data or the power waveform; the first waveform data is obtained by the generator processing a random noise vector and various types of labels in the power waveform dataset.

[0028] Compared with the prior art, the above embodiments have the following beneficial effects: By iteratively updating the model parameters according to the discrimination results of the discriminator on the generated waveform and the real waveform, an adversarial optimization mechanism is formed to prevent the training imbalance caused by one-sided model over-strongness, ensure the balanced improvement of the overall model performance, and enhance the deception ability of the generator and the discrimination ability of the discriminator.

[0029] In some embodiments of the first aspect of the present application, the first waveform data is obtained by processing a random noise vector and various types of labels in the power waveform dataset according to the generator, including:

[0030] Encoding each of the type labels to obtain corresponding label feature vectors;

[0031] Performing convolution processing on the random noise vector and the label feature vectors according to the preset convolutional layer in the generator to extract corresponding local features;

[0032] Extracting global features in the local features according to the preset self-attention layer in the generator;

[0033] Fusing and mapping the global features and local features according to the preset fully connected layer in the generator, and outputting the first waveform data corresponding to each of the type labels.

[0034] Compared with the prior art, the above embodiments have the following beneficial effects: By encoding the type labels as feature vectors, precise control of the type of the generated waveform is achieved, ensuring that the generated data strictly matches the target category; Based on the convolutional layer, local details of the noise and label features are extracted, retaining the physical detail authenticity of the waveform; By modeling the global dependence relationship in the local features through the self-attention layer, the waveform distortion problem caused by conventional generation methods ignoring long-range temporal correlations is solved; Finally, through the fully connected layer, the global and local features are fused to generate high-quality waveform data that not only meets the local detail fidelity but also satisfies the global physical laws.

[0035] In some embodiments of the first aspect of the present application, the discrimination result is obtained by processing the first waveform data or the power waveform according to the discriminator, including:

[0036] Performing convolution processing on the first waveform data or the power waveform according to the preset convolutional layer in the discriminator to extract corresponding local features;

[0037] Extracting global features in the local features according to the preset self-attention layer in the discriminator;

[0038] Fusing and mapping the global features and local features according to the preset fully connected layer in the discriminator, and outputting the discrimination result.

[0039] Compared with the prior art, the above embodiments have the following beneficial effects: By combining a convolutional layer and a self-attention layer in the discriminator, the local details and global structural features of the waveform are analyzed simultaneously, enhancing the ability to distinguish between real waveforms and generated waveforms; The discriminant result is output through a fully connected layer, simplifying the classification logic and improving the discrimination efficiency, providing a reliable basis for the adversarial training of the generative adversarial network.

[0040] In some embodiments of the first aspect of the present application, iteratively updating the generator parameters and discriminator parameters according to each discriminant result of the discriminator of the original self-attention generative adversarial network model includes:

[0041] Calculating a generator loss according to a preset generator loss function and each of the discriminant results, and updating the generator parameters according to the generator loss; wherein, the generator loss function is:

[0042] L g =λ g L g +λ MSE L MSE ; where L g represents the adversarial loss that the waveform data generated by the generator is recognized as real waveform data by the discriminator, L MSE represents the mean square error between the generated waveform data and the real waveform data, λ g and λ MSE represent balance coefficients;

[0043] Calculating a discriminator loss according to a preset discriminator loss function and each of the discriminant results, and updating the discriminator parameters according to the discriminator loss.

[0044] Compared with the prior art, the above embodiments have the following beneficial effects: Introducing a weighted combination of adversarial loss and mean square error, using the adversarial loss to force the generator to deceive the discriminator, enhancing the local fidelity of the waveform (such as spike morphology); Constraining the global similarity between the generated waveform and the real data through the mean square error (such as the overall amplitude distribution), avoiding local overfitting or global distortion caused by a single loss function, and improving the physical rationality of the generated data.

[0045] In some embodiments of the first aspect of the present application, inputting a preset random noise vector and type label into the self-attention generative adversarial network model, outputting a target power waveform, and completing the power waveform dataset based on the target power waveform includes:

[0046] Inputting a preset random noise vector and type label into the self-attention generative adversarial network model to generate an original target power waveform;

[0047] Denoise each of the original target power waveforms to obtain target power waveforms, and complete the power waveform dataset based on the target power waveforms.

[0048] Compared with the prior art, the above embodiments have the following beneficial effects: Adding denoising processing after the model output filters out the high-frequency noise in the generated waveforms, retains the core waveform features, ensures that the completed data can be directly used for algorithm training, and avoids the additional computational cost brought by secondary cleaning.

[0049] In a second aspect, the present invention also provides a waveform dataset completion system based on a self-attention generative adversarial network, including: a data acquisition module, a training module, and a generation module;

[0050] Among them, the data acquisition module is used to acquire the power waveform dataset to be completed; among them, the lengths of the power waveforms in the power waveform dataset are consistent, and corresponding type labels are equipped;

[0051] The training module is used to train a preset original self-attention generative adversarial network model according to the power waveform dataset to obtain a self-attention generative adversarial network model; among them, the generator of the original self-attention generative adversarial network model includes at least one self-attention layer;

[0052] The generation module is used to input a preset random noise vector and type label into the self-attention generative adversarial network model, output target power waveforms, and complete the power waveform dataset based on the target power waveforms.

[0053] Compared with the prior art, the above embodiments of the present application have the following beneficial effects: By acquiring a power waveform dataset with a unified length and type labels, ensuring the consistency and class controllability of the input data, and avoiding model training errors or performance degradation caused by data dimension mismatches; Training based on a generative adversarial network model containing self-attention layers, using the self-attention mechanism to capture the global dependencies in the waveforms, and solving the problem of poor physical regularity of the generated waveforms caused by the insufficient local feature modeling ability of conventional convolutional networks; Finally, through the trained model combined with noise and type labels, generate more realistic and physically regular waveform data, directly complete the scarce category data and balance the dataset distribution, and provide high-quality training data for the fault location algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 : A flowchart of a method for completing a waveform dataset based on a self-attention generative adversarial network provided in some embodiments of the present invention.

[0055] Figure 2: It is a schematic structural diagram of a waveform dataset completion system based on a self-attention generative adversarial network provided in some embodiments of the present invention. Detailed implementation manners

[0056] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0057] Embodiment 1:

[0058] Please refer to Figure 1 , which is a method for completing a waveform dataset based on a self-attention generative adversarial network provided in an embodiment of the present invention, including steps S1 to S3:

[0059] Step S1: Obtain a power waveform dataset to be completed;

[0060] Among them, the lengths of the power waveforms in the power waveform dataset are the same, and corresponding type labels are assigned; the power waveforms may specifically include power frequency waveforms, traveling wave waveforms, or other power waveforms.

[0061] Further, step S1 can be implemented through the following preferred implementation manners, including steps S11 - S14, specifically as follows:

[0062] S11: Obtain the original power waveform dataset.

[0063] S12: Perform denoising processing on the original power waveform dataset to obtain a second power waveform dataset.

[0064] In specific implementation, the denoising processing in step S12 can be implemented using a median filtering algorithm, or other similar filtering algorithms for denoising, which is not limited herein.

[0065] S13: Screen and extract the power waveforms in the second power waveform dataset that meet the preset waveform quantity range to obtain a third power waveform dataset.

[0066] S14: Unify the lengths of the power waveforms in the third power waveform dataset according to the preset target waveform length to obtain the power waveform dataset to be completed.

[0067] In steps S11 - S14, noise interference (such as sensor noise) in the original data is removed through denoising processing to improve data quality; power waveforms within a specific waveform quantity range are selected, redundant samples are eliminated, and the focus is on the core data distribution; the waveform lengths are unified to avoid training errors and performance degradation caused by inconsistent input dimensions for the model, laying a foundation for the efficient training of the subsequent generative adversarial network.

[0068] Further, step S14 can be implemented through the following preferred embodiments, including steps S141 - S143, specifically as follows:

[0069] S141: According to a preset interpolation sampling algorithm, interpolation processing is performed on each power waveform in the third power waveform dataset whose waveform length is less than the target waveform length to obtain the first power waveform to be completed.

[0070] S142: According to a preset downsampling algorithm, downsampling is performed on each power waveform in the third power waveform dataset whose waveform length is greater than the target waveform length to obtain the second power waveform to be completed.

[0071] In specific implementation, the interpolation processing in step S14 can be implemented using the cubic spline interpolation method, and the downsampling can be implemented through the linear interpolation downsampling method, or similar algorithms can also be used, which is not limited herein.

[0072] S143: Combine each power waveform in the third power waveform dataset whose waveform length is equal to the target waveform length, and the first power waveform and the second power waveform to be completed to obtain the power waveform dataset to be completed.

[0073] In steps S141 - S143, interpolation and downsampling processing are respectively performed on waveforms of different lengths. On the one hand, it avoids training errors caused by inconsistent input dimensions for the model; on the other hand, it avoids potential performance degradation of the model caused by waveform data truncation.

[0074] Step S2: According to the power waveform dataset, train a preset original self - attention generative adversarial network model to obtain a self - attention generative adversarial network model;

[0075] Among them, the generator of the original self - attention generative adversarial network model includes at least one self - attention layer.

[0076] Before training, the power waveform dataset can be divided into a training set and a test set, for example, divided into 7:3 or 8:2, and the data distribution within the dataset is randomly shuffled to prevent the model from overfitting to specific data patterns during training.

[0077] Preferably, the step S2 can be trained in combination with an adaptive learning rate adjustment algorithm, where the adaptive learning rate adjustment algorithm is as follows:

[0078] where η t represents the current learning rate, η max and η min represent the maximum and minimum values of the learning rate respectively, T cur represents the current training epoch, and T max represents the total number of training epochs.

[0079] In a specific implementation, at the initial stage of training, the learning rate starts from a relatively low value (such as 1×10 -5 ), and linearly increases as the training process progresses until it reaches a preset peak value (such as 1×10 -3 ). This process avoids instability caused by too rapid parameter updates through the initial low learning rate, and gradually increasing the learning rate helps the model quickly find the optimization direction; in the later stage of training, the learning rate gradually decreases according to the above expression as the training process progresses; this process avoids parameter fluctuations of the generator and discriminator when the model is approaching convergence by gradually reducing the learning rate, which helps to improve the stability of training.

[0080] In this preferred embodiment, step S2 dynamically adjusts the learning rate through the adaptive learning rate adjustment algorithm, uses a larger learning rate at the initial stage of training to accelerate convergence, and reduces the learning rate in the later stage to refine and optimize the parameters, solving the problems of training oscillation or insufficient convergence speed caused by a fixed learning rate, and improving the training efficiency and stability of the model.

[0081] Furthermore, the training of step S2 can be implemented through the following preferred implementation manner, specifically:

[0082] Iteratively update the generator parameters and discriminator parameters according to the discriminant results of each discriminator of the original self-attention generative adversarial network model until the model converges;

[0083] where the discriminant result is obtained by the discriminator processing the first waveform data or the power waveform; the first waveform data is obtained by the generator processing the random noise vector and various types of labels in the power waveform dataset.

[0084] In this preferred embodiment, step S2 iteratively updates the model parameters according to the discriminant results of the discriminator on the generated waveform and the real waveform, forming an adversarial optimization mechanism to prevent training imbalance caused by an overly strong unilateral model, ensuring the balanced improvement of the overall performance of the model, and enhancing the deception ability of the generator and the discrimination ability of the discriminator.

[0085] Further, the first waveform data and the discrimination result can be obtained through the following preferred embodiments, including steps S21 - S27, specifically as follows:

[0086] S21: Encode each of the type tags to obtain corresponding tag feature vectors.

[0087] S22: According to the preset convolutional layer in the generator, perform convolutional processing on the random noise vector and the tag feature vector to extract corresponding local features.

[0088] S23: According to the preset self - attention layer in the generator, extract the global features from the local features.

[0089] S24: According to the preset fully - connected layer in the generator, fuse and map the global features and local features, and output the first waveform data corresponding to each of the type tags.

[0090] In this preferred embodiment, steps S21 - S24 encode the type tags into feature vectors to achieve precise control over the type of the generated waveform, ensuring that the generated data strictly matches the target category; extract local details of the noise and tag features based on the convolutional layer to retain the physical detail authenticity of the waveform; model the global dependence relationship in the local features through the self - attention layer to solve the waveform distortion problem caused by conventional generation methods ignoring long - range temporal correlations; finally, fuse the global and local features through the fully - connected layer to generate high - quality waveform data that meets both local detail fidelity and global physical laws.

[0091] S25: According to the preset convolutional layer in the discriminator, perform convolutional processing on the first waveform data or the power waveform to extract corresponding local features.

[0092] S26: According to the preset self - attention layer in the discriminator, extract the global features from the local features.

[0093] S27: According to the preset fully - connected layer in the discriminator, fuse and map the global features and local features, and output the discrimination result.

[0094] In steps S25 - S27 of this preferred embodiment, the discriminator combines the convolutional layer and the self - attention layer to simultaneously analyze the local details and global structural features of the waveform, enhancing the discrimination ability between real waveforms and generated waveforms; outputs the discrimination result through the fully - connected layer, simplifies the classification logic, improves the discrimination efficiency, and provides a reliable basis for the adversarial training of the generative adversarial network.

[0095] Further, the iterative update of the generator parameters and the discriminator parameters in step S2 can be achieved through the following preferred embodiments, including steps S28 - S29, specifically as follows:

[0096] S28: Calculate the generator loss according to the preset generator loss function and each of the discrimination results, and update the generator parameters according to the generator loss; wherein, the generator loss function is:

[0097] L g = λ g L g + λ MSE L MSE ; where L g represents the adversarial loss that the waveform data generated by the generator is recognized as real waveform data by the discriminator, L MSE represents the mean square error between the generated waveform data and the real waveform data, and λ g and λ MSE represent balance coefficients; at the initial stage of training, with λ g > λ MSE dominant, enabling the generator to learn preferentially. At the later stage of training, make λ g = λ MSE to ensure that the generator can optimize both the physical characteristics and the adversarial nature of the waveform simultaneously.

[0098] S29: Calculate the discriminator loss according to the preset discriminator loss function and each of the discrimination results, and update the discriminator parameters according to the discriminator loss; wherein, the discriminator loss function can be as follows:

[0099] L D = -[logD(x T ) + log(1 - D(x F ))]; where D(x T ) is the determination probability of the discriminator for the real waveform (i.e., the power waveform), and D(x F ) is the determination probability of the discriminator for the generated waveform (i.e., the first waveform data).

[0100] In this preferred embodiment, steps S28 - S29 introduce a weighted combination of adversarial loss and mean square error. By using the adversarial loss, the generator is forced to deceive the discriminator, enhancing the local fidelity of the waveform (such as the spike shape); by the mean square error, the global similarity between the generated waveform and the real data is constrained (such as the overall amplitude distribution), avoiding local overfitting or global distortion caused by a single loss function, and improving the physical rationality of the generated data.

[0101] For example, in a specific implementation, the structure of the self - attention generative adversarial network model in step S2 can be as follows:

[0102] Generator part: The network structure of the generator can consist of 1 input layer, 3 convolutional layers, 1 self-attention layer, and 1 output layer; the input dimension of the input layer is 150, and the input parameters include a 100-dimensional random noise vector and a 50-dimensional type label of the power waveform, where the type label of the power waveform is a feature vector encoded by the embedding layer; the output dimension of convolutional layer 1 is 256, the convolutional kernel size is 3×3, the stride is 2, and the activation function is the ReLU function; the output dimensions of convolutional layers 2-3 are 512 and 1024 respectively, and other parameters are the same as those of convolutional layer 1; the input dimension of the self-attention layer is 1024, with 8 heads, which is used to capture the global features in the waveform and help the generator better understand the global structure of the waveform; the output layer uses a fully connected layer, and the output dimension is the same as the target length of the set power waveform, with a linear activation function, and its output is the power waveform data of a specific type.

[0103] Discriminator part: The network structure of the discriminator can consist of 1 input layer, 3 convolutional layers, 1 self-attention layer, and 1 output layer; the dimension of the input layer is the target length of the set power waveform, and the input parameters are the real power waveform (i.e., the power waveform in the power waveform dataset to be completed) or the waveform generated by the generator; the output dimension of convolutional layer 1 is 1024, the convolutional kernel size is 3×3, the stride is 2, and the activation function is the LeakyReLU function; the output dimensions of convolutional layers 2-3 are 512 and 256 respectively, and other parameters are the same as those of convolutional layer 1; the input dimension of the self-attention layer is 256, with 8 heads; the output layer uses a fully connected layer, the output dimension is 1, with a Sigmoid activation function, and its output is the discrimination result, which is used to judge whether the waveform is real data or generated data.

[0104] In step S2, based on the generative adversarial network model containing the self-attention layer for training, the self-attention mechanism is used to capture the global dependencies in the waveform, which can solve the problem of poor physical regularity of the generated waveform caused by the insufficient local feature modeling ability of the conventional convolutional network.

[0105] Step S3: Input the preset random noise vector and type label into the self-attention generative adversarial network model, output the target power waveform, and complete the power waveform dataset based on the target power waveform.

[0106] Preferably, step S3 can be implemented through the following preferred implementation manners, including steps S31-S32, specifically as follows:

[0107] S31: Input the preset random noise vector and type label into the self-attention generative adversarial network model to generate the original target power waveform.

[0108] S32: Denoise each of the original target power waveforms to obtain target power waveforms, and complete the power waveform dataset based on the target power waveforms.

[0109] Similarly, the denoising process in step S32 can also be performed using a median filtering algorithm or other similar algorithms, which is not limited herein.

[0110] In this preferred embodiment, steps S31 - S32 add a denoising process after the model output to filter out high - frequency noise in the generated waveforms, retain the core waveform features, ensure that the completed data can be directly used for algorithm training, and avoid the additional computational cost brought by secondary cleaning.

[0111] In summary, compared with the prior art, the above - mentioned embodiments of the present application have the following beneficial effects: By obtaining a power waveform dataset with a unified length and type labels, the consistency and class controllability of the input data are ensured, avoiding model training errors or performance degradation caused by mismatched data dimensions; Training is performed based on a generative adversarial network model containing a self - attention layer, and the self - attention mechanism is used to capture the global dependencies in the waveforms, solving the problem of poor physical regularity of the generated waveforms caused by the insufficient local feature modeling ability of conventional convolutional networks; Finally, the trained model combines noise and type labels to generate more realistic and physically regular waveform data, directly complete scarce category data and balance the dataset distribution, providing high - quality training data for the fault location algorithm.

[0112] Embodiment 2:

[0113] Please refer to Figure 2 , based on the same inventive concept, a waveform dataset completion system based on a self - attention generative adversarial network disclosed in an embodiment of the present invention includes: a data acquisition module M1, a training module M2, and a generation module M3;

[0114] Among them, the data acquisition module M1 is used to acquire a power waveform dataset to be completed; among them, the lengths of the power waveforms in the power waveform dataset are the same, and corresponding type labels are provided.

[0115] Further, the data acquisition module M1 includes: an original data acquisition unit, a first denoising unit, a screening unit, and a wavelength unification unit;

[0116] Among them, the original data acquisition unit is used to acquire an original power waveform dataset;

[0117] The first denoising unit is used to denoise the original power waveform dataset to obtain a second power waveform dataset;

[0118] The screening unit is configured to screen and extract the power waveforms in the second power waveform dataset that meet the preset waveform quantity range, so as to obtain a third power waveform dataset;

[0119] The wavelength unifying unit is configured to unify the lengths of the power waveforms in the third power waveform dataset according to a preset target waveform length, so as to obtain a power waveform dataset to be complemented.

[0120] In this preferred embodiment, the data acquisition module M1 removes noise interference (such as sensor noise) in the original data through denoising processing to improve data quality; screens the power waveforms that meet the waveform quantity range, eliminates redundant samples, and focuses on the core data distribution; unifies the waveform lengths to avoid training errors and performance degradation problems caused by inconsistent input dimensions of the model, laying a foundation for the efficient training of the subsequent generative adversarial network.

[0121] Further, the wavelength unifying unit includes: an interpolation sub-unit, a downsampling sub-unit, and a merging sub-unit;

[0122] Among them, the interpolation sub-unit is configured to perform interpolation processing on the power waveforms in the third power waveform dataset whose waveform lengths are less than the target waveform length according to a preset interpolation sampling algorithm, so as to obtain a first power waveform to be complemented;

[0123] The downsampling sub-unit is configured to perform downsampling on the power waveforms in the third power waveform dataset whose waveform lengths are greater than the target waveform length according to a preset downsampling algorithm, so as to obtain a second power waveform to be complemented;

[0124] The merging sub-unit is configured to merge the power waveforms in the third power waveform dataset whose waveform lengths are equal to the target waveform length, as well as the first power waveform to be complemented and the second power waveform to be complemented, so as to obtain a power waveform dataset to be complemented.

[0125] In this preferred embodiment, the data acquisition module M1 respectively performs interpolation and downsampling processing on waveforms of different lengths. On the one hand, it avoids training errors caused by inconsistent input dimensions of the model; on the other hand, it avoids model performance degradation problems caused by potential waveform data truncation.

[0126] The training module M2 is configured to train a preset original self-attention generative adversarial network model according to the power waveform dataset to obtain a self-attention generative adversarial network model; wherein, the generator of the original self-attention generative adversarial network model includes at least one self-attention layer.

[0127] Further, the training module M2 includes: an adaptive adjustment unit;

[0128] The adaptive adjustment unit is used to train the original self-attention generative adversarial network model according to a preset adaptive learning rate adjustment algorithm; wherein, the adaptive learning rate adjustment algorithm is as follows:

[0129] where η t represents the current learning rate, η max and η min represent the maximum and minimum values of the learning rate respectively, T cur represents the current training round, and T max represents the total number of training rounds.

[0130] In this preferred embodiment, the adaptive adjustment unit dynamically adjusts the learning rate through the adaptive learning rate adjustment algorithm, uses a larger learning rate at the beginning of training to accelerate convergence, and reduces the learning rate in the later stage to finely optimize the parameters, solving the problems of training oscillation or insufficient convergence speed caused by a fixed learning rate, and improving the training efficiency and stability of the model.

[0131] Further, the training module M2 further includes: a control training unit;

[0132] wherein, the control training unit is used to iteratively update the generator parameters and discriminator parameters according to the discriminant results of the discriminator of the original self-attention generative adversarial network model until the model converges;

[0133] wherein, the discriminant result is obtained by the discriminator processing the first waveform data or the power waveform; the first waveform data is obtained by the generator processing the random noise vector and various types of labels in the power waveform dataset.

[0134] Further, the control training unit includes: an encoding subunit, a first local feature extraction subunit, a first global feature extraction subunit, and a first waveform generation subunit;

[0135] wherein, the encoding subunit is used to encode each of the type labels to obtain corresponding label feature vectors;

[0136] The first local feature extraction subunit is used to perform convolution processing on the random noise vector and the label feature vector according to a preset convolutional layer in the generator to extract corresponding local features;

[0137] The first global feature extraction subunit is used to extract global features in the local features according to a preset self-attention layer in the generator;

[0138] The first waveform generation subunit is configured to fuse and map the global feature and the local feature according to the fully connected layer preset in the generator, and output first waveform data corresponding to each type label.

[0139] In this preferred embodiment, the control training unit realizes precise control of the type of the generated waveform by encoding the type label into a feature vector, ensuring that the generated data strictly matches the target category; extracts local details of the noise and label features based on the convolutional layer, and preserves the physical detail authenticity of the waveform; models the global dependence relationship in the local features through the self-attention layer, and solves the waveform distortion problem caused by the conventional generation method ignoring the long-range time series correlation; finally, fuses the global and local features through the fully connected layer to generate high-quality waveform data that not only conforms to the local detail fidelity but also satisfies the global physical law.

[0140] Further, the control training unit further includes: a second local feature extraction subunit, a second global feature extraction subunit, and a discriminant subunit;

[0141] The second local feature extraction subunit is configured to perform convolution processing on the first waveform data or the power waveform according to the convolutional layer preset in the discriminator, and extract corresponding local features;

[0142] The second global feature extraction subunit is configured to extract the global feature in the local feature according to the self-attention layer preset in the discriminator;

[0143] The discriminant subunit is configured to fuse and map the global feature and the local feature according to the fully connected layer preset in the discriminator, and output a discriminant result.

[0144] In this preferred embodiment, the control training unit combines the convolutional layer and the self-attention layer in the discriminator to simultaneously analyze the local details and the global structure features of the waveform, enhance the discrimination ability of the real waveform and the generated waveform; output the discriminant result through the fully connected layer, simplify the classification logic, improve the discrimination efficiency, and provide a reliable basis for the adversarial training of the generative adversarial network.

[0145] Further, the control training unit further includes: a generator update subunit and a discriminator update subunit;

[0146] Among them, the generator update subunit is configured to calculate a generator loss according to a preset generator loss function and each discriminant result, and update the generator parameters according to the generator loss; wherein, the generator loss function is:

[0147] L g =λ g L g +λ MSE L MSE; where L g represents the adversarial loss that the waveform data generated by the generator is recognized as real waveform data by the discriminator, L MSE represents the mean square error between the generated waveform data and the real waveform data, λ g and λ MSE represent the balance coefficients.

[0148] The discriminator update subunit is configured to calculate the discriminator loss according to a preset discriminator loss function and each of the discrimination results, and update the discriminator parameters according to the discriminator loss.

[0149] In this preferred embodiment, the control training unit introduces a weighted combination of adversarial loss and mean square error, and uses the adversarial loss to force the generator to deceive the discriminator, enhancing the local fidelity of the waveform (such as the spike shape); constraining the global similarity between the generated waveform and the real data through the mean square error (such as the overall amplitude distribution), avoiding local overfitting or global distortion caused by a single loss function, and improving the physical rationality of the generated data.

[0150] The generation module M3 is configured to input a preset random noise vector and type label into the self-attention generative adversarial network model, output a target power waveform, and complete the power waveform dataset based on the target power waveform.

[0151] Further, the generation module M3 includes: an original output unit and a second denoising unit;

[0152] The original output unit is configured to input a preset random noise vector and type label into the self-attention generative adversarial network model to generate an original target power waveform;

[0153] The second denoising unit is configured to perform denoising processing on each of the original target power waveforms to obtain a target power waveform, and complete the power waveform dataset based on the target power waveform.

[0154] In this preferred embodiment, the generation module M3 adds denoising processing after the model output, filters out the high-frequency noise in the generated waveform, retains the core waveform features, ensures that the completed data can be directly used for algorithm training, and avoids the additional computational cost brought by secondary cleaning.

[0155] In summary, compared with the prior art, the embodiments of the present application have the following beneficial effects: By obtaining a power waveform data set with a unified length and type tags, the consistency and class controllability of the input data are ensured, avoiding model training errors or performance degradation caused by mismatched data dimensions; Training is performed based on a generative adversarial network model including a self-attention layer, and the self-attention mechanism is used to capture the global dependencies in the waveform, solving the problem of poor physical regularity of the generated waveform caused by the insufficient local feature modeling ability of the conventional convolutional network; Finally, the trained model combines noise and type tags to generate more realistic and physically regular waveform data, directly complementing scarce category data and balancing the dataset distribution, providing high-quality training data for the fault location algorithm.

[0156] For the specific working processes of the above-described modules, reference may be made to the corresponding processes in the foregoing method embodiments, which will not be elaborated herein. The division of the modules is only a logical function division, and there may be other division methods in actual implementation. For example, multiple modules may be combined or integrated into another system.

[0157] The above specific embodiments have further elaborated on the purpose, technical solutions, and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. In particular, for those skilled in the art, any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.

Claims

1. A waveform dataset completion method based on self-attention generative adversarial network, characterized in that, Including: Obtain a power waveform dataset to be complemented; wherein, the lengths of the power waveforms in the power waveform dataset are the same, and each is equipped with a corresponding type label; Train a preset original self-attention generative adversarial network model according to the power waveform dataset to obtain a self-attention generative adversarial network model; wherein, the generator of the original self-attention generative adversarial network model includes at least one self-attention layer; Input a preset random noise vector and type label into the self-attention generative adversarial network model, output a target power waveform, and complement the power waveform dataset based on the target power waveform.

2. The waveform data set completion method based on the self-attention generative adversarial network according to claim 1, characterized in that, The obtaining of the power waveform dataset to be complemented includes: Obtain an original power waveform dataset; Perform denoising processing on the original power waveform dataset to obtain a second power waveform dataset; Screen and extract the power waveforms in the second power waveform dataset that meet the preset waveform quantity range to obtain a third power waveform dataset; According to a preset target waveform length, unify the lengths of the power waveforms in the third power waveform dataset to obtain a power waveform dataset to be complemented.

3. The waveform dataset completion method based on the self-attention generative adversarial network according to claim 2, wherein The unifying of the lengths of the power waveforms in the third power waveform dataset according to a preset target waveform length to obtain a power waveform dataset to be complemented includes: According to a preset interpolation sampling algorithm, perform interpolation processing on the power waveforms in the third power waveform dataset whose waveform lengths are less than the target waveform length to obtain a first power waveform to be complemented; According to a preset downsampling algorithm, perform downsampling on the power waveforms in the third power waveform dataset whose waveform lengths are greater than the target waveform length to obtain a second power waveform to be complemented; Merge the power waveforms in the third power waveform dataset whose waveform lengths are equal to the target waveform length, and the first power waveform to be complemented and the second power waveform to be complemented to obtain a power waveform dataset to be complemented.

4. The waveform dataset completion method based on the self-attention generative adversarial network according to claim 1, wherein The training of the preset original self-attention generative adversarial network model includes: Train the original self-attention generative adversarial network model according to a preset adaptive learning rate adjustment algorithm; wherein, the adaptive learning rate adjustment algorithm is: Among them, η t represents the current learning rate, η max and η min represent the maximum and minimum values of the learning rate respectively, T cur represents the current training epoch, T max represents the total number of training epochs.

5. The waveform dataset completion method based on the self-attention generative adversarial network according to claim 4, characterized in that The training of the preset original self-attention generative adversarial network model further includes: Iteratively update the generator parameters and discriminator parameters according to the discriminant results of the discriminator of the original self-attention generative adversarial network model until the model converges; Wherein, the discriminant result is obtained by the discriminator processing the first waveform data or the power waveform; the first waveform data is obtained by the generator processing a random noise vector and each type label in the power waveform dataset.

6. The waveform dataset completion method based on self-attention generative adversarial network according to claim 5, wherein The first waveform data is obtained by the generator processing a random noise vector and each type label in the power waveform dataset, including: Encode each of the type labels to obtain corresponding label feature vectors; According to a preset convolutional layer in the generator, perform convolutional processing on the random noise vector and the label feature vectors to extract corresponding local features; Extract the global features in the local features according to the self-attention layer preset in the generator; According to the fully connected layer preset in the generator, fuse and map the global features and local features, and output the first waveform data corresponding to each type label.

7. The waveform dataset completion method based on the self-attention generative adversarial network according to claim 5, characterized in that The discrimination result is obtained by processing the first waveform data or the power waveform according to the discriminator, and includes: Perform convolution processing on the first waveform data or the power waveform according to the convolution layer preset in the discriminator, and extract the corresponding local features; Extract the global features in the local features according to the self-attention layer preset in the discriminator; According to the fully connected layer preset in the discriminator, fuse and map the global features and local features, and output the discrimination result.

8. The waveform dataset completion method based on self-attention generative adversarial network according to claim 5, wherein Iteratively update the generator parameters and discriminator parameters according to each discrimination result of the discriminator of the original self-attention generative adversarial network model, including: Calculate the generator loss according to the preset generator loss function and each discrimination result, and update the generator parameters according to the generator loss; wherein, the generator loss function is: L g = λ g L g + λ MSE L MSE ; where L g represents the adversarial loss that the waveform data generated by the generator is recognized as real waveform data by the discriminator, and L MSE represents the mean square error between the generated waveform data and the real waveform data, and λ g and λ MSE represent the balance coefficients; Calculate the discriminator loss according to the preset discriminator loss function and each discrimination result, and update the discriminator parameters according to the discriminator loss.

9. A waveform dataset completion method based on a self-attention generative adversarial network according to any one of claims 1-8, characterized in that, Input the preset random noise vector and type label into the self-attention generative adversarial network model, output the target power waveform, and complete the power waveform dataset based on the target power waveform, including: Input the preset random noise vector and type label into the self-attention generative adversarial network model to generate the original target power waveform; Perform denoising processing on each of the original target power waveforms to obtain the target power waveform, and complete the power waveform dataset based on the target power waveform.

10. A waveform dataset completion system based on a self-attention generative adversarial network, characterized in that Including: A data acquisition module, a training module and a generation module; Among them, the data acquisition module is used to acquire the power waveform dataset to be completed; wherein, the lengths of the power waveforms in the power waveform dataset are the same, and each is equipped with a corresponding type label; The training module is used to train the preset original self-attention generative adversarial network model according to the power waveform dataset to obtain the self-attention generative adversarial network model; wherein, the generator of the original self-attention generative adversarial network model includes at least one self-attention layer; The generation module is used to input the preset random noise vector and type label into the self-attention generative adversarial network model, output the target power waveform, and complete the power waveform dataset based on the target power waveform.