A smart lock user behavior model updating method and system based on federated learning

By aggregating data among smart lock devices through federated learning, the problem of insufficient performance of smart lock user behavior models is solved, enabling more accurate and robust model updates and avoiding data leakage.

CN122394918APending Publication Date: 2026-07-14SHENZHEN KAADAS INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN KAADAS INTELLIGENT TECH CO LTD
Filing Date
2026-04-29
Publication Date
2026-07-14

Smart Images

  • Figure CN122394918A_ABST
    Figure CN122394918A_ABST
Patent Text Reader

Abstract

The embodiment of the present disclosure provides a kind of intelligent lock user behavior model updating method and system based on federal learning, multiple intelligent lock devices are respectively locally trained to basic global model, obtain intelligent lock user behavior model, respectively the parameter of intelligent lock user behavior model is encrypted and handled, obtains encrypted local parameter, the respective corresponding encrypted local parameter is sent to edge server, multiple encrypted local parameters are aggregated and calculated in trusted execution environment by edge server, generate global model update parameter, send global model update parameter to multiple intelligent lock devices, multiple intelligent lock devices fuse and fine-tune global model update parameter with intelligent lock user behavior model, to update intelligent lock user behavior model, can make full use of the collaborative learning advantage of multiple intelligent lock devices, overcome the bottleneck of limited data volume of single intelligent lock device, and train more robust and accurate intelligent lock user behavior model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of smart lock technology, and in particular to a method and system for updating a smart lock user behavior model based on federated learning. Background Technology

[0002] With the rapid development of IoT technology, smart locks, as crucial entry-level devices in smart homes, smart buildings, and smart security, are evolving towards greater intelligence, personalization, and security. Modern smart locks not only need to fulfill basic unlocking functions but also require advanced features such as user behavior recognition, anomaly detection, and adaptive learning. To enhance user experience and security, smart locks need to continuously learn users' normal behavioral patterns, including unlocking habits, biometric usage patterns, and time-related behaviors, thereby establishing personalized user behavior models.

[0003] However, the amount of data from a single smart lock device is limited and unevenly distributed, making it difficult to train a good general model. Furthermore, the data silos between different devices are severe, making it impossible to effectively utilize the advantages of cross-device collaborative learning. The performance of smart lock user behavior models still needs to be improved. Summary of the Invention

[0004] The main objective of this disclosure is to propose a method and system for updating a smart lock user behavior model based on federated learning, which can improve the performance of the smart lock user behavior model.

[0005] To achieve the above objectives, a first aspect of this disclosure proposes a method for updating a smart lock user behavior model based on federated learning, comprising: Send the basic global model to multiple smart lock devices participating in federated learning; The system receives encrypted local parameters sent by each of the smart lock devices. The encrypted local parameters are obtained by the smart lock device in response to the model update trigger condition, by training the basic global model locally based on locally collected sample user behavior data to obtain a smart lock user behavior model, and by encrypting the parameters of the smart lock user behavior model. In a trusted execution environment, multiple encrypted local parameters are aggregated and calculated to generate global model update parameters; The global model update parameters are sent to multiple smart lock devices so that the smart lock devices can verify the global model update parameters. When the global model update parameters are verified, the global model update parameters are fused and fine-tuned with the smart lock user behavior model to update the smart lock user behavior model.

[0006] In some embodiments, the step of aggregating and calculating multiple encrypted local parameters in a trusted execution environment to generate global model update parameters includes: The encrypted local parameters are security verified in a trusted execution environment. When the security verification of the encrypted local parameters passes, the encrypted local parameters are decrypted to obtain the decrypted local parameters. Verify the integrity of the decryption local parameters. When it is determined that the decryption local parameters are complete, determine the device weight corresponding to each of the smart lock devices. Based on the device weight, multiple encrypted local parameters are aggregated and calculated to generate global model update parameters.

[0007] In some embodiments, the step of aggregating and calculating multiple encrypted local parameters according to the device weight to generate global model update parameters includes: Obtain the device characteristics of each of the smart lock devices; Based on the device characteristics, cluster analysis is performed on multiple smart lock devices to obtain at least one device cluster; Within the same device cluster, multiple encrypted local parameters are aggregated and calculated based on the device weights to generate global model update parameters corresponding to the device cluster.

[0008] In some embodiments, the step of performing cluster analysis on multiple smart lock devices based on the device characteristics to obtain at least one device cluster includes: Based on the device characteristics, device data distribution analysis is performed on each of the smart lock devices to obtain the device distribution attributes of the smart lock devices; Based on the device distribution attributes, cluster analysis is performed on multiple smart lock devices to obtain at least one device cluster.

[0009] To achieve the above objectives, a second aspect of this disclosure proposes a method for updating a smart lock user behavior model based on federated learning, comprising: Multiple smart lock devices participating in federated learning receive the underlying global model sent by the edge server; In response to the model update trigger condition, multiple smart lock devices participating in federated learning train the basic global model locally based on locally collected sample user behavior data to obtain smart lock user behavior models. Each of the smart lock devices encrypts the parameters of the smart lock user behavior model to obtain encrypted local parameters, and sends the corresponding encrypted local parameters to the edge server so that the edge server can aggregate and calculate the encrypted local parameters in a trusted execution environment to generate global model update parameters. Multiple smart lock devices respectively receive the global model update parameters sent by the edge server, verify the global model update parameters, and when the global model update parameters pass the verification, fuse and fine-tune the global model update parameters with the smart lock user behavior model to update the smart lock user behavior model.

[0010] In some embodiments, the multiple smart lock devices participating in federated learning train the basic global model locally based on locally collected sample user behavior data to obtain a smart lock user behavior model, including: The various smart lock devices each preprocess their respective sample user behavior data and divide it into multiple batches; For each training round, iterative training is performed on the basic global model by traversing multiple batches of sample user behavior data until a smart lock user behavior model is obtained, wherein the iterative training includes: Based on the sample user behavior data of the current batch, the prediction result is obtained by forward propagation through the smart lock user behavior model; The target loss is calculated based on the prediction results and the true labels of the current batch. Backpropagation is then performed based on the target loss to calculate the gradient of the parameters of the smart lock user behavior model. The gradient is pruned, and differential privacy noise is added to the pruned gradient according to a preset privacy protection parameter. The parameters of the base global model are then updated using the gradient with added noise and a preset learning rate.

