Non-intrusive load identification method based on metric learning

Through a metric learning-based method, load current characteristics are mapped to a new metric space and clustered using triple losses, which solves the problem of poor dependence and generalization performance on tag samples in the existing technology, and realizes the unknown Effective identification and strong generalization capabilities of loads reduce maintenance costs.

CN114359674BActive Publication Date: 2025-02-11ZHEJIANG UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210032592.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-12
Publication Date
2025-02-11
Estimated Expiration
2042-01-12

AI Technical Summary

Technical Problem

The existing non-invasive load recognition methods rely on a large number of label samples, making it difficult to obtain sufficient label data in practical applications, and the model generalization performance is poor, so it is impossible to effectively identify new loads and affect the recognition effect of the original load.

Method used

Using a metric learning-based method, the load current features are mapped to the new metric space through convolutional neural networks, and the triple loss is used for clustering to achieve effective load recognition, and the training samples are reduced through feature library matching and user annotation. dependency.

Benefits of technology

It realizes effective identification of unknown loads, has strong generalization ability, reduces the requirements for the number of training samples, reduces maintenance complexity and cost, and obtains more and more accurate user-side detailed power consumption information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114359674B_ABST
    Figure CN114359674B_ABST
Patent Text Reader

Abstract

The present invention proposes a non-intrusive load identification method based on metric learning. The present invention maps the load current characteristics to the metric space through a one-dimensional convolutional neural network, uses triplet loss to achieve feature clustering during network training, and performs similarity discrimination on the metric space features to achieve load identification. This method can effectively identify unknown loads and has strong generalization ability; on the other hand, metric learning, as one of the methods of small sample learning, can reduce the dependence on training samples and has high practicality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of non-intrusive load monitoring (NILM), and in particular to a non-intrusive load identification method based on metric learning. Background Art

[0002] With the rapid development of society, the demand for energy is increasing, and electricity, as the main secondary energy source, is one of the main ways to utilize energy. How to improve the efficiency of electricity use and realize intelligent electricity use has attracted widespread attention, and it is particularly important to master detailed electricity information on the user side. Traditional intrusive load monitoring requires the installation of collection and communication devices on each power load to detect the load status, and requires the transformation of existing electrical appliances or lines. It is difficult to implement and the cost is high. Non-intrusive load monitoring technology monitors the bus to analyze the status of each load in the line. It has the advantages of strong versatility and low cost, and has become a research hotspot in recent years.

[0003] Most of the existing non-intrusive load identification research is based on optimization and pattern recognition methods, but these methods have certain defects. First, most of these models rely on a large number of labeled samples for model training, but in practical applications, it is often difficult to obtain sufficient labeled data or the acquisition cost is high; second, these models usually assume that all loads in the scene are known. When new loads are added to the scene, the original model cannot identify the new loads, and may even affect the identification effect of the original loads; finally, these models have poor generalization performance, and the model often needs to be retrained after the scene is changed. Training and building models for each scene separately will greatly increase the complexity and cost of maintenance. Summary of the invention

[0004] The purpose of the present invention is to propose a non-intrusive load identification method based on metric learning in view of the problems of the prior art. The load current is used as a feature, and the current feature is mapped to a new metric space through a convolutional neural network. The triplet loss is used as the network loss to achieve clustering during network training. When performing identification, only the distance measurement of the load feature vector in the metric space is required. This method can effectively identify unknown loads and has a strong generalization ability. On the other hand, metric learning, as one of the methods of small sample learning, can reduce the dependence on training samples and has high practicality.

[0005] The technical solution of the present invention is as follows:

[0006] A non-intrusive load identification method based on metric learning comprises the following steps:

[0007] Step 1: Use an event detection algorithm to monitor the power data of the power bus in real time, locate the time when the load switching event occurs, and make a difference between the steady-state data before and after the load switching event to separate the voltage, current and power data of the load switching to be identified;

