A sequence-to-subsequence non-intrusive load identification method and device and storage medium

By combining pre-training and supervised learning with the design of generators and discriminators, and utilizing position-time coding and probabilistic sparse attention modules, the problems of high training cost and low efficiency in non-invasive load recognition are solved, achieving efficient sequence-to-subsequence recognition and improving the utilization of temporal information and model prediction capabilities.

CN117493929BActive Publication Date: 2026-03-20ZHEJIANG UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-31
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing non-intrusive load identification methods suffer from high training costs, high model complexity, insufficient utilization of temporal information, and difficulty in handling sequence dependencies. In particular, sequence-to-sequence models perform poorly when dealing with dependencies at both ends of the output sequence, and sequence-to-point models have low prediction efficiency.

Method used

The model is fine-tuned using pre-trained weights. Combined with the design of the generator and discriminator, a position-time encoding module and a probabilistic sparse attention module are used. The generator recovers the mask data and the discriminator identifies it. The generator is pre-trained using the mean square error and KL divergence loss function. The discriminator is supervised learning using the binary cross-entropy loss function, realizing non-intrusive load identification from sequence to subsequence.

Benefits of technology

It reduces training time and cost, improves recognition efficiency, alleviates computational complexity and memory requirements, enhances the utilization of temporal information, improves the ability to handle sequence dependencies, and improves the model's prediction efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117493929B_ABST
    Figure CN117493929B_ABST
Patent Text Reader

Abstract

The application discloses a sequence-to-subsequence non-intrusive load identification method and device and a storage medium, and comprises the following steps: (1) acquiring power consumption data of multiple houses by using a public data set, obtaining total power consumption data of each house and corresponding power consumption data of each electric appliance after data processing, and constructing a training set; (2) constructing a non-intrusive load identification model, wherein the non-intrusive load identification model comprises a generator and a discriminator; (3) training the non-intrusive load identification model by using the training set, including a pre-training stage and a supervised learning stage; and (4) in the application process, inputting the total power consumption data of the house into the trained non-intrusive load identification model to obtain power consumption data of a target electric appliance, so that the purpose of non-intrusive monitoring of the power consumption of a single electric appliance is achieved. Through the pre-trained weight, the model can be quickly fine-tuned, the training time is reduced, and the efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of non-invasive load identification, and in particular relates to a non-invasive load identification method, apparatus and storage medium for sequence-to-subsequence load identification. Background Technology

[0002] Non-intrusive load monitoring (NILM) is a technology that uses total household signal to infer appliance consumption patterns. Data types in the field of NILM can be categorized by frequency into high-frequency and low-frequency data. High-frequency data typically operates in the kHz or MHz range and primarily consists of current and voltage signals, while low-frequency data is measured in seconds and mainly consists of power signals. For low-frequency data, deep learning has become the mainstream approach.

[0003] Deep learning-based NILM can be categorized into three types based on the length of the input and output sequences: sequence-to-sequence (seq2seq), sequence-to-point (seq2point), and sequence-to-subsequence (seq2subseq), such as... Figure 1 As shown. Figure 1 In the diagram, from left to right, we have: seq2seq, which decomposes the total power over a given period into the power consumption of a specific appliance over the same time interval; seq2point, which decomposes the total power over a given period into the power consumption of a specific appliance at a specific point in time; and seq2subsuq, which decomposes the total power over a given period into the power consumption of a specific appliance at a specific small interval in time.

[0004] Chinese patent document CN113762355A discloses a method for detecting abnormal user electricity consumption behavior based on non-intrusive load decomposition, which uses a sequence-to-sequence translation model for load decomposition. Chinese patent document CN113970667A discloses a non-intrusive load monitoring method based on a small segment of a sequence in the middle of a prediction window. This method improves the identifiability and efficiency of non-intrusive load monitoring by training a sequence-to-point network to predict only a small segment of the sequence in the middle of a sliding window.

[0005] The main drawbacks of existing technologies are:

[0006] (1) Currently, most identification methods require a separate model for each appliance. When identifying a new appliance, a new model must be retrained, which greatly increases the cost and complexity of training.