[0011] In some embodiments, the model update method further includes: The updated smart lock user behavior model is used to detect anomalies in the real-time collected target user behavior data and obtain an anomaly score level. The corresponding security response strategy is executed according to the anomaly score level. The security response strategy includes at least one of normal access, requiring secondary authentication, or immediate locking and alarm.

[0012] In some embodiments, the step of using the updated smart lock user behavior model to perform anomaly detection on the real-time collected target user behavior data and obtain an anomaly score level includes: Feature extraction is performed on real-time collected target user behavior data to obtain target features; The target features are input into the updated smart lock user behavior model for anomaly detection to obtain anomaly detection results and the confidence level of the anomaly detection results; Based on the target user behavior data and preset rules, a rule check is performed to obtain the rule check result; The target user's behavior data is matched with the corresponding historical behavior habits to obtain the habit matching result; An anomaly score is obtained by weighted fusion of the anomaly detection results, the confidence level, the rule check results, and the habit matching results.

[0013] To achieve the above objectives, a third aspect of the present disclosure proposes a smart lock user behavior model update system based on federated learning, including multiple smart lock devices participating in federated learning and an edge server. The edge server is used to send a basic global model to multiple smart lock devices; Multiple smart lock devices are used to respond to model update triggering conditions, and based on locally collected sample user behavior data, perform local training on the basic global model to obtain smart lock user behavior models, encrypt the parameters of the smart lock user behavior models to obtain encrypted local parameters, and send the corresponding encrypted local parameters to the edge server. The edge server is also used to receive encrypted local parameters sent by each of the smart lock devices, perform aggregate calculations on multiple encrypted local parameters in a trusted execution environment, generate global model update parameters, and send the global model update parameters to multiple smart lock devices. The multiple smart lock devices are also used to verify the global model update parameters. When the global model update parameters pass the verification, the global model update parameters are fused and fine-tuned with the smart lock user behavior model to update the smart lock user behavior model.

[0014] To achieve the above objectives, a fourth aspect of the present disclosure provides a storage medium, which is a computer-readable storage medium storing a computer program that, when executed by a processor, implements the smart lock user behavior model update method described in the first or second aspect of the embodiments.

[0015] The beneficial effects of the embodiments disclosed herein include: Multiple smart lock devices, responding to model update trigger conditions, train a basic global model locally based on locally collected sample user behavior data to obtain smart lock user behavior models. The parameters of each smart lock user behavior model are then encrypted to obtain encrypted local parameters, which are sent to an edge server to prevent parameter leakage. The edge server receives these encrypted local parameters from each smart lock device and performs aggregation calculations on them in a trusted execution environment to generate global model update parameters. These global model update parameters are then sent to the multiple smart lock devices, which verify them. When the global model update parameters pass verification, they are fused and fine-tuned with the smart lock user behavior model to update it. Throughout this process, the sample user behavior data remains locally on the smart lock devices, avoiding uploading to the edge server. This approach fully leverages the collaborative learning advantages of multiple smart lock devices, overcoming the bottleneck of limited data volume on a single smart lock device, and training a more robust and accurate smart lock user behavior model, thus improving its performance. Attached Figure Description

[0016] Figure 1 This is a schematic diagram of the smart lock user behavior model update system architecture provided in an embodiment of the present disclosure; Figure 2 This is a flowchart illustrating the smart lock user behavior model update method provided in this embodiment of the disclosure; Figure 3 This is a detailed flowchart of step S203 provided in the embodiments of this disclosure; Figure 4 This is a detailed flowchart of step S303 provided in the embodiments of this disclosure; Figure 5 This is a detailed flowchart of step S402 provided in the embodiments of this disclosure; Figure 6 This is a schematic diagram of non-independent, identically distributed data processing provided in an embodiment of this disclosure; Figure 7 This is a flowchart illustrating the smart lock user behavior model update method provided in this embodiment of the disclosure; Figure 8 This is a detailed flowchart of step S702 provided in the embodiments of this disclosure; Figure 9 This is a schematic diagram illustrating supplementary steps of the method provided in the embodiments of this disclosure; Figure 10 This is a detailed flowchart of step S901 provided in an embodiment of this disclosure; Figure 11 This is a schematic diagram of the overall process provided in the embodiments of this disclosure; Figure 12 This is a schematic diagram of the security and privacy protection mechanism provided in the embodiments of this disclosure. Detailed Implementation

[0017] The accompanying drawings in the embodiments clearly and completely describe the technical solutions in the embodiments of this disclosure. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments in this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0018] It is understood that in the specific embodiments of this disclosure, which involve the retrieval of relevant data, when the above embodiments of this disclosure are applied to specific products or technologies, permission or consent from the subject is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards.

[0019] In this disclosure, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0020] Reference Figure 1 , Figure 1 This is a schematic diagram of the smart lock user behavior model update system architecture provided in this embodiment. This embodiment provides a smart lock user behavior model update system based on federated learning, providing an execution carrier for subsequent method embodiments. It includes four layers: cloud layer, edge layer, device layer, and security layer, as well as the interaction relationships between each layer. The cloud layer is responsible for global management, the edge layer is responsible for model aggregation within a region, the device layer is responsible for local training and data collection, and the security layer provides security guarantees throughout all layers.

[0021] Within the cloud management layer, the cloud management platform manages all edge servers, enabling device registration, status monitoring, version management, and global scheduling. The model repository stores pre-trained basic global models and scenario-specific personalized model versions, distributing initial models and update rules to edge servers. The anomaly monitoring service receives alarm information from the edge and device layers, monitoring system operation status and model update anomalies. The security policy service configures global privacy protection parameters, security rules, and anomaly detection thresholds, distributing them to the edge and device layers for unified execution.

[0022] In the edge layer, edge servers are responsible for the federated learning and collaboration of smart lock devices within the region. This includes distributing the basic global model, receiving encrypted local parameters uploaded by devices, distributing global model update parameters, and connecting to the cloud management platform to report model update status and security events within the region. The Trusted Execution Environment (TEE) provides an isolated and secure operating space for the decryption, verification, and aggregation computation of encrypted local parameters. All sensitive computations are completed entirely within the TEE, ensuring that plaintext model parameters do not leak out of the security boundary.

[0023] The security layer provides end-to-end security for communication and data interaction between the edge server and smart lock devices, supporting the privacy protection and security verification requirements outlined in the patent. Access control enables two-way authentication and permission verification between the device and the edge / cloud, allowing only legally registered devices to access the federated learning process. Encrypted transmission ensures end-to-end encryption of communication data between the device and the edge, preventing parameters from being eavesdropped on or tampered with during transmission. Data anonymization desensitizes model parameters uploaded by the device, and combined with differential privacy technology, further defends against model reverse engineering attacks. Audit trail functionality records operation logs for all device access, model updates, and parameter transmissions, enabling traceability of security events.