[0008] Step 2, starting the information collection of a complete cycle of current data at the positive zero crossing point of the voltage, and resampling and normalizing the collected current information;

[0009] Step 3, using the trained feature extraction network to extract features from the current, and obtain feature vector information of the load switching event to be identified;

[0010] Step 4, check whether the feature library exists. If not, create a feature library to store the feature vector information and power data of the load switching event to be identified and set the corresponding feature number;

[0011] If it exists, the similarity between the feature vector of each sample in the feature library and the feature vector of the load to be identified is calculated one by one. For the samples that meet the feature vector similarity condition, the similarity between the power of the sample and the power of the load to be identified is further calculated. If the power similarity condition is met, the load switching event to be identified and the sample in the feature library belong to the same load switching event, and the feature number of the sample in the feature library is used as the feature number of the load switching event to be identified; if none of them meet the feature vector similarity condition or the power similarity condition, the load switching event to be identified is a new event, and the feature vector information and power data of the load switching event to be identified are stored in the feature library and the corresponding feature number is set.

[0012] Step 5: Map the obtained characteristic number to an actual load switching event, wherein the load switching event includes load category and load state transition information.

[0013] The feature number of the sample newly added to the feature library is mapped to the load switching event in the following way:

[0014] When there are new samples added to the feature library, the user is notified and the user determines the actual load category and load state conversion information of the newly added number based on the historical switching records and the actual usage of the day.

[0015] Historical switching records can be used for visualization of historical working information of various types of loads.

[0016] Furthermore, the feature extraction network is composed of a plurality of one-dimensional convolutional layers, an activation function layer, a plurality of residual modules, a global average pooling layer and a linear layer and an L2 regularization layer connected in sequence.

[0017] Furthermore, the triplet loss is used as the network loss during the feature extraction network training.

[0018] Furthermore, when the feature extraction network is trained, the training samples used regard different working states of the same electrical appliance as separate devices.

[0019] Furthermore, in step 4, a cosine similarity calculation method is used to calculate the similarity between the feature vector of each sample in the feature library and the feature vector of the load to be identified, and a difference calculation method is used to calculate the similarity between the power of the sample and the power of the load to be identified.

[0020] Furthermore, in the mapping between the characteristic number mapping and the actual load switching event, the single-state load and the multi-state load are processed differently, as follows:

[0021] For single-state loads, there are only two states: on / off. The state transition is relatively simple, and only the characteristics of the state transition process need to be marked. For multi-state loads, since transitions may occur between different states of the load, in addition to marking the load type information, the load state change information also needs to be marked. Only by mastering the characteristic information of the transition between states can the multi-state load conversion information and the current state information be accurately identified.

[0022] The beneficial effects of the present invention are:

[0023] First, as one of the small sample learning methods, metric learning can reduce the requirements of the non-intrusive load identification model for the number of training samples, and better recognition performance can be obtained after a small amount of sample training; secondly, load identification is achieved by matching with the feature library, and unknown loads are automatically added to the feature library for identification and classification, waiting for the later user to annotate the equipment information; finally, the metric learning model has a strong generalization performance, and there is no need to retrain or establish a model when migrating to a new scene, which greatly reduces the migration cost and has a higher practical value. At the same time, in the process of mapping the sample feature number newly added to the feature library with the load switching event, the method of the present invention also marks the current state of the electrical appliance / load, so that more and more accurate detailed electricity consumption information on the user side can be obtained. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 The figure shows the current resampling and normalization process.

[0025] Figure 2 Schematic diagram of the network structure for current feature extraction.

[0026] Figure 3 Schematic diagram of triplet loss calculation.

[0027] Figure 4FIG. 1 is an overall identification flow chart of the present invention.

[0028] Figure 5 Schematic diagram of multi-state load state switching.

[0029] Figure 6 The model is trained in house6 in PLAID and the recognition results (confusion matrix) of some electrical appliances tested in COOLL are shown. DETAILED DESCRIPTION

