Dictionary learning and neural network based nilm method
By using dictionary learning and neural networks, the optimal dictionary is adaptively learned and noise interference is suppressed, which solves the problems of insufficient feature extraction and noise sensitivity caused by fixed basis functions in the NILM method, and achieves higher load recognition accuracy and robustness.
Patent Information
- Application Number
- CN202511240947.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-02
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2045-09-02
AI Technical Summary
Existing NILM methods use fixed basis functions in signal decomposition, resulting in insufficient feature extraction capabilities and sensitivity to noise and sensor errors, which affects the accuracy of load identification.
By employing dictionary learning and neural network methods, and through sparse representation and multi-scale feature fusion, a one-dimensional receptive field module and a spatial feature pyramid module are constructed. The optimal dictionary is adaptively learned and noise interference is suppressed, thereby improving feature extraction capability and robustness.
It improves the accuracy of load identification and the robustness of the model, reduces the impact of noise on classification, and enhances the performance of the NILM method in complex environments.
Smart Images

Figure CN120744512B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a NILM method, more particularly to a NILM method based on dictionary learning and neural networks. BACKGROUND
[0002] The global energy structure is accelerating the transformation to low carbonization. According to the statistics of the International Energy Agency (IEA), the electricity consumption in the fields of building and industry accounts for more than 40% of global carbon emissions, and the low energy efficiency and invisible load on the user side are the key bottlenecks hindering emission reduction.
[0003] Under this background, intelligent power monitoring technology has become an important measure to achieve the goal. Traditional sub-metering (such as installing sub-meters) is high in cost and limited in coverage, and is difficult to support large-scale energy efficiency management. Non-intrusive load monitoring (NILM) analyzes the voltage and current data of the total meter, reversely decomposes the power consumption behavior of each electrical appliance, and provides a low-cost and scalable solution for fine energy management.
[0004] Non-intrusive load monitoring technology deploys an embedded system-based power feature recognition module at the user's total line end, and uses advanced load feature extraction technology to analyze the composite power signal non-contact.
[0005] Traditional signal analysis methods (such as fast Fourier transform FFT and wavelet decomposition WD) are widely used in the field of NILM, but they are essentially based on preset fixed basis functions for signal decomposition. Due to the fixedness of the basis, the application range and applicable objects of these signal processing tools are limited. This analysis framework based on prior assumptions has obvious limitations: first, the fixed basis function is difficult to adaptively match the diversified power features presented by different load characteristics; second, when processing non-stationary and nonlinear load signals, the decomposition accuracy and feature expression ability will be significantly restricted. Especially in complex power consumption scenarios, the constraint of this rigid basis will lead to incomplete load feature extraction, which will affect 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 the actual power consumption environment. It is sensitive to noise data, and voltage fluctuations and sensor measurement errors will significantly affect feature extraction, thereby affecting classification performance.
[0007] In summary, the existing NILM scheme uses a preset fixed basis function for signal decomposition when using signal analysis methods such as fast Fourier transform (FFT) and wavelet decomposition (WD), which significantly restricts the decomposition accuracy and feature expression ability. In addition, it lacks robustness when facing power grid noise and sensor errors. SUMMARY
[0008] In view of the deficiencies of the prior art, the purpose of the present application is to provide a NILM method based on dictionary learning and neural networks. To solve the problem of poor feature extraction caused by signal decomposition based on a preset fixed basis function, the present scheme first transforms the input during identification, uses a sparse representation method, and designs a set of carefully designed basis functions for the training data. The corresponding sparse coefficients are input into the neural network for feature learning and identification.
[0009] To achieve the above purpose, the present application provides the following technical scheme: a NILM method based on dictionary learning and neural networks, comprising the following steps:
[0010] Step one, construct a dictionary learning and sparse representation method;
[0011] Step two, construct a neural network model, which is composed of a one-dimensional receptive field module, a spatial feature pyramid module and a classification module. The one-dimensional receptive field module is connected through multi-scale hollow convolution and residual connection. The SAMFPN feature pyramid module is connected through a top-down and horizontal connection structure, which realizes efficient fusion of multi-scale features, and splicing operation of features of each scale through spatial attention, and adaptive optimization of the spatial dimension of the feature map;
[0012] Step three, model training is performed, and the trained model is used for non-intrusive load monitoring.
[0013] As a further improvement of the present application, the specific steps of constructing the dictionary learning and sparse representation method in step one are as follows:
[0014] Step one, collect load current and voltage data through an embedded device;
[0015] Step two, use the K-SVD algorithm to realize dictionary learning through alternating iterative optimization;
[0016] Step three, train the K-SVD algorithm to update the dictionary atom by atom to minimize the data reconstruction error;
[0017] Step four, use the mathematical optimization objective of the K-SVD algorithm as the following sub-problems, each of which updates a single variable;
[0018] Step one five, fixed dictionary, the optimal coefficient matrix is obtained by using OMP algorithm, then let fixed, according to update dictionary, so on and so forth until convergence.
[0019] As a further improvement of the application, the mathematical optimization target of the K-SVD algorithm in step one four is expressed in the following form:
[0020]
[0021] Wherein Y represents the training matrix sample; The first level of dictionary to be learned is represented by D1, The second level of dictionary to be learned is represented by D2, The function is represented by f, The sparse coding matrix is represented by X, The Frobenius norm is represented by ||.
[0022] As a further improvement of the application, the specific steps of constructing the neural network model in step two are as follows:
[0023] Step two one, 1DRFB module is constructed, and 1DRFB is used to process the features after sparse representation;
[0024] Step two two, a feature pyramid attention mechanism module is constructed, which is composed of a feature pyramid attention mechanism module S and a feature pyramid;
[0025] Step two three, a feature classification module is constructed, which is composed of three fully connected layers, and the number of neurons in the three layers is [64, 32, num_cls], wherein num_cls is the type of appliances in the training set.
[0026] As a further improvement of the application, the spatial attention mechanism module in step two two aggregates channel information to generate a spatial attention map through pooling and convolution operations, and then multiplies it with the original feature map to highlight important regions, while the FPN feature pyramid combines high-level features and low-level features to construct a multi-scale feature pyramid, so that the model can process targets of different sizes at the same time through simple horizontal connection and top-down feature fusion.
[0027] As a further improvement of the application, the model training of step three is as follows:
[0028] Step three one, first randomly extract 40% of the data in the training set for dictionary learning, and save the trained model;
[0029] Step three two, read the trained model in step three one to perform sparse representation on all data in the data set, and divide them into training set, test set and validation set according to the ratio of 7:2:1;
[0030] Step three, three modules in step two are connected in series to form a NILM classification neural network, and the loss function adopts a cross-entropy loss function, and when the loss function converges to a certain value and does not have a significant decrease, the model training is completed.
[0031] The beneficial effects of the present application are:
[0032] The present method adopts a dictionary learning method to avoid the limitation of signal decomposition based on a preset fixed basis function, and automatically learns an optimal dictionary from training data, so that the essential characteristics of data are more flexibly captured, the signal can be accurately represented by a small number of atomic linear combinations, and the storage and calculation costs are reduced.
[0033] The present method effectively reduces the interference of inevitable noise in the actual acquisition process on the NILM classification model. The 1DRFB module uses different expansion rate convolution kernels in parallel to improve the receptive field, and captures multi-scale context information within a single level. Secondly, the SAMFPN module enhances the weight of the target area, suppresses irrelevant noise, and fuses high-level information and low-level detail information, solves the problem of insufficient feature extraction capability, effectively suppresses the interference of noise on the model, and significantly improves the robustness of the model. BRIEF DESCRIPTION OF DRAWINGS
[0034] Figure 1 A flowchart of the dictionary learning and neural network based NILM method;
[0035] Figure 2 A flowchart of the sparse processing of the 1DRFB module;
[0036] Figure 3 A feature fusion flowchart of the SAMFPN feature pyramid module. DETAILED DESCRIPTION
[0037] The present application will be further described in detail below with reference to the embodiments given in the accompanying drawings.
[0038] A dictionary learning and neural network based NILM method, the overall framework is as shown in Figure 1 The main steps include:
[0039] 1) Construct a dictionary learning and sparse representation method. The K-SVD algorithm in dictionary learning is a classic optimization iterative method. K-SVD does not need to preset a fixed dictionary (such as Fourier or wavelet basis), but automatically learns an optimal dictionary from training data, so that the essential characteristics of data are more flexibly captured. By enforcing sparsity (using OMP algorithm), the signal can be accurately represented by a small number of atomic linear combinations, and the storage and calculation costs are reduced. The specific construction process is as follows:
[0040] Step1: Collecting load current voltage data through embedded device, sampling rate is 6.4KHz, each data length is 19200, using sliding window to divide data, window length is 640.
[0041] Step2: K-SVD algorithm realizes dictionary learning through alternating iterative optimization, in each iteration, first solve the sparse representation of samples based on the current dictionary, then update the dictionary atom by atom to minimize data reconstruction error. This two-stage optimization strategy gradually improves the representation ability of the dictionary, and finally makes the learned dictionary more accurately sparse fitting data features. In this paper, DCT basis is used as the initial dictionary, for signal dimension n, the atom of DCT dictionary is defined as:
[0042]
[0043] Where i=0, 1, 2`,....,n-1, is the kth atom, n=640.
[0044] Step3: Training K-SVD algorithm, updating dictionary atom by atom to minimize data reconstruction error. The mathematical optimization objective of K-SVD algorithm can be expressed in the following form:
[0045] (1)
[0046] Where Y represents the training matrix sample; represents the first level to be learned dictionary, represents the second level to be learned dictionary, function, represents the sparse coding matrix. is the Frobenius norm.
[0047] Step4: The above formula (1) is the following sub-problems, each sub-problem updates a single variable. Let:
[0048]
[0049] Then formula (1) can be expressed as
[0050]
[0051] Step5: Fixing the dictionary , using OMP algorithm to get the optimal coefficient matrix , then let fixed, update the dictionary according to , and so on until convergence.
[0052] 2) Building a neural network model. The model is mainly composed of a one-dimensional receptive field module (1DRFB), a spatial feature pyramid module and a classification module. The one-dimensional receptive field module (1DRFB) is connected by multi-scale hollow convolution and residual connection. The structure of 1DRFB is inspired by the idea of Inception. It mainly adds one-dimensional hollow convolution on the basis of Inception, thereby expanding the receptive field of the network without significantly increasing the computational burden. In addition, the short link operation preserves the original feature information while avoiding gradient disappearance. The feature pyramid attention mechanism module, through the structure of top-down and horizontal connection, realizes the efficient fusion of multi-scale features, and performs feature splicing operation on each scale of features. The weight of each feature map in the feature pyramid is calculated through global average pooling and Sigmoid layer to generate feature pyramid attention weight. The generated feature pyramid attention weight acts on the feature pyramid FPN, and the FPN feature pyramid combines high-level features and low-level features to construct a multi-scale feature pyramid, so that the model can process targets of different sizes at the same time. Through simple horizontal connection and top-down feature fusion, the feature extraction ability of the model is significantly improved. The main steps include:
[0053] Step 1: Building a 1DRFB module, which uses 1DRFB to process the features after sparse representation. In structure, 1DRFB is inspired by the idea of Inception. It mainly adds one-dimensional hollow convolution on the basis of Inception, thereby effectively increasing the receptive field. And use 1-dimensional convolution instead of the original Inception convolution layer. Set the convolution kernel size to 3, 5, 7, and the expansion rate to 1, 3, 5. Then the outputs of different convolution layers are spliced. The specific structure is shown in Figure 2
[0054] Step 2: Building a feature pyramid attention mechanism module, the specific structure is shown in Figure 3 , where represents the feature map obtained by progressively downsampling the input data with different sampling rates, each feature map has the same number of channels and different feature sizes. Then each layer of feature vector is reduced in channel number by 1*1 convolution, and the result is fused with the next layer of feature vector after dimension reduction, that is , , and so on, generate , then , , By upsampling and The attention weight is generated by a global average pooling layer and a sigmoid activation function.
[0055] Step3: Construct a feature classification module, which is composed of three fully connected layers, and the number of neurons in the three layers is [64, 32, num_cls], wherein num_cls is the type of appliances in the training set.
[0056] 3) Model training. The specific process can be as follows:
[0057] Step 1: First, randomly extract 40% of the data in the training set for dictionary learning, and save the trained model.
[0058] Step 2: Read the trained model in Step 1 to perform sparse representation on all data in the data set, and divide it into training set, test set and validation set according to 7:2:1.
[0059] Step 3: The three modules mentioned in 3) are connected in series to form a NILM classification neural network. The cross-entropy loss function is used as the loss function. When the loss function converges to a certain value and does not have a significant decrease, the model training is completed.
[0060] In summary:
[0061] The present application proposes a sparse representation method based on dictionary learning, which has the advantages of breaking through the limitations of traditional fixed base functions in signal decomposition, and instead of adaptively learning the optimal dictionary through data-driven way, so as to more accurately capture the internal characteristics and essential laws of data. And a new target optimization function is designed, so that the sparse represented data can more accurately represent the original data, improve the accuracy of data features, and further improve the accuracy of model classification.
[0062] The present application effectively improves the robustness of the model in the noise environment by innovatively using the 1DRFB module and the SAMFPN module. Specifically, the 1DRFB module realizes the effective capture of multi-scale context information within a single network level by deploying different expansion rate convolution kernels in parallel, significantly enhancing the feature extraction capability. On this basis, the SAMFPN module focuses on strengthening the feature response of the target region while suppressing noise interference through an adaptive feature weighting mechanism, and combines high-level semantic information with low-level 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 ability, but also significantly improves the classification performance of the model in actual complex noise environments.
[0063] The above merely describes the preferred embodiments of the present application, and the protection scope of the present application is not limited to the above-described embodiments. Any technical solution falling within the concept of the present application shall fall within the protection scope of the present application. It should be noted that, for ordinary skilled persons in the art, some improvements and refinements without departing from the principles of the present application shall also be considered as falling within the protection scope of the present application.
Claims
1. A dictionary learning and neural network based NILM method, characterized in that: It comprises the following steps: Step one, construct a dictionary learning and sparse representation method; Step two, build a neural network model, which is composed of a one-dimensional receptive field module, a spatial feature pyramid module, and a classification module. The one-dimensional receptive field module is connected through multi-scale hollow convolution and residual connection. The SAMFPN feature pyramid module realizes efficient fusion of multi-scale features through a structure of top-down and horizontal connection, and splices the features of each scale through spatial attention to adaptively optimize the spatial dimension of the feature map; Step three, model training, and using the trained model for non-invasive load monitoring; The specific steps of building a neural network model in step two are as follows: Step two one, build a 1DRFB module, which uses 1DRFB to process the sparse representation features; Step 22: Construct the feature pyramid attention mechanism module. This module consists of spatial attention and a feature pyramid, and employs... This represents the feature maps obtained by progressively downsampling the input data at different sampling rates. Each feature map has the same number of channels but different feature sizes. Then, the feature vectors from each layer are subjected to 1*1 convolution to reduce the dimensionality of the channel count, and the result is fused with the dimensionality-reduced feature vectors from the next layer. Obtained through 1*1 convolution. , Through upsampling and The convolution results after 1x1 convolution are fused together to generate And so on, generating Then , , Through upsampling and The fusion is performed by generating attention weights through a global flat pooling layer and a sigmoid activation function; Step two three, build a feature classification module, which is composed of three fully connected layers, and the number of neurons in the three layers is [64, 32, num_cls], where num_cls is the number of appliances in the training set.
2. The dictionary learning and neural network based NILM method according to claim 1, characterized in that: The specific steps of building a dictionary learning and sparse representation method in step one are as follows: Step one one, collect load current and voltage data through an embedded device; Step one two, use the K-SVD algorithm to realize dictionary learning through alternating iteration optimization; Step one three, train the K-SVD algorithm, and update the dictionary atom by atom to minimize the data reconstruction error; Step one four, use the mathematical optimization objective of the K-SVD algorithm as the following sub-problems, each of which updates a single variable; Step one five, fix the dictionary, use the OMP algorithm to obtain the optimal coefficient matrix, then let the fixed dictionary be updated, and so on until convergence.
3. The dictionary learning and neural network based NILM method according to claim 2, characterized in that: The mathematical optimization objective of the K-SVD algorithm in step one four is expressed in the following form: where Y represents a training matrix sample; denotes a first level dictionary to be learned, denotes a second level dictionary to be learned, a function, denotes a sparse coding matrix, is the Frobenius norm.
4. The dictionary learning and neural network based NILM method of claim 3, wherein: The spatial attention mechanism module in step two two 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 regions. The FPN feature pyramid combines high-level features and low-level features to construct a multi-scale feature pyramid, enabling the model to handle targets of different sizes simultaneously through simple horizontal connection and top-down feature fusion.
5. The dictionary learning and neural network based NILM method according to claim 1 or 2 or 3, characterized in that: The model training in step three is as follows: Step three one, first randomly extract 40% of the data in the training set for dictionary learning, and save the trained model; Step three two, read the trained model in step three one to perform sparse representation on all data in the data set, and divide them into training set, test set and validation set according to the ratio of 7:2:1; Step three three, connect the three modules in step two in series to form a NILM classification neural network, and use the cross-entropy loss function as the loss function. When the loss function converges to a certain value and does not have a significant decrease, the model training is completed.
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