[0007] (2) Existing sequence-to-sequence models perform poorly when dealing with dependencies between the two ends of the output sequence. Sequence-to-point models, on the other hand, are inefficient in prediction because they only output a single point.

[0008] (3) The existing attention mechanism-based model has o(L 2 ) computational and memory complexity.

[0009] (4) The existing non-intrusive load decomposition method often ignores the importance of time information. SUMMARY

[0010] The application provides a sequence-to-subsequence non-intrusive load identification method, device and storage medium. Through pre-trained weights, the model can be quickly fine-tuned, the training time is reduced, and the identification efficiency is improved.

[0011] A sequence-to-subsequence non-intrusive load identification method, comprising the following steps:

[0012] (1) Obtain the power consumption data of multiple houses by using a public data set, and obtain the total power consumption time series data stream of each house and the power consumption data stream of each electrical appliance under the same time stamp after data processing;

[0013] (2) Construct a non-intrusive load identification model, wherein the non-intrusive load identification model comprises a generator and a discriminator;

[0014] (3) Train the non-intrusive load identification model by using a training set, including a pre-training phase and a supervised learning phase;

[0015] (3-1) Pre-training phase:

[0016] This phase only needs the total power consumption time series data of each house. The power consumption data of each house is a time series arranged data stream. After obtaining the total power consumption time series data stream of each house, a continuous data stream is integrated. The data of each house is resampled for 6 seconds, the missing data is filled forward, and then the total power consumption time series data is normalized. After obtaining the total power consumption time series data of each house and the corresponding time stamp, the continuous data stream is divided into 720 lengths and 30 steps, thereby generating a pre-training data set;

[0017] Pre-training process: the pre-trained model is divided into a generator and a discriminator.

[0018] The generator accepts the time stamp and the masked power time series data as input; the masking rule is: in the range of 270 to 450 of the total power consumption time series data, the 180 unit length is masked according to the set rule, and the goal of the generator is to restore these masked data as much as possible.

[0019] The input of the discriminator is the output of the generator and the time stamp; the task of the discriminator is to identify which part of the output data of the generator is restored;

[0020] The pre-training process forces the model to understand the interdependence between the entire power time series data without relying on specific appliance label data.

[0021] (3-2) Supervised learning process:

[0022] In this phase, the total power consumption time series data of each house and the power label of the corresponding appliance to be decomposed are required; 6 seconds of resampling is performed on the data of each house, forward filling is performed on the missing data, and then the power time series data is normalized; after obtaining the total power consumption time series data of each house and the corresponding time stamp, the total power consumption time series data is then divided into 720 lengths, the target appliance is 180 lengths, and the data stream is divided into 30 steps, thereby generating a supervised training data set; the time stamp of the total power in the middle 180 time period corresponds to the same time stamp of the appliance label;

[0023] The supervised learning process discards the generator and initializes the model with the weights of the discriminator in the pre-training; the input of the discriminator is the masked total power consumption time series data, which is also masked in the 180 unit length from 270 to 450 according to the specified rule; the output is the corresponding appliance to be identified;

[0024] (4) In the application process, the total power consumption time series data of the house to be identified is input into the trained non-intrusive load identification model, and the power consumption data of the target appliance is obtained, thereby achieving the purpose of non-intrusive monitoring of the power consumption of a single appliance.

[0025] In step (1), the total power consumption data of each house and the corresponding power consumption data of each appliance both contain time stamps and power data.

[0026] In step (2), the generator and discriminator in the non-intrusive load identification model both contain a position time encoding module and a probabilistic sparse attention module.

[0027] In the generator, the shape of the tensor A output after the time stamp passes through the position time encoding module, the tensor A contains local position information and time information; the shape of the tensor B after the masked power data passes through the one-dimensional convolution (sequence embedding layer); the tensor A and the tensor B are added and then input into the probabilistic sparse attention module.

[0028] In the discriminator, the shape of the tensor A' output after the time stamp passes through the time encoding module, the tensor A' contains local position information and time information; the shape of the tensor B' after the restored power data passes through the one-dimensional convolution (sequence embedding layer); the tensor A' and the tensor B' are added and then input into the probabilistic sparse attention module.

[0029] Where the shape of the tensor is represented as (batch, len, d), batch represents the size of the batch, that is, the number of data processed at a time, len represents the length of each sequence, and d represents the dimension of each data point.

