Characteristic migration electric energy meter fault classification method and system under guidance of memory compensation strategy

By employing memory compensation strategies and feature transfer methods, the problem of class imbalance in smart meter fault classification was solved, improving classification accuracy and recall, and achieving more stable fault identification results.

CN121743972APending Publication Date: 2026-03-27BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-11
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

In the classification of faults in smart meters, there is a class imbalance problem. Existing methods are unable to effectively handle the bias of majority class samples to minority class samples, resulting in poor performance of the classifier on the test set. Furthermore, existing algorithm-level methods fail to fully explore the differential information in overlapping regions.

Method used

A feature transfer method guided by a memory compensation strategy is adopted. A feature memory module is constructed through an iterative clustering strategy to obtain the feature centers of correctly classified samples. The features of misclassified samples are transferred through vector combination theory. Classification compensation is performed by combining feature similarity to construct a feature space with better inter-class separability.

Benefits of technology

It improves the accuracy and recall of smart meter fault classification, alleviates overfitting and decision bias, and enhances the robustness and stability of the classifier.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121743972A_ABST
    Figure CN121743972A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an electric energy meter fault classification method and system based on feature migration under guidance of a memory compensation strategy, and the method comprises the steps: taking fault historical data of an intelligent electric meter under different classes as an input data set, and carrying out the division to obtain a plurality of second-class data sets; for each second-class data set, constructing a feature memory module based on an iterative clustering strategy, and obtaining feature centers of different classes of samples; designing a push and pull vector combined feature migration strategy, and optimizing the difference feature mining capability of the feature extraction network through feature migration loss; a classification compensation strategy based on feature similarity is provided, and results of a traditional classification branch and a feature memory module are integrated to serve as prediction results; and according to a classification result under each second-class data set, obtaining a fault category through hard voting.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a smart meter fault classification method, in particular to a smart meter fault classification method and system based on feature migration under a memory compensation strategy. BACKGROUND

[0002] In recent years, with the optimization of the national energy strategy and the acceleration of the electricity marketization process, the degree of interaction between electricity users and the market has been continuously improved. The continuous progress of the economic society has driven the rapid increase of electricity demand in various industries, and higher standards have been put forward for the reliability and stability of the power supply system. The popularity of distributed power generation technology has put new pressure on the coordinated management of traditional power networks in the aspects of power generation, power transmission and power consumption. Under this situation, smart grid, as the core direction of the modernization transformation of the power system, is rapidly advancing. Smart meters are the basic terminal devices, which not only retain the basic function of electric energy metering, but also integrate advanced functions such as real-time data display, remote control and power consumption behavior analysis, and become a key element to support the safe and stable operation of the power grid.

[0003] The construction scope of the smart grid is continuously expanding, which drives the rapid increase in the number of installed smart meters, and the number of related manufacturing enterprises is also increasing. Due to the differences in design ideas, component selection and process specifications of manufacturers, combined with the influence of actual conditions such as local climate and installation environment, smart meters exhibit complex and sudden fault types and complex causes in actual use, which brings many difficulties to user power experience and power grid operation and maintenance. Smart meters are finely structured and have various fault forms, and it is difficult for operation and maintenance personnel to quickly organize targeted maintenance when they lack clear fault type information, resulting in low processing efficiency and limited diagnostic accuracy. Therefore, based on the multi-dimensional attribute data and historical fault information of smart meters, an accurate and stable fault classification model is established, which helps power grid enterprises optimize the allocation of human and material resources, save maintenance costs, and also improves the level of residential power supply and service experience.

[0004] Nowadays, the rapid progress of big data and computer technology has promoted the significant development of the field of artificial intelligence. Machine learning, as an important branch of artificial intelligence, focuses on using computers to automatically discover rules and acquire knowledge from data, and establishes a prediction model that can adapt to complex data distribution and has good generalization ability. Choosing the right machine learning method can efficiently handle high-dimensional and large-scale data sets, and with the help of the constructed intelligent model, artificial judgment can be assisted, thereby greatly improving work efficiency.

[0005] It is worth noting that the expansion of the deployment scale of smart meters and the increase of manufacturers make the device complexity continue to increase, and the fault types also become more and more diverse. The natural environment conditions are quite different in different regions, and the running state of the smart meter is easily affected by the external environment, which further increases the complexity of fault diagnosis. From the perspective of machine learning, smart meter fault classification is essentially a typical class imbalance classification problem. When the training sample distribution is uneven, the ordinary classification method is prone to model preference, that is, it pays too much attention to the majority class samples, and the recognition ability for minority class faults is weak, which directly reduces the practical value and generalization performance of the model.

[0006] The current research on unbalanced classification problem mainly includes two levels: the data level method balances different class samples through sampling or generation, and then trains the classifier based on the balanced data, so as to alleviate the classifier decision deviation phenomenon caused by the difference in sample quantity. The algorithm level method reduces the model bias to the majority class samples by optimizing the model architecture or adjusting the loss function.

[0007] The data level method mainly includes sampling and generation. The sampling method includes under-sampling, over-sampling and hybrid sampling. Under-sampling reduces the majority class samples to balance the two classes of samples through certain strategies, but it may lose valuable information in the data set. Over-sampling generates minority class samples through sample selection and interpolation, but the over-sampling method does not learn the sample features and distribution information, and cannot guarantee the rationality of the generated samples, and may introduce noise or exacerbate the overlap. Hybrid sampling takes into account the advantages of under-sampling and over-sampling, but also inherits the problems of information loss of majority class samples and difficulty in ensuring the rationality of generated samples. The generation method mainly includes two types based on variational autoencoder (VAE) and generative adversarial networks (GAN). The generation method uses generative deep learning model to learn the distribution of minority class samples, and combines with specific discrimination mechanism to ensure the authenticity and reliability of the generated samples to a certain extent, but it cannot integrate the distribution information of different class samples to further process the samples in the overlap area. The data level method relies heavily on the distribution information of the original samples in the process of generating samples, and has limited ability to mine the difference information of different class samples in the overlap area. At the same time, whether it is a sampling method or a generation method, sampling or generating samples in the original sample space cannot avoid the influence of the overlap area on the performance of the subsequent classifier.

