Electric energy meter fault detection method and device of double-path constraint diffusion model

The fault detection model is generated through the dual-channel constrained diffusion model, which solves the problems of various and complex types of smart meter faults, and achieves the accuracy of fault identification and the reduction of operation and maintenance costs.

CN119474656APending Publication Date: 2025-02-18BEIJING UNIV OF POSTS & TELECOMM +1
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411361578.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

Smart meter fault types are diverse and complex, and the existing technology is difficult to effectively identify and classify, resulting in untimely and inaccurate fault handling, which increases the cost of power grid operation and maintenance and inconvenience of user power use.

Method used

A dual-channel constrained diffusion model is used to obtain multivariate data of smart meter and input it into a pre-trained fault detection model to generate a fault detection model. The model denoised the original data through data labels and sample distribution methods, and used the diffusion model constrained by the dual-channel discriminator to generate a minority sample data set, and trains the classification model to achieve fault detection.

Benefits of technology

It improves the accuracy of identifying smart meter faults, alleviates the in-class imbalance of a few types of samples, reduces the cost of power grid operation and maintenance, and ensures the stability of users' electricity use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474656A_ABST
    Figure CN119474656A_ABST
Patent Text Reader

Abstract

The invention discloses an electric energy meter fault detection method and device based on a double-path constraint diffusion model. The method comprises the following steps: acquiring multivariable data of a to-be-tested electric energy meter; inputting the multivariable data into a pre-trained fault detection model, and outputting a detection result of the to-be-detected electric energy meter, the detection result comprising a fault and a normal, the training process of the fault detection model comprises the following steps: denoising an original minority class sample data set and an original majority class sample data set based on a data label and a sample distribution method to obtain a minority class effective sample data set and a majority class sample data set; performing sample diffusion on the minority class effective sample data set by using a pre-trained diffusion model based on double-path discriminator constraint to generate a minority class sample data set; and training a pre-constructed classification model by using the minority class sample data set, the minority class effective sample data set and the majority class sample data set to generate a fault detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electric energy metering, and more specifically, to an electric energy meter fault detection method and device based on a dual-path constrained diffusion model. Background Art

[0002] In recent years, with the reform of the power market and the adjustment of relevant national energy policies, the interaction between users and the power market has become increasingly close. At the same time, with the continuous improvement of economic and technological levels, the demand for electricity in people's lives and work has continued to increase, and the requirements for the stability and reliability of power supply have become increasingly higher. In addition, various distributed power generation equipment has emerged in an endless stream, and it is difficult for traditional power networks to coordinate and meet the processes of power generation, transmission, and power consumption. In this environment, smart grids came into being. As the intelligent terminal of smart grids, smart meters, on the basis of traditional meters measuring power consumption, also have functions such as intelligent display, remote control, and power consumption monitoring, which play an important role in the stable operation of smart grids.

[0003] At present, with the continuous coverage of smart grids, smart meters are put into use on a large scale, and their manufacturers are gradually increasing. Each manufacturer has different design schemes, component selection and process flow; and the operation status of smart meters is inevitably affected by the geographical environment and specific installation location of different regions. The faults that occur during operation are diverse, sudden and complex, which have an important impact on the normal power consumption of users and the management and maintenance of smart grids. Smart meters have complex structures and various fault types. When a fault occurs, it is difficult for operation and maintenance personnel to dispatch maintenance personnel with relevant maintenance experience to repair the meter without knowing the fault type of the meter, which leads to untimely and inaccurate handling of smart meter faults. Therefore, by collecting relevant attribute information of smart meters and their fault types and conducting comprehensive analysis, a relatively accurate and robust fault classification model is established, which can not only help power grid companies to effectively dispatch operation and maintenance personnel and reduce the manpower and resource costs of power grid operation and maintenance, but also help to ensure the normal power consumption of residents and improve their sense of happiness.

[0004] With the advent of the big data era and the rapid development of computer technology, artificial intelligence has made qualitative progress, and the use of artificial intelligence related methods to solve problems has become a priority in various fields. Machine learning is the core research field of artificial intelligence. It mainly studies how to use the powerful computing power of computers to find patterns in data samples to acquire new knowledge and skills, and at the same time fit the distribution patterns of complex data to build a model with the ability to generalize. Proper use of machine learning methods can handle high-dimensional, multi-purpose complex data very well. At the same time, using the constructed model to help researchers make judgments and analyses also greatly saves human resources.

[0005] According to the research of relevant literature at home and abroad, the current fault detection methods of smart energy meters are mainly divided into two categories, algorithm-level methods and data-level methods. The algorithm-level methods reduce the bias of the model to the majority class fault samples by optimizing the model architecture or adjusting the loss function, so as to enhance the model's ability to distinguish between the majority class samples and the minority class samples. The algorithm-level methods have improved the decision-making deviation phenomenon of the model to a certain extent, but they cannot find a suitable cost matrix or a set of suitable hyperparameters for data sets with different characteristics, and cannot be applied to a variety of application scenarios, and their universality is poor. Compared with the algorithm-level methods, the data-level methods alleviate the decision-making deviation phenomenon of the basic classifier by achieving a balance of samples of different categories, and have stronger universality. The data-level methods are mainly divided into sampling methods and generation methods. The sampling method is dominated by oversampling. Oversampling synthesizes minority class samples through sample selection and interpolation, but the oversampling method only relies on the preset strategy to select and generate samples. There is no process of learning sample feature information, and the rationality of the generated samples cannot be guaranteed. At the same time, noise may be introduced. The generative class method mainly uses the generative deep learning model to learn the distribution of minority class samples, and generates minority class samples on this basis. At the same time, a certain discrimination mechanism is used to ensure the authenticity of the generated samples to a certain extent. However, the generated samples often have mode collapse and can only cover a few distribution modes. When faced with a data set with intra-class imbalance, it will even aggravate the intra-class imbalance, which is not conducive to the improvement of subsequent classification performance. However, in the smart meter fault data set, there are multiple distribution modes in the minority class fault samples, and there is an imbalance between the multiple distribution modes, that is, there are areas with high sample density and areas with low sample density. The existing data-level methods have limited ability to learn sample distribution modes and cannot mine multiple distribution modes of tabular data, resulting in limited improvement of subsequent classification performance. Summary of the invention

[0006] In view of the deficiencies in the prior art, the present invention provides a method and device for detecting faults in an electric energy meter using a dual-path constrained diffusion model.