[0030] In step (3), the mask processing is performed according to the set rule, which is specifically:

[0031] In this 180-length sequence, the power of 25% of the positions is randomly selected and masked; the masked part has an 80% probability of being set to -1, a 10% probability of being set to a random floating point number in the [0, 1) interval, and the remaining 10% remains unchanged.

[0032] In the pre-training stage, the task of the generator is to restore the masked data, and the task of the discriminator is to identify the data restored by the generator;

[0033] The loss function of the generator is only calculated based on the masked position, which is the sum of the Mean Squared Error (MSE) loss function and the Kullback-Leibler divergence loss function; the discriminator uses the binary cross-entropy loss function, where x represents the input of the masked position, represents the output of the generator mask position, x m represents the masked data, c represents the output of the discriminator; T represents the length of the masked time series, N represents the amount of data output by the discriminator, and τ is a hyperparameter, D KL represents the KL divergence loss function, and m is a binary mask; therefore, the loss functions of the generator and the discriminator are respectively:

[0034]

[0035]

[0036] In the pre-training stage, the total loss function is the sum of the loss functions of the generator and the discriminator.

[0037] In the supervised learning stage, the loss function is represented as:

[0038]

[0039] where T represents the length of the masked time series, represents the predicted decomposition power, y i represents the actual power, τ is a hyperparameter, represents the predicted state of the electrical appliance, s i represents the actual state of the electrical appliance, The set of appliances that are predicted to be on or misclassified, and lambda is another hyperparameter; the on-off state of an appliance is determined by a threshold, when the power reaches a certain threshold, the appliance is determined to be on, otherwise off.

[0040] A sequence-to-subsequence non-intrusive load identification device, comprising a memory and one or more processors, the memory stores executable code, and the one or more processors execute the executable code to implement the above sequence-to-subsequence non-intrusive load identification method.

[0041] A computer readable storage medium, which stores a program, and the program is executed by a processor to implement the above sequence-to-subsequence non-intrusive load identification method.

[0042] Compared with the prior art, the present application has the following beneficial effects:

[0043] (1) The pre-training and subsequent supervised learning process of the present application solves the problem of long training time and high training cost in the existing non-intrusive load identification method.

[0044] (2) The sequence-to-subsequence design of the present application solves the difficulty of capturing the dependency relationship at both ends of the output sequence based on the sequence-to-sequence model, and the low prediction efficiency of the sequence-to-point model.

[0045] (3) The probability sparse attention module of the present application alleviates the problem of high computational complexity and memory complexity caused by the model based on the attention mechanism.

[0046] (4) The position time encoding module of the present application solves the problem of lacking consideration of time information in the processing process of the model. BRIEF DESCRIPTION OF DRAWINGS

[0047] Figure 1 The sequence-to-sequence, sequence-to-point, and sequence-to-subsequence non-intrusive load monitoring schematic diagram;

[0048] Figure 2 The model schematic diagram of the pre-training stage and the supervised learning stage in the present application;

[0049] Figure 3 The appliance label diagram of the timestamp pair of the total power intermediate 180 time period in the supervised learning stage. DETAILED DESCRIPTION

[0050] The present application will be further described in detail below in conjunction with the drawings and examples, it should be pointed out that the following examples are intended to facilitate the understanding of the present application, and do not have any limiting effect on it.

[0051] A sequence-to-subsequence non-intrusive load identification method comprising the steps of:

[0052] 1. Prepare dataset

[0053] Prepare UK_DALE dataset: https: / / jack-kelly.com / data / . The UK_DALE dataset records the power consumption of five houses. In each house, the total power consumption (aggregate) of the entire house and the power consumption (individual) of each individual appliance are recorded every six seconds.

[0054] As shown in Table 1 below, the following is an example of data in the aggregate part, in which the first column of data is the timestamp, and the second column of data is the power.

[0055] Table 1

[0056] 1352500095 599 1352500101 582 1352500107 600 1352500113 586

[0057] As shown in Table 2 below, the following is an example of data in the Individual (kettle) part, in which the first column of data is the timestamp, and the second column of data is the power.

[0058] Table 2

[0059]

[0060]

[0061] 2. Model structure / train model

