A two-stage non-intrusive load detection method for unknown aliasing scenarios
Through a two-stage non-intrusive load detection method, a lightweight general denoising and robust recognition model is constructed by utilizing a combination of feature masking and non-local residual shrinkage modules. This solves the problem of waveform distortion in unknown aliasing scenarios and achieves highly accurate and robust load recognition, which is suitable for edge deployment.
Patent Information
- Application Number
- CN202411199440.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-08-29
AI Technical Summary
Existing non-invasive load monitoring technologies are difficult to effectively reduce the noise of distorted waveforms in unknown aliasing scenarios, resulting in a decrease in recognition accuracy. In addition, existing methods are not robust enough in processing aliasing scenarios, making them difficult to promote and apply on a large scale.
A two-stage non-intrusive load detection method is adopted. First, a lightweight universal denoising model is constructed through feature masking to denoise the target electrical appliance waveform. Then, a robust recognition model is constructed through the non-local residual shrinkage module. The universal denoising model and the robust recognition model are trained separately using the enhanced training set. The mean square error and cross entropy loss functions are used for training. Finally, two-stage robust recognition is performed in the testing phase.
It maintains high recognition accuracy in unknown aliasing scenarios, improves the robustness of the model, is suitable for edge deployment, can effectively solve the problem of decreased recognition accuracy in unknown aliasing scenarios, and is applicable to different load identification methods, with practical application value.
Smart Images