[0007] According to one aspect of the present invention, a method for detecting faults in an electric energy meter using a dual-path constrained diffusion model is provided, comprising:

[0008] Obtain multivariable data of the electric energy meter to be tested;

[0009] The multivariate data is input into the pre-trained fault detection model, and the detection results of the electric energy meter to be tested are output, including fault and normal. The fault detection model is trained based on the minority class sample data generated by the two-way constrained diffusion model, and

[0010] The training process of the fault detection model is:

[0011] Based on the data label and sample distribution method, the original minority class sample data set and the original majority class sample data set are denoised to obtain the minority class valid sample data set and the majority class sample data set;

[0012] Using the pre-trained diffusion model based on two-way discriminator constraints to perform sample diffusion on the minority class valid sample data set, a minority class sample data set is generated;

[0013] The pre-built classification model is trained using the minority class sample data set, the minority class valid sample data set, and the majority class sample data set to generate a fault detection model.

[0014] Optionally, denoising the original minority class sample data set and the original majority class sample data set based on the data label and sample distribution method to obtain a minority class valid sample data set and a majority class sample data set includes:

[0015] Based on the nearest neighbor data labeling method, local denoising is performed on the original minority class sample data set and the original majority class sample data set to obtain the initial minority class valid sample data set and the initial majority class sample data set;

[0016] Based on the single-class support vector machine, the initial minority class valid sample data set and the initial majority class sample data set are globally denoised to obtain the minority class valid sample data set and the majority class sample data set.

[0017] Optionally, the optimization objective of the single-class support vector machine is:

[0018]

[0019] In the formula, α is the support vector of the hyperplane, b is the distance from the hyperplane to the origin, is a slack variable, representing the minority class sample x i The degree of abnormality, μ controls the proportion of noise samples, <α,x i > represents the distance between the sample support vector and the hyperplane after the kernel function operation;

[0020] The denoising criterion of the single-class vector machine is:

[0021] score=Sign(b-<α,x>)

[0022] Wherein, Sign() is a sign function, score is the abnormal score of the sample data, when score=1, the sample data is determined to be normal sample data, and when score=-1, the sample data is determined to be noise sample data.

[0023] Optionally, a pre-trained diffusion model based on two-way discriminator constraints is used to perform sample diffusion on a minority class valid sample dataset to generate a minority class sample dataset, including:

[0024] Perform forward propagation processing on the minority class valid sample data set to obtain the initial minority class sample data set that conforms to the normal distribution;

[0025] The initial minority class sample data set is denoised using an inverse denoising network with a two-way discriminant constraint to generate a minority class sample data set.

[0026] Optionally, the expression for the forward propagation process is:

[0027]

[0028] In the formula, x represents the original data, t represents the tth step of the forward process, and x t represents the data of the tth step in the forward process, ε represents Gaussian noise, Is a hyperparameter that controls the size of the noise. Usually α i is a very small and gradually decreasing constant value;

[0029] The denoising process of the reverse denoising network is:

[0030]

[0031] Where z represents the standard Gaussian distribution, σ t is the predefined variance at step t, θ ddpm represents the parameters of the diffusion model, Represents the noise of the t-th step sample predicted by the denoising model.

[0032] Optionally, the two-way discriminant constraint includes a sample density discriminator and a sample authenticity discriminator, wherein,

[0033] The loss function of the sample density discriminator is:

[0034]

[0035] in,

[0036]

[0037] In the formula, dis x and Respectively represent the minority class valid sample data set x and the initial minority class sample data set x gen The average distance to the K nearest neighbors, E represents the mean loss in a batch of samples, X i represents the samples in the nearest neighbor sample set, and k represents the size of the nearest neighbor sample set;

[0038] The loss function of the sample authenticity discriminator is:

[0039] L Dis2 =E[log(M(x))]+E[log(1-M(x) gen ))]

[0040] In the formula,

[0041] M(x)=x·m

[0042] Where M(x) is the mask of the valid data of the minority class, m = [m0,m1,...,m q ],m i ~Binomal(1,p), q is the number of feature dimensions of minority class samples.

[0043] Optionally, the loss function of the diffusion model is:

[0044] L=L ddpm +αL Dis1 +βL G

[0045] in,

[0046]

[0047] L G =E[log(M(x gen ))]

[0048] Where α and β are the hyperparameters that control the influence of the sample density discriminator and the sample authenticity discriminator on the diffusion model denoising network. G is the loss function of the sample authenticity discriminator acting on the diffusion model, L ddpm is the loss function for noise prediction.

[0049] According to another aspect of the present invention, there is provided an electric energy meter fault detection device based on a dual-path constrained diffusion model, comprising:

[0050] An acquisition module, used for acquiring multivariable data of the electric energy meter to be tested;

[0051] The output module is used to input multivariate data into a pre-trained fault detection model and output the detection results of the electric energy meter to be tested, including fault and normal, wherein the fault detection model is trained based on the minority class sample data generated by the two-way constrained diffusion model, and

[0052] The training process of the fault detection model is:

[0053] Based on the data label and sample distribution method, the original minority class sample data set and the original majority class sample data set are denoised to obtain the minority class valid sample data set and the majority class sample data set;

[0054] Using the pre-trained diffusion model based on two-way discriminator constraints to perform sample diffusion on the minority class valid sample data set, a minority class sample data set is generated;

[0055] The pre-built classification model is trained using the minority class sample data set, the minority class valid sample data set and the majority class sample data set to generate a fault detection model.

[0056] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute the method described in any one of the above aspects of the present invention.

[0057] According to another aspect of the present invention, an electronic device is provided, comprising: a processor; a memory for storing instructions executable by the processor; the processor is configured to read the executable instructions from the memory and execute the instructions to implement the method described in any one of the above aspects of the present invention.

[0058] Therefore, the present invention first removes the noise in the data set and the samples that interfere with the normal distribution pattern of the data based on the data labels and sample distribution, and then constructs a two-way discriminator to constrain the diffusion model. On the basis of ensuring that the generated samples conform to the original data distribution, the intra-class imbalance of the minority class samples is alleviated, and the phenomenon that the classifier ignores the classification accuracy of the sparse areas of the minority class due to the intra-class imbalance of the minority class is avoided. The fault recognition accuracy of the subsequent basic classifier is effectively improved, thereby reducing the potential huge economic losses and ensuring the stable operation and safety of the power grid. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] A more complete understanding of exemplary embodiments of the present invention may be obtained by referring to the following drawings:

[0060] Figure 1 It is a flow chart of an electric energy meter fault detection method of a dual-path constrained diffusion model provided by an exemplary embodiment of the present invention;

[0061] Figure 2 It is another flow chart of a method for detecting faults in an electric energy meter using a dual-path constrained diffusion model provided by an exemplary embodiment of the present invention;

[0062] Figure 3 is a denoising flow chart based on data labels and sample distribution provided by an exemplary embodiment of the present invention;

[0063] Figure 4A flow chart of generating samples based on a diffusion model under a two-way discriminator provided by an exemplary embodiment of the present invention;

[0064] Figure 5 It is a structural schematic diagram of an electric energy meter fault detection device of a dual-path constrained diffusion model provided by an exemplary embodiment of the present invention;

[0065] Figure 6 This is a structure of an electronic device provided by an exemplary embodiment of the present invention. DETAILED DESCRIPTION

[0066] Below, the exemplary embodiments according to the present invention will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments of the present invention, and it should be understood that the present invention is not limited to the exemplary embodiments described here.

[0067] It should be noted that the relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present invention unless specifically stated otherwise.

[0068] Those skilled in the art can understand that the terms "first" and "second" in the embodiments of the present invention are only used to distinguish different steps, devices or modules, etc., and neither represent any specific technical meaning nor indicate the necessary logical order between them.

[0069] It should also be understood that, in the embodiments of the present invention, “plurality” may refer to two or more than two, and “at least one” may refer to one, two or more than two.

[0070] It should also be understood that any component, data or structure mentioned in the embodiments of the present invention can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.

[0071] In addition, the term "and / or" in the present invention is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present invention generally indicates that the associated objects before and after are in an "or" relationship.

[0072] It should also be understood that the description of the various embodiments of the present invention focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.

[0073] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0074] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.

[0075] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered part of the specification.

[0076] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0077] Embodiments of the present invention can be applied to electronic devices such as terminal devices, computer systems, servers, etc., which can operate with many other general or special computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, servers, etc. include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, large computer systems, and distributed cloud computing technology environments including any of the above systems, etc.

[0078] Electronic devices such as terminal devices, computer systems, servers, etc. can be described in the general context of computer system executable instructions (such as program modules) executed by computer systems. Generally, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in a distributed cloud computing environment, where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.

[0079] Exemplary Methods

[0080] Figure 1 FIG. 1 is a flow chart of a method for detecting a fault in an electric energy meter using a dual-path constrained diffusion model according to an exemplary embodiment of the present invention. This embodiment can be applied to electronic devices, such as Figure 1 As shown, the electric energy meter fault detection method 100 of the dual-path constrained diffusion model includes the following steps:

[0081] Step 101, obtaining multivariable data of the electric energy meter to be tested;

[0082] Step 102, input the multivariate data into a pre-trained fault detection model, and output the detection result of the electric energy meter to be tested, the detection result includes fault and normal, wherein the fault detection model is trained based on the minority class sample data generated by the two-way constrained diffusion model, and

[0083] The training process of the fault detection model is:

[0084] Based on the data label and sample distribution method, the original minority class sample data set and the original majority class sample data set are denoised to obtain the minority class valid sample data set and the majority class sample data set;

[0085] Using the pre-trained diffusion model based on two-way discriminator constraints to perform sample diffusion on the minority class valid sample data set, a minority class sample data set is generated;

[0086] The pre-built classification model is trained using the minority class sample data set, the minority class valid sample data set, and the majority class sample data set to generate a fault detection model.

[0087] Specifically, the meter fault classification problem is essentially an unbalanced classification problem. In an unbalanced data set, the number of minority class samples is less than the number of majority class samples. The classifier will be biased towards majority class samples during the classification process, that is, it will pay more attention to the accuracy of majority class samples, resulting in a decrease in the classification accuracy of minority class samples. The intra-class imbalance of minority class samples and the noise samples in the data set will have a negative impact on the accurate classification of the data set and minority class samples. When there are different distribution patterns within the minority class samples, and the sample densities of different distribution patterns are also different. During the classification process, the area with higher density has a greater impact on the classifier than the area with lower density. Therefore, the classifier will focus on the classification accuracy of the area with higher density and ignore the area with lower density, resulting in a decrease in the classification performance of the classifier. At the same time, when there are noise samples in both the majority class and the minority class in the data set, the noise will interfere with the normal distribution pattern of the samples. In the sample generation process, the noise will be regarded as an independent distribution pattern by the model. The model will generate more noise around the noise samples, which will affect the decision boundary and classification performance of the classifier.

[0088] In view of the above problems, the present invention proposes an Electricity Meter Fault Classification Method and System Based on Dual-pathConstrained Diffusion Model (EMFC-DM). First, the noise that interferes with the normal distribution pattern in the data set is removed to provide a good data basis for subsequent sample generation. On the basis of the diffusion model fully learning the distribution pattern of the original minority class fault samples, a dual-path discriminant constraint is designed to control the spatial distribution of the generated samples, so that the generated samples can alleviate the intra-class imbalance of the minority class fault samples on the basis of alleviating the inter-class imbalance, avoiding the phenomenon that the classifier ignores the classification accuracy of the sparse areas of the minority class due to the intra-class imbalance of the minority class, and effectively improving the classification performance of the basic classifier. The present invention mainly includes two steps: (1) a denoising strategy based on data labels and sample distribution; (2) a sample generation method based on the diffusion model under the constraints of a dual-path discriminator. The overall process of the proposed invention is as follows. Figure 2 shown.

[0089] 1. Denoising based on data labels and sample distribution:

[0090] Noise samples refer to instances where labels or sample attributes are incorrectly labeled. Noise samples will have a certain impact on the normal distribution pattern of samples, especially when there is an intra-class imbalance in minority class samples. The diffusion model will also regard noise samples as an independent distribution pattern in the process of learning sample distribution, and will generate more noise samples or samples that have a counterproductive effect on improving classification performance in the process of generating samples.

[0091] For noise samples whose labels are incorrectly labeled, they are often located in the distribution pattern of another type of samples, and their labels are different from those of the surrounding neighboring samples; for noise samples whose sample attributes are incorrectly labeled, they tend to deviate from the distribution pattern of the same type of samples to a certain extent. Based on this, the present invention proposes a denoising method based on data labels and sample distribution, which is mainly divided into two steps: local denoising based on neighboring data labels and global denoising based on the overall distribution of data. The denoising process is as follows: Figure 3 shown.

