Non-intrusive load identification method based on graph encoding and transfer learning

Through graph coding and transfer learning, one-dimensional time-series data are converted into two-dimensional image data. The pre-trained ResNet18 model solves the problems of low recognition efficiency of single-parameter power consumption equipment and strong dependence on long sequence data, and realizes efficient monitoring and classification of power consumption equipment, which is suitable for scenarios with limited hardware resources.

CN117216653BActive Publication Date: 2025-08-29XIAN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311107725.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-30
Publication Date
2025-08-29
Estimated Expiration
2043-08-30

AI Technical Summary

Technical Problem

In the prior art, the identification efficiency of single-parameter power consumption equipment is low, and the dependence between long-sequence data is strong, making it difficult to achieve efficient monitoring and classification of power consumption equipment.

Method used

Using graph coding and transfer learning methods, one-dimensional time-series data is converted into two-dimensional image data, and the pre-trained ResNet18 model is used for training and testing, and the timing features are retained through segmented aggregation approximation algorithm and position coding to build a lightweight model architecture.

Benefits of technology

It improves the monitoring and classification efficiency of power consumption equipment, is suitable for deployment on devices with limited hardware resources, and has high accuracy and generalization capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117216653B_ABST
    Figure CN117216653B_ABST
Patent Text Reader

Abstract

This invention discloses a non-intrusive load identification method based on graph coding and transfer learning. The method first collects recorded wave data from different household appliances to form an original data set, which is then divided into a training data set, a validation data set, and a test data set. The data is then segmented and aggregated using the PAA-S algorithm, mapping long sequences into short sequences so that the short sequence data has a similar trend to the original long sequence data. Position coding is added to the short sequence data to retain the temporal characteristics of the original data, and the data is then converted into two-dimensional image data. A ResNet18 pre-trained model based on transfer learning is constructed, trained, and the model performance is tested, ultimately achieving classification and identification of electrical appliances. This method solves the existing problem of identifying single-parameter electrical appliances, avoids dependencies between long sequence data, and improves the generalization capability of the model and the efficiency of monitoring and classifying electrical appliances.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of non-invasive power load monitoring, and in particular relates to a non-invasive load identification method based on graph coding and transfer learning. Background Art

[0002] With the development of the power system and the continuous increase in electricity demand, the state requires that all regions further improve time-of-use electricity pricing mechanisms to better guide users to shift peaks and fill valleys, improve power supply and demand, and promote the integration of renewable energy. Compared with intrusive load monitoring, non-intrusive load identification does not require the installation of monitoring devices on each electrical device to obtain the status and power consumption of each device. It is low-cost, easy to deploy, and highly scalable. It provides a strong theoretical basis for scientifically demarcating peak and valley periods and rationally customizing peak and valley electricity price differentials.

[0003] Deep learning theory and methods offer a new approach for non-intrusive load monitoring. Their advantage is that they can directly extract higher-dimensional load features from raw data through multiple nonlinear transformations, thus avoiding the signal loss and error accumulation associated with traditional feature extraction. Non-intrusive load identification typically uses single-parameter, one-dimensional time series data as input. These sequences often have dependencies and are long, resulting in high training costs. Using simple methods to achieve non-intrusive load identification with long sequences has significant practical implications.

[0004] Compared to traditional training models, transfer learning leverages model parameters trained in the source domain to directly begin training in the target domain, significantly reducing training time and computing resources. Furthermore, leveraging the pre-trained neural network structure and excellent feature representation, fine-tuning can achieve excellent results, making it suitable for porting to devices with limited hardware resources. Converting one-dimensional time series data into two-dimensional images and inputting them into a mature pre-trained model can significantly improve recognition efficiency, providing a theoretical basis for monitoring and identifying electrical equipment and further planning electricity consumption. Summary of the Invention

[0005] The purpose of the present invention is to provide a non-intrusive load identification method based on graph coding and transfer learning, which solves the identification problem of single-parameter electrical equipment existing in the prior art, avoids the dependency between long sequence data, and improves the generalization ability of the model and the monitoring and classification efficiency of electrical equipment.

[0006] The technical solution adopted by the present invention is a non-intrusive load identification method based on graph coding and transfer learning, which is specifically implemented according to the following steps:

[0007] Step 1: Collect recorded data from different household devices to form an original dataset, and divide it into a training dataset, a validation dataset, and a test dataset in a ratio of 7:2:1;

[0008] Step 2: Use the segmented aggregation approximation PAA-S algorithm to perform segmented aggregation approximation on the data in the original data set in step 1, mapping the long sequence into short sequences so that the short sequence data has a similar trend to the original long sequence data;

[0009] Step 3: Add position coding to the short sequence data in step 2, retain the temporal characteristics of the original data, and then convert it into two-dimensional image data;

[0010] Step 4: Build a ResNet18 pre-trained model based on transfer learning. Import the two-dimensional data with position encoding added in step 3 into the ResNet18 pre-trained model based on transfer learning, train and test the model performance, and finally achieve classification and recognition of electrical appliances.

[0011] The present invention is also characterized in that:

[0012] Step 2 is implemented as follows:

[0013] Assume that the recorded data in step 1 is a short sequence data of length N, and the short sequence data is divided into S segments, and the length L of each segment is:

[0014] L=N / S (1)

[0015] Then, for each segment, define a vector A(i) of length L, where A(i) represents the data of the i-th segment. Apply the PAA-S algorithm to vector A(i) to obtain a new value A_i. That is, a straight line model is fitted through simple linear regression to represent the trend of the linear segment, and the slope k(i) and intercept b(i) are obtained. The slope and intercept are calculated as follows:

[0016]

[0017] b(i)=y(i,1)-k(i)·x(i,1) (3)

[0018] Where y(i,L) and y(i,1) are the values ​​of the last point and the first point of the i-th segment respectively, x(i,L) and x(i,1) are the time from the start to the end of the i-th segment respectively; y(i,1) and x(i,1) represent the starting point of the i-th short sequence.

[0019] For segment i, the linear model is expressed as:

[0020] y(i)=k(i)·x+b(i) (4)

[0021] Among them, y(i) represents the mean of all data points in the segment, x represents the time point, and all data points in each segment are regarded as Y, then the sequence Y={A1,A2,...,AS}, where A S Represents the mean of all data points in the segment. After resampling, the output sequence Z is obtained. Then the sequence Z={Z1,Z2,...,Z M}, where Z M is the mean of all data points after resampling, where M is the length of the output sequence. The resampling calculation formula is as follows:

[0022]

[0023] Where k = 1, 2, ..., M represents the index position in the output sequence, and T represents the total length of the time series.

[0024] Step 3 is implemented as follows:

[0025] Add position encoding to the output sequence after dimensionality reduction in step 2 and convert it into a representation form that can be input to the neural network. The one-dimensional time series data in step 2 is Z, then the sequence Z={Z1,Z2,...,Z M}, where element Z M Represents the value of the data sequence at time M, and the position code is calculated using the following formula:

[0026]