[0024] The smart lock device is a terminal device with data acquisition, local computing, security encryption, and network communication capabilities. Specific hardware configurations include: a main control chip using the CYPRESS P6NB series or equivalent, with a main frequency ≥400MHz, equipped with 1MB SRAM and 8MB Flash; integrated fingerprint sensor, face recognition camera, accelerometer, ambient light sensor, microphone, and other behavioral data acquisition units; a communication module supporting Wi-Fi 802.11n and BLE 5.0; and a built-in hardware encryption engine (supporting AES-256 and SHA-256 algorithms), a secure storage area, and a globally unique device identifier.

[0025] The software architecture of a smart lock device, from bottom to top, includes: a hardware abstraction layer, a real-time operating system, a sensor driver layer, a data acquisition module, a local training engine, a privacy protection module, a communication protocol stack, a secure storage module, an anomaly detection module, and a user interface layer. Among these: The data acquisition module is used to collect raw data related to user unlocking behavior, including unlocking habits, biometric usage patterns, time patterns, operation frequency, environmental parameters, etc.; the local training engine is used to perform model training based on local data, and the lightweight training logic is adapted to scenarios with limited device resources; the privacy protection module is used to implement functions such as differential privacy noise addition, model parameter encryption, and secure data storage; the anomaly detection module is used to perform anomaly detection and security response for unlocking behavior in real time based on the trained user behavior model.

[0026] The edge server is deployed within the local area network where the smart lock device is located. It is responsible for the collaborative management of federated learning, model parameter aggregation and secure distribution. The specific hardware configuration can be: x86 architecture, 4 or more CPU cores, 8GB RAM, 256GB SSD; equipped with a trusted execution environment that supports Intel SGX or AMDSEV; equipped with gigabit Ethernet and supports VPN encrypted tunnel.

[0027] Reference Figure 2 , Figure 2 This is a flowchart illustrating the smart lock user behavior model update method provided in this embodiment. The execution entity of this embodiment is the edge server in the aforementioned system, and the method includes the following steps: Step S201: Send the basic global model to the multiple smart lock devices participating in federated learning; The basic global model is a pre-trained lightweight user behavior recognition model, employing a lightweight CNN+LSTM network structure. The model size is kept under 500KB, making it suitable for resource-constrained scenarios in smart lock devices. The model input is a standardized user behavior feature vector, and the output is anomaly detection results and corresponding confidence scores. The anomaly detection results can be classified as either normal or abnormal behavior.

[0028] The smart lock devices participating in federated learning are legitimate terminal devices that have completed device registration, identity authentication, and two-way security key negotiation. The edge server distributes the basic global model to each participating device via an encrypted communication channel, simultaneously distributing the corresponding model version number, training configuration parameters, and privacy protection parameters. Training configuration parameters include the number of local training epochs and the learning rate. The number of local training epochs can be the default 10 epochs, adjustable from 1 to 50 epochs; the learning rate can be the default 0.001, adjustable from 0.0001 to 0.01. Privacy protection parameters include the privacy budget ε and the noise type. The privacy budget ε can be the default 1.0, adjustable from 0.1 to 10.0; the noise type can be Gaussian noise by default, or Laplace noise as an option.

[0029] Step S202: Receive encrypted local parameters sent by each smart lock device; Among them, the encrypted local parameters are obtained by the smart lock device responding to the model update trigger condition, training the basic global model locally based on locally collected sample user behavior data to obtain the smart lock user behavior model, and encrypting the parameters of the smart lock user behavior model.

[0030] In some embodiments, model update triggering conditions may include three categories: the first category is timed triggering, for example, it can be executed by default during the device's idle period in the early morning every day, and the aggregation period can be configured to range from 1 hour to 7 days; the second category is event triggering, which is automatically triggered when the device detects a significant change in user behavior patterns or when the number of abnormal behavior triggers exceeds a preset threshold; the third category is manual triggering, which is initiated by the user or administrator through the management interface.

[0031] In some embodiments, the encryption process can use a symmetric encryption key pre-negotiated between the smart lock device and the edge server to encrypt the model parameters, and at the same time, use the device's unique private key to digitally sign the encrypted parameters to ensure the confidentiality and immutability of the parameters.

[0032] Step S203: In a trusted execution environment, aggregate and calculate multiple encrypted local parameters to generate global model update parameters; All sensitive computational operations in this step are performed entirely within the TEE isolation environment of the edge server, ensuring that plaintext data does not leak out of the TEE's security boundary.

[0033] Step S204: Send global model update parameters to multiple smart lock devices.

[0034] The edge server sends encrypted global model update parameters, corresponding signature information, and model version number to the corresponding smart lock devices via an encrypted communication channel. This allows the smart lock devices to verify the global model update parameters. When the verification is successful, the global model update parameters are fused and fine-tuned with the smart lock user behavior model to update the smart lock user behavior model. For cluster-generated personalized model update parameters, they are only sent to smart lock devices within the corresponding device cluster.

[0035] In this embodiment, multiple smart lock devices, responding to a model update trigger condition, train a basic global model locally based on locally collected sample user behavior data to obtain a smart lock user behavior model. The parameters of each smart lock user behavior model are encrypted to obtain encrypted local parameters, which are then sent to an edge server. This avoids parameter leakage of the smart lock user behavior model. The edge server receives the encrypted local parameters from each smart lock device and performs aggregation calculations on these parameters in a trusted execution environment to generate global model update parameters. These global model update parameters are then sent to the multiple smart lock devices, which verify them. When the global model update parameters pass verification, they are fused and fine-tuned with the smart lock user behavior model to update it. Throughout this process, the sample user behavior data remains locally on the smart lock devices, avoiding uploading to the edge server. Simultaneously, this fully leverages the collaborative learning advantages of multiple smart lock devices, overcoming the bottleneck of limited data volume on a single smart lock device, training a more robust and accurate smart lock user behavior model, and improving its performance.

[0036] In some embodiments, refer to Figure 3 , Figure 3 This is a detailed flowchart of step S203 provided in the embodiments of this disclosure. Step S203 may specifically include the following sub-steps: Step S301: Perform security verification on the encrypted local parameters in the trusted execution environment. When the security verification of the encrypted local parameters passes, decrypt the encrypted local parameters to obtain the decrypted local parameters.