[0030] In order to verify the characteristics and effects of the present invention, the present invention is further described below in combination with the WHITED dataset, the PLAID dataset and the COOLL dataset.

[0031] The present invention provides a non-intrusive load identification method based on metric learning, which obtains feature vector information through a trained feature extraction network, and compares the similarity between the feature vector information and power information of the load switching event to be identified and the samples in the feature library, and determines whether the load switching event to be identified is a new event based on the similarity, and determines the event type of the load switching event to be identified that is not a new event. In this embodiment, a feature extraction network is first constructed and trained, and then the method of the present invention is described in detail in combination with the trained feature extraction network.

[0032] Build and train the feature extraction network:

[0033] (1) Training set construction:

[0034] The training set of the present invention can adopt samples of the existing public data set in the field of non-intrusive load identification. Taking the sample of house6 in the PLAID data set as an example, the training set construction method is as follows:

[0035] House6 includes six electrical appliances: fluorescent lamps, air conditioners, refrigerators, fans, hair dryers, and laptop computers. The air conditioners and refrigerators have three and two working states, respectively. During model training, different working states are treated as independent load types.

[0036] When collecting training samples from each load type sample, the number of test cases for each load type is different. In order to ensure sample balance, when the number of samples is insufficient, the synthetic minority oversampling technique (SMOTE) is used to expand them. The main process is as follows:

[0037] 1) Randomly select two samples x0 and x1 from the same type of samples;

[0038] 2) The new sample is obtained according to the following formula:

[0039] x new=x0+rand(0,1)(x1-x0)

[0040] Rand(0,1) represents a random function that generates a random number of 0 or 1.

[0041] 3) Repeat the steps until the specified number of samples are obtained.

[0042] For each sample obtained, the current information is preprocessed, resampled to the specified frequency and normalized as network input. The detailed steps are:

[0043] a. In order to obtain the current phase information, the current acquisition starts when the voltage crosses the zero point in the positive direction;

[0044] b. Record the current information of a complete cycle;

[0045] c Resample the current information and use the linear interpolation method to obtain the current information of the specified sampling frequency. The specific calculation process is as follows:

[0046]

[0047]

[0048]

[0049] i' n =(ceil(loc)-loc)·i floor(loc) +(loc-floor(loc))·i ceil(loc)

[0050] Where N0 and N1 are the number of points per cycle of the original data and the sampled data, respectively; Ts0 and Ts1 are the sampling times before and after sampling, respectively; n is the nth data point after sampling; loc is the position of the nth data point corresponding to the original sequence; ceil and floor are the upward and downward rounding functions, respectively; i ceil(loc) and i floor(loc) are the current values ​​of the nth data point at the ceil(loc) and floor(loc) positions of the original sequence, i' n The current value of the nth data point after sampling is calculated by linear interpolation.

[0051] d. Normalize the sampled current and scale the current amplitude to between [-1,1]. That is, perform the following operations on the current:

[0052]

[0053] Where, I' is the normalized current, I = [i'1,i'2,…,i' N1,] is the current sequence after sampling. max(abs(I)) represents the maximum value of the absolute value of the current sequence after sampling.

[0054] (2) Constructing a feature extraction network model: The feature extraction network in the present invention can be any feature extraction network. In this implementation, it is constructed with reference to the ResNet model, which is a metric network model constructed based on a one-dimensional convolutional residual block, and is composed of multiple one-dimensional convolutional layers, activation function layers, multiple residual modules, global average pooling layers, linear layers, and L2 regularization layers connected in sequence (not shown in the figure). Figure 2 The figure shows a schematic diagram of an exemplary structure. The structure first uses 64 one-dimensional convolution kernels of size 7 to perform convolution operations on the current, and selects a step size of 2 for downsampling. Then, it passes through three residual modules in sequence for downsampling and feature extraction. Finally, it passes through the global average pooling layer for dimensional expansion. After passing through the linear layer, the feature vector extracted based on the load current is obtained. In order to eliminate the influence of the feature vector modulus value in the distance calculation, the L2 regularization layer is used to normalize the feature vector output by the network so that it falls on the surface of the unit hypersphere. At this time, the Euclidean distance and the cosine distance can be regarded as equivalent. In order to speed up the convergence speed, a BN (BatchNormalization) layer is added to the convolution layer and the residual module after each convolution to standardize the feature value. In terms of the selection of the activation function, the network input is the current sampling value of [-1,1], so the Tanh function is selected as the activation function.