[0027] where i represents the time step, j represents the number of dimensions in the position encoding vector, and d model The dimension of i represents the hidden state, and the dimension of i is the dimension M of the time series data. The final position encoding dimension is (1, M). The position encoding is inserted into the one-dimensional data in step 2 to obtain a new data sequence Z' with position encoding, where the sequence Z'={Z'1,Z'2,...,Z' M}, element Z' M Represents the value of the data sequence with position coding at time M;

[0028] Then convert Z' into two-dimensional image data, as shown in the following matrix:

[0029]

[0030] is the data element in the original data sequence Z', where Indicates that the time series is converted into image data by stacking to form a two-dimensional matrix.

[0031] Step 3d model The dimension is 1.

[0032] Step 4 is implemented as follows:

[0033] The encoded two-dimensional image data in step 3 is used as the input of the pre-trained ResNet18 network. Assume that the input of the ResNet18 network is x=Z', the activation function is F(x), and the output of x after two convolutional layers and one activation function is H(x). After the activation function and residual connection, the network output changes from the original H(x) to the following, which is the calculation formula of a residual block:

[0034] H(x)=F(x)+x (8)

[0035] The ReLU nonlinear activation function is used between the two convolutional layers. The expression of the ReLU function is as follows:

[0036] f(x)=max(0,x) (9)

[0037] The residual blocks in the ResNet18 network use different numbers of channels and are composed of convolutional layers, batch normalization layers, pooling layers, and identity mapping layers. Each convolutional layer is followed by a batch normalization layer and a ReLU activation function, and finally an average pooling layer and a fully connected classifier are used. The entire ResNet18 network consists of four stages: the first stage has only one convolutional layer, and the other three stages include two residual blocks, so the total number of basic blocks is 18. The pre-trained model is fine-tuned according to the number of electrical appliance categories. During training, each round of training is tested using the validation dataset, and the model with the highest current recognition accuracy is saved, and the model with the best recognition effect is finally obtained;

[0038] After model training is completed, the prediction effect needs to be evaluated based on the test data set. The evaluation indicators of the prediction results include accuracy, precision, recall, and F1-score. Let TP represent the number of positive classes predicted as positive, TN represent the number of negative classes predicted as negative, FP represent the number of negative classes predicted as positive, and FN represent the number of positive classes predicted as negative. The calculation formulas for the above indicators are as follows:

[0039]

[0040]

[0041]

[0042]

[0043] The beneficial effects of the present invention are that the non-intrusive load identification method based on graph coding and transfer learning introduces a graph coding algorithm, maps one-dimensional sequence data into two-dimensional image data after adding position coding, retains the time series characteristics, and solves the problem that the characteristics of electrical equipment labeled with a single feature carry insufficient information and are difficult to distinguish loads of similar nature; based on the transfer learning theory, the pre-trained ResNet18 model is used for fine-tuning training; finally, the monitoring and classification of electrical equipment are realized, and a lightweight model architecture suitable for porting to hardware resource-constrained devices is provided. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 This is the overall algorithm flow chart of the non-intrusive load identification method based on graph coding and ResNet transfer learning of the present invention;

[0045] Figure 2 This is a schematic diagram of the raw data processing process in the non-intrusive load identification method based on graph coding and ResNet transfer learning of the present invention. DETAILED DESCRIPTION

[0046] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0047] The present invention is a non-intrusive load identification method based on graph coding and transfer learning, the flow chart is as follows Figure 1 As shown, combined Figure 1 、 Figure 2 , specifically follow the steps below:

[0048] Step 1: Use a household appliance recording device to collect recording data from different household appliances to form an original data set, and divide it into a training data set, a validation data set, and a test data set in a ratio of 7:2:1;

[0049] Step 2: Use the Piecewise Aggregate Approximation with Segments (PAA-S) algorithm to perform segmented aggregation approximation on the data in the original dataset in step 1. This algorithm maps long sequences into short sequences, making the trends of the short sequences similar to those of the original long sequences. This algorithm provides acceptable approximation results on the CER_Electricity_Data, REFITPowerData, and Umass Smart Data Set datasets.

[0050] Step 2 is implemented as follows:

[0051] The PAA-S algorithm is used to process the original data set. The operation of household appliances is described as a time series, but the time period of appliance use is too long. In order to quickly analyze it, it is necessary to reduce the dimension of the time series. Assume that the recorded data in step 1 is a short sequence data of length N. The short sequence data is divided into S segments, and the length of each segment L is:

[0052] L=N / S (1)

[0053] Then, for each segment, define a vector A(i) of length L, where A(i) represents the data of the i-th segment. Apply the PAA-S algorithm to vector A(i) to obtain a new value A_i. That is, a straight line model is fitted through simple linear regression to represent the trend of the linear segment, and the slope k(i) and intercept b(i) are obtained. The slope and intercept are calculated as follows:

[0054]

[0055] b(i)=y(i,1)-k(i)·x(i,1) (3)

[0056] Where y(i,L) and y(i,1) are the values ​​of the last point and the first point of the i-th segment respectively, x(i,L) and x(i,1) are the time from the start to the end of the i-th segment respectively; y(i,1) and x(i,1) represent the starting point of the i-th short sequence.

[0057] For segment i, the linear model is expressed as:

[0058] y(i)=k(i)·x+b(i) (4)