[0092] First, local denoising is performed based on the neighbor labels of the samples. Specifically, the training set D = {x1, x2, ..., x i ,...,x n} is divided into a minority sample set D min and the majority class sample set D maj , n represents the number of training set samples. For sample x, use the K nearest neighbor algorithm to obtain its K nearest neighbor sample set nei-setx ={x 1 ,x 2 ,...,x k}. If the sample x∈D min , and the samples in its K nearest neighbor sample set are all majority class samples, that is: Then it will be judged as a noise sample. Similarly, if the sample x∈D maj , and the samples in its K nearest neighbor sample set are all minority class samples, that is: It is then judged as a noise sample.

[0093] On the basis of local denoising, the data set is globally denoised based on the overall distribution of the original data. The present invention uses a one-class support vector machine (OCSVM) to detect noise samples whose sample attributes are incorrectly labeled in the data set. The one-class support vector machine captures the normal distribution pattern of the original data to identify and filter out noise samples that do not conform to the normal distribution pattern.

[0094] Assume that the minority class sample set n m i n Represents the number of minority class samples. The goal of a single-class support vector machine is to find a splitting hyperplane so that all minority class samples are on the same side of the hyperplane and have the maximum distance from the hyperplane. Then, based on the distance between each minority class sample and the hyperplane, it is determined whether the sample is a noise sample. The optimization goal of a single-class support vector machine is shown in formula (5-1).

[0095]

[0096] Where α is the support vector of the hyperplane, b is the distance from the hyperplane to the origin, is a slack variable, representing the minority class sample x i The degree of abnormality, μ controls the proportion of noise samples, <α,x i > represents the distance between the sample support vector and the hyperplane after the kernel function operation. For the minority class sample x, the calculation of its abnormal score score is shown in formula (5-2).

[0097] score=Sign(b-<α,x>) (5-2)

[0098] Where Sign() is a sign function. If the anomaly score of the minority class sample x is 1, it is judged as a normal sample; if the anomaly score of the minority class sample x is -1, it is judged as a noise sample.

[0099] For most class samples, single-class support vector machines are also used for global denoising. The denoising strategy based on data labels and sample distribution can effectively remove noise samples in the data set and samples that interfere with the original data distribution pattern, laying a good data foundation for subsequent sample generation and screening.

[0100] 2. Sample generation method based on diffusion model under the constraint of two-way discriminator:

[0101] For an unbalanced data set, the number of majority class samples is greater than the number of minority class samples. The classifier will be biased towards majority class samples during the classification process, that is, it will pay more attention to the accuracy of majority class samples, resulting in a lower classification accuracy for minority class samples. When there are different distribution patterns within minority class samples, and the sample densities of different distribution patterns are also different. During the classification process, the impact of higher density areas on the classifier is greater than that of lower density areas. The classifier will focus on the classification accuracy of higher density areas and ignore lower density areas, resulting in a decrease in classification performance. Therefore, alleviating the intra-class imbalance of minority class samples while balancing the overall number and distribution of the two types of samples is the key to improving the classification accuracy of the minority class and the overall classification performance.

[0102] The diffusion model is a probabilistic generative model inspired by non-equilibrium thermodynamics. It uses two interrelated Markov chains to achieve data generation, one is the forward chain that perturbs the original data into noise, and the other is the reverse chain that converts the noise back to the original data distribution. The forward process starts with the original data distribution and gradually introduces noise through a series of diffusion steps to convert the original data into a Gaussian distribution. In the reverse process, the model learns how to gradually restore the original data distribution from the Gaussian distribution through a series of denoising steps. The process of generating new samples starts with Gaussian noise, and through the steps of reverse diffusion, denoises step by step to restore new data samples.

[0103] In the forward process, by continuously adding different degrees of Gaussian noise to the original sample x, the distribution of the original sample gradually approaches the normal distribution. This process is shown in formula (5-3).

[0104]

[0105] Where x0 represents the original data, t represents the tth step of the forward process, and x t represents the data of the tth step in the forward process, ε represents Gaussian noise, Is a hyperparameter that controls the size of the noise. Usually α i is a very small and gradually decreasing constant value.

[0106] In the reverse denoising process, the model needs to predict the noise added in each step of the forward diffusion process, and its loss function is shown in formula (5-4).

[0107]

[0108] where θ ddpm represents the parameters of the diffusion model, Represents the noise of the sample at step t predicted by the denoising model. The denoising model that has converged in training gradually removes the noise from the Gaussian distribution by predicting and inferring the noise added at each time step to obtain samples that satisfy the original distribution pattern. The denoising process is shown in formula (5-5).

[0109]

[0110] Where z represents the standard Gaussian distribution, σ t is the predefined variance at step t.

[0111] The denoising network UNet of the diffusion model is designed to process the complex relationships in image data. It extracts the spatial relationships and local features of the image through the convolution layer. Tabular data is usually structured and exists in the form of rows and columns. It does not contain the spatial relationships and local features in the image. Directly using UNet to generate tabular data will result in unclear boundaries between the distribution patterns of the generated samples, and it is impossible to accurately cover the distribution of the original minority class samples. Therefore, the UNet denoising network used in the standard diffusion model cannot effectively extract feature information from the tabular data. The present invention uses a multi-layer perceptron (MLP) to replace UNet as the denoising model in the reverse process, which can better extract the high-level feature information of the tabular data.

[0112] Compared with VAE-based and GAN-based generative models, the diffusion model gradually understands how the various parts of the original data are related to each other and how they change dynamically with the increase or decrease of noise during the process of adding noise and denoising the original samples. This progressive learning method enables the model to gain insight into the inherent structure and laws of the data. Therefore, the model can effectively capture the characteristics and details of the data at different scales, and has a stronger ability to learn the distribution of the original samples. The generated samples can widely reflect the diverse distribution characteristics of the original data. However, for minority class samples with multiple distribution patterns, the diffusion model has no special design or constraints on the space for generating samples, and cannot generate samples in a targeted manner for special areas. The generated samples cannot alleviate the intra-class imbalance phenomenon of minority class samples, and the improvement of the classification performance of minority class samples is limited.