[0055] When the triplet loss function is used during network training, if each pair of samples is input into the network for training, the space complexity is O(N 3 ), and as the training process progresses, the number of triplets with a loss of 0 will increase, the average network loss will be lowered, and the network training will slow down until it falls into a local optimum. To solve this problem, it is necessary to screen the triplets each time the training sample is constructed, and select a certain number of triplets with a loss of non-zero as the training sample group. Figure 3 As shown, the network training process is accelerated to avoid falling into the local optimum.

[0056] Specifically, triple loss is used as the loss function for network training, and the triple loss is as follows:

[0057] L=max(d(a,p)-d(a,n)+margin,0)

[0058] In the formula, the triple is<a,p,n> , a is called the anchor, p is a positive example, belonging to the same category as a, and n is a negative example, belonging to a different category. d is the distance metric function, and the Euclidean distance is used during training (due to normalization, the farther the distance on the unit hypersphere, the larger the angle between the two vectors, which is equivalent to the cosine distance), and margin is a constant, whose purpose is to prevent the loss from being zero when both the positive and negative samples are very close to the anchor sample.

[0059] After the training is completed, a trained feature extraction network is obtained, and the non-intrusive load identification method based on metric learning of the present invention is implemented using the trained feature extraction network. Figure 4 As shown, the following steps are included:

[0060] Step 1: Use the event detection algorithm to monitor the power data of the power bus in real time, locate the time when the load switching event occurs, and make a difference between the steady-state data before and after the load switching event occurs, so as to separate the voltage, current and power data of the load switching event to be identified;

[0061] Step 2, collecting current information of a complete cycle of voltage and current data starting at the voltage positive zero crossing point, and resampling and normalizing the collected current information;

[0062] Step 3, using the trained feature extraction network to extract features from the current, and obtain feature vector information of the load switching event to be identified;

[0063] Step 4, check whether the feature library exists. If not, create a feature library to store the feature vector information and power data of the load switching event to be identified and set the corresponding feature number;

[0064] If it exists, the similarity between the feature vector of each sample in the feature library and the feature vector of the load to be identified is calculated one by one. For the samples that meet the feature vector similarity condition, the similarity between the power of the sample and the power of the load to be identified is further calculated. If the power similarity condition is met, the load switching event to be identified and the sample in the feature library belong to the same load switching event, and the feature number of the sample in the feature library is used as the feature number of the load switching event to be identified; if none of them meet the feature vector similarity condition or the power similarity condition, the load switching event to be identified is a new event, and the feature vector information and power data of the load switching event to be identified are stored in the feature library and the corresponding feature number is set.

[0065] The similarity calculation result is used to judge the similarity, and a calculation method such as cosine similarity, difference calculation, and Euclidean distance can be used. Preferably, this embodiment uses a cosine similarity calculation method to calculate the similarity between the feature vector of each sample in the feature library and the feature vector of the load to be identified, as follows:

[0066]

[0067] In the formula, x and y represent two feature vectors, and n represents the length of the feature vector. The closer its value is to 1, the more similar the two features are. In practice, the similarity condition can be reasonably set according to the situation.

[0068] The difference calculation method is used to calculate the similarity between the power of the sample and the power of the load to be identified, as follows:

[0069] Relative difference = (P max -P min ) / P min