[0059] Where y(i) represents the mean of all data points in the segment, x represents the time point, and all data points in each segment are regarded as Y, then the sequence Y={A1,A2,...,A S}, where A S Represents the mean of all data points in the segment. After resampling, the output sequence Z is obtained. Then the sequence Z={Z1,Z2,...,Z M}, where Z M is the mean of all data points after resampling, where M is the length of the output sequence. The resampling calculation formula is as follows:

[0060]

[0061] Where k = 1, 2, ..., M represents the index position in the output sequence, and T represents the total length of the time series.

[0062] Step 3: Add position encoding to the short sequence data in step 2, retain the temporal characteristics of the original data, and then convert it into two-dimensional image data to facilitate processing using mature image pre-training models;

[0063] Step 3 is implemented as follows:

[0064] Add position encoding to the output sequence after dimensionality reduction in step 2 and convert it into a representation form that can be input to the neural network. The one-dimensional time series data in step 2 is Z, then the sequence Z={Z1,Z2,...,Z M}, where element Z M Represents the value of the data sequence at time M, and the position code is calculated using the following formula:

[0065]

[0066] where i represents the time step, j represents the number of dimensions in the position encoding vector, and d model Represents the dimension of the hidden state. In this method, d model The dimension of is 1, the dimension of i is the dimension M of the time series data, and the final position code dimension is (1, M). Insert the position code into the one-dimensional data in step 2 to obtain a new data sequence Z' with position code, where the sequence Z'={Z'1,Z'2,...,Z' M}, element Z' M Represents the value of the data sequence with position coding at time M;

[0067] Then convert Z' into two-dimensional image data, as shown in the following matrix:

[0068]

[0069] is the data element in the original data sequence Z', where Indicates that the time series is converted into image data by stacking to form a two-dimensional matrix.

[0070] Step 4: Build a ResNet18 pre-trained model based on transfer learning. Import the two-dimensional data with position encoding added in step 3 into the ResNet18 pre-trained model based on transfer learning, train and test the model performance, and finally achieve classification and recognition of electrical appliances.

[0071] Step 4 is implemented as follows:

[0072] The encoded two-dimensional image data in step 3 is used as the input of the pre-trained ResNet18 network. ResNet solves the problem of gradient disappearance by adding "residual blocks". Each regular residual block consists of two convolutional layers and a cross connection.

[0073] Assume that the input of the ResNet18 network is x=Z', the activation function is F(x), and the output of x after passing through two convolutional layers and an activation function is H(x). Then, after the activation function and the residual connection, the network output changes from the original H(x) to the following, which is the calculation formula of a residual block:

[0074] H(x)=F(x)+x (8)

[0075] The ReLU nonlinear activation function is used between the two convolutional layers. The expression of the ReLU function is as follows:

[0076] f(x)=max(0,x) (9)

[0077] The residual blocks in the ResNet18 network use different numbers of channels and are composed of convolutional layers, batch normalization layers, pooling layers, and identity mapping layers. Each convolutional layer is followed by a batch normalization layer and a ReLU activation function, and finally an average pooling layer and a fully connected classifier are used. The entire ResNet18 network consists of four stages: the first stage has only one convolutional layer, and the other three stages include 2 residual blocks, so the total number of basic blocks is 18, with a smaller number of parameters and lower computational complexity.

[0078] Using a pre-trained model can improve training efficiency. In this method, the pre-trained model needs to be fine-tuned based on the number of appliance categories, and certain layers can be frozen or unfrozen as appropriate. During training, after each round of training, the validation dataset is used for testing, and the model with the highest recognition accuracy is saved, ultimately obtaining the model with the best recognition performance.

[0079] After model training is completed, the prediction effect needs to be evaluated based on the test data set. The evaluation indicators of the prediction results include accuracy, precision, recall, and F1-score. Let TP represent the number of positive classes predicted as positive, TN represent the number of negative classes predicted as negative, FP represent the number of negative classes predicted as positive, and FN represent the number of positive classes predicted as negative. The calculation formulas for the above indicators are as follows:

[0080]

[0081]

[0082]

[0083]

[0084] This method uses an oscilloscope to collect raw recorded data from electrical appliances. It then uses the PAA-S algorithm to reduce its dimensionality and incorporate position encoding to preserve temporal features. The reduced data is then stacked into two-dimensional images and fed into a pretrained ResNet18 model for feature extraction and classification prediction. This solves the problem of insufficient information and difficulty distinguishing appliance data with a single feature as a label, and achieves classification using a mature pretrained model. This model has fewer parameters and lower computational complexity, as well as higher accuracy and stronger generalization capabilities, making it well-suited for deployment in scenarios with limited hardware resources.

[0085] Example 1

[0086] The present invention is a non-intrusive load identification method based on graph coding and transfer learning, the flow chart is as follows Figure 1 As shown, please follow the steps below:

[0087] Step 1: Use a household appliance recording device to collect recording data from different household appliances to form an original data set, and divide it into a training data set, a validation data set, and a test data set in a ratio of 7:2:1;

[0088] Step 2: Use the Piecewise Aggregate Approximation with Segments (PAA-S) algorithm to perform segmented aggregation approximation on the data in the original dataset in step 1. This algorithm maps long sequences into short sequences, making the trends of the short sequences similar to those of the original long sequences. This algorithm provides acceptable approximation results on the CER_Electricity_Data, REFITPowerData, and Umass Smart Data Set datasets.

[0089] Step 3: Add position encoding to the short sequence data in step 2, retain the temporal characteristics of the original data, and then convert it into two-dimensional image data to facilitate processing using mature image pre-training models;

[0090] Step 4: Build a ResNet18 pre-trained model based on transfer learning. Import the two-dimensional data with position encoding added in step 3 into the ResNet18 pre-trained model based on transfer learning, train and test the model performance, and finally achieve classification and recognition of electrical appliances.

[0091] Example 2

[0092] The present invention is a non-intrusive load identification method based on graph coding and transfer learning, the flow chart is as follows Figure 1 As shown, please follow the steps below:

[0093] Step 1: Use a household appliance recording device to collect recording data from different household appliances to form an original data set, and divide it into a training data set, a validation data set, and a test data set in a ratio of 7:2:1;

[0094] Step 2: Use the Piecewise Aggregate Approximation with Segments (PAA-S) algorithm to perform segmented aggregation approximation on the data in the original dataset in step 1. This algorithm maps long sequences into short sequences, making the trends of the short sequences similar to those of the original long sequences. This algorithm provides acceptable approximation results on the CER_Electricity_Data, REFITPowerData, and Umass Smart Data Set datasets.

[0095] Step 2 is implemented as follows:

[0096] The PAA-S algorithm is used to process the original data set. The operation of household appliances is described as a time series, but the time period of appliance use is too long. In order to quickly analyze it, it is necessary to reduce the dimension of the time series. Assume that the recorded data in step 1 is a short sequence data of length N. The short sequence data is divided into S segments, and the length of each segment L is:

[0097] L=N / S (1)

[0098] Then, for each segment, define a vector A(i) of length L, where A(i) represents the data of the i-th segment. Apply the PAA-S algorithm to vector A(i) to obtain a new value A_i. That is, a straight line model is fitted through simple linear regression to represent the trend of the linear segment, and the slope k(i) and intercept b(i) are obtained. The slope and intercept are calculated as follows:

[0099]

[0100] b(i)=y(i,1)-k(i)·x(i,1) (3)

[0101] Where y(i,L) and y(i,1) are the values ​​of the last point and the first point of the i-th segment respectively, x(i,L) and x(i,1) are the time from the start to the end of the i-th segment respectively; y(i,1) and x(i,1) represent the starting point of the i-th short sequence.

[0102] For segment i, the linear model is expressed as:

[0103] y(i)=k(i)·x+b(i) (4)

[0104] Where y(i) represents the mean of all data points in the segment, x represents the time point, and all data points in each segment are regarded as Y, then the sequence Y={A1,A2,...,A S}, where A S Represents the mean of all data points in the segment. After resampling, the output sequence Z is obtained. Then the sequence Z={Z1,Z2,...,Z M}, where Z M is the mean of all data points after resampling, where M is the length of the output sequence. The resampling calculation formula is as follows:

[0105]

[0106] Where k = 1, 2, ..., M represents the index position in the output sequence, and T represents the total length of the time series.

[0107] Step 3: Add position encoding to the short sequence data in step 2, retain the temporal characteristics of the original data, and then convert it into two-dimensional image data to facilitate processing using mature image pre-training models;

[0108] Step 4: Build a ResNet18 pre-trained model based on transfer learning. Import the two-dimensional data with position encoding added in step 3 into the ResNet18 pre-trained model based on transfer learning, train and test the model performance, and finally achieve classification and recognition of electrical appliances.

[0109] Step 4 is implemented as follows:

[0110] The encoded two-dimensional image data in step 3 is used as the input of the pre-trained ResNet18 network. ResNet solves the problem of gradient disappearance by adding "residual blocks". Each regular residual block consists of two convolutional layers and a cross connection.

[0111] Assume that the input of the ResNet18 network is x=Z', the activation function is F(x), and the output of x after passing through two convolutional layers and an activation function is H(x). Then, after the activation function and the residual connection, the network output changes from the original H(x) to the following, which is the calculation formula of a residual block:

[0112] H(x)=F(x)+x (8)

[0113] The ReLU nonlinear activation function is used between the two convolutional layers. The expression of the ReLU function is as follows:

[0114] f(x)=max(0,x) (9)

[0115] The residual blocks in the ResNet18 network use different numbers of channels and are composed of convolutional layers, batch normalization layers, pooling layers, and identity mapping layers. Each convolutional layer is followed by a batch normalization layer and a ReLU activation function, and finally an average pooling layer and a fully connected classifier are used. The entire ResNet18 network consists of four stages: the first stage has only one convolutional layer, and the other three stages include 2 residual blocks, so the total number of basic blocks is 18, with a smaller number of parameters and lower computational complexity.

[0116] Using a pre-trained model can improve training efficiency. In this method, the pre-trained model needs to be fine-tuned based on the number of appliance categories, and certain layers can be frozen or unfrozen as appropriate. During training, after each round of training, the validation dataset is used for testing, and the model with the highest recognition accuracy is saved, ultimately obtaining the model with the best recognition performance.

[0117] After model training is completed, the prediction effect needs to be evaluated based on the test data set. The evaluation indicators of the prediction results include accuracy, precision, recall, and F1-score. Let TP represent the number of positive classes predicted as positive, TN represent the number of negative classes predicted as negative, FP represent the number of negative classes predicted as positive, and FN represent the number of positive classes predicted as negative. The calculation formulas for the above indicators are as follows:

[0118]

[0119]

[0120]

[0121]

[0122] This method uses an oscilloscope to collect raw recorded data from electrical appliances. It then uses the PAA-S algorithm to reduce its dimensionality and incorporate position encoding to preserve temporal features. The reduced data is then stacked into two-dimensional images and fed into a pretrained ResNet18 model for feature extraction and classification prediction. This solves the problem of insufficient information and difficulty distinguishing appliance data with a single feature as a label, and achieves classification using a mature pretrained model. This model has fewer parameters and lower computational complexity, as well as higher accuracy and stronger generalization capabilities, making it well-suited for deployment in scenarios with limited hardware resources.

[0123] Example 3

[0124] The present invention is a non-intrusive load identification method based on graph coding and transfer learning, the flow chart is as follows Figure 1 As shown, please follow the steps below:

[0125] Step 1: Use a household appliance recording device to collect recording data from different household appliances to form an original data set, and divide it into a training data set, a validation data set, and a test data set in a ratio of 7:2:1;

[0126] Step 2: Use the Piecewise Aggregate Approximation with Segments (PAA-S) algorithm to perform segmented aggregation approximation on the data in the original dataset in step 1. This algorithm maps long sequences into short sequences, making the trends of the short sequences similar to those of the original long sequences. This algorithm provides acceptable approximation results on the CER_Electricity_Data, REFITPowerData, and Umass Smart Data Set datasets.

[0127] Step 2 is implemented as follows:

[0128] The PAA-S algorithm is used to process the original data set. The operation of household appliances is described as a time series, but the time period of appliance use is too long. In order to quickly analyze it, it is necessary to reduce the dimension of the time series. Assume that the recorded data in step 1 is a short sequence data of length N. The short sequence data is divided into S segments, and the length of each segment L is:

[0129] L=N / S (1)

[0130] Then, for each segment, define a vector A(i) of length L, where A(i) represents the data of the i-th segment. Apply the PAA-S algorithm to vector A(i) to obtain a new value A_i. That is, a straight line model is fitted through simple linear regression to represent the trend of the linear segment, and the slope k(i) and intercept b(i) are obtained. The slope and intercept are calculated as follows:

[0131]

[0132] b(i)=y(i,1)-k(i)·x(i,1) (3)

[0133] Where y(i,L) and y(i,1) are the values ​​of the last point and the first point of the i-th segment respectively, x(i,L) and x(i,1) are the time from the start to the end of the i-th segment respectively; y(i,1) and x(i,1) represent the starting point of the i-th short sequence.

[0134] For segment i, the linear model is expressed as:

[0135] y(i)=k(i)·x+b(i) (4)

[0136] Where y(i) represents the mean of all data points in the segment, x represents the time point, and all data points in each segment are regarded as Y, then the sequence Y={A1,A2,...,A S}, where A S Represents the mean of all data points in the segment. After resampling, the output sequence Z is obtained. Then the sequence Z={Z1,Z2,...,Z M}, where Z M is the mean of all data points after resampling, where M is the length of the output sequence. The resampling calculation formula is as follows:

[0137]

[0138] Where k = 1, 2, ..., M represents the index position in the output sequence, and T represents the total length of the time series.

[0139] Step 3: Add position encoding to the short sequence data in step 2, retain the temporal characteristics of the original data, and then convert it into two-dimensional image data to facilitate processing using mature image pre-training models;

[0140] Step 3 is implemented as follows:

[0141] Add position encoding to the output sequence after dimensionality reduction in step 2 and convert it into a representation form that can be input to the neural network. The one-dimensional time series data in step 2 is Z, then the sequence Z={Z1,Z2,...,Z M}, where element Z M Represents the value of the data sequence at time M, and the position code is calculated using the following formula:

[0142]

[0143] where i represents the time step, j represents the number of dimensions in the position encoding vector, and d model Represents the dimension of the hidden state. In this method, d model The dimension of is 1, the dimension of i is the dimension M of the time series data, and the final position code dimension is (1, M). Insert the position code into the one-dimensional data in step 2 to obtain a new data sequence Z' with position code, where the sequence Z'={Z'1,Z'2,...,Z' M}, element Z' M Represents the value of the data sequence with position coding at time M;

[0144] Then convert Z' into two-dimensional image data, as shown in the following matrix:

[0145]

[0146] is the data element in the original data sequence Z', where Indicates that the time series is converted into image data by stacking to form a two-dimensional matrix.

[0147] Step 4: Build a ResNet18 pre-trained model based on transfer learning. Import the two-dimensional data with position encoding added in step 3 into the ResNet18 pre-trained model based on transfer learning, train and test the model performance, and finally achieve classification and recognition of electrical appliances.

[0148] This method uses an oscilloscope to collect raw recorded data from electrical appliances. It then uses the PAA-S algorithm to reduce its dimensionality and incorporate position encoding to preserve temporal features. The reduced data is then stacked into two-dimensional images and fed into a pretrained ResNet18 model for feature extraction and classification prediction. This solves the problem of insufficient information and difficulty distinguishing appliance data with a single feature as a label, and achieves classification using a mature pretrained model. This model has fewer parameters and lower computational complexity, as well as higher accuracy and stronger generalization capabilities, making it well-suited for deployment in scenarios with limited hardware resources.

Claims

1. A non-intrusive load identification method based on graph coding and transfer learning, characterized by: Please follow the steps below to implement it: Step 1: Collect recorded data from different household devices to form an original dataset, and divide it into a training dataset, a validation dataset, and a test dataset in a ratio of 7:2:1; Step 2: Use the segmented aggregation approximation PAA-S algorithm to perform segmented aggregation approximation on the data in the original data set in step 1, mapping the long sequence into short sequences so that the short sequence data has a similar trend to the original long sequence data; The step 2 is specifically implemented according to the following steps: Assume that the recording data in step 1 is of length The short sequence data is divided into Segments, length of each segment for: (1) Then define a length for each segment Vector , Indicates the Segment data, vector Apply the PAA-S algorithm to get a new value , that is, fitting a straight line model through simple linear regression to express the trend of the linear segment and obtain the slope and intercept , where the slope and intercept are calculated as follows: (2) (3) in and They are The values ​​of the last and first points of the segment, and They are The time corresponding to the start and end of the segment; and Indicates the The starting point of a short sequence, For the Segment, the linear model is expressed as: (4) in, represents the mean of all data points in this segment. represents a time point, and all data points in each segment are considered as , then the sequence ,in Represents the mean of all data points in this segment. After resampling, the output sequence is obtained , then the sequence ,in is the mean of all data points after resampling, where is the length of the output sequence, and the resampling formula is as follows: (5) in represents the index position in the output sequence, Indicates the total length of the time series; Step 3: Add position coding to the short sequence data in step 2, retain the temporal characteristics of the original data, and then convert it into two-dimensional image data; Step 4: Build a ResNet18 pre-trained model based on transfer learning. Import the two-dimensional data with position encoding added in step 3 into the ResNet18 pre-trained model based on transfer learning, train and test the model performance, and finally achieve classification and recognition of electrical appliances.

2. The non-intrusive load identification method based on graph coding and transfer learning according to claim 1 is characterized in that: The step 3 is specifically implemented according to the following steps: Add position encoding to the output sequence after dimensionality reduction in step 2 and convert it into a representation that can be used as input for the neural network. The one-dimensional time series data in step 2 is , then the sequence , where the elements Represents the data sequence at time The position code is calculated using the following formula: (6) in represents the time step, represents the number of dimensions in the position encoding vector, represents the dimension of the hidden state, The dimension is the dimension of the time series data , the final position encoding dimension is , insert the position code into the one-dimensional data in step 2 to obtain a new data sequence with position code , where the sequence ,element Represents a data sequence with position encoding at time The value of Then Converted into two-dimensional image data, as shown in the following matrix: (7) The original data sequence The data elements in , which means that the time series is converted into image data by stacking to form a two-dimensional matrix.

3. The non-intrusive load identification method based on graph coding and transfer learning according to claim 2 is characterized in that: In step 3 The dimension is 1.

4. The non-intrusive load identification method based on graph coding and transfer learning according to claim 2, characterized in that: The step 4 is specifically implemented according to the following steps: The encoded two-dimensional image data in step 3 is used as the input of the pre-trained ResNet18 network. Let the input of the ResNet18 network be , the activation function is , The output after two convolutional layers and an activation function is , then after the activation function and residual connection, the network output is changed from the original It becomes as follows, which is the calculation formula of a residual block: (8) The ReLU nonlinear activation function is used between the two convolutional layers. The expression of the ReLU function is as follows: (9) The residual blocks in the ResNet18 network use different numbers of channels and are composed of convolutional layers, batch normalization layers, pooling layers, and identity mapping layers. Each convolutional layer is followed by a batch normalization layer and a ReLU activation function, and finally an average pooling layer and a fully connected classifier are used. The entire ResNet18 network consists of four stages: the first stage has only one convolutional layer, and the other three stages include two residual blocks, so the total number of basic blocks is 18. The pre-trained model is fine-tuned according to the number of electrical appliance categories. During training, each round of training is tested using a validation dataset, and the model with the highest current recognition accuracy is saved, and finally the model with the best recognition effect is obtained; After the model training is completed, the prediction effect needs to be evaluated based on the test data set. The evaluation indicators of the prediction results include accuracy, precision, recall, and F1-score. Indicates the number of positive classes predicted as positive classes, Indicates the number of negative classes predicted as negative classes, Indicates the number of negative classes predicted as positive classes Represents the number of positive classes predicted as negative classes, and the calculation formula of the above indicators is as follows: (10) (11) (12) (13)。

Citation Information

Patent Citations

  • Non-invasive load identification method and system based on self-supervised comparative learning

    CN114358132A

  • Non-intrusive load identification method and system, electronic equipment and storage medium

    CN115980421A