[0113] To solve the above problems, the present invention proposes a sample generation method based on a diffusion model under the constraint of a two-way discriminator. The main process of the method is as follows: Figure 4 As shown in the figure. The proposed method is mainly divided into a forward process and a reverse process. The denoised minority class samples are used to train the diffusion model. The forward process is consistent with the forward process of the traditional diffusion model. In the reverse process, the UNet denoising network in the traditional diffusion model is replaced with an MLP that is more suitable for tabular data denoising. At the same time, a two-way discriminator is added to constrain the reverse denoising network, so that the samples generated by the diffusion model can alleviate the intra-class imbalance of minority class samples while covering the distribution pattern of the original minority class samples.

[0114] The two-way discriminator consists of a sample density discriminator Dis1 and a sample authenticity discriminator Dis2. For the original minority class sample x, in the reverse denoising process, the denoising network can remove the noise added to the sample x in the first t steps, thereby obtaining the generated minority class sample x gen The sample density discriminator Dis1 calculates the original sample x and the generated sample x respectively. gen The average distance to its K nearest neighbors is calculated as shown in formula (5-6).

[0115]

[0116] The sample density discriminator Dis1 forces the samples generated by the diffusion model to have a larger distance with their neighbors by comparing the average distance between the original minority class samples and the generated samples and their K nearest neighbors. Its loss function is shown in formula (5-7).

[0117]

[0118] where dis x and Represent the average distances between the original minority class samples and the generated samples and their K nearest neighbors, respectively. For the generated samples, samples with larger intra-class neighbor distances are more likely to be located in sparse areas. Therefore, the sample density discriminator Dis1 can force the diffusion model to generate samples that are closer to the original minority class samples and are located in the sparse area, thereby alleviating the intra-class imbalance of minority class samples.

[0119] However, only using the sample density discriminator Dis1 to constrain the generated samples may cause most of the samples generated by the diffusion model to be located in the sparse area of ​​the original minority class samples, or even cause the generated minority class samples to deviate from the distribution pattern of the original minority class samples, and fail to effectively enhance the overall distribution of the original minority class. In order to alleviate the above problems, the present invention constructs a sample authenticity discriminator Dis2, which ensures the authenticity and rationality of the generated samples by playing against the denoising network.

[0120] Specifically, during the training process, the sample authenticity discriminator Dis2 determines whether the input sample comes from the original sample or the minority class sample generated by the diffusion model. The diffusion model hopes that the generated sample can be judged as the original minority class sample by the sample authenticity discriminator Dis2. The two continue to compete against each other during the training process and finally reach a equilibrium state so that the generated sample can conform to the distribution of the original minority class samples.

[0121] Since the number of minority class samples in the original data is small, the sample authenticity discriminator Dis2 can well judge whether the input sample belongs to the original minority class sample after a few rounds of adversarial game process. At this time, continuing adversarial game training will cause the sample authenticity discriminator Dis2 to overfit the original minority class samples. In order to alleviate this phenomenon, the present invention uses a Mask operation on the sample of the input sample authenticity discriminator Dis2, and performs a feature random mask operation on it before sample discrimination. The main process is shown in formula (5-8).

[0122] M(x)=x·m (5-8)

[0123] Where m=[m0,m1,...,m q ],m i ~Binomal(1,p), q is the number of feature dimensions of minority class samples. The sample mask operation effectively improves the diversity of the input sample authenticity discriminator Dis2 samples by randomly masking the original data, alleviating the overfitting problem of the discriminator Dis2. The loss function of the sample authenticity discriminator Dis2 and its loss function acting on the diffusion model are shown in formulas (5-9) and (5-10), respectively.

[0124] L Dis2 =E[log(M(x))]+E[log(1-M(x) gen ))] (5-9)

[0125] L G =E[log(M(x gen ))] (5-10)

[0126] Under the constraint of the two-path discriminator, the loss function of the diffusion model is shown in formula (5-11).

[0127] L=L ddpm +αL Dis1 +βL G (5-11)

[0128] Among them, α and β are hyperparameters that control the influence of sample density discriminator Dis1 and sample authenticity discriminator Dis2 on the diffusion model denoising network. Within a reasonable parameter range, the samples generated by the diffusion model can be controlled to effectively enhance the sparse areas of minority class samples while maintaining the original minority class sample distribution pattern, effectively alleviating the intra-class imbalance of minority class samples. The pseudo code of the sample generation method based on the diffusion model under the constraint of the two-way discriminator is shown in Algorithm 1.

[0129]

[0130] In the technical solution implemented by the present invention, a method for classifying electric energy meter faults based on a two-way constrained diffusion model is proposed to solve the problem of intra-class imbalance and noise samples in minority class fault samples in smart meter fault data. First, based on data labels and sample distribution, the noise in the data set and the samples interfering with the normal distribution pattern of the data are removed, and the data set is denoised at local and global levels using the K nearest neighbor algorithm and the single-classification SVM algorithm, providing a good data basis for sample generation. Then, a method for generating samples based on a diffusion model under two-way discriminant constraints is proposed. In the reverse denoising process of the diffusion model, a two-way discriminator structure is carefully designed. The generated samples are controlled to be located in the low-density area as much as possible by constructing a sample density discriminator based on the nearest neighbor distance comparison, and the authenticity of the generated samples is ensured by the confrontation game between the constructed sample authenticity discriminator and the denoising network. Under the collaborative constraints of the two-way discriminator, the samples generated by the diffusion model can effectively alleviate the intra-class imbalance phenomenon of the minority class. The combination of the above strategies can effectively improve the classification accuracy of the subsequent basic classifier on the smart meter fault data set, and better cope with the smart meter fault classification task.

[0131] In addition, this application compares the proposed electric energy meter fault classification method based on the two-way constrained diffusion model with four data-level sampling methods and three mainstream deep learning sample generation methods. Considering the large amount of sample data and complex categories of the smart meter fault dataset, the data-level method uses RF as a classifier to verify the sample balance effect. The effectiveness and advancement of the proposed electric energy meter fault classification method based on the two-way constrained diffusion model are confirmed.

[0132] 1) Electricity meter dataset