[0070] Where P max and P min are the larger and smaller values ​​of the power of the load switching event to be identified and the power of the samples in the feature library, respectively.

[0071] In practice, the similarity condition can be reasonably set according to the situation, and different thresholds can be set for different power ranges to improve recognition accuracy.

[0072] The feature number of the sample newly added to the feature library is mapped to the load switching event in the following way:

[0073] When there are new samples added to the feature library, the user is notified. The user determines the actual load category and load state transition information of the newly added feature number based on the historical switching records and the actual usage of the day. Among them, for single-state loads, there are only two states: on / off. Its state transition is relatively simple, and it only needs to mark the characteristics of the state transition process; for multi-state loads, such as Figure 5 As shown, since transitions may occur between various states of the load, different states have different characteristic information. When marking, in addition to marking the load type information, the change information of the load state can also be marked. By mastering the characteristic information when transitioning between states, the multi-state load conversion information and the current state information can be accurately identified, thereby obtaining more and more accurate detailed electricity consumption information on the user side.

[0074] In order to illustrate the advantages of the method of the present invention, two embodiments are constructed for illustration.

[0075] In the two embodiments, in terms of model parameter selection, the extracted current sampling frequency is 128 points per cycle, the feature dimension extracted by the measurement network is 16, and when performing cosine similarity judgment, the similarity threshold is set to 0.8. When the cosine similarity of two features is greater than 0.8, the two features are considered to be similar, otherwise they are not similar. Similarly, when performing power matching, the power relative difference threshold is set to 0.2.

[0076] In terms of test result measurement indicators, the F1 score and accuracy (Acc) are selected for measurement, and the calculation is as follows:

[0077]

[0078]

[0079]

[0080]

[0081] Where TP, FP, TN, and FN refer to the number of true positives, false positives, true negatives, and false negatives, respectively; precision is the accuracy rate, and recall is the recall rate.

[0082] Embodiment 1:

[0083] In order to illustrate the general recognition ability of the present invention, 80% of the WHITED dataset samples are used as the training set to train the feature extraction network, and the remaining samples are tested and compared with the common VI methods: literature [1] (De Baets L, Dhaene T, Deschrijver D, et al. VI-Based Appliance Classification Using Aggregated Power Consumption Data [C] / / 2018 IEEE International Conference on Smart Computing (SMARTCOMP). Taormina: IEEE, 2018: 179–186.), literature [2] (Wang Ying, Yang Wei, Xiao Xianyong, Zhang Shu. Non-intrusive residential load monitoring method based on refined recognition of UI trajectory curves [J]. Power System Technology, 2021, 45 (10): 4104-4113.) and literature [3] (De Baets L, Ruyssinck J, Develder C, et al. Appliance Classification Using VI Trajectories and Convolutional Neural Networks [J]. Energy and Power Systems Engineering, 2018: 117–118.). Buildings, 2018, 158:32–36.) and used the F1 score as the performance indicator. The results are shown in Table 1.

[0084] Table 1 Comparison of general recognition capabilities

[0085]

[0086] It can be seen that the present invention can obtain better recognition ability than the existing VI method (including VI trajectory and power two-stage recognition) by using current data and power data combined with a one-dimensional convolutional neural network. The method of the present invention has a simpler network structure and lower computational complexity.

[0087] Embodiment 2:

[0088] In order to verify the versatility and small sample learning ability of the method of the present invention, only the samples of house6 in the PLAID dataset are used as the training set, and some appliances in the COOLL dataset are selected for testing.

[0089] The selected electrical appliances in the COOLL data set include air conditioner, modem, charger, travel charger, drill, fan 1, fan 2, soldering iron, and vacuum cleaner. 20 sets of information are collected for each electrical appliance as test samples, and the confusion matrix of the recognition results is as shown in the attached figure. Figure 6 shown.