[0008] Compared with the data level method, the algorithm level method reduces the bias of the model to the majority class samples by changing the model architecture or adjusting the loss function, avoiding the problems of information loss and exacerbating overlap caused by eliminating or incorrectly introducing samples. The algorithm level method mainly includes three categories: cost-sensitive learning, single classifier and ensemble learning. Cost-sensitive learning avoids the decision bias of the classifier to the majority class by increasing the misclassification cost of the minority samples. However, this method may cause overfitting of the model. Single classifier cannot fully utilize the distribution characteristics of minority samples and is usually used in extremely unbalanced data situations such as anomaly detection. Ensemble learning algorithm is usually combined with data sampling method to improve the classification performance by integrating the results of multiple weak classifiers. The above methods can reduce the influence of data imbalance and improve the decision bias phenomenon of the model to a certain extent through algorithm optimization without introducing noise, but the existing algorithm level method depends heavily on the distribution information of the class label and the original sample in the training process of the classifier, ignores the mining of the commonness and difference information of different class samples in the overlap area, resulting in serious waste of feature information of the data itself and unable to significantly improve the classification effect.

[0009] Based on the above analysis, the application proposes a feature migration method for electric energy meter fault classification under the guidance of memory compensation strategy. In the traditional classification process, the feature extraction network is used to map the original sample to a high-level feature space, and the correctly classified and misclassified samples are selected according to the classification results. In the compensation classification branch, a feature memory module based on iterative clustering strategy is designed to obtain and save the feature centers of correctly classified samples of different categories, and to indicate the direction for subsequent feature migration. At the same time, a feature migration strategy based on vector combination theory is proposed, which migrates the misclassified sample features with high probability in the overlap area to the non-overlapping area corresponding to the same feature memory module in the feature space multiple times by combining the "push" and "pull" vectors, so as to construct a feature space with better class separation. Finally, a classification compensation strategy based on feature similarity is designed, which calculates the similarity between the test features and the feature memory modules of different categories as the compensation classification probability, and combines the prediction results of the traditional classification branch and the feature memory module as the final classification result, effectively improving the accuracy of fault recognition, which is of great significance for strengthening the state monitoring of smart meters and ensuring the safety of power grids. SUMMARY

[0010] Therefore, the application proposes a feature migration method for electric energy meter fault classification under the guidance of memory compensation strategy to improve the performance of smart meter fault classification.

[0011] The application proposes a feature migration method for electric energy meter fault classification under the guidance of memory compensation strategy, which includes the following steps:

[0012] (1) The fault history data of different categories of smart meters is taken as input data set, and a plurality of two-class data sets are obtained by division, specifically:

[0013] The actual fault data set of the smart meter is input, and the samples in the data set include 19 characteristic variables such as use days, manufacturing unit, calibrated current, active accuracy level, specification, overload multiple, voltage, wiring mode, payment terminal production batch, new or old, rotation period, hardware version, meter tripping mode, with or without load curve, whether to copy the meter, whether to judge the reverse phase sequence, whether to judge the loss of flow, rate, and meter type; the fault category label includes 7 categories of appearance failure, power failure, software failure, clock failure, communication unit failure, metering unit failure and storage unit failure; each class of sample in the fault data set is traversed, all samples in the category are taken as a minority class sample set, and all samples in the remaining categories are taken as a majority class sample set, so that the original data set is converted into 7 two-class data sets; for each two-class data set, the data set can be described as:

[0014] X = [X min ,X maj ],

[0015] Wherein, X is a two-class data set, x is defined as any sample in the data set, that is, x X; X min is a minority class sample set, x min is defined as any sample in the data set, that is, x min X min ; X maj is a majority class sample set, x maj is defined as any sample in the data set, that is, x maj X maj ;

[0016] (2) For each two-class data set, the feature memory module based on the iterative clustering strategy is designed; specifically, the traditional classification branch is composed of a feature extraction network θ and a classifier CLS, for the sample x in the two-class data set, the sample x is input into the feature extraction network and the classifier, to obtain the feature vector f and the classification result

[0017] For the sample x T correctly classified in the traditional classification branch, it can be divided into correctly classified majority class samples and correctly classified minority class samples The correctly classified majority class samples and minority class samples have their corresponding feature memory modules, respectively fm maj and fm min ;

[0018] Since the feature extraction network and the classifier have been pre-trained before the two-way branch training, the features extracted by the feature extraction network have a certain credibility, and in order to ensure that the feature memory module can retain the global information of the original sample in the continuous updating process, the construction and updating of the feature memory module is a continuous iteration process;

[0019] Based on the above analysis, in the first round of two-way branch training, for the correctly classified minority class samples The corresponding feature is For Using the k-means clustering algorithm, a plurality of clustered cluster centers can be obtained, which are used as the initial value fm of the minority class feature memory module min_0 In the next iteration process, new features corresponding to the correctly classified samples will be generated At this time, the new feature is And the minority class feature memory module fm obtained in the last round min_0 Vertically spliced, the k-means clustering algorithm is used on the expanded feature to obtain the minority class feature memory module fm of this round min_1 ;

[0020] In the process of two-way branch training, the above process is repeated to obtain the final minority class feature memory module fm min ;

[0021] The above iteration steps are also performed on the correctly classified samples of the majority class to obtain the feature memory module fm of the majority class maj ;

[0022] Before clustering the correctly classified features of each round, the features of the correctly classified samples are expanded using the previous feature memory module. This step is equivalent to expanding the number of features corresponding to the correctly classified samples, which retains the feature information of the correctly classified samples in the previous round to some extent, so that the feature memory module can retain the global information of the original sample in the continuous updating process;

[0023] Since a feature space with stronger class separability and lower class overlap needs to be constructed, and the feature memory module indicates the direction of subsequent feature migration, the feature memory items in the feature memory module of different classes need to have good class separability. In order to ensure the stability of subsequent feature migration, each item in the feature memory module of each class sample needs to have good intra-class uniformity. In order to ensure the class separability and intra-class uniformity of the feature memory module, the present application uses the contrast loss of two types of sample feature memory modules to constrain the feature extraction network, forcing it to extract features that meet the above requirements. The calculation process of the contrast loss L c is as follows:

[0024]

[0025] Where n fm-num The number of feature memory items in the feature memory module is represented by exp(·), which is the exponential function, sim(·,·) represents the cosine similarity function, τ represents the hyperparameter temperature, and fm i and fm j fm represents two memory items from the same feature memory module. k This indicates that the features come from all feature memory modules except fm. i Other memory items;

[0026] In summary, the construction and updating process of the feature memory module can acquire and save the central information of the features corresponding to the correctly classified samples during the classification process, thus pointing the way for subsequent feature transfer.

[0027] Meanwhile, the contrastive loss of the two types of sample feature memory modules ensures the inter-class separability and intra-class uniformity of features extracted by the feature memory modules and feature extraction networks of different categories of samples, thus ensuring the reliability and stability of feature transfer.

[0028] (3) For samples x that are misclassified in the traditional classification branch F It can be classified as a misclassified majority class sample. and misclassified minority class samples Inputting it into a feature extraction network yields its corresponding feature vectors in the feature space. and