[0133] The meter data set collected smart meter data of 7 types of faults in 25 provinces. Due to various factors such as manual labeling errors, there are problems such as wrong labeling and missing labeling in the fault type labels, and there are problems such as outliers and missing values ​​in the meter fault data. After various technical processing such as missing value completion, feature selection, outlier detection, and data standardization, a total of 1,500 smart meter fault data were obtained. Among them, the number of samples of each fault type is highly unbalanced, and the maximum imbalance rate reaches 9.94. After the above data preprocessing, the obtained smart meter fault data set contains 19 feature attributes including days of use, manufacturing unit, calibrated current, active accuracy level, specification, overload multiple, voltage, wiring method, payment terminal production batch, new and old, rotation cycle, hardware version, card meter tripping mode, load curve, whether there is power outage meter reading, whether there is reverse phase sequence judgment, whether there is loss of current judgment, rate, and meter mode. In order to reduce the randomness of the results, the data set is randomly divided into training set and test set with a fixed random number seed in a ratio of 8:2.

[0134] 2) Comparison method

[0135] As shown in Table 1, to verify the effectiveness of the proposed algorithm, four data-level sampling methods and three mainstream deep learning sample generation methods were used in the embodiment of the present invention for comparison. All models were fully retrained and tested in the same experimental environment using official codes.

[0136] Table 1 Comparison methods and detailed information

[0137]

[0138] 3) Evaluation indicators

[0139] The embodiment of the present invention uses macro-F1 and G-mean indicators to evaluate the classification effect of the algorithm. The macro-F1 indicator is the arithmetic mean of F1 for each fault category, which is used to comprehensively evaluate the accuracy and recall of the model in each category. The G-mean indicator is the geometric mean of the recall rate for each category, which is used to evaluate the recall of the model in each category. Both Macro-F1 and G-mean have values ​​ranging from 0 to 1. The larger the value, the better the classification performance of the model.

[0140] 4) Implementation details

[0141] The parameter settings of the proposed invention are shown in Table 2. Wherein k is the number of neighbors when the KNN algorithm is used in the proposed invention, and μ is the proportion of outliers set when the single-classification SVM denoising is used in the proposed invention. Since the number of samples in the data set is small, the proportion of outliers is set to be small to reduce the impact of removing outliers on the classification boundary. T is the total time step in the forward and reverse processes of the diffusion model. bs is the number of samples contained in the sample block each time the model is entered. epoch is the number of times the model is trained on each data set. lr is the learning rate of the diffusion model and the discriminator. Optimizer is the neural network optimizer in the training process. The present invention uses the Adam optimizer which is the most commonly used in deep learning. α and β are hyperparameters for controlling the weights of the two-way discriminator, and their values ​​are a set of better parameters obtained by comprehensively considering the performance of the selected data set. p is the probability of setting the feature value to 0 in the mask operation. num is the number of minority class samples generated by the diffusion model, where N max and N min are the number of samples of the majority class and the minority class in the denoised dataset, respectively.

[0142] Table 2 Parameter settings of the proposed invention

[0143]

[0144] In order to make the diffusion model better adapt to the generation of tabular data, the proposed invention replaces the denoising network UNet in the diffusion model with an MLP network that can better capture the characteristics of tabular data. At the same time, in order to alleviate the intra-class imbalance of minority class samples as much as possible while maintaining the original distribution pattern of the generated samples, the present invention proposes a dual-path discriminator architecture to constrain the diffusion model. The network structures of the denoising MLP and the discriminator are shown in Tables 3 and 4, respectively, where x_dim represents the dimension of the input sample, that is, the number of features of the sample.

[0145] Table 3 Network structure of denoising MLP

[0146]

[0147] Table 4 Network structure of the discriminator

[0148]

[0149] For the parameters of the comparison methods, the sampling methods are implemented based on the default parameters in the smote_variants library or the original paper, and the K nearest neighbor parameter is set to 5 when using KNN. The generation methods all use the default parameters in the original paper. The implementation of the basic classifier uses the default parameters in the Scikit-learn library. In order to reduce the impact of experimental contingency, the final performance of each method is the average of ten five-fold cross-validation results.

[0150] 5) Experimental results on the electric meter dataset

[0151] The experimental results of the embodiments of the present invention and the comparative methods on the F1 and macro-F1 indicators under various fault categories of smart meters are shown in Table 5, and the experimental results on the recall rate and G-mean indicators of each category are shown in Table 6. It can be seen that the electric energy meter fault classification method based on the two-way constrained diffusion model proposed in the present invention has obtained F1 and recall rates that exceed those of other methods in most categories, and has obtained the highest macro-F1 and G-mean. The results of Tables 5 and 6 show that the fault sample balancing effect of the smart meter method of the embodiment of the present invention is better than that of the comparative methods, and can obtain higher classification accuracy and recall rate.

[0152] Table 5 Experimental results of EMFC-DM and other comparison methods on F1 index under various fault categories of smart meters

[0153]

[0154]

[0155] Table 6 Experimental results of EMFC-DM and other comparison methods on G-mean index under various fault categories of smart meters

[0156]

[0157] A large number of comparison results with mainstream oversampling methods and deep learning sample generation methods show that the present invention first removes the noise that interferes with the normal distribution pattern in the data set, providing a good data basis for subsequent sample generation, and then generates samples based on the diffusion model. The model has a stronger ability to learn sample distribution. At the same time, the combination of the dual-path discriminant constrained diffusion model and the generated sample screening strategy can enable the generated samples to effectively alleviate the intra-class imbalance of the minority class, avoiding the phenomenon that the classifier ignores the classification accuracy of the sparse area of ​​the minority class due to the intra-class imbalance of the minority class, effectively improving the classification performance of the basic classifier, and effectively improving the accuracy and recall rate of faulty meter classification, which is of great significance for strengthening the status monitoring of smart electricity meters and ensuring the safety of the power grid.

[0158] Therefore, the present invention first removes the noise in the data set and the samples that interfere with the normal distribution pattern of the data based on the data labels and sample distribution, and then constructs a two-way discriminator to constrain the diffusion model. On the basis of ensuring that the generated samples conform to the original data distribution, the intra-class imbalance of the minority class samples is alleviated, and the phenomenon that the classifier ignores the classification accuracy of the sparse areas of the minority class due to the intra-class imbalance of the minority class is avoided. The fault recognition accuracy of the subsequent basic classifier is effectively improved, thereby reducing the potential huge economic losses and ensuring the stable operation and safety of the power grid.

[0159] Exemplary Devices

[0160] Figure 5 FIG. 1 is a schematic diagram of a structure of an electric energy meter fault detection device of a dual-path constrained diffusion model provided by an exemplary embodiment of the present invention. Figure 5 As shown, the device 500 includes:

[0161] An acquisition module 510 is used to acquire multivariable data of the electric energy meter to be tested;