Figure CN119202938B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of non-intrusive universal load detection, and in particular to a two-stage non-intrusive load detection method for unknown aliasing scenarios. Background Art
[0002] Smart grids, by integrating advanced measurement, communication, and control technologies, provide innovative solutions for improving load-side electricity efficiency and reliability. In recent years, non-intrusive load monitoring (NILM) technology has become a key bridge connecting smart grids and the user side, and its importance in user-side intelligent sensing is increasing. NILM technology has been applied in various fields, such as energy management and electrical accident prevention. Despite certain progress in NILM technology, existing event-based load monitoring methods often ignore the impact of factors such as voltage fluctuations, line losses, and changes in load impedance characteristics during waveform extraction. This neglect can lead to diverse and unpredictable distortions in the extracted waveforms, significantly reducing the performance of load identification models. This is particularly true in unknown aliasing scenarios, where model performance is particularly poor. Therefore, improving model robustness in unknown aliasing scenarios has become a key challenge for the large-scale promotion and application of non-intrusive load identification technology.
[0003] Currently, research on event-based load identification primarily focuses on the development of event detection and identification algorithms. Event detection research aims to more accurately capture event mutation points, while identification algorithm research focuses on improving the algorithm's identification accuracy. However, most existing studies rely solely on relatively clean single-unit datasets, which can lead to overly optimistic estimates of load identification results. These single-unit datasets are typically waveform samples collected from a single appliance operating independently. Although some studies have considered sampling noise in the original waveforms and implemented simple measures such as Gaussian sequence convolution, mean filters, high-intensity encoding, and model parameter adjustments to mitigate noise interference, these methods often lack robustness when dealing with decomposed waveforms in aliasing scenarios. In practical applications, researchers are often unable to pre-collect decomposed distorted waveforms for all possible aliasing scenarios, which violates the independent and identically distributed assumption of data in machine learning and can significantly reduce identification accuracy. Therefore, studying how to effectively reduce noise in distorted waveforms and enhance the robustness of identification models in unknown aliasing scenarios is crucial for the large-scale promotion and application of non-intrusive load monitoring technology. Summary of the Invention
[0004] The purpose of the present invention is to overcome the shortcomings and deficiencies of the existing technology and propose a two-stage non-intrusive load detection method for unknown aliasing scenarios. It can maintain a high recognition accuracy of the target electrical appliance in unknown aliasing scenarios and improve the robust performance of different methods in unknown aliasing scenarios. Its lightweight design makes it suitable for edge deployment.
[0005] To achieve the above objectives, the present invention provides a technical solution: a two-stage non-intrusive load detection method for unknown aliasing scenarios, comprising the following steps:
[0006] Step 1: A lightweight universal denoising model is constructed based on feature masking to denoise the waveforms of target appliances in unknown aliasing scenarios, obtaining more recognizable waveforms. A lightweight robust recognition model is constructed based on the non-local residual shrinkage module to extract key features of the denoised waveforms of target appliances for robust recognition. Voltage and current data for each appliance in the target scenario are obtained to establish a single dataset.
[0007] Step 2: Construct a perturbation dataset by adding random noise interference of a specified signal-to-noise ratio to the single dataset obtained in step 1, and merge the single dataset and the perturbation dataset into an enhanced training set;
[0008] Step 3: Use the enhanced training set constructed in step 2 to train the general denoising model and robust recognition model constructed in step 1 respectively. The general denoising model is trained using the mean square error loss function, and the robust recognition model is trained using the cross entropy loss function.
[0009] Step 4: In the testing phase, the model trained in step 3 is used to perform two-stage robust recognition on the aliasing decomposition waveform of the target appliance in the unknown aliasing scenario. In the first stage, the waveform is denoised using the trained general denoising module. In the second stage, the trained robust recognition model is used to identify key features of the aliasing decomposition waveform of the target appliance after denoising to obtain the predicted label of the target appliance.
[0010] Furthermore, in step 1, the general noise reduction model includes an encoder, a feature masking module, a decoder and a gain module, and the details are as follows:
[0011] a. The encoder consists of a one-dimensional convolution and a ReLU activation function, which is used to map the input waveform features to a high-dimensional feature space. The encoder input is the current waveform of a single cycle of the appliance. Before input, the current cycle needs to be normalized based on the variance and mean of each current cycle as follows:
[0012]
[0013] Where xi represents the current at the i-th current sampling point; N is the total number of sampling points of the current cycle; μ is the mean current of one cycle; v is the standard deviation of the cycle; x i ′ is the current sampling point after standardization;
[0014] b. The feature masking module first performs component analysis on the high-dimensional features of the above encoder through the non-local residual shrinkage module. The non-local residual shrinkage module includes a residual network, soft thresholding, and an adaptive threshold network. The details are as follows:
[0015] b1. Residual network: It consists of two identical one-dimensional convolutions and cross-layer identity paths. Batch normalization is used between each one-dimensional convolution to speed up training and prevent the model from overfitting.
[0016] b2. Soft thresholding: First, a positive threshold τ needs to be set. Then, the soft threshold function sets the load features whose absolute values are lower than the positive threshold τ to zero, and the load features whose absolute values are greater than the positive threshold τ also shrink towards zero, thereby achieving the distinction between different component features. The relationship between its input x and output y is shown in the following formula:
[0017]
[0018]
[0019] b3. Adaptive Threshold Network: The input of this network is the output feature vector of the second one-dimensional convolution in the above residual network. First, the spatial attention module calculates the feature vector s(n) with spatial attention characteristics. The calculation process is shown in the following formula, where n represents the input feature vector of dimension C×L in the real number domain R, where C is the number of channels and L is the length of each cycle; the spatial attention module further extracts features through one-dimensional convolution and compresses them in the channel dimension to generate a one-dimensional feature vector of length L. The one-dimensional feature vector is then formed into an attention vector through the Softmax function to strengthen the correlation between positions. The attention vector is multiplied by the output of the one-dimensional convolution to provide input for the channel attention mechanism and optimize the effectiveness of the threshold evaluation;
[0020] s(n)=Softmax(GAP(Transpose(Conv(n))))×Conv(n), n∈R C×L
[0021] In the formula, Transpose represents the transposition operation of the vector; GAP represents global average pooling; Conv represents a one-dimensional convolution that performs absolute value processing and global average pooling on the feature channels of the output s(n) of the spatial attention module through the channel attention mechanism to form an attention vector s'(n) with channel attention characteristics. The dimension of this vector is C×1; then, adaptive threshold learning is performed through two linear layers. The two linear layers are first batch normalized and then activated by the ReLu function; then a set of coefficients n between 0 and 1 are generated for each channel through the Softmax activation function. c ; Finally, using the above obtained s(n) and n c , the threshold τ for each channel used for soft thresholding c It can be obtained by the following formula:
[0022] τ c =|s(n)|×n c
[0023] Where |s(n)| represents the absolute value of the output vector s(n) of the spatial attention. After completing the threshold calculation, the feature vector output by the second one-dimensional convolution in the residual network is soft-thresholded according to the channel to obtain the processed feature vector, which is added to the input vector mapped by the identity mapping path in the residual network to obtain the output vector x of the non-local residual contraction module. t ;
[0024] Subsequently, the output of the non-local residual shrinkage module is passed through a gating unit to obtain a characteristic masking vector of the current waveform; wherein the gating unit is designed as follows:
[0025] y t =ReLu(tanh(x t )⊙σ(x t ))
[0026] Where ⊙ represents element-wise multiplication; y t represents the masking vector output by the gate unit, and σ represents the Sigmoid activation function. The feature masking vector is then multiplied element-wise by the high-dimensional features output by the encoder to extract the noise feature component.
[0027] c. The decoder reconstructs the noise waveform of the noise feature component output by the feature masking module through one-dimensional convolution, and subtracts the noise waveform from the input current waveform to extract the clean waveform;
[0028] d. The gain module reconstructs the global information of the extracted clean waveform through left and right branch linear layers. The right branch linear layer is a 1×1 linear layer that uses global average pooling to obtain the overall amplitude information of the waveform. It then calculates the overall amplitude gain of the waveform and multiplies this gain by the output of the left branch linear layer to reduce the overall amplitude error of the waveform. The left branch linear layer is a 150×150 linear layer.
[0029] Furthermore, in step 1, the input of the robust recognition model is a single current cycle, and the length of each cycle is L. The robust recognition model first extracts the high-dimensional features of the current cycle through a one-dimensional convolution, and then extracts the key features by stacking three non-local residual shrinkage modules with the same structure. The relationship between these three non-local residual shrinkage modules is a series relationship. Finally, two series-connected linear layers are used to construct a classification module. Nonlinearity is introduced in the middle of the two series-connected linear layers through the ReLu activation function, and the output dimension of the last linear layer is the number of electrical types M.
[0030] Furthermore, in step 1, the current and voltage data of each electrical appliance in the target scene are collected individually, with a sampling frequency of f, and the sampled data are annotated with artificial electrical labels. To establish a single dataset, the above sampled data are uniformly resampled to the specified sampling frequency f. s , the resampling method is Lagrange polynomial interpolation method, and its calculation process is as follows:
[0031] First, construct the interpolation polynomial P(e) using the Lagrange basis polynomial:
[0032]
[0033] Where, L u (e) is the u-th Lagrange basis polynomial; e represents the position of the interpolation sampling point of the current cycle; y u The corresponding value is the current sampling value at the u-th position; l is the number of sampling points of the current cycle to be resampled;
[0034] Resampling: Calculate the value of the interpolation polynomial at the new sampling point and resample the data to the specified current sampling length L;
[0035] Through the above resampling processing of the sampled data, the current cycles of different electrical appliances with the same number of sampling points when running independently can be obtained, and the resampled cycles of each appliance are merged to establish a single data set.
[0036] Furthermore, in step 2, the perturbation data set is constructed by adding two types of random noise to the current cycle: Gaussian noise and random walk noise. The specific calculation process of the perturbation data set is as follows:
[0037] Signal-to-noise ratio: refers to the logarithm of the ratio of signal power to noise power, as shown in the following formula:
[0038]
[0039] Where, P signal and P noise Represents signal power and noise power respectively; SNR dB is the signal-to-noise ratio of the signal; the bus data obtained by the smart meter is discrete, and the power of the signal can be directly calculated. Here, a current signal of one cycle is assumed to be I = {i1′, i2′, …, i L ′},i L ' represents the Lth current sampling point, then the current signal power P of one cycle can be calculated signal for:
[0040]
[0041] Where i k It represents the current value of the kth sampling point in I. The signal power here is not the same as the active power of traditional electrical appliances. After obtaining the current signal power, the noise signal power P can be calculated by the following formula: noise :
[0042]
[0043] In the formula, SNR is the specified signal-to-noise ratio, that is, the signal-to-noise ratio of the sample after adding noise is SNR; after obtaining the signal power of the noise, it is necessary to generate a random noise sequence with the signal power; among the two noise sequences used, Gaussian noise is a white noise that obeys the normal distribution. In the one-dimensional state, the probability density function of the Gaussian normal distribution is:
[0044]
[0045] Where P(r) represents the value of 2 Under this condition, the random variable r takes the probability density function of r; assuming that the generated random Gaussian noise sequence is I N_noise , then the random Gaussian noise sequence I′ with a specified noise signal power can be calculated by the following formula N_noise :
[0046]
[0047] For a time series {g t}, if the following conditions are met, the time series is a random walk;
[0048] g t =wt +w t-1 +...w0
[0049] Where w t and w t-1 are the tth and t-1th white noise sequences respectively; w0 is the 0th white noise sequence; for the random walk sequence g t , which is equal to the sum of multiple white noises, that is, random walk is the accumulation of white noise, from which we can get the steps to generate a random walk sequence. Given a random initial value g0, each subsequent value g in the random walk sequence t It can be calculated by the following formula:
[0050] g t =g t-1 +w t
[0051] Where g t-1 is the random walk sequence of the t-1th time step; similarly, assuming that the generated random walk noise sequence is I W_noise , then the random walk noise sequence I′ with a specified noise signal power can be calculated by the following formula W_noise :
[0052]
[0053] At this point, two random noise sequences with specified noise signal power have been generated. By superimposing the generated random noise sequences on the original monomer waveform, we can obtain the noisy data after data enhancement. From this, we can construct the perturbation data set as follows:
[0054]
[0055] Where, I noise Represents the constructed perturbation dataset.
[0056] Furthermore, in step 3, the general denoising model is trained using the mean square error loss function MSE, which is defined as follows:
[0057]
[0058] Where D is the number of samples; j d is the true value of the d-th sample; is the true value of the d-th sample;
[0059] The robust recognition model is trained using the cross-entropy loss function, which is defined as follows:
[0060]
[0061] Where, M is the number of electrical appliances; j d,h is the true label of the d-th sample for the h-th category of electrical appliances; is the predicted probability of the dth sample for the hth type of electrical appliance.
[0062] Furthermore, in step 4, the aliasing scenario refers to a complex power usage environment in which multiple appliances are running simultaneously. In an unknown aliasing scenario, the newly switched appliance is called the target appliance, and the appliances running on the bus other than the target appliance are called background appliances.
[0063] In the identification stage, the aliased decomposition current of the target appliance, i.e., its branch current, is first obtained by subtracting the bus current before and after the switching event. The aliased decomposition current can be obtained by the following formula:
[0064]
[0065] Where, I Y is the aliasing decomposition current; I s ' um is the total current after the switching event occurs; I sum is the total current before the switching event occurs; after obtaining the aliasing decomposition current of the target appliance in the unknown aliasing scenario, it is first input into the general noise reduction model to obtain the noise-reduced current waveform, and then the noise-reduced current waveform is input into the robust recognition model to identify the appliance type, thereby obtaining the predicted label of the target appliance.
[0066] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0067] To address the problem of aliased decomposition waveform distortion in unknown aliasing scenarios, this paper proposes a robust recognition model designed to improve its robustness by enhancing the model's ability to identify key features of distorted waveforms. Furthermore, we employ a perturbed dataset and a universal denoising model to further enhance the model's robustness, thereby constructing a two-stage robust load identification method. Specifically, we train the universal denoising model and the robust recognition model separately using a perturbed dataset. During testing, the test data is first passed through the universal denoising model and then input into the robust recognition model for identification. The proposed method does not require training on the distorted waveforms of the target scenario; it only requires the original waveform to achieve robust recognition in the target scenario. This effectively addresses the problem of existing methods experiencing reduced accuracy when faced with aliased decomposition waveform distortion in unknown aliasing scenarios. Furthermore, the proposed universal denoising model is effective for different aliasing scenarios and different load identification methods, and can be used as a pre-denoising model for other methods. Furthermore, all models in this paper employ a lightweight design, making them more suitable for high-frequency recognition edge deployment in NILM. In summary, the present invention provides a new solution to the problem of performance degradation of event-based high-frequency load identification in unknown aliasing scenarios, has practical application value, and is worthy of promotion. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 Flowchart of the method of the present invention.
[0069] Figure 2 This is the structural diagram of the general noise reduction model.
[0070] Figure 3 This is the structural diagram of the non-local residual shrinkage module.
[0071] Figure 4 This is the structural diagram of the robust recognition model. DETAILED DESCRIPTION
[0072] The present invention will be described in further detail below with reference to the embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0073] Example 1
[0074] This embodiment discloses a two-stage non-intrusive load detection method for unknown aliasing scenarios, such as Figure 1 As shown, the following steps are included:
[0075] Step 1: Construct a lightweight universal noise reduction model based on feature masking. The encoder feature masking module is used to reduce the noise of the target appliance waveform in the unknown aliasing scene to obtain a more recognizable target appliance waveform. Construct a lightweight robust recognition model based on the non-local residual shrinkage module to extract the key features of the target appliance waveform after noise reduction for robust recognition. Obtain the voltage and current data of each appliance in the target scene running separately to establish a single dataset.
[0076] like Figure 2 As shown in Figure 1, the general noise reduction model consists of four parts: encoder, feature masking module, decoder, and gain module. The different parts are described in detail below.
[0077] The encoder consists of a one-dimensional convolution with parameters (1, 16, 3, 1, 1) and a ReLU activation function, which maps the input waveform features to a high-dimensional feature space. The five parameters represent (number of input channels, number of output channels, convolution kernel size, stride, and padding). The encoder input is a single cycle of the electrical current waveform. Before input, each current cycle is normalized based on its variance and mean.
[0078]
[0079] Among them, x i represents the current at the i-th current sampling point; N is the total number of sampling points of the current cycle; μ is the mean current of one cycle; v is the standard deviation of the cycle; x i ′ is the current sampling point after standardization
[0080] The feature masking module first performs component analysis on the above high-dimensional features through the non-local residual shrinkage module. Figure 3 As shown in the figure, the non-local residual shrinkage module consists of three parts: residual network, soft thresholding, and adaptive threshold network.
[0081] Residual Network: This network consists of two identical one-dimensional convolutions with cross-layer identity paths. The parameters of the two one-dimensional convolutions are (16, 16, 3, 1, 1). Batch normalization (BN) is used between each one-dimensional convolution to speed up training and prevent overfitting.
[0082] Soft thresholding: First, a positive threshold τ is set. The soft threshold function then sets load features with absolute values below this positive threshold τ to zero, while load features with absolute values above this positive threshold τ are also contracted towards zero. This allows for the differentiation of different component features. The relationship between the input x and output y is shown in the following equation:
[0083]
[0084] Adaptive Threshold Network: The input to this network is the output feature vector of the second one-dimensional convolution in the residual network described above. First, a feature vector s(n) with spatial attention characteristics is calculated using the spatial attention module. The calculation process is shown in the following formula, where n represents the input feature vector of dimension C×L in the real number domain R. C is the number of channels, 16. The spatial attention module further extracts features through one-dimensional convolution and compresses them in the channel dimension to generate a one-dimensional feature vector of length L of 150. This one-dimensional feature vector is then passed through the Softmax function to form an attention vector, which strengthens the correlation between positions. This attention vector is multiplied by the output of the one-dimensional convolution to provide input to the channel attention mechanism, optimizing the effectiveness of the threshold evaluation.
[0085] s(n)=Softmax(GAP(Transpose(Conv(n))))×Conv(n), n∈R C×L
[0086] Among them, Transpose represents the transposition operation of the vector, represented by "T" in the figure; GAP represents global average pooling; Conv represents one-dimensional convolution. Furthermore, the channel attention mechanism is used to perform absolute value processing and global average pooling on the feature channels of the output s(n) of the spatial attention module to form an attention vector s'(n) with channel attention characteristics. The dimension of this vector is C×1. Then, adaptive threshold learning is performed through two linear layers with input and output of 16. The two linear layers are first batch normalized and then activated by the ReLu function; then, the Softmax activation function is used to generate a set of coefficients n between 0 and 1 for each channel. c ; Finally, using the above obtained s(n) and n c , the threshold τ for each channel used for soft thresholding c It can be obtained by the following formula.
[0087] τ c =|s(n)|×n c
[0088] Where |s(n)| represents the absolute value of the output vector s(n) of the spatial attention. After completing the threshold calculation, the feature vector output by the second one-dimensional convolution in the residual network is soft-thresholded according to the channel to obtain the processed feature vector, which is added to the input vector mapped by the identity mapping path in the output residual network to obtain the output x of the non-local residual contraction module. t .
[0089] Subsequently, the output of the non-local residual shrinkage module is passed through a gating unit to obtain a characteristic masking vector of the current waveform; wherein the gating unit is designed as follows:
[0090] y t =ReLu(tanh(x t )⊙σ(x t ))
[0091] Where ⊙ represents element-wise multiplication; y t Represents the mask vector output by the gate unit, and σ represents the Sigmoid activation function. The feature mask vector is then multiplied element-wise with the high-dimensional features output by the encoder to extract the noise feature component.
[0092] c. The decoder reconstructs the noise waveform of the noise feature component output by the feature masking module through one-dimensional convolution, and extracts the clean waveform by subtracting the noise waveform from the input current waveform.
[0093] d. The gain module reconstructs the global information of the extracted clean waveform through left and right branch linear layers. The right branch linear layer is a 1×1 linear layer that uses global average pooling to obtain the overall amplitude information of the waveform. It then calculates the overall amplitude gain of the waveform and multiplies this gain by the output of the left branch linear layer to reduce the overall amplitude error of the waveform. The left branch linear layer is a 150×150 linear layer.
[0094] The input of the robust recognition model is a single current cycle, and the length of each cycle is 150. Figure 4 As shown in the figure, this robust recognition model first extracts high-dimensional features of the current cycle through a one-dimensional convolution. Next, key features are extracted by stacking three non-local residual contraction modules with the same structure. These three non-local residual contraction modules are connected in series. Finally, the classification module is constructed using two linear layers connected in series. A Reluctant Luminance (ReLU) activation function is used between these two linear layers to introduce nonlinearity. The output dimension of the last linear layer is the number of electrical appliance types, M.
[0095] In the embodiment of the present application, the storage recorder MR8875-30 is used to collect the electrical data of each appliance in the target scene, with a sampling frequency of f, and the sampled data are annotated with artificial electrical labels. The establishment of a single data set is to uniformly resample the above sampled data to the specified sampling frequency f. s , its value is set to 7500, and the resampling method is Lagrange polynomial interpolation, and its calculation process is as follows:
[0096] (1) First, construct the interpolation polynomial P(e) using the Lagrange basis polynomial:
[0097]
[0098] Among them, L u(e) is the u-th Lagrange basis polynomial; e represents the position of the interpolation sampling point of the current cycle; y u The corresponding value is the current sampling value at the uth position. l is the number of sampling points of the current cycle to be resampled.
[0099] (2) Resampling: Calculate the value of the interpolation polynomial at the new sampling point and resample the data to the specified current sampling length L.
[0100] By resampling the sampled data above, we can obtain the current cycles of different appliances with the same number of sampling points when they are operating independently. The resampled cycles of each appliance are merged to create a single data set.
[0101] Step 2: Construct a perturbation dataset by adding random noise interference of a specified signal-to-noise ratio to the single dataset obtained in step 1, and merge the single dataset and the perturbation dataset into an enhanced training set.
[0102] The perturbation dataset is constructed by adding two types of random noise to the current cycle: Gaussian noise and random walk noise. The specific calculation process of the perturbation dataset is as follows.
[0103] Signal-to-noise ratio: refers to the logarithm of the ratio of signal power to noise power, as shown in the following formula:
[0104]
[0105] Where, P signal and P noise Represents signal power and noise power respectively; SNR dB is the signal-to-noise ratio of the signal; usually, the bus data obtained by the smart meter is discrete, and the power of the signal can be directly calculated. Here we assume that the current signal of one cycle is I = {i1′,i2′,…,i L ′},i L ′ represents the Lth current sampling point, then the current signal power of one cycle can be calculated as:
[0106]
[0107] Where i k It represents the current value of the kth sampling point in I. It is worth noting that the signal power here is not the same as the active power of traditional electrical appliances. After obtaining the current signal power, the noise signal power can be calculated using the following formula:
[0108]
[0109] Where SNR is the specified signal-to-noise ratio, which is set to 10 here, meaning the signal-to-noise ratio of the sample after adding noise is SNR. After obtaining the signal power of the noise, it is necessary to generate a random noise sequence with this signal power. Of the two noise sequences used, Gaussian noise is a type of white noise that follows a normal distribution. In a one-dimensional state, the probability density function of the Gaussian normal distribution is:
[0110]
[0111] Where P(r) represents the value of the given mean a and variance b. 2 Under this condition, the random variable r takes the probability density function of r. Assume that the generated random Gaussian noise sequence is I N_noise , then the random Gaussian noise sequence with specified noise signal power can be calculated by the following formula.
[0112]
[0113] For a time series {g t}, if the following conditions are met, the time series is a random walk.
[0114] g t =w t +w t-1 +...w0
[0115] Among them, w t and w t-1 are the tth and t-1th white noise sequences respectively; w0 is the 0th white noise sequence. t , which is equal to the sum of multiple white noises, that is, random walk is the accumulation of white noise, from which we can get the steps to generate a random walk sequence. Given a random initial value g0, each subsequent value g in the random walk sequence t It can be calculated by the following formula:
[0116] g t =g t-1 +w t
[0117] Where g t-1 is the random walk sequence of the t-1th time step; similarly, assuming that the generated random Gaussian noise sequence is I W_noise , then the random walk noise sequence with specified noise signal power can be calculated by the following formula:
[0118]
[0119] Through the above steps, we have generated two random noise sequences with specified noise signal power. By superimposing the generated random noise sequences on the original monomer waveform, we can obtain the noisy data after data enhancement, and thus construct the perturbation dataset.
[0120]
[0121] Where, I noise Represents the constructed perturbation dataset.
[0122] The perturbation dataset I constructed above noise Merge with the individual dataset to form an enhanced training set for subsequent model training.
[0123] Step 3: Use the enhanced training set constructed in step 2 to train the two models proposed in step 1 respectively. The two models are trained using mean square error and cross entropy loss functions respectively.
[0124] The enhanced training set constructed in step 4 is used to train the universal denoising model and the robust recognition model proposed in steps 1 and 2, respectively. The two models are trained using mean square error and cross entropy loss functions, respectively.
[0125] The general denoising model is trained using the mean square error loss function MSE, which is defined as follows:
[0126]
[0127] Where D is the number of samples; j d is the true value of the d-th sample; is the true value of the d-th sample.
[0128] The robust recognition model is trained using the cross-entropy loss function, which is defined as follows:
[0129]
[0130] Where M is the number of electrical appliance types; j d,h is the true label of the d-th sample for the h-th class; is the predicted probability of the dth sample for the hth class.
[0131] Step 4: In the testing phase, the model trained in step 3 is used to perform two-stage robust recognition on the aliasing decomposition waveform of the target appliance in the unknown aliasing scenario. In the first stage, the waveform is denoised using the trained general denoising module. In the second stage, the trained robust recognition model is used to identify key features of the aliasing decomposition waveform of the target appliance after denoising to obtain the predicted label of the target appliance.
[0132] The aliasing scenario refers to a complex power consumption environment where multiple appliances are running simultaneously. In an unknown aliasing scenario, the newly switched appliance is called the target appliance, and the appliances running on the bus other than the target appliance are called background appliances.
[0133] In the identification stage, the aliased decomposition current of the target appliance is first obtained by subtracting the bus current before and after the switching event, that is, its branch current I Y Current I Y It can be obtained by the following formula:
[0134]
[0135] Among them, I s ' um is the total current after the switching event occurs; I sum is the total current before the switching event. After obtaining the aliased decomposition current of the target appliance in the unknown aliasing scenario, this current waveform is first input into a general noise reduction model to obtain a de-noised current waveform. This de-noised current waveform is then input into a robust recognition model to identify the appliance type and obtain the predicted label of the target appliance.
[0136] Example 2
[0137] Referring to Table 1, Table 2 and Table 3, which are the second embodiment of the present invention, based on the first embodiment, in order to verify its beneficial effects, an experimental effect description is provided.
[0138] Preferably, in order to further illustrate the effectiveness of the invention, four datasets, namely LIT, self-collected dataset, PLAID and WHITED, were used for testing. The first two datasets are intended to verify the robust performance of the two-stage non-intrusive load identification method for known electrical appliances in unknown aliasing scenarios, and the performance is averaged by repeating 10 times to obtain more convincing results. The latter two datasets are used to evaluate the recognition performance of the proposed robust identification model for single waveforms, and ten-fold cross-validation is used to obtain more convincing results. Among them, LIT and self-collected datasets contain sampling data of electrical appliances in many aliasing scenarios, and PLAID and WHITED contain single waveforms of many electrical appliances. In terms of experimental data acquisition, the timestamps recorded in LIT and self-collected datasets are directly used to extract waveforms by subtracting the steady-state current waveforms before and after the event. Finally, the LIT dataset contains 20 cycles of current and voltage data randomly selected for each aliasing scenario, including 1520 decomposed waveforms and 500 original waveform samples of 25 electrical appliances. The self-collected dataset contains 30 cycles of voltage and current data randomly selected for each aliasing scenario, comprising 1,800 decomposed waveforms and 260 original waveform samples from 12 electrical appliances. The PLAID dataset contains 1,874 individual waveforms from 15 electrical appliances. The WHITED dataset contains 1,259 individual waveforms from 54 electrical appliances. We downsampled the voltage and current of all datasets to 150 sampling points per cycle using polynomial interpolation as model input. All experiments used the adaptive weighted recurrent graph (AWRG) method for comparison.
[0139] Furthermore, to test robust performance, the model was trained using an augmented dataset based on the individual dataset, and aliased decomposition waveforms from different aliasing scenarios were used as the test set. To test individual waveform recognition performance, all individual waveforms were divided into training and test sets in an 8:2 ratio.
[0140] Furthermore, in terms of test indicators, the macro average score (F1-macro), accuracy (ACC), and Matthews correlation coefficient (MCC) are used as evaluation indicators of the model. The macro average score is defined as follows:
[0141]
[0142] Where N′ is the number of electrical appliance categories; Recall i′ is the recall rate of the i′th category of electrical appliances; Precision i′ is the accuracy rate of the i′th type of electrical appliance; TP i′ Indicates the true positive rate of the i′th category electrical appliance, FP i′ Indicates the false positive rate of the i′th category electrical appliance, FN i′ represents the false negative rate of the i′th category of electrical appliances; the accuracy rate is defined as follows:
[0143]
[0144] Among them, TP represents the true positive rate, FP represents the false positive rate, TN represents the true negative rate, and FN represents the false negative rate.
[0145] The Matthews correlation coefficient (MCC) is defined as follows:
[0146]
[0147] The value range of MCC is from -1 to 1, and the closer the value is to 1, the better the performance.
[0148] Furthermore, Table 1 shows the recognition performance of the proposed robust recognition model (Ours) for individual waveforms. Experimental results demonstrate that the proposed robust recognition model achieves the best waveform recognition performance when the waveform is relatively clean. Specifically, on the PLAID dataset, the robust recognition model performs exceptionally well in F1-macro, exceeding the comparison method by 3.26%. Furthermore, the variance of its test results across all metrics is smaller than that of the comparison model, demonstrating excellent stability. On the PLAID dataset, all metrics approach 100%, demonstrating its superior single-waveform recognition performance.
[0149] Table 1 Single waveform recognition performance test results
[0150]
[0151] Furthermore, Table 2 shows the basic robustness test results of different methods on aliased decomposition waveforms in unknown aliasing scenarios, using only the robust recognition model (Ours). As can be seen, the proposed robust recognition model performs excellently on both datasets, achieving optimal performance in all metrics. Its performance far exceeds that of the comparison methods in unknown aliasing scenarios.
[0152] Table 2 Robustness performance test results for unknown aliasing scenarios
[0153]
[0154] Furthermore, Table 3 shows the results of a two-stage robustness test of different methods on aliased decomposition waveforms in the presence of unknown aliasing scenarios. This test involves prepending the constructed universal denoising model to all recognition models. It can be seen that, compared to the baseline robustness, the prepend universal denoising model further stabilizes the model's classification performance at a high level, alleviating the recognition issues caused by severe waveform distortion. The proposed robust recognition model achieves a recognition accuracy of 95.97% on the LIT dataset and as high as 99% on self-collected data. Notably, the prepend universal denoising model not only validates the proposed recognition method but also significantly improves the recognition performance of AWRG. Compared to the baseline robustness, AWRG's F1-macro on the LIT dataset improves by 20.04%, demonstrating the versatility of the prepend denoising model in improving the robustness of different methods.
[0155] Table 3 Two-stage test results
[0156]
[0157] Table 4 Model parameter statistics
[0158] method Parameter quantity (k) Memory occupied (MB) Computational Amount AWRG 667.66 2.55 <![CDATA[2.55×10 3 ]]> Robust recognition model 103.01 0.39 <![CDATA[9.12×10 2 ]]> General noise reduction model 24.97 0.09 <![CDATA[2.90×10 2 ]]>
[0159] Table 4 summarizes the parameters, memory usage, and floating-point computational overhead of the constructed universal denoising module and robust recognition model. It also shows the relevant parameters of the comparative method AWRG. It can be seen that both the constructed universal denoising module and robust recognition model are lightweight and have recognition capabilities within seconds, making them suitable for edge deployment and large-scale application.
[0160] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be considered as equivalent replacement methods and are included in the scope of protection of the present invention.
Claims
1. A two-stage non-intrusive load detection method for unknown aliasing scenarios, characterized by: The following steps are involved: Step 1: Build a lightweight universal noise reduction model based on feature masking to reduce the noise of the target appliance waveform in the unknown aliasing scenario and obtain a more recognizable target appliance waveform; A lightweight robust recognition model is constructed based on the non-local residual shrinkage module to extract the key features of the target appliance waveform after noise reduction, thereby performing robust recognition. The voltage and current data of each appliance in the target scene are obtained to establish a single dataset. The general noise reduction model includes an encoder, a feature masking module, a decoder, and a gain module. The details are as follows: a. The encoder consists of a one-dimensional convolution and a ReLU activation function, which is used to map the input waveform features to a high-dimensional feature space. The encoder input is the current waveform of a single cycle of the appliance. Before input, the current cycle needs to be normalized based on the variance and mean of each current cycle as follows: ; ; ; Where x i represents the current at the i-th current sampling point; N is the total number of sampling points of the current cycle; μ is the mean current of one cycle; v is the standard deviation of the cycle; is the current sampling point after standardization; b. The feature masking module first performs component analysis on the high-dimensional features of the encoder through a non-local residual shrinkage module, and passes the output of the non-local residual shrinkage module through a gating unit to obtain a feature masking vector for the current waveform. The gating unit is designed as follows: ; Where, represents the output vector of the non-local residual shrinkage module; ⊙ represents element-wise multiplication; represents the masking vector output by the gated unit, and σ represents the Sigmoid activation function. The feature masking vector is then multiplied element-wise by the high-dimensional features output by the encoder to extract the noise feature component. c. The decoder reconstructs the noise waveform of the noise feature component output by the feature masking module through one-dimensional convolution, and subtracts the noise waveform from the input current waveform to extract the clean waveform; d. The gain module reconstructs the global information of the extracted clean waveform through the left and right branch linear layers; the right branch linear layer is a The linear layer of the left branch uses global average pooling to obtain the overall amplitude information of the waveform, and then calculates the overall amplitude gain of the waveform, and then multiplies the gain by the output of the left branch linear layer to reduce the overall amplitude error of the waveform. The left branch linear layer is a Linear layer; Step 2: Construct a perturbation dataset by adding random noise interference of a specified signal-to-noise ratio to the single dataset obtained in step 1, and merge the single dataset and the perturbation dataset into an enhanced training set; Step 3: Use the enhanced training set constructed in step 2 to train the general denoising model and robust recognition model constructed in step 1 respectively. The general denoising model is trained using the mean square error loss function, and the robust recognition model is trained using the cross entropy loss function. Step 4: In the testing phase, the model trained in step 3 is used to perform two-stage robust recognition on the aliasing decomposition waveform of the target appliance in the unknown aliasing scenario. In the first stage, the waveform is denoised using the trained general denoising module. In the second stage, the trained robust recognition model is used to identify key features of the aliasing decomposition waveform of the target appliance after denoising to obtain the predicted label of the target appliance.
2. A two-stage non-intrusive load detection method for unknown aliasing scenarios according to claim 1, characterized in that: In step 1, the non-local residual shrinkage module includes a residual network, soft thresholding, and an adaptive threshold network, as follows: b1. Residual network: It consists of two identical one-dimensional convolutions and cross-layer identity paths. Batch normalization is used between each one-dimensional convolution to speed up training and prevent the model from overfitting. b2. Soft thresholding: First, a positive threshold τ needs to be set. Then, the soft threshold function will set the load features with absolute values lower than the positive threshold τ to zero, and the load features with absolute values greater than the positive threshold τ will also shrink towards zero, thereby achieving the distinction between different component features. The relationship between its input x and output y is shown in the following formula: ; ; b3. Adaptive threshold network: The input of this network is the output feature vector of the second one-dimensional convolution in the above residual network. First, the feature vector s(n) with spatial attention characteristics is calculated through the spatial attention module. The calculation process is shown in the following formula, where n represents the dimension in the real number field R. The input feature vector is , where C is the number of channels and L is the length of each cycle; the spatial attention module further extracts features through one-dimensional convolution and compresses them in the channel dimension to generate a one-dimensional feature vector of length L. This one-dimensional feature vector is then passed through the Softmax function to form an attention vector, which strengthens the correlation between positions. This attention vector is multiplied by the output of the one-dimensional convolution to provide input for the channel attention mechanism and optimize the effectiveness of the threshold evaluation; ; In the formula, Transpose represents the transposition operation of the vector; GAP represents global average pooling; Conv represents a one-dimensional convolution that performs absolute value processing and global average pooling on the feature channels of the output s(n) of the spatial attention module through the channel attention mechanism to form an attention vector s'(n) with channel attention characteristics. The dimension of this vector is C×1; then, adaptive threshold learning is performed through two linear layers. The two linear layers are first batch normalized and then activated by the ReLu function; then a set of coefficients n between 0 and 1 are generated for each channel through the Softmax activation function. c ; Finally, using the above obtained s(n) and n c , the threshold 𝜏 for each channel used for soft thresholding c It can be obtained by the following formula: ; Where, The output vector representing spatial attention Take the absolute value; after completing the threshold calculation, the feature vector of the second one-dimensional convolution output in the above residual network is soft-thresholded according to the channel to obtain the processed feature vector, which is added to the input vector mapped by the identity mapping path in the residual network to obtain the output vector of the non-local residual contraction module .
3. The two-stage non-intrusive load detection method for unknown aliasing scenarios according to claim 1 is characterized in that: In step 1, the input of the robust recognition model is a single current cycle, and the length of each cycle is L. The robust recognition model first extracts the high-dimensional features of the current cycle through a one-dimensional convolution, and then extracts the key features by stacking three non-local residual shrinkage modules with the same structure. The relationship between these three non-local residual shrinkage modules is a series relationship. Finally, two series-connected linear layers are used to construct a classification module. Nonlinearity is introduced in the middle of the two series-connected linear layers through the ReLu activation function. The output dimension of the last linear layer is the number of electrical types M.
4. The two-stage non-intrusive load detection method for unknown aliasing scenarios according to claim 1 is characterized in that: In step 1, the current and voltage data of each electrical appliance in the target scene are collected individually, with a sampling frequency of f, and the sampled data are annotated with artificial electrical labels. To establish a single dataset, the above sampled data are uniformly resampled to the specified sampling frequency f. s , the resampling method is Lagrange polynomial interpolation method, and its calculation process is as follows: First, construct the interpolation polynomial P(e) using the Lagrange basis polynomial: ; Where, L u (e) is the u-th Lagrange basis polynomial; e represents the position of the interpolation sampling point of the current cycle; y u The corresponding value is the current sampling value at the u-th position; l is the number of sampling points of the current cycle to be resampled; Resampling: Calculate the value of the interpolation polynomial at the new sampling point and resample the data to the specified current sampling length L; Through the above resampling processing of the sampled data, the current cycles of different electrical appliances with the same number of sampling points when running independently can be obtained, and the resampled cycles of each appliance are merged to establish a single data set.
5. The two-stage non-intrusive load detection method for unknown aliasing scenarios according to claim 1 is characterized in that: In step 2, the perturbation dataset is constructed by adding two types of random noise to the current cycle: Gaussian noise and random walk noise. The specific calculation process of the perturbation dataset is as follows: Signal-to-noise ratio: refers to the logarithm of the ratio of signal power to noise power, as shown in the following formula: ; Where, and denote the signal power and noise power respectively; is the signal-to-noise ratio of the signal; the bus data obtained by the smart meter is discrete, and the power of the signal can be directly calculated. Here, a current signal with a cycle is assumed to be , Represents the Lth current sampling point, then the current signal power of one cycle can be calculated for: ; Where, It represents the current value of the kth sampling point in I. The signal power here is not the same as the active power of traditional electrical appliances. After obtaining the current signal power, the signal power of the noise can be calculated by the following formula: : ; In the formula, SNR is the specified signal-to-noise ratio, that is, the signal-to-noise ratio of the sample after adding noise is SNR; after obtaining the signal power of the noise, it is necessary to generate a random noise sequence with the signal power; among the two noise sequences used, Gaussian noise is a white noise that obeys the normal distribution. In the one-dimensional state, the probability density function of the Gaussian normal distribution is: ; Where P(r) represents the value of Under this condition, the random variable r takes the probability density function of r; assuming that the generated random Gaussian noise sequence is , then the random Gaussian noise sequence with a specified noise signal power can be calculated by the following formula : ; For a time series {g t }, if the following conditions are met, the time series is a random walk; ; Where, and are the tth and t-1th white noise sequences respectively; is the 0th white noise sequence; for the random walk sequence , which is equal to the sum of multiple white noises, that is, random walk is the accumulation of white noise, from which we can get the steps to generate a random walk sequence. Given a random initial value g0, each subsequent value g in the random walk sequence t It can be calculated by the following formula: ; Where, is the random walk sequence of the t-1th time step; similarly, assume that the generated random walk noise sequence is , then the random walk noise sequence with a specified noise signal power can be calculated by the following formula : ; At this point, two random noise sequences with specified noise signal power have been generated. By superimposing the generated random noise sequences on the original monomer waveform, we can obtain the noisy data after data enhancement. From this, we can construct the perturbation data set as follows: ; Where, Represents the constructed perturbation dataset.
6. The two-stage non-intrusive load detection method for unknown aliasing scenarios according to claim 1 is characterized in that: In step 3, the general denoising model adopts the mean square error loss function Training, which is defined as follows: ; Where D is the number of samples; j d is the true value of the d-th sample; is the true value of the d-th sample; The robust recognition model adopts the cross entropy loss function Training, which is defined as follows: ; Where, M is the number of electrical appliance types; is the true label of the d-th sample for the h-th category of electrical appliances; is the predicted probability of the dth sample for the hth type of electrical appliance.
7. The two-stage non-intrusive load detection method for unknown aliasing scenarios according to claim 1 is characterized in that: In step 4, the aliasing scenario refers to a complex power consumption environment where multiple appliances are running simultaneously. In an unknown aliasing scenario, the newly switched appliance is called the target appliance, and the appliances running on the bus other than the target appliance are called background appliances. In the identification stage, the aliased decomposition current of the target appliance, i.e., its branch current, is first obtained by subtracting the bus current before and after the switching event. The aliased decomposition current can be obtained by the following formula: ; Where, Decompose the current for aliasing; is the total current after the switching event occurs; is the total current before the switching event occurs; After obtaining the aliasing decomposition current of the target appliance in the unknown aliasing scenario, it is first input into the general noise reduction model to obtain the noise-reduced current waveform, and then the noise-reduced current waveform is input into the robust recognition model to identify the appliance type, thereby obtaining the predicted label of the target appliance.
Citation Information
Patent Citations
Non-intrusive load decomposition improvement method and device and storage medium
CN114692740A
Non-intrusive load identification method and system for high-frequency aliasing data
CN117056665A