[0029] Features corresponding to misclassified minority class samples It needs to be pulled toward the minority class feature memory module, while the majority class feature memory module is used to push it away from its original position.

[0030] Since the transfer to the most recent feature memory item in the feature memory module is the easiest, the most recent feature memory items are found in the feature memory modules of the majority class and the minority class, respectively. and This indicates the direction of subsequent feature transfer, where t represents the index of the minimum distance feature memory term;

[0031] and The direction that forms the difference vector represents the direction of the "push" during feature transfer; and The direction of the difference vector represents the direction of the "pull" during feature transfer. The transfer vector δ is obtained by combining the two directions. min The calculation process is as follows:

[0032]

[0033] Where α min and β min To represent the "push" and "pull" strengths in feature transfer, we use a uniformly distributed random number (Uniform(0,1)). Combining these two directions... Features after migration for

[0034] For existing imbalanced datasets, the number of samples in the dataset is often small. In order to achieve better classification results on the training set, the classifier often overfits the samples on the training set, resulting in underfitting of the samples on the test set and poor performance on the test set.

[0035] Therefore, in order to alleviate the overfitting phenomenon of the classifier, during the transfer of features corresponding to misclassified samples, the number of features corresponding to the transferred samples is increased, more diverse transfer features are generated, and the range of transferred features is expanded, thereby alleviating the overfitting phenomenon of the classifier to the training set.

[0036] Specifically, α min and β min To obtain a uniformly distributed random number (Uniform(0,1)), representing the strength of the "push" and "pull" forces during feature transfer, α is sampled multiple times during the feature transfer process. min and β min α conforms to a uniform distribution. min and β min Let be a set s, and s be expressed as follows:

[0037]

[0038] in and M represents the number of features in the transferred samples. At this point, the transfer vector δ′ obtained by combining the two directions... min as well as Features after migration The calculation process is as follows:

[0039]

[0040] Similarly, for the features corresponding to the misclassified majority class samples... Find the nearest feature memory item in the feature memory modules of the majority and minority classes respectively. and and The direction that forms the difference vector represents the direction of the "push" during feature transfer; and The direction of the difference vector represents the direction of the "pull" during feature transfer; the transfer vector δ′ obtained by combining the two directions... maj and features after migration

[0041] For imbalanced datasets, the number of majority class samples in the original data is often greater than the number of minority class samples. In order to achieve the best overall classification effect, traditional classifiers often misclassify some minority class samples as majority class samples, resulting in decision bias, which is not conducive to the accurate classification of the minority class.

[0042] Therefore, in order to alleviate the decision bias phenomenon of the classifier, during the transfer of features corresponding to the misclassified minority class, it is necessary to further increase the number of features corresponding to the minority class after transfer, generate more diverse minority class transfer features, thereby alleviating the underfitting phenomenon of the classifier to the minority class and alleviating the decision bias problem of the classifier; specifically, the number of features after transfer of the misclassified minority class features increases from M to IR·M.

[0043] IR is the imbalance ratio of the samples in the training set, which can be expressed as IR = n maj / n min The calculation yields n, where n maj n is the number of majority class samples in the training set. min The number of minority class samples in the training set;

[0044] For the transferred features and By concatenating these features vertically and then inputting them into a classifier, we can obtain the classifier's prediction results for the transferred features. The calculation process for the classification loss of the compensated classification branch is as follows:

[0045]

[0046] Where i is the index of the specific sample, σ(·) is the Sigmoid activation function, and y i is the label of the original sample, and N′ is the number of features after transfer;

[0047] Meanwhile, during the training process of the dual-branch network, in order to enable the feature extraction network to mine the difference information of samples from different categories as much as possible and extract features with less overlap and higher separability between classes, this invention uses the sum of the mean of the feature transfer vectors corresponding to the misclassified majority and minority classes as the loss constraint for the feature extraction network, forcing the extracted features to meet the above requirements. The loss function calculation process for feature transfer is as follows:

[0048] L t =||δ′min || 2 +||δ′ maj || 2 ,

[0049] During the training process of the dual-branch method, the feature transfer module transfers the features corresponding to the majority and minority class samples that were misclassified in the traditional classification branch. and The classes were transferred to the non-overlapping regions corresponding to the feature memory modules, and multiple transfers were used to alleviate the overfitting of the classifier and the class imbalance in the feature space.

[0050] Meanwhile, the mean of the feature transfer vectors corresponding to the misclassified majority and minority classes is used as the loss constraint feature extraction network, which forces it to focus on the difference information of different classes of samples in the overlapping area, and to mine the difference information of different classes of samples in the overlapping area as much as possible and construct a feature space with higher inter-class separability.

[0051] In summary, during the dual-branch training process, the losses of the feature extraction network and classifier include the contrastive loss of the feature memory module, the feature transfer loss, the loss of the traditional classification branch, and the classification loss of the transferred features. The calculation process of the total loss function is as follows:

[0052] L = L c +L t +L cls1 +L cls2 ;

[0053] (4) Based on the feature memory module and the feature transfer module, the features corresponding to the misclassified samples in the traditional classification branch will be transferred to the corresponding non-overlapping region in the feature memory module, which effectively alleviates the inter-class overlap and class imbalance in the feature space.

[0054] To further improve the subsequent classification performance and the robustness of the classification results, a classification compensation module based on feature similarity is proposed. During the testing process, the classification compensation module integrates the classification results of the classifier and the feature memory module as the final classification result.

[0055] Specifically, for the feature memory module, its construction and updating process can acquire and save the central information of the features corresponding to the correctly classified samples during the classification process, thus pointing the way for subsequent feature transfer;

[0056] Meanwhile, due to the constraints of contrast loss, the feature center information it contains has good inter-class separability and intra-class uniformity, and can assist in sample classification by calculating the similarity between test features and memory items in the feature memory module.

[0057] During the testing process, for a test sample (x, y), its features f are first extracted using a feature extraction network, and then a classifier is used to classify the features f to obtain the predicted probability p. c Simultaneously, the distance d between the high-level features and the nearest memory item in the majority and minority class feature memory modules is calculated. maj and d min ;

[0058] For feature f, if its distance d from the nearest memory item in the majority class feature memory module is... maj Smaller values ​​indicate that it is closer to the majority class, and vice versa; therefore, d maj and d min The relative size of the values ​​can aid in classification, and the calculation process for their classification probability is as follows:

[0059] p h =σ(d maj -d min ),

[0060] Where σ(·) is the Sigmoid activation function, p h This is the compensated classification probability obtained from the feature memory module; if feature f is closer to the majority class sample, i.e., d maj <d min According to the properties of the Sigmoid function, p at this time h The value of p is close to 0; conversely, p h The value is close to 1;

