Non-intrusive electrical load detection method and system based on hierarchical federal learning
Through hierarchical federated learning and self-distillation technology, the problem of high communication overhead and model deviation of the non-intrusive load detection model is solved, personalized power load detection is realized, data security is ensured through encrypted transmission, and the risk of data leakage is solved.
Patent Information
- Application Number
- CN202410762026.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-09-06
AI Technical Summary
Existing non-intrusive load detection models have problems such as high communication overhead, model deviation and lack of personalization of the global model, as well as data leakage and security risks.
Using a method based on hierarchical federated learning, the model encryption distribution and gradient information transmission are carried out through the collaborative work of the global server, edge server and edge client. It is combined with the edge client's self-distillation technology and FedProx algorithm to reduce communication overhead and improve model personalization. .
It implements personalized power load detection models in different areas, reducing the risk of model deviation, and ensures data security through the encryption process, reducing the risk of data leakage.
Smart Images

Figure CN118607666A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of non-invasive load decomposition of household energy systems, and specifically relates to a non-invasive electricity load detection method and system based on hierarchical federated learning. Background Art
[0002] With the development of smart grids and the continuous improvement of people's living standards, the demand for precise and lean electricity consumption services by residential users is also growing. Users hope to provide more refined energy consumption services, such as household energy efficiency assessment and timely acquisition of household electricity consumption. Nowadays, load detection helps to achieve device-level electricity consumption decomposition. Load detection includes invasive load detection and non-invasive load detection. Traditional invasive user load detection requires the installation of dedicated terminals and collection sensors on the device side, which is costly and requires changes to the existing power collection architecture. As a result, non-invasive load detection has emerged. Non-invasive load detection refers to the installation of a monitoring device at the entrance of the user bus, which decomposes the total load electrical quantity collected into independent operating data of each electrical appliance through an intelligent algorithm, identifies the working status of each electrical appliance, and analyzes the user's electricity consumption behavior. Non-invasive load detection is easy to deploy and has low cost. It does not require changes to the existing power collection architecture. Non-invasive load detection is the development trend of future power measurement. Currently, most non-intrusive load detection is data-driven, and the model effect depends on the quality of training data. Sufficient training data is of great help to the model effect. However, many places have issued laws and regulations on personal privacy protection and information security, which makes it difficult to transfer local user data to a centralized model. In addition, non-intrusive load detection has certain security risks. Illegal visitors can infer users' living habits through analysis of their electricity consumption data, resulting in user privacy leaks and even economic losses to users.
[0003] Some scholars have proposed the use of federated learning technology in the field of non-intrusive load detection. However, the following problems still exist: as the number of clients increases, the communication overhead also surges; due to the limited amount of local data, the model is prone to deviation in the early stage; the global model lacks personalization for certain data sets. Summary of the invention
[0004] The purpose of the present invention is to solve the problems of high communication overhead, local model deviation and lack of personalization of the global model in the federated non-intrusive load detection model, and proposes a complete model architecture to address the shortcomings of the existing non-intrusive load detection model; the proposed non-intrusive load detection model based on hierarchical federated learning has guiding significance for training non-intrusive load detection models.
[0005] The present invention provides a non-intrusive electricity load detection method based on hierarchical federated learning.
[0006] The method comprises the following steps:
[0007] Inputting the user's total power load data into the corresponding user personalized model to obtain the power load data of each electrical appliance of the user;
[0008] The user personalized model is obtained through the following steps:
[0009] 1) The global server encrypts and distributes the global model stored therein at the current moment to the corresponding multiple edge servers, and the edge servers receive the global model and then encrypt and distribute it to their respective multiple edge clients; wherein the global model at the initial moment is obtained based on the total power load data of users in one or more regions and the power load data of each electrical appliance of the users;
[0010] 2) The edge client uses the obtained model as a local model, trains the local model, obtains the trained local model, obtains the model update parameters of the trained local model, and encrypts the model update parameters and transmits them to the edge server; wherein, when the local model is a global model at the initial moment, the trained local model is obtained based on the total power load data of the local users in the edge client and the power load data of each electrical appliance of the local users;
[0011] 3) The edge server receives the model update parameters input by all edge clients and performs model aggregation on the model update parameters and the model stored in the edge server at the current moment to obtain an updated model, and transmits the updated model to the edge client, and repeats steps 2) and 3) until the set number of rounds. The result of the last round of model aggregation in the edge server is the edge global model;
[0012] 4) The edge server obtains the model update gradient information of the edge global model compared to the global model input to the edge server by the global server in the current round, and encrypts the model update gradient information and sends it to the global server;
[0013] 5) The global server receives the model update gradient information sent by all edge servers, and performs model aggregation on the model update gradient information sent by each edge server and the global model stored in the global server at the current moment, to obtain multiple updated global models, and repeats steps 1) to 5) for a preset number of rounds. The result obtained by model aggregation in the global server in the last round of cycles is the user personalized model of each edge server;
[0014] 6) The global server encrypts and distributes the user personalized models of each edge server to the corresponding edge server. The edge server receives the respective user personalized models and then encrypts and distributes them to the respective multiple edge clients.
[0015] The present invention also provides a non-intrusive power load detection system for implementing the method, comprising a global server, an edge server, an edge client and a third-party trusted platform;
[0016] The global server is used to generate and update the global model, and finally obtain multiple user personalized models, and encrypt and distribute the models stored therein to the corresponding multiple edge servers;
[0017] The edge server is used to update the model input by the global server and obtain the model update gradient information, and encrypt and send the model update gradient information to the global server; and receive the model update parameters and generate an updated model and encrypt and transmit the updated model to the edge client;
[0018] The edge client is used to train the local model and generate the model update parameters, and encrypt the model update parameters and send them to the edge server;
[0019] The third-party trusted platform is used to generate the public and private keys of the receiver and the sender and distribute the public and private keys;
[0020] Among them, multiple user personalized models finally generated by the global server are transmitted to the corresponding edge clients, and the edge clients use their own personalized models to obtain the power load data of each electrical appliance of the user.
[0021] Compared with the prior art, the present invention has the following beneficial effects:
[0022] (1) The present invention proposes a non-intrusive power load detection method and system based on hierarchical federated learning, which includes a global server, an edge server, an edge client, and a third-party trusted platform. The method can obtain personalized non-intrusive power load detection models for different regions, and at the same time, to reduce the communication overhead of the model, an edge server is added; in view of the problem that the model is easily deviated due to data differences in the early stage of hierarchical federated learning, an edge client self-distillation technology is proposed, and the historical optimal model of the edge client is used to guide the current model.
[0023] (2) The present invention can reduce the risk of data leakage in traditional non-intrusive power load detection models. In traditional model training, data needs to be transmitted locally, which may cause data leakage risks during data transmission. There is also a certain risk of data leakage in centralized databases. In the present invention, data can be stored locally, so the model can be trained, and an encryption process is designed to ensure the secure transmission of model gradient information. This ensures data security. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1is a flow chart of a method for obtaining a user personalized model;
[0025] Figure 2 is a schematic diagram of the present invention;
[0026] Figure 3 is the hour dimension encoding for time information extraction in the present invention;
[0027] Figure 4 is the week dimension code for time information extraction in the present invention;
[0028] Figure 5 It is the seasonal dimension encoding of the time information extraction in the present invention;
[0029] Figure 6 It is a key flow diagram between the third-party trusted platform and the receiver and sender in the present invention;
[0030] Figure 7 It is a self-distillation model architecture diagram of the edge client in the present invention;
[0031] Figure 8 This is the edge client self-distillation flow chart of the present invention. DETAILED DESCRIPTION
[0032] The present invention is further described and illustrated below in conjunction with specific embodiments. The embodiments are merely exemplary of the present disclosure and do not define the scope of limitation. The technical features of each embodiment of the present invention may be combined accordingly without conflicting with each other.
[0033] The roles of the present invention mainly include global servers, edge servers, edge clients and third-party trusted platforms. The important responsibility of the global server is to use the customized PFedCS aggregation to obtain the user personalized model. The main responsibility of the edge server is to use FedProx aggregation to obtain the aggregated model. The main responsibility of the edge client is data preprocessing and model self-distillation training. The third-party trusted platform is mainly responsible for generating the public and private keys of the corresponding roles and distributing them.
[0034] The specific flow chart and architecture of the method for obtaining a user personalized model of the present invention are as follows: Figure 1 and Figure 2 shown.
[0035] The user personalized model of the present invention is obtained through the following steps:
[0036] 1) The global server encrypts and distributes the global model stored therein at the current moment to the corresponding multiple edge servers, and the edge servers receive the global model and then encrypt and distribute it to their respective multiple edge clients; wherein the global model at the initial moment is obtained based on the total power load data of users in one or more regions and the power load data of each electrical appliance of the users;
[0037] 2) The edge client uses the obtained model as a local model, trains the local model, obtains the trained local model, obtains the model update parameters of the trained local model, and encrypts the model update parameters and transmits them to the edge server; wherein, when the local model is a global model at the initial moment, the trained local model is obtained based on the total power load data of the local users in the edge client and the power load data of each electrical appliance of the local users;
[0038] 3) The edge server receives the model update parameters input by all edge clients and performs model aggregation on the model update parameters and the model stored in the edge server at the current moment to obtain an updated model, and transmits the updated model to the edge client, and repeats steps 2) and 3) until the set number of rounds. The result of the last round of model aggregation in the edge server is the edge global model;
[0039] 4) The edge server obtains the model update gradient information of the edge global model compared to the global model input to the edge server by the global server in the current round, and encrypts the model update gradient information and sends it to the global server;
[0040] 5) The global server receives the model update gradient information sent by all edge servers, and performs model aggregation on the model update gradient information sent by each edge server and the global model stored in the global server at the current moment, to obtain multiple updated global models, and repeats steps 1) to 5) for a preset number of rounds. The result obtained by model aggregation in the global server in the last round of cycles is the user personalized model of each edge server;
[0041] 6) The global server encrypts and distributes the user personalized models of each edge server to the corresponding edge server. The edge server receives the respective user personalized models and then encrypts and distributes them to the respective multiple edge clients.
[0042] In a specific embodiment of the present invention, in step 1), the global model at the initial moment is obtained based on the total power load data of users in one or more regions and the power load data of each electrical appliance of the users, and specifically includes the following steps:
[0043] 1a) The total power load data of multiple users in one or more areas and the power load data of each electrical appliance of the users are used as data sets, and the data sets are preprocessed to obtain the first trainable data set; the areas refer to different logical areas and geographical areas, the logical areas refer to a group of areas that require the same user personalized model, and the geographical areas refer to areas divided according to actual geographical locations. For example, if the power consumption habits of two provinces in a logical area are similar, only one user personalized model is needed to divide the two provinces into one area. The geographical area refers to the division according to geographical location, for example, a province can be divided into a region, and a city can also be divided into a region.
[0044] 1a1) The data set includes the user's total power load power value and the power load power value of each electrical appliance of the user. The user's total power load power value and the power load power value of each electrical appliance of the user are sampled to obtain respective data streams, and the starting data of all data streams are aligned. For the data segment of the data stream that is missing for less than 3 minutes, forward filling is performed, and for the data segment of the data stream that is missing for more than 3 minutes, zero value filling is performed;
[0045] 1a2) Normalize the total power load value and the power load value of each electrical appliance in all data streams, that is,
[0046]
[0047] x′ is the normalized total power load power value or the normalized power load power value of each electrical appliance; x represents the input total power load power value or the power load power value of each electrical appliance; x min is the minimum value of the total power load power values input or the minimum value of the power load power values of the electrical appliances input; max The maximum value among the input total power load values or the maximum value among the input power load values of the electrical appliances;
[0048] 1a3) respectively encoding the time information corresponding to the normalized total power load power value and the time information corresponding to the normalized power load power value of each electrical appliance to obtain respective time information codes, wherein the codes are respectively encoding the season dimension information, the week dimension information and the hour dimension information; for example, for a format such as "2024-04-09 16:32", the season code is converted into 1, the hour code is 16, and the week code is 1;
[0049] 1a4) The normalized total power load value, the normalized power load value of each electrical appliance, and their respective time information codes are combined to obtain a first trainable data set.
[0050] 1b) using the first trainable dataset to train the BERT4NILM model to obtain a centralized model;
[0051] 1 c ) Use the centralized model as the teacher model and the Bi-LSTM model as the student model to perform knowledge distillation. The student model after knowledge distillation is the global model.
[0052] Among them, the centralized model is used as the teacher model, and the Bi-LSTM model is used as the student model for knowledge distillation, and its loss is:
[0053] L=αL soft +βL hard (1)
[0054] Among them, α and β are hyperparameters, L soft is the difference between the predictions of the teacher model and the student model calculated using the KL (Kullback-Leibler, relative entropy) divergence, L hard is the difference between the student model prediction and the true label calculated using the cross entropy loss function.
[0055]
[0056]
[0057]
[0058]
[0059]
[0060] Among them, v i is the logits of the teacher model for the i-th class, i∈(1,N); v k is the logits of the teacher model for the kth class, k∈(1,N); T is the temperature; z i is the logits of the student model for the i-th class, z k is the logits of the student model for the kth class; is the softmax output value of the teacher model for the i-th class at temperature T, is the softmax output value of the student model for the i-th class at temperature T, N is the total number of labels, c i Refers to the true label value of the i-th category.
[0061] In a specific embodiment of the present invention, the step 2) is specifically:
[0062] When the edge server transmits the global model at the initial moment to the edge client, the edge client uses the global model at the initial moment input by the edge server as the local model, and pre-processes the total power load data of the local users in the edge client and the power load data of each electrical appliance of the local users to obtain a second trainable data set, and uses the second trainable data set to train the local model in the edge client to obtain a trained local model, and the edge client obtains the model update parameters of the trained local model and encrypts the model update parameters of the trained local model and transmits them to the respective edge servers;
[0063] When the model transmitted by the edge server to the edge client is not the global model at the initial moment, the edge client uses the model input by the edge server as the local model, and uses the historical optimal local model as the teacher model, and uses the local model at the current moment as the student model for self-distillation. The edge server obtains the local model after this training, and the edge client obtains the model update parameters of the local model after this training and encrypts the model update parameters of the local model after this training and transmits them to the edge server.
[0064] The edge client uses the model received at the current moment as the local model. The edge client locally records the optimal model as the teacher model and uses the local model of this round as the student model to let the student model learn the output probability distribution of the teacher model. Its loss function is the same as the loss function when performing knowledge distillation. The specific process of the client work is as follows
[0065] Step 1: Determine whether there is a teacher model. If not, jump to step 2.
[0066] Step 2: Save the current model as the teacher model and skip the following steps;
[0067] Step 3: Read the teacher model and perform knowledge distillation;
[0068] Step 4: Compare the distilled student model with the teacher model. If it is better than the teacher model, save the current distilled student model as the teacher model.
[0069] In the present invention, the total power load data of local users in the edge client and the power load data of each electrical appliance of the local user are preprocessed to obtain a second trainable data set, and the second trainable data set is used to train the local model in the corresponding edge client, specifically:
[0070] a) the total power load data of the local users in the edge client includes the total power load power value of the local users, the power load data of each electrical appliance of the local users includes the power load power value of each electrical appliance of the local users, the total power load power value and the power load power value of each electrical appliance are sampled to obtain respective data streams, and the starting data of all data streams are aligned, and forward filling is performed for data segments of the data stream that are missing for less than 3 minutes, and zero filling is performed for data segments of the data stream that are missing for more than 3 minutes;
[0071] b) normalizing the total power load value and the power load value of each electrical appliance in all data streams, that is,
[0072]
[0073] y′ is the normalized total power load power value or the normalized power load power value of each electrical appliance; y represents the input total power load power value or the power load power value of each electrical appliance; y min is the minimum value among the total power load power values input or the minimum value among the power load power values of the electrical appliances input; max The maximum value among the input total power load values or the maximum value among the input power load values of the electrical appliances;
[0074] c) respectively encoding the time information corresponding to the normalized total power load power value and the time information corresponding to the normalized power load power value of each electrical appliance to obtain respective time information codes, wherein the codes are respectively encoding the seasonal dimension information, the weekly dimension information and the hourly dimension information;
[0075] d) combining the normalized total power load power value, the normalized power load power value of each electrical appliance, and their respective time information codes to obtain a second trainable data set;
[0076] e) The second trainable data set obtained by the edge client itself is used to train its own local model.
[0077] In step 3) of the present invention, the edge server receives the model update parameters input by all edge clients and uses the FedProx method to perform model aggregation on the model update parameters and the model stored in the edge server at the current moment to obtain an updated global model.
[0078] In the present invention, the client first encrypts the model update parameters using the edge client private key, and then encrypts them again using the edge server public key, and sends the model update parameter ciphertext to the edge server, thereby ensuring the security of the update gradient information and authenticating the edge client.
[0079] In the present invention, the global server uses a custom PFedCS algorithm to generate a personalized model. The server uses the cosine similarity algorithm for the gradient update transmitted from each edge server to calculate the similarity between each edge server. In the non-independent and identically distributed scenario, FedAvg relies on the amount of data to allocate weights, which is disadvantageous for clients with small amounts of data. Therefore, FedAvg is improved and the concept of similarity is introduced. The overall process is listed as follows:
[0080] 5.1) The global server receives multiple model update gradient information sent by multiple edge servers, and uses the cosine similarity algorithm to calculate the similarity between any two edge servers, that is,
[0081]
[0082] Among them, s ij Update the similarity of gradient information for the models of edge servers i and j; is the model update gradient information of edge server i; The model update gradient information of edge server j;
[0083] 5.2) Calculate the weight value between any two edge servers, that is,
[0084]
[0085] Among them, weight ij is the weight value of edge server i and edge server j; a is a hyperparameter; n j is the sum of the data volume participating in the local model training in the edge clients under edge server j; N is the number of edge servers;
[0086] 5.3) The global server calculates the updated global model that will be input to each edge server in this round according to the weight value; that is,
[0087]
[0088] Among them, S_W i is the updated global model that will be input to edge server i in this round. The hour dimension information is encoded in the hour dimension. The specific encoding result is as follows: Figure 3As shown, when the hour dimension information is 1, the hour dimension is encoded as 1; when the hour dimension information is 24, the hour dimension is encoded as 24; the encoding result of the hour dimension information is equal to the hour dimension information, and the hour dimension information is the hour data corresponding to the current moment.
[0089] The information of the week dimension is encoded in the week dimension. The specific encoding result is as follows Figure 4 As shown, when the week dimension is 1, the week dimension is encoded as 0, and the encoding result of the week dimension information is equal to the week dimension information minus 1, and the week dimension information refers to the day of the week at the current moment.
[0090] The information of the quarterly dimension is coded in the quarterly dimension. The specific coding results are as follows: Figure 5 As shown, when the seasonal dimension information is 1, 2, or 12, the encoding result of the seasonal dimension information is 0; when the seasonal dimension information is 3, 4, or 5, the encoding result of the seasonal dimension information is 1; when the seasonal dimension information is 6, 7, or 8, the encoding result of the seasonal dimension information is 2; when the seasonal dimension information is 9, 10, or 11, the encoding result of the seasonal dimension information is 3.
[0091] In the present invention, the encryption scheme uses Figure 6 In the key transfer scheme, a third-party trusted platform generates corresponding public and private keys for the global server, edge server and edge client, wherein the receiver in this invention includes the global server, edge server and edge client, and the sender in this invention includes the global server, edge server and edge client. The global server, as the sender, sends the encrypted initialization model to the edge server. The edge server, as the sender, then forwards the model to the edge client.
[0092] The edge client decrypts the received data. Figure 7 It is the edge client self-distillation model architecture. The edge client follows Figure 8 The self-distillation flow chart of the edge client performs self-distillation operation. After the edge client is trained, it acts as the sender and sends the gradient update parameters to the edge server. After receiving the edge server, the FedProx algorithm is used to aggregate the model, and the verification set is used to determine whether the edge server has converged. The new aggregated model parameters are sent to the edge client, and this process is repeated until the preset number of training rounds of the edge server is reached. The result of the last round of model aggregation in the edge server is the edge global model.
[0093] As the sender, the edge server sends the model update gradient information to the global server. After receiving it, the global server uses the customized PFedCS algorithm to perform personalized model aggregation, and uses the verification sets of the edge server and the global server to verify whether the global model and the updated global model converge. This process is repeated until the preset number of training rounds is reached.
[0094] In this example, a centralized model is first obtained, and this centralized model is used as the teacher model, and the Bi-LSTM model is used as the student model to perform knowledge distillation. The student model after knowledge distillation is the global model.
[0095] The global model is distributed to edge servers, which in turn distribute it to edge clients.
[0096] The edge client copies the global model as the local model, preprocesses the local data and inputs it into the local model. Since there is no optimal historical model locally at this time, self-distillation is skipped and training is performed directly. The model update parameters compared to the global model are encrypted and sent to the edge server.
[0097] The edge server uses the FedProx algorithm to perform model aggregation operations on the received model update parameters to obtain the updated model, and then distributes the updated model to the edge client.
[0098] After receiving the data, the edge client uses the updated model as the local model of this round, takes the historical optimal local model as the teacher model, performs self-distillation, and encrypts the model update parameters of the model compared with the updated model and sends them to the edge server. Repeat the above until the preset number of rounds of the edge server is reached; the result of the model aggregation in the last round of the edge server is the edge global model.
[0099] The edge server encrypts the model update parameters compared to the global model and sends them to the global server. The global server calculates the similarity between the edge servers, calculates the weights based on the similarity, and finally calculates multiple updated global models. The global server then encrypts and distributes the multiple updated global models to the corresponding edge servers. The edge servers receive and store the updated global models, and encrypt and distribute the updated global models to their respective edge clients.
[0100] The edge client copies the updated global model as the local model, uses the historical optimal local model as the teacher model, and uses the local model at the current moment as the student model for self-distillation. Finally, each edge server obtains its own local model after this training. The edge client encrypts the model update parameters of the local model after this training relative to the local model at the current moment and transmits them to their respective edge servers.
[0101] The edge server uses the FedProx algorithm to perform model aggregation operations on the received model update parameters to obtain the updated model, and then distributes the updated model to the edge client.
[0102] After receiving the update, the edge client uses the updated model as the local model of this round, takes the historical optimal local model as the teacher model, performs self-distillation, and encrypts the model update parameters of the model compared with the received updated model and sends them to the edge server. Repeat the above until the preset number of rounds of the edge server is reached; the result of the last round of model aggregation in the edge server is the edge global model.
[0103] The edge server encrypts the model update parameters of the edge global model compared to the model input by the global server in this round and sends them to the global server. The global server calculates the similarity between the edge servers, calculates the weight based on the similarity, and finally calculates the updated global model.
[0104] Repeat the above steps until the preset number of training rounds is reached. The result of model aggregation in the global server in the last round is the user personalized model of each edge server; then send multiple user personalized models to the edge client, and perform load prediction tasks on the edge client.
[0105] The present invention also provides a non-intrusive power load detection system for implementing the method, comprising a global server, an edge server, an edge client and a third-party trusted platform;
[0106] The global server is used to generate and update the global model, and finally obtain multiple user personalized models, and encrypt and distribute the models stored therein to the corresponding multiple edge servers;
[0107] The edge server is used to update the model input by the global server and obtain the model update gradient information, and encrypt and send the model update gradient information to the global server; and receive the model update parameters and generate an updated model and encrypt and transmit the updated model to the edge client;
[0108] The edge client is used to train the local model and generate the model update parameters, and encrypt the model update parameters and send them to the edge server;
[0109] The third-party trusted platform is used to generate the public and private keys of the receiver and the sender and distribute the public and private keys;
[0110] Among them, the multiple user personalized models finally generated by the global server are transmitted to the corresponding edge clients, and the edge clients use their own personalized models to obtain the power load data of each electrical appliance of the user. The above-mentioned embodiments only express several implementation methods of the present invention, and the description is relatively specific and detailed, but it cannot be understood as a limitation on the scope of the patent of the present invention. For ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.
Claims
1. A non-intrusive power load detection method based on hierarchical federated learning, characterized in that: The steps include: Inputting the user's total power load data into the corresponding user personalized model to obtain the power load data of each electrical appliance of the user; The user personalized model is obtained through the following steps: 1) The global server encrypts and distributes the global model stored therein at the current moment to the corresponding multiple edge servers, and the edge servers receive the global model and then encrypt and distribute it to their respective multiple edge clients; wherein the global model at the initial moment is obtained based on the total power load data of users in one or more regions and the power load data of each electrical appliance of the users; 2) The edge client uses the obtained model as a local model, trains the local model, obtains the trained local model, obtains the model update parameters of the trained local model, and encrypts the model update parameters and transmits them to the edge server; wherein, when the local model is a global model at the initial moment, the trained local model is obtained based on the total power load data of the local users in the edge client and the power load data of each electrical appliance; 3) The edge server receives the model update parameters input by all edge clients and performs model aggregation on the model update parameters and the model stored in the edge server at the current moment to obtain an updated model, and transmits the updated model to the edge client, and repeats steps 2) and 3) until the set number of rounds. The result of the last round of model aggregation in the edge server is the edge global model; 4) The edge server obtains the model update gradient information of the edge global model compared to the global model input to the edge server by the global server in the current round, and encrypts the model update gradient information and sends it to the global server; 5) The global server receives the model update gradient information sent by all edge servers, and performs model aggregation on the model update gradient information sent by each edge server and the global model stored in the global server at the current moment, to obtain multiple updated global models, and repeats steps 1) to 5) for a preset number of rounds. The result obtained by model aggregation in the global server in the last round of cycles is the user personalized model of each edge server; 6) The global server encrypts and distributes the user personalized models of each edge server to the corresponding edge server. The edge server receives the respective user personalized models and then encrypts and distributes them to the respective multiple edge clients.
2. The method according to claim 1, characterized in that In step 1), the global model at the initial moment is obtained based on the total power load data of users in one or more regions and the power load data of each electrical appliance of the users; specifically, it includes the following steps: 1a) taking the total power load data of multiple users in one or more areas and the power load data of each electrical appliance of the users as a data set, preprocessing the data set to obtain a first trainable data set; 1b) using the first trainable dataset to train the BERT4NILM model to obtain a centralized model; 1c) Using the centralized model as the teacher model and the Bi-LSTM model as the student model, knowledge distillation is performed. The student model after knowledge distillation is the global model.
3. The method according to claim 2, characterized in that The step 1a) is specifically as follows: 1a1) The data set includes the user's total power load power value and the power load power value of each electrical appliance of the user. The user's total power load power value and the power load power value of each electrical appliance of the user are sampled to obtain respective data streams, and the starting data of all data streams are aligned. For the data segment of the data stream that is missing for less than 3 minutes, forward filling is performed, and for the data segment of the data stream that is missing for more than 3 minutes, zero value filling is performed; 1a2) Normalize the total power load value and the power load value of each electrical appliance in all data streams, that is, x′ is the normalized total power load power value or the normalized power load power value of each electrical appliance; x represents the input total power load power value or the power load power value of each electrical appliance; x min The minimum value among the total power load power values input or the minimum value among the power load power values of the electrical appliances input; x max The maximum value among the input total power load values or the maximum value among the input power load values of the electrical appliances; 1a3) respectively encoding the time information corresponding to the normalized total power load power value and the time information corresponding to the normalized power load power value of each electrical appliance to obtain respective time information codes, wherein the codes are respectively encoding the seasonal dimension information, the weekly dimension information and the hourly dimension information; 1a4) The normalized total power load value, the normalized power load value of each electrical appliance, and their respective time information codes are combined to obtain a first trainable data set.
4. The method according to claim 1, characterized in that: The step 2) is specifically as follows: When the edge server transmits the global model at the initial moment to the edge client, the edge client uses the global model at the initial moment input by the edge server as the local model, and pre-processes the total power load data of the local users in the edge client and the power load data of each electrical appliance of the local users to obtain a second trainable data set, and uses the second trainable data set to train the local model in the edge client to obtain a trained local model, and the edge client obtains the model update parameters of the trained local model and encrypts the model update parameters of the trained local model and transmits them to the respective edge servers; When the model transmitted by the edge server to the edge client is not the global model at the initial moment, the edge client uses the model input by the edge server as the local model, and uses the historical optimal local model as the teacher model, and uses the local model at the current moment as the student model for self-distillation. The edge client obtains the local model after this training, obtains the model update parameters of the local model after this training, and encrypts the model update parameters of the local model after this training and transmits them to the edge server.
5. The method according to claim 4, characterized in that The total power load data of local users in the edge client and the power load data of each electrical appliance of the local users are preprocessed to obtain a second trainable data set, and the second trainable data set is used to train the local model in the corresponding edge client, specifically: a) the total power load data of the local users in the edge client includes the total power load power value of the local users, the power load data of each electrical appliance of the local users includes the power load power value of each electrical appliance of the local users, the total power load power value and the power load power value of each electrical appliance are sampled to obtain respective data streams, and the starting data of all data streams are aligned, and forward filling is performed for data segments of the data stream that are missing for less than 3 minutes, and zero filling is performed for data segments of the data stream that are missing for more than 3 minutes; b) normalizing the total power load value and the power load value of each electrical appliance in all data streams, that is, y′ is the normalized total power load power value or the normalized power load power value of each electrical appliance; y represents the input total power load power value or the power load power value of each electrical appliance; y min The minimum value among the total power load power values input or the minimum value among the power load power values of the electrical appliances input; y max The maximum value among the input total power load values or the maximum value among the input power load values of the electrical appliances; c) respectively encoding the time information corresponding to the normalized total power load power value and the time information corresponding to the normalized power load power value of each electrical appliance to obtain respective time information codes, wherein the codes are respectively encoding the seasonal dimension information, the weekly dimension information and the hourly dimension information; d) combining the normalized total power load power value, the normalized power load power value of each electrical appliance, and their respective time information codes to obtain a second trainable data set; e) The second trainable data set obtained by the edge client itself is used to train its own local model.
6. The method according to claim 1, characterized in that In the step 3), the edge server receives the model update parameters input by all edge clients and uses the FedProx method to perform model aggregation on the model update parameters to obtain an updated global model.
7. The method according to claim 1, characterized in that In step 5), the global server receives the model update gradient information sent by all edge servers, and performs model aggregation on the model update gradient information sent by each edge server and the global model stored in the global server at the current moment, to obtain multiple updated global models, specifically: (5.1) The global server receives multiple model update gradient information sent by multiple edge servers and uses the cosine similarity algorithm to calculate the similarity between any two edge servers, that is, Among them, s ij Update the similarity of gradient information for the models of edge servers i and j; is the model update gradient information of edge server i; The model update gradient information of edge server j; (5.2) Calculate the weight value between any two edge servers, that is, Among them, weight ij is the weight value of edge server i and edge server j; a is a hyperparameter; n j is the sum of the data volume participating in the local model training in the edge clients under edge server j; N is the number of edge servers; (5.3) The global server calculates the updated global model that will be input to each edge server in this round according to the weight value; that is, Among them, S_W i is the updated global model that will be input to edge server i in this round.
8. The method according to claim 3 or 5, characterized in that: The seasonal dimension information is encoded as follows: when the seasonal dimension information is 1, 2, or 12, the encoding result of the seasonal dimension information is 0; when the seasonal dimension information is 3, 4, or 5, the encoding result of the seasonal dimension information is 1; when the seasonal dimension information is 6, 7, or 8, the encoding result of the seasonal dimension information is 2; when the seasonal dimension information is 9, 10, or 11, the encoding result of the seasonal dimension information is 3; The week dimension information is encoded as follows: the encoding result of the week dimension information is equal to the week dimension information minus 1, and the week dimension information refers to the day of the week at the current moment; The hour dimension information is encoded as follows: the encoding result of the hour dimension information is equal to the hour dimension information, and the hour dimension information is the hour data corresponding to the current moment.
9. A non-intrusive power load detection system for implementing the method of claim 7, characterized in that: Including global servers, edge servers, edge clients and third-party trusted platforms; The global server is used to generate and update the global model, and finally obtain multiple user personalized models, and encrypt and distribute the models stored therein to the corresponding multiple edge servers; The edge server is used to update the model input by the global server and obtain the model update gradient information, and encrypt the model update gradient information and send it to the global server; and receiving the model update parameters and generating an updated model and encrypting and transmitting the updated model to the edge client; The edge client is used to train the local model and generate the model update parameters, and encrypt the model update parameters and send them to the edge server; The third-party trusted platform is used to generate the public and private keys of the receiver and the sender and distribute the public and private keys; Among them, multiple user personalized models finally generated by the global server are transmitted to the corresponding edge clients, and the edge clients use their own personalized models to obtain the power load data of each electrical appliance of the user.
Citation Information
Cited By
Power consumption data hierarchical federation learning method and device, equipment and storage medium
CN119443307A
Power model deployment method and device based on federated learning and knowledge distillation
CN119536771A
Non-intrusive load monitoring method and system based on knowledge distillation algorithm
CN119830999A
