NILM method based on dictionary learning and neural network
Through dictionary learning and neural network methods, the optimal dictionary is adaptively learned. Combined with the one-dimensional receptive field module and the spatial feature pyramid module, the problems of insufficient feature extraction and noise sensitivity caused by the fixed basis function in the NILM method are solved, and more efficient load identification and classification are achieved.
Patent Information
- Application Number
- CN202511240947.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-02
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-09-02
AI Technical Summary
The existing NILM method uses fixed basis functions in signal decomposition, resulting in insufficient feature extraction capability and is sensitive to noise and sensor errors, affecting the accuracy of load identification.
The dictionary learning and neural network methods are used to adaptively learn the optimal dictionary through the K-SVD algorithm. The one-dimensional receptive field module and the spatial feature pyramid module are combined for feature extraction and classification to improve the robustness and feature expression ability of the model.
The model's feature extraction capability and load identification accuracy in complex environments are improved, noise interference is reduced, and the model's robustness and classification performance are improved.
Smart Images

Figure CN120744512A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a NILM method, and more particularly to a NILM method based on dictionary learning and neural network. Background Art
[0002] The global energy structure is accelerating its transition toward a low-carbon future. According to the International Energy Agency (IEA), electricity consumption in the building and industrial sectors accounts for over 40% of global carbon emissions. Inefficient user-side energy consumption and lack of load visibility are key bottlenecks hindering emission reduction.
[0003] In this context, smart electricity monitoring technology has become a crucial step toward achieving this goal. Traditional itemized metering (such as installing sub-meters) is costly and has limited coverage, making it difficult to support large-scale energy efficiency management. Non-Intrusive Load Monitoring (NILM), on the other hand, analyzes voltage and current data from the master meter to decompose the electricity usage of individual appliances, providing a low-cost, scalable solution for refined energy management.
[0004] Non-intrusive load monitoring technology deploys an embedded system-based power feature recognition module at the user's main incoming line end and uses advanced load feature extraction technology to perform non-contact analysis of composite power signals.
[0005] Although traditional signal analysis methods (such as fast Fourier transform (FFT) and wavelet decomposition (WD)) are widely used in the NILM field, they are essentially based on preset fixed basis functions for signal decomposition. Due to the fixed nature of the basis, the application scope and applicable objects of these signal processing tools are subject to certain restrictions. This analysis framework based on a priori assumptions has obvious limitations: first, fixed basis functions are difficult to adaptively match the diverse power characteristics presented by different load characteristics; second, when processing non-stationary and nonlinear load signals, its decomposition accuracy and feature expression capabilities will be significantly restricted. Especially in complex power consumption scenarios, the constraints of this rigid basis will lead to incomplete load feature extraction, which in turn affects the accuracy of subsequent load identification. This limitation has become a key bottleneck restricting the performance improvement of traditional methods in actual NILM applications.
[0006] Secondly, the existing NILM method shows obvious limitations in dealing with complex changes in actual power consumption environments. It is sensitive to noisy data, and voltage fluctuations and sensor measurement errors can significantly affect feature extraction, thereby affecting classification performance.
[0007] In summary, existing NILM solutions employ signal analysis methods (such as fast Fourier transform (FFT) and wavelet decomposition (WD)) based on preset fixed basis functions for signal decomposition, significantly limiting their decomposition accuracy and feature expression capabilities. Furthermore, they lack robustness against grid noise and sensor errors. Summary of the Invention
[0008] In view of the shortcomings of the existing technology, the purpose of the present invention is to provide an NILM method based on dictionary learning and neural network. In order to solve the problem of poor feature extraction ability caused by signal decomposition based on preset fixed basis functions, this scheme first transforms the input during recognition, adopts a sparse representation method, designs a set of carefully designed basis functions for training data, and inputs the corresponding sparse coefficients into the neural network for feature learning and recognition.
[0009] To achieve the above object, the present invention provides the following technical solution: a method based on dictionary learning and neural network (NILM), comprising the following steps: Step 1: Construct dictionary learning and sparse representation methods; Step 2: Construct a neural network model. The model consists of a one-dimensional receptive field module, a spatial feature pyramid module, and a classification module. The one-dimensional receptive field module uses multi-scale dilated convolution and residual connection, and the SAMFPN feature pyramid module uses a top-down and horizontal connection structure to achieve efficient fusion of multi-scale features. It also splices features of each scale through spatial attention and adaptively optimizes the spatial dimension of the feature map. Step three: perform model training and use the trained model for non-intrusive load monitoring.
[0010] As a further improvement of the present invention, the specific steps of constructing the dictionary learning and sparse representation method in step 1 are as follows: Step 11: Collect load current and voltage data through an embedded device; Step 1 and 2: Use K-SVD algorithm to achieve dictionary learning through alternating iterative optimization; Step 13: train the K-SVD algorithm and update the dictionary atom by atom to minimize the data reconstruction error; In step 14, the mathematical optimization objective of the K-SVD algorithm is formulated as the following subproblems, each of which updates a single variable; Step 15: Fix the dictionary and use the OMP algorithm to obtain the optimal coefficient matrix, then fix it and update the dictionary according to , and repeat this cycle until convergence.
[0011] As a further improvement of the present invention, the mathematical optimization objective of the K-SVD algorithm in step 14 is expressed as follows: Where Y represents the training matrix sample; Indicates the first-level dictionary to be learned, Indicates the second-level dictionary to be learned, function, represents the sparse coding matrix, is the Frobenius norm.
[0012] As a further improvement of the present invention, the specific steps of constructing the neural network model in step 2 are as follows: Step 21: construct a 1DRFB module and use 1DRFB to process the features after sparse representation; Step 22: Construct a feature pyramid attention mechanism module, which consists of a feature pyramid attention mechanism module S and a feature pyramid; Step 2 and 3: Construct a feature classification module. The feature classification module consists of three fully connected layers with the number of neurons in the three layers being [64, 32, num_cls], where num_cls is the type of electrical appliances in the training set.
[0013] As a further improvement of the present invention, the spatial attention mechanism module in step 22 aggregates channel information through pooling and convolution operations to generate a spatial attention map, and then multiplies it with the original feature map to highlight important areas. The FPN feature pyramid combines high-level features and low-level features to construct a multi-scale feature pyramid, so that the model can simultaneously process targets of different sizes through simple lateral connections and top-down feature fusion.
[0014] As a further improvement of the present invention, the model training in step 3 is specifically as follows: Step 3.1: First, randomly extract 40% of the data in the training set for dictionary learning and save the trained model; Step 32: Read the model trained in step 31 to perform sparse representation on all data in the dataset, and divide it into training set, test set, and validation set according to the ratio of 7:2:1; Step 3: Connect the three modules in step 2 in series to form the NILM classification neural network. The loss function uses the cross entropy loss function. When the loss function converges to a certain value and no longer decreases significantly, the model training ends.
[0015] Beneficial effects of the present invention: This method uses dictionary learning to avoid the limitations of signal decomposition based on preset fixed basis functions. Instead, it automatically learns the optimal dictionary through training data, thereby more flexibly capturing the essential characteristics of the data, and can accurately represent the signal with a small number of atomic linear combinations, reducing storage and computing costs.
[0016] This method effectively reduces the interference of noise, which is inevitable during the actual acquisition process, on the NILM classification model. The 1DRFB module uses convolution kernels with different dilation rates in parallel to increase the receptive field, capturing multi-scale contextual information within a single layer. Secondly, the SAMFPN module enhances the weight of the target area, suppresses irrelevant noise, and fuses high-level information with low-level detail information, addressing the problem of insufficient feature extraction capabilities. This effectively suppresses noise interference on the model, significantly improving its robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 Flowchart of the NILM method based on dictionary learning and neural network; Figure 2 Schematic diagram of the sparse processing process for the 1DRFB module; Figure 3 Schematic diagram of the feature fusion process of the SAMFPN feature pyramid module. DETAILED DESCRIPTION
[0018] The present invention will be further described below with reference to the embodiments shown in the accompanying drawings.
[0019] A method based on dictionary learning and neural network NILM, the overall framework is as follows Figure 1 As shown, it mainly includes the following steps: 1) Develop dictionary learning and sparse representation methods. The K-SVD algorithm in dictionary learning is a classic iterative optimization method. K-SVD does not require a fixed dictionary (such as a Fourier or wavelet basis). Instead, it automatically learns the optimal dictionary from training data, allowing for more flexible capture of the data's essential characteristics. By enforcing sparsity (using algorithms such as OMP), it can accurately represent signals using a small number of linear combinations of atoms, reducing storage and computational costs. The specific construction process is as follows: Step 1: Collect load current and voltage data through the embedded device with a sampling rate of 6.4 kHz and a data length of 19200. Use a sliding window to divide the data with a window length of 640.
[0020] Step 2: The K-SVD algorithm implements dictionary learning through alternating iterative optimization. In each iteration, the sparse representation of the sample is first solved based on the current dictionary, and then the dictionary is updated atom by atom to minimize the data reconstruction error. This two-stage optimization strategy gradually improves the representation ability of the dictionary, and ultimately enables the learned dictionary to more accurately sparsely fit the data features. This paper uses the DCT basis as the initial dictionary. For the signal dimension n, the DCT dictionary The atoms are defined as: Where i=0, 1, 2`,...., n-1, is the kth atom, n=640. Step 3: Train the K-SVD algorithm and update the dictionary atom by atom to minimize the data reconstruction error. The mathematical optimization objective of the K-SVD algorithm can be expressed as follows: (1) Where Y represents the training matrix sample; Indicates the first-level dictionary to be learned, Indicates the second-level dictionary to be learned, function, represents the sparse coding matrix. is the Frobenius norm.
[0021] Step 4: Transform the above formula (1) into the following sub-problems, each of which updates a single variable. Let: Then formula (1) can be expressed as Step 5: Fix the dictionary , using the OMP algorithm to obtain the optimal coefficient matrix , then let Fixed, according to Update dictionary , and repeat this cycle until convergence.
[0022] 2) Construct a neural network model. This model primarily consists of a one-dimensional receptive field module (1DRFB), a spatial feature pyramid module, and a classification module. The one-dimensional receptive field module (1DRFB) utilizes multi-scale dilated convolutions and residual connections. Its structure draws on the ideas of Inception, primarily by adding one-dimensional dilated convolutions to Inception. This expands the network's receptive field without significantly increasing the computational burden. Furthermore, the short-link operation preserves the original feature information while preventing gradient vanishing. The feature pyramid attention mechanism module achieves efficient fusion of multi-scale features through a top-down and lateral connection structure. It concatenates features at each scale and calculates the weights of each feature map in the feature pyramid through global average pooling and sigmoid layers. This generates feature pyramid attention weights, which are then applied to the feature pyramid FPN. The FPN feature pyramid combines high- and low-level features to construct a multi-scale feature pyramid, enabling the model to simultaneously process objects of different sizes. Through simple lateral connections and top-down feature fusion, the model's feature extraction capabilities are significantly improved. The following steps are primarily involved: Step 1: Construct the 1DRFB module and use 1DRFB to process the features after sparse representation. In terms of structure, 1DRFB draws on the idea of Inception. It mainly adds one-dimensional hole convolution on the basis of Inception, thereby effectively increasing the receptive field. And use one-dimensional convolution to replace the original convolution layer of Inception. Set the convolution kernel size to 3, 5, and 7 and the expansion rate to 1, 3, and 5. Then, the output of different convolution layers is spliced. The specific structure is as follows Figure 2 shown Step 2: Construct a feature pyramid attention mechanism module. The specific structure is as follows Figure 3 As shown, It represents the feature maps obtained by downsampling the input data at different sampling rates. Each feature map has the same number of channels and different feature sizes. Then, the feature vector of each layer is reduced in dimension by 1*1 convolution and fused with the result of the feature vector of the next layer after dimensionality reduction. Obtained through 1*1 convolution , By upsampling and The convolution results are fused and generated by 1*1 convolution , and so on, generating , and then , , By upsampling and Fusion is performed and attention weights are generated through a global average pooling layer and a Sigmoid activation function.
[0023] Step 3: Construct a feature classification module. The feature classification module consists of three fully connected layers with the number of neurons in the three layers being [64, 32, num_cls], where num_cls is the type of electrical appliances in the training set.
[0024] 3) Model training. The specific process can be as follows: Step 1: First, randomly extract 40% of the data in the training set for dictionary learning and save the trained model.
[0025] Step 2: Read the model trained in Step 1 to perform sparse representation on all the data in the dataset, and divide it into training set, test set, and validation set according to the ratio of 7:2:1.
[0026] Step 3: The three modules mentioned in step 3 are connected in series to form the NILM classification neural network. The cross-entropy loss function is used as the loss function. Model training ends when the loss function converges to a certain value and no longer decreases significantly.
[0027] In summary: This paper proposes a sparse representation method based on dictionary learning. This method overcomes the limitations of traditional fixed basis functions in signal decomposition and instead adaptively learns an optimal dictionary through a data-driven approach, enabling more accurate capture of the data's inherent characteristics and essential laws. A new target optimization function is designed, enabling the sparsely represented data to more accurately represent the original data, improving the accuracy of data features and, consequently, the accuracy of model classification.
[0028] The present invention effectively improves the robustness of the model in noisy environments by innovatively adopting the 1DRFB module and the SAMFPN module. Specifically, the 1DRFB module achieves effective capture of multi-scale contextual information within a single network layer by deploying convolution kernels with different expansion rates in parallel, significantly enhancing the feature extraction capability. On this basis, the SAMFPN module uses an adaptive feature weighting mechanism to focus on strengthening the feature response of the target area while suppressing noise interference, and organically combines high-level semantic information with underlying detail features through a multi-level feature fusion strategy. This dual optimization mechanism not only effectively overcomes the shortcomings of traditional methods in noise sensitivity and feature expression capabilities, but also significantly improves the classification performance of the model in actual complex noise environments.
[0029] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiment. All technical solutions based on the concept of the present invention are within the scope of protection of the present invention. It should be noted that for those skilled in the art, various improvements and modifications that do not depart from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A method based on dictionary learning and neural network (NILM), characterized by: The steps include: Step 1: Construct dictionary learning and sparse representation methods; Step 2: Construct a neural network model. The model consists of a one-dimensional receptive field module, a feature pyramid attention mechanism module, and a classification module. The one-dimensional receptive field module uses multi-scale dilated convolution and residual connection, and the SAMFPN feature pyramid attention mechanism module uses a top-down and horizontal connection structure to achieve efficient fusion of multi-scale features. It also splices features of each scale through spatial attention and adaptively optimizes the spatial dimension of the feature map. Step three: perform model training and use the trained model for non-intrusive load monitoring.
2. The method based on dictionary learning and neural network (NILM) according to claim 1, characterized in that: The specific steps of constructing the dictionary learning and sparse representation method in step 1 are as follows: Step 11: Collect load current and voltage data through an embedded device; Step 1 and 2: Use K-SVD algorithm to achieve dictionary learning through alternating iterative optimization; Step 13: train the K-SVD algorithm and update the dictionary atom by atom to minimize the data reconstruction error; In step 14, the mathematical optimization objective of the K-SVD algorithm is formulated as the following subproblems, each of which updates a single variable; Step 15: Fix the dictionary and use the OMP algorithm to obtain the optimal coefficient matrix, then fix it and update the dictionary according to , and repeat this cycle until convergence.
3. The method based on dictionary learning and neural network (NILM) according to claim 2, characterized in that: The mathematical optimization objective of the K-SVD algorithm in step 14 is expressed as follows: Where Y represents the training matrix sample; Indicates the first-level dictionary to be learned, Indicates the second-level dictionary to be learned, function, represents the sparse coding matrix, is the Frobenius norm.
4. The method based on dictionary learning and neural network (NILM) according to claim 1, 2 or 3, characterized in that: The specific steps of constructing the neural network model in step 2 are as follows: Step 21: construct a 1DRFB module and use 1DRFB to process the features after sparse representation; Step 22: Build a feature pyramid attention mechanism module, which consists of spatial attention and feature pyramid; Step 2 and 3: Construct a feature classification module. The feature classification module consists of three fully connected layers with the number of neurons in the three layers being [64, 32, num_cls], where num_cls is the type of electrical appliances in the training set.
5. The method based on dictionary learning and neural network (NILM) according to claim 4, characterized in that: The spatial attention mechanism module in step 22 aggregates channel information through pooling and convolution operations to generate a spatial attention map, which is then multiplied with the original feature map to highlight important areas. The FPN feature pyramid combines high-level features and low-level features to construct a multi-scale feature pyramid, enabling the model to simultaneously process targets of different sizes through simple lateral connections and top-down feature fusion.
6. The method based on dictionary learning and neural network (NILM) according to claim 1, 2 or 3, characterized in that: The model training of step 3 is specifically as follows: Step 3.1: First, randomly extract 40% of the data in the training set for dictionary learning and save the trained model; Step 32: Read the model trained in step 31 to perform sparse representation on all data in the dataset, and divide it into training set, test set, and validation set according to the ratio of 7:2:1; Step 3: Connect the three modules in step 2 in series to form the NILM classification neural network. The loss function uses the cross entropy loss function. When the loss function converges to a certain value and no longer decreases significantly, the model training ends.
Citation Information
Patent Citations
A lightweight object detection method based on multiple receptive fields and attention feature pyramids
CN114937151A
Non-intrusive load monitoring data online compressed sensing method based on cloud edge collaboration
CN116859140A
Equipment signal compressed sensing method based on dictionary learning and convolutional neural network
CN117526962A