Non-intrusive load identification method based on NAM-CapsNet
By adopting a NAM-CapsNet-based method in non-invasive load recognition, the load characteristics are weightedly extracted using NAM module and capsule neural network, the problem of low load recognition accuracy in the prior art is solved, and higher load recognition accuracy is achieved.
Patent Information
- Application Number
- CN202510356225.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-06-27
AI Technical Summary
In the prior art, the identification accuracy of non-invasive load identification is low and cannot meet the identification requirements in actual engineering.
The non-invasive load identification method based on NAM-CapsNet is adopted to draw the load V-I trajectory curve chart, color-code the image, and weighted extraction of channel information and spatial information using the NAM module and capsule neural network to achieve more effective focus and recognition of load characteristics.
It effectively improves the accuracy of non-invasive load recognition, and significantly improves the accuracy of load recognition through indicators such as recall, accuracy, F1 score and accuracy.
Smart Images

Figure CN120219920A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electric load, and particularly relates to a non-intrusive load identification method based on NAM-CapsNet. Background Art
[0002] With the increasing proportion of electric energy in terminal energy consumption year by year, how to effectively reduce residential electricity consumption has become an issue that cannot be ignored. As one of the related technologies in the power grid field, non-intrusive load identification technology can accurately monitor and identify loads, thus providing theoretical support for further research on how to save residential electricity consumption. In recent years, the most widely used method is to use the operating characteristics of the load as the identification basis and identify the load through deep learning. However, the selection of load characteristics will largely affect the accuracy of the final identification result; in addition, as the existing mainstream technology, different neural network structures will also cause differences in load identification. Existing models such as traditional convolutional neural networks and capsule neural networks only use convolutional layers to extract features from the input image, and fail to effectively focus on the channel information and spatial information of the image, resulting in the recognition model being unable to pay attention to more critical feature information, resulting in low identification accuracy, insufficient identification accuracy of non-intrusive load identification, and being unable to meet the identification requirements in actual engineering. Summary of the Invention
[0003] The purpose of the present invention is to provide a non-intrusive load identification method based on NAM-CapsNet to solve the problem of low accuracy of non-intrusive load identification in the existing technology.
[0004] The technical solution adopted by the present invention is a non-intrusive load identification method based on NAM-CapsNet, which specifically includes the following steps: Step 1, draw a load V-I trajectory curve graph; Step 2, perform color coding on the load V-I trajectory grayscale graph; Step 3, build a capsule neural network for load identification, output a heat map result, complete load identification, and at the same time select recall (Re), precision (Pre), F1 score, and accuracy (Acc) as indicators for evaluating the identification result.
[0005] The present invention is also characterized in that Step 1 is specifically: Draw a V-I trajectory curve graph for the historical voltage and current data of residential electric loads, with the voltage per cycle as the abscissa and the current per cycle as the ordinate, normalize the pixel value of each point to 0-255, and at the same time set the resolution of each picture to 47x47; Step 2 is specifically: Encode the R channel using the average active power per cycle, encode the G channel using the current change rate per cycle, and encode the B channel using the trajectory area density. Cumulate the three encoded channels to form an RGB three-channel trajectory map for recognition.
[0006] Step 3 is specifically as follows: Step 3.1: Use a 2D convolution operation to extract features from the input RGB image and generate a feature map. Step 3.2: Use the NAM module to weighted extract the channel information and spatial information of the feature map after adding it to the convolutional layer; calculate the channel weights, perform a weighted operation on the channels at the same time, and finally multiply by the input feature residual to form an enhanced feature. Step 3.3: The features output from the NAM module enter the low-level capsule layer for feature sampling, and then are aggregated into the input of the digital capsule layer through the dynamic routing mechanism. Step 3.4: The output of the digital capsule layer is used as the input of the decoder composed of three fully connected layers. The first two layers use activation functions, and the last layer uses activation functions, calculate the Euclidean distance between the output and the input image to represent the reconstruction loss, and finally output the classification result. Step 3.5: Calculate the loss function of the capsule network. The loss function of the capsule network consists of the reconstruction loss and the margin loss in Step 3.4.
[0007] The operation definition of the 2D convolution in Step 3.1 is specifically shown in formula (1): (1) In the formula, represents the th feature map in the th layer; represents the activation function, and generally function is selected; represents the convolution kernel function; represents the bias of each in the
[0008] Step 3.2 is specifically as follows: The NAM module weighted extracts the channel information and spatial information of the feature map after adding it to the convolutional layer to improve the expression ability of the feature map; the feature map output from the convolutional layer first enters the channel attention module of the NAM, calculates the channel weights by taking the absolute value of batch normalization for the feature map, performs a weighted operation on the channels at the same time, and finally multiplies by the input feature residual to form an enhanced feature; the expression of this layer is shown in formula (2): (2) In the formula, and are the standard deviations for small batches respectively; ; and are trainable transformation parameters; and the channel attention output feature is shown in Equation (3): (3) In the formula, is the feature output by the channel attention sub-module; is the weight, where ; After passing through the channel attention module, the feature map enters the spatial attention sub-module to enhance the spatial feature expression ability; at this time, batch normalization is also used to measure the importance of pixels, as shown in Equation (2). The weight of each pixel is obtained by calculating the mean of the input feature map in the channel dimension and then normalized; then weighted processing is performed, and the result is pixel-multiplied with the input feature map and combined with residual information to enhance the feature. The spatial attention output feature is expressed as: (4) In the formula, is the feature output by the spatial attention sub-module; is the scale factor; is the weight, where .
[0009] The output of the low-level capsule layer in Step 3.3 is specifically: (5) In the formula, is the input of the low-level capsule layer; is the result of multiplying the weights of capsule and capsule ; The input of the digital capsule layer is: (6) By measuring the consistency between the output of each capsule in the previous capsule layer and the prediction of capsule , the coupling coefficient is continuously iteratively updated. The expression of is: (7) In the formula, is the initial weight. After repeated iterative updates, the final predicted vector is output. and They are the logarithmic prior probabilities between capsules respectively.
[0010] Between each capsule layer, its output vector often passes through an activation function for processing, and the expression is as shown in Equation (8): (8) In the formula, represents the output of capsule ; represents the total input of capsule ; The length of reflects the probability that the type to be finally recognized exists in the input , and the longer the length, the greater the probability that the corresponding category is confirmed.
[0011] The reconstruction loss in Step 3.4 is specifically expressed as: (9) In the formula, represents the original input image; represents the image reconstructed by the capsule network.
[0012] The margin loss in Step 3.5 is specifically expressed as: (10) In the formula, is the output vector of the digital capsule ; is the Euclidean norm of the output vector , representing the probability that the category exists; and are the preset positive and negative margins, usually taking and ; is a regulation factor, mainly for regulating missing categories, generally taking for weight reduction; the loss of the entire capsule neural network is the weighted sum of the margin loss plus the reconstruction loss, and the overall loss L is specifically expressed as: (11).
[0013] Compared with the prior art, the beneficial effects of the present invention are: (1) The non-intrusive load identification method based on NAM-CapsNet provided by the present invention effectively improves the identification accuracy of non-intrusive loads. First, the historical voltage and current data of the load are extracted, and a V-I trajectory grayscale map is drawn with the voltage data per cycle as the abscissa and the current data per cycle as the ordinate. Secondly, color coding is performed on the V-I trajectory grayscale map of the load for feature enhancement. The average active power per cycle of the load is encoded in the R channel; the current change rate per cycle of the load is encoded in the G channel; the area density of the load trajectory is encoded in the B channel. At the same time, the pixel values of the three channels are normalized, and then accumulated to form a color-coded V-I trajectory color map of the load. Finally, after integrating NAM into the convolutional layer of the CapsNet network, further mining and learning of the input image channel features and spatial features are realized. Then, the network parameters of the capsule layer and the digital capsule layer are updated through the dynamic routing algorithm, and the final identification result of the load is output through three fully connected layers, so as to achieve the identification goal of accurate identification of non-intrusive loads. Description of the Drawings
[0014] Figure 1 is a schematic flowchart of the non-intrusive load identification method based on NAM-CapsNet of the present invention; Figure 2 is a V-I trajectory grayscale map of the non-intrusive load identification method based on NAM-CapsNet of the present invention. Detailed Embodiments
[0015] The technical solutions in the embodiments of the present application will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.
[0016] Embodiment 1 The present invention provides a non-intrusive load identification method based on NAM-CapsNet, as Figure 1-2 shown, which specifically includes the following steps: Step 1, draw a load V-I trajectory curve graph; Step 2, perform color coding on the load V-I trajectory grayscale map; Step 3, build a capsule neural network for load identification, output a heat map result, complete the load identification, and at the same time select the recall rate Re, precision rate Pre, F1 score, and accuracy Acc as indicators for evaluating the identification result.
[0017] Embodiment 2 On the basis of Embodiment 1, Step 1 is specifically: Step 1: Draw a load V-I trajectory curve graph.
[0018] Draw a V-I trajectory curve graph for the historical voltage and current data of residential power loads. Plot the voltage per cycle on the x-axis and the current per cycle on the y-axis. Normalize the pixel value of each point to 0 - 255, and set the size of each image to 47x47.
[0019] Example 3 Based on Example 2, Step 2 is specifically as follows: Use the average active power per cycle to encode the R channel, use the current change rate per cycle to encode the G channel, and use the trajectory area density to encode the B channel. Cumulate the encoded three channels to form an RGB three-channel trajectory graph for recognition.
[0020] Example 4 Based on Example 3, Step 3 is specifically as follows: Step 3.1: Use 2D convolution operation to extract features from the input RGB image to generate a feature map; Step 3.2: Use the NAM module to weighted extract the channel information and spatial information of the feature map after adding it to the convolutional layer; calculate the channel weights, perform a weighted operation on the channels, and finally multiply with the input feature residuals to form an enhanced feature; Step 3.3: The features output from the NAM module enter the low-level capsule layer for feature sampling, and then are aggregated into the input of the digital capsule layer through the dynamic routing mechanism; Step 3.4: The output of the digital capsule layer is used as the input of the decoder composed of three fully connected layers. The first two layers use activation functions, and the last layer uses activation functions. Calculate the Euclidean distance between the output and the input image to represent the reconstruction loss, and finally output the classification result; Step 3.5: Calculate the loss function of the capsule network. The loss function of the capsule network consists of the reconstruction loss in Step 3.4 and the margin loss.
[0021] Example 5 Based on Example 4, Step 3.1 is specifically as follows: Use 2D convolution operation to extract features from the input RGB image; the operation definition formula of the convolutional layer is shown in Equation 1: (1) In the formula, represents the th feature map in the layer; represents the activation function, and generally the denotes the convolutional kernel function; denotes the th bias of each layer.
[0022] Step 3.2: After adding the NAM (Normalized Spatial and Channel Attention) module to the convolutional layer, the channel information and spatial information of the feature map are weighted and extracted to improve the expression ability of the feature map. The feature map output by the convolutional layer first enters the channel attention module of NAM. The channel weights are calculated by taking the absolute value using Batch Normalization for the feature map, and at the same time, the channels are weighted. Finally, it is multiplied by the input feature residual to form the enhanced feature. The expression of this layer is shown in Equation (2): (2) where and are the standard deviations of the mini-batch respectively; and are trainable transformation parameters. And the output feature of the channel attention is shown in Equation (3): (3) where is the feature output by the channel attention sub-module; is the weight, where .
[0023] After passing through the channel attention sub-module, the feature map enters the spatial attention sub-module to enhance the spatial feature expression ability. At this time, Batch Normalization is also used to measure the importance of pixels, as shown in Equation (2). The weight of each pixel is obtained by calculating the mean of the input feature map in the channel dimension and normalized. Then, weighted processing is performed, and the result is pixel-multiplied with the input feature map to combine the residual information to enhance the feature. The output feature of the spatial attention is: (4) where is the feature output by the spatial attention sub-module; is the scaling factor; is the weight, where .
[0024] Step 3.3: The feature output by the NAM module enters the capsule layer for feature sampling, and then is aggregated into the input of the digital capsule layer through the dynamic routing mechanism. The output of the low-level capsule is shown in Equation (5): (5) where is the input of the low-level capsule layer; is the capsule and the capsule multiplied by their weights; the input to the digital capsule layer is: (6) By measuring the output of each capsule in the previous capsule layer and the prediction of the capsule and continuously iteratively updating the coupling coefficient The expression of is shown in Equation 4-5: (7) In the formula, is the initial weight, and after repeated iterative updates, the final predicted vector is output
[0025] Between each capsule layer, its output vector often passes through the activation function for processing, and the expression is shown in Equation 8: (8) In the formula, represents the output of the capsule ; represents the total input of the capsule ; The length of reflects the probability that the type to be finally recognized exists in the input , and the longer the length, the greater the probability that the corresponding category is confirmed
[0026] Example 6 On the basis of Example 5, Step 3.4 is specifically: The output of the digital capsule layer is used as the input to the decoder composed of three fully connected layers. The first two layers use the activation function, and the last layer uses the activation function to calculate the Euclidean distance between the output and the input image to represent the reconstruction loss, and finally output the classification result. The reconstruction loss is represented by the mean square error: (9) In the formula, represents the original input image; represents the image reconstructed by the capsule network; Step 3.5. The loss function of the capsule network is composed of the reconstruction loss in Step 3.4 and the margin loss. The formula for the margin loss is: (10) In the formula, is the digital capsule Output vector; is the output vector The Euclidean norm of, representing the probability of the existence of the category; and are preset positive and negative margins, usually taking and ; is a regulation factor, mainly for regulating missing categories, generally taking for downweighting. The loss of the entire capsule neural network is the weighted sum of the margin loss plus the reconstruction loss: (11).
[0027] Comparative Example 1 Table 1 lists the comparison between NAM-CapsNet and other existing methods. Compared with the traditional convolutional neural network (CNN), it uses vector information for information representation, which can effectively represent the spatial information of the input image; the existence of the dynamic routing mechanism makes it not cause information loss due to pooling operations, and retains the spatial relationship between features; it will not cause the loss of position information due to translational invariance; at the same time, the NAM module is introduced, which pays more attention to the key feature information in the spatial and channel dimensions, making the feature extraction for the input feature image more efficient.
[0028] Table 1 Comparison Table of Method Characteristics
[0029] In this specification, each embodiment is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other.
[0030] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A non-intrusive load identification method based on NAM-CapsNet, characterized in that: The specific steps include: Step 1, draw a load VI trajectory curve graph; Step 2, color coding the load VI trajectory grayscale image; Step 3: Build a capsule neural network for load identification, output the thermal result diagram, complete the load identification, and select the recall rate Re, precision rate Pre, F1 score and accuracy rate Acc as indicators for evaluating the identification results.
2. The non-intrusive load identification method based on NAM-CapsNet according to claim 1 is characterized in that: The step 1 is specifically as follows: A VI trajectory graph is drawn for the historical voltage and current data of residential power loads, with the voltage per cycle as the horizontal axis and the current per cycle as the vertical axis. The pixel value of each point is normalized to 0-255, and the resolution of each picture is set to 47x47.
3. The non-intrusive load identification method based on NAM-CapsNet according to claim 1 is characterized in that: The step 2 is specifically as follows: The average active power per cycle is used to encode the R channel, the current change rate per cycle is used to encode the G channel, and the trajectory area density is used to encode the B channel. The encoded three channels are accumulated to form an RGB three-channel trajectory map for identification.
4. The non-intrusive load identification method based on NAM-CapsNet according to claim 3 is characterized in that: The step 3 is specifically as follows: Step 3.1, use 2D convolution operation to extract features from the input RGB image and generate a feature map; Step 3.2, use the NAM module to perform weighted extraction of the channel information and spatial information of the feature map after adding the convolution layer; calculate the channel weight, perform weighted operation on the channel, and finally multiply it with the input feature residual to form the enhanced feature; Step 3.3, the features output by the NAM module enter the lower capsule layer for feature sampling, and then aggregated into the input of the digital capsule layer through the dynamic routing mechanism; Step 3.4: The output of the digital capsule layer is used as the input of the decoder consisting of three fully connected layers. The first two layers use Activation function, the last layer uses Activation function, calculates the Euclidean distance between the output and input graph to represent the reconstruction loss, and finally outputs the classification result; Step 3.5, calculate the loss function of the capsule network. The loss function of the capsule network is composed of the reconstruction loss and edge loss in step 3.
4.
5. The non-intrusive load identification method based on NAM-CapsNet according to claim 4 is characterized in that: The operational definition of the 2D convolution described in step 3.1 is specifically shown in formula (1): (1) In the formula, Indicates Layer feature map; Represents the activation function, which is generally selected function; Represents the convolution kernel function; Indicates Layer Each bias.
6. The non-intrusive load identification method based on NAM-CapsNet according to claim 4 is characterized in that: The step 3.2 is specifically as follows: After adding the NAM module to the convolutional layer, the channel information and spatial information of the feature map are weighted and extracted to improve the expressiveness of the feature map. The feature map output by the convolutional layer first enters the channel attention module of the NAM, and the channel weight is calculated by taking the absolute value of the batch normalization for the feature map. At the same time, the channel is weighted and finally multiplied with the input feature residual to form the enhanced feature. The expression of this layer is shown in formula (2): (2) In the formula, and Small batch The standard deviation of and is a trainable transformation parameter; and the channel attention output feature is shown in formula (3): (3) In the formula, It is the feature output by the channel attention submodule; is the weight, where ; After the channel attention module, the feature map enters the spatial attention submodule to enhance the spatial feature expression capability; At this time, batch normalization is also used to measure the importance of pixels. See formula (2). The weight of each pixel is obtained by calculating the mean of the input feature map in the channel dimension and normalizing it. Then, weighted processing is performed, and the result is pixel-wise multiplied with the input feature map to combine the residual information to enhance the feature. The spatial attention output feature is expressed as: (4) In the formula, is the feature output by the spatial attention submodule; is the scale factor; is the weight, where .
7. The non-intrusive load identification method based on NAM-CapsNet according to claim 1, characterized in that: The output of the lower capsule layer in step 3.3 is: (5) In the formula, It is the input of the lower capsule layer; For capsules and capsules The weight of multiplying; The digital capsule layer The input is: (6) By measuring each capsule in the previous capsule layer Output and capsules Prediction The consistency between the coupling coefficient Carry out continuous iterative updates, The expression is: (7) In the formula, is the initial weight, after repeated iterative updates, the final prediction vector is output , and are the logarithmic prior probabilities between capsules respectively; Between each capsule layer, its output vector is often passed through The activation function is used for processing, and the expression is shown in formula (8): (8) In the formula, Capsules Output: Capsules Total input of The length of reflects the final type to be identified in the input The longer the length, the greater the probability that the corresponding category is confirmed.
8. The non-intrusive load identification method based on NAM-CapsNet according to claim 4 is characterized in that: The reconstruction loss described in step 3.4 is specifically expressed as: (9) In the formula, represents the original input image; Represents the image reconstructed by the capsule network.
9. The non-intrusive load identification method based on NAM-CapsNet according to claim 4, characterized in that: The edge loss described in step 3.5 Specifically expressed as: (10) In the formula, It's a digital capsule The output vector of is the output vector The Euclidean norm of , which indicates the probability of the existence of a category; and is the preset positive and negative edge, usually and ; It is an adjustment factor, which is mainly used to adjust the missing category. The weight is reduced; the loss of the entire capsule neural network is the weighted sum of the edge loss and the reconstruction loss. The overall loss L is specifically expressed as: (11)。