[0037] Specifically, security verification may include device identity verification, based on the device's unique device identifier and digital certificate, to verify whether the device is a legitimate participant in the registration process. It may also include transmission integrity verification, based on the digital signature reported by the device, to verify whether the encrypted local parameters have been tampered with during transmission. Furthermore, it may include format compliance verification, checking whether the dimensions and format of the parameters match the underlying global model. After all the above verifications pass, the encrypted local parameters are decrypted in the TEE's secure memory using the negotiated key of the corresponding device, yielding the decrypted local parameters.

[0038] Step S302: Verify the integrity of the decrypted local parameters. When it is determined that the decrypted local parameters are complete, determine the device weight corresponding to each smart lock device.

[0039] Specifically, integrity verification can be achieved by comparing the hash value of the decrypted parameters with the hash digest reported by the device.

[0040] The calculation of device weights can be determined based on the local sample data volume, data quality, online stability, and historical model contribution of the device. Devices with larger sample data volume, higher data quality, and better stability will have higher weights. All weights are normalized, and the sum of the weights of all participating devices is 1.

[0041] Specifically, the device weights can be obtained by comprehensively weighting and summing the local sample data volume, data quality, online stability of the equipment, and historical model contribution.

[0042] Step S303: Perform weighted aggregation calculation on multiple decryption local parameters according to the device weight to generate global model update parameters.

[0043] Specifically, for each trainable parameter of the model layer, the global parameters are calculated using the following formula: Global model parameters = Σ (Decryption local parameters of the i-th device × Device weight of the i-th device) Optionally, after weighted aggregation, differential privacy noise can be added to the global model update parameters according to the global privacy protection configuration. The noise scale is determined based on the global privacy budget and the number of participating devices to further resist model reverse engineering attacks. After generating the global model update parameters, the parameters are signed using the edge server's global private key and encrypted using a key negotiated with the devices to ensure the security of the distribution process.

[0044] In some embodiments, refer to Figure 4 , Figure 4 This is a detailed flowchart of step S303 provided in the embodiments of this disclosure. Step S303 may specifically include the following sub-steps: Step S401: Obtain the device characteristics of each smart lock device; Among them, device characteristics can include device hardware configuration, sensor type and accuracy, user group attributes, and other characteristics.

[0045] Step S402: Perform cluster analysis on multiple smart lock devices based on device characteristics to obtain at least one device cluster; Specifically, based on device characteristics, the K-Means clustering algorithm can be used to divide smart lock devices with similar data distributions into the same device cluster. The value of k can be adaptively adjusted according to the number of devices, with a default value of 3, and the number of devices in each device cluster is not less than the preset minimum participation threshold.

[0046] Step S403: Within the same device cluster, aggregate and calculate multiple decryption local parameters based on device weights to generate global model update parameters corresponding to the device cluster.

[0047] By clustering multiple smart lock devices based on their characteristics, at least one device cluster can be obtained. This allows smart lock devices with similar features in the same scenario to generate more personalized global model update parameters that better fit the usage scenario. This avoids interference from data differences in different scenarios on the aggregation results and improves the adaptability and accuracy of user behavior model updates in different scenarios.

[0048] In some embodiments, refer to Figure 5 , Figure 5 This is a detailed flowchart of step S402 provided in this embodiment of the disclosure. Step S402 may specifically include the following sub-steps: Step S501: Perform device data distribution analysis on each of the smart lock devices according to the device characteristics to obtain the device distribution attributes of the smart lock devices; Among them, the device distribution attribute refers to the statistical distribution characteristics of the local user behavior data of the device, which is used to indicate the user's usage habits.

[0049] Step S502: Perform cluster analysis on the multiple smart lock devices according to the device distribution attributes to obtain at least one device cluster.

[0050] By performing cluster analysis on multiple smart lock devices based on the device distribution attributes, at least one device cluster can be obtained. This allows devices with more similar data distributions to be aggregated to generate a global update, avoiding the performance degradation of the model caused by heterogeneous data aggregation, further improving the accuracy of model aggregation, and making the updated model more in line with the actual usage habits of the corresponding group.

[0051] For example, refer to Figure 6 , Figure 6 This is a schematic diagram of non-independent, identically distributed data processing provided in this embodiment. The diagram illustrates six types of device distribution attributes: Device 1 represents the behavior pattern of home commuters who leave early and return late; Device 2 represents the behavior pattern of home office users with flexible entry and exit times and high daytime access frequency; Device 3 represents the behavior pattern of regular office users with fixed entry and exit times; Device 4 represents the random access behavior pattern of visitors and temporary personnel with no fixed entry or exit pattern; Device 5 represents the long-term residence behavior pattern of hotel long-stay guests; and Device 6 represents the short-term accommodation behavior pattern of hotel short-stay guests with short stay periods and rapid behavior switching.

[0052] The K-Means clustering algorithm ultimately divided the devices into three core clusters: Cluster 1 is the home user cluster, integrating devices 1 and 2 with similar behavioral patterns in home scenarios; Cluster 2 is the office user cluster, integrating devices 3 and 4 with similar behavioral patterns in office scenarios; and Cluster 3 is the hotel user cluster, integrating devices 5 and 6 with similar behavioral patterns in hotel scenarios.

[0053] For each device cluster, federated aggregation computation of devices within the cluster is performed in a trusted execution environment to generate a customized model adapted to the corresponding scenario. Specifically, for Cluster 1 (home users), Model 1 (Home Mode) is generated, adapting to the daily routines and multi-member usage patterns of home users. For Cluster 2 (office users), Model 2 (Office Mode) is generated, adapting to the fixed-time entry and exit and multi-role access management characteristics of office scenarios. For Cluster 3 (hotel users), Model 3 (Hotel Mode) is generated, adapting to the short stay periods and high staff turnover characteristics of hotel scenarios.

[0054] Reference Figure 7 , Figure 7 This is a flowchart illustrating the smart lock user behavior model update method provided in this embodiment. The execution subject of this embodiment is the smart lock device in the above system, and the method includes the following steps: The execution subject of this embodiment is the smart lock device in the above system, and the method includes the following steps: Step S701: Multiple smart lock devices participating in federated learning receive the basic global model sent by the edge server; After the smart lock device completes device registration and two-way identity authentication with the edge server, it can receive the basic global model issued by the edge server through an encrypted communication channel. At the same time, it can receive the corresponding training configuration parameters, privacy protection parameters and model version information, and store the basic global model in a local secure storage area to prevent the model from being illegally tampered with or stolen.

