Electronic device operation method, apparatus, storage medium, and electronic device
By acquiring the operating parameters of electronic devices and adjusting or replacing the computational precision of neural networks, the power consumption and heat generation problems of electronic devices when running neural networks are solved, achieving energy saving and heat dissipation effects when it is necessary to reduce power consumption or concentrate resources.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-20
- Publication Date
- 2026-03-24
AI Technical Summary
Electronic devices consume power and generate heat when running neural networks, and existing technologies struggle to effectively address these issues, especially when it is necessary to reduce power consumption or concentrate system resources.
By acquiring the operating parameters of electronic devices, when preset conditions are met, the computational precision of the current neural network is reduced or replaced with another neural network. The computational precision of the new neural network is lower than that of the original neural network, thereby reducing power consumption and heat generation.
Effectively reduce the power consumption and heat generation of electronic devices, especially when it is necessary to reduce power consumption or concentrate system resources. By adjusting the computational precision of the neural network or replacing the neural network, energy saving and heat dissipation effects can be achieved.
Smart Images

Figure CN115220562B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of electronic devices, and particularly relates to an electronic device running method and device, a storage medium, and an electronic device. BACKGROUND
[0002] With the development of technology and actual application requirements, many electronic devices are configured with neural networks. Generally, various processors configured in an electronic device can be used to run neural networks, such as a central processing unit (CPU), a neural-network processing unit (NPU), a digital signal processor (DSP), a graphics processing unit (GPU), and the like. However, when running a neural network, the electronic device has relatively high power consumption and heat generation. SUMMARY
[0003] Embodiments of the present application provide an electronic device running method and device, a storage medium, and an electronic device, which can reduce power consumption and heat generation of the electronic device.
[0004] In a first aspect, embodiments of the present application provide an electronic device running method, comprising:
[0005] obtaining a running parameter of the electronic device;
[0006] if the running parameter meets a preset condition, reducing operation precision of a currently used neural network, and / or replacing the currently used neural network with another neural network and performing operation, the operation precision of the another neural network being less than that of the currently used neural network;
[0007] wherein the running parameter meeting the preset condition indicates that the electronic device is in at least one of the following states: a state of needing to reduce power consumption and a state of needing to centrally allocate system resources to at least one application or device.
[0008] In a second aspect, embodiments of the present application provide an electronic device running device, comprising:
[0009] an obtaining module configured to obtain a running parameter of the electronic device;
[0010] a processing module configured to, if the running parameter meets a preset condition, reduce operation precision of a currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, the operation precision of the another neural network being less than that of the currently used neural network.
[0011] The running parameter satisfying the preset condition indicates that the electronic device is in at least one of the following states: a state of needing to reduce power consumption and a state of needing to allocate system resources to at least one application or device.
[0012] In a third aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed on a computer, the computer is caused to perform the flow of the electronic device running method provided by the embodiment of the present application.
[0013] In a fourth aspect, an embodiment of the present application further provides an electronic device, including a memory and a processor, the processor being capable of running a neural network, and the processor being configured to execute the flow of the electronic device running method provided by the embodiment of the present application by invoking a computer program stored in the memory.
[0014] In the embodiment, the electronic device can first acquire a running parameter. Then, if it is detected that the running parameter of the electronic device satisfies a preset condition, the electronic device can reduce the operation precision of a currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, the operation precision of the another neural network being lower than that of the currently used neural network. The running parameter satisfying the preset condition can indicate that the electronic device is in at least one of the following states: a state of needing to reduce power consumption and a state of needing to allocate system resources to at least one application or device. Since higher neural network operation precision requires more operation consumption, resulting in higher power consumption and device heating, the embodiment of the present application can reduce the operation precision of the currently used neural network and / or replace the currently used neural network with another neural network with lower operation precision when the electronic device is in at least one of the two states, thereby reducing the power consumption and heating of the electronic device. BRIEF DESCRIPTION OF DRAWINGS
[0015] The technical solutions of the present application and the beneficial effects thereof will become apparent through the following detailed description of the specific embodiments of the present application in conjunction with the accompanying drawings.
[0016] Figure 1 FIG. 1 is a first flowchart of an electronic device running method provided by an embodiment of the present application.
[0017] Figure 2 FIG. 2 is a second flowchart of an electronic device running method provided by an embodiment of the present application.
[0018] Figure 3is a third flowchart of a method for running an electronic device provided by an embodiment of the present application.
[0019] Figure 4 is a fourth flowchart of a method for running an electronic device provided by an embodiment of the present application.
[0020] Figures 5 to 8 is a scenario diagram of a method for running an electronic device provided by an embodiment of the present application.
[0021] Figure 9 is a structural diagram of an electronic device running apparatus provided by an embodiment of the present application.
[0022] Figure 10 is a structural diagram of an electronic device provided by an embodiment of the present application.
[0023] Figure 11 is another structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0024] Reference will now be made to the drawings, wherein like numerals refer to like components throughout the several figures, which illustrate the principles of the application by way of example. The following description is based on the exemplified embodiments of the present application and should not be taken as limiting the other embodiments of the present application not described herein.
[0025] It can be understood that the execution subject of the embodiments of the present application can be an electronic device such as a smart phone or a tablet computer.
[0026] Reference will now be made to the drawings, wherein like numerals refer to like components throughout the several figures, which illustrate the principles of the application by way of example. The following description is based on the exemplified embodiments of the present application and should not be taken as limiting the other embodiments of the present application not described herein. Figure 1 Figure 1 is a flowchart of a method for running an electronic device provided by an embodiment of the present application, which can include:
[0027] 101, obtaining a running parameter of an electronic device.
[0028] With the development of technology and actual application needs, many electronic devices are configured with neural networks. Generally, various processors configured in electronic devices can be used to run neural networks, such as central processing units (CPUs), neural-network processing units (NPUs), digital signal processors (DSPs), graphics processing units (GPUs), etc. However, when running a neural network, the electronic device will consume more power and generate heat.
[0029] In this embodiment, the electronic device can obtain its running parameter before or during the running of the neural network.
[0030] After obtaining the running parameter of the electronic device, the electronic device can detect whether the running parameter meets a preset condition.
[0031] If it is detected that the running parameter does not meet the preset condition, the electronic device can continue to run the neural network.
[0032] If it is detected that the running parameter meets the preset condition, the process of 102 can be entered.
[0033] 102. If the running parameter meets the preset condition, the operation precision of the currently used neural network is reduced, and / or the currently used neural network is replaced by another neural network and operated, and the operation precision of the another neural network is less than that of the currently used neural network; wherein the running parameter meeting the preset condition indicates that the electronic device is in at least one of the following states: a state of needing to reduce power consumption and a state of needing to allocate system resources to at least one application or device.
[0034] For example, if the electronic device detects that the running parameter meets the preset condition, the electronic device can reduce the operation precision of the currently used neural network, and / or replace the currently used neural network with another neural network and operate, wherein the operation precision of the another neural network is less than that of the currently used neural network. It can be understood that if the neural network is replaced, the neural network used for replacement and the originally used neural network belong to the same functional neural network, and they can achieve the same function, the difference being that their structures and operation precisions are different.
[0035] In this embodiment, the running parameter of the electronic device meeting the preset condition can indicate that the electronic device is in at least one of the following states: a state of needing to reduce power consumption and a state of needing to allocate system resources to at least one application or device. That is, the running parameter of the electronic device meeting the preset condition can indicate that the electronic device has at least one of the above two states.
[0036] For example, when it is detected that the running parameter meets the preset condition, the electronic device can only reduce the operation precision of the currently used neural network and operate, without changing the structure of the currently used neural network.
[0037] For example, when it is detected that the running parameter meets the preset condition, the electronic device can replace the currently used neural network with another neural network, and then perform operation, where the operation precision of the another neural network can be lower than that of the currently used neural network. For example, the structure of the another neural network can be simpler than that of the currently used neural network, so that the operation precision of the another neural network is lower than that of the currently used neural network.
[0038] For another example, when it is detected that the running parameter meets the preset condition, the electronic device can first replace the currently used neural network A with another neural network B. It can be understood that the currently used neural network becomes B after the replacement. Then, according to actual use requirements, the electronic device can further reduce the operation precision of the neural network B, and perform operation by using the neural network B with reduced operation precision.
[0039] For another example, when it is detected that the running parameter meets the preset condition, the electronic device can first reduce the operation precision of the currently used neural network A, and perform operation by using the neural network A with reduced operation precision. Then, according to actual use requirements, the electronic device can further replace the currently used neural network A with reduced operation precision with another neural network B, and perform operation by using the neural network B, where the operation precision of the neural network B can be lower than that of the above-mentioned neural network A with reduced operation precision.
[0040] In some embodiments, the state in which the power consumption needs to be reduced can include at least one of the following two states: a state in which the power consumption needs to be limited and a state in which the heat needs to be limited.
[0041] In an embodiment, for example, the electronic device detects, according to the running parameter, that the electronic device is in a low-power state, i.e., the electronic device is in a state in which the power consumption needs to be limited. In this case, the electronic device can reduce the operation precision of the currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, where the operation precision of the another neural network is lower than that of the currently used neural network.
[0042] For another example, the electronic device detects, according to the running parameter, that the electronic device is in a high-heat state, i.e., the electronic device is in a state in which the heat needs to be limited. In this case, the electronic device can reduce the operation precision of the currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, where the operation precision of the another neural network is lower than that of the currently used neural network.
[0043] For another example, the electronic device detects, according to the running parameter, that the electronic device is in a state that requires the power and the computing resource to be concentratedly allocated to an application or a device. In this case, the electronic device can reduce the operation precision of the currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, the operation precision of the another neural network being less than that of the currently used neural network.
[0044] It can be understood that in the embodiment, the electronic device can first acquire the running parameter. Then, if it is detected that the running parameter of the electronic device satisfies a preset condition, the electronic device can reduce the operation precision of the currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, the operation precision of the another neural network being less than that of the currently used neural network. The running parameter satisfying the preset condition can represent that the electronic device is in at least one of the following states: a state that requires reducing power consumption and a state that requires concentrating system resources to at least one application or device. Since higher neural network operation precision requires more operation consumption, resulting in higher power consumption and device heating, the embodiment can reduce the operation precision of the currently used neural network and / or replace the currently used neural network with another neural network with lower operation precision when the electronic device is in at least one of the two states, thereby reducing the power consumption and heating of the electronic device.
[0045] In an implementation manner, the process of acquiring the running parameter of the electronic device can include acquiring a remaining power value of the electronic device.
[0046] Then, if the running parameter satisfies the preset condition, the process of reducing the operation precision of the currently used neural network, and / or replacing the currently used neural network with another neural network and performing operation can include: if the remaining power value is less than a first threshold, reducing the operation precision of the currently used neural network, and / or replacing the currently used neural network with another neural network and performing operation, wherein the remaining power value being less than the first threshold represents that the electronic device is in a state that requires reducing power consumption.
[0047] For example, before the electronic device runs the neural network to perform operation or in the process of running the neural network, the electronic device can acquire the remaining power value thereof and detect whether the remaining power value is less than the first threshold.
[0048] If it is detected that the remaining power value is greater than or equal to the first threshold, it can be considered that the power of the electronic device is sufficient. In this case, the electronic device can run the neural network.
[0049] If it is detected that the remaining power value is less than the first threshold value, it can be considered that the electronic device is in a power shortage state, i.e., at this time, the electronic device is in a state in which power consumption needs to be limited, and the state in which power consumption needs to be limited belongs to one of the states in which power consumption needs to be reduced. In this case, the electronic device can reduce the operation precision of the currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, thereby saving power in the manner of reducing operation precision. Since reducing operation precision can reduce the workload of the processor running the neural network, the heat of these devices can also be reduced, thereby reducing the overall heat of the electronic device.
[0050] In another implementation, the process of obtaining the operating parameter of the electronic device can include obtaining the temperature of the electronic device.
[0051] Then, if the operating parameter meets the preset condition, the process of reducing the operation precision of the currently used neural network, and / or replacing the currently used neural network with another neural network and performing operation can include: if the temperature of the electronic device is greater than the second threshold value, reducing the operation precision of the currently used neural network, and / or replacing the currently used neural network with another neural network and performing operation, wherein the temperature greater than the second threshold value indicates that the electronic device is in a state in which power consumption needs to be reduced.
[0052] For example, before the electronic device runs the neural network to perform operation or in the process of running the neural network, the electronic device can obtain the temperature of at least one component and detect whether the temperature is greater than the second threshold value.
[0053] If it is detected that the temperature is less than or equal to the second threshold value, it can be considered that the temperature of the electronic device is low. In this case, the electronic device can continue to run the neural network.
[0054] If it is detected that the temperature is greater than the second threshold value, it can be considered that the electronic device is in a state in which heat is relatively serious, i.e., at this time, the electronic device is in a state in which heat needs to be limited, and the state in which heat needs to be limited also belongs to one of the states in which power consumption needs to be reduced. In this case, the electronic device can reduce the operation precision of the currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, thereby reducing the workload of the processor running the neural network in the manner of reducing operation precision, thereby reducing the heat of these devices to achieve the effect of reducing the overall heat of the electronic device. In addition, reducing the workload of the processor running the neural network can also save power for the electronic device.
[0055] It should be noted that in the embodiments of the present application, the temperature obtained by the electronic device can be the temperature of at least one of the following components: a battery, a dynamic random access memory controller (DRAM), a central processing unit (CPU), a graphics processing unit (GPU), a neural network processing unit (NPU), an image signal processor (ISP), a digital signal processor (DSP), an electronic device shell, etc.
[0056] In yet another implementation, the electronic device can set different priorities for different applications in advance. Among them, the higher the priority of an application can represent the higher demand of the application for system resources (such as power, computing resources, etc.).
[0057] Based on this, the process of obtaining the running parameter of the electronic device can include: obtaining the priority of the application running in the electronic device.
[0058] Then, if the running parameter meets the preset condition, the process of reducing the operation precision of the currently used neural network and / or replacing the currently used neural network with another neural network and performing operation can include: if there is a second application whose priority is higher than that of the first application among the running applications, reducing the operation precision of the currently used neural network and / or replacing the currently used neural network with another neural network and performing operation, wherein the first application is an application that uses a neural network to perform operation, and the presence of the second application whose priority is higher than that of the first application among the running applications indicates that the electronic device is in a state of needing to allocate system resources to at least one application.
[0059] For example, at T1, the electronic device is running a first application that uses a neural network to perform operation. After a period of time, at T2, a second application starts running in the electronic device. Among them, the priority of the second application is higher than that of the first application. Since the priority of the second application is higher than that of the first application, it can be considered that the demand of the second application for system resources is higher than that of the first application, and the electronic device is in a state of needing to allocate system resources to the second application. In this case, the electronic device can reduce the operation precision of the currently used neural network and / or replace the currently used neural network with another neural network and perform operation, so as to reduce power consumption and device heating by reducing the operation precision, and leave more power and computing resources for the second application to use.
[0060] Please refer to Figure 2 , Figure 2 Another flowchart of the electronic device running method provided by the embodiments of the present application can include:
[0061] 201, obtaining a running parameter of an electronic device.
[0062] For example, before or during the electronic device running the neural network, the electronic device can obtain its running parameter.
[0063] After obtaining the running parameter of the electronic device, the electronic device can detect whether the running parameter meets a preset condition. The running parameter meeting the preset condition can represent that the electronic device is in at least one of the following states: a state requiring to reduce power consumption (such as a state requiring to limit power consumption or a state requiring to limit heat generation, etc.) and a state requiring to allocate system resources to at least one application or device.
[0064] If it is detected that the running parameter does not meet the preset condition, the electronic device can continue to run the neural network.
[0065] If it is detected that the running parameter meets the preset condition, the process of 202 can be entered.
[0066] 202. If the running parameter meets the preset condition, obtaining a power consumption value requiring to be reduced or a temperature value of the electronic device requiring to be reduced, and determining a first operation precision according to an operation precision of the currently used neural network and the power consumption value requiring to be reduced or the temperature value of the electronic device requiring to be reduced, wherein the running parameter meeting the preset condition represents that the electronic device is in at least one of the following states: a state requiring to reduce power consumption and a state requiring to allocate system resources to at least one application or device, and the neural network executing different operation precisions can cause the electronic device to consume different power values and can cause the electronic device to generate different temperature values.
[0067] For example, the electronic device detects that its running parameter meets the preset condition, which represents that the electronic device is in at least one of the following states: a state requiring to reduce power consumption and a state requiring to allocate system resources to at least one application or device. Then, the electronic device can first determine the first operation precision.
[0068] In this embodiment, the electronic device can determine the first operation precision in the following manner: since the neural network executing different operation precisions can cause the electronic device to consume different power values and can cause the electronic device to generate different temperature values. Therefore, the electronic device can obtain a power consumption value requiring to be reduced or a temperature value of the electronic device requiring to be reduced, and then determine the first operation precision according to an operation precision of the currently used neural network and the power consumption value requiring to be reduced or the temperature value of the electronic device requiring to be reduced.
[0069] For example, the power consumption value of each neural network with different operation precision can be obtained by the power model of the processor (e.g., NPU) itself. For example, the power model can be used to obtain the power consumption value of the neural network with different operation precision, and the temperature value caused by the device working.
[0070] Based on this, when it is detected that the running parameter of the electronic device meets the preset condition, the electronic device can obtain the power consumption value that needs to be reduced or the temperature value that needs to be reduced. Then, the electronic device can determine the first operation precision according to the operation precision of the currently used neural network and the power consumption value that needs to be reduced or the temperature value that needs to be reduced.
[0071] For example, the neural network A currently used by the electronic device needs to consume 5% of power when running. The electronic device obtains that the power consumption value that needs to be reduced is 3%, that is, the electronic device needs an operation precision that consumes only 2% of power when running at this time. Then, the electronic device can determine the operation precision that consumes 2% of power as the first operation precision.
[0072] For another example, the temperature of the processor of the electronic device will rise by 2℃ when running the neural network A currently used by the electronic device due to the heat generated by the device. The electronic device obtains that the temperature value that needs to be reduced is 1℃, that is, the electronic device needs an operation precision that will only make the temperature of the processor rise by 1℃ when running at this time. Then, the electronic device can determine the operation precision that will make the temperature of the processor rise by 1℃ as the first operation precision.
[0073] 203、reduce the operation precision of the currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, so that the operation precision of the neural network used by the electronic device is reduced to the first operation precision.
[0074] For example, after determining the first operation precision, the electronic device can reduce the operation precision of the currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, so that the operation precision of the neural network used by the electronic device is finally reduced to the first operation precision.
[0075] For example, the neural network currently used by the electronic device is A, and then after determining the first operation precision, the electronic device can reduce the operation precision of the neural network A currently used to the first operation precision.
[0076] Alternatively, the neural network currently used by the electronic device is A, and then after determining the first operation precision, the electronic device can obtain a neural network B with the first operation precision, and replace the neural network A currently used with the neural network B. Then, the electronic device can use the neural network B to perform operation.
[0077] Or, the neural network currently used by the electronic device is A, and then after determining the first operation precision, the electronic device can first reduce the operation precision of the currently used neural network A to a second operation precision, which can be greater than the first operation precision. Then, the electronic device can replace the currently used neural network A with a second operation precision with a neural network B having a first operation precision. Then, the electronic device can use the neural network B to perform operations.
[0078] Or, the neural network currently used by the electronic device is A, and then after determining the first operation precision, the electronic device can first replace the currently used neural network A with a neural network C, which has a third operation precision, which can be greater than the first operation precision. Then, the electronic device can reduce the operation precision of the currently used neural network C from the third operation precision to the first operation precision. Then, the electronic device can use the neural network C to perform operations.
[0079] In an embodiment, the electronic device can gradually reduce the operation precision of the neural network, thereby reducing the negative impact of reducing the operation precision. For example, the neural network is used to process video frame images, and then gradually reducing the operation precision of the neural network can gradually reduce the imaging quality of the processed video frame images, thereby making the user almost unaware of the gradual process from high quality to low quality.
[0080] In an embodiment, when only reducing the operation precision of the currently used neural network, the electronic device can gradually reduce the operation precision to the first operation precision by the following way:
[0081] Each time a new set of neural network setting parameters is obtained, and the obtained neural network setting parameters are used to run the used neural network, so that the operation precision of the neural network used by the electronic device is gradually reduced to the first operation precision, wherein each set of neural network setting parameters corresponds to an operation precision.
[0082] For example, the neural network currently used is A, and the electronic device can pre-store multiple sets of setting parameters about the neural network A, and each set of setting parameters can correspond to an operation precision. For example, the electronic device pre-stores five sets of setting parameters about the neural network A, which are S1, S2, S3, S4, and S5. The operation precisions corresponding to the five sets of setting parameters decrease in turn. For example, the setting parameter currently used by the neural network A is S1, and the operation precision corresponding to the setting parameter S4 is the first operation precision. Then, the electronic device can first obtain the setting parameter S2 and run the neural network A by using the setting parameter S2. Then, the electronic device can obtain the setting parameter S3 and run the neural network A by using the setting parameter S3. Finally, the electronic device can obtain the setting parameter S4 and run the neural network A by using the setting parameter S4, so that the operation precision of the neural network used by the electronic device gradually decreases to the first operation precision. The above process can be as shown in FIG. 8. Figure 3
[0083] In some embodiments, obtaining a new set of setting parameters of the neural network each time can be obtaining a new set of setting parameters of the neural network each time after running the neural network once. For example, running the neural network once can perform a complete operation (for example, running the neural network once can complete noise reduction on a frame of video), and then the electronic device can obtain a new set of neural network setting parameters S2 to replace the original neural network setting parameters S1 before starting the next operation.
[0084] In an embodiment, when only the used neural network is replaced, the electronic device can gradually reduce the operation precision to the first operation precision by the following method:
[0085] Each time a new neural network is obtained, the newly obtained neural network is used to replace the current neural network and perform operation, so that the operation precision of the neural network used by the electronic device gradually decreases to the first operation precision, wherein each neural network has an operation precision.
[0086] For example, the neural network currently used is A, and the electronic device further has other neural networks, and each other neural network has an operation precision. For example, the electronic device further has neural networks B, C, D, E, and F. The operation precisions of the neural networks A, B, C, D, E, and F decrease in turn. For example, the operation precision of the neural network D is the first operation precision. Then, the electronic device can first replace the neural network A with the neural network B and perform operation. Then, the electronic device can replace the neural network B with the neural network C and perform operation. Finally, the electronic device can replace the neural network C with the neural network D and perform operation, so that the operation precision gradually decreases to the first operation precision. The above process can be as shown in FIG. 9. Figure 4
[0087] In some embodiments, obtaining a new neural network each time can be obtaining a new neural network each time after running the neural network once. For example, running the neural network once can perform a complete operation (such as running the neural network once can complete the noise reduction of a frame of video), and then the electronic device can obtain a new neural network B to replace the original neural network A before starting the next operation, and the like.
[0088] It can be understood that, by gradually reducing the operation precision, the negative effects caused by reducing the operation precision can be reduced.
[0089] In an embodiment, the electronic device can reduce the operation precision of the currently used neural network at least by the following ways:
[0090] reducing the bit number of the weight corresponding to the neuron in the currently used neural network, and / or reducing the bit number of the feature map output by the network layer in the currently used neural network.
[0091] For example, the operation precision of the neural network can be represented by the bit number of the weight corresponding to the neuron, the bit number of the feature map output by the network layer, and the like. The more the bit number, the finer the granularity. For example, 8 bits can represent an accuracy of 1 / 256, 16 bits can represent an accuracy of 1 / 65536, and the like. Therefore, the embodiment can reduce the operation precision of the neural network by at least one of reducing the bit number of the weight corresponding to the neuron in the currently used neural network and reducing the bit number of the feature map output by the network layer in the currently used neural network.
[0092] In an embodiment, the bit number of the weight corresponding to the neuron and the bit number of the feature map output by the network layer in the currently used neural network can be represented by WgAh. Wherein, W represents the weight corresponding to the neuron, g represents the bit number used by the weight, A represents the feature map, and h represents the bit number used by the feature map. For example, W16A16 can represent that the bit number used by the weight corresponding to the neuron in the neural network is 16 bits and the bit number used by the feature map output by the network layer is 16 bits.
[0093] Based on this, the operation precision of the neural network changes from W16A16 to W14A16 can be used to represent that the bit number of the weight corresponding to the neuron in the currently used neural network is reduced from 16 bits to 14 bits, thereby reducing the operation precision of the neural network.
[0094] For another example, the operation precision of the neural network is changed from W16A16 to W14A12 can be used to represent that the bit number of the weight corresponding to the neuron in the currently used neural network is reduced from 16 bits to 14 bits, and the bit number of the feature map output by the network layer of the currently used neural network is reduced from 16 bits to 12 bits, so as to reduce the operation precision of the neural network.
[0095] For another example, the operation precision of the neural network is changed from W16A16 to W14A12 can be used to represent that the bit number of the weight corresponding to the neuron in the currently used neural network is reduced from 16 bits to 14 bits, and the bit number of the feature map output by the network layer of the currently used neural network is reduced from 16 bits to 12 bits, so as to reduce the operation precision of the neural network.
[0096] It should be noted that when the operation precision of the neural network is reduced, the bit number of the weight corresponding to the neuron of some network layers can be reduced, or the bit number of the feature map output by some network layers can be reduced. In addition, different network layers can be different when reducing the bit number of the weight or the feature map. For example, the weight corresponding to the neuron of some network layers can be reduced from 32-bit numbers to 8-bit numbers, and the weight corresponding to the neuron of some network layers can be reduced from 32-bit numbers to 12-bit numbers. For another example, the feature map output by some network layers can be reduced from 19-bit numbers to 11-bit numbers, and the feature map output by some network layers can be reduced from 19-bit numbers to 15-bit numbers, and the like.
[0097] Please refer to Figures 5 to 8 , Figures 5 to 8 The scene schematic diagram of the electronic device running method provided by the embodiment of the present application.
[0098] For example, as shown in Figure 5 , the electronic device starts recording a video at T3, and the electronic device runs the neural network A to perform noise reduction processing on the video frame when recording the video. At this time, the neural network A can first run according to the default operation precision P1.
[0099] At T4, the electronic device detects that the remaining power is lower than the first threshold (such as 20%), that is, the electronic device is in a low power state. At this time, the electronic device can generate a prompt information for prompting the user whether to enter the power saving mode when the current remaining power is small, as shown in Figure 6 .
[0100] The user selects to enter the power saving mode. After the electronic device enters the power saving mode, the electronic device can reduce the operation precision of the currently used neural network A, for example, reduce the operation precision of the neural network A from P1 to P2, and perform noise reduction processing on the video frame obtained by recording according to the operation precision P2, so as to reduce the power consumption and heat.
[0101] For another example, the electronic device starts recording a video at T5, and the electronic device runs the neural network A to perform noise reduction on video frames during the recording of the video. At this time, the neural network A can run according to the default operation precision P1. At T6, the electronic device detects that the battery temperature is higher than the second threshold (for example, 50 DEG C), that is, the electronic device is in a state of relatively serious battery heating. At this time, the electronic device can generate a prompt information for prompting the user whether to reduce heating, for example, as shown in the following table. Figure 7
[0102] The user selects to reduce heating. After that, the electronic device can replace the currently used neural network A with another neural network B and perform operation, so as to reduce heating and power consumption. The neural network B has a simpler structure than the neural network A, so that the operation precision P3 of the neural network B is less than the operation precision P1 of the neural network A.
[0103] For another example, the electronic device starts recording a video at T7, and the electronic device runs the neural network A to perform noise reduction on video frames during the recording of the video. At this time, the neural network A can run according to the default operation precision P1. At T8, the electronic device detects that the remaining power is lower than the first threshold (for example, 20%) and the battery temperature is higher than the second threshold (for example, 50 DEG C), that is, the electronic device is in a state of relatively low power and relatively serious battery heating. At this time, the electronic device can generate a prompt information for prompting the user whether to reduce heating and save power, for example, as shown in the following table. Figure 8
[0104] The user selects to reduce heating and save power. After that, the electronic device can replace the currently used neural network A with another neural network B, where the neural network B has a simpler structure than the neural network A, so that the operation precision of the neural network B is less than the operation precision of the neural network A as a whole. For example, the default operation precision of the neural network B is P4, which is less than P1. After replacing the used neural network with the neural network B, the electronic device can also reduce the operation precision of the neural network B, for example, from P4 to P5. After that, the electronic device can use the neural network B with the operation precision P5 to perform the operation of video noise reduction. Compared with using the neural network A with the operation precision P1, using the neural network B with the operation precision P5 to perform the operation of video noise reduction can reduce heating and save power.
[0105] Please refer to Figure 9 , Figure 9 The electronic device running apparatus provided by the embodiment of the present application is shown in the structure diagram. The electronic device running apparatus 300 can include an acquisition module 301 and a processing module 302.
[0106] The acquisition module 301 is configured to acquire a running parameter of the electronic device.
[0107] The processing module 302 is configured to, if the running parameter meets a preset condition, reduce an operation precision of a currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, the operation precision of the another neural network being less than the operation precision of the currently used neural network.
[0108] The running parameter meeting the preset condition means that the electronic device is in at least one of the following states: a state of needing to reduce power consumption and a state of needing to allocate system resources to at least one application or device.
[0109] In an embodiment, the processing module 302 can be configured to reduce a bit number of a weight corresponding to a neuron in the currently used neural network, and / or reduce a bit number of a feature map output by a network layer in the currently used neural network.
[0110] In an embodiment, the neural network can make the electronic device consume different power values and produce different temperature values when performing different operation precisions, and the processing module 302 can be configured to acquire a power consumption value to be reduced or a temperature value of the electronic device to be reduced, determine a first operation precision according to an operation precision of the currently used neural network and the power consumption value to be reduced or the temperature value of the electronic device to be reduced, reduce the operation precision of the currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, so that the operation precision of the neural network used by the electronic device is reduced to the first operation precision.
[0111] In an embodiment, the processing module 302 can be configured to acquire a new set of neural network setting parameters each time, and run the used neural network by using the newly acquired neural network setting parameters, so that the operation precision of the neural network used by the electronic device is gradually reduced to the first operation precision, wherein each set of neural network setting parameters corresponds to an operation precision.
[0112] In another embodiment, the processing module 302 can be configured to acquire a new neural network each time, and replace the current neural network with the newly acquired neural network and perform operation, so that the operation precision of the neural network used by the electronic device is gradually reduced to the first operation precision, wherein each neural network has an operation precision.
[0113] In an embodiment, the acquisition module 301 can be configured to acquire a residual power value of the electronic device.
[0114] Therefore, the processing module 302 can be used to: reduce the computational precision of the currently used neural network if the remaining power value is less than a first threshold, and / or replace the currently used neural network with another neural network, wherein the remaining power value being less than the first threshold indicates that the electronic device is in a state where power consumption needs to be reduced.
[0115] In one embodiment, the acquisition module 301 can be used to: acquire the temperature of the electronic device;
[0116] Therefore, the processing module 302 can be used to: reduce the computational precision of the currently used neural network if the temperature is greater than the second threshold, and / or replace the currently used neural network with another neural network, wherein the temperature being greater than the second threshold indicates that the electronic device is in a state where power consumption needs to be reduced.
[0117] In one implementation, priorities can be set for applications in the electronic device.
[0118] Therefore, the acquisition module 301 can be used to: acquire the priority of the application running in the electronic device.
[0119] The processing module 302 can be used to: if there is a second application with a higher priority than the first application in the running application, reduce the computational precision of the currently used neural network, and / or replace the currently used neural network with another neural network, wherein the first application is an application that uses a neural network for computation, and the existence of a second application with a higher priority than the first application in the running application indicates that the electronic device is in a state where system resources need to be centrally allocated to at least one application.
[0120] This application provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed on a computer, it causes the computer to perform the process in the electronic device operation method provided in this embodiment.
[0121] This application also provides an electronic device, including a memory and a processor, wherein the processor executes the process in the electronic device operation method provided in this embodiment by calling a computer program stored in the memory.
[0122] For example, the aforementioned electronic device could be a mobile terminal such as a tablet or smartphone. See also... Figure 10 , Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0123] The electronic device 400 may include components such as a power supply 401, a memory 402, and a processor 403. Those skilled in the art will understand that... Figure 10The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and can include more or fewer components than shown, or combine certain components, or arrange different components.
[0124] The power supply 401 can be configured to provide power support for various components and modules of the electronic device, thereby ensuring normal operation of the various components and modules.
[0125] The memory 402 can be configured to store application programs and data. The application programs stored in the memory 402 include executable codes. The application programs can constitute various functional modules. The processor 403 executes various functional applications and data processing by running the application programs stored in the memory 402.
[0126] The processor 403 is the control center of the electronic device, and connects various parts of the electronic device through various interfaces and lines. The processor 403 executes various functions and processes data of the electronic device by running or executing the application programs stored in the memory 402 and calling the data stored in the memory 402, thereby monitoring the entire electronic device. The processor 403 can be a device capable of running a neural network, such as a CPU, NPU, DSP, GPU, etc.
[0127] In the embodiment, the processor 403 in the electronic device loads the executable code corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and runs the application programs stored in the memory 402 by the processor 403, thereby executing:
[0128] obtaining a running parameter of the electronic device;
[0129] if the running parameter meets a preset condition, reducing the operation precision of a currently used neural network, and / or replacing the currently used neural network with another neural network and performing operation, the operation precision of the another neural network being less than the operation precision of the currently used neural network;
[0130] wherein the running parameter meeting the preset condition indicates that the electronic device is in at least one of the following states: a state of needing to reduce power consumption and a state of needing to allocate system resources to at least one application or device.
[0131] Please refer to Figure 11 , the electronic device 400 can include a power supply 401, a memory 402, a processor 403, a display screen 404, a speaker 405, a microphone 406, and the like.
[0132] The power supply 401 can be configured to provide power support for various components and modules of the electronic device, thereby ensuring normal operation of the various components and modules.
[0133] The memory 402 can be used to store applications and data. The applications stored in the memory 402 include executable codes. The applications can constitute various functional modules. The processor 403 executes various functional applications and data processing by running the applications stored in the memory 402.
[0134] The processor 403 is the control center of the electronic device, connects various parts of the electronic device through various interfaces and lines, executes various functions of the electronic device and processes data by running or executing the applications stored in the memory 402 and calling the data stored in the memory 402, and thus monitors the entire electronic device. The processor 403 can be a device capable of running a neural network, such as a CPU, an NPU, a DSP, a GPU, etc.
[0135] The display screen 404 can be used to display information such as text, images, etc. The display screen 404 can also be used to receive touch operations from the user.
[0136] The speaker 405 can be used to play sound signals. The microphone 406 can be used to collect sound signals in the surrounding environment, for example, the microphone 406 can be used to collect voice information issued by the user.
[0137] In this embodiment, the processor 403 in the electronic device loads the executable code corresponding to the process of one or more applications into the memory 402 according to the following instructions, and runs the applications stored in the memory 402 by the processor 403, so as to execute:
[0138] obtain a running parameter of the electronic device;
[0139] if the running parameter meets a preset condition, reduce the operation precision of the currently used neural network, and / or replace the currently used neural network with another neural network and perform operation, the operation precision of the another neural network is less than the operation precision of the currently used neural network;
[0140] wherein the running parameter meeting the preset condition means that the electronic device is in at least one of the following states: a state of needing to reduce power consumption and a state of needing to allocate system resources to at least one application or device.
[0141] In an implementation manner, when the processor 403 executes the reducing of the operation precision of the currently used neural network, the processor 403 can execute: reducing the bit number of the weight corresponding to the neuron in the currently used neural network, and / or reducing the bit number of the feature map output by the network layer in the currently used neural network.
[0142] In an embodiment, the neural network can make the electronic device consume different power values and generate different temperature values when performing different operation precisions, and the processor 403 can further execute: obtaining a power consumption value to be reduced or a temperature value of the electronic device to be reduced; and determining the first operation precision according to the operation precision of the currently used neural network and the power consumption value to be reduced or the temperature value of the electronic device to be reduced.
[0143] Then, when the processor 403 performs the operation of reducing the operation precision of the currently used neural network and / or replacing the currently used neural network with another neural network, the processor 403 can perform: reducing the operation precision of the currently used neural network and / or replacing the currently used neural network with another neural network to reduce the operation precision of the neural network used by the electronic device to the first operation precision.
[0144] In an embodiment, when only the operation precision of the currently used neural network is reduced, the processor 403 can execute: obtaining a new set of neural network setting parameters each time, and running the used neural network by using the newly obtained neural network setting parameters, so that the operation precision of the neural network used by the electronic device is gradually reduced to the first operation precision, wherein each set of neural network setting parameters corresponds to an operation precision.
[0145] In an embodiment, when only the used neural network is replaced, the processor 403 can execute: obtaining a new neural network each time, and replacing the current neural network with the newly obtained neural network to perform operation, so that the operation precision of the neural network used by the electronic device is gradually reduced to the first operation precision, wherein each neural network has an operation precision.
[0146] In an embodiment, when the processor 403 performs the operation of obtaining the running parameter of the electronic device, the processor 403 can execute: obtaining a remaining power value of the electronic device.
[0147] Then, when the processor 403 performs the operation of reducing the operation precision of the currently used neural network and / or replacing the currently used neural network with another neural network if the running parameter meets a preset condition, the processor 403 can perform: reducing the operation precision of the currently used neural network and / or replacing the currently used neural network with another neural network if the remaining power value is less than a first threshold value, wherein the remaining power value being less than the first threshold value indicates that the electronic device is in a state of needing to reduce power consumption.
[0148] In an embodiment, when the processor 403 performs the operation of obtaining the running parameter of the electronic device, the processor 403 can execute: obtaining a temperature of the electronic device.
[0149] So, the processor 403 performs the operation of: if the temperature is greater than the second threshold, reducing the operation precision of the currently used neural network, and / or replacing the currently used neural network with another neural network, wherein the temperature being greater than the second threshold indicates that the electronic device is in a state requiring reduction of power consumption.
[0150] In an implementation, the processor 403 can further perform the operation of: setting priorities for applications in the electronic device.
[0151] So, the processor 403 performs the operation of: obtaining the priorities of the running applications in the electronic device.
[0152] The processor 403 performs the operation of: if the running applications include a second application with a priority higher than a first application, reducing the operation precision of the currently used neural network, and / or replacing the currently used neural network with another neural network, wherein the first application is an application using a neural network for operation, and the running applications including the second application with the priority higher than the first application indicates that the electronic device is in a state requiring system resources to be concentratedly allocated to at least one application.
[0153] In the above embodiments, the description of each embodiment focuses on different aspects, and the parts not described in detail in a certain embodiment can be referred to the detailed description of the electronic device running method above, which will not be repeated here.
[0154] The electronic device running apparatus provided by the embodiments of the present application and the electronic device running method in the above embodiments belong to the same concept, and any method provided in the electronic device running method embodiments can be run on the electronic device running apparatus. For specific implementation process, refer to the electronic device running method embodiments, which will not be repeated here.
[0155] It should be noted that, for the electronic device running method described in the embodiments of the present application, those skilled in the art can understand that all or part of the processes of the electronic device running method described in the embodiments of the present application can be completed by a computer program controlling relevant hardware, and the computer program can be stored in a computer readable storage medium, such as a memory, and executed by at least one processor. In the execution process, the processes of the electronic device running method described in the embodiments of the present application can be included. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM), a random access memory (RAM), etc.
[0156] For the electronic device running apparatus described in the embodiments of the present application, each functional module can be integrated in one processing chip, or each module can exist physically independently, or two or more modules can be integrated in one module. The integrated module can be realized in the form of hardware or in the form of a software functional module. If the integrated module is realized in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer readable storage medium, such as a read-only memory, a magnetic disc or an optical disc, etc.
[0157] The electronic device running method, apparatus, storage medium and electronic device provided by the embodiments of the present application are described in detail above, and the principles and implementation manners of the present application are described by applying specific examples. The above description of the embodiments is only used to help understand the method and its core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range can be changed, and the above description should not be understood as a limitation of the present application.
Claims
1. A method for operating an electronic device, characterized in that, include: Obtain the operating parameters of electronic devices; If the operating parameters meet preset conditions, the computational precision of the currently used neural network is reduced, and / or the currently used neural network is replaced with another neural network and computation is performed, wherein the computational precision of the other neural network is less than that of the currently used neural network, wherein the power consumption value to be reduced or the temperature value of the electronic device to be reduced is obtained; a first computational precision is determined based on the computational precision of the currently used neural network and the power consumption value to be reduced or the temperature value of the electronic device to be reduced; when only the computational precision of the currently used neural network is reduced, it includes: each time a new set of neural network setting parameters is obtained, and the used neural network is run using the newly obtained neural network setting parameters, so that the computational precision of the neural network used by the electronic device is gradually reduced to the first computational precision, wherein each set of neural network setting parameters corresponds to a computational precision; or, when only the used neural network is replaced, it includes: each time a new neural network is obtained, and the current neural network is replaced using the newly obtained neural network and computation is performed, so that the computational precision of the neural network used by the electronic device is gradually reduced to the first computational precision, wherein each neural network has a computational precision; The fact that the operating parameters meet the preset conditions indicates that the electronic device is in at least one of the following states: a state that requires reduced power consumption and a state that requires centralized allocation of system resources to at least one application or device.
2. The method for operating an electronic device according to claim 1, characterized in that, The reduction in computational accuracy of the currently used neural network includes at least: Reduce the number of bits for the weights of neurons in the currently used neural network, and / or reduce the number of bits for the feature maps output by the network layers in the currently used neural network.
3. The method for operating an electronic device according to claim 1, characterized in that, The method further includes: When a neural network performs calculations with different precisions, it can cause the electronic device to consume different amounts of power and generate different temperatures. The step of reducing the computational precision of the currently used neural network and / or replacing the currently used neural network with another neural network and performing computation includes: reducing the computational precision of the currently used neural network and / or replacing the currently used neural network with another neural network and performing computation, so that the computational precision of the neural network used by the electronic device is reduced to the first computational precision.
4. The method for operating an electronic device according to any one of claims 1 to 3, characterized in that, The acquisition of the operating parameters of the electronic device includes: acquiring the remaining battery power of the electronic device; The step of reducing the computational precision of the currently used neural network and / or replacing the currently used neural network with another neural network if the operating parameters meet the preset conditions includes: reducing the computational precision of the currently used neural network and / or replacing the currently used neural network with another neural network if the remaining power value is less than a first threshold, wherein the remaining power value being less than the first threshold indicates that the electronic device is in a state where power consumption needs to be reduced.
5. The method for operating an electronic device according to any one of claims 1 to 3, characterized in that, The acquisition of operating parameters of the electronic device includes: acquiring the temperature of the electronic device; The step of reducing the computational precision of the currently used neural network and / or replacing the currently used neural network with another neural network if the operating parameters meet the preset conditions includes: if the temperature is greater than a second threshold, reducing the computational precision of the currently used neural network and / or replacing the currently used neural network with another neural network, wherein the temperature being greater than the second threshold indicates that the electronic device is in a state where power consumption needs to be reduced.
6. The method for operating an electronic device according to any one of claims 1 to 3, characterized in that, The method further includes: setting priorities for applications in the electronic device; The process of obtaining the operating parameters of the electronic device includes: obtaining the priority of the applications running in the electronic device; The step of reducing the computational precision of the currently used neural network and / or replacing the currently used neural network with another neural network if the operating parameters meet the preset conditions includes: if there is a second application with a higher priority than the first application in the running application, then reducing the computational precision of the currently used neural network and / or replacing the currently used neural network with another neural network, wherein the first application is an application that uses a neural network for computation, and the existence of a second application with a higher priority than the first application in the running application indicates that the electronic device is in a state where system resources need to be concentratedly allocated to at least one application.
7. An operating device for an electronic device, characterized in that, include: The acquisition module is used to acquire the operating parameters of the electronic device; A processing module is configured to, if the operating parameters meet preset conditions, reduce the computational precision of the currently used neural network, and / or replace the currently used neural network with another neural network and perform computation, wherein the computational precision of the other neural network is less than that of the currently used neural network, wherein the module acquires a power consumption reduction value or an electronic device temperature reduction value; determines a first computational precision based on the computational precision of the currently used neural network and the power consumption reduction value or the electronic device temperature reduction value; when only reducing the computational precision of the currently used neural network, the module includes: acquiring a new set of neural network setting parameters each time, and using the newly acquired neural network setting parameters to run the used neural network, so that the computational precision of the neural network used by the electronic device is gradually reduced to the first computational precision, wherein each set of neural network setting parameters corresponds to a computational precision; or, when only replacing the used neural network, the module includes: acquiring a new neural network each time, and using the newly acquired neural network to replace the current neural network and perform computation, so that the computational precision of the neural network used by the electronic device is gradually reduced to the first computational precision, wherein each neural network has a computational precision. The fact that the operating parameters meet the preset conditions indicates that the electronic device is in at least one of the following states: a state that requires reduced power consumption and a state that requires centralized allocation of system resources to at least one application or device.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed on a computer, it causes the computer to perform the method as described in any one of claims 1 to 6.
9. An electronic device, comprising a memory and a processor, characterized in that, The processor is capable of running a neural network, and the processor performs the method as described in any one of claims 1 to 6 by invoking a computer program stored in the memory.
Citation Information
Patent Citations
Power consumption adjustment method and device of setting multiplier precision on basis of power amount
CN108388333A
Weight precision configuration method, weight precision configuration device, weight precision configuration equipment and storage medium
CN111831358A
Automatic tuning of artificial neural networks
US20160358070A1
Video playback method and apparatus, storage medium and electronic device
WO2020206688A1