Generative adversarial network training method and device, current reconstruction method and device and storage medium
Through the training method of generative adversarial network, it solves the problem that traditional current sampling technology is difficult to collect high-frequency and ultra-high-frequency current signals, achieves high-precision collection and reconstruction of power grid data, simplifies operations and reduces costs.
Patent Information
- Application Number
- CN202410890518.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-10-18
AI Technical Summary
Traditional current sampling technology is difficult to collect high-frequency and ultra-high-frequency current signals. It is limited by Nyquist's theorem and the frequency bandwidth of the sensor, and cannot obtain complete data on the status of electrical equipment in the power grid.
Using the training method of generative adversarial network, by synchronously collecting low-frequency and high-frequency current signals, using the generative adversarial network generator and discriminator based on the bulldozer distance, the frequency of the low-frequency current signal is increased, and high-frequency and ultra-high-frequency current signals are constructed, and The network is updated by the total loss value until the training conditions are met.
It achieves accurate collection and reconstruction of high-frequency and ultra-high-frequency current signals, improves the accuracy of power grid data, is simple to operate, low in cost, does not rely on specific sensors, and is suitable for large-scale promotion.
Smart Images

Figure CN118798313A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power grids, and in particular to a training and current reconstruction method, device and storage medium for generating adversarial networks. Background Art
[0002] The power grid is one of the basic infrastructures in modern society, and current sampling is one of the measures to monitor and maintain the normal operation of the power grid. The main goal of current sampling is to obtain accurate data related to the status of electrical equipment and current load to ensure the reliability, safety and efficiency of the power grid.
[0003] Traditional current sampling technology is based on the Nyquist theorem and has relatively strict requirements on the sampling frequency of current signals. In addition, due to constraints such as the bandwidth of the sensor, the collected current signals usually exhibit low-frequency characteristics. In addition, high-frequency and ultra-high-frequency current transformers are designed to be installed in a sealed manner, which makes it impossible to collect high-frequency and ultra-high-frequency current signals. Summary of the invention
[0004] In view of this, the present invention provides a training and current reconstruction method, device and storage medium for generating adversarial networks to collect high-frequency and ultra-high-frequency current signals.
[0005] A first aspect of the present invention provides a training method for generating an adversarial network, comprising:
[0006] Synchronously collecting a first sample current signal and a second sample current signal from a designated electrical device in a power grid; the frequency of the first sample current signal is lower than the frequency of the second sample current signal;
[0007] Loading a generative adversarial network based on bulldozer distance; the generative adversarial network has a generator and a discriminator;
[0008] Inputting the first sample current signal into the generator to increase the frequency so as to construct a third sample current signal;
[0009] Inputting the second sample current signal and the third sample current signal into the discriminator to generate a true or false probability;
[0010] Generating a total loss value according to the true and false probability;
[0011] Updating the generative adversarial network according to the total loss value;
[0012] Determine whether the preset training conditions are met; if so, determine that the generative adversarial network has completed training; if not, return to execute the step of inputting the first sample current signal into the generator to increase the frequency to construct a third sample current signal.
[0013] A second aspect of the present invention provides a current reconstruction method, comprising:
[0014] Collect original current signals from designated electrical equipment in the power grid;
[0015] Loading the generator trained according to the method described in the first aspect;
[0016] The original current signal is input into the generator to increase the frequency so as to construct a target current signal.
[0017] A third aspect of the present invention provides a training device for generating an adversarial network, comprising:
[0018] A sample current signal acquisition module, used for synchronously acquiring a first sample current signal and a second sample current signal from a designated electrical device in a power grid; the frequency of the first sample current signal is lower than the frequency of the second sample current signal;
[0019] A generative adversarial network loading module, used to load a generative adversarial network based on bulldozer distance; the generative adversarial network has a generator and a discriminator;
[0020] a training current signal construction module, configured to input the first sample current signal into the generator to increase the frequency so as to construct a third sample current signal;
[0021] A true-false probability generating module, used for inputting the second sample current signal and the third sample current signal into the discriminator to generate a true-false probability;
[0022] A total loss value generating module, used to generate a total loss value according to the true and false probability;
[0023] A generative adversarial network update module, used to update the generative adversarial network according to the total loss value;
[0024] A training condition judgment module, used to judge whether the preset training condition is met; if so, execute the training completion module; if not, return to execute the training current signal construction module;
[0025] The training completion module is used to determine whether the generative adversarial network has completed training.
[0026] A fourth aspect of the present invention provides a current reconstruction device, comprising:
[0027] The original current signal acquisition module is used to collect the original current signal of the specified electrical equipment in the power grid;
[0028] A generator loading module, used to load the generator trained according to the method of the first aspect;
[0029] The target current signal construction module is used to input the original current signal into the generator to increase the frequency so as to construct a target current signal.
[0030] A fifth aspect of the present invention provides an electronic device, the electronic device comprising:
[0031] at least one processor; and
[0032] a memory communicatively connected to the at least one processor; wherein,
[0033] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the training method of the generative adversarial network described in the first aspect or the current reconstruction method described in the second aspect.
[0034] The sixth aspect of the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the training method of the generative adversarial network described in the first aspect or the current reconstruction method described in the second aspect.
[0035] The seventh aspect of the present invention provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the training method of the generative adversarial network described in the first aspect or the current reconstruction method described in the second aspect.
[0036] The generator directly reconstructs the one-dimensional low-frequency current signal into a one-dimensional high-frequency or ultra-high-frequency current signal in sequence, thereby realizing the direct conversion of the one-dimensional sequence signal. While ensuring that the one-dimensional sequence signal has a high degree of accuracy, the operation is direct and simple, the calculation is fast, it does not rely on specific sensors, has low cost, and can be promoted on a large scale.
[0037] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0039] Figure 1It is a flowchart of a training method for a generative adversarial network provided in Example 1 of the present invention.
[0040] Figure 2 It is a structural diagram of a generator provided in Example 1 of the present invention.
[0041] Figure 3 It is a schematic diagram of the structure of a discriminator provided in Embodiment 1 of the present invention.
[0042] Figure 4 This is a flow chart of a current reconstruction method provided in Embodiment 2 of the present invention.
[0043] Figure 5 It is a structural diagram of a training device for generating an adversarial network provided in Example 3 of the present invention.
[0044] Figure 6 It is a structural schematic diagram of a current reconstruction device provided in Embodiment 4 of the present invention.
[0045] Figure 7 It is a structural schematic diagram of an electronic device provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION
[0046] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0047] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can cover sequential implementations other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0048] Embodiment 1
[0049] See also Figure 1, shows a flow chart of a method for training a generative adversarial network and current reconstruction provided by the first embodiment of the present invention, the method can be performed by a training and current reconstruction device for a generative adversarial network, the training and current reconstruction device for a generative adversarial network can be implemented in the form of hardware and / or software, and the training and current reconstruction device for a generative adversarial network can be configured in an electronic device. Figure 1 As shown, the method includes:
[0050] Step 101: synchronously collect a first sample current signal and a second sample current signal from a designated electrical device in a power grid.
[0051] In this embodiment, there are various types of electrical equipment distributed in the power grid, and these electrical equipment refer to various types of equipment and devices used for power generation, transmission, transformation, distribution, power quality control and other links.
[0052] Furthermore, electrical equipment can be divided into primary equipment and secondary equipment. Among them, primary equipment refers to the related equipment directly used for the production, transmission and distribution of electric energy, such as generators, transformers, circuit breakers, disconnectors, mutual inductors, etc.; secondary equipment refers to the auxiliary equipment for monitoring, measuring, controlling and protecting primary equipment, such as relay protection devices, signal devices, measurement and control devices, metering devices, etc.
[0053] In this embodiment, a low-resolution instrument and a high-resolution instrument can be used to synchronously collect a first sample current signal and a second sample current signal from an electrical device serving as a sample in a power grid, wherein the frequency of the first sample current signal is lower than the frequency of the second sample current signal, the first sample current signal is also called a low-frequency current signal, and the second sample current signal is also called a high-frequency or ultra-high-frequency current signal.
[0054] With respect to the first sample current signal, the first sample current signal may be preprocessed to improve the quality of the first sample current signal.
[0055] The preprocessing includes wavelet denoising and Z-score normalization.
[0056] Furthermore, the wavelet denoising process is based on wavelet transform, which decomposes the first sample current signal into sub-bands of different frequencies and removes noise by processing the sub-band values of different frequencies through thresholds.
[0057] The formula for Z-Score is as follows:
[0058]
[0059] Wherein, x' is the normalized signal in the first sample current signal, x is the original signal in the first sample current signal, mean(X) is the mean of the original signal in the first sample current signal, and std(X) is the standard deviation of the original signal in the first sample current signal.
[0060] If the preprocessing is completed, a one-dimensional reflection padding (ReflectionPadding1D) is performed on the first sample current signal to maintain the fillability and scalability of the original current signal and ensure that the characteristic information of the low-frequency signal is not lost.
[0061] The first sample current signal is organized into a three-dimensional tensor (batch_size, time_steps, features) in chronological order, where batch_size represents the number of first sample current signals in each batch, time_steps represents the number of time steps, and features represents the number of features in each time step.
[0062] Step 102: Load the generative adversarial network based on the bulldozer distance.
[0063] In this embodiment, for the task of reconstructing the current, a Wasserstein Generative Adversarial Networks (WGAN) based on bulldozer distance can be loaded into the memory and run, waiting for training.
[0064] Among them, the generative adversarial network has a generator and a discriminator. The function of the generator is to input a sample and output it into a realistic appearance, and the discriminator is to determine whether the input sample is real or fake.
[0065] WGAN uses a new distance definition, Wasserstein Distance, which theoretically gives the reason why GAN training is unstable, that is, cross entropy (JS divergence) is not suitable for measuring the distance between distributions with disjoint parts. Instead, it uses the bulldozer distance to measure the distance between the generated data distribution and the real data distribution, which theoretically solves the problem of unstable training.
[0066] Step 103: Input the first sample current signal into a generator to increase the frequency to construct a third sample current signal.
[0067] In practical applications, the first sample current signal is input into the generator, and the generator processes the first sample current signal according to its structure, increases the frequency of the first sample current signal, and thus constructs a high-frequency or ultra-high-frequency third sample current signal.
[0068] In a generator structure such as Figure 2 As shown, the generator includes a first fully connected layer (FC), a first gated recurrent unit (GRU), a first upsampling layer (Upsample), a first convolutional layer (Convolutional), a second upsampling layer, a second convolutional layer and a third convolutional layer in sequence.
[0069] Furthermore, the structure of each layer in the generator is as follows:
[0070]
[0071]
[0072] In this structure, the first sample current signal is input into the first fully connected layer and mapped into the first sample current sequence feature, the input latent vector z (i.e., the first sample current signal) is mapped to a high-dimensional space, and a nonlinear transformation is applied to increase the complexity of the WGAN to provide sufficient features for the subsequent first gated recurrent unit.
[0073] The first sample current sequence feature is input into the first gated recurrent unit to extract the second sample current sequence feature. GRU can be used to process sequence data and can capture the temporal characteristics of the input data. The stacking of two layers of GRU units increases the depth of the network and helps to learn more complex patterns. The return sequence is set to True to keep the output of all time steps.
[0074] The second sample current signal is input into the first upsampling layer to perform an upsampling operation to obtain the third sample current sequence feature. The length of the input data is doubled, which can improve the resolution of the data so that other subsequent convolutional layers can generate higher resolution feature maps.
[0075] The third sample current signal is input into the first convolution layer to perform convolution operation, extract local features, and obtain the fourth sample current sequence features. The convolution kernel size is 3, which can capture the local features of three consecutive time steps. 128 filters are used to generate a 128-dimensional feature map.
[0076] The fourth sample current sequence feature is batch normalized (BatchNorm, BN) to obtain the fifth sample current sequence feature, thereby standardizing the output of the first convolutional layer to speed up the training speed and stabilize the training process of WGAN, and its momentum parameter determines the update rate of the mean and variance.
[0077] The fifth sample current signal is input into the second up-sampling layer to perform an up-sampling operation, and the sixth sample current sequence feature is obtained, and the length of the input data is doubled again, so as to further improve the resolution of the data.
[0078] The sixth sample current signal is input into the second convolutional layer to perform a convolution operation, extract higher-level local features, and obtain the seventh sample current sequence features. The convolution kernel size is 3, and 64 filters are used to generate a 64-dimensional feature map.
[0079] The seventh sample current sequence features are batch normalized to obtain the eighth sample current sequence features, thereby standardizing the output of the second convolutional layer to speed up the training speed and stabilize the training process of WGAN.
[0080] The eighth sample current signal is input into the third convolution layer to perform a convolution operation to obtain a third sample current signal, whose convolution kernel size is 2, and 1 filter is used to generate the final one-dimensional time series data. The tanh activation function is used to map the output to the [1,1] interval.
[0081] Step 104: Input the second sample current signal and the third sample current signal into a discriminator to generate a true or false probability.
[0082] In practical applications, the second sample current signal and the third sample current signal can be respectively input into the discriminator, which processes the second sample current signal or the third sample current signal according to its structure and generates a true or false probability for the second sample current signal or the third sample current signal, wherein the true or false probability is the probability that the second sample current signal or the third sample current signal is true or false.
[0083] In a discriminator structure, such as Figure 3 As shown, the discriminator includes a fourth convolutional layer, a first maximum pooling layer (MaxPooling), a fifth convolutional layer, a second maximum pooling layer, a second gated recurrent unit, a third gated recurrent unit and a second fully connected layer in sequence.
[0084] Furthermore, the structure of each layer in the discriminator is as follows:
[0085]
[0086]
[0087] In this structure, the second sample current signal or the third sample current signal is input into the fourth convolution layer to perform a convolution operation, extract the initial features, and obtain the first discriminant sequence current features. The convolution kernel size is 3, which can capture the features of three consecutive local time steps. 64 filters are used to generate a 64-dimensional feature map.
[0088] The batch normalization operation and activation operation (LeakyReLU) are performed on the first discriminant sequence current features in sequence to obtain the second discriminant sequence current features, and the output of the fourth convolutional layer is standardized to speed up the training speed and stabilize the training process of WGAN. In addition, nonlinearity is introduced to allow a small amount of negative slope so that the gradient can be transferred even when a negative value is input.
[0089] The second discriminant sequence current feature is input into the first maximum pooling layer to perform the maximum pooling operation, and the third discriminant sequence current feature is obtained. Downsampling is performed here to reduce the dimension of the data and the size of the feature map while retaining important (or significant) features.
[0090] The third discriminant sequence current feature is input into the fifth convolutional layer to perform a convolution operation, extract higher-level features, and obtain the fourth discriminant sequence current feature.
[0091] The batch normalization operation and activation operation (LeakyReLU) are performed on the fourth discriminant sequence current feature in sequence to obtain the fifth discriminant sequence current feature, and the output of the fifth convolutional layer is standardized to speed up the training speed and stabilize the training process of WGAN. In addition, nonlinearity is introduced to allow a small amount of negative slope so that the gradient can be transferred even when a negative value is input.
[0092] The fifth discriminant sequence current feature is input into the second maximum pooling layer to perform the maximum pooling operation, and the sixth discriminant sequence current feature is obtained. Downsampling is performed here to reduce the dimension of the data and the size of the feature map while retaining important (or significant) features.
[0093] The sixth discriminant sequence current feature is input into the second gated recurrent unit to extract the seventh discriminant sequence current feature. GRU is used to process time series data and can capture the time series characteristics of the input data. The return sequence is set to True to keep the output of all time steps so that it can be passed to the next layer of GRU.
[0094] A batch normalization operation is performed on the seventh discriminant sequence current feature to obtain the eighth discriminant sequence current feature, and the output of the second gated recurrent unit is standardized to speed up the training speed and stabilize the training process of WGAN.
[0095] The eighth discriminant sequence current feature is input into the third gated recurrent unit to extract the ninth discriminant sequence current feature. GRU extracts deeper sequence features and sets the return sequence to False to retain the output of the last time step for subsequent fully connected layers.
[0096] A batch normalization operation is performed on the ninth discriminant sequence current feature to obtain the tenth discriminant sequence current feature, and the output of the third gated recurrent unit is standardized to speed up the training speed and stabilize the training process of WGAN.
[0097] The tenth discriminant sequence current feature is input into the second fully connected layer and mapped to a true or false probability indicating whether the second sample current signal or the third sample current signal is true or false, thereby mapping the flattened feature map to a scalar value for discriminating the authenticity of the input data. The output of the fully connected layer is a real number, indicating the probability that the input data is true data.
[0098] Step 105: Generate a total loss value based on the authenticity probability.
[0099] In this embodiment, a total loss value may be generated for the GWAN based on the true or false probability.
[0100] In the specific implementation, the bulldozer distance can be calculated according to the true and false probability. Using the bulldozer distance as the optimization strategy of WGAN can reduce the probability of gradient disappearance and WGAN collapse.
[0101] Among them, the bulldozer distance can be expressed as follows:
[0102]
[0103] In the formula, S r is the distribution of the second sample current signal, S g is the distribution of the third sample current signal, Π(S r ,S g ) are all possible joint distributions of the second sample current signal and the third sample current signal, E is the expectation operation, for each possible joint distribution α, we can sample (x, y)~α to obtain a real sample (second sample current signal) x and a generated sample (third sample current signal) y, and calculate the expected value of the distance [||xy||] of this pair of samples, which is defined as the bulldozer distance.
[0104] At the end of the WGAN, the second sample current signal is compared with the third sample current signal to generate a perceptual loss value (Perceptual Losses).
[0105] Among them, the perceptual loss value can be expressed as follows:
[0106]
[0107] In the formula, F H is the third sample current signal generated, F L is the first sample current signal, G δ is the generator, Φ i,j Denotes the generator G δThe generated current signal is the temporal feature map obtained after the j-th one-dimensional convolution layer of the pre-trained network (such as VGG19) and after activation, and before the i-th maximization layer in the pre-trained network (such as VGG19), U i.j and V i.j Represents the size of the feature map in the spatial dimension.
[0108] In WGAN, pre-trained networks (such as VGG19) can be used to calculate perceptual loss, that is, the intermediate layer features of the pre-trained network (such as VGG19) are used to measure the similarity between the generated signal and the real signal. This perceptual loss helps to improve the quality of the generated signal.
[0109] The bulldozer distance and the perceived loss value are weighted and summed to obtain the total loss value.
[0110] At this point, the total loss value can be expressed as:
[0111] l=l w +ηl x
[0112] Among them, l is the total loss value, l w is the bulldozer distance, l x is the perceptual loss value, and η is a hyperparameter (such as 100) used to balance the bulldozer distance and the perceptual loss value.
[0113] Step 106: Update the generative adversarial network according to the total loss value.
[0114] In this embodiment, the Adam (Adaptive Moment Estimation) optimization algorithm can be used to update the WGAN according to the total loss value, and the initial learning rate is set to 10 -4 , and gradually reduce the learning rate as the number of iterations increases, aiming to ensure the effectiveness and robustness of training WGAN.
[0115] Step 107, determine whether the preset training conditions are met; if so, execute step 108; if not, return to execute steps 103-107.
[0116] Step 108: Determine whether the generative adversarial network has completed training.
[0117] In practical applications, WGAN consists of a generator and a discriminator. The generator G receives a random variable z and generates fake sample data G(z). The goal of the generator is to make the generated samples as indistinguishable from the real samples as possible. The input of the discriminator D consists of two parts, the real data x and the data G(z) generated by the generator. The output of the discriminator is a probability value, which indicates the probability that D believes the input comes from real data. If the input is real data, the output should be close to 1; if the input is generated data, the output should be close to 0. At the same time, the output of the discriminator is fed back to the generator to guide the training of the generator. Ideally, the discriminator cannot distinguish whether the input data comes from real data x or generated data G(z), that is, the output probability value of the discriminator should be 0.5 each time (equivalent to random guessing), at which time WGAN reaches the optimal value.
[0118] In this embodiment, training conditions can be pre-set as conditions for stopping WGAN training, for example, the number of iterations reaches a certain threshold (such as 1000), the total loss value is less than a certain threshold, the change in the total loss value in multiple iterative training is less than a certain threshold, and so on. In each round of iterative training, it is determined whether the training conditions are met.
[0119] If the training conditions are met, WGAN training is considered complete. At this point, the parameters in WGAN are output and written to the corresponding configuration file.
[0120] If the training conditions are not met, the next round of iterative training can be entered, and steps 103 to 107 are executed again, and the iterative training is repeated in this way until the WGAN training is completed.
[0121] Further, when the training of WGAN is completed, part of the first sample current image data may be input into the generator to increase the frequency so as to construct a fourth sample current signal.
[0122] The performance index is calculated according to the second sample current signal and the fourth sample current signal.
[0123] Exemplarily, the performance indicators include mean square error (MSE), peak signal-to-noise ratio (PSNR) and structural similarity index (SSIM).
[0124] The mean square error represents the square of the difference between the fourth sample current signal generated at each time t and the second sample current signal, and the average value is taken to measure the overall error. The mean square error can be expressed as follows:
[0125]
[0126] Where T is the number of time steps, t∈T, X t is the fourth sample current signal at time t, Y tis the second sample current signal at time t.
[0127] The peak signal-to-noise ratio is used to measure the quality of the signal. The unit of PSNR is db. The larger the value, the smaller the distortion. The closer the characteristics of the fourth sample current signal are to those of the second sample current signal. The peak signal-to-noise ratio can be expressed as follows:
[0128]
[0129] Among them, I MAX To verify the amplitude of the current signal.
[0130] The structural similarity index can measure the structural similarity between the fourth sample current signal and the second sample current signal. The larger the structural similarity index is, the higher the structural similarity between the fourth sample current signal and the second sample current signal is. The structural similarity index can be expressed as follows:
[0131]
[0132] Among them, μ I is the average value of the second sample current signal, σ I is the variance of the second sample current signal, μ K is the average value of the fourth sample current signal, σ K is the variance of the fourth sample current signal, σ IK is the covariance between the fourth sample current signal and the second sample current signal, and c1 and c2 are both constants.
[0133] The generator is verified according to the performance indicators, that is, whether the performance of the generator meets the requirements.
[0134] Exemplarily, a data model can be constructed in advance for the mean square error, peak signal-to-noise ratio and structural similarity index using methods such as the threshold method. When the mean square error, peak signal-to-noise ratio and structural similarity index meet the data model, it is determined that the performance of the generator meets the requirements. When the mean square error, peak signal-to-noise ratio and structural similarity index do not meet the data model, it is determined that the performance of the generator does not meet the requirements.
[0135] In this embodiment, the first sample current signal and the second sample current signal are synchronously collected from the electrical equipment specified in the power grid; the frequency of the first sample current signal is lower than the frequency of the second sample current signal; a generative adversarial network based on the bulldozer distance is loaded; the generative adversarial network has a generator and a discriminator; the first sample current signal is input into the generator to increase the frequency to construct a third sample current signal; the second sample current signal and the third sample current signal are input into the discriminator to generate the probability of authenticity; the total loss value is generated according to the probability of authenticity; the generative adversarial network is updated according to the total loss value; it is determined whether the preset training conditions are met; if so, it is determined that the generative adversarial network has completed the training; if not, it returns to execute the input of the first sample current signal into the generator to increase the frequency to construct the third sample current signal. The generator directly reconstructs the one-dimensional low-frequency current signal into a one-dimensional high-frequency or ultra-high-frequency current signal, realizing the direct conversion of the one-dimensional sequence signal. While ensuring that the one-dimensional sequence signal has a high degree of accuracy, the operation is direct, simple, and the calculation is fast. It does not rely on specific sensors, has low cost, and can be widely promoted.
[0136] Embodiment 2
[0137] See also Figure 4 , shows a flow chart of a current reconstruction method provided by the first embodiment of the present invention, the method can be executed by a current reconstruction device, the training of the generative adversarial network and the current reconstruction device can be implemented in the form of hardware and / or software, and the current reconstruction device can be configured in an electronic device. Figure 4 As shown, the method includes:
[0138] Step 401: Collect original current signals from designated electrical equipment in a power grid.
[0139] When the electrical equipment has a resistive load, the current signal of the electrical equipment can be collected based on the principle of voltage drop caused by current, and recorded as the original current signal. That is, the original current signal is collected by voltage division when the resistance is small.
[0140] In the absence of frequency restrictions, high-frequency and ultra-high-frequency current signals can be obtained, but they exhibit low-frequency performance.
[0141] For the original current signal, the original current signal can be preprocessed to improve the quality of the original current signal.
[0142] The preprocessing includes wavelet denoising and Z-score normalization.
[0143] If the preprocessing is completed, one-dimensional reflection filling can be performed on the original current signal.
[0144] Step 402: Load the generator.
[0145] In this embodiment, the generator that has been trained according to the method of Embodiment 1 can be loaded into the memory for execution.
[0146] Step 403: Input the original current signal into a generator to increase the frequency to construct a target current signal.
[0147] In practical applications, the original current signal is input into the generator, and the generator processes the original current signal according to its structure, increases the frequency of the original current signal, and thus constructs a high-frequency or ultra-high-frequency target current signal.
[0148] In the embodiment, since the application of step 403 in embodiment 2 is basically similar to that of step 103 in embodiment 1, the description is relatively simple. For the relevant parts, please refer to the partial description of step 103 in embodiment 1. This embodiment will not be described in detail here.
[0149] In this embodiment, the original current signal is collected from the designated electrical equipment in the power grid, loaded into the generator, and the original current signal is input into the generator to increase the frequency to construct the target current signal. The generator directly reconstructs the one-dimensional low-frequency current signal into a one-dimensional high-frequency or ultra-high-frequency current signal, and realizes the direct conversion of the one-dimensional sequence signal. While ensuring that the one-dimensional sequence signal has a high degree of accuracy, the operation is direct and simple, the calculation is fast, it does not rely on specific sensors, the cost is low, and it can be promoted on a large scale.
[0150] Embodiment 3
[0151] See also Figure 5 , shows a schematic diagram of the structure of a training device for a generative adversarial network provided in Embodiment 3 of the present invention. Figure 5 As shown, the device comprises:
[0152] The sample current signal acquisition module 501 is used to synchronously acquire a first sample current signal and a second sample current signal from a specified electrical device in a power grid; the frequency of the first sample current signal is lower than the frequency of the second sample current signal;
[0153] A generative adversarial network loading module 502 is used to load a generative adversarial network based on the bulldozer distance; the generative adversarial network has a generator and a discriminator;
[0154] A training current signal construction module 503, configured to input the first sample current signal into the generator to increase the frequency so as to construct a third sample current signal;
[0155] A true-false probability generating module 504, configured to input the second sample current signal and the third sample current signal into the discriminator to generate a true-false probability;
[0156] A total loss value generating module 505, used to generate a total loss value according to the authenticity probability;
[0157] A generative adversarial network update module 506, configured to update the generative adversarial network according to the total loss value;
[0158] The training condition determination module 507 is used to determine whether the preset training condition is met; if so, the training completion module 508 is executed; if not, the training current signal construction module 503 is returned to execute;
[0159] The training completion module 508 is used to determine whether the generative adversarial network has completed training.
[0160] In one embodiment of the present invention, the generator includes, in sequence, a first fully connected layer, a first gated recurrent unit, a first upsampling layer, a first convolutional layer, a second upsampling layer, a second convolutional layer, and a third convolutional layer;
[0161] The training current signal building module 503 includes:
[0162] A first sample current sequence feature generating module, used for inputting the first sample current signal into the first fully connected layer and mapping it into a first sample current sequence feature;
[0163] A second sample current sequence feature generating module, used for inputting the first sample current sequence feature into the first gated cycle unit to extract a second sample current sequence feature;
[0164] A third sample current sequence feature generating module, configured to input the second sample current signal into the first up-sampling layer to perform an up-sampling operation, and obtain a third sample current sequence feature;
[0165] a fourth sample current sequence feature generating module, configured to input the third sample current signal into the first convolution layer to perform a convolution operation, thereby obtaining a fourth sample current sequence feature;
[0166] a fifth sample current sequence feature generating module, configured to perform batch normalization processing on the fourth sample current sequence feature to obtain a fifth sample current sequence feature;
[0167] a sixth sample current sequence feature generating module, configured to input the fifth sample current signal into the second up-sampling layer to perform an up-sampling operation, and obtain a sixth sample current sequence feature;
[0168] a seventh sample current sequence feature generating module, configured to input the sixth sample current signal into the second convolution layer to perform a convolution operation, so as to obtain a seventh sample current sequence feature;
[0169] an eighth sample current sequence feature generating module, configured to perform batch normalization processing on the seventh sample current sequence feature to obtain an eighth sample current sequence feature;
[0170] The third sample current signal generating module is used to input the eighth sample current signal into the third convolution layer to perform a convolution operation to obtain a third sample current signal.
[0171] In one embodiment of the present invention, the discriminator includes, in sequence, a fourth convolutional layer, a first maximum pooling layer, a fifth convolutional layer, a second maximum pooling layer, a second gated recurrent unit, a third gated recurrent unit, and a second fully connected layer;
[0172] The authenticity probability generation module 504 includes:
[0173] a first discrimination sequence current feature generating module, configured to input the second sample current signal or the third sample current signal into the fourth convolution layer to perform a convolution operation, so as to obtain a first discrimination sequence current feature;
[0174] A second discrimination sequence current feature generation module, used for sequentially performing a batch normalization operation and an activation operation on the first discrimination sequence current feature to obtain a second discrimination sequence current feature;
[0175] A third discriminant sequence current feature generating module, used for inputting the second discriminant sequence current feature into the first maximum pooling layer to perform a maximum pooling operation to obtain a third discriminant sequence current feature;
[0176] a fourth discriminant sequence current feature generating module, configured to input the third discriminant sequence current feature into the fifth convolution layer to perform a convolution operation, thereby obtaining a fourth discriminant sequence current feature;
[0177] a fifth discrimination sequence current feature generation module, configured to sequentially perform a batch normalization operation and an activation operation on the fourth discrimination sequence current feature to obtain a fifth discrimination sequence current feature;
[0178] a sixth discriminant sequence current feature generating module, configured to input the fifth discriminant sequence current feature into the second maximum pooling layer to perform a maximum pooling operation to obtain a sixth discriminant sequence current feature;
[0179] A seventh discrimination sequence current feature generating module, configured to input the sixth discrimination sequence current feature into the second gated cycle unit to extract a seventh discrimination sequence current feature;
[0180] an eighth discrimination sequence current feature generating module, configured to perform a batch normalization operation on the seventh discrimination sequence current feature to obtain an eighth discrimination sequence current feature;
[0181] A ninth discrimination sequence current feature generating module, configured to input the eighth discrimination sequence current feature into the third gated cycle unit to extract a ninth discrimination sequence current feature;
[0182] a tenth discrimination sequence current feature generating module, configured to perform a batch normalization operation on the ninth discrimination sequence current feature to obtain a tenth discrimination sequence current feature;
[0183] The true-false probability construction module is used to input the tenth discrimination sequence current feature into the second fully connected layer to map it into a true-false probability indicating whether the second sample current signal or the third sample current signal is true or false.
[0184] In one embodiment of the present invention, the total loss value generating module 505 includes:
[0185] A bulldozer distance calculation module, used for calculating the bulldozer distance according to the true and false probability;
[0186] a perception loss value generating module, configured to compare the second sample current signal with the third sample current signal to generate a perception loss value;
[0187] The linear fusion module is used to perform weighted summation of the bulldozer distance and the perception loss value to obtain a total loss value.
[0188] In one embodiment of the present invention, the device further comprises:
[0189] A preprocessing module, used for preprocessing the first sample current signal; the preprocessing includes wavelet denoising and Z-score normalization;
[0190] A reflection filling module is used to perform one-dimensional reflection filling on the first sample current signal if the preprocessing is completed.
[0191] In one embodiment of the present invention, the device further comprises:
[0192] A verification current signal construction module, used for inputting the first sample current image data into the generator to increase the frequency so as to construct a fourth sample current signal;
[0193] a performance index calculation module, configured to calculate a performance index according to the second sample current signal and the fourth sample current signal;
[0194] A generator verification module is used to verify the generator according to the performance indicator.
[0195] Exemplarily, the performance indicators include mean square error, peak signal-to-noise ratio and structural similarity index.
[0196] The training device for a generative adversarial network provided in an embodiment of the present invention can execute the training method for a generative adversarial network provided in any embodiment of the present invention, and has functional modules and beneficial effects corresponding to executing the training method for a generative adversarial network.
[0197] Embodiment 4
[0198] See also Figure 6 , shows a schematic diagram of the structure of a current reconstruction device provided by Embodiment 4 of the present invention. Figure 6 As shown, the device comprises:
[0199] The original current signal acquisition module 601 is used to acquire the original current signal of the specified electrical equipment in the power grid;
[0200] A generator loading module 602, used to load the generator trained according to the method described in Embodiment 1;
[0201] The target current signal construction module 603 is used to input the original current signal into the generator to increase the frequency so as to construct a target current signal.
[0202] The current reconstruction device provided in the embodiment of the present invention can execute the current reconstruction method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the current reconstruction method.
[0203] Embodiment 5
[0204] See also Figure 7 , showing a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0205] like Figure 7As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0206] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0207] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as the training method of generating adversarial networks or the current reconstruction method.
[0208] In some embodiments, the training method or current reconstruction method of the generative adversarial network may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the training method or current reconstruction method of the generative adversarial network described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the training method or current reconstruction method of the generative adversarial network by any other appropriate means (e.g., by means of firmware).
[0209] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0210] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0211] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0212] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0213] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0214] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0215] Embodiment 6
[0216] An embodiment of the present invention also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the training method of the generative adversarial network or the current reconstruction method provided in any embodiment of the present invention.
[0217] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0218] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0219] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A training method for generating an adversarial network, characterized in that: include: Synchronously collecting a first sample current signal and a second sample current signal from a designated electrical device in a power grid; The frequency of the first sample current signal is lower than the frequency of the second sample current signal; Loading a generative adversarial network based on bulldozer distance; the generative adversarial network has a generator and a discriminator; Inputting the first sample current signal into the generator to increase the frequency so as to construct a third sample current signal; Inputting the second sample current signal and the third sample current signal into the discriminator to generate a true or false probability; Generating a total loss value according to the true and false probability; Updating the generative adversarial network according to the total loss value; Determine whether the preset training conditions are met; if so, determine that the generative adversarial network has completed training; if not, return to execute the step of inputting the first sample current signal into the generator to increase the frequency to construct a third sample current signal.
2. The method according to claim 1, characterized in that: The generator sequentially includes a first fully connected layer, a first gated recurrent unit, a first upsampling layer, a first convolutional layer, a second upsampling layer, a second convolutional layer and a third convolutional layer; The step of inputting the first sample current signal into the generator to increase the frequency so as to construct a third sample current signal comprises: Inputting the first sample current signal into the first fully connected layer to map it into a first sample current sequence feature; Inputting the first sample current sequence feature into the first gated cycle unit to extract the second sample current sequence feature; Inputting the second sample current signal into the first up-sampling layer to perform an up-sampling operation to obtain a third sample current sequence feature; Inputting the third sample current signal into the first convolution layer to perform a convolution operation to obtain a fourth sample current sequence feature; performing batch normalization processing on the fourth sample current sequence feature to obtain a fifth sample current sequence feature; Inputting the fifth sample current signal into the second up-sampling layer to perform an up-sampling operation to obtain a sixth sample current sequence feature; Inputting the sixth sample current signal into the second convolution layer to perform a convolution operation to obtain a seventh sample current sequence feature; performing batch normalization processing on the seventh sample current sequence feature to obtain an eighth sample current sequence feature; The eighth sample current signal is input into the third convolution layer to perform a convolution operation to obtain a third sample current signal.
3. The method according to claim 1, characterized in that: The discriminator includes, in sequence, a fourth convolutional layer, a first maximum pooling layer, a fifth convolutional layer, a second maximum pooling layer, a second gated recurrent unit, a third gated recurrent unit and a second fully connected layer; The step of inputting the second sample current signal and the third sample current signal into the discriminator to generate a true or false probability includes: Inputting the second sample current signal or the third sample current signal into the fourth convolution layer to perform a convolution operation to obtain a first discrimination sequence current feature; performing batch normalization operations and activation operations on the first discrimination sequence current characteristics in sequence to obtain a second discrimination sequence current characteristic; Inputting the second discriminant sequence current feature into the first maximum pooling layer to perform a maximum pooling operation to obtain a third discriminant sequence current feature; Inputting the third discriminant sequence current feature into the fifth convolution layer to perform a convolution operation to obtain a fourth discriminant sequence current feature; performing batch normalization operations and activation operations on the fourth discrimination sequence current characteristics in sequence to obtain a fifth discrimination sequence current characteristic; Inputting the fifth discriminant sequence current feature into the second maximum pooling layer to perform a maximum pooling operation to obtain a sixth discriminant sequence current feature; Inputting the sixth discrimination sequence current feature into the second gated cycle unit to extract the seventh discrimination sequence current feature; performing a batch normalization operation on the seventh discrimination sequence current feature to obtain an eighth discrimination sequence current feature; Inputting the eighth discrimination sequence current feature into the third gated cycle unit to extract the ninth discrimination sequence current feature; performing a batch normalization operation on the ninth discrimination sequence current feature to obtain a tenth discrimination sequence current feature; The tenth discrimination sequence current feature is input into the second fully connected layer and mapped into a true or false probability indicating whether the second sample current signal or the third sample current signal is true or false.
4. The method according to claim 1, characterized in that: The generating of the total loss value according to the authenticity probability comprises: Calculate the bulldozer distance according to the true and false probabilities; comparing the second sample current signal with the third sample current signal to generate a perceived loss value; The bulldozer distance and the perceived loss value are weighted and summed to obtain a total loss value.
5. The method according to claim 1, characterized in that After synchronously collecting the first sample current signal and the second sample current signal from the designated electrical equipment in the power grid, the method further includes: Preprocessing the first sample current signal; the preprocessing includes wavelet denoising and Z-score normalization; If the preprocessing is completed, one-dimensional reflection filling is performed on the first sample current signal.
6. The method according to any one of claims 1 to 5, characterized in that Also includes: Inputting the first sample current image data into the generator to increase the frequency so as to construct a fourth sample current signal; calculating a performance indicator according to the second sample current signal and the fourth sample current signal; The generator is verified according to the performance indicator.
7. The method according to claim 6, characterized in that The performance indicators include mean square error, peak signal-to-noise ratio and structural similarity index.
8. A current reconstruction method, characterized in that: include: Collect original current signals from designated electrical equipment in the power grid; Loading a generator trained according to the method of any one of claims 1 to 7; The original current signal is input into the generator to increase the frequency so as to construct a target current signal.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the training method of the generative adversarial network as described in any one of claims 1 to 7 or the current reconstruction method as described in claim 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the training method of the generative adversarial network according to any one of claims 1 to 7 or the current reconstruction method according to claim 8.
Citation Information
Cited By
Permanent magnet synchronous motor demagnetization fault positioning method based on branch current
CN121069181A
