Non-intrusive home appliance state recognition method and medium based on long short-term memory network
Through the non-invasive home appliance state recognition method based on the CNN-LSTM model, the problems of high cost, high complexity and unsatisfactory recognition of home appliances in the traditional method are solved, and low energy consumption, low cost and fast home appliance state recognition is achieved. In many appliance environments.
Patent Information
- Application Number
- CN202311864845.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2043-12-29
AI Technical Summary
The traditional home appliance state recognition method has the problems of high cost, complex installation and maintenance, large data collection, high algorithm complexity and unsatisfactory recognition accuracy, especially in the environment of multiple home appliances, complex multi-stable state and transient signals, and Supervised learning requires a large number of data samples, and as the types of electrical appliances increase, the number of training sets increases exponentially, becoming impractical.
Using a non-invasive household appliance state recognition method based on the CNN-LSTM model, the training data set is constructed by collecting the current value of a single appliance, and the features are extracted using the CNN module. The LSTM module separates the electrical signals, combines knowledge distillation and model quantization methods to compress the model, and obtain a lightweight A magnitude model, deployed to mobile terminal for real-time identification.
It realizes the status recognition of home appliances with low energy consumption, low cost, simple configuration, high recognition accuracy and fast inference speed. It can achieve ideal recognition accuracy in multiple home appliance environments, and greatly reduce the complexity of the algorithm through model compression and improve the inference speed.
Smart Images