[0055] Step S702: In response to the model update trigger condition, multiple smart lock devices participating in federated learning train the basic global model locally based on locally collected sample user behavior data to obtain the smart lock user behavior model. The user's sample user behavior data is stored locally on the device and will not be uploaded to edge servers or the cloud, thus preventing privacy data leakage at the source.

[0056] Step S703: Multiple smart lock devices encrypt the parameters of the smart lock user behavior model to obtain encrypted local parameters, and send their respective encrypted local parameters to the edge server. The trained model parameters can be compressed using a sparsity and quantization compression method. The default compression ratio is 0.5, adjustable from 0.1 to 0.9, significantly reducing the amount of parameter data and communication overhead. Then, the compressed model parameters are encrypted using a symmetric encryption key pre-negotiated with the edge server. Simultaneously, the encrypted parameters are digitally signed using the device's unique private key, generating encrypted local parameters. Finally, the encrypted local parameters, corresponding signature information, and device metadata are sent to the edge server via an encrypted communication channel. The edge server then performs aggregation calculations on the encrypted local parameters in a trusted execution environment to generate global model update parameters. For example, the device metadata may include device identifier, training epoch, sample data volume, and model version number.

[0057] Step S704: Multiple smart lock devices receive global model update parameters sent by the edge server, verify the global model update parameters, and when the global model update parameters pass the verification, they are fused and fine-tuned with the smart lock user behavior model to update the smart lock user behavior model.

[0058] The smart lock device first receives encrypted global model update parameters and corresponding signature information. It then verifies the signature's legitimacy using the edge server's public key. Upon successful verification, the parameters are decrypted using a negotiated key, while simultaneously verifying their integrity and version compatibility. After all verifications pass, the global model update parameters are weighted and fused with the local smart lock user behavior model. The weight of the global model parameters can be adjusted according to the device's specific needs; the default weight is 0.7, and the local model parameter weight is 0.3. After fusion, fine-tuning is performed based on a small batch of local sample data to better adapt the model to local user behavior habits, completing the model update and simultaneously updating the local model's version number.

[0059] Figure 7 The method shown is the same as Figure 2 The methods shown are based on the same inventive concept and have the same beneficial effects, and will not be described in detail here.

[0060] In some embodiments, refer to Figure 8 , Figure 8 This is a detailed flowchart of step S702 provided in the embodiments of this disclosure. Step S702 may specifically include the following sub-steps: Step S801: Multiple smart lock devices preprocess their respective sample user behavior data and divide them into multiple batches; The smart lock device preprocesses locally collected sample user behavior data, including data cleaning, outlier removal, feature standardization, time-series data alignment, and feature vector construction, converting the raw behavior data into standardized feature vectors that the model can input. The preprocessed dataset is divided into multiple batches, and the sample size of each batch can be adaptively adjusted according to the device resources. The default batch size can be 32.

[0061] Step S802: For each training round, iterate through multiple batches of sample user behavior data to perform iterative training on the basic global model until the smart lock user behavior model is obtained.

[0062] The iterative training process includes: Based on the current batch of sample user behavior data, the prediction results are obtained through forward propagation using the smart lock user behavior model; The target loss is calculated based on the prediction results and the real labels of the current batch. Backpropagation is then performed based on the target loss to calculate the gradient of the parameters of the smart lock user behavior model. The gradient is clipped, and differential privacy noise is added to the clipped gradient according to the preset privacy protection parameters. The parameters of the base global model are updated using the gradient with added noise and the preset learning rate.

[0063] The target loss can be the cross-entropy loss function, with an L2 regularization term added to prevent overfitting. Gradient clipping restricts the gradient norm to within a preset maximum norm, preventing gradient explosion and providing a stable gradient range for differential privacy noise. Differential privacy protection adds differential privacy noise to the clipped gradient based on preset privacy protection parameters. The noise scale is calculated based on the privacy budget ε, gradient clipping threshold, training epochs, and batch size, ensuring the training process meets the mathematical requirements of differential privacy and resisting attacks that infer user privacy data through gradient inversion. Finally, the parameters of the base global model are updated using the gradient with added noise and a preset learning rate via gradient descent.

[0064] In some embodiments, refer to Figure 9 , Figure 9 This is a supplementary step diagram of the method provided in the embodiments of this disclosure. The smart lock user behavior model update method further includes: Step S901: Use the updated smart lock user behavior model to perform anomaly detection on the real-time collected target user behavior data and obtain anomaly score levels.

[0065] Step S902: Execute the corresponding security response strategy based on the anomaly score level.

[0066] The security response strategy includes at least one of the following: normal access, requiring secondary authentication, or immediate locking and alarm.

[0067] In some embodiments, refer to Figure 10 , Figure 10 This is a detailed flowchart of step S901 provided in an embodiment of this disclosure. S901 may specifically include the following sub-steps: S1001: Extract features from the real-time collected target user behavior data to obtain target features; The target user behavior data consists of real-time user unlocking behavior data collected by the smart lock device through its built-in sensors and control panel. This data includes, but is not limited to, unlocking trigger time, unlocking method selection, operation sequence and interval, biometric data acquisition quality, device vibration status, ambient light parameters, and number of unlocking attempts. The feature extraction process employs preprocessing logic identical to that used in the local training phase, including data cleaning, outlier removal, feature standardization, temporal data alignment, and feature vector construction. This transforms the real-time collected raw behavior data into standardized target features that match the model's input dimensions. By maintaining consistency between the feature extraction method and the training phase, this step ensures the stability of the model's input data distribution, avoids model inference bias and recognition failures caused by differences in feature dimensions and units, and provides compliant and reliable input data for subsequent anomaly detection.

[0068] S1002: Input the target features into the updated smart lock user behavior model for anomaly detection, and obtain the anomaly detection results and the confidence level of the anomaly detection results; The standardized target features are input into the model, which then uses forward propagation to infer and output anomaly detection results, namely a binary classification of the current user behavior as normal or abnormal, and a confidence score, which is the degree of confidence of the model in the classification result. The confidence score ranges from 0 to 1, and the higher the confidence score, the stronger the certainty of the model in the judgment result.