[0062] First, introduce the relevant deep learning modules

[0063] (1) Sequence embedding layer

[0064] Embedding(x) = Conv1d(x)

[0065] Conv1d represents one-dimensional convolution, which embeds data in one dimension. In the generator, the input x is the masked power time series number, and in the discriminator, the input is the output data of the generator. The output of the sequence embedding layer is added to the output of the position time encoding module and input to the probabilistic sparse attention module.

[0066] (2) Position time encoding module

[0067] Time encoding:

[0068] After obtaining the timestamp, the hour information (which hour of the day), week information (which day of the week), month information (which month of the year), and day information (which day of the year) are extracted from it. Then, each information is mapped to the interval (-0.5 to 0.5) to form a tensor with shape (1, 4). This information is first input into a one-dimensional convolutional neural network

[0069] Position encoding:

[0070] If t is the actual position of a token in the sequence (for example, the first token is 1, the second token is 2...), is the position encoding of this token, represents the i-th element in this position encoding, d model is the dimension of this token, then can be expressed as:

[0071]

[0072] where,

[0073] (3) Probability sparse attention module

[0074] The probability sparse attention module includes a probability sparse attention mechanism and a self-attention distillation.

[0075] Probability sparse attention:

[0076] The original self-attention mechanism is as follows: Let q i ,k i ,v i represent the i-th row in Q, K, and V, respectively. The attention of the i-th query is defined as a kernel smoother in the form of probability:

[0077]

[0078] where and The self-attention mechanism requires quadratic time complexity dot product calculation and O(L Q L K ) memory usage.

[0079] The self-attention mechanism has potential sparsity characteristics. The probability sparse attention is as follows

[0080]

[0081] where the metric is:

[0082] Probabilistic sparse self-attention: each key only focuses on u dominant queries, Here is a sparse matrix of the same size as q, which only contains the top-u queries under the metric M(q, K). u is controlled by a constant sampling factor c, set u = c * lnL Q , which makes the time complexity of probabilistic sparse self-attention query-key computation O(lnL Q ), and the space complexity is O(L K lnL Q ). In multi-head attention, the probabilistic sparse attention mechanism generates different sparse query-key pairs for each head, thereby avoiding serious information loss.

[0083] Self-attention distillation,

[0084] X j+1 = MaxPool(ELU(Conv1d([X j ] AB )))

