Model recovery method and device
By acquiring and resuming damaged machine learning models in the local storage area and using feature identification information, the problem of low model recovery efficiency is solved, and an efficient and safe model recovery process is achieved.
Patent Information
- Application Number
- CN202510401106.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-04
AI Technical Summary
In the prior art, machine learning models need to be re-downloaded from the cloud when the user terminal is damaged, resulting in low model recovery efficiency and poor user experience.
By obtaining the target model backup file in the local storage area and restoring it with feature identification information, we ensure that the restored model meets user needs and security.
Improves the efficiency and accuracy of model recovery, improves user experience, and reduces dependence on network speed.
Smart Images

Figure CN120256202A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and more specifically, to a model recovery method and device. Background Art
[0002] Model localization refers to deploying a machine learning model to a local environment so that it can run on a user terminal instead of relying on cloud services. This can improve data privacy and reduce data processing latency, etc. However, when the model deployed on the user terminal is damaged, the user needs to be guided to redownload the corresponding model file from the cloud for model recovery. The download and installation process of the model file depends on the network speed and usually takes a long time to achieve model recovery, reducing the model recovery efficiency and user experience. Summary of the Invention
[0003] In view of this, this application provides the following technical solutions:
[0004] A model recovery method includes:
[0005] Detect that the target model of the electronic device is in a first state, and obtain the feature identification information of the target model, where the feature identification information characterizes the data state of the target model;
[0006] Obtain a target model backup file corresponding to the target model in the local storage area;
[0007] Based on the target model backup file and the feature identification information, recover the target model so that the recovered target model is in a second state;
[0008] Wherein, the first state characterizes the non-available state of the target model, and the second state characterizes the available state of the target model; the target model backup file stored in the local storage area is a backup data file for the target model determined based on user association information.
[0009] Optionally, it further includes:
[0010] When the model is in the second state, obtain the user association information for the target model;
[0011] Based on the user association information, determine the target backup mode of the target model;
[0012] Based on the target backup mode, create a target model backup file for the target model;
[0013] Store the target backup file in the local storage area;
[0014] Generate the feature identification information of the target model backup file, and store the feature identification information in a trusted storage area.
[0015] Optionally, the feature identification information includes target signature information and target version information. Wherein, generating the feature identification information of the target model file and storing the feature identification information in a trusted storage area includes:
[0016] Generate the target signature information of the target model backup file based on the device key of the electronic device and the model signature information of the target model;
[0017] Obtain the target version information corresponding to the target model backup file;
[0018] Store the target signature information and the target version information in a trusted storage area.
[0019] Optionally, determining the target backup mode of the target model based on the user association information includes:
[0020] Analyze the user association information to determine the usage frequency of the user for the target model and / or the application requirement characteristics of the target model;
[0021] Based on the usage frequency and / or application requirement characteristics, determine the target backup mode of the target model. The target backup mode includes a first backup mode and a second backup mode. The first backup mode represents performing matching backup when the target model is updated; the second backup mode represents backing up the target model according to a target backup period.
[0022] Or,
[0023] When at least one model is configured in the electronic device and the user association information represents the first selection information for the target model in the models, determine the target backup mode of the target model as the first backup mode. The first backup mode represents performing matching backup when the target model is updated.
[0024] Optionally, creating the target model backup file of the target model based on the target backup mode includes:
[0025] Based on the target backup mode, obtain the first model data corresponding to the target model to be updated;
[0026] Based on the first model data and the second model data corresponding to the current data state of the target model, determine the data to be updated of the current model backup file of the target model in the local storage area;
[0027] Update the current model backup file based on the data to be updated to obtain a target model backup file.
[0028] Optionally, the detecting that the target model of the electronic device is in the first state includes:
[0029] Detect the data integrity of the target model of the electronic device to obtain a first detection result;
[0030] If the first detection result indicates that the data of the target model is incomplete, determine that the target model is in the first state;
[0031] If the first detection result indicates that the data of the target model is complete, detect whether the version information of the target model is the version information selected by the user. If not, determine that the target model is in the first state.
[0032] Optionally, the creating a target model backup file of the target model based on the target backup mode includes:
[0033] In the case where the target backup mode is the first backup mode, obtain second selection information of the user when the target model is updated; the second selection information indicates whether to back up the currently updated target model;
[0034] Create a target model backup file of the target model based on the second selection information.
[0035] Optionally, the feature identification information includes the first model signature information of the target model and the first version information of the target model. Among them, the restoring the target model based on the target model backup file and the feature identification information includes:
[0036] Obtain the second model signature information of the target model backup file;
[0037] Determine the data integrity of the target model backup file based on the first model signature information and the second model signature information;
[0038] If the data of the target backup file is complete, detect whether the first version information is consistent with the second version information of the target model backup file;
[0039] If they are inconsistent, determine whether the second version information of the target model backup file is consistent with the version information selected by the user;
[0040] If the second version information of the target model backup file is consistent with the version information selected by the user, restore the target model based on the target model backup file.
[0041] Optionally, the method further includes:
[0042] If the second version information of the target model backup file is inconsistent with the version information selected by the user, obtain the original backup file corresponding to the target model in the local storage area;
[0043] Download an incremental data file corresponding to the target model in the cloud; wherein, the incremental data file represents a data file to be updated based on the target model and the original backup file;
[0044] Restore the target model based on the original backup file and the incremental data file.
[0045] A model restoration device, comprising:
[0046] A detection unit, configured to detect that the target model of the electronic device is in a first state, and obtain the feature identification information of the target model, where the feature identification information represents the data state of the target model;
[0047] An acquisition unit, configured to obtain a target model backup file corresponding to the target model in the local storage area;
[0048] A restoration unit, configured to restore the target model based on the target model backup file and the feature identification information, so that the restored target model is in a second state;
[0049] Wherein, the first state represents a non-available state of the target model, and the second state represents an available state of the target model; the target model backup file stored in the local storage area is a backup data file for the target model determined based on user association information. Description of the Drawings
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for description in the embodiments. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on the provided drawings.
[0051] Figure 1 A flowchart of a model restoration method provided by an embodiment of the present application;
[0052] Figure 2 A flowchart of a model backup method provided by an embodiment of the present application;
[0053] Figure 3 A flowchart of a method for detecting a target model provided by an embodiment of the present application;
[0054] Figure 4 A schematic diagram of a processing flow for restoring a target model provided by an embodiment of the present application;
[0055] Figure 5 A schematic structural diagram of a model restoration device provided by an embodiment of the present application. Detailed implementation manners
[0056] 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 only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.
[0057] The terms "first" and "second" etc. in the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may include steps or units not listed.
[0058] The embodiments of the present application provide a model restoration method, which can be applied to the scenario of restoring a model in an electronic device. Among them, the model in the electronic device can be a local artificial intelligence model, such as a basic large language model (which can be a text generation model, a dialogue interaction model, etc.), a multi-modal model (which can be an artificial intelligence drawing model, a speech recognition model, etc.), a dedicated model (such as an expression recognition model, a text translation model, etc.). If the model of the electronic device has problems, it is usually necessary to re-download and install the model from the cloud, which will result in low model restoration efficiency and there may also be a difference between the re-downloaded model and the user's needs. To solve these problems, in the embodiments of the present application, the model can be restored based on the target model backup file in the local storage area, and when generating the target model backup file, it is determined based on the user association information, which is more matched with the user's usage status of the model, thereby improving the efficiency and accuracy of model restoration.
[0059] See Figure 1 , a schematic flow diagram of a model restoration method provided by an embodiment of the present application, and the method may include the following steps:
[0060] S101. Detect that the target model of the electronic device is in a first state, and obtain the feature identification information of the target model.
[0061] The target model of the electronic device can be the local artificial intelligence model of the electronic device. Correspondingly, the target model can be any model in the electronic device, or some selected models. By detecting the data of the target model of the electronic device, the state of the target model is determined. The state of the target model can include a first state and a second state. The first state represents the unavailable state of the target model, and the second state represents the available state of the target model. For example, the first state can be the data damage state of the target model, the outdated state of the target model (the training data of the target model has exceeded the time limit and does not conform to the current application scenario), the first state can also be the state where the data of the target model is tampered with, or the state where the configuration parameters of the target model are incorrect, etc. Therefore, when it is detected that the target model is in the first state, the target model can no longer meet the current user's usage requirements. At this time, the feature identification information of the target model will be obtained. This feature identification information represents the data state of the target model, so that the target model can be restored according to this feature identification information, and the restored target model meets its current data state. For example, the feature identification information includes the verification information of the target model, or it can also be the version information of the target model, so that the data available for restoring the target model can be verified or selected based on this information to ensure the accuracy of model restoration.
[0062] S102. Obtain the target model backup file corresponding to the target model in the local storage area.
[0063] In the embodiments of the present application, the model data of the relevant model of the electronic device will be backed up in advance, and the model backup file will be stored in the local storage area. In this way, when the target model is in the first state, the target model backup file corresponding to the target model can be obtained from the local storage area, and the model data of the target model can be downloaded without going through the cloud, thereby solving the problem of low efficiency of data download relying on network bandwidth. Moreover, the target model can be restored to the corresponding data state before its non-available state to ensure the accuracy of model restoration. Among them, the target model backup file can be the mirror file of the target model when the target model is in the available state. Correspondingly, the target model backup file stored in the local storage area is the backup data file for the target model determined based on the user association information. Among them, the target model backup file can be the file backed up after detecting the update of the model data of the target model; it can also be the target model backup file obtained by downloading relevant update data from the cloud for backup when the electronic device is in the idle state after receiving the push request that the target model in the cloud can be updated and upgraded. For example, the version of the target model used by the user is version 1.0. When receiving the update push request, the information of version 2.0 can be downloaded and stored as a backup file when the electronic device is idle. In this way, when the target model needs to be updated, the backup file of version 2.0 in the local storage area can be used for the update, without affecting other applications due to bandwidth limitations and improving the update efficiency. The user association information represents the relevant trigger data of the user for the target model, such as the selection information of the user selecting the target model among multiple models. The target association information can also be the information of the user backing up the specified version or model data of the target model; the target association information can also be the information such as the usage frequency or application requirements of the user for the model. In this way, the relevant data of the target model can be backed up according to these user association information, making the target model backup file more in line with the application requirements of the user for the target model. For example, the target model backup file can be the file backed up after the real-time update of the target model selected by the user; the target model backup file can also be the data file backed up when the target model is in a specific state (such as the state specified by the user, or during the backup cycle). Thus, the restored model of the target model can also meet the application requirements of the user.
[0064] S103. Based on the target model backup file and the feature identification information, restore the target model so that the restored target model is in the second state.
[0065] After obtaining the target model backup file, the target model backup file can be verified according to the feature identification information. If the verification is passed, the target model in the first state is restored based on the target model backup file, so that the restored target model is in an available state. Verifying the target model backup file according to the feature identification information can determine whether the target model backup file has been tampered with, or whether the target model backup file meets the application requirements of the current user. For example, the feature identification information includes the unique identification information of the target model, and the unique identification information is matched with the identification corresponding to the target model backup file to determine the data integrity and security of the target model backup file. Another example is that the feature identification information includes the target model version information. In this way, when there are multiple backup files corresponding to the target model in the local storage area, the target model backup file that best matches the current version information of the target model to be restored can be determined based on this version information. Therefore, when the target model is restored based on the target model backup file, the application requirements of the user for the target model can be met.
[0066] An embodiment of the present application provides a model restoration method. When it is detected that the target model of the electronic device is in the first state, that is, the non-available state, instead of downloading the model data of the target model through the cloud, the target model backup file is obtained from the local storage area, which can improve the efficiency of model restoration. And the target model backup file is a backup data file for the target model determined based on the user association information, which can make the target model backup file more in line with the application requirements of the user for the target model, so that the restored target model can match the application requirements of the user and improve the user experience effect.
[0067] The model restoration method of the embodiment of the present application will be described below in combination with an actual application scenario. In the embodiment of the present application, the relevant data of the model can be backed up based on the association information of the user to obtain a model backup file, which is used to restore the model when the corresponding model is in a non-available state. See Figure 2 , which is a schematic flowchart of a model backup method provided by an embodiment of the present application. The method may include the following steps:
[0068] S201. Obtain the user association information for the target model when the model is in the second state.
[0069] S202. Determine the target backup mode of the target model based on the user association information.
[0070] S203. Create a target model backup file for the target model based on the target backup mode.
[0071] S204. Store the target model backup file in the local storage area.
[0072] S205. Generate the feature identification information of the target model backup file, and store the feature identification information in the trusted storage area.
[0073] Multiple models can be set in the electronic device. For example, multiple artificial intelligence models are configured in the electronic device, and these artificial intelligence models can assist the electronic device in performing text, image, and user intelligent interaction processing. When the model is in the second state, that is, when the model is in the available state, the target backup mode of the target model can be determined based on the user association information of the target model. Among them, the target model can be a model frequently called by the user in the electronic device, or a model specified and selected by the user. In this way, the target backup mode of the model can be determined by combining the usage data of the user for the model. This target backup mode can match the application requirements of the user for the target model to obtain the target model backup file. Thus, while realizing the local model backup, excessive backup resources can be avoided from being wasted, and the application requirements of the user for the model can also be met, so that when the model is restored based on the backup file later, the model can be restored to the state required by the user.
[0074] In an implementation manner of the embodiment of the present application, determining the target backup mode of the target model based on the user association information includes: analyzing the user association information to determine the usage frequency of the user for the target model and / or the application requirement characteristics of the target model; determining the target backup mode of the target model based on the usage frequency and / or the application requirement characteristics.
[0075] Among them, the target backup mode includes a first backup mode and a second backup mode. The first backup mode represents performing matching backup when the target model is updated, and the second backup mode represents backing up the target model according to the target backup period. In this embodiment, the target model can be any model configured in the electronic device used by the user. The user association information represents the usage data of each model by the user or the requirement data for the model. For example, the user association information can be the call frequency of each model by the user. The user association information can also be the interaction data between the user and the model, or the requirement information generated by the user based on the model. For example, if the user often performs image processing through the model, then the user's requirement for the model is about image processing. In this way, the usage frequency of the user for the target model and / or the application requirement characteristics of the target model can be determined according to the user association information. For example, the call frequency of the user for the target model is higher than the target frequency threshold, that is, the user often calls the target model, and it is necessary to make the target model backup file of the target model meet the user's usage requirements in real time. Therefore, the target backup mode adopted at this time is the first backup mode, that is, matching backup is performed after detecting that the target model is updated. In this way, the target model backup file can be made to match the current state of the target model in real time. When the target model is restored based on the target model backup file later, the target model can be restored to the state required by the user, improving the user experience effect. If it is analyzed through the user association information that the usage frequency of the user for the target model is low, or the requirement for the target model is low, then the backup mode of the target model can be determined as the second backup mode, that is, backing up the target model according to the target period, realizing periodic backup of the target model. For example, the target period for backing up the target model is one month. If the version of the target model is updated twice successively within one month, then the model data of the target model after the second update is backed up. In this way, when backing up the data of the target model, the resource occupancy of the backup file can also be reduced, thereby improving the processing efficiency of the electronic device.
[0076] In another embodiment of the embodiments of the present application, based on the user association information, the processing process of determining the target backup mode of the target model may further include: when at least one model is configured in the electronic device and the user association information represents the first selection information for the target model in the model, determining the target backup mode of the target model as the first backup mode. The first backup model represents performing matching backup when the target model is updated.
[0077] In this embodiment, when multiple models are configured in the electronic device, the user can select a certain model or some models among them, and use the selected model as the target model. At this time, the target model is the model that the user is concerned about. In this way, when backing up the target model, the first backup mode can be adopted, that is, as long as it is detected that the target model is updated, the target model will be backed up, so that the obtained target model backup model can represent the latest state of the target model in real time. When restoring the target model according to the target model backup file, the restored target model can also be in the latest state, thus meeting the user's needs.
[0078] After obtaining the target model backup file of the target model, it is necessary to store the target model backup file in the local storage area. In this way, when it is necessary to restore the target model, the target model backup file stored in the local storage area can be called and restored through the target model backup file, without downloading through the cloud, which improves the efficiency of model restoration.
[0079] Furthermore, in order to ensure the data security of the target model backup file and prevent malicious tampering of the backup file. In the embodiments of the present application, the feature identification information of the target model backup file can also be generated, and the data security can be ensured through the feature identification information. The feature identification information can also be stored in a trusted storage area. For example, the feature identification information can be stored in a TAC (Trusted Application Chip) chip. The TAC chip is a hardware chip dedicated to security control, and its core function is to provide hardware-level security protection and a trusted execution environment for the local AI model. In this way, even if the data of the target model file is tampered with, it cannot be verified through the feature identification information in the TAC chip, thus ensuring the data security of the backup file.
[0080] In an embodiment of the embodiments of the present application, the feature identification information includes target signature information and target version information. Among them, the process of generating the feature identification information of the target model backup file and storing the feature identification information in the trusted storage area includes:
[0081] Generate the target signature information of the target model backup file based on the device key of the electronic device and the model signature information of the target model; obtain the target version information of the target model backup file; store the target signature information and the target version information in the trusted storage area.
[0082] In this embodiment, the device key of the electronic device may be a unique key generated by the TAC chip in the electronic device, and the model signature information of the target model may be a common signature of the target model itself. In this way, the model backup file can be secondarily signed based on the device key in addition to the common signature of the target model itself to obtain the target signature information. Then, the version information of the target model backup file can be determined according to the configuration information of the target model backup file, and this version information can be determined as the target version information. In this way, the target signature information and the target version information can be stored in the trusted storage area, and whether the target model backup file has been tampered with can be verified through the target signature information. According to the target version information, it can be determined whether the backup file meets the user's application requirements, thereby improving the user experience effect.
[0083] In the process of creating the target model backup file of the target model in the embodiments of the present application, all the data of the target model may be fully backed up to obtain the target model backup file. It may also be to generate the target model backup file by means of incremental backup based on the existing backup data of the target model. In this way, the backup file can be generated in an incremental update manner, which can improve the generation efficiency of the backup file. Correspondingly, in one embodiment, based on the target backup mode, creating the target model backup file of the target model may include the following steps:
[0084] S301. Based on the target backup mode, obtain the first model data corresponding to the target model to be updated.
[0085] S302. Based on the first model data and the second model data corresponding to the current data state of the target model, determine the data to be updated in the current model backup file of the target model in the local storage area.
[0086] S303. Update the current model backup file based on the data to be updated to obtain the target model backup file.
[0087] The target backup mode may include a first backup mode and a second backup mode. The first backup mode represents performing matching backup when the target model is updated; the second backup mode represents backing up the target model according to the target backup period. When the target backup mode is the first backup mode, it is necessary to update the backup file of the target model after the target model is updated. In order to save the occupancy of backup processing resources, the first model data corresponding to the current target model to be updated can be compared with the second model data of the current data state of the target model before the update to determine the incremental data part after the update, that is, the data to be updated. In this way, the target model backup file can be obtained by updating the data to be updated to the current model backup file.
[0088] For example, the current version of the target model is 1.0. According to the model update push information, the target model can be updated to version 2.0. Then, the model data differences between version 2.0 and version 1.0 can be compared to determine the incremental data, i.e., the data to be updated. Then, the backup file corresponding to version 1.0 can be updated according to the data to be updated to obtain a backup file of version 2.0. Thus, when problems such as damage occur to the target model, the target model can be restored based on the backup file of version 2.0 to meet the user's application requirements for the model.
[0089] Further, in the embodiments of the present application, the process of generating the target model backup file can also be updated based on the user's selection. Correspondingly, based on the target backup mode, the process of creating the target model backup file of the target model includes: when the target backup mode is the first backup mode, obtaining the second selection information of the user when the target model is updated; based on the second selection information, creating the target model backup file of the target model.
[0090] In this embodiment, the first backup mode means matching the update when the target model is updated, and the second selection information ensures whether to back up the currently updated target model. To save backup resources and better match the actual needs of the user for model backup, corresponding prompt information can be generated when performing model backup. The prompt information is used to prompt the user whether to back up the data of the current model version. Further, the prompt information can also include a description of the differences between the current version and the previous version. In this way, after obtaining the prompt information, the user can determine whether to back up the current updated version. For example, if the updated content of the current updated version is not what the user is concerned about, the user can choose not to back up this updated version, which can save backup resources.
[0091] In the embodiments of the present application, when the target model is in the first state, that is, when the target model is in a non - available state, it may be that the data of the target model is incomplete, or the version information of the target model does not meet the application requirements of the user. At this time, the target model can be restored or updated according to the target model backup file. Refer to Figure 3 , which is a schematic flowchart of a method for detecting a target model provided by the embodiments of the present application. The method may include the following steps:
[0092] S401. Detect the data integrity of the target model of the electronic device to obtain a first detection result.
[0093] S402. Determine the data integrity of the target model based on the first detection result. If yes, execute step S403; if no, execute step S404;
[0094] S403. Detect whether the version information of the target model is the version information selected by the user. If so, execute step S404; if not, execute step S405;
[0095] S404. Determine that the target model passes the verification;
[0096] S405. Determine that the target model is in the first state.
[0097] When detecting the data integrity of the target model, it can be to detect each part of the model data of the target model. For example, by comparing the hash value corresponding to each model data partition with the pre-stored hash value, if they are the same, it indicates that the data in this partition has not been tampered with. Then obtain its version information according to the configuration information of the target model, and obtain the version information in the user requirement information. If the two version information do not match, it means that the target model cannot meet the user's requirements, and it can also obtain the result that the target model fails the verification. Thus, the target model can be restored according to the target model backup file, or the target model can be updated when the versions do not match, achieving the purpose that the target model can meet the user's requirements.
[0098] The following details the model restoration process. When the model needs to be restored, in addition to obtaining the target model backup file from the local storage area, it is also necessary to verify the target model backup file to determine whether it has been maliciously tampered with. In one implementation, see Figure 4 , which shows a schematic diagram of a processing flow for restoring a target model according to an embodiment of the present application. Among them, when verifying the target model, the feature identification information used includes the first model signature information of the target model and the first version information of the target model. This process can include the following steps:
[0099] S501. Obtain the second model signature information of the target model backup file.
[0100] S502. Based on the first model signature information and the second model signature information, determine the data integrity of the target model backup file.
[0101] S503. If the data of the target backup file is complete, detect whether the first version information is consistent with the second version information of the target model backup file. If not, execute step S504; if so, execute step S505.
[0102] S504. Determine whether the second version information of the target model backup file is consistent with the version information selected by the user. If so, execute S505; if not, execute S506.
[0103] S505. Restore the target model based on the target model backup file.
[0104] S506. Obtain the original backup file corresponding to the target model in the local storage area.
[0105] S507. Download the incremental data file corresponding to the target model from the cloud.
[0106] Wherein, the incremental data file represents the data file to be updated based on the target model and the original backup file.
[0107] S508. Restore the target model based on the original backup file and the incremental data file.
[0108] When generating the backup file of the target model, the corresponding feature identification information will be stored in the trusted storage area, so that the data of the target model backup file can be verified through the feature identification information, avoiding the problem that the data of the target model backup file is maliciously tampered with. First, verify through the first model signature information stored in the trusted storage area and the second model signature information of the current target model obtained by calculation. If they are consistent, it indicates the data integrity of the target backup file, that is, the data has not been tampered with. Then, it can also be verified whether the version information corresponding to the current target model backup file is consistent with the first version information of the target model backup file stored in the trusted storage area. If they are inconsistent, it can also be verified whether it is the version selected by the user. In this way, the user's needs can be met when updating based on the target model backup file.
[0109] Furthermore, if they are inconsistent, the incremental data corresponding to the user's required version can be downloaded from the cloud, so as to update the target model according to the incremental data and the original backup file stored before, to meet the user's update and restoration requirements for the target model, and at the same time, the user's usage requirements for the model can be met, improving the user experience effect.
[0110] In another embodiment of the present application, a model restoration device is further provided. Refer to Figure 5 , the device may include:
[0111] A detection unit 601, configured to detect that the target model of the electronic device is in the first state, and obtain the feature identification information of the target model, where the feature identification information represents the data state of the target model;
[0112] An acquisition unit 602, configured to obtain the target model backup file corresponding to the target model in the local storage area;
[0113] A restoration unit 603, configured to restore the target model based on the target model backup file and the feature identification information, so that the restored target model is in the second state;
[0114] Wherein, the first state represents the unavailable state of the target model, and the second state represents the available state of the target model; the target model backup file stored in the local storage area is a backup data file for the target model determined based on user association information.
[0115] Optionally, it further includes:
[0116] An information acquisition unit, configured to obtain user association information for the target model when the model is in the second state;
[0117] A first determination unit, configured to determine the target backup mode of the target model based on the user association information;
[0118] A creation unit, configured to create a target model backup file for the target model based on the target backup mode;
[0119] A storage unit, configured to store the target model backup file in the local storage area;
[0120] A generation unit, configured to generate feature identification information for the target model backup file and store the feature identification information in a trusted storage area.
[0121] Optionally, the feature identification information includes target signature information and target version information, wherein the generation unit includes:
[0122] A first generation subunit, configured to generate target signature information for the target model backup file based on the device key of the electronic device and the model signature information of the target model;
[0123] A first acquisition subunit, configured to obtain the target version information corresponding to the target model backup file;
[0124] A first storage subunit, configured to store the target signature information and the target version information in a trusted storage area.
[0125] Optionally, the first determination unit includes:
[0126] A first determination subunit, configured to analyze the user association information to determine the usage frequency of the user for the target model and / or the application requirement characteristics of the target model;
[0127] A second determination subunit, configured to determine the target backup mode of the target model based on the usage frequency and / or application requirement characteristics, where the target backup mode includes a first backup mode and a second backup mode, and the first backup mode represents performing matching backup when the target model is updated; the second backup mode represents backing up the target model according to a target backup period;
[0128] Alternatively,
[0129] a third determination subunit, configured to, when at least one model is configured in the electronic device and the user association information represents first selection information for a target model in the models, determine a target backup mode of the target model as a first backup mode, where the first backup mode represents performing matching backup when the target model is updated.
[0130] Optionally, the creation unit includes:
[0131] a second acquisition subunit, configured to obtain first model data corresponding to a target model to be updated based on the target backup mode;
[0132] a fourth determination subunit, configured to determine data to be updated for a current model backup file of the target model in a local storage area based on the first model data and second model data corresponding to a current data state of the target model;
[0133] a third acquisition subunit, configured to update the current model backup file based on the data to be updated to obtain a target model backup file.
[0134] Optionally, the detection unit includes:
[0135] a first detection subunit, configured to detect data integrity of a target model of an electronic device to obtain a first detection result;
[0136] a fifth determination subunit, configured to, if the first detection result indicates that the data of the target model is incomplete, determine that the target model is in a first state;
[0137] a second detection subunit, configured to, if the first detection result indicates that the data of the target model is complete, detect whether version information of the target model is the version information selected by the user, and if not, determine that the target model is in a first state.
[0138] Optionally, the creation unit includes
[0139] a fourth acquisition subunit, configured to obtain second selection information of a user when the target model is updated in the case that the target backup mode is the first backup mode; the second selection information represents whether to back up the currently updated target model;
[0140] a first creation subunit, configured to create a target model backup file of the target model based on the second selection information.
[0141] Optionally, the feature identification information includes the first model signature information of the target model and the first version information of the target model, where the recovery unit includes:
[0142] A fifth acquisition subunit, configured to acquire the second model signature information of the target model backup file;
[0143] A sixth determination subunit, configured to determine the data integrity of the target model backup file based on the first model signature information and the second model signature information;
[0144] A third detection subunit, configured to, if the data of the target backup file is complete, detect whether the first version information is consistent with the second version information of the target model backup file;
[0145] A seventh determination subunit, configured to, if inconsistent, determine whether the second version information of the target model backup file is consistent with the version information selected by the user;
[0146] A first recovery subunit, configured to, if the second version information of the target model backup file is consistent with the version information selected by the user, recover the target model based on the target model backup file.
[0147] Optionally, the recovery unit further includes:
[0148] A sixth acquisition subunit, configured to, if the second version information of the target model backup file is inconsistent with the version information selected by the user, acquire the original backup file corresponding to the target model in the local storage area;
[0149] A download subunit, configured to download an incremental data file corresponding to the target model in the cloud; where the incremental data file represents a data file to be updated based on the target model and the original backup file;
[0150] A second recovery subunit, configured to recover the target model based on the original backup file and the incremental data file.
[0151] It should be noted that the specific implementation of each unit and subunit in this embodiment can refer to the corresponding content in the foregoing, and will not be elaborated here.
[0152] In another embodiment of the present application, a readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the model recovery method as described above is implemented.
[0153] In another embodiment of the present application, an electronic device is further provided. The electronic device may include:
[0154] A memory for storing an application program and data generated by the operation of the application program;
[0155] A processor for executing the application program to implement the model recovery method as described above.
[0156] It should be noted that the specific implementation of the processor in this embodiment can refer to the corresponding content in the previous text and will not be elaborated here.
[0157] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, refer to the description in the method section.
[0158] Those skilled in the art can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0159] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be directly implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0160] The above description of the disclosed embodiments enables those skilled in the art to implement or use this application. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application will not be limited to the embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.
Claims
1. A model recovery method, comprising: Detecting that a target model of an electronic device is in a first state, and obtaining feature identification information of the target model, where the feature identification information characterizes the data state of the target model; Obtaining a target model backup file corresponding to the target model in a local storage area; Recovering the target model based on the target model backup file and the feature identification information, so that the recovered target model is in a second state; Wherein, the first state characterizes the non - available state of the target model, and the second state characterizes the available state of the target model; The target model backup file stored in the local storage area is a backup data file for the target model determined based on user - associated information.
2. The method according to claim 1, further comprising: When the model is in the second state, obtaining user - associated information for the target model; Based on the user - associated information, determining a target backup mode of the target model; Based on the target backup mode, creating a target model backup file of the target model; Storing the target model backup file in a local storage area; Generating feature identification information of the target model backup file, and storing the feature identification information in a trusted storage area.
3. The method according to claim 2, wherein the feature identification information includes target signature information and target version information, where The generating feature identification information of the target model backup file and storing the feature identification information in a trusted storage area includes: Generating target signature information of the target model backup file based on a device key of the electronic device and model signature information of the target model; Obtaining target version information corresponding to the target model backup file; Storing the target signature information and the target version information in a trusted storage area.
4. The method according to claim 2, wherein the determining the target backup mode of the target model based on the user - associated information includes: Analyzing the user - associated information to determine the usage frequency of the user for the target model and / or the application requirement characteristics of the target model; Based on the usage frequency and / or application requirement characteristics, determining the target backup mode of the target model, where the target backup mode includes a first backup mode and a second backup mode, and the first backup mode characterizes performing matching backup when the target model is updated; The second backup mode characterizes backing up the target model according to a target backup period; Or, When at least one model is configured in the electronic device and the user - associated information characterizes first selection information for the target model in the models, determining the target backup mode of the target model as the first backup mode, and the first backup mode characterizes performing matching backup when the target model is updated.
5. The method according to claim 2, wherein the creating a target model backup file of the target model based on the target backup mode includes: Based on the target backup mode, obtaining first model data corresponding to the target model to be updated; Determine the data to be updated for the current model backup file of the target model in the local storage area based on the first model data and the second model data corresponding to the current data state of the target model; Update the current model backup file based on the data to be updated to obtain a target model backup file.
6. The method according to claim 1, wherein the detecting that the target model of the electronic device is in the first state includes: Detect the data integrity of the target model of the electronic device to obtain a first detection result; If the first detection result indicates that the data of the target model is incomplete, determine that the target model is in the first state; If the first detection result indicates that the data of the target model is complete, detect whether the version information of the target model is the version information selected by the user. If not, determine that the target model is in the first state.
7. The method according to claim 4, wherein the creating a target model backup file of the target model based on the target backup mode includes When the target backup mode is the first backup mode, obtain the second selection information of the user when the target model is updated; The second selection information indicates whether to back up the currently updated target model; Create a target model backup file of the target model based on the second selection information.
8. The method according to claim 1, wherein the feature identification information includes first model signature information of the target model and first version information of the target model, where The restoring the target model based on the target model backup file and the feature identification information includes: Obtain the second model signature information of the target model backup file; Determine the data integrity of the target model backup file based on the first model signature information and the second model signature information; If the data of the target backup file is complete, detect whether the first version information is consistent with the second version information of the target model backup file; If not, determine whether the second version information of the target model backup file is consistent with the version information selected by the user; If the second version information of the target model backup file is consistent with the version information selected by the user, restore the target model based on the target model backup file.
9. The method according to claim 8, further comprising: If the second version information of the target model backup file is not consistent with the version information selected by the user, obtain the original backup file corresponding to the target model in the local storage area; Download the incremental data file corresponding to the target model in the cloud; wherein, the incremental data file represents the data file to be updated based on the target model and the original backup file; Restore the target model based on the original backup file and the incremental data file.
10. A model restoration device, comprising: A detection unit, configured to detect that the target model of the electronic device is in the first state, and obtain the feature identification information of the target model, where the feature identification information represents the data state of the target model; An acquisition unit, configured to obtain a target model backup file corresponding to the target model in the local storage area; A restoration unit, configured to restore the target model based on the target model backup file and the feature identification information, so that the restored target model is in the second state; Among them, the first state characterizes the unavailable state of the target model, and the second state characterizes the available state of the target model; The target model backup file stored in the local storage area is a backup data file for the target model determined based on user association information.