[0090] Due to signal noise or current fluctuations during steady-state operation of electrical appliances, some electrical appliances are identified as multiple numbers. As shown in the mark in the confusion matrix, electrical appliances 1 and 5 are identified as 2 numbers respectively, that is, the waveform difference within the class exceeds the threshold set by the model, and some samples are identified as new devices. However, the overall recognition effect is relatively ideal, and the recognition accuracy of each electrical appliance is shown in Table 2. Electrical appliances identified as multiple numbers can be solved by mapping these numbers to the same type of electrical appliances in the process of mapping and labeling the feature numbers set for the samples added to the feature library to the real load switching events. The method of the present invention has good robustness.

[0091] Table 2 Results of cross-dataset generalization ability test

[0092]

[0093]

[0094] In summary, it can be seen from the embodiments that compared with other methods based on VI trajectories, the present invention is superior in general recognition performance. More importantly, the present invention still performs well in generalization ability across data sets and small sample learning tests. It only needs to be trained with limited samples (only the load in house6 in the PLAID data set is used as the training set), and in the later stage, multiple identification numbers can be mapped to the same appliance to further improve the recognition effect, which has high practical value. At the same time, in the process of mapping the sample feature number newly added to the feature library with the load switching event, the method of the present invention also marks the status of the current appliance / load, so that more and more accurate detailed electricity consumption information on the user side can be obtained.

[0095] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.

Claims

1. A non-intrusive load identification method based on metric learning, characterized in that: The steps include: Step 1: Use an event detection algorithm to monitor the power data of the power bus in real time, locate the time when the load switching event occurs, and make a difference between the steady-state data before and after the load switching event to separate the voltage, current and power data of the load switching to be identified; Step 2, starting the information collection of a complete cycle of current data at the positive zero crossing point of the voltage, and resampling and normalizing the collected current information; Step 3, using the trained feature extraction network to extract features from the current, and obtain feature vector information of the load switching event to be identified; Step 4, check whether the feature library exists. If not, create a feature library to store the feature vector information and power data of the load switching event to be identified and set the corresponding feature number; If it exists, the similarity between the feature vector of each sample in the feature library and the feature vector of the load to be identified is calculated one by one. For the samples that meet the feature vector similarity condition, the similarity between the power of the sample and the power of the load to be identified is further calculated. If the power similarity condition is met, the load switching event to be identified and the sample in the feature library belong to the same load switching event, and the feature number of the sample in the feature library is used as the feature number of the load switching event to be identified; if all do not meet the feature vector similarity condition or the power similarity condition, the load switching event to be identified is a new event, and the feature vector information and power data of the load switching event to be identified are stored in the feature library and the corresponding feature number is set; Step 5, mapping the obtained characteristic number to an actual load switching event, wherein the load switching event includes load category and load state transition information; The feature number of the sample newly added to the feature library is mapped to the load switching event in the following way: When there are new samples added to the feature library, the user is notified and the user determines the actual load category and load state conversion information of the newly added number based on the historical switching records and the actual usage of the day.

2. A non-intrusive load identification method based on metric learning as claimed in claim 1, characterized in that: The feature extraction network consists of a plurality of one-dimensional convolutional layers, an activation function layer, a plurality of residual modules, a global average pooling layer and a linear layer and an L2 regularization layer connected in sequence.

3. The non-intrusive load identification method based on metric learning according to claim 1, characterized in that: The feature extraction network is trained using triplet loss as the network loss.

4. The non-intrusive load identification method based on metric learning according to claim 1, characterized in that: When the feature extraction network is trained, the training samples used regard different working states of the same electrical appliance as separate devices.

5. The non-intrusive load identification method based on metric learning according to claim 1, characterized in that: In step 4, a cosine similarity calculation method is used to calculate the similarity between the feature vector of each sample in the feature library and the feature vector of the load to be identified, and a difference calculation method is used to calculate the similarity between the power of the sample and the power of the load to be identified.