[0085] where j represents the jth layer, j+1 represents the j+1th layer, and [. AB represents the output of the multi-head probabilistic sparse attention mechanism. Conv1d represents one-dimensional convolution. ELU represents the Exponential Linear Unit (ELU) activation function, and MaxPool represents the one-dimensional maximum pooling layer.

[0086] (4) Deconvolution output layer

[0087] Out(X) = Tanh(Deconv(X)w1 + b1)w2 + b2

[0088] X represents the output of the probabilistic sparse attention module, Deconv is the deconvolution network, w1 w2 b1 b2 represent the weights that can be learned. Tanh represents the Tanh activation function.

[0089] As Figure 2 shown, the constructed non-intrusive load identification model includes a generator and a discriminator. The training set is used to train the non-intrusive load identification model, including a pre-training phase and a supervised learning phase.

[0090] Pre-training stage, only aggregate total power features are used. The following input and output configurations are set. In the pre-training process, only aggregate of all houses are used. First, these aggregates are integrated to generate a continuous data stream. Then, normalization is performed on it, using the formula: (x-mean) / std. Next, the data stream is divided into segments with a length of 720 and a step of 30. The input of the generator is the aggregate in the form of (batch, 720) and its corresponding timestamp.

[0091] The input of the generator is a power time series signal with a length of 720. In this sequence, the power part between 270 and 450 (total length of 180) will be masked according to the following rules: in this 180-length sequence, the power of 25% of the positions is randomly selected and masked. The masked part has an 80% probability of being set to -1, a 10% probability of being set to a random floating point number in the interval [0, 1), and the remaining 10% remains unchanged. The output of the discriminator is a data sequence with a length of 180, which aims to identify those masked data parts. This stage will train a general discriminator weight.

[0092] The loss function of the generator is only based on the masked position, which is the sum of the Mean Squared Error (MSE) loss function and the Kullback-Leibler divergence loss function; the discriminator uses the binary cross-entropy loss function. Let x represent the input of the masked position, Let x represent the output of the generator's masked position, x m Let c represent the output of the discriminator; T represents the length of the time series that is masked, N represents the amount of data output by the discriminator, and τ is a hyperparameter. KL Let m be the binary mask. Therefore, the loss functions of the generator and the discriminator are represented as:

[0093]

[0094]

[0095] In the pre-training stage, the total loss function is the sum of the loss functions of the generator and the discriminator.

[0096] In the supervised learning stage, the generator is discarded and the discriminator is fine-tuned. It is initialized with the pre-trained discriminator weights. At this time, the input of the discriminator is the aggregate data, and the same masking rules are applied to the 180-unit length of data from 270 to 450. The output is the corresponding appliance to be identified, such asFigure 3 For example, when the model wants to identify a kettle, it is trained with the label of the kettle.

[0097] The loss function can be expressed as:

[0098]

[0099] where T represents the length of the masked time series, represents the predicted decomposition of the power, y i represents the actual power, τ is a hyperparameter, represents the predicted state of the appliance, s i represents the actual state of the appliance, represents the predicted state of the appliance, s i represents the actual state of the appliance, represents the predicted state of the appliance, s i represents the actual state of the appliance,

[0100] The present application mainly applies to the field of non-intrusive load monitoring (identification). The target appliance is energy-decomposed from the aggregate data, so as to achieve the purpose of non-intrusive monitoring of the power consumption of a single appliance. The purpose of pre-training is to reduce the training cost. In the field of non-intrusive load monitoring (identification), the current mainstream method is that one model identifies one appliance, and through the pre-trained weights, the model can be quickly fine-tuned.

[0101] Based on the same inventive principle, the embodiment provides a sequence-to-subsequence non-intrusive load identification device, which comprises a memory and one or more processors, and the memory stores executable code. When the one or more processors execute the executable code, the sequence-to-subsequence non-intrusive load identification method is implemented.

[0102] Based on the same inventive principle, the embodiment provides a computer readable storage medium, which stores a program. When the program is executed by a processor, the sequence-to-subsequence non-intrusive load identification method is implemented.

[0103] The above embodiments have described the technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only a specific embodiment of the present application and is not used to limit the present application. Any modification, supplement and equivalent replacement made within the principle range of the present application should be included in the protection range of the present application.

Claims

1. A non-invasive load identification method from sequence to subsequence, characterized in that, Includes the following steps: (1) Use public datasets to obtain power consumption data of multiple buildings. After data processing, obtain the total power consumption time series data stream of each building and the power consumption data stream of each appliance under the same timestamp. (2) Construct a non-intrusive load identification model, which includes a generator and a discriminator; (3) The non-intrusive load identification model is trained using the training set, including the pre-training stage and the supervised learning stage; (3-1) Pre-training phase: This stage only requires the total power consumption time series data for each building. After obtaining the total power consumption time series data stream for each building, it is integrated to generate a continuous data stream. The data for each building is resampled for 6 seconds, and missing data is padded forward. Then, the total power consumption time series data is normalized. After obtaining the total power consumption time series data for each building and its corresponding timestamp, the continuous data stream is segmented with a length of 720 and a step size of 30 to generate a pre-trained dataset. The generator accepts timestamps and masked power timing data as input. The masking rule is: within a length range of 180 units from 270 to 450 of the total power consumption timing data, the generator performs masking processing according to the set rules. The generator's goal is to try its best to recover these masked data. The discriminator's inputs are the generator's output and a timestamp; the discriminator's task is to determine which part of the generator's output data has been restored. The pre-training process enables the model to understand the interdependencies between the entire power time series data without relying on specific appliance label data; (3-2) Supervised learning phase: This stage requires the total power consumption time series data for each building and the power labels of the appliances to be decomposed. The data for each building is resampled for 6 seconds, and missing data is padded forward. The power time series data is then normalized. After obtaining the total power consumption time series data and its corresponding timestamps for each building, the data stream is divided into segments of 720 units in length and 180 units in length for the target appliances, with a step size of 30 units, to generate a supervised training dataset. The timestamps of the middle 180-unit time interval of the total power consumption time series correspond exactly to the labels of the appliances with the same timestamp. The supervised learning process discards the generator and initializes the model with the weights of the discriminator during pre-training. The input to the discriminator is the masked total power consumption time series data, which is also masked according to the set rules within the 180-unit length from 270 to 450. The output is the corresponding electrical appliance that you want to identify; (4) During the application process, the total power consumption time series data of the house to be identified is input into the trained non-intrusive load identification model to obtain the power consumption data of the target appliance, thereby achieving the purpose of non-intrusive monitoring of the power consumption of a single appliance.

2. The non-invasive load identification method from sequence to subsequence according to claim 1, characterized in that, In step (1), the total power consumption data of each house and the power consumption data of each corresponding appliance both include timestamps and power data.

3. The non-invasive load identification method from sequence to subsequence according to claim 1, characterized in that, In step (2), the generator and discriminator in the non-invasive load identification model both include a location-time coding module and a probabilistic sparse attention module. In the generator, the shape of the tensor A output by the timestamp after passing through the location-time encoding module contains local location information and time information; the shape of the tensor B after the masked power data is convolved in one dimension; tensor A and tensor B are added together and then input into the probabilistic sparse attention module. In the discriminator, the shape of the tensor A' output after the timestamp is processed by the time encoding module contains local location information and time information; the shape of the tensor B' after the restored power data is processed by one-dimensional convolution; tensor A' and tensor B' are added together and then input into the probabilistic sparse attention module. The shape of the tensor is represented as (batch, len, d), where batch represents the size of the batch, that is, the number of data to be processed at one time, len represents the length of each sequence, and d represents the dimension of each data point.

4. The non-invasive load identification method from sequence to subsequence according to claim 1, characterized in that, In step (3), the masking process according to the predetermined rules is as follows: In this 180-length sequence, the power of 25% of the positions is randomly selected and masked; the masked part has an 80% probability of being set to -1, a 10% probability of being set to a random floating-point number in the interval [0,1), and the remaining 10% remains unchanged.

5. The non-invasive load identification method from sequence to subsequence according to claim 1, characterized in that, During the pre-training phase, the generator's task is to recover the masked data, and the discriminator's task is to identify the data recovered by the generator. The generator's loss function is calculated based solely on the masked position and is the sum of the mean squared error (MSE) loss function and the KL divergence loss function. The discriminator uses a binary cross-entropy loss function, where x represents the input at the mask position. The output represents the generator's mask position, c represents the discriminator's output; T represents the length of the masked time series, N represents the amount of data output by the discriminator, τ is a hyperparameter, and D... KL This represents the KL divergence loss function, where m is the binary mask; Therefore, the loss functions of the generator and the discriminator are expressed as follows: During the pre-training phase, the total loss function is the sum of the loss functions of the generator and the discriminator.

6. The non-invasive load identification method from sequence to subsequence according to claim 1, characterized in that, In the supervised learning phase, the loss function is expressed as: Where T represents the length of the masked time series. y represents the power of the predicted decomposition. i This represents the actual power; τ is a hyperparameter. s represents the predicted on / off state of electrical appliances. i This indicates the actual on / off state of the electrical appliance. λ represents the set of predicted appliances that are either on or misclassified. λ is another hyperparameter. The on / off state of appliances is determined by a threshold. When the power reaches a certain threshold, the appliance is judged as on; otherwise, it is off.

7. A sequence-to-subsequence non-invasive load identification device, comprising a memory and one or more processors, wherein the memory stores executable code, and the one or more processors execute the executable code to implement the sequence-to-subsequence non-invasive load identification method according to any one of claims 1-6.

8. A computer-readable storage medium, characterized in that, It stores a program that, when executed by a processor, implements the non-intrusive load identification method from sequence to subsequence as described in any one of claims 1-6.

Citation Information

Patent Citations

  • User abnormal power consumption behavior detection method based on non-intrusive load decomposition

    CN113762355A

  • Non-intrusive load monitoring method based on prediction window midpoint value

    CN113970667A

  • Non-intrusive load decomposition method based on Informer model coding structure

    CN113393025A

  • Semi-supervised load identification and decomposition method and system and storage medium

    CN116522151A