[0162] The output module 520 is used to input the multivariate data into the pre-trained fault detection model, and output the detection result of the electric energy meter to be tested, the detection result includes fault and normal, wherein the fault detection model is trained based on the minority class sample data generated by the two-way constrained diffusion model, and

[0163] The training process of the fault detection model in the output module 520 is:

[0164] Based on the data label and sample distribution method, the original minority class sample data set and the original majority class sample data set are denoised to obtain the minority class valid sample data set and the majority class sample data set;

[0165] Using the pre-trained diffusion model based on two-way discriminator constraints to perform sample diffusion on the minority class valid sample data set, a minority class sample data set is generated;

[0166] The pre-built classification model is trained using the minority class sample data set, the minority class valid sample data set, and the majority class sample data set to generate a fault detection model.

[0167] Optionally, denoising the original minority class sample data set and the original majority class sample data set based on the data label and sample distribution method to obtain a minority class valid sample data set and a majority class sample data set includes:

[0168] Based on the nearest neighbor data labeling method, local denoising is performed on the original minority class sample data set and the original majority class sample data set to obtain the initial minority class valid sample data set and the initial majority class sample data set;

[0169] Based on the single-class support vector machine, the initial minority class valid sample data set and the initial majority class sample data set are globally denoised to obtain the minority class valid sample data set and the majority class sample data set.

[0170] Optionally, the optimization objective of the single-class support vector machine is:

[0171]

[0172] In the formula, α is the support vector of the hyperplane, b is the distance from the hyperplane to the origin, is a slack variable, representing the minority class sample x i The degree of abnormality, μ controls the proportion of noise samples, <α,x i > represents the distance between the sample support vector and the hyperplane after the kernel function operation;

[0173] The denoising criterion of the single-class vector machine is:

[0174] score=Sign(b-<α,x>)

[0175] Wherein, Sign() is a sign function, score is the abnormal score of the sample data, when score=1, the sample data is determined to be normal sample data, and when score=-1, the sample data is determined to be noise sample data.

[0176] Optionally, a pre-trained diffusion model based on two-way discriminator constraints is used to perform sample diffusion on a minority class valid sample dataset to generate a minority class sample dataset, including:

[0177] Perform forward propagation processing on the minority class valid sample data set to obtain the initial minority class sample data set that conforms to the normal distribution;

[0178] The initial minority class sample data set is denoised using the reverse denoising network with two-way discriminant constraints to generate a minority class sample data set;

[0179] Optionally, the expression for the forward propagation process is:

[0180]

[0181] In the formula, x represents the original data, t represents the tth step of the forward process, and x t represents the data of the tth step in the forward process, ε represents Gaussian noise, Is a hyperparameter that controls the size of the noise. Usually α i is a very small and gradually decreasing constant value;

[0182] The denoising process of the reverse denoising network is:

[0183]

[0184] Where z represents the standard Gaussian distribution, σ t is the predefined variance at step t, θ ddpm represents the parameters of the diffusion model, ε θddpm (x t ,t) represents the noise of the t-th step sample predicted by the denoising model.

[0185] Optionally, the two-way discriminant constraint includes a sample density discriminator and a sample authenticity discriminator, wherein,

[0186] The loss function of the sample density discriminator is:

[0187] L Dis1 =E[1.0-(dis xgen -dis x )]

[0188] in,

[0189]

[0190] In the formula, dis x and Respectively represent the minority class valid sample data set x and the initial minority class sample data set x gen The average distance to the K nearest neighbors, E represents the mean loss in a batch of samples, X i represents the samples in the nearest neighbor sample set, and k represents the size of the nearest neighbor sample set;

[0191] The loss function of the sample authenticity discriminator is:

[0192] L Dis2 =E[log(M(x))]+E[log(1-M(x) gen ))]

[0193] In the formula,

[0194] M(x)=x·m

[0195] Where M(x) is the mask of the valid data of the minority class, m = [m0,m1,...,m q ],m i ~Binomal(1,p), q is the number of feature dimensions of minority class samples.

[0196] Optionally, the loss function of the diffusion model is:

[0197] L=L ddpm +αL Dis1 +βL G

[0198] in,

[0199]

[0200] L G =E[log(M(x gen ))]

[0201] In the formula, α and β are the hyperparameters that control the influence of the sample density discriminator and the sample authenticity discriminator on the diffusion model denoising network, L G is the loss function of the sample authenticity discriminator acting on the diffusion model, L ddpm is the loss function for noise prediction.

[0202] Exemplary Electronic Devices

[0203] Figure 6 This is a structure of an electronic device provided by an exemplary embodiment of the present invention. Figure 6 As shown, the electronic device 60 includes one or more processors 61 and a memory 62 .

[0204] The processor 61 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.

[0205] The memory 62 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 61 may run the program instructions to implement the methods of the software programs of the various embodiments of the present invention described above and / or other desired functions. In one example, the electronic device may also include: an input device 63 and an output device 64, which are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0206] In addition, the input device 63 may also include, for example, a keyboard, a mouse, etc.

[0207] The output device 64 can output various information to the outside, and can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto.

[0208] Of course, to simplify, Figure 6 Only some of the components related to the present invention in the electronic device are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, the electronic device may further include any other appropriate components according to specific application conditions.

[0209] Exemplary computer program products and computer-readable storage media

[0210] In addition to the above-mentioned methods and devices, an embodiment of the present invention may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the method according to various embodiments of the present invention described in the above "Exemplary Method" section of this specification.

[0211] The computer program product may be written in any combination of one or more programming languages ​​to write program code for performing the operations of the embodiments of the present invention, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0212] In addition, an embodiment of the present invention may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, enable the processor to execute the steps of the method according to various embodiments of the present invention described in the above “Exemplary Method” section of this specification.

[0213] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, system or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable 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 above.

[0214] The basic principle of the present invention is described above in conjunction with specific embodiments. However, it should be pointed out that the advantages, strengths, effects, etc. mentioned in the present invention are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. must be possessed by each embodiment of the present invention. In addition, the specific details disclosed above are only for the purpose of illustration and facilitation of understanding, rather than limitation, and the above details do not limit the present invention to being implemented by adopting the above specific details.

[0215] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0216] The block diagrams of the devices, systems, equipment, and systems involved in the present invention are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, systems, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The word "such as" used here refers to the phrase "such as but not limited to", and can be used interchangeably with it.