Figure CN117807528B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of current identification, and in particular relates to a non-invasive household appliance state identification method and medium based on a long short-term memory network. Background Art
[0002] Among the household appliance load identification methods, the traditional intrusive methods have the following main disadvantages: (1) The traditional intrusive methods require the installation of collection sensor devices in household appliances, which has the disadvantages of high cost and complex installation and maintenance. The present invention only needs to collect the total power consumption information of users at the power entrance, and then perform data analysis and prediction on the total power consumption data, which has the advantages of low cost and easy installation and maintenance. (2) The current household appliance state identification algorithms mostly use time domain method and time frequency method. The time domain method and time frequency method mostly select the steady-state or transient electrical parameters of household appliances such as steady-state voltage, current, power parameters and other high-frequency signals as load tags, which have the disadvantages of large amount of collected data and large storage space. The present invention only collects the low-frequency current signal of household appliances as the load tag, which has the advantages of simple collection process and small amount of data. (3) Traditional home appliance status recognition algorithms mostly use traditional clustering and decomposition algorithms such as k-nearest neighbor algorithm, LMD (local mean decomposition), HHT (Hilbert transform), wavelet transform, etc. to realize the judgment of the switch status of home appliances. They have the disadvantages of high computational space and time complexity, and unsatisfactory recognition accuracy in the environment of multiple appliances, complex multi-stable states and transient signals. The present invention adopts the CNN-LSTM model, which can achieve ideal recognition accuracy in the environment of multiple appliances, complex multi-stable states and transient signals, and can greatly reduce the algorithm complexity through the model compression method, thereby improving the inference speed while ensuring the recognition accuracy.
[0003] With the development of artificial intelligence and smart homes, research on home appliance status recognition has become an important research topic in the fields of electricity behavior analysis, household electricity safety, and reasonable power distribution. Based on existing load identification research, users can monitor the operating status of appliances and optimize electricity consumption independently. Furthermore, users' electricity behavior can be analyzed and predicted based on different home appliance status data. However, too many sensors will bring about problems such as infringement of user privacy, cumbersome installation and maintenance, and high costs. Traditional unsupervised learning algorithms have low accuracy in identifying the status of a single home appliance from electrical signals with mixed, complex electrical steady-state, and transient information from multiple appliances. Supervised learning requires a large amount of data samples for training. As the number of electrical appliances increases, the number of required training sets also increases exponentially, making it impractical to use traditional unsupervised learning algorithms for status recognition. Summary of the invention
[0004] The present invention proposes a non-intrusive household appliance status recognition method based on a long short-term memory network.
[0005] The technical solution to achieve the purpose of the present invention is: a non-intrusive household appliance status recognition method based on long short-term memory network, the specific steps are:
[0006] Collect the current value of a single appliance and construct a training data set;
[0007] The CNN-LSTM-based perception model is trained using the training data set. The perception model uses a CNN module as a feature extractor, uses an LSTM module to separate the electrical signal of each appliance from the total signal, and uses a fully connected layer to determine the probability of the switch state of the appliance based on the separated electrical signal;
[0008] Use knowledge distillation and model quantization methods to compress the trained perception model to obtain a lightweight model;
[0009] Deploy the lightweight model to the mobile terminal to identify the status of electrical appliances in real time.
[0010] Preferably, the specific method of collecting the current value of a single appliance and constructing a training data set is:
[0011] Collect the current value of a single appliance, combine the current of the single appliance according to Kirchhoff's law, and the combination of n appliances is 2 n The mixed current is used as the training data set.
[0012] Preferably, random noise of Gaussian distribution is added to the training data set according to the mean and variance of the training data set, and Gaussian noise is generated and added to the current signal by setting the mean and standard deviation.
[0013] Preferably, the CNN module includes a cascaded three-layer CNN, a ReLU activation function and a pooling layer enhanced network, each layer of CNN includes a series of convolution operations for extracting the time pattern, frequency information and amplitude change characteristics in the current data, and reducing the feature dimension through the nonlinear characteristics of the ReLU activation function and the pooling layer enhanced network.
[0014] Preferably, the LSTM module is used to perform time series evolution analysis on the features extracted by the CNN module to obtain important time dynamics and key events in the current signal, wherein the important time dynamics include periodic fluctuations, spikes or drops of the current signal, and the key events include turning on or off the electrical appliance.
[0015] Preferably, a binary cross entropy loss function is used as the loss function for training the CNN-LSTM based perception model.
[0016] Preferably, the trained perception model is compressed by using knowledge distillation and model quantization methods. The specific method for obtaining a lightweight model is as follows:
[0017] The trained CNN-LSTM-based perception model is used as the teacher model, and the key information of the teacher model is transferred to the student model by using the knowledge distillation technology and the student model is trained. The number of CNN layers and LSTM layers of the student model is less than that of the teacher model.
[0018] The weights of the student model are converted into integers, and the trained student model with integer weights is used as a lightweight model.
[0019] Preferably, the specific method of using knowledge distillation technology to transfer key information of the teacher model to the student model and train the student model is:
[0020] The training data set of the perception model and its corresponding labels, as well as the soft target output of the perception model in the form of probability distribution of the same training data set, are input into the student model for training until the model converges.
[0021] Compared with the prior art, the present invention has the following significant advantages: the present invention proposes a non-intrusive household appliance status recognition algorithm based on the CNN-LSTM model, which has the advantages of low energy consumption, low cost, simple configuration, high recognition accuracy and fast reasoning speed;
[0022] The present invention proposes a method for constructing a data set using the current of a single household appliance. Based on Kirchhoff's law, all the current values of single household appliances are arranged and combined to generate a data set, and a new data set can be instantly generated through online learning based on user feedback.
[0023] The present invention takes into account the algorithm operation complexity problem and adopts a model compression method that combines knowledge distillation and model quantization, which greatly improves the model's reasoning speed while ensuring that the algorithm recognition accuracy does not decrease significantly.
[0024] The present invention is described in further detail below in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 The present invention is a flowchart of a non-intrusive household appliance status recognition method based on a long short-term memory network.
[0026] Figure 2 Schematic diagram of the perception model based on CNN-LSTM. DETAILED DESCRIPTION
[0027] A non-intrusive household appliance state recognition method based on long short-term memory network, the specific steps are:
[0028] Collect the current value of a single appliance and construct a training data set;
[0029] Considering the characteristics of electrical appliance characteristic signals, the CNN-LSTM-based perception model is trained using the training data set. Each appliance is trained with a model, and n models are trained for n appliances. The perception model uses the CNN network as a feature extractor and the LSTM network to separate the electrical signal of each appliance from the total signal.
[0030] Use knowledge distillation and model quantization methods to compress the trained perception model to obtain a lightweight model;
[0031] Deploy the lightweight model to the mobile terminal to identify the status of electrical appliances in real time.
[0032] As an embodiment, the current value of a single appliance is collected, and the current of the single appliance is combined according to Kirchhoff's law. In the case of n appliances, 2^n mixed currents are combined as a training data set. Supervised learning requires a large amount of data for training. In the field of home appliance status recognition, the training data set needs to cover the switch status combination of all appliances in the case of multiple appliances, which makes the training data collection too cumbersome, and the newly added appliances need to re-collect the data set, and the large data set will lead to a long training time. The training set construction method of this embodiment solves the above problems.
[0033] Specifically, a multi-electric scene is constructed, and the current is collected and monitored using a single-chip microcomputer combined with a current transformer. The current transformer is responsible for detecting the current and converting it into an analog signal that can be processed by the single-chip microcomputer. Each current signal consists of 320 acquisition points, which are converted into digital signals for processing by the analog-to-digital converter (ADC) on the single-chip microcomputer. The single-chip microcomputer is responsible for reading and analyzing these data points, and further transmitting and displaying the data through the corresponding interface. This configuration enables the system to accurately monitor current changes and is suitable for a variety of current monitoring application scenarios. After the current signal of each appliance is collected, according to Kirchhoff's law, the total current value of the parallel appliances is equal to the sum of the currents of each appliance. The current signals are arranged and combined to obtain a representative total data set.
[0034] Furthermore, noise is added to the training dataset to generate a comprehensive and updateable dataset.
[0035] Specifically, a multi-grid scenario is established. In addition to accurately monitoring the current signal, noise data is introduced to simulate the current fluctuations in the real world to enhance the diversity and practicality of the data set. Gaussian distributed random noise is added according to the mean and variance of the training data set. By setting the appropriate mean and standard deviation, Gaussian noise is generated and added to the current signal. These noises can simulate realistic factors such as voltage fluctuations, temporary load changes, or equipment aging, making the data set more comprehensive.
[0036] Furthermore, as time passes and appliance usage patterns change, the dataset is updated through an online learning mechanism, which continuously adjusts and optimizes based on the latest current monitoring data to accommodate new usage patterns and environmental conditions. This is achieved by periodically reanalyzing the current data and incorporating new observations into the existing dataset. The online learning mechanism ensures that the dataset is always up to date, thereby improving the accuracy and reliability of the monitoring system’s predictions of appliance behavior.
[0037] Furthermore, the training data set uses a one-hot binary classification label, such as [1,0] indicates that the appliance is turned off, and [0,1] indicates that the appliance is turned on.
[0038] The data set generated by this embodiment has the advantages of small data volume, comprehensive coverage of electrical switch state combinations, and real-time update according to user feedback.
[0039] As an example, Figure 2 As shown, the perception model includes a cascaded three-layer convolutional neural network (CNN), a two-layer long short-term memory network (LSTM) and a decision layer. The three-layer convolutional neural network constitutes a CNN module, and the two-layer long short-term memory network constitutes a LSTM module.
[0040] Specifically, each layer of convolutional neural network is connected to a pooling layer. After the last pooling layer outputs the time pattern, frequency information, and amplitude change characteristics in the current data, Python and tensorflow built-in functions are called to perform latitude conversion and tensor segmentation on the features, so that the output of the pooling layer meets the requirements of the long short-term memory network input.
[0041] Specifically, the CNN module is used to extract features from input data. In the CNN module, each layer of the convolutional neural network consists of a series of convolution operations, which effectively extract local features such as time patterns, frequency information, and amplitude changes in the current data. Then, the ReLU activation function and the pooling layer are used to enhance the nonlinear characteristics of the network to reduce the feature dimension, and finally the extracted multi-dimensional feature map is sent to the LSTM layer.
[0042] Specifically, the LSTM module is used to process time series data and capture long-term dependencies. LSTM is a special recurrent neural network (RNN) that can retain long-term dependency information in sequence data processing. Through the processing of the LSTM layer, the model can better understand the temporal dynamics in the current data and effectively classify or predict the sequence.
[0043] Specifically, the main role of the LSTM module is to capture and understand the long-term time dependencies and dynamic changes in the current data. By combining the local features extracted by the CNN module (such as time patterns, frequency information, and amplitude changes), the LSTM module can deeply analyze the evolution of these features throughout the time series, and keenly capture important time dynamics in the current signal, such as periodic fluctuations, spikes or drops, and key events such as the opening and closing of electrical appliances. After processing the current data, the long short-term memory network produces a comprehensive feature representation that not only contains the key time dependencies and dynamic features in the current signal, but also includes contextual information within the entire observation window. This enables the output of the LSTM module to provide rich information for further analysis of the current data, which is used to identify the switching state of the electrical appliance in the perception model.
[0044] Specifically, the decision layer determines the probability of the appliance switch state based on the output of the LSTM module, allowing the model to perform accurate data interpretation and prediction based on a comprehensive understanding of the current time series.
[0045] Specifically, the decision layer adopts a fully connected layer.
[0046] Furthermore, the CNN-LSTM-based perception model training uses binary cross entropy as the loss function for the binary classification problem. The model perception model training uses the back propagation algorithm combined with the gradient descent method to optimize the network parameters. In each iteration, the gradient of the loss function with respect to the model parameters is calculated, and the parameters are updated to minimize the loss function.
[0047] Furthermore, the Adam optimizer is used during training, which helps to accelerate the training process and improve the convergence speed of the model while ensuring the training accuracy. Training strategies such as learning rate scheduling, early stopping and Dropout are used to improve the generalization ability of the model and prevent overfitting.
[0048] The CNN-LSTM-based perception model of the present invention fully utilizes the advantages of CNN in feature extraction and the ability of LSTM in processing long-term dependencies in time series data, making the model more effective and accurate in processing complex current data.
[0049] As an embodiment, the trained perception model is compressed by using knowledge distillation and model quantization methods to obtain a lightweight model. The model can be reduced to 1 / 64 of the original model without a significant decrease in prediction accuracy. The specific method is as follows:
[0050] Through knowledge distillation technology, the trained perception model is used as a teacher model to pass its key information to a smaller and lighter "student model".
[0051] The student model uses two layers of convolution and one layer of LSTM as the student model, and the number of parameters is about 1 / 4 of the teacher model, making it smaller and lighter.
[0052] The key information includes the soft target output of the teacher model (i.e., the probability distribution of the entire output layer), the feature representation of the intermediate layers, and the intrinsic regularities and abstract representation of the current data.
[0053] In order to make the student model imitate the behavior and performance of the teacher model while keeping the size small, the output of the teacher model is involved in the training process of the student model. The training process of the student model is as follows:
[0054] The training data set of the perception model and its corresponding labels, and the soft target output of the perception model in the form of probability distribution of the same training data set are input into the student model for training. The soft target output includes the confidence of the teacher model for each classification;
[0055] The training goal of the student model is not only to accurately predict the original label, but also to approximate the soft target of the teacher model as much as possible. In this way, the student model can learn the behavior and decision-making process of the teacher model, thereby imitating the high-level behavior and performance of the teacher model while maintaining a small size. This training process allows the student model to not only learn simple classification tasks, but also capture the teacher model's deep understanding of the data and subtle classification boundaries, which is critical to improving the accuracy and generalization ability of the student model.
[0056] Subsequently, the student model is quantized, a technique that reduces the storage space required for the model. The 32-bit floating-point parameters in the student model are converted to 8-bit low-precision integer representations, which not only significantly reduces the storage requirements of the model, but also increases the model's inference speed because integer operations are more efficient than floating-point operations on hardware. After these two steps, the student model is reduced to 1 / 64 of its original size, with no significant decrease in prediction accuracy, and the inference speed is increased to about 4 times the original.
[0057] Furthermore, in the unquantized deep learning model of the trained student model, weights (i.e., parameters of each layer in the neural network) and activation values (outputs of the neural network layer) are usually stored in 32-bit floating point format. This format provides sufficient accuracy to capture subtle changes in the training process, but relatively occupies more storage space and computing resources. The present invention adopts a symmetric quantization strategy, calculates scaling factors and zero points to map floating point numbers to integer ranges, and applies integer range parameters to complete quantization conversion, converting the 32-bit floating point parameters in the student model into 8-bit low-precision integer representations, thereby using the weight-converted student model as a lightweight model.
[0058] In a further embodiment, the lightweight model is deployed on a smart meter. As a typical edge computing device, the meter usually has low processing power and limited storage space. Therefore, model compression is crucial to ensure that the model can run smoothly on these devices. The smart meter can deploy lightweight models of multiple different electrical appliances, and each lightweight model predicts the switch state of the corresponding electrical appliance.
[0059] Through this series of model optimization and compression strategies, it is possible to ensure model performance while achieving effective operation in resource-constrained environments, providing powerful data analysis and processing support for applications such as smart meters.
[0060] The following data takes a model laptop computer in the lightweight model corresponding to 15 electrical appliances as an example. The test set consists of 2048 mixed current data. The original model size is 1731k, and the size after two model compressions is 25.7k. In addition, there is no obvious decrease in the test accuracy on the test set, as shown in Table 1:
[0061] method Model size (front / back) Test accuracy (front / back) Knowledge Distillation 1731k / 130k 99.7% / 94.92% Quantification 1731k / 185k 99.7% / 95.05% Knowledge Distillation + Quantification 1731k / 25.7k 99.7% / 94.7%
[0062] Table 1
[0063] In order to compare the inference speed before and after model compression, the models before and after compression are tested on the test set and the test time is calculated. The time consumption comparison before and after model compression is shown in Table 2:
[0064] index Before model compression After model compression Testing time 16.9s 4.4s
[0065] Table 2
[0066] As an embodiment, the device for collecting user electricity consumption information is a smart meter at the user's access point. The smart meter collects the current values of 15 types of electrical appliances and generates a training data set through an algorithm. The CNN-LSTM model is trained on the host computer, and the trained model is deployed on the smart meter through model compression to predict the status of home appliances in real time. The training set can be updated through online learning to correct the model prediction results.
[0067] As an embodiment, a computer-readable storage medium stores a computer program, which, when executed by a processor, can implement any of the methods for sensing the state of electrical equipment based on a graph convolutional neural network in the above-mentioned embodiments.
[0068] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only storage (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0069] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0070] Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to:
[0071] Wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0072] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
Claims
1. A non-intrusive household appliance state recognition method based on long short-term memory network, characterized in that: The specific steps are: Collect the current value of a single appliance and construct a training data set; The CNN-LSTM-based perception model is trained using the training data set. The perception model uses a CNN module as a feature extractor, uses an LSTM module to separate the electrical signal of each appliance from the total signal, and uses a decision layer to determine the probability of the switch state of the appliance according to the separated electrical signal; The CNN module includes a cascaded three-layer CNN, a ReLU activation function, and a pooling layer enhanced network. Each layer of CNN includes a series of convolution operations for extracting time patterns, frequency information, and amplitude variation characteristics from current data. The nonlinear characteristics of the network are enhanced by the ReLU activation function and the pooling layer to reduce feature dimensions. The LSTM module is used to perform time series evolution analysis on the features extracted by the CNN module to obtain important time dynamics and key events in the current signal, wherein the important time dynamics include periodic fluctuations, peaks or drops of the current signal, and the key events include turning on or off the electrical appliance; Use knowledge distillation and model quantization methods to compress the trained perception model to obtain a lightweight model; Deploy the lightweight model to the mobile terminal to identify the status of electrical appliances in real time.
2. The non-intrusive home appliance state recognition method based on long short-term memory network according to claim 1 is characterized in that: The specific method for collecting the current value of a single appliance and constructing a training data set is: Collect the current value of a single appliance, combine the current of the single appliance according to Kirchhoff's law, and the combination of n appliances is 2 n The mixed current is used as the training data set.
3. The non-intrusive household appliance state recognition method based on long short-term memory network according to claim 2 is characterized in that: Gaussian distributed random noise is added to the training data set according to the mean and variance of the training data set. Gaussian noise is generated and added to the current signal by setting the mean and standard deviation.
4. The non-intrusive household appliance state recognition method based on long short-term memory network according to claim 1 is characterized in that: The binary cross entropy loss function is used as the loss function for training the CNN-LSTM based perception model.
5. The non-intrusive household appliance state recognition method based on long short-term memory network according to claim 1 is characterized in that: The trained perception model is compressed using knowledge distillation and model quantization methods. The specific method to obtain a lightweight model is as follows: The trained CNN-LSTM-based perception model is used as the teacher model, and the key information of the teacher model is transferred to the student model by using the knowledge distillation technology and the student model is trained. The number of CNN layers and LSTM layers of the student model is less than that of the teacher model. Convert the floating-point parameters of the trained student model into integers, and use the converted student model as a lightweight model.
6. The non-intrusive household appliance state recognition method based on long short-term memory network according to claim 1 is characterized in that: The specific method of using knowledge distillation technology to transfer the key information of the teacher model to the student model and train the student model is: The training data set of the perception model and its corresponding labels, as well as the soft target output of the perception model in the form of probability distribution of the same training data set, are input into the student model for training until the model converges.
7. The non-intrusive household appliance state recognition method based on long short-term memory network according to claim 1 is characterized in that: The appliance status results recognized in real time by the lightweight model are compared with user feedback. If they are inconsistent with the user feedback, the training set is updated through online learning, and the CNN-LSTM-based perception model is retrained.
8. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a non-intrusive household appliance status recognition method based on a long short-term memory network as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Non-invasive load identification algorithm based on hybrid neural network and ensemble learning
CN107122790A
Household appliance operation state non-intrusive detection method based on intelligent electric meter data
CN110188826A
Non-intrusive load monitoring method based on LSTM and sequence-to-point translation model
CN114723040A
Document character recognition method and electronic equipment
CN115527213A
Method and system for recognizing statuses of electric appliances
US20110121988A1