[0061] During the testing phase, the predicted probability p of integrating a traditional classifier is... c The classification prediction probability p of the feature memory module h The final classification prediction probability p can be obtained, and its calculation process is as follows:

[0062]

[0063] The classification compensation module can make full use of the feature memory module that is continuously updated and iteratively optimized during training. It calculates the similarity between the test feature and the memory items in the feature memory modules of different categories to obtain the compensation classification probability, and compensates the prediction probability of the traditional classifier, thereby obtaining a more robust classification result and ensuring the stability of the classification performance improvement.

[0064] (5) Based on the above training process, the feature extraction network θ and classifier CLS of the two types of datasets are obtained.

[0065] In the above method, the structure of the feature extraction network in step (2) is as follows:

[0066]

[0067] The structure of the classifier is shown below:

[0068]

[0069] Here, Linear() is the fully connected layer construction function, ReLU represents the corresponding activation function, and x_dim is the number of feature dimensions of the samples in the binary dataset.

[0070] In the above method, in step (2), n fm-num The value of is 3.

[0071] In the above method, in step (2), the value of τ is 0.5.

[0072] In the above method, in step (3), the value of M is 10.

[0073] The aforementioned method and system for classifying smart meter faults using feature transfer guided by a memory compensation strategy improves the accuracy and recall of smart meter fault classification.

[0074] As can be seen from the above technical solutions, the present invention has the following beneficial effects:

[0075] In the technical solution of this invention, a feature extraction network and classifier are used in the traditional classification branch to map the original samples to the feature space and perform classification. In the compensated classification branch, a feature memory module based on an iterative clustering strategy is proposed to acquire and save the feature centers of correctly classified samples that are likely located in non-overlapping regions, thus guiding the subsequent feature transfer. Simultaneously, a feature transfer strategy based on vector combination theory is proposed to transfer the features of misclassified samples that are likely located in overlapping regions, thereby forcing the feature extraction network to extract features with better inter-class separability and lower overlap. Finally, a classification compensation strategy based on feature similarity is proposed to ensure the stability of the classification performance improvement and effectively improve the subsequent classification performance and the accuracy and recall rate of faulty meter classification. [Attached Image Description]

[0076] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0077] Figure 1 This is a schematic diagram of the fault classification method and system framework of an energy meter based on feature transfer guided by a memory compensation strategy proposed in this invention.

[0078] Figure 2 This is a flowchart illustrating the process of classifying faults in smart meters.

[0079] Figure 3 This is a detailed schematic diagram of the algorithm of the present invention.

Detailed Implementation Methods

[0080] To better understand the technical solution of the present invention, the present invention will be described in detail below with reference to the accompanying drawings.

[0081] It should be understood that the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0082] This invention presents a method and system for classifying smart meter faults using feature transfer guided by a memory compensation strategy. To meet the fault classification requirements of smart meters, this invention uses historical fault data from different categories of smart meters as input datasets, dividing them into multiple binary datasets. For each binary dataset, a feature memory module based on an iterative clustering strategy is constructed to acquire and store the center information of correctly classified samples from different categories. A feature transfer strategy combining "push" and "pull" vector methods is designed, and the differential feature mining capability of the feature extraction network is optimized through feature transfer loss. Simultaneously, a classification compensation strategy based on feature similarity is proposed, integrating the prediction results of traditional classification branches and the prediction results of the feature memory module as the final prediction result, thereby obtaining a more robust classification result. Based on the classification results of each binary dataset, its fault category is determined through hard voting.

[0083] Figure 1 This is a schematic diagram of a method and system framework for energy meter fault classification based on feature transfer guided by a memory compensation strategy proposed in this invention. The method includes the following steps:

[0084] Step 101: Using historical fault data from different categories of smart meters as input datasets, multiple binary datasets are obtained, specifically:

[0085] Input the actual fault dataset of smart meters. This dataset contains 19 feature variables: usage days, manufacturing unit, rated current, active power accuracy level, specifications, overload multiple, voltage, wiring method, payment terminal production batch, new / old, replacement cycle, hardware version, card meter tripping method, presence of load curve, whether meter reading occurred during a power outage, presence of reverse phase sequence judgment, presence of current loss judgment, tariff rate, and metering method. The fault category labels include 7 categories: appearance fault, power supply fault, software fault, clock fault, communication unit fault, metering unit fault, and storage unit fault. Traverse the samples of each category in the fault dataset, treating all samples in that category as the minority class sample set, and all samples in the remaining categories as the majority class sample set, transforming the original dataset into 7 binary datasets. Each of these binary datasets can be described as follows:

[0086] X = [X] min ,X maj ],

[0087] Where X is a binary dataset, and x is defined as any sample in this dataset, i.e., x∈X; X min Let x be the minority class sample set. min Let x be any sample in this dataset. min ∈X min ;X maj Let x be the majority class sample set. maj Let x be any sample in this dataset. maj ∈X maj .

[0088] Step 102: For each binary dataset, the present invention designs a feature memory module based on an iterative clustering strategy;

[0089] Specifically, the traditional classification branch consists of a feature extraction network θ and a classifier CLS. For a sample x in a binary dataset, it is input into the feature extraction network and the classifier to obtain a feature vector f and a classification result.

[0090] For a sample x that is correctly classified in the traditional classification branch T It can be classified into the correct majority class samples. and correctly classified minority class samples Each correctly classified majority and minority class sample has its corresponding feature memory module, namely fm maj and fm min ;

[0091] Since the feature extraction network and classifier have been pre-trained before the dual-branch training, the features extracted by the feature extraction network have a certain degree of reliability. At the same time, in order to ensure that the feature memory module can retain the global information of the original sample during the continuous updating process, the construction and updating of the feature memory module is a continuous iterative process.

[0092] Based on the above analysis, during the first round of dual-branch training, for correctly classified minority class samples... Its corresponding features are right Using the k-means clustering algorithm, we can obtain the cluster centers of several clusters, which can be used as the initial values ​​fm of the minority class feature memory module. min_0 In the next iteration, new features corresponding to the correctly classified samples will be generated. At this time Compared with the minority class feature memory module fm obtained in the previous round min_0 Vertical concatenation is performed, and the expanded features are then subjected to k-means clustering to obtain the minority class feature memory module fm for this round. min_1 ;

[0093] During the dual-branch training process, the above procedure is repeated to obtain the final feature memory module fm for the minority class. min ;

[0094] The same iterative steps are performed on the samples correctly classified in the majority class to obtain the feature memory module fm for the majority class. maj ;