[0069] S1003: Perform rule checks based on target user behavior data and preset rules to obtain rule check results; The preset rules are mandatory security constraint rules pre-configured according to the device deployment scenario and security level, including but not limited to time window restriction rules, operation frequency restriction rules, unlocking method permission restriction rules, anti-pry vibration trigger rules, illegal disassembly detection rules, and password or biometric identification error count restriction rules.

[0070] S1004: Match the target user's behavior data with the corresponding historical behavior habits to obtain the habit matching result; The matching process can calculate the similarity between current behavior and historical habits based on the user's historical behavior patterns over the past 24 hours to 30 days.

[0071] S1005: The anomaly score is obtained by weighted fusion of the anomaly detection results, confidence level, rule check results and habit matching results, and the anomaly score level is determined based on the anomaly score.

[0072] The system allows configuring corresponding weights for anomaly detection results, confidence levels, rule check results, and habit matching results. These weights can be adaptively adjusted based on device deployment scenarios and security level requirements. For example, in high-security office scenarios, the weight of rule check results can be increased, while in home scenarios, the weight of habit matching results can be increased. Based on preset weights, multi-dimensional results are weighted and calculated to obtain a comprehensive anomaly score ranging from 0 to 100. Then, according to pre-set scoring thresholds, the comprehensive anomaly score is divided into corresponding anomaly score levels, such as low-risk, medium-risk, and high-risk levels. Correspondingly, when the anomaly score is at the normal level, a normal access policy is implemented, operation logs are recorded, and behavior monitoring continues. When the anomaly score is at the warning level, a secondary authentication policy is implemented, sending an anomaly behavior alert to the user and requiring secondary authentication via fingerprint, password, facial recognition, etc., while simultaneously recording a warning log. When the anomaly score is at the severe level, an immediate locking and alarm policy is implemented, temporarily locking the smart lock device, prohibiting any unlocking operations, and simultaneously sending emergency alarm information to the user and administrator via APP, SMS, etc., while recording the error level audit log.

[0073] Reference Figure 11 , Figure 11 This is a schematic diagram of the overall process provided in the embodiments of this disclosure. The principle of the method provided in the embodiments of this disclosure will be explained in detail below with an example.

[0074] The system startup initialization process specifically involves completing preliminary tasks such as smart lock device registration, two-way authentication with the edge server, encryption key negotiation, distribution of the basic global model, and synchronization of training configuration and privacy protection parameters, thus establishing a secure and reliable operating environment for subsequent processes.

[0075] Local data collection on the device specifically refers to the smart lock device collecting user behavior sample data locally, including core data such as unlocking habits, entry and exit time patterns, biometric usage patterns, operation sequences, and environmental parameters. All data is stored in the device's local secure area and is not transmitted externally, thus preventing user privacy leaks from the source and providing compliant datasets for local model training.

[0076] Local model training specifically uses the basic global model issued during the initialization phase as pre-trained weights, and performs lightweight iterative training based on locally collected user behavior data. It completes the entire training process, including forward propagation, loss calculation, backpropagation, and gradient pruning, to generate a personalized model adapted to local user habits.

[0077] Differential privacy processing involves adding differential privacy noise that meets a preset privacy budget to the gradients of the model generated during training. This ensures that the training process meets the mathematical requirements of differential privacy, resists model inversion and privacy inference attacks, and prevents the leakage of users' original behavioral data through model parameters.

[0078] The model parameter encryption process involves first sparsifying and quantizing the trained local model parameters to reduce transmission overhead; then using a symmetric encryption key pre-negotiated between the device and the edge server, and generating a digital signature using the device's unique private key to ensure the confidentiality, integrity, and immutability of the parameters.

[0079] Securely uploading to the edge server involves using an encrypted communication channel to upload encrypted local parameters, digital signatures, and device metadata to the edge server. The entire process only transmits encrypted model parameters and does not involve any original user behavior data.

[0080] The edge server receives encrypted parameters uploaded by each smart lock device to perform a preliminary verification of transmission integrity.

[0081] In TEE, decryption and verification specifically involves sending encrypted parameters into the Trusted Execution Environment (TEE) of the edge server. Device identity verification, digital signature verification, and parameter decryption are completed in isolated secure memory, with plaintext parameters never leaving the security boundary of the TEE.

[0082] The parameter validity check specifically verifies the compliance and validity of the decrypted parameters, including parameter dimension matching, format compliance, and whether there is a risk of model poisoning. If the verification result is invalid, the abnormal parameter is discarded, removing the parameters from invalid devices to avoid polluting the global model. Simultaneously, an anomaly audit log is recorded, and the current process for that device is terminated. If the verification result is valid, the process proceeds to the subsequent federated aggregation process.

[0083] The secure aggregation calculation specifically assigns corresponding weights to each valid device within the TEE, performs weighted aggregation calculations on the valid parameters of multiple devices, and supports clustered personalized aggregation to solve the pain point of non-independent and identically distributed data among smart lock devices.

[0084] The generation of global model updates is specifically based on the aggregated calculation results, generating optimized global model update parameters.

[0085] The update encryption signature is specifically achieved by using the edge server's global private key to digitally sign the global model update parameters, while simultaneously using a key negotiated with the device to complete the encryption, ensuring the security of the distribution process.

[0086] The secure delivery to the device is achieved through an encrypted communication channel, where the encrypted global model update parameters, signature information, and model version number are sent to the corresponding smart lock device.

[0087] The device receiving verification process involves the smart lock device receiving the parameters and first verifying the signature validity, parameter integrity, and model version compatibility. Only after all verifications are passed can the subsequent process begin, preventing malicious parameter tampering.

[0088] Local model fusion specifically involves updating the parameters of the validated global model and then weighting and fusing them with the device's local personalized model to balance global collaborative optimization capabilities with the personalized adaptation needs of local users.

[0089] Local fine-tuning optimization is specifically based on small batches of sample data from the device's local environment. It involves lightweight fine-tuning of the fused model to further adapt the model to the current user behavior and improve recognition accuracy.

[0090] Anomaly detection and response are based on the updated user behavior model. Anomaly detection is performed on the real-time collected user unlocking behavior, a graded anomaly score level is generated, and the corresponding graded security response strategy is executed to realize the actual implementation of the model's capabilities.

[0091] The determination of whether a node needs the next round of updates is based on preset model update trigger conditions. If the determination is yes, it returns directly to the local data acquisition step and starts a new round of local training to achieve continuous iterative optimization of the model. If the determination is no, it enters the waiting trigger condition stage, pausing the current process until the next update trigger condition is met, before returning to the data acquisition stage to start a new process.