[0217] The method and system of the present invention may be implemented in many ways. For example, the method and system of the present invention may be implemented by software, hardware, firmware or any combination of software, hardware, firmware. The above order of steps for the method is only for illustration, and the steps of the method of the present invention are not limited to the order specifically described above, unless otherwise specifically stated. In addition, in some embodiments, the present invention may also be implemented as a program recorded in a recording medium, which includes machine-readable instructions for implementing the method according to the present invention. Thus, the present invention also covers a recording medium storing a program for executing the method according to the present invention.

[0218] It should also be noted that in the system, device and method of the present invention, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. The above description of the disclosed aspects is provided to enable any technician in the field to make or use the present invention. Various modifications to these aspects are very obvious to those skilled in the art, and the general principles defined here can be applied to other aspects without departing from the scope of the present invention. Therefore, the present invention is not intended to be limited to the aspects shown here, but in accordance with the widest range consistent with the principles and novel features disclosed here.

[0219] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present invention to the forms disclosed herein. Although a number of example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. A method for detecting electric energy meter faults based on a dual-path constrained diffusion model, characterized in that: include: Obtain multivariable data of the electric energy meter to be tested; The multivariate data is input into a pre-trained fault detection model, and the detection result of the electric energy meter to be tested is output, wherein the detection result includes fault and normal, wherein the fault detection model is trained based on the minority class sample data generated by the two-way constrained diffusion model, and The training process of the fault detection model is: Based on the data label and sample distribution method, the original minority class sample data set and the original majority class sample data set are denoised to obtain the minority class valid sample data set and the majority class sample data set; Using a pre-trained diffusion model based on two-way discriminator constraints to perform sample diffusion on the minority class valid sample data set to generate a minority class sample data set; The pre-built classification model is trained using the minority class sample data set, the minority class valid sample data set, and the majority class sample data set to generate the fault detection model.

2. The method according to claim 1, characterized in that Based on the data label and sample distribution method, the original minority class sample data set and the original majority class sample data set are denoised to obtain the minority class valid sample data set and the majority class sample data set, including: Based on the nearest neighbor data labeling method, local denoising is performed on the original minority class sample data set and the original majority class sample data set to obtain an initial minority class valid sample data set and an initial majority class sample data set; The initial minority class valid sample data set and the initial majority class sample data set are globally denoised based on a single-classification support vector machine to obtain the minority class valid sample data set and the majority class sample data set.

3. The method according to claim 2, characterized in that The optimization goal of the single-class support vector machine is: In the formula, α is the support vector of the hyperplane, b is the distance from the hyperplane to the origin, is a slack variable, representing the minority class sample x i The degree of abnormality, μ controls the proportion of noise samples, <α,x i . represents the distance between the sample support vector and the hyperplane after the kernel function operation; The denoising criterion of the single-class vector machine is: score=Sign(b-<α,x.) Wherein, Sign() is a sign function, score is the abnormal score of the sample data, when score=1, the sample data is determined to be normal sample data, and when score=-1, the sample data is determined to be noise sample data.

4. The method according to claim 1, characterized in that: The sample diffusion of the minority class valid sample data set is performed using a pre-trained diffusion model based on two-way discriminator constraints to generate a minority class sample data set, including: Performing forward propagation processing on the minority class valid sample data set to obtain an initial minority class sample data set that conforms to a normal distribution; The initial minority class sample data set is denoised using an inverse denoising network with a two-way discriminant constraint added to generate the minority class sample data set.

5. The method according to claim 4, characterized in that The expression of the forward propagation process is: In the formula, x represents the original data, t represents the tth step of the forward process, and x t represents the data of the tth step in the forward process, ε represents Gaussian noise, Is a hyperparameter that controls the size of the noise. Usually α i is a very small and gradually decreasing constant value; The denoising process of the reverse denoising network is: Where z represents the standard Gaussian distribution, σ t is the predefined variance at step t, θ ddpm represents the parameters of the diffusion model, Represents the noise of the t-th step sample predicted by the denoising model.

6. The method according to claim 5, characterized in that The two-way discriminant constraint includes a sample density discriminator and a sample authenticity discriminator, wherein, The loss function of the sample density discriminator is: in, In the formula, dis x and Respectively represent the minority class valid sample data set x and the initial minority class sample data set x gen The average distance to the K nearest neighbors, E represents the mean loss in a batch of samples, X i represents the samples in the nearest neighbor sample set, and k represents the size of the nearest neighbor sample set; The loss function of the sample authenticity discriminator is: L Dis2 =E[log(M(x))]+E[log(1-M(x gen ))] In the formula, M(x)=x·m Where M(x) is the mask of the valid data of the minority class, m = [m0,m1,...,m q ],m i ~Binomal(1,p), q is the number of feature dimensions of minority class samples.

7. The method according to claim 6, characterized in that The loss function of the diffusion model is: L=L ddpm +αL Dis1 +βL G in, L G =E[log(M(x gen ))] In the formula, α and β are the hyperparameters that control the influence of the sample density discriminator and the sample authenticity discriminator on the diffusion model denoising network, L G is the loss function of the sample authenticity discriminator acting on the diffusion model, L ddpm is the loss function for noise prediction.

8. A two-path constrained diffusion model based electric energy meter fault detection device, characterized in that: include: An acquisition module, used for acquiring multivariable data of the electric energy meter to be tested; An output module is used to input the multivariate data into a pre-trained fault detection model, and output the detection result of the electric energy meter to be tested, wherein the detection result includes fault and normal, wherein the fault detection model is trained based on the minority class sample data generated by the two-way constrained diffusion model, and The training process of the fault detection model is: Based on the data label and sample distribution method, the original minority class sample data set and the original majority class sample data set are denoised to obtain the minority class valid sample data set and the majority class sample data set; Using a pre-trained diffusion model based on two-way discriminator constraints to perform sample diffusion on the minority class valid sample data set to generate a minority class sample data set; The pre-built classification model is trained using the minority class sample data set, the minority class valid sample data set, and the majority class sample data set to generate the fault detection model.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1 to 7.

Citation Information

Cited By

  • Generalized zero sample recognition method and system for generative chest X-ray image

    CN120563971A

  • A generative chest x-ray image generalized zero-shot recognition method and system

    CN120563971B

  • Class imbalance table data processing method based on comparison constraint diffusion generation

    CN122153609A

  • Class imbalance table data processing method based on contrast constraint diffusion

    CN122153609B