[0095] Before clustering the correct classification features in each round, the feature memory module is used to expand the features of the correctly classified samples. This step is equivalent to expanding the number of features corresponding to the correctly classified samples, and to a certain extent, it retains the feature information of the correctly classified samples in the previous rounds. This allows the feature memory module to retain the global information of the original samples during the continuous updating process.

[0096] Because a feature space with stronger inter-class separability and lower inter-class overlap needs to be constructed, and the feature memory module provides direction for subsequent feature transfer, the feature memory items in different class feature memory modules need to have good inter-class separability. Simultaneously, to ensure the stability of subsequent feature transfer, each item in each class of sample feature memory module needs to have good intra-class uniformity. To ensure the inter-class separability and intra-class uniformity of the feature memory module, this invention uses a contrastive loss constraint on the feature extraction network of two class of sample feature memory modules, forcing the extracted features to meet the above requirements. The contrastive loss L... c The calculation process is as follows:

[0097]

[0098] Where n fm-num The number of feature memory items in the feature memory module is represented by exp(·), which is the exponential function, sim(·,·) represents the cosine similarity function, τ represents the hyperparameter temperature, and fm i and fm j fm represents two memory items from the same feature memory module. k This indicates that the features come from all feature memory modules except fm. i Other memory items;

[0099] In summary, the construction and updating process of the feature memory module can acquire and save the central information of the features corresponding to the correctly classified samples during the classification process, thus pointing the way for subsequent feature transfer.

[0100] Meanwhile, the contrastive loss of the two types of sample feature memory modules ensures the inter-class separability and intra-class uniformity of features extracted by the feature memory modules and feature extraction networks of different categories of samples, thus ensuring the reliability and stability of feature transfer.

[0101] Step 103, for samples x that are misclassified in the traditional classification branch F It can be classified as a misclassified majority class sample. and misclassified minority class samples Inputting it into a feature extraction network yields its corresponding feature vectors in the feature space. and

[0102] Features corresponding to misclassified minority class samples It needs to be pulled toward the minority class feature memory module, while the majority class feature memory module is used to push it away from its original position.

[0103] Since the transfer to the most recent feature memory item in the feature memory module is the easiest, the most recent feature memory items are found in the feature memory modules of the majority class and the minority class, respectively. and This indicates the direction of subsequent feature transfer, where t represents the index of the minimum distance feature memory term;

[0104] and The direction that forms the difference vector represents the direction of the "push" during feature transfer; and The direction of the difference vector represents the direction of the "pull" during feature transfer. The transfer vector δ is obtained by combining the two directions. min The calculation process is as follows:

[0105]

[0106] Where α min and β min These are random numbers conforming to a uniform distribution Uniform(0,1), representing the "push" and "pull" strengths in feature transfer, respectively. Combining both directions... Features after migration for

[0107] For existing imbalanced datasets, the number of samples in the dataset is often small. In order to achieve better classification results on the training set, the classifier often overfits the samples on the training set, resulting in underfitting of the samples on the test set and poor performance on the test set.

[0108] Therefore, in order to alleviate the overfitting phenomenon of the classifier, during the transfer of features corresponding to misclassified samples, the number of features corresponding to the transferred samples is increased, more diverse transfer features are generated, and the range of transferred features is expanded, thereby alleviating the overfitting phenomenon of the classifier to the training set.

[0109] Specifically, α min and β min To obtain a uniformly distributed random number (Uniform(0,1)), representing the strength of the "push" and "pull" forces during feature transfer, α is sampled multiple times during the feature transfer process. min and β min α conforms to a uniform distribution. min and β min Let be a set s, and s be expressed as follows:

[0110]

[0111] in and M represents the number of features in the transferred samples. At this point, the transfer vector δ′ obtained by combining the two directions... min as well as Features after migration The calculation process is as follows:

[0112]

[0113] Similarly, for the features corresponding to the misclassified majority class samples... Find the nearest feature memory item in the feature memory modules of the majority and minority classes respectively. and and The direction that forms the difference vector represents the direction of the "push" during feature transfer; and The direction of the difference vector represents the direction of the "pull" during feature transfer; the transfer vector δ′ obtained by combining the two directions... maj and features after migration

[0114] For imbalanced datasets, the number of majority class samples in the original data is often greater than the number of minority class samples. In order to achieve the best overall classification effect, traditional classifiers often misclassify some minority class samples as majority class samples, resulting in decision bias, which is not conducive to the accurate classification of the minority class.

[0115] Therefore, to alleviate the decision bias phenomenon of the classifier, during the transfer of features corresponding to the misclassified minority class, it is necessary to further increase the number of transferred minority class features, generating more diverse minority class transfer features. This will alleviate the underfitting phenomenon of the classifier to the minority class and mitigate the decision bias problem. Specifically, the number of transferred minority class misclassified features increases from M to IR·M;

[0116] IR is the imbalance ratio of the samples in the training set, which can be expressed as IR = n maj / n min The calculation yields n, where n maj n is the number of majority class samples in the training set. min The number of minority class samples in the training set;

[0117] For the transferred features and By concatenating these features vertically and then inputting them into a classifier, we can obtain the classifier's prediction results for the transferred features. The calculation process for the classification loss of the compensated classification branch is as follows:

[0118]

[0119] Where i is the index of the specific sample, σ(·) is the Sigmoid activation function, and y i is the label of the original sample, and N′ is the number of features after transfer;

[0120] Meanwhile, during the training process of the dual-branch network, in order to enable the feature extraction network to mine the difference information of samples from different categories as much as possible and extract features with less overlap and higher separability between classes, this invention uses the sum of the mean of the feature transfer vectors corresponding to the misclassified majority and minority classes as the loss constraint for the feature extraction network, forcing the extracted features to meet the above requirements. The loss function calculation process for feature transfer is as follows:

[0121] L t =||δ′min || 2 +||δ′ maj || 2 ,

[0122] During the training process of the dual-branch method, the feature transfer module transfers the features corresponding to the majority and minority class samples that were misclassified in the traditional classification branch. and The classes were transferred to the non-overlapping regions corresponding to the feature memory modules, and multiple transfers were used to alleviate the overfitting of the classifier and the class imbalance in the feature space.

[0123] Meanwhile, the mean of the feature transfer vectors corresponding to the misclassified majority and minority classes is used as the loss constraint feature extraction network, which forces it to focus on the difference information of different classes of samples in the overlapping area, and to mine the difference information of different classes of samples in the overlapping area as much as possible and construct a feature space with higher inter-class separability.

[0124] In summary, during the dual-branch training process, the losses of the feature extraction network and classifier include the contrastive loss of the feature memory module, the feature transfer loss, the loss of the traditional classification branch, and the classification loss of the transferred features. The calculation process of the total loss function is as follows:

[0125] L = L c +L t +L cls1 +L cls2 ;

[0126] Step 104: Based on the feature memory module and the feature transfer module, the features corresponding to the misclassified samples in the traditional classification branch will be transferred to the corresponding non-overlapping regions in the feature memory module, which effectively alleviates the inter-class overlap and class imbalance in the feature space.

[0127] To further improve the subsequent classification performance and the robustness of the classification results, a classification compensation module based on feature similarity is proposed. During the testing process, the classification compensation module integrates the classification results of the classifier and the feature memory module as the final classification result.

[0128] Specifically, for the feature memory module, its construction and updating process can acquire and save the central information of the features corresponding to the correctly classified samples during the classification process, thus pointing the way for subsequent feature transfer;

[0129] Meanwhile, due to the constraints of contrast loss, the feature center information it contains has good inter-class separability and intra-class uniformity, and can assist in sample classification by calculating the similarity between test features and memory items in the feature memory module.

[0130] During the testing process, for a test sample (x, y), its features f are first extracted using a feature extraction network, and then a classifier is used to classify the features f to obtain the predicted probability p. c Simultaneously, the distance d between the high-level features and the nearest memory item in the majority and minority class feature memory modules is calculated. maj and d min ;

[0131] For feature f, if its distance d from the nearest memory item in the majority class feature memory module is... maj Smaller values ​​indicate that it is closer to the majority class, and vice versa. Therefore, d maj and d min The relative size of the values ​​can aid in classification, and the calculation process for their classification probability is as follows:

[0132] p h =σ(d maj -d min ),

[0133] Where σ(·) is the Sigmoid activation function, p h This is the compensated classification probability obtained from the feature memory module. If feature f is closer to the majority class sample, i.e., d... maj <d min According to the properties of the Sigmoid function, p at this time h The value of p is close to 0; conversely, p h The value is close to 1;

[0134] During the testing phase, the predicted probability p of integrating a traditional classifier is... c The classification prediction probability p of the feature memory module h The final classification prediction probability p can be obtained, and its calculation process is as follows:

[0135]

[0136] The classification compensation module can make full use of the feature memory module that is continuously updated and iteratively optimized during training. It calculates the similarity between the test feature and the memory items in the feature memory modules of different categories to obtain the compensation classification probability, and compensates the prediction probability of the traditional classifier, thereby obtaining a more robust classification result and ensuring the stability of the classification performance improvement.

[0137] Step 105: Based on the above training process, the feature extraction network θ and classifier CLS for the two types of datasets are obtained.

[0138] Step 106: Based on the prediction results for each binary dataset, the fault category is obtained through hard voting, specifically as follows:

[0139] Based on steps 101 to 105, the classifier CLS corresponding to each binary dataset can be obtained. j , where j∈[1,7], for the sample to be tested x test Its predicted label The calculation is as follows:

[0140]

[0141] When the value is j, it means x test The predicted fault category is the j-th type of fault.

[0142] Figure 2 This is a flowchart illustrating the process of solving the fault classification of smart meters according to the present invention. First, the fault history datasets of smart meters under different categories are divided into multiple binary datasets. The proposed invention is then applied to construct a fault classification method and system for smart meters based on feature transfer under the guidance of a memory compensation strategy. For the test sample, the classifiers obtained from each binary dataset can be used for discrimination, and the final predicted category is obtained through a hard voting method.

[0143] Figure 3 This is a detailed schematic diagram of the algorithm of this invention. Based on a dual-path classification branch, this invention designs a compensating classification branch on top of the traditional classification branch. Utilizing a feature memory module and a feature transfer module, it forces the feature extraction network to focus on mining the commonalities and differences between samples of different categories within overlapping regions. This effectively constructs a feature space with stronger inter-class separability and lower overlap, significantly reducing the classification difficulty for subsequent classifiers. Simultaneously, during testing, the similarity between the feature memory module and the test features compensates for the classification results of the traditional classification branch, further improving classification performance and effectively enhancing subsequent classification performance and the accuracy and recall rate of faulty meter classification.

[0144] In a specific implementation, historical fault datasets from different categories of smart meters were used for testing. The dataset collected data from smart meters across 25 provinces and 7 fault types. Due to factors such as manual statistics and external conditions, data labels contained errors and omissions. After data cleaning using techniques including cluster analysis, missing value completion, and outlier handling, a total of 1500 fault sample data points were obtained. To reduce the randomness of the results, the dataset was randomly divided into training and test sets in an 8:2 ratio using a fixed random number seed.

[0145] To verify the effectiveness of the proposed invention, four mainstream algorithm-level methods and four mainstream data-level methods were compared in the embodiments of the present invention, as shown in Table 1. The embodiments of the present invention are represented by FT-MCS in the table.

[0146] Table 1 shows the algorithms compared in specific embodiments.

[0147]

[0148] This invention uses macro-F1 and G-mean metrics to evaluate the classification performance of the algorithm. The macro-F1 metric is the arithmetic mean of the F1-measures for each class, used to comprehensively evaluate the model's precision and recall across all classes. The G-mean metric is the geometric mean of the recall for each class, used to assess the model's recall performance across all classes. Both macro-F1 and G-mean values ​​range from 0 to 1; a higher value indicates better classification performance.

[0149] Table 2 compares the experimental results of the embodiments of this invention, mainstream algorithm-level methods, and data-level methods on F1-measure and macro-F1 metrics for various fault categories in smart meters. Table 3 compares the experimental results on recall and G-mean metrics for each category. It can be seen that the present invention achieves higher F1-measure and recall rates than other methods in most categories, and obtains the highest macro-F1 and G-mean. Combining the results in Tables 2 and 3, it is evident that the classification performance of the method in the embodiments of this invention for smart meter fault samples is better than existing imbalanced classification methods, achieving higher classification accuracy and recall.

[0150] Table 2. Experimental results of FT-MCS and comparison methods on F1-measure and macro-F1 indicators for various fault categories in smart meters.

[0151]

[0152] Table 3. Experimental results of FT-MCS and comparative methods on recall rate and G-mean index for various fault categories in smart meters.

[0153]

[0154] Extensive comparative results with mainstream algorithmic and data-level methods demonstrate that this invention trains the feature extraction network and classifier through a dual-path classification branch, utilizes a feature memory module to acquire and store the feature information centers of correctly classified non-overlapping region samples, and employs a feature transfer module to transfer features of misclassified samples that are likely located in overlapping regions. This forces the feature transfer module to fully exploit the differences between different categories within the overlapping regions, thereby constructing a feature space with stronger inter-class separability. This fundamentally avoids the impact of overlapping regions on the performance of subsequent classifiers, effectively improving subsequent classification performance and the accuracy and recall rate of fault meter classification. This is of great significance for strengthening the status monitoring of smart meters and ensuring power grid safety.