[0092] Reference Figure 12 , Figure 12This is a schematic diagram of the security and privacy protection mechanism provided in this embodiment. The privacy protection layer is the top-level protection framework of the system, which sets up five progressive protection dimensions: data not leaving the device, differential privacy processing, end-to-end encryption, trusted execution environment, and access control auditing, covering a privacy protection technology system from the data source to the entire training process. Meanwhile, the security assurance mechanism is the specific execution capability module for implementing protection, including integrity verification, data anonymization, anomaly detection, identity authentication, and attack defense capabilities. Furthermore, it clearly defines the security threats that this system needs to address, namely data eavesdropping, model reverse engineering, parameter tampering, model poisoning, and inference attacks, covering typical privacy leaks and model security attack behaviors in the entire distributed training process. Specifically, The first layer of privacy protection is ensuring that data does not leave the device. All raw user behavior data is stored securely on the local storage area of ​​the smart lock device. Training and computation are performed only locally on the device, and no raw data is transmitted externally. This blocks the path to privacy leakage at the source of data collection and avoids the risk of large-scale privacy leaks caused by data aggregation and storage in traditional centralized training. The second layer of protection is differential privacy processing. After gradients are generated locally, differential privacy noise is added according to a preset privacy budget, making it impossible for attackers to infer the raw behavior data of individual users from the gradient information. This ensures the model aggregation effect while meeting strict differential privacy protection requirements. The third layer of protection is end-to-end encryption. Throughout the gradient upload and model distribution process between the smart lock and the edge server, all transmitted data is encrypted with a pre-negotiated symmetric key and decrypted only in a trusted environment between the sender and receiver. Even if the data is eavesdropped on during transmission, attackers cannot obtain plaintext parameter information, ensuring the data security of the transmission link. The fourth layer of protection is the Trusted Execution Environment (TEE). All operations involving plaintext parameter processing and aggregation calculations on the edge server are completed within an isolated TEE. Plaintext parameters never leave the security boundary of the TEE, preventing parameter leakage caused by attacks on the edge environment. The fifth layer of protection is access control auditing. Strict identity and permission controls are configured for smart lock device registration and edge server model access operations. All operation logs are recorded throughout the entire process, and any abnormal access operations are logged and alerted, enabling traceable security audit management.

[0093] The following examples illustrate this with real-world scenarios.

[0094] This disclosed embodiment can be applied to a residential home scenario. A family has three smart lock devices deployed at the front door, bedroom door, and study door. The family members are parents and two children, each with different daily routines and unlocking habits. The three smart lock devices are connected to a home gateway with built-in edge server functionality. After registration and authentication, the home gateway sends a basic global model (300KB) to the devices. The model's configuration parameters are: privacy budget ε=0.8, 5 local training rounds, learning rate 0.001, aggregation period 12 hours, and minimum number of participating devices 2. Each smart lock device locally collects user unlocking behavior data for its corresponding door. The front door lock collects family members' entry and exit times and unlocking method preferences; the bedroom door lock collects access patterns to personal privacy spaces; and the study door lock collects access patterns during work hours. During the device's idle periods at noon and night, each device responds to timed trigger conditions to perform local training and generate a local smart lock user behavior model. Each device compresses, encrypts, and signs its local model parameters before uploading them to the home gateway. The gateway performs verification, decryption, and weighted aggregation in the TEE (Transmission Equipment Environment) to generate global model update parameters, which are then encrypted and distributed to each device. After parameter verification, each device performs model fusion and fine-tuning to update its local model. The updated model performs real-time anomaly detection, triggering corresponding alarms and locking policies when unauthorized unlocking attempts or unlocking operations during abnormal periods are detected.

[0095] This embodiment can also be applied to an office building with 50 smart lock devices deployed in offices, meeting rooms, and equipment rooms. Employees are divided into different groups, including management, R&D personnel, administrative staff, interns, and visitors. These groups exhibit significant differences in behavior patterns and access permissions. Three edge servers are deployed per floor in the building. Each smart lock device registers and connects to the corresponding edge server per floor. The server distributes a basic global model with the following parameters: privacy budget ε = 0.5, 8 local training rounds, learning rate 0.0008, aggregation period 6 hours, number of clusters 5, and minimum number of participating devices 3. Each smart lock device locally collects user access behavior data and performs local training during idle periods to generate a local model. The edge server receives the encrypted local parameters, verifies and decrypts them within the TEE, extracts the device data distribution attributes, and uses K-Means clustering to divide the data into five clusters: management, R&D, administrative, public, and visitor areas. Weighted aggregation is then performed on each cluster to generate global model update parameters for each cluster. The edge server distributes the cluster model parameters to the corresponding devices. After each device completes the verification, it updates its local model. At the same time, it sets differentiated anomaly detection thresholds for different roles, and sets stricter detection rules for devices in high-security areas.

[0096] This embodiment can also be applied to a chain hotel deploying 200 smart lock devices in guest rooms and public areas. The users are primarily short-term guests with short stays and high turnover, requiring rapid adaptation to guest behavior patterns while strictly protecting guest privacy. The hotel deploys an edge server cluster, with all smart lock devices connected to the server. The server distributes a basic global model, configured with rapid learning mode parameters: privacy budget ε=0.3, 3 local training rounds, learning rate 0.002, aggregation period 24 hours, and a data retention policy of automatically clearing all local behavioral data within 24 hours of guest check-out. When a guest checks in, the corresponding smart lock loads a general sub-model for the hotel scenario. During the stay, guest unlocking behavior data is collected in real time, and local training is performed quickly to adapt to guest habits. Every morning, each device uploads encrypted local parameters to the edge server. The server aggregates the data within the TEE (Trusted Execution Environment) to generate an optimized global model, extracting only general behavioral pattern features to update the hotel knowledge base, without retaining any guest personal privacy data. After a guest checks out, the smart lock automatically clears all behavioral data and personalized models for that guest, restoring the initial state.

[0097] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described smart lock user behavior model update method.

[0098] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0099] The embodiments described in this disclosure are for the purpose of more clearly illustrating the technical solutions of this disclosure and do not constitute a limitation on the technical solutions provided by this disclosure. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by this disclosure are also applicable to similar technical problems.

[0100] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this disclosure, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0101] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the embodiments disclosed herein, depending on actual needs.

