A model training method and related device
By conducting model training on multiple training time periods and using the target decision model to determine the training time period, the problems of user data privacy leakage and device temperature increase in electronic devices are solved, and user experience and energy utilization are improved.
Patent Information
- Application Number
- CN202411102853.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-08-13
AI Technical Summary
The prior art has problems with user data privacy leakage and equipment temperature increase during model training in electronic devices, which affects user experience and performance.
By conducting model training on multiple training time periods, the target decision model is used to determine the training time period based on user data and energy consumption data, reducing the negative impact of the equipment and improving energy utilization.
It reduces users' perception of the model training process, reduces device temperature and charging time, and improves user experience and energy utilization.
Smart Images

Figure CN118643889B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a model training method and related devices. Background Art
[0002] As users' personalized needs increase, the conventional functions of electronic devices are difficult to meet users' usage needs. Therefore, electronic devices can send user data to cloud servers, and the cloud servers train models based on the user data, so that the trained models can realize functions related to users to meet users' personalized needs.
[0003] However, since user data involves user privacy, there may be a risk of leaking user privacy when the electronic device sends user data to the cloud server. Therefore, the electronic device trains the model locally based on the user data to solve the problem of privacy leakage of user data during transmission. For example, the electronic device can train the model based on the user data during the charging process. However, the electronic device will generate heat when charging. If the model is trained during the charging process, the heat generated by the electronic device may further increase, making the temperature of the electronic device higher. If the temperature of the electronic device is high, it may affect the performance of the electronic device and reduce the user experience. Summary of the invention
[0004] The embodiment of the present application provides a model training method and related devices. By performing model training in multiple training time periods, the terminal device can reduce the negative impact of model training on users and improve the energy utilization of the terminal device.
[0005] In a first aspect, the present application provides a model training method, the method comprising:
[0006] In response to the first instruction, first training data and first energy consumption data are acquired, wherein the first training data is used to indicate the total time required for training the first model, and the first energy consumption data is used to characterize the change in power of the terminal device;
[0007] Inputting the first training data and the first energy consumption data into a target decision model, so that the target decision model outputs a plurality of training time periods, wherein the sum of the durations respectively corresponding to the plurality of training time periods is equal to the total duration, and the plurality of training time periods include a start time and an end time corresponding to each training time period, and one or more of a first power level of the terminal device corresponding to the start time and a second power level of the terminal device corresponding to the end time;
[0008] The first model is trained according to the multiple training time periods.
[0009] In the above method, the first training data is used to determine the total time required for training the first model, so that the terminal device can divide multiple training time periods according to the total time. Energy consumption data includes but is not limited to data corresponding to energy consumption generated by the terminal device during operation, such as energy consumption data generated when the terminal device runs an application, energy consumption data generated when the terminal device runs an algorithm, etc. The terminal device runs in response to the user's operation, so the energy consumption data of the terminal device can reflect the rules of the user's use of the terminal device, that is, the user's usage habits. Therefore, "the terminal device determines the training time period according to the energy consumption data" can be understood as "the terminal device determines the training time period according to the user's usage habits", so that the determined training time period can be consistent with the user's usage habits. For example, the user's usage habits are used to reflect the user's frequency of use of the terminal device, and the user's usage habits include but are not limited to time habits and location habits. The terminal device trains the first model according to the training time period that conforms to the user's usage habits. For example, according to the user's time habits of using the terminal device, the terminal device trains the first model at night between 1:00 and 5:00 when the user's usage frequency is low. For another example, according to the user's location habits of using the terminal device, the terminal device trains the first model when it is at a work place where the user's usage frequency is low. Therefore, since the frequency of user use of the terminal device is low during the training time period, the user's perception of the training process can be reduced during the training process, and the negative impact on the user (such as increased heat generation of the terminal device, increased charging time, running jams, etc.) can be reduced. The multiple training time periods determined by the terminal device based on the energy consumption data are consistent with the power changes of the terminal device, thereby improving the energy utilization of the terminal device. Therefore, the terminal device trains the first model in sequence according to the start and end times indicated by the multiple training time periods, rather than concentrating on training the first model in one time period (such as the time period when the terminal device is charging), which can improve the energy utilization of the terminal device and reduce the speed of power consumption. This reduces the user's perception of training when the terminal device is training the first model, and further improves the user's usage experience.
[0010] In a possible implementation, the training the first model according to the multiple training time periods includes:
[0011] The first model is trained starting from the start time of a first training time period, and the training of the first model is terminated at the end time of the first training time period, wherein the first training time period is one of the multiple training time periods, and when the second electrical quantity corresponding to the end time of the first training time period is less than or equal to the first electrical quantity corresponding to the start time of the first training time period, the electrical quantity difference between the third electrical quantity and the fourth electrical quantity is less than or equal to the electrical quantity threshold, the third electrical quantity corresponds to the maximum electrical quantity of the terminal device in the first training time period, and the fourth electrical quantity corresponds to the minimum electrical quantity of the terminal device in the first training time period.
[0012] In the above method, the second power corresponding to the end time of the first training time period is less than or equal to the first power corresponding to the start time of the first training time period, which can indicate that the power of the terminal device during the first training time period is on a downward trend. The power difference between the third power and the fourth power is less than or equal to the power threshold, which can indicate that the difference between the maximum power and the minimum power of the terminal device in the first training time period is small, and further indicates that the power of the terminal device during the first training time period has a slow downward trend, that is, compared with the model training when the terminal device is charging, the power consumption of the terminal device during the first training time period is less. Less power consumption can indicate that the terminal device runs less data during the first training time period, so the terminal device has more unused computing resources (such as computing power or memory, etc.). If the terminal device trains the first model in the first training time period, the unused computing resources in the terminal device can be reasonably used, thereby improving the utilization rate of the energy and computing resources of the terminal device. From the user's perspective, it can be understood that the user's frequency of use of the terminal device during the first training time period is low. If the terminal device trains the first model in the first training time period, since the user's frequency of use of the terminal device is low at this time, the negative perceived factors such as the computing power consumed and the heat generated when the terminal device trains the first model will have less impact on the user.
[0013] In a possible implementation manner, before acquiring the first training data and the first energy consumption data in response to the first instruction, the method further includes:
[0014] Acquire a first training set, where the first training set includes second training data of the first model and second energy consumption data of the terminal device;
[0015] The original decision model is trained according to the second training data and the second energy consumption data to obtain the target decision model, wherein the original decision model is a model pre-stored in the terminal device.
[0016] In the above method, the second energy consumption data is the energy consumption data corresponding to the terminal device, for example, it can be the energy consumption data generated by the actual user of the terminal device when using the terminal device. Because the user's usage habits of the terminal device will affect the actual energy consumption changes of the terminal device, and the health of the hardware such as the battery in the terminal device will also affect the actual energy consumption changes of the terminal device. In addition, the target decision model is trained based on the historical energy consumption data of the terminal device. Therefore, if the actual energy consumption change of the terminal device is significantly different from the historical energy consumption change of the terminal device, it may cause the accuracy of multiple training time periods output by the target decision model to be low. Therefore, the terminal device can iteratively train the original decision model based on the actual energy consumption data of the terminal device, which can reduce the impact of changes in user usage habits and / or changes in the health of hardware such as the battery in the terminal device on the output results of the target decision model.
[0017] In a possible implementation manner, training the original decision model according to the second training data and the second energy consumption data to obtain the target decision model includes:
[0018] Inputting the second training data and the second energy consumption data into the original decision model, so that the original decision model outputs N start times and N end times, and one or more of N estimated start power and N estimated end power of the terminal device, wherein N is an integer greater than 1, the Nth start time of the N start times and the Nth end time of the N end times are used to determine the Nth training time period of the first model, the N estimated start power and the N start times correspond one-to-one, and the N estimated end power and the N end times correspond one-to-one;
[0019] The original decision model is trained based on the N start times, the N end times, the N estimated start power quantities and the N estimated end power quantities to obtain the target decision model.
[0020] In the above method, since the training time period output by the target decision model is required to be consistent with the energy consumption (power) change of the terminal device, when training the original decision model, the training can be based on the power of the terminal device. For example, in addition to outputting the start time and end time for training the first model, the original decision model can also infer the power corresponding to the start time and the power corresponding to the end time of the terminal device, and then iteratively train the original decision model based on the power inferred by the original decision model.
[0021] In a possible implementation manner, the training of the original decision model based on the N start times, the N end times, the N estimated start power quantities, and the N estimated end power quantities to obtain the target decision model includes:
[0022] Performing simulation training on the first model according to the N start times and the N end times, obtaining N simulated start power quantities and N simulated end power quantities of the terminal device, wherein the N simulated start power quantities correspond one-to-one to the N start times, and the N simulated end power quantities correspond one-to-one to the N end times;
[0023] Determine a first comparison value of an N-th estimated starting electric quantity among the N estimated starting electric quantities and an N-th simulated starting electric quantity among the N simulated starting electric quantities, and a second comparison value of an N-th estimated ending electric quantity among the N estimated ending electric quantities and an N-th simulated ending electric quantity among the N simulated ending electric quantities;
[0024] When the first comparison value is less than or equal to a first comparison threshold and the second comparison value is less than or equal to a second comparison threshold, the parameters of the target decision model are determined according to the first comparison value and the second comparison value to obtain the target decision model.
[0025] In the above method, the server simulates and trains the first model based on the start time and end time inferred by the original decision model, and can simulate the power consumed by training the first model, for example, simulating the simulated start power corresponding to the start time, and simulating the simulated end power corresponding to the end time. Then, the estimated start power inferred by the original decision model is compared with the simulated start power, and the estimated end power inferred by the original decision model is compared with the simulated end power, and the parameters of the original decision model are modified according to the comparison value. Then, the original decision model continues to be iteratively trained until the first comparison value is less than or equal to the first comparison threshold and the second comparison value is less than or equal to the second comparison threshold, at which time the target decision model is successfully trained. Therefore, through the above training process, the training time period inferred by the target decision model can be made to conform to the power changes of the terminal device, thereby improving the accuracy of the target decision model reasoning results.
[0026] In a possible implementation, the original decision model is a model trained by the server based on the third training data and third energy consumption data of the first model, the third energy consumption data includes energy consumption data generated by multiple terminal devices, and the third energy consumption data includes multiple energy consumption curves, and the multiple energy consumption curves are respectively used to indicate the power changes of the terminal devices. The power changes corresponding to the multiple energy consumption curves are used to divide the multiple energy consumption curves into energy consumption curves corresponding to M categories, where M is an integer greater than 1, and M is less than or equal to the number corresponding to the multiple energy consumption curves.
[0027] In the above method, in order to save the computing resources of the terminal device, the original decision model can be trained on the server and then deployed on the terminal device for use. The third energy consumption data includes energy consumption data generated by multiple terminal devices, for example, energy consumption data generated by one or more users using the terminal devices respectively. Since different users have different usage habits for the terminal devices, the energy consumption data generated are also different. The types of third energy consumption data obtained by the terminal device can be more, so that the trained original decision model conforms to the usage habits of different users for the terminal device. In order to refine the second training set and enhance the accuracy and robustness of the training of the original decision model, the acquired energy consumption curves can be classified first, and then the original decision model can be trained according to different categories of energy consumption curves.
[0028] In a possible implementation, the original decision model is a model trained based on the third training data and the fourth energy consumption data, the fourth energy consumption data is determined based on the third energy consumption data, the third energy consumption data is the energy consumption data generated when the terminal device is running on the first chip platform, the fourth energy consumption data is the energy consumption data generated when the terminal device is running on the second chip platform, and the chip of the terminal device is mounted on the first chip platform or the second chip platform.
[0029] In the above method, there is no need to collect a large amount of energy consumption data generated when the terminal device is running on the second chip platform. The fourth energy consumption data can be determined directly based on the third energy consumption data, which saves the time for collecting energy consumption data, reduces the difficulty of training the original decision model, and shortens the cycle of training the original decision model. For example, the third energy consumption data generated when the terminal device is running on the first chip platform is more than the energy consumption data generated when it is running on the second chip platform. If the original decision model is trained based on the energy consumption data generated when running on the second chip platform, it may be limited by the number of energy consumption data generated when running on the second chip platform, resulting in a small number and / or type of training sets determined, affecting the training of the original decision model. Therefore, the fourth energy consumption data can be determined based on the third energy consumption data, so that the number and / or type of the fourth energy consumption data can be increased to improve the effect of training the original decision model.
[0030] In a possible implementation, the fourth energy consumption data includes data obtained by fitting the third energy consumption data according to an energy consumption difference, wherein the energy consumption difference is the difference between a first energy consumption and a second energy consumption, wherein the first energy consumption is the energy consumption generated by the terminal device running a first function algorithm on the first chip platform, and the second energy consumption is the energy consumption generated by the terminal device running a second function algorithm on the second chip platform.
[0031] In the above method, different chip platforms will generate different energy consumption during operation, which is mainly caused by the different energy consumption of functional algorithms in different chip platforms. Therefore, if the electronic device can obtain the energy consumption of the first functional algorithm in the first chip platform and the energy consumption of the second functional algorithm in the second chip platform. Then, the electronic device can fit the fourth energy consumption data based on the third energy consumption data according to the difference between the first energy consumption and the second energy consumption, saving the time of collecting energy consumption data, reducing the difficulty of training the original decision model, and shortening the cycle of training the original decision model.
[0032] In a second aspect, an electronic device is provided by an embodiment of the present application, and the electronic device includes: one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method for updating the corner mark described in the first aspect or any possible implementation of the first aspect.
[0033] In a third aspect, the present application provides a chip or a chip system, the chip or chip system includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected by a line, and the at least one processor is used to run a computer program or instruction to execute the method for updating the corner mark described in the first aspect or any possible implementation of the first aspect. The communication interface in the chip can be an input / output interface, a pin or a circuit, etc.
[0034] In a possible implementation, the chip or chip system described above in the embodiment of the present application further includes at least one memory, in which instructions are stored. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or a storage unit of the chip (such as a read-only memory, a random access memory, etc.).
[0035] In a fourth aspect, an embodiment of the present application provides a computer storage medium, which stores a computer program. When the computer program is executed by a processor, the computer executes the method for updating the superscript as described in the first aspect or any possible implementation of the first aspect.
[0036] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a communication device, enables the communication device to execute a method for updating a superscript as described in the first aspect or any possible implementation of the first aspect.
[0037] It should be understood that the description of technical features, technical solutions, beneficial effects or similar language in this application does not imply that all features and advantages can be realized in any single embodiment. On the contrary, it is understood that the description of features or beneficial effects means that specific technical features, technical solutions or beneficial effects are included in at least one embodiment. Therefore, the description of technical features, technical solutions or beneficial effects in this specification does not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and beneficial effects described in the present embodiment can also be combined in any appropriate manner. Those skilled in the art will understand that the embodiment can be realized without one or more specific technical features, technical solutions or beneficial effects of a specific embodiment. In other embodiments, additional technical features and beneficial effects can also be identified in a specific embodiment that does not embody all embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The following is an introduction to the drawings used in the embodiments of the present application.
[0039] Figure 1A and Figure 1B This is a schematic diagram of an interface of a terminal device provided in an embodiment of the present application;
[0040] Figure 2 This is a schematic diagram of the power consumption of a terminal device provided in an embodiment of the present application;
[0041] Figure 3 It is a structural diagram of a terminal device provided in an embodiment of the present application;
[0042] Figure 4 It is a software structure block diagram of a terminal device provided in an embodiment of the present application;
[0043] Figure 5 is a schematic diagram of training a first model provided in an embodiment of the present application;
[0044] Figure 6 It is a structural diagram of a decision model provided in an embodiment of the present application;
[0045] Figure 7 is a schematic diagram of a terminal device training a first model provided in an embodiment of the present application;
[0046] Figure 8 is a schematic diagram of a training target decision model provided in an embodiment of the present application;
[0047] Fig. 9 is a schematic diagram of a training original decision model provided in an embodiment of the present application;
[0048] Fig.10 is a schematic diagram of a classified second energy consumption curve provided in an embodiment of the present application;
[0049] Fig.11A and Fig. 11B is a schematic diagram of a modified second energy consumption curve provided in an embodiment of the present application;
[0050] Fig.12 It is a flowchart of a model training method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.
[0052] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0053] In order to facilitate the understanding of the embodiments of the present application, the technical problems that the present application specifically aims to solve are analyzed and proposed below.
[0054] With the rapid development of artificial intelligence technology, electronic devices (such as mobile phones and other terminal devices) can train models based on user data, so that the trained models can realize user-related functions to meet the personalized needs of users. Among them, user-related functions include but are not limited to image recognition functions related to user appearance features, recommendation functions related to user interest preferences, etc.
[0055] For example, the following will take the camera application as an example. Figure 1A and Figure 1B , Figure 1A and Figure 1B The terminal device's camera application is used to take photos and record videos. The terminal device responds to user operations, such as when the user clicks on the desktop icon of the camera application. Figure 1A or Figure 1B At the same time, the terminal device can also start the model corresponding to the camera application, such as the first detection model or the second detection model, to implement the function of the camera application through the first detection model or the second detection model.
[0056] The following is an explanation using the focus tracking function in the camera application as an example, wherein the terminal device can automatically identify the subject (such as a person, cat, dog, etc.) displayed in the shooting preview screen through the focus tracking function, so that the subject in the captured image and / or video has higher clarity.
[0057] like Figure 1A and Figure 1BAs shown, in the camera interface, the terminal device 10 displays a shooting preview screen (e.g., shooting preview screen 101, shooting preview screen 108), a function selection area 102, a mode selection area 103, a zoom function 104, a gallery 105, a shooting button 106, and a switch button 107. Among them, the function selection area 102 includes at least one function setting button. The function setting button includes but is not limited to: a visual button, a flash button, an artificial intelligence (AI) camera button, a color button, and a setting button. If the terminal device 10 detects that the user touches any function setting button in the function selection area 102, the corresponding function is set according to the touched function setting button. For example, if it is detected that the user touches the flash button, the flash is set. The mode selection area 103 includes at least one shooting mode button. The shooting mode buttons include but are not limited to: an aperture mode button, a night scene mode button, a portrait mode button, a photo mode button, a video mode button, a professional mode button, and more mode buttons. If the terminal device 10 detects that the user touches any shooting mode button in the mode selection area 103, it switches to the corresponding shooting mode according to the touched shooting mode button. The gallery 105 is used to review the taken pictures. Specifically, the gallery 105 is used to provide the user with an entrance to review the taken pictures. The user clicks the gallery 105 to enter the interface for reviewing the taken pictures. The shooting button 106 is used to take pictures, and the switch button 107 is used to switch the front and rear cameras when shooting.
[0058] like Figure 1A As shown, when the terminal device 10 implements the focus tracking function through the first detection model, a shooting preview screen 101 is displayed in the camera interface. The shooting preview screen 101 displays detection frames, such as detection frame 1011, detection frame 1012 and detection frame 1013. Among them, the detection frame is used to mark the shooting subject in the shooting preview screen 101, for example, the detection frame 1011 is used to mark the cat 1014 displayed in the shooting preview screen 101, the detection frame 1012 is used to mark the cat 1015 displayed in the shooting preview screen 101, and the detection frame 1013 is used to mark the cat 1016 displayed in the shooting preview screen 101. Among them, cat 1016 is the user's cat.
[0059] In a possible implementation, the terminal device 10 detects the shooting subject displayed in the shooting preview screen 101 through the first detection model, thereby obtaining detection frame 1011, detection frame 1012 and detection frame 1013. The first detection model is a model trained based on multiple images containing shooting subjects (e.g., different cats), so the terminal device 10 can detect all cats displayed in the shooting preview screen 101 through the first detection model. For example, cat 1014, cat 1015 and cat 1016. However, in the process of training the first detection model, the user data (e.g., images containing cat 1016) in the training data is not distinguished, so the first detection model cannot detect the user's cat from multiple cats, and then during the shooting process, only the user's cat will not be marked through the detection frame.
[0060] See also Figure 1B , when the terminal device 10 implements the focus tracking function through the second detection model, a shooting preview screen 108 is displayed in the camera interface. A detection frame 1081 is displayed in the shooting preview screen 108. Among them, the detection frame 1081 is used to mark the cat 1016. Since the cat 1016 is the user's cat, the detection frame 1081 marks the user's cat from the cats 1014, 1015 and 1016 displayed in the shooting preview screen 108.
[0061] In a possible implementation, the terminal device 10 detects the user's cat displayed in the shooting preview screen 108 through the second detection model to obtain a detection frame 1081. The second detection model is a model after the terminal device 10 iteratively trains the first detection model based on the image corresponding to the user's cat (i.e., cat 1016) in the user data, so that the second detection model has the ability to recognize the user's cat. For example, the image corresponding to the user's cat in the user data can be an image of cat 1016 in the gallery of the terminal device 10. Therefore, the terminal device 10 can implement user-related functions through the second detection model. Specifically, the terminal device 10 can detect cat 1016 from cats 1014, cat 1015, and cat 1016 displayed in the shooting preview screen 108 through the second detection model. Thus, the terminal device 10 can automatically focus on the cat 1016 according to the annotation information of the detection frame 1081, so that the clarity of the cat 1016 in the captured image and / or video is improved, which can meet the user's personalized needs for automatically focusing on the cat 1016 through the terminal device 10.
[0062] Among them, for the model (for example Figure 1B The training methods of the second detection model shown in the figure include cloud training and local training.
[0063] During the cloud training process, the terminal device sends the user data generated by the terminal device to the cloud server. Then, the cloud server trains the model based on the user data to obtain a trained model. Finally, the terminal device downloads the trained model from the cloud server, and the trained model can realize user-related functions.
[0064] It can be seen that the training of the model requires the interaction between the terminal device and the cloud server, which may cause the link of the training model to be too long and increase the time of training the model. In addition, user data involves user privacy, and transferring user data to the cloud server may have the risk of leaking user privacy. Although with the continuous development of model training technology, the risk of data leakage when training models on cloud servers has been reduced. For example, Federated Meta Learning (FML) can reduce the risk of data leakage when training models on cloud servers. However, considering the user experience, users still have concerns about data leakage when transferring user data involving privacy to cloud servers. Therefore, training models through cloud servers has the risk of data leakage on the one hand, and on the other hand, it may affect the user's experience of using terminal devices.
[0065] In order to solve the problem of data leakage when training models on cloud servers, you can choose to train the model based on user data locally on the terminal device (i.e. local training). Since the user data is stored locally on the terminal device, there is no problem of information leakage. However, due to the limited computing power of the terminal device, it takes a long time for the terminal device to train the model, so the training model consumes more power. In order to ensure that the terminal device has the power required for training the model during the training process, the terminal device usually trains the model while charging. The training time for the terminal device to train the model can be found in Figure 2 Description.
[0066] See also Figure 2 , Figure 2 Schematic diagram of the power consumption of a terminal device provided in an embodiment of the present application. Figure 2 As shown, Figure 2The horizontal axis represents the time of the terminal device, and the vertical axis represents the power of the terminal device. During the process from time point A to time point B, and from time point C to time point D, the power of the terminal device shows a downward trend. It can be seen that the terminal device is not in a charging state during the process from time point A to time point B, and from time point C to time point D. During the process from time point B to time point C, and from time point D to time point E, the power of the terminal device shows a continuous upward trend. It can be seen that the terminal device is in a charging state during the process from time point B to time point C, and from time point D to time point E. Since the terminal device in a charging state can provide sufficient power for training the model, the terminal device can train the model during the process from time point B to time point C, and / or from time point D to time point E.
[0067] Although the terminal device in the charging state can provide enough power for the model training process, there are still the following problems: the terminal device will generate heat in the charging state. If the model is trained during the charging process, the heat generated by the terminal device may be further increased, making the temperature of the terminal device higher. If the temperature of the terminal device is high, it may affect the performance of the terminal device. In the process of training the model, the terminal device will generate energy consumption, that is, it will consume the power of the terminal device, resulting in an increase in the time it takes for the terminal device to charge the power to the target power. Users need more time to charge the terminal device, which affects the user experience. Since the terminal device can only perform model training when it is in the charging state, if the terminal device is not in the charging state when it receives the instruction of the training model from the cloud, the terminal device will not train the model immediately, but will train the model when it is in the charging state. This may cause the model to be updated and iterated untimely, affecting the accuracy of the model output results.
[0068] In summary, in the solution where the cloud server trains the model on the terminal device side based on user data, there is a risk of leaking user information. In the solution where the model is trained while the terminal device is charging, although the user data used for model training is stored locally on the terminal device, the problem of user information leakage can be solved. However, in the process of training the model on the terminal device, the heat generation of the terminal device will increase, the charging time of the terminal device will increase, and the model update iteration will not be timely.
[0069] In order to solve the above problems, an embodiment of the present application provides a model training method. The terminal device determines multiple training time periods based on the training data of the first model and the energy consumption data of the terminal device. Then, the first model is trained according to the start time and the end time respectively indicated by the multiple training time periods. In a possible implementation, the terminal device determines the training strategy for the first model through the target decision model. For example, the training strategy includes multiple training time periods for training the first model. Among them, the target decision model is a model trained according to the training data of the first model and the energy consumption data of the terminal device, so the target decision model can obtain the training strategy for the first model based on the training data of the first model and the energy consumption data of the terminal device.
[0070] The first model includes a machine learning model or an artificial intelligence model built into the terminal device, and the first model can be used to implement functions such as speech recognition, image recognition, translation, predictive text, gesture recognition, etc. in the terminal device. The training data of the first model is used to determine the total time required for the terminal device to train the first model.
[0071] The energy consumption data of the terminal device includes the energy consumption curve of the terminal device (also called the power consumption change curve), and the terminal device can determine the user's usage habits of the terminal device based on the energy consumption curve.
[0072] Exemplarily, the training time period determined by the terminal device according to the energy consumption curve meets the user's usage habits of the terminal device, and can reduce the user's negative perception (such as increased heat generation of the terminal device, increased charging time of the terminal device, etc.) during the process of the terminal device training the first model. Multiple training time periods are equivalent to the terminal device dividing the total time required to train the first model into the above-mentioned multiple training time periods. The multiple training time periods determined according to the energy consumption curve are consistent with the power changes of the terminal device, thereby improving the energy utilization rate of the terminal device. Therefore, the terminal device trains the first model in sequence according to the start and end times indicated by the multiple training time periods, rather than concentrating on training the first model in one time period (such as the time period when the terminal device is charging), which can improve the energy utilization rate of the terminal device and reduce the speed of power consumption. Thereby reducing the user's perception of energy consumption when the terminal device is training the first model, and further improving the user's usage experience.
[0073] The model training method of the embodiment of the present application is described below in combination with the hardware structure and software structure of the terminal device.
[0074] In some embodiments, the terminal device includes but is not limited to a mobile phone, a tablet computer (Portable Android Device, PAD), a personal digital assistant (Personal Digital Assistant, PDA), a handheld device with wireless communication function, a computing device, a vehicle-mounted device or a wearable device, a virtual reality (Virtual Reality, VR) terminal device, an augmented reality (Augmented Reality, AR) terminal device, a wireless terminal in industrial control (Industrial Control), a wireless terminal in self-driving (Self Driving), a wireless terminal in remote medical (Remote Medical), a wireless terminal in smart home (Smart Home) and other mobile terminals or fixed terminals. The form of the terminal device is not specifically limited in the embodiments of the present application.
[0075] See also Figure 3 , Figure 3 is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application, such as Figure 3 As shown, the terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0076] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0077] The processor 110 can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0078] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0079] In some embodiments, the processor 110 determines multiple training time periods based on the training data of the first model and the energy consumption data of the terminal device 100, and then the processor 110 trains the first model according to the start time and end time indicated by the multiple training time periods, respectively. The first model is a machine learning model or an artificial intelligence model built into the terminal device 100.
[0080] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuits sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, and a subscriber identity module (SIM) interface.
[0081] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160.
[0082] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), and the like.
[0083] In some embodiments, the processor 110 and the display screen 194 communicate via a DSI interface to implement the display function of the terminal device 100 .
[0084] The wireless communication function of the terminal device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0085] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0086] The wireless communication module 160 can provide wireless communication solutions applied to the terminal device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.
[0087] The terminal device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0088] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the terminal device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the terminal device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.
[0089] In one embodiment of the present application, one or more first models and one or more target decision models may be stored in the internal memory 121. The first model is a machine learning model or an artificial intelligence model built into the terminal device 100, and the target decision model is used to determine multiple training time periods based on the training data of the first model and the energy consumption data of the terminal device 100, and the multiple training time periods are used to train the first model.
[0090] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The terminal device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the terminal device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The terminal device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions.
[0091] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the terminal device 100, which is different from the position of the display screen 194.
[0092] See also Figure 4 , Figure 4 1 is a software structure diagram of a terminal device provided in an embodiment of the present application. The software system of the terminal device 100 can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. For example, the software system of the layered architecture can be an Android system, or a Harmony operating system (OS), or other software systems. The embodiment of the present application takes the Android system of the layered architecture as an example to illustrate the software structure of the terminal device 100.
[0093] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0094] The application layer can include a series of application packages.
[0095] like Figure 4 As shown, the application package may include camera, WLAN, music, short message, gallery, call, navigation, Bluetooth, etc. The application in this application may also be replaced by other software such as mini-programs and atomic services.
[0096] In some embodiments, the application includes a first model. When the application is started, the terminal device 100 also loads the first model in the application, and the application can implement the corresponding function through the first model. For example, the first model in the camera application includes a detection model, and the camera application can identify the user's cat from an image containing multiple cats through the detection model to meet the user's personalized needs for taking pictures.
[0097] The application framework layer provides an application programming interface (API) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0098] like Figure 4 As shown, the application framework layer may include a training module, a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0099] The training module is used to train the model in the terminal device 100. For example, the model in the terminal device 100 includes a target decision model and a first model. The training module trains the original decision model according to the energy consumption data of the terminal device 100 and the training data of the first model to obtain the target decision model, so that the training strategy output by the target decision model meets the energy consumption requirements of the terminal device 100, wherein the training strategy includes multiple training time periods for training the first model. For another example, the training module determines multiple training time periods for training the first model through the target decision model, and then trains the first model according to the user data based on the above-mentioned multiple training time periods, so that the trained first model can realize user-related functions.
[0100] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0101] Content providers are used to store and retrieve data and make it accessible to applications. The data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0102] In some embodiments, the content provider may store energy consumption data of the terminal device 100. The energy consumption data includes an energy consumption curve, which is used to characterize the change in power consumption of the terminal device 100. Since the energy consumption curve can be used to determine the user's usage habits, the terminal device 100 obtains the energy consumption curve from the content provider, trains the original decision model according to the energy consumption curve, and obtains the target decision model, so that the target decision model meets the user's usage habits.
[0103] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0104] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0105] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used for message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, the terminal device vibrates, the indicator light flashes, etc.
[0106] The system library can include multiple functional modules, such as model library, surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0107] The model library is used to store models in the terminal device 100, such as a target decision model or a first model, etc. Among them, the first model includes a general machine learning model. For example, a speech recognition model, an image processing model, etc. The models stored in the model library can be used by the application program through the interface or service provided by the system library.
[0108] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0109] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.
[0110] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, sensor driver, etc.
[0111] The following is an example of the workflow of the software and hardware of the terminal device 100, combined with the scenario of the training model.
[0112] When the terminal device 100 receives an instruction to train the first model from the cloud server, the application layer calls the interface of the application framework layer to obtain the energy consumption data of the terminal device 100 and the training data of the first model from the content provider. The application layer determines multiple training time periods based on the energy consumption data and the training data of the first model through the target decision model. The training module of the application framework layer obtains multiple training time periods from the target decision model, and trains the first model according to the user data based on the start time and end time indicated by the multiple training time periods.
[0113] The model training method provided in the embodiment of the present application can be applied to Figure 3 The hardware structure shown in Figure 4 In a terminal device with the software structure shown in the figure, or a terminal device with more or less components than shown in the figure, or a combination of some components, or a separation of some components, or a different arrangement of components, etc., with similar hardware structure and software structure.
[0114] In this embodiment, the terminal device can divide the total training time of the first model into multiple training time periods, and then train the first model in multiple training time periods in sequence, so that the trained first model can realize user-related functions.
[0115] The first model includes a model deployed in a system application of a terminal device, such as a model used for image recognition in a camera application.
[0116] In a possible implementation, the terminal device may determine the training time period through a target decision model. The target decision model is trained based on the energy consumption data of the terminal device and the training data of the first model. Therefore, the target decision model may divide the total training time corresponding to the training data of the first model into multiple training time periods based on the energy consumption data of the terminal device. The obtained multiple training time periods may be made to conform to the energy consumption changes of the terminal device.
[0117] The following will be combined Figure 5 The process of outputting multiple training time periods by the terminal device through the target decision model to train the first model is specifically introduced.
[0118] See also Figure 5 , Figure 5 is a schematic diagram of a training first model provided in an embodiment of the present application, such as Figure 5 As shown, Figure 5 It includes steps S501 to S503.
[0119] S501: The terminal device receives a first instruction.
[0120] Specifically, in order to enable the first model to realize functions related to the user and provide more accurate services to the user, thereby improving the user's experience, after receiving the first instruction, the terminal device may iteratively train the first model based on the user data according to steps S502 and S503.
[0121] The first instruction is used to instruct the terminal device to train the first model. The first model includes a model deployed in an application of the terminal device, such as a model for image recognition in a camera application. In a possible implementation, the cloud server may be a server that maintains or develops the first model. When the first model needs to be updated, the cloud server sends the first instruction to the terminal device, and the terminal device receives the first instruction from the cloud server.
[0122] In a possible implementation, the first instruction is generated when the terminal device meets a preset condition. For example, the preset condition includes but is not limited to the terminal device reaching a preset training time, the amount of user data newly added to the terminal device reaching a preset training amount, etc.
[0123] For example, the terminal device reaching the preset training time can be understood as the system time of the terminal device being the preset training time. For example, if the preset training time is a specific time point, such as October 1st, then when the system time of the terminal device is on October 1st, the terminal device generates a first instruction. If the preset training time is a time interval, such as an interval of 3 months, then when the system time of the terminal device is the time corresponding to the last training time plus 3 months, the terminal device generates a first instruction. Among them, the preset training time can be set before the terminal device leaves the factory, or it can be the training time received by the terminal device from the cloud server.
[0124] For another example, since the terminal device needs to train the first model based on user data, the terminal device needs to first collect a certain amount of user data as a training set. Therefore, when the amount of new user data added to the terminal device reaches the preset training amount, the terminal device can generate a first instruction. In addition, because the terminal device may generate new user data during the user's use. Therefore, in order for the first model to conform to the user's usage habits and provide users with more accurate services, when the amount of new user data added to the terminal device reaches the preset training amount, the first model can be iteratively trained based on the newly generated user data.
[0125] S502: The terminal device determines a plurality of training time periods based on a target decision model in response to the first instruction.
[0126] Specifically, the terminal device starts the target decision model in response to the first instruction, and then determines multiple training time periods through the target decision model to train the first model.
[0127] The target decision model is a pre-trained model, and the training process of the target decision model can be referred to the following steps S801 and S802, which will not be described again. Therefore, the terminal device can determine multiple training time periods of the first model through the target decision model.
[0128] In one implementation, the terminal device responds to the first instruction and obtains information such as the name of the first model and the first training data of the first model from the first instruction. The first model is a model that needs to be trained, and the first training data of the first model includes but is not limited to the parameter quantity of the first model, the parameter quantity of the first model that needs to be trained, and the preset number of training iterations.
[0129] In one implementation, the terminal device obtains first energy consumption data in response to a first instruction, wherein the first energy consumption data includes information such as a historical energy consumption curve of the terminal device.
[0130] In one implementation, the terminal device inputs the first energy consumption data and the first training data of the first model into the target decision model, so that the target decision model can output multiple training time periods corresponding to the first model. Among them, there is a certain time interval between any two consecutive training time periods in the multiple training time periods. Each training time period in the multiple training time periods includes a start time and an end time. Among them, the start time is used to indicate the time when the terminal device starts training the first model, and the end time is used to indicate the time when the terminal device ends training the first model, that is, the time period between the start time and the end time is the time period for the terminal device to train the first model.
[0131] The following will be combined Figure 6 One or more modules in the target decision model are introduced. It can be understood that the modules in the target decision model are used to subdivide the reasoning process of the target decision model and do not constrain the structure of the target decision model.
[0132] Among them, the target decision model can be a model based on deep reinforcement learning. Deep reinforcement learning combines the perception ability of deep learning and the decision-making ability of reinforcement learning, and is an artificial intelligence method that is closer to the human way of thinking.
[0133] Specifically, Figure 6 : is a schematic diagram of a decision model provided in an embodiment of the present application. Figure 6 The structure of the decision model shown may be a structure corresponding to the target decision model and / or a structure corresponding to the original decision model. The target decision model will be used as an example for explanation below. It is understood that the structure of the original decision model can be referred to in the embodiment of the present application. Figure 6 The description of , will not be repeated here. Figure 6 As shown, the target decision model includes an energy consumption analysis module, an information feedback module and a decision module.
[0134] The energy consumption analysis module is used to analyze the first energy consumption data (such as the energy consumption curve of the terminal device) to obtain analysis information. The energy consumption curve is used to indicate the change of energy consumption. For example, if the energy consumption curve includes the change of energy consumption of the terminal device from the first moment to the second moment, then the energy consumption curve is used to indicate the change of the remaining power of the terminal device from the first moment to the second moment.
[0135] For example, if the energy consumption curve between any two moments between the first moment and the second moment (for example, moment A and moment B, where moment B is the moment after moment A) shows an upward trend, it can be determined that the terminal device is in a charging state. If the energy consumption curve between any two moments between the first moment and the second moment (for example, moment C and moment D, where moment D is the moment after moment C) shows a gentle downward trend, then the terminal device is in a first power consumption state between moment C and moment D, wherein the first power consumption state is used to indicate that the power consumption of the terminal device between moment C and moment D is less than the power threshold, thereby indicating that the power consumption of the terminal device between moment C and moment D is less. Furthermore, the less power consumption between moment C and moment D can also indicate that the terminal device has less data running between moment C and moment D, so the terminal device may have computing resources for training the first model.
[0136] If the energy consumption curve between any two moments between the first moment and the second moment (for example, moment E and moment F, where moment F is the moment after moment E) shows a trend of a faster decline, then the terminal device is in the second power consumption between moment E and moment F, where the second power consumption is used to indicate that the power consumption of the terminal device between moment E and moment F is greater than or equal to the power threshold, thereby indicating that the power consumption of the terminal device between moment E and moment F is relatively large. Furthermore, the relatively large power consumption between moment E and moment F can also indicate that the terminal device has more data running between moment E and moment F, so the terminal device may not have computing resources for training the first model.
[0137] The decision module is used to receive the parsing information from the energy consumption parsing module, and then determine multiple time periods according to the parsing information and the first training data of the first model. Among them, the first training data of the first model is used to determine the total training time corresponding to the first model, so the multiple training time periods can be multiple time periods divided from the total training time corresponding to the first model. The first energy consumption data corresponding to the parsing information is used to determine the energy consumption change of the terminal device. Further, the first energy consumption data corresponding to the parsing information is also used to determine the user's usage habits for the terminal device. Therefore, the multiple training time periods determined by the decision module based on the first energy consumption data of the terminal device are consistent with the user's usage habits. For example, the time period in which the user uses the terminal device to a low degree is used as the training time period, and the time period in which the user uses the terminal device to a high degree is not used as the training time period. Among them, the time period in which the user uses the terminal device to a low degree can be understood as the time period in which the energy consumption decrease rate is less than the speed threshold in the first energy consumption data of the terminal device. The time period in which the user uses the terminal device to a high degree can be understood as the time period in which the energy consumption decrease rate is greater than or equal to the speed threshold in the first energy consumption data of the terminal device. Therefore, the terminal device training the first model during the training time period can be understood as training the first model during the time period when the user uses the terminal device less, which can reduce the negative impact of the terminal device on the user during the training of the first model (such as heat impact, energy consumption impact, etc.).
[0138] Among them, any one of the multiple training time periods (for example, the first time period) is taken as an example for explanation, and the first time period includes a start time and an end time, as well as an estimated power of the terminal device corresponding to the start time and an estimated power of the terminal device corresponding to the end time. The start time is used to indicate the time when the terminal device starts training the first model, and the end time is used to indicate the time when the terminal device ends training the first model, that is, the time period between the start time and the end time is the time period for the terminal device to train the first model. The estimated power of the terminal device corresponding to the start time and the estimated power of the terminal device corresponding to the end time are mainly used for the training of the target decision model, and their role will be specifically introduced in Example 2.
[0139] The information feedback module is used in the training process of the target decision model, and is not used in the inference process of the target decision model. Specifically, in the training process of the target decision model, the information feedback module is used to obtain the actual power of the terminal device in the process of simulating the terminal device to train the first model, for example, to obtain the actual power of the terminal device at the beginning of the process of simulating the terminal device to train the first model, and to obtain the actual power of the terminal device at the end of the process of simulating the terminal device to train the first model.
[0140] In one implementation, the information feedback module includes an information feedback switch. During the training process of the target decision model, the information feedback switch is in an on state, and the information feedback module is used to obtain the actual power of the terminal device during the process of simulating the terminal device to train the first model. During the inference process of the target decision model, the information feedback switch is in an off state, and the information feedback module has no function.
[0141] It should be noted that since the first energy consumption data of the terminal device includes but is not limited to the data corresponding to the energy consumption generated when the terminal device is running, and the terminal device runs in response to the user's operation, the first energy consumption data of the terminal device can reflect the regularity of the user's use of the terminal device, that is, the user's usage habits. Therefore, the terminal device determines the training time period based on the first energy consumption data, which can be understood as determining the training time period based on the regularity of the user's use of the terminal device, so that the determined training time period can be consistent with the user's usage habits. The terminal device trains the first model according to the training time period that conforms to the user's usage habits, which can reduce the user's perception of the training process during the training process and reduce the negative impact on the user (such as increased heat generation, running jams, etc.).
[0142] Exemplarily, the regularity of the user's use of the terminal device includes a time regularity. For example, the energy consumption generated by the user's use of the terminal device at different times may be different, so in order to meet the user's usage habits, the multiple training time periods determined by the terminal device based on different times are also different. Among them, the user's use of the terminal device at different times can be understood as the user's use of the terminal device on weekdays or weekends, and the user's use of the terminal device during the day or at night, etc.
[0143] For example, the user's low frequency of use of the terminal device on weekdays is used as an example. Since the target decision model is a model trained based on the historical first energy consumption data of the terminal device, the target decision model can learn from the historical first energy consumption data of the terminal device that the power consumption of the terminal device decreases slowly on weekdays (such as Monday to Friday) and decreases quickly on weekends (such as Saturday and Sunday). Therefore, the training time period determined by the target decision model on weekdays or weekends is different.
[0144] Specifically, when the terminal device starts the target decision model, the target decision model can first obtain the corresponding date in the system calendar of the terminal device. If the corresponding date in the system calendar of the terminal device is a working day, the duration of a single training time period determined by the target decision model may be longer than the duration of a single training time period determined on a rest day, the time interval between multiple training time periods determined may be shorter than the time interval determined on a rest day, and the number of training time periods determined may be less than the number determined on a rest day.
[0145] For example, it is taken that the user uses the terminal device less in the first time period (e.g., 9:00-17:00) and uses the terminal device more in the second time period (e.g., 17:00-22:00). Since the target decision model is a model trained based on the first energy consumption data of the terminal device, the target decision model can learn from the first energy consumption data of the terminal device that the power consumption of the terminal device decreases slowly when it is in the first time period, and decreases quickly when it is in the second time period. Therefore, the training time period determined by the target decision model for the first time period or the second time period is different.
[0146] Specifically, when the terminal device starts the target decision model, the target decision model can first obtain the system time of the terminal device. If the system time of the terminal device is before the first time period (that is, the system time is before 9:00), the terminal device can train the first model in the first time period and / or the second time period. Since the user uses the terminal device less in the first time period than in the second time period, the terminal device can preferentially train the first model in the first time period, that is, the number of the multiple training time periods determined by the target decision model that are in the first time period is greater than the number that are in the second time period.
[0147] Exemplarily, the regularity of the user's use of the terminal device includes the regularity of location. The energy consumption generated by the user using the terminal device in different locations may be different, so in order to meet the user's usage habits, the terminal device determines different training time periods based on different locations. Among them, the user using the terminal device in different locations can be understood as the user using the terminal device at home or at work, etc.
[0148] For example, the user's low frequency of use of the terminal device at the workplace is used as an example. Since the target decision model is a model trained based on the historical first energy consumption data of the terminal device, the target decision model can learn from the historical first energy consumption data of the terminal device that the power consumption of the terminal device decreases slowly when it is at the user's workplace, and decreases quickly when it is at the user's home. Therefore, the training time periods determined by the target decision model when the terminal device is located in different locations are different.
[0149] Specifically, when the terminal device starts the target decision model, the target decision model can first obtain the location of the terminal device. If the location of the terminal device belongs to the user's workplace, the target decision model can determine multiple training time periods according to the strategy corresponding to the workplace. Among them, the user's workplace and / or home can be determined based on the location of the terminal device during the process of training the target decision model by the terminal device.
[0150] S503: The terminal device trains the first model according to multiple training time periods.
[0151] Specifically, after the terminal device obtains multiple training time periods based on the target decision model, the terminal device can train the first model based on the start time and end time indicated by the training time period. For example, the terminal device starts training the first model at the start time indicated by the training time period, and ends the training of the first model at the end time indicated by the training time period, so that the training of the first model can be completed after the above multiple training time periods end.
[0152] In a possible implementation, in step S502, the terminal device determines the first training data of the first model from the first instruction, and the first training data of the first model includes but is not limited to the parameter amount of the first model, the parameter amount of the first model that needs to be trained, the preset number of training iterations, etc. Therefore, the terminal device trains the parameter amount of the first model that needs to be trained based on the training time period until the number of training times for the first model reaches the preset number of training iterations, and the terminal device completes the training of the first model.
[0153] The following will be combined Figure 7 Multiple training time periods are introduced.
[0154] See also Figure 7 , Figure 7 It is a schematic diagram of a terminal device training a first model provided in an embodiment of the present application. Figure 7 In the coordinate system shown, the horizontal axis represents time, such as 9:00, 13:00, etc., and the vertical axis represents the remaining power of the terminal device. Figure 7 As shown, the start time indicated by training time period 1 is start time 1, and the end time is end time 1. The start time indicated by training time period 2 is start time 2, and the end time is end time 2. The start time indicated by training time period 3 is start time 3, and the end time is end time 3. Among them, training time period 1, training time period 2 and training time period 3 are determined by the terminal device through the target decision model. The terminal device can start training the first model when the system time is at the start time 1, and then end the training of the first model when the system time is at the end time 1. When the system time of the terminal device is at the start time 2, the terminal device starts training the first model again. When the system time of the terminal device is at the end time 2, the terminal device ends the training of the first model. The terminal device trains the first model in training time period 1, training time period 2 and training time period 3, so as to complete the training of the first model.
[0155] like Figure 7 As shown, the terminal device trains the first model in multiple time periods instead of focusing on one time period, such as focusing on the time period when the terminal device is charging. This allows the terminal device to hide the training of the first model during the use of the terminal device, reducing the user's perception. For example, taking training time period 1 as an example, from Figure 7 It can be seen that the power of the terminal device decreases slowly between the start time 1 and the end time 1 corresponding to the training time period 1 in the use time of the terminal device. Specifically, the power corresponding to the end time 1 is less than or equal to the power corresponding to the start time 1, which can indicate that the power is in a downward trend. In addition, in the training time period 1, the difference between the maximum power and the minimum power of the terminal device is less than or equal to the power threshold, so it can be understood that the power of the terminal device decreases slowly in the training time period 1. Therefore, from the user's perspective, it can be understood that the user's frequency of use of the terminal device in the training time period 1 is low. If the terminal device trains the first model in the training time period 1, since the user's frequency of use of the terminal device is low at this time, the negative perception factors such as the computing power consumed and the heat generated when the terminal device trains the first model have little impact on the user. In addition, from the perspective of the terminal device, the power of the terminal device in the training time period 1 decreases slowly, which can indicate that the terminal device runs less data in the training time period 1. Therefore, the terminal device has more unused computing resources (such as computing power or memory) in the training time period 1. If the terminal device trains the first model in training time period 1, unused computing resources in the terminal device can be reasonably utilized, thereby improving the utilization rate of energy and computing resources of the terminal device.
[0156] In this embodiment, the terminal device determines the multiple training time periods by using a target decision model. Therefore, in order to enable the target decision model to output multiple training time periods for training the first model, the terminal device may receive a target decision model trained by other electronic devices, and / or the terminal device may train the original decision model to obtain a trained target decision model.
[0157] The following will be combined Figure 8 The present invention introduces a process of training a target decision model by using second energy consumption data generated by a user when the user actually uses the terminal device.
[0158] See also Figure 8 , Figure 8 Schematic diagram of a training target decision model provided in an embodiment of the present application. Figure 8 As shown, Figure 8 It includes step S801 and step S802.
[0159] Step S801: The terminal device determines a first training set.
[0160] Specifically, the terminal device can receive the original decision model from other electronic devices, because other electronic devices train the original decision model based on the third energy consumption data generated by one or more users during the test phase of the terminal device, but the third energy consumption data generated by one or more users during the test phase of the terminal device does not correspond to the usage habits of the actual users of the terminal device. Therefore, in order to enable the original decision model to output a training strategy that conforms to the usage habits of the actual users of the terminal device, the terminal device can construct a first training set based on the second energy consumption data generated by the actual users, and then train the original decision model based on the first training set through step S802 to obtain a target decision model.
[0161] In a possible implementation, the terminal device may obtain a first training set from other electronic devices, and the terminal device may also construct the first training set according to the second energy consumption data of the terminal device itself.
[0162] Exemplarily, the first training set includes the second energy consumption data and the second training data of the first model. The second training data of the first model includes but is not limited to the parameter quantity of the first model, the parameter quantity of the first model that needs to be trained, the preset number of training iterations, etc. The first model includes the model deployed in the application and / or the general model of the terminal device, and the type and quantity of the first model are not limited here.
[0163] In a possible implementation, the second energy consumption data includes a first energy consumption curve. The first energy consumption curve can be used to characterize the change of energy consumption. For example, the first energy consumption curve can be used to characterize the speed of power decrease and / or increase. Therefore, the target decision model trained based on the first energy consumption curve can output a training time period that conforms to the change of energy consumption of the terminal device.
[0164] Specifically, the terminal device can construct the first training set according to the first energy consumption curves generated by n consecutive days in the system time. Where n is a positive integer. For example, if the terminal device trains the original decision model on October 18, then the terminal device can obtain multiple first energy consumption curves generated from October 10 to October 17, and then construct the first training set based on the obtained multiple first energy consumption curves.
[0165] For example, Figure 8As shown, the first energy consumption curve generated by n consecutive days includes the first energy consumption curve corresponding to the first day, the first energy consumption curve corresponding to the second day, and the first energy consumption curve corresponding to the nth day, wherein n is an integer greater than 1. In the first energy consumption curve, the horizontal axis represents the usage time of the terminal device, and the vertical axis represents the remaining power of the terminal device. It can be understood that the embodiment of the present application does not limit the length of the usage time corresponding to the first energy consumption curve, that is, the time. For example, the usage time corresponding to the first energy consumption curve may be from 00:00 on the nth day to 24:00 on the nth day. For another example, the usage time corresponding to the first energy consumption curve may be from 10:00 on the nth day to 10:30 on the nth day.
[0166] Step S802: The terminal device trains a target decision model according to a first training set.
[0167] The structure of the original decision model can be found in Figure 6 Multiple modules are shown. Specifically, the energy consumption parsing module in the original decision model parses the first energy consumption curve in the first training set to obtain parsing information. The energy consumption parsing module in the original decision model sends the obtained parsing information to the decision module in the original decision model. The decision module in the original decision model determines multiple training time periods based on the parsing information and the second training data of the first model, wherein the training time period includes information such as the start time, the end time, the estimated power of the terminal device corresponding to the start time, and the estimated power of the terminal device corresponding to the end time.
[0168] At the same time, the terminal device simulates the first model in the energy consumption simulation environment based on the start time and the end time determined by the decision module to simulate the actual power when training the first model, for example, simulating the actual power at the start time during the training of the first model, and simulating the actual power at the end time during the training of the first model. The information feedback module in the original decision model can obtain the simulated actual power at the start time and the actual power at the end time.
[0169] In a possible implementation, the energy consumption simulation environment is used to simulate the actual power consumption of the terminal device when training the first model. The energy consumption simulation environment includes the energy consumption simulation environment in the cloud and the energy consumption simulation environment on the terminal device side.
[0170] For example, in the energy consumption simulation environment of the cloud, the energy consumption generated by the terminal device when training the first model can be measured by hardware equipment, and then the actual power consumption of the terminal device when training the first model can be simulated in combination with the algorithm. For example, the actual power consumption of the terminal device at the beginning of the process of training the first model can be simulated, and the actual power consumption of the terminal device at the end of the process of training the first model can be simulated.
[0171] For another example, in the energy consumption simulation environment on the terminal device side, the actual power consumption of the terminal device when training the first model is simulated by an algorithm. For example, the actual power consumption of the terminal device at the beginning of the training of the first model is simulated, and the actual power consumption of the terminal device at the end of the training of the first model is simulated.
[0172] Then, the terminal device compares the actual power simulated at the start time with the estimated power of the terminal device corresponding to the start time inferred by the decision module through the original decision model to obtain a first comparison value. And, the terminal device compares the actual power simulated at the end time with the estimated power of the terminal device corresponding to the end time inferred by the decision module through the original decision model to obtain a second comparison value. The terminal device adjusts the parameter value of the original decision model based on the first comparison value and the second comparison value.
[0173] The terminal device uses the original decision model based on the same steps as above to output the start time, end time, estimated power of the terminal device corresponding to the start time, and estimated power of the terminal device corresponding to the end time corresponding to the training time period. And obtain the simulated actual power at the start time and the actual power at the end time. Then, the parameter value of the original decision model is adjusted based on the first comparison value and the second comparison value until the first comparison value is less than the first comparison threshold and the second comparison value is less than the second comparison threshold. At this time, the terminal device completes the iterative training of the original decision model according to the first training set and obtains the target decision model.
[0174] It is understandable that the user's usage habits of the terminal device will affect the actual energy consumption changes of the terminal device, and the health of the hardware such as the battery in the terminal device will also affect the actual energy consumption changes of the terminal device. In addition, the training strategy output by the target decision model is generated based on the historical energy consumption changes of the terminal device. Therefore, if the gap between the actual energy consumption changes of the terminal device and the historical energy consumption changes of the terminal device is large, it may cause the training strategy output by the target decision model to fail to solve the problems to be solved by the embodiments of the present application, such as how to increase the energy consumption utilization rate when training the first model, how to reduce the negative impact on the user when training the first model, etc. Therefore, the terminal device can iteratively train the target decision model or the original decision model based on the actual second energy consumption data of the terminal device at intervals of a certain period of time, which can reduce the impact of changes in user usage habits and / or changes in the health of hardware such as batteries in the terminal device on the output results of the target decision model.
[0175] In one possible implementation, since users have certain regularities in using terminal devices, if the original decision model or the target decision model is trained according to the regularities of users using terminal devices, the trained target decision model can output training strategies based on the regularities of users using terminal devices, thereby improving the accuracy of the training strategies.
[0176] Among them, since the energy consumption of the terminal device includes but is not limited to the energy consumption generated by the operation of the terminal device, and the terminal device operates in response to the user's operation, the user's operation can be determined based on the second energy consumption data of the terminal device, thereby determining the regularity of the user's use of the terminal device based on the user's operation.
[0177] In a possible implementation, the regularity of the user's use of the terminal device includes a time regularity. For example, the energy consumption generated by the user's use of the terminal device at different times may be different, so in order to conform to the user's usage habits, the training strategy determined by the terminal device through the target decision model based on different times is also different. Therefore, the terminal device can train the target decision model or the original decision model according to the time regularity of the user's use of the terminal device, so that the trained target decision model can output a training strategy that conforms to the user's habits. Among them, the user's use of the terminal device at different times can be understood as the user using the terminal device on weekdays or weekends, and the user using the terminal device during the day or at night, etc. Among them, the working day or weekend can be determined according to the system time of the terminal device.
[0178] Specifically, let's take the example that users use terminal devices less frequently on weekdays. Therefore, based on the historical second energy consumption data, the terminal device can determine that the power consumption of the terminal device decreases more slowly on weekdays (such as Monday to Friday), and decreases more quickly on weekends (such as Saturday and Sunday). Then, the training strategy learned by the target decision model based on the second energy consumption data on weekdays is different from the training strategy learned based on the second energy consumption data on weekends. The target decision model can output corresponding training strategies according to different times.
[0179] In one possible implementation, the regularity of the user's use of the terminal device includes the regularity of the location. For example, the energy consumption generated by the user using the terminal device in different locations may be different, so in order to conform to the user's usage habits, the training strategies determined by the terminal device through the target decision model based on different locations are also different. Therefore, the terminal device can train the target decision model or the original decision model according to the regularity of the location where the user uses the terminal device, so that the trained target decision model can output a training strategy that conforms to the user's habits. Among them, the user using the terminal device in different locations can be understood as the user using the terminal device at home or at work, etc.
[0180] Specifically, the example of a user using a terminal device less frequently at the workplace is used for explanation. Since the target decision model is a model trained based on the second energy consumption data of the terminal device, the terminal device can determine based on the second energy consumption data that the power consumption of the terminal device decreases more slowly when the terminal device is located at the user's workplace, and decreases more quickly when the terminal device is located at the user's home. Then, the training strategy learned by the target decision model based on the second energy consumption data at the user's workplace is different from the training strategy learned based on the second energy consumption data at the user's home. The target decision model can output corresponding training strategies according to different locations.
[0181] The above embodiment is a process in which a terminal device iteratively trains a target decision model or an original decision model based on second energy consumption data generated when a user uses the terminal device. The following will introduce a process in which an electronic device trains an original decision model based on third energy consumption data generated by one or more users during a testing phase of the terminal device before the terminal device receives the original decision model from other electronic devices.
[0182] In a possible implementation, in order to save computing resources of the terminal device (including but not limited to computing power for training the original decision model, memory for storing the training set, etc.), the original decision model can be trained on other electronic devices before being deployed on the terminal device for use. Furthermore, after receiving the original decision model from other electronic devices, the terminal device can also iteratively train the original decision model according to the second energy consumption data of the terminal device. Since the second energy consumption data of the terminal device is used to characterize the user's usage habits, iteratively training the original decision model according to the second energy consumption data can enable the trained target decision model to output a training time period that conforms to the user's usage habits.
[0183] The following will be combined Fig. 9 The process of training the original decision model through electronic devices is described in detail. The electronic devices are devices with computing capabilities, including but not limited to servers and terminal devices. When the electronic device is a server, the electronic device can be a server, a server cluster or a distributed system composed of several servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud computing, cloud storage, big data and artificial intelligence platforms, which are not limited here.
[0184] See also Fig. 9 , Fig. 9 is a schematic diagram of a training original decision model provided in an embodiment of the present application, such as Fig. 9 As shown, Fig. 9 It includes step S901 and step S902.
[0185] Step S901: The electronic device obtains a second training set.
[0186] The second training set includes the third energy consumption data and the third training data of the first model. The second training set may be determined by the electronic device, or may come from other electronic devices.
[0187] Exemplarily, the third energy consumption data includes energy consumption data generated by one or more users during the test phase of the terminal device. Since different users have different usage habits of the terminal device, the generated third energy consumption data is also different. This allows the electronic device to obtain more types of third energy consumption data, so that the trained original decision model conforms to the usage habits of different users for the terminal device.
[0188] Exemplarily, the third training data of the first model includes but is not limited to the parameter quantity of the first model, the parameter quantity of the first model that needs to be trained, the preset number of training iterations, etc. Among them, the first model includes the model deployed in the application and / or the general model of the terminal device, and the type and quantity of the first model are not limited here. Since the total training time of the first model is related to the size of the first model, the original decision model is trained based on the parameter quantity used to represent the size of the first model, so that the sum of multiple training time periods inferred by the original decision model corresponds to the total training time of the first model.
[0189] In a possible implementation, the third energy consumption data includes a second energy consumption curve. The second energy consumption curve can be used to characterize the change of energy consumption. For example, the second energy consumption curve can be used to characterize the speed of power decrease and / or increase. Therefore, the original decision model trained based on the second energy consumption curve can output a training time period that conforms to the change of energy consumption.
[0190] Since the third energy consumption data includes energy consumption data generated by one or more users during the test phase of the terminal device, the second energy consumption curve also includes a curve corresponding to the third energy consumption data generated by one or more users during the test phase of the terminal device. Since different users have different habits of using terminal devices, the amount of electricity consumed by different users during the test phase of the terminal device is also different, resulting in different changes in the second energy consumption curves corresponding to different users. Therefore, there are many types of second energy consumption curves, such as a type with a slower rate of power decline, a type with a faster rate of power decline, and so on. In order to refine the second training set and enhance the accuracy of training the original decision model, the second energy consumption curves obtained by the electronic device can be first classified, and then second training sets of corresponding categories can be generated according to different categories of second energy consumption curves.
[0191] In a possible implementation, the electronic device cleans and classifies the obtained multiple second energy consumption curves in a classification module by machine learning to obtain multiple categories of second energy consumption curves. Fig.10 The process of classifying multiple second energy consumption curves is specifically introduced.
[0192] See also Fig.10 , Fig.10 is a schematic diagram of a classified second energy consumption curve provided in an embodiment of the present application. Fig.10 The classification modules shown correspond to Fig. 9 The classification module in . Fig.10 As shown, the electronic device first extracts features from the acquired multiple second energy consumption curves through the classification module, and then clusters the extracted features through machine learning to obtain multiple categories of second energy consumption curves. For example, one or more second energy consumption curves shown in category A, one or more second energy consumption curves shown in category B, one or more second energy consumption curves shown in category C, etc.
[0193] Among them, the feature extracted by the electronic device from the second energy consumption curve through the classification module may be the energy consumption change corresponding to the second energy consumption curve (for example, the speed of energy consumption decrease). Then, clustering is performed according to the speed of energy consumption decrease corresponding to the second energy consumption curve. Further, when the energy consumption decrease speed corresponding to the second energy consumption curve is greater than the speed threshold, the electronic device classifies the second energy consumption curve into Class A through the classification module. When the energy consumption decrease speed corresponding to the second energy consumption curve is less than or equal to the speed threshold, the electronic device classifies the second energy consumption curve into Class B through the classification module. Since the speed of energy consumption decrease can characterize the operation of the terminal device, the operation of the terminal device at different energy consumption decrease speeds is different, and the computing resources that the terminal device can provide for training the first model at different operation conditions are also different. Therefore, in order to improve the energy utilization rate of the terminal device training the first model, the terminal device can adopt different training strategies for the first model at different energy consumption decrease speeds. Therefore, the embodiment of the present application respectively uses the second energy consumption curves with different energy consumption decrease speeds to train the original decision model, so that the original decision model can output corresponding training strategies at different energy consumption decrease speeds.
[0194] Exemplarily, the electronic device may classify the second energy consumption curve by using a clustering algorithm. For example, the clustering algorithm includes but is not limited to a K-means algorithm.
[0195] Specifically, an electronic device is used to classify the second energy consumption curve by using the k-means algorithm as an example for explanation. The electronic device needs to divide the n second energy consumption curves into k clusters by using the k-means algorithm. Therefore, the electronic device can first arbitrarily select k second energy consumption curves from the n second energy consumption curves by using the k-means algorithm to serve as the initial cluster centers of the k clusters. Then, according to the similarity between the other second energy consumption curves and the initial cluster centers of the k clusters, the other second energy consumption curves are respectively assigned to the clusters that are most similar to them. Among them, the other second energy consumption curves are the second energy consumption curves other than the k second energy consumption curves selected above among the n second energy consumption curves. The electronic device then calculates the cluster center of each new cluster obtained, and divides the clusters of the second energy consumption curves according to the cluster centers of the new clusters. The similarity of the second energy consumption curves in the same cluster is high, and the similarity of the second energy consumption curves in different clusters is low, thereby completing the classification of the second energy consumption curves.
[0196] Exemplarily, the electronic device can classify multiple second energy consumption curves through a self-organizing map (SOM) network. SOM is a clustering algorithm based on a neural network, which constructs a low-dimensional grid in the input data space and adjusts the weight vector on the low-dimensional grid through training, so as to cluster the input data samples (such as multiple second energy consumption curves) into different grid units, and the second energy consumption curves in the same grid unit are curves of the same category.
[0197] In summary, the electronic device can divide the second energy consumption curves of different categories based on the third energy consumption data generated by one or more users during the test phase of the terminal device, thereby constructing second training sets of different categories. Among them, the chip of the terminal device is usually mounted on a chip platform, and the chip platform includes a variety of functional algorithms. The terminal device can process and perform different operations through a variety of functional algorithms on the chip platform. For example, the functional algorithm includes but is not limited to an algorithm for calculation, an algorithm for image processing, an algorithm for communication, and the like. Since the terminal device generates energy consumption when running the functional algorithm on the chip platform, the energy consumption data generated by the user using the terminal device during the test phase of the terminal device includes energy consumption data generated based on the chip platform in the terminal device, such as the third energy consumption data generated based on chip platform A. When the chip platform in the terminal device changes, for example, the chip platform in the terminal device changes from chip platform A to chip platform B. Since the energy consumption generated by different chip platforms during operation is different, the third energy consumption data generated by the user based on chip platform A is different from the fourth energy consumption data generated based on chip platform B. Then, if the third energy consumption data generated by chip platform A is still used to construct the second training set, the training strategy output by the original decision model trained according to the second training set will not meet the energy consumption changes of the terminal device. Therefore, the electronic device needs to construct the second training set based on the fourth energy consumption data generated by chip platform B.
[0198] The following will specifically introduce the situation where the electronic device constructs a second training set based on the energy consumption of the functional algorithm in the changed chip platform when the chip platform in the terminal device changes. For example, the chip platform in the terminal device is still changed from chip platform A to chip platform B as an example. Among them, the change of the chip platform in the terminal device may be because the chip in the terminal device has been updated, so the chip platform used to carry the chip also needs to be updated. Or with the continuous development of technology, the chip platform has been updated and iterated, and the chip platform of the terminal device will also change.
[0199] In one possible implementation, since chip platform B may be a platform developed after chip platform A, the third energy consumption data generated for chip platform A by one or more users during the testing phase of the terminal device is greater than the fourth energy consumption data generated for chip platform B. The number of second energy consumption curves based on chip platform A that can be obtained by the electronic device is greater than the number of second energy consumption curves based on chip platform B. If the second training set is constructed based on the second energy consumption curve based on chip platform B, it may be limited by the number of second energy consumption curves based on chip platform B, resulting in a smaller number and / or types of second training sets determined, affecting the training of the original decision model. Therefore, the electronic device can perform curve correction on the obtained second energy consumption curve based on chip platform A, estimate the second energy consumption curve based on chip platform B, and thereby increase the number and / or types of second energy consumption curves of the second chip platform B. For example, Fig. 9 As shown, the electronic device performs curve correction on multiple categories of second energy consumption curves obtained according to the classification module according to the energy consumption of the functional algorithm in the changed chip platform, and obtains multiple categories of second energy consumption curves corresponding to the changed chip platform.
[0200] In a possible implementation, different chip platforms will generate different energy consumption during operation, which is mainly caused by the different energy consumption of functional algorithms in different chip platforms. Therefore, if the electronic device can obtain the energy consumption of the functional algorithm in chip platform A and the energy consumption of the functional algorithm in chip platform B. Then, the electronic device can correct the second energy consumption curve based on chip platform A according to the difference between the energy consumption of the functional algorithm in chip platform A and the energy consumption of the functional algorithm in chip platform B, thereby estimating the second energy consumption curve based on chip platform B.
[0201] Exemplarily, when the electronic device obtains the energy consumption of the functional algorithm in chip platform B, since chip platform A is deployed in the terminal device before chip platform B, the electronic device can determine the energy consumption of the functional algorithm in chip platform A according to the third energy consumption data generated by the terminal device for chip platform A during the test phase. Then, the electronic device corrects the second energy consumption curve based on chip platform A according to the curve correction algorithm based on the energy consumption of the functional algorithm in chip platform B, and obtains the second energy consumption curve based on chip platform B. Further, the electronic device constructs a second training set according to the second energy consumption curve based on chip platform B.
[0202] For example, see Fig.11A and Fig. 11B , Fig.11A and Fig. 11B It is a schematic diagram of a modified second energy consumption curve provided in an embodiment of the present application. Fig.11AA possible remaining power change curve of the terminal device based on chip platform A, that is, a possible second energy consumption curve, is shown. Among them, the horizontal axis represents the usage time of the terminal device, and the vertical axis represents the remaining power of the terminal device. It can be seen that the remaining power of the terminal device from the first moment to the second moment, and from the third moment to 10:30 of the second day shows an upward trend, and the terminal device is in a charging state at this time. The remaining power of the terminal device from 10:30 of the first day to the first moment, and from the second moment to the third moment shows a downward trend. At this time, the reasons for power consumption include the energy consumption generated by the operation of the application in the terminal device, the energy consumption of the functional algorithm in the chip platform A, etc. In addition, Fig.11A It also shows the power consumed by the application program in the terminal device when the terminal device is based on chip platform A, and the power consumed by the functional algorithm in chip platform A in the time period corresponding to the second energy consumption curve. For example, the power consumed by application program 1 in the terminal device accounts for 47% of the total power consumption, the power consumed by application program 2 accounts for 19% of the total power consumption, the power consumed by the functional algorithm in chip platform A accounts for 10% of the total power consumption, and so on.
[0203] Fig. 11B The remaining power change curve of the terminal device based on chip platform B, i.e., the second energy consumption curve, is shown. Fig. 11B The dotted line in the figure is the second energy consumption curve when the terminal device is based on chip platform B, and the solid line is the second energy consumption curve when the terminal device is based on chip platform A. Fig.11A The second energy consumption curve of the terminal device shown is consistent with that of the terminal device based on chip platform A. The horizontal axis represents the usage time of the terminal device, and the vertical axis represents the remaining power of the terminal device. It can be understood that when the electronic device obtains the energy consumption of the functional algorithm in chip platform B, it can be based on the energy consumption of the functional algorithm in chip platform B. Fig.11A The terminal device shown is based on the second energy consumption curve of chip platform A, and the result is Fig. 11B The second energy consumption curve shown is when the terminal device is based on chip platform B.
[0204] Specifically, the reasons for the power consumption of terminal devices include the energy consumption generated by the running of applications in the terminal devices and the energy consumption of functional algorithms in the chip platform. Fig.11AThe reduction of the remaining power in the second energy consumption curve when the terminal device is based on chip platform A can be used to characterize the energy consumption generated by the operation of the application program and the energy consumption of the functional algorithm in the chip platform when the terminal device is based on chip platform A. Therefore, the process of the electronic device correcting the second energy consumption curve when the terminal device is based on chip platform A can be understood as the electronic device correcting the remaining power corresponding to each moment in the second energy consumption curve when the terminal device is based on chip platform A after determining the power consumed by running the same application program and the same functional algorithm on the terminal device when the terminal device is based on chip platform B and when the terminal device is based on chip platform A.
[0205] For example, if the energy consumption of the function algorithm in chip platform B is less than that of the function algorithm in chip platform A, then the power consumed by the terminal device based on chip platform B when running the same function algorithm as that based on chip platform A is less than that consumed by the terminal device based on chip platform A. Therefore, it can be seen that Fig. 11B In the process from 10:30 on the first day to the first moment and from the second moment to the third moment, the remaining power of the terminal device based on chip platform B is higher than the remaining power of the terminal device based on chip platform A. The remaining power from the first moment to the second moment and from the third moment to 10:30 on the second day shows an upward trend, and the terminal device is in a charging state at this time.
[0206] Exemplarily, when the electronic device cannot obtain the energy consumption of the functional algorithm in chip platform B, the electronic device can fit the second energy consumption curve based on chip platform B according to the second energy consumption curve based on chip platform A. In one implementation, when the energy consumption of some functional algorithms in chip platform B is similar to the energy consumption of some functional algorithms in chip platform A, the electronic device can fit the second energy consumption curve based on chip platform B based on the second energy consumption curve of chip platform A. For example, the electronic device can fit the second energy consumption curve based on chip platform A based on the fitting algorithm of the machine learning statistical scheme to obtain the second energy consumption curve based on chip platform B. Further, the electronic device constructs a second training set according to the second energy consumption curve based on chip platform B.
[0207] Step S902: The electronic device trains the original decision model based on the second training set.
[0208] Specifically, as described in step S901, when the electronic device determines the second training set, it can classify the multiple second energy consumption curves included in the second training set. Therefore, the number of categories in the second training set is consistent with the number of categories in the second energy consumption curve. For example, the second energy consumption curve has three categories: category A, category B, and category C. Then the second training set also corresponds to three categories: second training set A, second training set B, and second training set C. The electronic device can train the original decision model according to the second training set A, the second training set B, and the second training set C, respectively, so that the original decision model can infer the training strategies (such as training time periods) corresponding to the multiple categories based on the multiple categories of the second energy consumption curve.
[0209] For example, the electronic device is used to train the original decision model according to the second training set A. The structure of the original decision model can be found in Figure 6 Multiple modules are shown. Specifically, the energy consumption analysis module in the original decision model analyzes the second energy consumption curve A in the second training set A to obtain analysis information. The energy consumption analysis module in the original decision model sends the obtained analysis information to the decision module in the original decision model. The decision module in the original decision model determines multiple training time periods based on the analysis information and the third training data of the first model, wherein the training time period includes information such as the start time, the end time, the estimated power of the terminal device corresponding to the start time, and the estimated power of the terminal device corresponding to the end time.
[0210] At the same time, the electronic device simulates and trains the first model in the energy consumption simulation environment based on the start time and the end time determined by the decision module to simulate the actual power of the terminal device when training the first model, for example, simulating the actual power of the terminal device at the start time during the training of the first model, and simulating the actual power of the terminal device at the end time during the training of the first model. The information feedback module in the original decision model can obtain the simulated actual power of the terminal device at the start time and the actual power of the terminal device at the end time.
[0211] In a possible implementation, the energy consumption simulation environment is used to simulate the actual power consumption of the terminal device when training the first model. The energy consumption simulation environment includes the energy consumption simulation environment in the cloud and the energy consumption simulation environment on the electronic device side.
[0212] For example, in the energy consumption simulation environment of the cloud, the energy consumption generated by the terminal device when training the first model can be measured by hardware equipment, and then the actual power consumption of the terminal device when training the first model can be simulated in combination with the algorithm. For example, the actual power consumption of the terminal device at the beginning of the process of training the first model can be simulated, and the actual power consumption of the terminal device at the end of the process of training the first model can be simulated.
[0213] For another example, in the energy consumption simulation environment of the electronic device side, the actual power of the terminal device when training the first model is simulated by an algorithm. For example, the actual power of the terminal device at the beginning of the training of the first model is simulated, and the actual power of the terminal device at the end of the training of the first model is simulated.
[0214] Then, the electronic device compares the actual power of the simulated terminal device at the start time with the estimated power of the terminal device corresponding to the start time inferred by the decision module through the original decision model to obtain a first comparison value. And, the electronic device compares the actual power of the simulated terminal device at the end time with the estimated power of the terminal device corresponding to the end time inferred by the decision module through the original decision model to obtain a second comparison value. The electronic device adjusts the parameter value of the original decision model based on the first comparison value and the second comparison value.
[0215] The electronic device outputs the start time, end time, estimated power of the terminal device corresponding to the start time, and estimated power of the terminal device corresponding to the end time corresponding to the training time period through the original decision model based on the same steps as above. And obtain the simulated actual power of the terminal device at the start time and the actual power of the terminal device at the end time. Then, the parameter value of the original decision model is adjusted based on the first comparison value and the second comparison value until the first comparison value is less than the first comparison threshold and the second comparison value is less than the second comparison threshold. At this time, the electronic device completes the iterative training of the original decision model based on the second training set A.
[0216] See also Fig.12 , Fig.12 is a flow chart of a model training method provided in an embodiment of the present application. This method can be applied to Figure 3 The terminal device 100 and Figure 4 The terminal device 100 is shown. The method includes but is not limited to the following steps:
[0217] Step S1201: Responding to a first instruction, obtaining first training data and first energy consumption data. For example, in step S502, the terminal device responds to the first instruction, obtains information such as first training data of the first model from the first instruction, and the terminal device responds to the first instruction, obtains first energy consumption data.
[0218] In one embodiment, the first training data is used to indicate the total time required for training the first model. For example, the first training data of the first model in step S502 is used to determine the total training time corresponding to the first model.
[0219] In one implementation, the first energy consumption data is used to characterize the change in power consumption of the terminal device. For example, in step S502, the first energy consumption data is used to determine the change in energy consumption of the terminal device.
[0220] In one implementation, the first instruction may be, for example, in step S501, the first instruction is used to instruct the terminal device to train the first model.
[0221] Step S1202, input the first training data and the first energy consumption data into the target decision model, so that the target decision model outputs multiple training time periods. For example, in step S502, the terminal device responds to the first instruction and determines multiple training time periods based on the target decision model.
[0222] In one embodiment, the sum of the durations corresponding to the multiple training time periods is equal to the total duration. For example, the multiple training time periods in step S502 can be multiple time periods divided from the total training duration corresponding to the first model.
[0223] In one embodiment, multiple training time periods include a start time and an end time corresponding to each training time period, and one or more of a first power level of the terminal device corresponding to the start time and a second power level of the terminal device corresponding to the end time.
[0224] For example, in step S502, any one of the multiple training time periods (for example, the first time period) is used as an example for explanation, and the first time period includes a start time and an end time, as well as an estimated power of the terminal device corresponding to the start time and an estimated power of the terminal device corresponding to the end time. The first power of the terminal device corresponding to the start time corresponds to the estimated power of the terminal device corresponding to the start time in step S502, and the second power of the terminal device corresponding to the end time corresponds to the estimated power of the terminal device corresponding to the end time in step S502.
[0225] Step S1203, training the first model according to multiple training time periods. For example, in step S503, the terminal device trains the first model according to multiple training time periods.
[0226] In a possible implementation, the first model is trained at the start time of the first training time period, and the training of the first model is terminated at the end time of the first training time period. For example, in step S503, the terminal device starts training the first model at the start time indicated by the training time period, and terminates the training of the first model at the end time indicated by the training time period.
[0227] In one implementation, the first training time period is one of the multiple training time periods, and when the second power corresponding to the end time of the first training time period is less than or equal to the first power corresponding to the start time of the first training time period, the power difference between the third power and the fourth power is less than or equal to the power threshold, the third power corresponds to the maximum power of the terminal device in the first training time period, and the fourth power corresponds to the minimum power of the terminal device in the first training time period. For example, Figure 7 Description of training period 1 in .
[0228] In a possible implementation, a first training set is obtained, and the original decision model is trained according to the second training data and the second energy consumption data to obtain a target decision model. Figure 8 In step S801 and step S802 shown, the terminal device trains the target decision model.
[0229] In one embodiment, the first training set includes the second training data of the first model and the second energy consumption data of the terminal device. For example, in step S801, the first training set includes the second energy consumption data and the second training data of the first model. The second training data of the first model includes but is not limited to the parameter quantity of the first model, the parameter quantity of the first model that needs to be trained, the preset number of training iterations, etc.
[0230] In one implementation, the original decision model is a model pre-stored in the terminal device. For example, in step S801, the terminal device may receive an original decision model from other electronic devices.
[0231] In one embodiment, the target decision model may be, for example, in step S801, the terminal device may construct a first training set based on the second energy consumption data actually generated by the user, and then train the original decision model based on the first training set through step S802 to obtain the target decision model.
[0232] In one possible implementation, the second training data and the second energy consumption data are input into the original decision model, so that the original decision model outputs N start times and N end times, as well as one or more of the N estimated start power and N estimated end power of the terminal device, and the original decision model is trained based on the N start times, N end times, N estimated start power and N estimated end power to obtain a target decision model. Wherein, N is an integer greater than 1, the Nth start time among the N start times and the Nth end time among the N end times are used to determine the Nth training time period of the first model, the N estimated start power corresponds to the N start times one-to-one, and the N estimated end power corresponds to the N end times one-to-one. For example, N can be a plurality of those in step S802.
[0233] For example, in step S802, the decision module in the original decision model determines multiple training time periods based on the parsing information and the second training data of the training information of the first model, wherein the training time period includes information such as the start time, the end time, the estimated power of the terminal device corresponding to the start time, and the estimated power of the terminal device corresponding to the end time. The estimated start power may be the estimated power of the terminal device corresponding to the start time in step S802, and the estimated end power may be the estimated power of the terminal device corresponding to the end time in step S802.
[0234] In a possible implementation, the first model is simulated and trained according to N start times and N end times, N simulated start power and N simulated end power of the terminal device are obtained, and a first comparison value of the Nth estimated start power among the N estimated start power and the Nth simulated start power among the N simulated start power, as well as a second comparison value of the Nth estimated end power among the N estimated end power and the Nth simulated end power among the N simulated end power are determined; when the first comparison value is less than or equal to the first comparison threshold and the second comparison value is less than or equal to the second comparison threshold, the parameters of the target decision model are determined according to the first comparison value and the second comparison value to obtain the target decision model. Among them, the N simulated start power corresponds to the N start times one by one, and the N simulated end power corresponds to the N end times one by one.
[0235] For example, in step S802, the terminal device simulates and trains the first model based on the start time and the end time determined by the decision module in the energy consumption simulation environment to simulate the actual power when training the first model, for example, simulate the actual power at the start time during the training of the first model, and simulate the actual power at the end time during the training of the first model. Then, the terminal device compares the simulated actual power at the start time with the estimated power of the terminal device corresponding to the start time inferred by the decision module through the original decision model to obtain a first comparison value. And, the terminal device compares the simulated actual power at the end time with the estimated power of the terminal device corresponding to the end time inferred by the decision module through the original decision model to obtain a second comparison value. The terminal device adjusts the parameter value of the original decision model based on the first comparison value and the second comparison value. The parameter value of the original decision model is adjusted based on the first comparison value and the second comparison value until the first comparison value is less than the first comparison threshold and the second comparison value is less than the second comparison threshold, at which time the terminal device completes the iterative training of the original decision model according to the first training set to obtain the target decision model. The simulation start power may be the actual power at the start time in step S802 , and the simulation end power may be the actual power at the end time in step S802 .
[0236] In a possible implementation, the original decision model is a model trained by the server based on the third training data and third energy consumption data of the first model. The third energy consumption data includes energy consumption data generated by multiple terminal devices. The third energy consumption data includes multiple energy consumption curves. The multiple energy consumption curves are used to indicate the changes in power of the terminal devices. The changes in power corresponding to the multiple energy consumption curves are used to divide the multiple energy consumption curves into energy consumption curves corresponding to M categories, where M is an integer greater than 1, and M is less than or equal to the number corresponding to the multiple energy consumption curves.
[0237] For example, it can be Fig. 9 In step S901 and step S902, the electronic device trains the original decision model. The third energy consumption data may be, for example, in step S901, the third energy consumption data includes energy consumption data generated by one or more users during the test phase of the terminal device. The power consumption changes corresponding to the multiple energy consumption curves are used to divide the multiple energy consumption curves into M categories. The corresponding energy consumption curves may be, for example, Fig.10 In the figure, the second energy consumption curve of electronic equipment classification is shown.
[0238] In a possible implementation, the original decision model is a model trained based on third training data and fourth energy consumption data, the fourth energy consumption data is determined based on the third energy consumption data, the third energy consumption data is the energy consumption data generated when the terminal device is running on the first chip platform, the fourth energy consumption data is the energy consumption data generated when the terminal device is running on the second chip platform, and the chip of the terminal device is mounted on the first chip platform or the second chip platform.
[0239] For example, in step S901, when the chip platform in the terminal device is changed, the electronic device constructs the second training set based on the energy consumption of the functional algorithm in the changed chip platform. The first chip platform may be, for example, chip platform A in step S901, and the second chip platform may be, for example, chip platform B in step S901.
[0240] In a possible implementation, the fourth energy consumption data includes data obtained by fitting the third energy consumption data according to an energy consumption difference, wherein the energy consumption difference is the difference between a first energy consumption and a second energy consumption, wherein the first energy consumption is the energy consumption generated by the terminal device running a first function algorithm on a first chip platform, and the second energy consumption is the energy consumption generated by the terminal device running a second function algorithm on a second chip platform.
[0241] For example, in step S901, the electronic device may correct the second energy consumption curve based on chip platform A according to the difference in energy consumption between the functional algorithm in chip platform A and the functional algorithm in chip platform B, thereby estimating the second energy consumption curve based on chip platform B.
[0242] It should be understood that each step in the above method embodiment provided by the present application can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.
[0243] The present application also provides an electronic device, which may include: a memory and a processor, wherein the memory may be used to store a computer program; and the processor may be used to call the computer program in the memory so that the electronic device executes the method in any one of the above embodiments.
[0244] The present application also provides a chip system, which includes at least one processor for implementing the functions involved in the method executed by the electronic device in any of the above embodiments.
[0245] In one possible design, the chip system also includes a memory, which is used to store program instructions and data, and the memory is located inside or outside the processor.
[0246] The chip system may be composed of the chip, or may include the chip and other discrete devices.
[0247] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0248] Optionally, the memory in the chip system may also be one or more. The memory may be integrated with the processor or may be separately arranged with the processor, which is not limited in the embodiments of the present application. Exemplarily, the memory may be a non-transient processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be arranged on different chips respectively. The embodiments of the present application do not specifically limit the type of memory and the arrangement of the memory and the processor.
[0249] Exemplarily, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD), or other integrated chips.
[0250] The present application also provides a computer program product, which includes: a computer program (also referred to as code, or instruction), which enables a computer to execute the method executed by the electronic device in any of the above embodiments when the computer program is executed.
[0251] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program (also referred to as code or instruction). When the computer program is executed, the computer executes the method executed by the electronic device in any of the above embodiments.
[0252] The various implementation modes of the present application can be combined arbitrarily to achieve different technical effects.
[0253] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk SolidState Disk), etc.
[0254] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0255] In short, the above description is only an embodiment of the technical solution of the present invention, and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present invention shall be included in the protection scope of the present invention.
Claims
1. A model training method, characterized in that: Applied to a terminal device, the method comprises: Acquire a first training set, wherein the first training set includes second training data of the first model and second energy consumption data of the terminal device; Training an original decision model according to the second training data and the second energy consumption data to obtain a target decision model, wherein the original decision model is a model pre-stored by the terminal device; In response to the first instruction, first training data and first energy consumption data are acquired, wherein the first training data is used to indicate the total time required for training the first model, and the first energy consumption data is used to characterize the change in power of the terminal device; Inputting the first training data and the first energy consumption data into the target decision model, so that the target decision model outputs a plurality of training time periods, wherein the sum of the durations respectively corresponding to the plurality of training time periods is equal to the total duration, and the plurality of training time periods include a start time and an end time corresponding to each training time period, and one or more of a first power level of the terminal device corresponding to the start time and a second power level of the terminal device corresponding to the end time; The first model is trained starting from the start time of a first training time period, and the training of the first model is terminated at the end time of the first training time period, wherein the first training time period is one of the multiple training time periods, and when the second electrical quantity corresponding to the end time of the first training time period is less than or equal to the first electrical quantity corresponding to the start time of the first training time period, the electrical quantity difference between the third electrical quantity and the fourth electrical quantity is less than or equal to the electrical quantity threshold, the third electrical quantity corresponds to the maximum electrical quantity of the terminal device in the first training time period, and the fourth electrical quantity corresponds to the minimum electrical quantity of the terminal device in the first training time period.
2. The method according to claim 1, characterized in that The training of the original decision model according to the second training data and the second energy consumption data to obtain a target decision model includes: Inputting the second training data and the second energy consumption data into the original decision model, so that the original decision model outputs N start times and N end times, and one or more of N estimated start power and N estimated end power of the terminal device, wherein N is an integer greater than 1, the Nth start time of the N start times and the Nth end time of the N end times are used to determine the Nth training time period of the first model, the N estimated start power and the N start times correspond one-to-one, and the N estimated end power and the N end times correspond one-to-one; The original decision model is trained based on the N start times, the N end times, the N estimated start power quantities and the N estimated end power quantities to obtain the target decision model.
3. The method according to claim 2, characterized in that The training of the original decision model based on the N start times, the N end times, the N estimated start power quantities, and the N estimated end power quantities to obtain the target decision model includes: Performing simulation training on the first model according to the N start times and the N end times, obtaining N simulated start power quantities and N simulated end power quantities of the terminal device, wherein the N simulated start power quantities correspond one-to-one to the N start times, and the N simulated end power quantities correspond one-to-one to the N end times; Determine a first comparison value of an N-th estimated starting electric quantity among the N estimated starting electric quantities and an N-th simulated starting electric quantity among the N simulated starting electric quantities, and a second comparison value of an N-th estimated ending electric quantity among the N estimated ending electric quantities and an N-th simulated ending electric quantity among the N simulated ending electric quantities; When the first comparison value is less than or equal to a first comparison threshold and the second comparison value is less than or equal to a second comparison threshold, the parameters of the target decision model are determined according to the first comparison value and the second comparison value to obtain the target decision model.
4. The method according to claim 1, characterized in that: The original decision model is a model trained by the server based on the third training data and third energy consumption data of the first model. The third energy consumption data includes energy consumption data generated by multiple terminal devices. The third energy consumption data includes multiple energy consumption curves. The multiple energy consumption curves are used to indicate the changes in the power of the terminal devices. The changes in the power corresponding to the multiple energy consumption curves are used to divide the multiple energy consumption curves into energy consumption curves corresponding to M categories, where M is an integer greater than 1, and M is less than or equal to the number corresponding to the multiple energy consumption curves.
5. The method according to claim 4, characterized in that The original decision model is a model trained based on the third training data and the fourth energy consumption data, the fourth energy consumption data is determined based on the third energy consumption data, the third energy consumption data is the energy consumption data generated when the terminal device is running on the first chip platform, the fourth energy consumption data is the energy consumption data generated when the terminal device is running on the second chip platform, and the chip of the terminal device is mounted on the first chip platform or the second chip platform.
6. The method according to claim 5, characterized in that The fourth energy consumption data includes data obtained by fitting the third energy consumption data according to an energy consumption difference, wherein the energy consumption difference is the difference between a first energy consumption and a second energy consumption, wherein the first energy consumption is the energy consumption generated by the terminal device running a first function algorithm on the first chip platform, and the second energy consumption is the energy consumption generated by the terminal device running a second function algorithm on the second chip platform.
7. An electronic device, characterized in that: The electronic device comprises: one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions so that the electronic device executes the method as described in any one of claims 1 to 6.
8. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method as described in any one of claims 1 to 6.
9. A computer program product comprising instructions, characterized in that When the computer program product is run on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 6.
10. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for optimizing model applicable to pattern recognition and terminal equipment
CN107545889A
Application control method and apparatus, storage medium and electronic device
WO2019062462A1