[0155] In summary, the embodiments of the present invention have the following beneficial effects:

[0156] In the technical solution of this invention, historical fault data of smart meters under different categories are used as input datasets, which are divided into multiple binary datasets. For each binary dataset, a feature memory module based on an iterative clustering strategy is constructed to acquire and store the center information of correctly classified samples of different categories. A feature transfer strategy combining "push" and "pull" vector methods is designed to optimize the differential feature mining capability of the feature extraction network through feature transfer loss. At the same time, a classification compensation strategy based on feature similarity is proposed, which combines the prediction results of traditional classification branches and the prediction results of the feature memory module as the final prediction result, thereby obtaining a more robust classification result. Based on the classification results of each binary dataset, its fault category is obtained through hard voting.

[0157] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method and system for classifying electricity meter faults based on feature transfer guided by a memory compensation strategy, characterized in that, Includes the following steps: (1) Using historical fault data from different categories of smart meters as input datasets, multiple binary datasets are obtained, specifically: Input the actual fault dataset of smart meters. The samples in this dataset contain 19 characteristic variables, including usage days, manufacturing unit, rated current, active power accuracy level, specifications, overload multiple, voltage, wiring method, payment terminal production batch, new or old, replacement cycle, hardware version, card meter tripping method, whether there is a load curve, whether there is a power outage for meter reading, whether there is a reverse phase sequence judgment, whether there is a current loss judgment, rate, and metering method. The fault category labels include seven categories: appearance fault, power supply fault, software fault, clock fault, communication unit fault, metering unit fault, and storage unit fault. By iterating through the samples of each category in the fault dataset, all samples in that category are designated as the minority class sample set, and all samples in the remaining categories are designated as the majority class sample set, transforming the original dataset into seven binary datasets. Each of these binary datasets can be described as follows: X=[X min ,X maj ], Where X is a binary dataset, and x is defined as any sample in this dataset, i.e., x∈X; X min Let x be the minority class sample set. min Let x be any sample in this dataset. min ∈X min ;X maj Let x be the majority class sample set. maj Let x be any sample in this dataset. maj ∈X maj ; (2) For each binary dataset, the present invention designs a feature memory module based on an iterative clustering strategy; Specifically, the traditional classification branch consists of a feature extraction network θ and a classifier CLS. For a sample x in a binary dataset, it is input into the feature extraction network and the classifier to obtain a feature vector f and a classification result. For a sample x that is correctly classified in the traditional classification branch T It can be classified into the correct majority class samples. and correctly classified minority class samples Each correctly classified majority and minority class sample has its corresponding feature memory module, namely fm. maj and fm min ; Since the feature extraction network and classifier have been pre-trained before the dual-branch training, the features extracted by the feature extraction network have a certain degree of reliability. At the same time, in order to ensure that the feature memory module can retain the global information of the original sample during the continuous updating process, the construction and updating of the feature memory module is a continuous iterative process. Based on the above analysis, during the first round of dual-branch training, for correctly classified minority class samples... Its corresponding characteristics are right Using the k-means clustering algorithm, we can obtain the cluster centers of several clusters, which can be used as the initial values ​​fm of the minority class feature memory module. min_0 In the next iteration, new features corresponding to the correctly classified samples will be generated. At this time Compared with the minority class feature memory module fm obtained in the previous round min_0 Vertical concatenation is performed, and the expanded features are then subjected to k-means clustering to obtain the minority class feature memory module fm for this round. min_1 ; During the dual-branch training process, the above procedure is repeated to obtain the final feature memory module fm for the minority class. min ; The same iterative steps are performed on the samples correctly classified in the majority class to obtain the feature memory module fm for the majority class. maj ; Before clustering the correct classification features in each round, the feature memory module is used to expand the features of the correctly classified samples. This step is equivalent to expanding the number of features corresponding to the correctly classified samples, and to a certain extent, it retains the feature information of the correctly classified samples in the previous rounds. This allows the feature memory module to retain the global information of the original samples during the continuous updating process. Because a feature space with stronger inter-class separability and lower inter-class overlap needs to be constructed, and the feature memory module provides direction for subsequent feature transfer, the feature memory items in different class feature memory modules need to have good inter-class separability. Simultaneously, to ensure the stability of subsequent feature transfer, each item in each class of sample feature memory module needs to have good intra-class uniformity. To ensure the inter-class separability and intra-class uniformity of the feature memory module, this invention uses a contrastive loss constraint on the feature extraction network of two class of sample feature memory modules, forcing the extracted features to meet the above requirements. The contrastive loss L... c The calculation process is as follows: Where n fm-num The number of feature memory items in the feature memory module is represented by exp(·), which is the exponential function, sim(·,·) represents the cosine similarity function, τ represents the hyperparameter temperature, and fm i and fm j fm represents two memory items from the same feature memory module. k This indicates that the features come from all feature memory modules except fm. i Other memory items; In summary, the construction and updating process of the feature memory module can acquire and save the central information of the features corresponding to the correctly classified samples during the classification process, thus pointing the way for subsequent feature transfer. Meanwhile, the contrastive loss of the two types of sample feature memory modules ensures the inter-class separability and intra-class uniformity of features extracted by the feature memory modules and feature extraction networks of different categories of samples, thus ensuring the reliability and stability of feature transfer. (3) For samples x that are misclassified in the traditional classification branch F It can be classified as a misclassified majority class sample. and misclassified minority class samples Inputting it into a feature extraction network yields its corresponding feature vectors in the feature space. and Features corresponding to misclassified minority class samples It needs to be pulled toward the minority class feature memory module, while the majority class feature memory module is used to push it away from its original position. Since the transfer to the most recent feature memory item in the feature memory module is the easiest, the most recent feature memory items are found in the feature memory modules of the majority class and the minority class, respectively. and This indicates the direction of subsequent feature transfer, where t represents the index of the minimum distance feature memory term; and The direction that forms the difference vector represents the direction of the "push" during feature transfer; and The direction of the difference vector represents the direction of the "pull" during feature transfer. The transfer vector δ is obtained by combining the two directions. min The calculation process is as follows: Where α min and β min To represent the "push" and "pull" strengths in feature transfer, we use a uniformly distributed random number (Uniform(0,1)). Combining these two directions... Features after migration for For existing imbalanced datasets, the number of samples in the dataset is often small. In order to achieve better classification results on the training set, the classifier often overfits the samples on the training set, resulting in underfitting of the samples on the test set and poor performance on the test set. Therefore, in order to alleviate the overfitting phenomenon of the classifier, during the transfer of features corresponding to misclassified samples, the number of features corresponding to the transferred samples is increased, more diverse transfer features are generated, and the range of transferred features is expanded, thereby alleviating the overfitting phenomenon of the classifier to the training set. Specifically, α min and β min To represent the strength of the "push" and "pull" forces in feature transfer, random numbers conforming to a uniform distribution (Uniform(0,1)) are sampled multiple times during the feature transfer process. min and β min α conforms to a uniform distribution. min and β min Let be a set s, and s be expressed as follows: in and M represents the number of features in the transferred samples. At this point, the transfer vector δ′ obtained by combining the two directions... min as well as Features after migration The calculation process is as follows: Similarly, for the features corresponding to the misclassified majority class samples... Find the nearest feature memory item in the feature memory modules of the majority and minority classes respectively. and and The direction that forms the difference vector represents the direction of the "push" during feature transfer; and The direction of the difference vector represents the direction of the "pull" during feature transfer; the transfer vector δ′ obtained by combining the two directions... maj and features after migration For imbalanced datasets, the number of majority class samples in the original data is often greater than the number of minority class samples. In order to achieve the best overall classification effect, traditional classifiers often misclassify some minority class samples as majority class samples, resulting in decision bias, which is not conducive to the accurate classification of the minority class. Therefore, in order to alleviate the decision bias phenomenon of the classifier, during the transfer of features corresponding to the misclassified minority class, it is necessary to further increase the number of features corresponding to the minority class after transfer, generate more diverse minority class transfer features, thereby alleviating the underfitting phenomenon of the classifier to the minority class and alleviating the decision bias problem of the classifier; specifically, the number of features after transfer of the misclassified minority class features increases from M to IR·M. IR is the imbalance ratio of the samples in the training set, which can be expressed as IR = n maj / n min The calculation yields n, where n maj n is the number of majority class samples in the training set. min The number of minority class samples in the training set; For the transferred features and By concatenating these features vertically and then inputting them into a classifier, we can obtain the classifier's prediction results for the transferred features. The calculation process for the classification loss of the compensated classification branch is as follows: Where i is the index of the specific sample, σ(·) is the Sigmoid activation function, and y i is the label of the original sample, and N′ is the number of features after transfer; Meanwhile, during the training process of the dual-branch network, in order to enable the feature extraction network to mine the difference information of samples from different categories as much as possible and extract features with less overlap and higher separability between classes, this invention uses the sum of the mean of the feature transfer vectors corresponding to the misclassified majority and minority classes as the loss constraint for the feature extraction network, forcing the extracted features to meet the above requirements. The loss function calculation process for feature transfer is as follows: L t =||δ′ min || 2 +||d′ maj || 2 , During the training process of the dual-branch method, the feature transfer module transfers the features corresponding to the majority and minority class samples that were misclassified in the traditional classification branch. and The classes were transferred to the non-overlapping regions corresponding to the feature memory modules, and multiple transfers were used to alleviate the overfitting of the classifier and the class imbalance in the feature space. Meanwhile, the mean of the feature transfer vectors corresponding to the misclassified majority and minority classes is used as the loss constraint feature extraction network, which forces it to focus on the difference information of different classes of samples in the overlapping area, and to mine the difference information of different classes of samples in the overlapping area as much as possible and construct a feature space with higher inter-class separability. In summary, during the dual-branch training process, the losses of the feature extraction network and classifier include the contrastive loss of the feature memory module, the feature transfer loss, the loss of the traditional classification branch, and the classification loss of the transferred features. The calculation process of the total loss function is as follows: L=L c +L t +L cls1 +L cls2 ; (4) Based on the feature memory module and the feature transfer module, the features corresponding to the misclassified samples in the traditional classification branch will be transferred to the corresponding non-overlapping region in the feature memory module, which effectively alleviates the inter-class overlap and class imbalance in the feature space. To further improve the subsequent classification performance and the robustness of the classification results, a classification compensation module based on feature similarity is proposed. During the testing process, the classification compensation module integrates the classification results of the classifier and the feature memory module as the final classification result. Specifically, for the feature memory module, its construction and updating process can acquire and save the central information of the features corresponding to the correctly classified samples during the classification process, thus pointing the way for subsequent feature transfer; Meanwhile, due to the constraints of contrast loss, the feature center information it contains has good inter-class separability and intra-class uniformity, and can assist in sample classification by calculating the similarity between test features and memory items in the feature memory module. During the testing process, for a test sample (x, y), its features f are first extracted using a feature extraction network, and then a classifier is used to classify the features f to obtain the predicted probability p. c Simultaneously, the distance d between the high-level features and the nearest memory item in the majority and minority class feature memory modules is calculated. maj and d min ; For feature f, if its distance d from the nearest memory item in the majority class feature memory module is... maj Smaller values ​​indicate that it is closer to the majority class, and vice versa; therefore, d maj and d min The relative size of the values ​​can aid in classification, and the calculation process for their classification probability is as follows: p h =σ(d maj -d min ), Where σ(·) is the Sigmoid activation function, p h This is the compensated classification probability obtained from the feature memory module; if feature f is closer to the majority class sample, i.e., d maj <d min According to the properties of the Sigmoid function, p at this time h The value of p is close to 0; conversely, p h The value is close to 1; During the testing phase, the predicted probability p of integrating a traditional classifier is... c The classification prediction probability p of the feature memory module h The final classification prediction probability p can be obtained, and its calculation process is as follows: The classification compensation module can make full use of the feature memory module that is continuously updated and iteratively optimized during training. It calculates the similarity between the test feature and the memory items in the feature memory modules of different categories to obtain the compensation classification probability, and compensates the prediction probability of the traditional classifier, thereby obtaining a more robust classification result and ensuring the stability of the classification performance improvement. (4) Based on the above training process, the feature extraction network θ and classifier CLS of the two types of datasets are obtained.

2. The method for classifying electricity meter faults based on commonality extraction and latent space optimization according to claim 1, characterized in that, In step (2), the structure of the feature extraction network is as follows: The structure of the classifier is shown below: Here, Linear() is the fully connected layer construction function, ReLU represents the corresponding activation function, and x_dim is the number of feature dimensions of the samples in the binary dataset.

3. The method and system for classifying electricity meter faults based on feature transfer guided by a memory compensation strategy according to claim 1, characterized in that, In step (2), n fm-num The value of is 3.

4. The method and system for classifying electricity meter faults based on feature transfer guided by a memory compensation strategy according to claim 1, characterized in that, In step (2), the value of τ is 0.

5.

5. The method and system for classifying electricity meter faults based on feature transfer guided by a memory compensation strategy according to claim 1, characterized in that, In step (2), the value of M is 10.