Control model training method and device, control model application method and device, equipment and storage medium
Patent Information
- Application Number
- CN202510349595.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-07-29
AI Technical Summary
The existing smart home systems rely on centralized cloud servers to process user data, which poses the risk of user privacy leakage and insufficient personalization.
The federated learning method is adopted to train the global model parameters locally through smart home devices, and weighted aggregation is performed according to personalized factors, and the global model is updated to realize personalized smart home control.
Protect user privacy without uploading original data, and provide personalized smart home control strategies for different families' living habits and device usage patterns to improve user satisfaction.
Smart Images

Figure CN120386182A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of smart home, and particularly relates to a control model training method, application method, device, equipment and storage medium. Background Art
[0002] With the increasing popularity of smart home in modern life, more and more household appliances have computing capabilities. The smart home system realizes the automatic and intelligent control of the home environment by connecting various smart home devices, such as smart lights, smart thermostats, smart security cameras, etc.
[0003] However, the existing smart home systems rely on a centralized cloud server to process and analyze user data and formulate control strategies. This method has the risk of user privacy leakage and insufficient personalization. Summary of the Invention
[0004] This application provides a control model training method, application method, device, equipment and storage medium to solve the technical problems of user privacy leakage and insufficient personalization.
[0005] In a first aspect, this application provides a control model training method applied to a smart home device. The method includes:
[0006] Receiving global model parameters sent by a server, and performing model training according to the global model parameters to obtain local model parameters;
[0007] Determining a personalized factor according to the local model parameters; the personalized factor is used to characterize the difference degree between the local model and the global model;
[0008] Uploading the local model parameters and the personalized factor to the server, so that the server performs weighted aggregation on the local model parameters according to the local model parameters and the personalized factor, and updates the global model parameters;
[0009] Receiving the updated global model parameters sent by the server, and training the local model according to the updated global model parameters to obtain a target control model.
[0010] Optionally, the performing model training according to the global model parameters to obtain local model parameters includes:
[0011] Generating a local model according to the global model parameters;
[0012] Performing model training on the local model according to the local operation data of the smart home device to obtain local model parameters; the local operation data includes historical setting data, environmental data and user behavior data of the smart home device.
[0013] Optionally, training the local model based on the local operation data of the smart home device to obtain local model parameters includes:
[0014] Determining a target loss function of the local model according to the control task type of the smart home device;
[0015] Inputting the local operation data into the local model to obtain a loss value of the target loss function;
[0016] Updating the parameters of the local model through a gradient descent algorithm until the loss value is less than or equal to a preset loss threshold to obtain the local model parameters.
[0017] Optionally, determining a personalized factor according to the local model parameters includes:
[0018] Determining an improvement parameter of the local model according to the difference between the loss value of the current round of iteration and the loss value of the previous round of iteration; the improvement parameter is used to characterize the performance improvement degree of the local model after the current round of iteration;
[0019] Calculating the Euclidean distance between the local model parameters and the global model parameters to obtain a model parameter difference value;
[0020] Calculating a personalized factor according to the improvement parameter, the model parameter difference value, and the number of smart home devices.
[0021] Optionally, uploading the local model parameters and the personalized factor to the server includes:
[0022] Encrypting the local model parameters and the personalized factor and then uploading them to the server; or,
[0023] Adding noise to the local model parameters and the personalized factor and then uploading them to the server.
[0024] Optionally, the method further includes:
[0025] Determining the contribution degree of multiple parameters in the local model parameters through the least absolute error;
[0026] Regarding the parameters with a contribution degree less than a preset contribution degree threshold as parameters to be pruned;
[0027] Setting the parameters to be pruned to zero to obtain pruned model parameters;
[0028] Uploading the pruned model parameters to the server.
[0029] Second aspect, the present application provides a control model training method, which is applied to a server. The method includes:
[0030] Sending preset global model parameters to each smart home device, so that each smart home device performs model training according to the global model parameters to obtain local model parameters of each smart home device; determining a personalized factor according to the local model parameters; the personalized factor is used to characterize the difference degree between the local model and the global model;
[0031] Receiving the local model parameters and the personalized factor uploaded by each smart home device;
[0032] According to the local model parameters and the personalized factor, performing weighted aggregation on the local model parameters to update the global model parameters;
[0033] Sending the updated global model parameters to each smart home device, so that each smart home device trains the local model according to the updated global model parameters to obtain a target control model.
[0034] Optionally, the performing weighted aggregation on the local model parameters according to the local model parameters and the personalized factor to update the global model parameters includes:
[0035] Determining weight values corresponding to each smart home device according to the personalized factor; the larger the personalized factor of the smart home device, the larger the weight value;
[0036] Performing weighted aggregation on the local model parameters according to the weight values to update the global model parameters.
[0037] Third aspect, the present application provides a model application method based on federated learning, which is applied to a smart home device. The method includes:
[0038] Obtaining a control task of the smart home device;
[0039] Inputting the control task into the target control model to obtain output control parameters, where the target control model is trained by the training method of the above control model.
[0040] Fourth aspect, the present application provides a control model training device, which is applied to a smart home device. The device includes:
[0041] A first training module, configured to receive global model parameters sent by a server and perform model training according to the global model parameters to obtain local model parameters;
[0042] A determination module, configured to determine a personalized factor according to the local model parameters; the personalized factor is used to characterize the difference degree between the local model and the global model;
[0043] A first sending module, configured to upload the local model parameters and the personalized factor to the server, so that the server performs weighted aggregation on the local model parameters according to the local model parameters and the personalized factor, and updates the global model parameters;
[0044] A second training module, configured to receive the updated global model parameters sent by the server, and train the local model according to the updated global model parameters to obtain a target control model.
[0045] In a fifth aspect, the present application provides a control model application device, which is applied to a smart home device. The device includes:
[0046] An acquisition module, configured to acquire a control task of the smart home device;
[0047] A model application module, configured to input the control task into the target control model to obtain an output control parameter, where the target control model is trained by the training method of the above control model.
[0048] In a sixth aspect, the present application provides an electronic device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor, wherein the processor implements the above control model training method when executing the program.
[0049] In a seventh aspect, the present application provides a readable storage medium, when instructions in the readable storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the above control model training method.
[0050] In the embodiments of the present application, on the one hand, since federated learning is adopted to train the smart home control model without uploading the original home data, user privacy can be protected. On the other hand, by setting a personalized factor, the model error caused by the differences in living habits and device usage patterns of different families can be solved, and personalized smart home control strategies can be provided for the unique needs of different families, improving user satisfaction. Description of the Drawings
[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0052] Figure 1 It is a schematic diagram of an overall system architecture provided by an embodiment of the present application;
[0053] Figure 2 It is a flowchart of steps of a control model training method provided by an embodiment of the present application;
[0054] Figure 3 It is a flowchart of steps of another control model training method provided by an embodiment of the present application;
[0055] Figure 4 It is a flowchart of steps of yet another control model training method provided by an embodiment of the present application;
[0056] Figure 5 It is a flowchart of steps of a control model application method provided by an embodiment of the present application;
[0057] Figure 6 It is a structural diagram of a control model training device provided by an embodiment of the present application;
[0058] Figure 7 It is a structural diagram of another control model training device provided by an embodiment of the present application;
[0059] Figure 8 It is a structural diagram of a control model application device provided by an embodiment of the present application;
[0060] Figure 9 It is a structural diagram of an electronic device provided by an embodiment of the present application;
[0061] Figure 10 It is a structural diagram of another electronic device provided by an embodiment of the present application. Detailed implementation manners
[0062] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0063] The terms "first", "second", etc. in the description and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments of this application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same category and do not limit the number of objects. For example, the first object can be one or multiple. In addition, "and / or" in the description and claims means at least one of the connected objects, and the character " / ", generally represents an "or" relationship between the associated objects before and after.
[0064] In the description of the present disclosure, unless otherwise specified, "a plurality" means two or more, and other quantifiers are similar; "at least one (item)", "one (item) or more (items)" or similar expressions refer to any combination of these items (items), including any combination of a single item (item) or plural items (items). For example, at least one (item) a can represent any number of a; for another example, one (item) or more (items) of a, b, and c can represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, c can be single or multiple; "and / or" is an association relationship describing associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. Among them, A and B can be singular or plural. The character " / " represents an "or" relationship between the associated objects before and after.
[0065] In the embodiments of the present disclosure, although the operations or steps are described in a specific order in the drawings, it should not be understood that these operations or steps are required to be performed in the specific order shown or in a serial order, or that all the operations or steps shown are required to be performed to obtain the desired result. In the embodiments of the present disclosure, these operations or steps can be performed serially; they can also be performed in parallel; or a part of these operations or steps can be performed.
[0066] With the rapid development of Internet of Things and artificial intelligence technologies, smart home devices are becoming increasingly popular in modern life. The smart home system realizes the automated and intelligent control of the home environment by connecting various smart home devices, such as smart lights, smart thermostats, smart security cameras, etc.
[0067] However, traditional smart home systems usually rely on centralized cloud servers to process and analyze user data, and then formulate control strategies. This centralized approach has the following problems: 1. The risk of user privacy leakage: The home environment data and behavior habits of users are uploaded to the cloud server, and there is a risk of data being stolen or misused. 2. Insufficient personalization: It is difficult for the centralized model to fully adapt to the unique needs of each family, resulting in a poor user experience. 3. Data transmission delay: The communication between the device and the cloud may cause delays in control instructions, affecting real-time performance.
[0068] Currently, many smart home privacy protection methods and frameworks avoid the leakage of users' privacy data by minimizing the upload of privacy data of smart home devices to the device manufacturers or cloud servers. Among them, the privacy protection technology based on Federated Learning (FL) not only reduces the upload of users' privacy data, but also can use the local data of each device to train the model on the premise of protecting user privacy, and effectively utilizes the data of edge devices for machine learning calculations to provide better intelligent services for users.
[0069] However, due to the differences in living habits and device usage patterns among different families, traditional federated learning methods still have performance bottlenecks in personalized smart home control.
[0070] To solve the above technical problems, this application provides a control model training method, application method, device, equipment and storage medium. The following will detail the specific implementation manners of this application with reference to the accompanying drawings.
[0071] First, an application scenario related to the embodiments of this application will be described.
[0072] See Figure 1 , the control model training method provided by the embodiments of this application can be applied to the hardware environment composed of multiple smart home devices 10 and a server 20 as shown in Figure 1 .
[0073] In this embodiment, the multiple smart home devices 10 may include: PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projection device, smart TV, smart clothes hanger, smart curtain, smart audio and video, smart socket, smart speaker, smart sound box, smart fresh air device, smart kitchen and bathroom equipment, smart bathroom equipment, smart floor sweeping robot, smart window cleaning robot, smart mopping robot, smart air purification device, smart steam box, smart microwave oven, smart kitchen water heater, smart purifier, smart water dispenser, smart camera, etc.
[0074] In this embodiment, multiple smart home devices 10 are connected via a network, and the server 20 is connected to the multiple smart home devices 10 via the network. Among them, the network may include: a wired network, a wireless network. The wired network may include: a wide area network, a metropolitan area network, a local area network. The wireless network may include: WIFI (Wireless Fidelity), Bluetooth.
[0075] Optionally, multiple smart home devices 10 are located in different households, and the server 20 may be a cloud server.
[0076] Optionally, multiple smart home devices 10 are located in the same household, and the server 20 may also be deployed on the smart gateway. By building in computing power on the home gateway to provide computing power support for the terminal devices inside the home, it is possible to effectively reduce the upgrade and replacement of the terminal application devices, meeting the home's demand for computing power resources without incurring high costs.
[0077] Optionally, the server 20 may also be deployed on the smart router. Multiple smart home devices 10 can be connected to the smart router through wired or wireless communication to receive tasks issued by the smart router. In some embodiments, multiple smart home devices 10 communicate with the server 20 through the TCP / IP protocol.
[0078] In some embodiments, the terminal 30 is connected to the server 20 via the network and accesses the server 20 through an access interface. Exemplarily, the terminal 30 may be a smart phone and a computer, and the access interface includes but is not limited to the World Wide Web (web), a mobile application (APP), and a mini-program. The terminal 30 can access the server 20 through the web, APP, and mini-program.
[0079] The following provides a detailed description of the control model training method provided by the embodiments of the present application.
[0080] Figure 2 is a flowchart of the steps of a control model training method provided by the embodiments of the present application. This control model training method is applied to Figure 1 the smart home device 10 in Figure 2 as shown, and the method may include the following steps.
[0081] Step 101, receive the global model parameters issued by the server, and perform model training according to the global model parameters to obtain local model parameters.
[0082] In the embodiments of the present application, the global model parameters issued by the server may be the initial parameters of the global model.
[0083] Optionally, the global model can be a neural network model for smart home control (Convolutional Neural Networks, CNN), such as a neural network model for predicting user device usage habits, a neural network model for environmental parameter adjustment, etc.
[0084] Step 102: Determine the personalization factor according to the local model parameters.
[0085] In the embodiments of the present application, the personalization factor is used to characterize the degree of difference between the local model and the global model.
[0086] In some embodiments, step 102 may include: calculating the personalization factor according to the Euclidean distance between the local model parameters and the global model parameters.
[0087] It should be noted that for a smart home device with a greater degree of difference between the local model and the global model, the personalized needs of the smart home device may be stronger, and the personalization factor is larger.
[0088] In some embodiments, for a smart home device with more data samples locally stored in step 102, the personalization factor is larger.
[0089] Step 103: Upload the local model parameters and the personalization factor to the server.
[0090] In the embodiments of the present application, step 103 enables the server to perform weighted aggregation on the local model parameters according to the local model parameters and the personalization factor, and update the global model parameters.
[0091] In the embodiments of the present application, after local training is completed, the smart home device extracts the model parameters or relevant update information that needs to be uploaded from the locally trained model, such as the weights and gradients of the model, and uploads them to the server.
[0092] It can be understood that the data distributions and model training situations of different smart home devices may vary. In the embodiments of the present application, an adaptive aggregation method is adopted to dynamically adjust the weights of different smart home devices in parameter aggregation according to the performance of the smart home devices, so as to improve the performance of the global model.
[0093] In some embodiments, step 103 may include: encrypting the local model parameters and the personalization factor and then uploading them to the server; or adding noise to the local model parameters and the personalization factor and then uploading them to the server.
[0094] In some other embodiments, before step 103, it may further include: compressing and quantifying the local model parameters and personalized factors to reduce the communication volume. For example, using sparsification techniques, only uploading the non-zero elements and their indices in the model parameters; or quantifying the model parameters into low-precision data types.
[0095] Step 104, receive the updated global model parameters sent by the server, and train the local model according to the updated global model parameters to obtain the target control model.
[0096] In the embodiments of the present application, the global model will send the initially generated model to each smart home device at the beginning; after each smart home device completes training, the server collects the local model parameters of each trained smart home device, updates the global model parameters using a personalized aggregation algorithm according to the clustering situation of the local model parameters, integrates and forms a new global model, sends the new global model to each smart home device and continues the next round of training until the model converges, and uses the converged model as the target control model.
[0097] Exemplarily, set the termination condition of the iteration in advance, such as the termination condition being reaching a preset number of training rounds, the performance index of the global model on the validation set reaching a certain threshold, the change amount of the model parameters being less than a certain threshold, etc. During the iterative training process, after each round of training iteration is completed, the smart home device will check whether the termination condition is met; if it is met, stop training and output the final global model; if it is not met, continue with the next round of local training, model uploading, model aggregation, and model distribution operations until the termination condition is met.
[0098] In some embodiments, training the local model according to the updated global model parameters in step 104 to obtain the target control model may include: using the updated global model parameters to replace the local global model parameters; performing multiple rounds of training until the model converges or reaches a predetermined number of training rounds.
[0099] In summary, in this embodiment, on the one hand, since federated learning is used to train the smart home control model without uploading the original home data, user privacy can be protected. On the other hand, by setting personalized factors, the model error caused by the differences in living habits and device usage patterns of different families can be solved, and personalized smart home control strategies can be provided for the unique needs of different families, improving user satisfaction.
[0100] Figure 3 It is a flowchart of the steps of another control model training method provided by the embodiments of the present application. This control model training method is applied to a server, as Figure 3 shown, and this method may include the following steps.
[0101] Step 201: Send the global model parameters to each smart home device.
[0102] In the embodiment of the present application, each smart home device trains a model according to the global model parameters to obtain the local model parameters of each smart home device; according to the local model parameters, a personalized factor is determined; the personalized factor is used to characterize the difference degree between the local model and the global model.
[0103] In the embodiment of the present application, the global model parameters in Step 201 are obtained by initializing a preset global model.
[0104] In some embodiments, before Step 201, the above control model training method may further include: establishing a secure communication channel between each smart home device and the server to ensure the security and reliability of data transmission, such as using an encrypted communication protocol to guarantee communication security.
[0105] Step 202: Receive the local model parameters and personalized factors uploaded by each smart home device.
[0106] In some embodiments, the local model parameters and personalized factors are encrypted or added with noise. Step 203 may include: decrypting the local model parameters and personalized factors; or removing the noise in the local model parameters and personalized factors.
[0107] In other embodiments, the local model parameters and personalized factors are compressed or quantized parameters. Step 203 may further include: decompressing or inverse quantizing the local model parameters and personalized factors.
[0108] Step 203: Weightedly aggregate the local model parameters according to the local model parameters and personalized factors, and update the global model parameters.
[0109] In the embodiment of the present application, the weights can be determined by evaluating the quality metrics of the data of each smart home device, such as the accuracy, integrity, diversity, etc. of the data.
[0110] For example, a higher weight is given to a smart home device with high data quality, and a lower weight is given otherwise.
[0111] Step 204: Send the updated global model parameters to each smart home device so that each smart home device trains the local model according to the updated global model parameters to obtain the target control model.
[0112] In the embodiments of the present application, the global model will send the initially generated model to each smart home device at the beginning; after each smart home device finishes training, the server collects the local model parameters of each trained smart home device, updates the global model parameters using a personalized aggregation algorithm according to the clustering situation of the local model parameters, integrates them to form a new global model, sends the new global model to each smart home device and continues the next round of training until the model converges.
[0113] In summary, in this embodiment, on the one hand, since federated learning is used to train the smart home control model without uploading the original home data, user privacy can be protected. On the other hand, by setting a personalized factor, the model error caused by the differences in the living habits and device usage patterns of different families can be solved, and personalized smart home control strategies can be provided for the unique needs of different families, improving user satisfaction.
[0114] Figure 4 It is a flowchart of the steps of a control model training method provided by an embodiment of the present application, applied Figure 1 in the overall system architecture shown, as Figure 4 shown, the method may include the following steps.
[0115] Step 301: The smart home device generates a local model according to the global model parameters.
[0116] In the embodiments of the present application, the smart home device instantiates a model with the same structure as the global model locally according to the received global model parameters, and loads the global model parameters into the local model as the starting point for local model training.
[0117] Step 302: The smart home device trains the local model according to the local operation data of the smart home device to obtain local model parameters.
[0118] In the embodiments of the present application, the local operation data includes the historical setting data, environmental data, and user behavior data of the smart home device.
[0119] It can be understood that the local operation data is the local data collected by the smart home device during its daily operation.
[0120] Exemplarily, the device usage data may include: the switch time, brightness adjustment, color temperature setting, etc. of the smart lamp, and the environmental data may include: indoor temperature, humidity, light intensity, air quality, etc.; the user behavior data may include: the activity area and usage preferences of the user at different time periods.
[0121] In some embodiments, before step 302, the above control model training method may further include: preprocessing the local operation data, where the preprocessing includes data cleaning, data normalization, and feature extraction.
[0122] In some embodiments, step 302 may use the gradient descent algorithm to minimize the loss function of the local model.
[0123] In some embodiments, step 302 includes:
[0124] Sub-step 3021: Determine the target loss function of the local model according to the control task type of the smart home device.
[0125] In the embodiments of the present application, sub-step 3021 may include: matching the target loss function of the smart home device according to the correspondence between the control task type and the loss function. Wherein, the correspondence may be preset and stored in the smart home device.
[0126] In some embodiments, the correspondence between the control task type and the loss function may include: when the control task type is temperature control, the loss function is Mean Squared Error (MSE) or Mean Absolute Error (MAE); when the control task type is classification control, the loss function is Cross Entropy Loss Function; when the control task type is predictive control, the loss function is Mean Absolute Error (MAE); when the control task type is anomaly detection, the loss function is Huber loss.
[0127] It can be understood that different control tasks require different loss functions because different control tasks have different goals and requirements. For example, if the control task is temperature control, more attention may be paid to the average error between the predicted value and the actual value, and in this case, MSE is more appropriate; but if the control task needs to handle outliers or data with large noise, Huber loss may be better because it is less sensitive to outliers and can reduce the impact of noisy data. Another example is that for tasks with high real-time requirements, since time series prediction is involved, a custom loss function can be defined, combining time dependence, such as adding a time decay factor to the loss.
[0128] Exemplarily, the smart home device is a smart thermostat, the control task is temperature control, and the target loss function of the smart thermostat is MSE or MAE; the smart home device is a smart light, the control task is to predict the user's preference for turning the light on and off, and the target loss function of the smart light is the cross-entropy loss function; the smart home device is a smart security camera, the control task is to detect intrusion events, and the target loss function of the smart security camera is the Huber loss.
[0129] For example, the smart home device is a smart thermostat, the loss function is MSE, and the target loss function of the smart home device is:
[0130]
[0131] where x n is the input feature, y n is the target value, and f(x n :) is the predicted output of the model.
[0132] Sub-step 3022: Input the local running data into the local model to obtain the loss value of the target loss function.
[0133] In some embodiments, sub-step 3022 may include: inputting the local running data into the local model, and performing forward propagation calculation to obtain the output of the local model; calculating the error between the output of the local model and the true label according to the loss function to obtain the loss value.
[0134] Sub-step 3023: Update the parameters of the local model through the gradient descent algorithm until the loss value is less than or equal to the preset loss threshold to obtain the local model parameters.
[0135] In some embodiments, sub-step 3023 may include: when the loss value is greater than the preset loss threshold, updating the parameters of the local model through the gradient descent algorithm; until the loss value is less than or equal to the preset loss threshold, and taking the model parameters corresponding to the loss value as the local model parameters.
[0136] Exemplarily, updating the parameters of the local model through the gradient descent algorithm can be achieved in the following manner:
[0137]
[0138] where θ i represents the parameters of the local model in this round of iteration, θ t represents the parameters of the local model in the previous round of iteration, represents the gradient of the model parameters, and η represents the learning rate, which can be set according to actual needs.
[0139] Step 303: The smart home device determines the improvement parameters of the local model according to the difference between the loss value of the current iteration and the loss value of the previous iteration.
[0140] In the embodiments of the present application, the improvement parameters are used to characterize the degree of performance improvement of the local model after the current iteration.
[0141] Exemplarily, the improvement parameters can be calculated in the following manner:
[0142]
[0143] Among them, δ i represents the improvement parameters, L i (θ t ) represents the loss value of the current iteration, and L i (θ i ) represents the loss value of the previous iteration.
[0144] In some embodiments, the smart home device with a significant improvement in the performance of the local model on the validation set compared to the previous round of training or the global model has a higher personalization factor.
[0145] Exemplarily, the accuracy of the global model is 75%, the accuracy of the local model of device C is 82% (an increase of 7%), which is significantly better than the global model; the accuracy of device A has increased from 70% to 78% (an increase of 8%), exceeding the assumed threshold (5%), indicating a significant performance improvement; among 10 devices, the accuracy improvements of devices D, E, and F are 12%, 9%, and 8% respectively, ranking among the top three, and are regarded as significant improvements.
[0146] Step 304: The smart home device calculates the Euclidean distance between the local model parameters and the global model parameters to obtain the model parameter difference value.
[0147] Exemplarily, the model parameter difference value is ‖θ i -θ t ‖2, where θ i represents the parameters of the local model in the current iteration, θ t represents the parameters of the local model in the previous iteration, and ‖·‖2 represents the calculation of the Euclidean distance (two-norm).
[0148] Step 305: The smart home device calculates the personalization factor according to the improvement parameters, the model parameter difference value, and the number of smart home devices.
[0149] In the embodiments of the present application, the number of smart home devices can be the number of smart home devices participating in model training.
[0150] Exemplarily, the personalization factor α i of smart home device i can be obtained in the following manner:
[0151]
[0152] Among them, δ i represents the improvement parameter of the smart home device i, and δ j represents the improvement parameter of the smart home device j, and θ i represents the parameter of the local model of the smart home device i in this round of iteration, and θ t represents the parameter of the local model of the smart home device i in the previous round of iteration. ‖·‖2 represents calculating the Euclidean distance (two-norm), and K represents the number of smart home devices participating in the training.
[0153] Step 306: The smart home device uploads the local model parameter and the personalized factor to the server.
[0154] The method of this step has been described in the foregoing step 103 and will not be elaborated here.
[0155] In some embodiments, step 306 may include:
[0156] Sub-step 3061: Encrypt the local model parameter and the personalized factor and then upload them to the server.
[0157] Exemplarily, sub-step 3061 may include: The encryption adopts the homomorphic encryption method, and its principle is to allow direct calculations (such as addition, multiplication) on the encrypted data, and the result after decryption is the same as the result calculated on the plaintext data. The local device homomorphically encrypts the model parameter update (gradient) and uploads it to the server. The server aggregates the updates of all devices in the encrypted state and can complete the global model update without decryption. The data transmission process is protected by the standard encryption protocol (TLS1.3).
[0158] Sub-step 3062: Add noise to the local model parameter and the personalized factor and then upload them to the server.
[0159] In the embodiments of the present application, noise addition is mainly used to achieve differential privacy and prevent the original data from being inferred through parameter updates.
[0160] In the embodiments of the present application, there is an "or" relationship between sub-step 3061 and sub-step 3062.
[0161] In some embodiments, before step 306, the above method may further include:
[0162] Sub-step S1: Determine the contribution degrees of multiple parameters in the local model parameter through the least absolute error.
[0163] Sub-step S2: Use the parameters with contribution degrees less than the preset contribution degree threshold as the parameters to be pruned.
[0164] Sub-step S3: Set the parameter to be pruned to zero to obtain the pruned model parameters.
[0165] It should be noted that model pruning is an important technology for optimizing deep learning models. By reducing redundant computing nodes (such as unimportant weights and neurons), the model complexity and inference overhead can be reduced, and the performance of the deep learning model in the door lock system can be optimized, especially for models running on edge computing units.
[0166] Exemplarily, methods such as the L1 norm are used to evaluate the importance of weights and convolution kernels, and a contribution threshold is set to obtain parameters with a lower contribution to the door lock function. Then, through structured pruning, redundant convolution kernels or channels are removed to optimize the model structure to adapt to the computing power limitations of embedded edge computing units. After pruning, the system restores the model performance through fine-tuning training, and further combines quantization techniques (such as converting floating-point operations to the INT8 format) to reduce the computing burden and storage requirements.
[0167] Correspondingly, step 306 may include: uploading the pruned model parameters to the server.
[0168] Step 307: Determine the weight values corresponding to each smart home device according to the personalized factor.
[0169] In the embodiments of the present application, the larger the personalized factor of the smart home device, the larger the weight value.
[0170] Exemplarily, the weight value β i corresponding to the smart home device i can be obtained in the following manner:
[0171]
[0172] where δ i represents the improvement parameter of the smart home device i, δ j represents the improvement parameter of the smart home device j, θ i represents the parameter of the local model of the smart home device i in this round of iteration, θ t represents the parameter of the local model of the smart home device i in the previous round of iteration, ‖·‖2 represents calculating the Euclidean distance (two-norm), and K represents the number of smart home devices participating in the training.
[0173] By the above technical means, calculating the Euclidean distance between the local model parameters and the global model parameters can solve the problem of the decline in model performance caused by the difference in data distribution of different household devices.
[0174] Step 308: Perform weighted aggregation on the local model parameters according to the weight values to update the global model parameters.
[0175] Exemplarily, the following formula can be used to update the global model:
[0176]
[0177] where θ i represents the parameters of the local model in the current iteration, and θ t represents the parameters of the local model in the previous iteration, and Δθ i represents the change amount of the local model.
[0178] Step 309, the server sends the updated global model parameters, so that the smart home device trains the local model according to the updated global model parameters to obtain the target control model.
[0179] The method of this step has been described in the foregoing step 204 and will not be elaborated here.
[0180] In the embodiments of the present application, each smart home device replaces the local global model parameters according to the updated global model parameters; performs multiple rounds of training until the model meets the termination conditions, where the termination conditions may include convergence or reaching a predetermined number of training rounds.
[0181] For example, the conditions for model convergence are mainly judged by the change of the loss function or the validation performance. Common criteria include: First, the change range of the loss function: When the value of the loss function changes less than a certain preset threshold in several consecutive training epochs, it can be considered that the model has converged. For example, if the loss value changes less than 0.001 in 5 consecutive epochs, stop training. Second, the performance of the validation set no longer improves: In addition to the loss of the training set, the performance of the validation set (such as accuracy, F1 score, etc.) can also be used to judge whether the model has converged. If the performance of the validation set does not improve in several consecutive epochs or even starts to decline, it may mean that the model has overfitted, and training should be stopped at this time. Third, the gradient approaches zero: During the optimization process, if the gradient of the model approaches zero, it means that the parameter update becomes very small, and the model has found a local minimum or saddle point.
[0182] Another example is that the predetermined number of training rounds is usually set according to the size of the dataset, the complexity of the model, and the limitation of computing resources. Small datasets and simple models: may require fewer rounds, such as 10 to 50 rounds. Large datasets and complex models: may require more rounds, such as 100 to 500 rounds or more. Dynamic adjustment: Using early stopping can dynamically adjust the number of training rounds, that is, terminate training in advance when the performance of the validation set no longer improves, rather than a fixed number of rounds.
[0183] In summary, in the embodiments of the present application, through the personalized aggregation algorithm, the model can adapt to the unique needs of each family and improve the control effect. And by optimizing the model update and aggregation strategies, the communication volume is reduced and the training efficiency is improved.
[0184] Figure 5 FIG. 4 is a flowchart of steps of a method for applying a control model provided by an embodiment of the present application, which is applied to a smart home device, such as Figure 5 shown, and the method may include the following steps.
[0185] Step 401, obtain a control task of the smart home device.
[0186] In the embodiments of the present application, the control task may include: temperature control, processing outliers or data with large noise, time series prediction, etc.
[0187] Exemplarily, when the smart home device is a smart thermostat, the control task is temperature control; when the smart home device is a smart lamp, the control task is to predict the user's preference for turning the lamp on and off; when the smart home device is a smart security camera, the control task is to detect intrusion events.
[0188] Step 402, input the control task into the target control model to obtain the output control parameters.
[0189] In the embodiments of the present application, the target control model is trained by the training method of the above-mentioned control model.
[0190] In the embodiments of the present application, the trained local model can predict the user's control requirements.
[0191] Exemplarily, when the smart home device is a smart thermostat, different families have different preferences for the indoor temperature, and are affected by factors such as season, time, and human activities. The smart thermostat collects data such as indoor and outdoor temperature, humidity, and user adjustment history as local data. After completing the local model training, it can predict the temperature settings of the user in different situations.
[0192] In summary, in the embodiments of the present application, through the personalized aggregation algorithm, the model can adapt to the unique needs of each family and improve the control effect. And by optimizing the model update and aggregation strategies, the communication volume is reduced and the training efficiency is improved.
[0193] Figure 6 FIG. 5 is a structural diagram of a control model training device provided by an embodiment of the present application. The control model training device is applied to a smart home device. The control model training device 500 may include:
[0194] The first training module 501 is configured to receive the global model parameters sent by the server and perform model training according to the global model parameters to obtain local model parameters;
[0195] A determination module 502, configured to determine a personalized factor according to local model parameters; the personalized factor is used to characterize the difference degree between the local model and the global model;
[0196] A first sending module 503, configured to upload the local model parameters and the personalized factor to a server, so that the server performs weighted aggregation on the local model parameters according to the local model parameters and the personalized factor, and updates the global model parameters;
[0197] A second training module 504, configured to receive the updated global model parameters sent by the server, and train the local model according to the updated global model parameters to obtain a target control model.
[0198] Optionally, the first training module 501 includes:
[0199] A model generation sub-module, configured to generate a local model according to the global model parameters;
[0200] A model training sub-module, configured to perform model training on the local model according to the local operation data of the smart home device to obtain local model parameters; the local operation data includes historical setting data, environmental data, and user behavior data of the smart home device.
[0201] Optionally, the model training sub-module includes:
[0202] A first determination unit, configured to determine a target loss function of the local model according to the control task type of the smart home device;
[0203] A second determination unit, configured to input the local operation data into the local model to obtain a loss value of the target loss function;
[0204] An update unit, configured to update the parameters of the local model through a gradient descent algorithm until the loss value is less than or equal to a preset loss threshold, to obtain local model parameters.
[0205] Optionally, the determination module 502 includes:
[0206] A first determination sub-module, configured to determine an improvement parameter of the local model according to the difference between the loss value of this round of iteration and the loss value of the previous round of iteration; the improvement parameter is used to characterize the performance improvement degree of the local model after this round of iteration;
[0207] A second determination sub-module, configured to calculate the Euclidean distance between the local model parameters and the global model parameters to obtain a model parameter difference value;
[0208] A third determination sub-module, configured to calculate a personalized factor according to the improvement parameter, the model parameter difference value, and the number of smart home devices.
[0209] Optionally, the first sending module 503 includes:
[0210] The first sending sub-module is configured to encrypt and upload the local model parameters and the personalized factor to the server; or,
[0211] The second sending sub-module is configured to add noise to the local model parameters and the personalized factor and then upload them to the server.
[0212] Optionally, the control model training device 500 further includes:
[0213] The contribution degree determination module 502 is configured to determine the contribution degrees of multiple parameters in the local model parameters through the least absolute error;
[0214] The parameter determination module 502 is configured to use the parameters with contribution degrees less than a preset contribution degree threshold as the parameters to be pruned;
[0215] The parameter pruning module is configured to set the parameters to be pruned to zero to obtain the pruned model parameters;
[0216] The parameter sending module is configured to upload the pruned model parameters to the server.
[0217] For the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For related parts, please refer to the partial description of the method embodiments.
[0218] Figure 7 It is a structural diagram of a control model training device provided by an embodiment of the present application. The control model training device is applied to a server. The control model training device 600 may include:
[0219] The second sending module 601 is configured to send preset global model parameters to each smart home device, so that each smart home device performs model training according to the global model parameters to obtain local model parameters of each smart home device; determine a personalized factor according to the local model parameters; the personalized factor is used to characterize the difference degree between the local model and the global model;
[0220] The receiving module 602 is configured to receive the local model parameters and the personalized factor uploaded by each smart home device;
[0221] The updating module 603 is configured to perform weighted aggregation on the local model parameters according to the local model parameters and the personalized factor to update the global model parameters;
[0222] The third sending module 604 is configured to send the updated global model parameters to each smart home device, so that each smart home device trains the local model according to the updated global model parameters to obtain a target control model.
[0223] Optionally, the update module 603 includes:
[0224] A fourth determination sub-module, configured to determine a weight value corresponding to each smart home device according to a personalization factor; the larger the personalization factor of the smart home device, the larger the weight value;
[0225] A parameter update sub-module, configured to perform weighted aggregation on local model parameters according to the weight values and update global model parameters.
[0226] For the apparatus embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For related parts, please refer to the partial description of the method embodiments.
[0227] Figure 8 FIG. is a structural diagram of a control model application apparatus provided by an embodiment of the present application. The control model application apparatus is applied to smart home devices. The control model application apparatus 700 may include:
[0228] An acquisition module 701, configured to acquire a control task of a smart home device;
[0229] A model application module 702, configured to input the control task into a target control model to obtain output control parameters, where the target control model is trained by the training method of the above control model.
[0230] For the apparatus embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For related parts, please refer to the partial description of the method embodiments.
[0231] The present application further provides an electronic device. Refer to Figure 9 , the electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 809, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0232] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, telephone call, data communication, camera operation, and recording operation. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 809 and the processing component 802.
[0233] The memory 804 is used to store various types of data to support the operation of the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, multimedia, and the like. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk.
[0234] The power supply component 806 provides power to various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
[0235] The multimedia component 809 includes an interface that provides an output interface between the electronic device 800 and the user. In some embodiments, the interface may include a liquid crystal display (LCD) and a touch panel (TP). If the interface includes a touch panel, the interface can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can not only sense the boundaries of touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operations. In some embodiments, the multimedia component 809 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a multimedia mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
[0236] The audio component 810 is used to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC) that is used to receive external audio signals when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 further includes a speaker for outputting audio signals.
[0237] The input / output (I / O) interface 812 provides an interface between the processing component 802 and a peripheral interface module, which can be a keyboard, a click wheel, buttons, etc. These buttons can include, but are not limited to: a home button, a volume button, a power-on button, and a lock button.
[0238] The sensor assembly 814 includes one or more sensors for providing status assessments of various aspects for the electronic device 800. For example, the sensor assembly 814 can detect the on / off state of the electronic device 800, the relative positioning of components, such as the display and keypad of the electronic device 800. The sensor assembly 814 can also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0239] The communication component 816 is configured to facilitate communication between the electronic device 800 and other devices in a wired or wireless manner. The electronic device 800 can access a wireless network based on communication standards, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0240] In an exemplary embodiment, the electronic device 800 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for implementing a control model training method or application method provided in the embodiments of the present application.
[0241] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the above instructions can be executed by a processor 820 of the electronic device 800 to complete the above method. For example, the non-transitory storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0242] Figure 10is a block diagram of an electronic device 900 according to another embodiment of the present invention. For example, the electronic device 900 may be provided as a server. Referring to Figure 10 , the electronic device 900 includes a processing component 922, which further includes one or more processors, and memory resources represented by a memory 932 for storing instructions executable by the processing component 922, such as application programs. The application programs stored in the memory 932 may include one or more modules each corresponding to a set of instructions. In addition, the processing component 922 is configured to execute instructions to perform a control model training method or an application method provided in an embodiment of the present application.
[0243] The electronic device 900 may also include a power component 926 configured to perform power management of the electronic device 900, a wired or wireless network interface 950 configured to connect the electronic device 900 to a network, and an input / output (I / O) interface 858. The electronic device 900 may operate based on an operating system stored in the memory 932, such as Windows Server TM, Mac OS XTM, Unix TM, Linux TM, Free BSDTM or the like.
[0244] In an embodiment of the present application, the memory 932 can be used to store software programs and various data. The memory 932 mainly includes a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area can store an operating system, applications or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 932 can include a volatile memory or a non-volatile memory, or the memory 932 can include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link dynamic random access memory (SLDRAM), and a direct rambus random access memory (DRRAM). The memory 932 in the embodiment of the present application includes but is not limited to these and any other suitable types of memories.
[0245] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above modem processor may not be integrated into the processor.
[0246] The present application also provides a readable storage medium. When the instructions in the readable storage medium are executed by the processor of the electronic device, the electronic device can execute the control model training method or application method in the foregoing embodiments.
[0247] The embodiments of the present application also provide a computer program product. The program product is stored in a storage medium and is executed by at least one processor to implement the various processes of the control model training method or the application method embodiment as described above, and can achieve the same technical effects. To avoid repetition, it will not be described in detail here.
[0248] It should be noted that all the information and data obtained in the embodiments of the present application are obtained under the authorization of the information / data holder. All actions of obtaining signals, information, or data in the present application are carried out on the premise of complying with the corresponding data protection regulations and policies of the country where it is located and obtaining the authorization given by the owner of the corresponding device.
[0249] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings provided herein. The structure required to construct such systems will be apparent from the above description. In addition, the present application is not directed to any particular programming language. It should be understood that the content of the present application described herein can be implemented using various programming languages, and the description of the specific language above is to disclose the best mode of the present application.
[0250] In the specification provided herein, a large number of specific details are set forth. However, it can be understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures, and technologies have not been shown in detail so as not to obscure the understanding of this specification.
[0251] Similarly, it should be understood that, in order to streamline the present application and assist in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be construed as reflecting the intention that the claimed present application requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, the inventive aspects lie in less than all the features of the single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate embodiment of the present application.
[0252] Those skilled in the art can understand that the modules in the devices in the embodiments can be adaptively changed and set in one or more devices different from the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and in addition, they can be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive, any combination can be adopted to combine all the features disclosed in this specification (including the accompanying claims, abstract and drawings) and all the processes or units of any method or device so disclosed. Unless otherwise explicitly stated, each feature disclosed in this specification (including the accompanying claims, abstract and drawings) can be replaced by an alternative feature that provides the same, equivalent or similar purpose.
[0253] Each component embodiment of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) can be used in practice to implement some or all of the functions of some or all of the components in the sorting device according to the present application. The present application can also be implemented as a device or device program for executing part or all of the methods described herein. Such a program for implementing the present application can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0254] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and those skilled in the art can design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application can be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In the unit claims listing several devices, several of these devices can be embodied by the same item of hardware. The use of the words first, second, and third, etc. does not denote any order. These words can be interpreted as names.
[0255] The user information involved in the present application (including but not limited to the user's device information, user personal information, etc.), relevant data, etc. are all information authorized by the user or authorized by all parties.
[0256] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.
[0257] The foregoing is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present application shall be included within the protection scope of the present application. The foregoing is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present application, and all should be covered by the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for controlling model training, characterized in that, Applied to a smart home device, the method includes: Receiving global model parameters issued by a server, and performing model training according to the global model parameters to obtain local model parameters; Determining a personalized factor according to the local model parameters; the personalized factor is used to characterize the difference degree between the local model and the global model; Uploading the local model parameters and the personalized factor to the server, so that the server performs weighted aggregation on the local model parameters according to the local model parameters and the personalized factor to update the global model parameters; Receiving the updated global model parameters sent by the server, and training the local model according to the updated global model parameters to obtain a target control model, obtaining a target control model.
2. The method according to claim 1, wherein The performing model training according to the global model parameters to obtain local model parameters includes: Generating the local model according to the global model parameters; Performing model training on the local model according to the local operation data of the smart home device to obtain local model parameters; the local operation data includes historical setting data, environmental data, and user behavior data of the smart home device.
3. The method according to claim 2, characterized in that The performing model training on the local model according to the local operation data of the smart home device to obtain local model parameters includes: Determining a target loss function of the local model according to the control task type of the smart home device; Inputting the local operation data into the local model to obtain a loss value of the target loss function; Updating the parameters of the local model through a gradient descent algorithm until the loss value is less than or equal to a preset loss threshold to obtain the local model parameters.
4. The method according to claim 1, characterized in that The determining a personalized factor according to the local model parameters includes: Determining an improvement parameter of the local model according to the difference between the loss value of the current iteration and the loss value of the previous iteration; the improvement parameter is used to characterize the performance improvement degree of the local model after the current iteration; Calculating the Euclidean distance between the local model parameters and the global model parameters to obtain a model parameter difference value; Calculating a personalized factor according to the improvement parameter, the model parameter difference value, and the number of smart home devices.
5. The method according to claim 1, characterized in that The uploading the local model parameters and the personalized factor to the server includes: Encrypting the local model parameters and the personalized factor and uploading them to the server; or, Adding noise to the local model parameters and the personalized factor and uploading them to the server.
6. The method according to claim 1, characterized in that The method further includes: Determining the contribution degrees of multiple parameters in the local model parameters through least absolute error; Regarding the parameters with contribution degrees less than a preset contribution degree threshold as parameters to be pruned; Setting the parameters to be pruned to zero to obtain pruned model parameters; Uploading the pruned model parameters to the server.
7. A method for controlling model training, characterized in that, Applied to a server, the method includes: Distributing preset global model parameters to each smart home device so that each smart home device performs model training based on the global model parameters to obtain local model parameters for each smart home device; determining a personalization factor based on the local model parameters; the personalization factor is used to represent the degree of difference between the local model and the global model; Receiving the local model parameters and the personalized factors uploaded by each smart home device; Performing weighted aggregation on the local model parameters according to the local model parameters and the personalized factors, and updating the global model parameters; The updated global model parameters are sent to each smart home device, so that each smart home device trains the local model according to the updated global model parameters to obtain the target control model.
8. The method according to claim 7, wherein The step of performing weighted aggregation on the local model parameters according to the local model parameters and the personalized factors to update the global model parameters includes: Determine a weight value corresponding to each smart home device according to the personalized factor; the larger the personalized factor of the smart home device, the greater the weight value; The local model parameters are weightedly aggregated according to the weight values to update the global model parameters.
9. A model application method based on federated learning, characterized in that: Applied to smart home devices, the method includes: Get control tasks for smart home devices; The control task is input into a target control model to obtain output control parameters, and the target control model is trained by the control model training method described in any one of claims 1 to 8.
10. A control model training device, characterized in that: Applied to smart home devices, the device includes: A first training module is configured to receive global model parameters sent by a server, and perform model training based on the global model parameters to obtain local model parameters; A determination module, configured to determine a personalized factor based on the local model parameters; the personalized factor is used to characterize the degree of difference between the local model and the global model; a first sending module, configured to upload the local model parameters and the personalized factors to the server, so that the server performs weighted aggregation on the local model parameters according to the local model parameters and the personalized factors, and updates the global model parameters; The second training module is used to receive the updated global model parameters sent by the server, and train the local model according to the updated global model parameters to obtain a target control model.
11. A control model application device, characterized in that, Applied to smart home devices, the device includes: Acquisition module, used to obtain control tasks of smart home devices; A model application module is used to input the control task into a target control model to obtain output control parameters, wherein the target control model is trained by the control model training method according to any one of claims 1 to 8.
12. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the control model training method according to any one of claims 1 to 6 or 7 to 8 is implemented.
13. A readable storage medium, characterized in that, When the instructions or transactions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the control model training method described in any one of claims 1 to 6 or claims 7 to 8.
Citation Information
Cited By
Behavior adaptive continuous identity authentication method and system
CN121389091A
A behavior-adaptive continuous authentication method and system
CN121389091B