[0102] Those skilled in the art will understand that all or some of the steps, apparatuses, or functional modules / units in the methods disclosed above can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0103] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in this disclosure and the foregoing drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0104] It should be understood that in this disclosure, "at least one item" means one or more, and "more than one" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0105] In the several embodiments provided in this disclosure, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0106] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this disclosure, depending on actual needs.

[0107] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0108] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0109] The preferred embodiments of the present disclosure have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present disclosure. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and spirit of the present disclosure shall be within the scope of the claims of the present disclosure.

Claims

1. A method for updating a smart lock user behavior model based on federated learning, characterized in that, include: Send the basic global model to multiple smart lock devices participating in federated learning; The system receives encrypted local parameters sent by each of the smart lock devices. The encrypted local parameters are obtained by the smart lock device in response to the model update trigger condition, by training the basic global model locally based on locally collected sample user behavior data to obtain a smart lock user behavior model, and by encrypting the parameters of the smart lock user behavior model. In a trusted execution environment, multiple encrypted local parameters are aggregated and calculated to generate global model update parameters; The global model update parameters are sent to multiple smart lock devices so that the smart lock devices can verify the global model update parameters. When the global model update parameters are verified, the global model update parameters are fused and fine-tuned with the smart lock user behavior model to update the smart lock user behavior model.

2. The smart lock user behavior model update method according to claim 1, characterized in that, The step of aggregating and calculating multiple encrypted local parameters in a trusted execution environment to generate global model update parameters includes: The encrypted local parameters are security verified in a trusted execution environment. When the security verification of the encrypted local parameters passes, the encrypted local parameters are decrypted to obtain the decrypted local parameters. Verify the integrity of the decryption local parameters. When it is determined that the decryption local parameters are complete, determine the device weight corresponding to each of the smart lock devices. Based on the device weight, multiple encrypted local parameters are aggregated and calculated to generate global model update parameters.

3. The smart lock user behavior model update method according to claim 2, characterized in that, The step of aggregating and calculating multiple encrypted local parameters based on the device weight to generate global model update parameters includes: Obtain the device characteristics of each of the smart lock devices; Based on the device characteristics, cluster analysis is performed on multiple smart lock devices to obtain at least one device cluster; Within the same device cluster, multiple encrypted local parameters are aggregated and calculated based on the device weights to generate global model update parameters corresponding to the device cluster.

4. The smart lock user behavior model update method according to claim 3, characterized in that, The step of performing cluster analysis on multiple smart lock devices based on the device characteristics to obtain at least one device cluster includes: Based on the device characteristics, device data distribution analysis is performed on each of the smart lock devices to obtain the device distribution attributes of the smart lock devices; Based on the device distribution attributes, cluster analysis is performed on multiple smart lock devices to obtain at least one device cluster.

5. A method for updating a smart lock user behavior model based on federated learning, characterized in that, include: Multiple smart lock devices participating in federated learning receive the underlying global model sent by the edge server; In response to the model update trigger condition, multiple smart lock devices participating in federated learning train the basic global model locally based on locally collected sample user behavior data to obtain smart lock user behavior models. Each of the smart lock devices encrypts the parameters of the smart lock user behavior model to obtain encrypted local parameters, and sends the corresponding encrypted local parameters to the edge server so that the edge server can aggregate and calculate the encrypted local parameters in a trusted execution environment to generate global model update parameters. Multiple smart lock devices respectively receive the global model update parameters sent by the edge server, verify the global model update parameters, and when the global model update parameters pass the verification, fuse and fine-tune the global model update parameters with the smart lock user behavior model to update the smart lock user behavior model.

6. The smart lock user behavior model update method according to claim 5, characterized in that, The multiple smart lock devices participating in federated learning train the basic global model locally based on locally collected sample user behavior data to obtain smart lock user behavior models, including: The various smart lock devices each preprocess their respective sample user behavior data and divide it into multiple batches; For each training round, iterative training is performed on the basic global model by traversing multiple batches of sample user behavior data until a smart lock user behavior model is obtained, wherein the iterative training includes: Based on the sample user behavior data of the current batch, the prediction result is obtained by forward propagation through the smart lock user behavior model; The target loss is calculated based on the prediction results and the true labels of the current batch. Backpropagation is then performed based on the target loss to calculate the gradient of the parameters of the smart lock user behavior model. The gradient is pruned, and differential privacy noise is added to the pruned gradient according to a preset privacy protection parameter. The parameters of the base global model are then updated using the gradient with added noise and a preset learning rate.

7. The smart lock user behavior model update method according to claim 5, characterized in that, The smart lock user behavior model update method further includes: The updated smart lock user behavior model is used to detect anomalies in the real-time collected target user behavior data and obtain an anomaly score level. The corresponding security response strategy is executed according to the anomaly score level. The security response strategy includes at least one of normal access, requiring secondary authentication, or immediate locking and alarm.

8. The smart lock user behavior model update method according to claim 7, characterized in that, The updated smart lock user behavior model is used to perform anomaly detection on the real-time collected target user behavior data to obtain anomaly scoring levels, including: Feature extraction is performed on real-time collected target user behavior data to obtain target features; The target features are input into the updated smart lock user behavior model for anomaly detection to obtain anomaly detection results and the confidence level of the anomaly detection results; Based on the target user behavior data and preset rules, a rule check is performed to obtain the rule check result; The target user's behavior data is matched with the corresponding historical behavior habits to obtain the habit matching result; An anomaly score is obtained by weighted fusion of the anomaly detection results, the confidence level, the rule check results, and the habit matching results, and the anomaly score level is determined based on the anomaly score.

9. A smart lock user behavior model update system based on federated learning, characterized in that, This includes multiple smart lock devices participating in federated learning, as well as edge servers; The edge server is used to send a basic global model to multiple smart lock devices; Multiple smart lock devices are used to respond to model update triggering conditions, and based on locally collected sample user behavior data, perform local training on the basic global model to obtain smart lock user behavior models, encrypt the parameters of the smart lock user behavior models to obtain encrypted local parameters, and send the corresponding encrypted local parameters to the edge server. The edge server is also used to receive encrypted local parameters sent by each of the smart lock devices, perform aggregate calculations on multiple encrypted local parameters in a trusted execution environment, generate global model update parameters, and send the global model update parameters to multiple smart lock devices. The multiple smart lock devices are also used to verify the global model update parameters. When the global model update parameters pass the verification, the global model update parameters are fused and fine-tuned with the smart lock user behavior model to update the smart lock user behavior model.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the smart lock user behavior model update method according to any one of claims 1 to 8.