Adaptive resource optimization method, device and medium based on image processing program

CN118550719BActive Publication Date: 2024-11-29ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411049486.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-01
Publication Date
2024-11-29
Estimated Expiration
2044-08-01

AI Technical Summary

Technical Problem

When deploying image processing algorithms to different devices, it is necessary to test and tune through manpower, resulting in waste of resources and inefficiency, affecting the optimized deployment of image processing.

Method used

An adaptive resource optimization method based on an image processing program is provided. By obtaining the operating nodes and resource utilization information of the current system, optimizing the target operating nodes according to the preset optimization strategy, and automatically adjusting the resource configuration to improve the efficiency of the image processing program.

Benefits of technology

It reduces the subjectivity and time cost of manual tuning, improves the optimization efficiency of image processing programs on different devices, and reduces the waste of manpower and time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550719B_ABST
    Figure CN118550719B_ABST
Patent Text Reader

Abstract

The present application discloses an adaptive resource optimization method, device and medium based on an image processing program. The method includes obtaining, during the process of the current system running the image processing program, the running node running the image processing program in the current system and the current system resource utilization information; determining the target running node from each running node according to the node information of the running node; in response to the current system resource utilization information satisfying the preset resource configuration information of the current system, selecting the target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information; and optimizing the operation of the target running node with the target optimization strategy. Thus, the optimization efficiency of the image processing program is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an adaptive resource optimization method based on an image processing program, an electronic device and a computer-readable storage medium. Background Art

[0002] Different industries have different requirements for image processing in various business scenarios. Even image processing algorithms with the same functions will be deployed on device platforms with different performance levels and specifications according to the actual application scenarios. Given the differences in processing power and performance of various devices, the image processing algorithm R&D team needs to continuously test and optimize the image processing algorithm based on the capabilities of different devices. This ensures that the image processing algorithm can accurately adapt to the target device, and after repeated iterations and optimizations, it can be successfully deployed to the target device to maximize performance and user experience.

[0003] Currently, when deploying image processing algorithms to different devices, testing and tuning are mainly done by manpower, which results in a large amount of manpower and time consumed in the tuning process, ultimately affecting the deployment of the image processing algorithm. Summary of the invention

[0004] The main technical problem solved by the present application is to provide an adaptive resource optimization method based on an image processing program, an electronic device and a computer-readable storage medium, which can improve the optimization efficiency of the image processing program.

[0005] In order to solve the above technical problems, a technical solution adopted in the present application is: providing an adaptive resource optimization method based on an image processing program, the method comprising: in the process of the current system running the image processing program, obtaining the running node running the image processing program in the current system and the current system resource utilization information; determining the target running node from each running node according to the node information of the running node; in response to the current system resource utilization information satisfying the preset resource configuration information of the current system, selecting a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information; and performing operation optimization on the target running node using the target optimization strategy.

[0006] In some embodiments, the current system resource utilization information includes a current utilization rate of a central processing unit, the preset resource configuration information includes a preset utilization rate of the central processing unit, and the preset optimization strategy includes a batch processing strategy of the target running node;

[0007] In response to the current system resource utilization information satisfying the preset resource configuration information of the current system, the step of selecting a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information includes: in response to the current utilization rate of the central processing unit being greater than or equal to the preset utilization rate of the central processing unit, determining the batch processing strategy of the corresponding target operating node as the target optimization strategy according to the current utilization rate of the central processing unit; the step of performing operation optimization of the target operating node with the target optimization strategy includes: performing operation optimization of the target operating node with the batch processing strategy of the target operating node.

[0008] In some embodiments, the step of performing operation optimization on the target operation node using the batch processing strategy of the target operation node includes: obtaining the amount of operation data executed each time by the target operation node; increasing the amount of operation data executed each time by the target operation node according to the node information of the target operation node to obtain the target amount of operation data executed each time by the target operation node; and performing operation processing on the target operation node with the target amount of operation data executed each time.

[0009] In some embodiments, the current system resource utilization information includes the current usage rate of the hardware resources, the preset resource configuration information includes the preset usage rate of the hardware resources, and the preset optimization strategy includes the parallel processing strategy of the target running node; the step of selecting a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information in response to the current system resource utilization information satisfying the preset resource configuration information of the current system includes: in response to the current usage rate of the hardware resources being greater than or equal to the preset usage rate of the hardware resources, determining the corresponding parallel processing strategy of the target running node as the target optimization strategy according to the current usage rate of the hardware resources; the step of performing operation optimization of the target running node with the target optimization strategy includes: performing operation optimization of the target running node with the parallel processing strategy of the target running node.

[0010] In some embodiments, the step of optimizing the operation of the target operation node using the parallel processing strategy of the target operation node includes: duplicating the target operation node to obtain at least two target operation nodes; grouping the data to be run of the target operation node according to the number of nodes of the target operation node; and performing operation processing on each group of data to be run using at least two target operation nodes.

[0011] In some embodiments, the adaptive resource optimization method also includes: obtaining the next system resource utilization information of the current system after resource optimization when running the image processing program, the next system resource utilization information including the next usage rate of the central processing unit and / or the next usage rate of the hardware resources, and the acquisition time of the current system resource utilization information is earlier than the acquisition time of the next system resource utilization information; in response to the next usage rate of the central processing unit being greater than or equal to the preset usage rate of the central processing unit, and / or the next usage rate of the hardware resources being greater than or equal to the preset usage rate of the hardware resources, obtaining the current resource configuration information of the current system; and running the image processing program with the current resource configuration information of the current system.

[0012] In some embodiments, the target running node includes a running node whose running time reaches a time threshold, the current system resource utilization information includes a current utilization rate of the central processing unit, a current utilization rate of hardware resources, and a current memory utilization rate, the preset resource configuration information of the current system includes a preset utilization rate of the central processing unit, a preset utilization rate of the hardware resources, and a preset memory capacity, and the preset optimization strategy includes a resource allocation strategy and a priority allocation strategy; in response to the current system resource utilization information satisfying the preset resource configuration information of the current system, the step of selecting a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information includes: in response to the current utilization rate of the central processing unit being less than If the preset usage rate of the central processing unit, the current usage rate of the hardware resources is less than the current usage rate of the hardware resources, and the current memory usage rate is less than the preset memory capacity, then the number of active yields and / or the number of passive preemptions are obtained, the number of active yields represents the number of times the thread running the target running node actively yields to run, and the number of passive preemptions represents the number of times the thread running the target running node is preempted by other running terminals; in response to the number of active yields being greater than the preset number of yields, the resource allocation policy of the target running node is determined as the target optimization policy; and / or, in response to the number of passive preemptions being greater than the preset number of preemptions, the priority allocation policy of the target running node is determined as the target optimization policy.

[0013] In some embodiments, the target running node includes a running node whose amount of data to be run is greater than a preset running data amount, the current system resource utilization information includes a current usage rate of a central processing unit, a current usage rate of hardware resources, and a current memory usage rate, the preset resource configuration information of the current system includes a preset usage rate of the central processing unit, a preset usage rate of the hardware resources, and a preset memory capacity, and the preset optimization strategy includes a parallel processing strategy; in response to the current system resource utilization information satisfying the preset resource configuration information of the current system, the step of selecting a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information includes: in response to the current usage rate of the central processing unit being less than the preset usage rate of the central processing unit, the current usage rate of the hardware resources being less than the current usage rate of the hardware resources, and the current memory utilization being less than the preset memory capacity, the parallel processing strategy of the target running node is used as the target optimization strategy.

[0014] To solve the above technical problems, another technical solution adopted in the present application is: an electronic device is provided, including a memory and a processor, the processor is used to execute program instructions stored in the memory to implement the above-mentioned adaptive resource optimization method based on the image processing program.

[0015] In order to solve the above technical problems, another technical solution adopted in the present application is: providing a computer-readable storage medium on which program instructions are stored, and when the program instructions are executed by a processor, the above-mentioned adaptive resource optimization method based on the image processing program is implemented.

[0016] Compared with the above scheme, when the image processing program is currently applied to different systems, it needs to be debugged and optimized by manpower, resulting in a large waste of manpower and time. The present application provides an adaptive resource optimization method based on the image processing program, which includes obtaining the running nodes running the image processing program in the current system and the current system resource utilization information during the process of the image processing program running in the current system; determining the target running node from each running node according to the node information of the running node; in response to the current system resource utilization information satisfying the preset resource configuration information of the current system, selecting the target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information; and optimizing the operation of the target running node with the target optimization strategy. In this way, the image processing program is optimized in combination with the system resource utilization information and the node information of the running node when the image processing program is running in the current system, and adaptive resource optimization is performed according to the current system resource utilization information and the node information, thereby improving the optimization efficiency of the image processing program. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work, among which:

[0018] Figure 1 is a flowchart of an exemplary embodiment of an adaptive resource optimization method shown in the present application;

[0019] Figure 2 yes Figure 1 A flow chart of an exemplary embodiment of step S130 in the adaptive resource optimization method is shown;

[0020] Figure 3 yes Figure 1 A flowchart of another exemplary embodiment of step S130 in the adaptive resource optimization method is shown;

[0021] Figure 4 yes Figure 1 A flowchart of another exemplary embodiment of step S130 in the adaptive resource optimization method is shown;

[0022] Figure 5 yes Figure 1 A flowchart of another exemplary embodiment of step S130 in the adaptive resource optimization method is shown;

[0023] Figure 6 It is a specific flow chart of an exemplary embodiment of the adaptive resource optimization method shown in the present application;

[0024] Figure 7 is a structural diagram of an exemplary embodiment of an adaptive resource optimization device shown in the present application;

[0025] Figure 8 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application;

[0026] Fig. 9 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present application. DETAILED DESCRIPTION

[0027] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It will be appreciated that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some but not all structures related to the present application are shown in the drawings. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the art without making creative work are within the scope of protection of the present application.

[0028] First of all, it should be noted that since the systems of different devices have different performances, the image processing program needs to be debugged according to the performance of each device system when applied to different devices, so that the image processing program can run smoothly in different devices. At present, the debugging process of image processing programs is mainly participated by humans, which may lead to human subjective deviation and take too long.

[0029] Based on this, the present application provides an adaptive resource optimization method based on an image processing program, an electronic device, and a computer-readable storage medium. For details, please refer to Figure 1 , Figure 1 It is a flowchart of an exemplary embodiment of the adaptive resource optimization method shown in the present application.

[0030] The execution subject of the adaptive resource optimization method may be a terminal device or a server or other processing device, wherein the terminal device may be a user equipment (UE), a computer, a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The execution subject of the adaptive resource optimization method may also be an adaptive resource optimization device. In some possible implementations, the adaptive resource optimization method may be implemented by a processor calling a computer-readable instruction stored in a memory.

[0031] Specifically, the adaptive resource optimization method of this embodiment includes the following steps:

[0032] S110: In the process of the current system running the image processing program, obtaining the running node running the image processing program in the current system and the current system resource utilization information.

[0033] The current system refers to the system where the image processing program is currently deployed. Since the operating capabilities and performance of each system are different, the current system needs to be debugged and optimized when the image processing program is first deployed to ensure that the image processing program can run smoothly in the current system. For example, the current system can be the system where the image processing program is first deployed, or it can be the system where the updated image processing program is debugged and optimized again after the image processing program is updated. There is no specific limitation here, and it is only necessary to take the system where the image processing program is being adapted as the current system.

[0034] The image processing program is used to analyze and modify images. After the system deploys the image processing program, it can use the functions of the image processing program to analyze and modify images.

[0035] An operation node generally refers to different functional modules in an image processing program. For example, in an image processing program, an image reading operation node, a grayscale conversion operation node, a feature extraction operation node, etc. may be included. Each operation node may be an independent image processing step, and when all operation nodes are connected, a complete image processing program is formed.

[0036] The current system resource utilization information refers to the utilization of the system resources of the current system when the current system is running the image processing program, wherein the system resources include the central processing unit (CPU), hardware resources and system memory, and the hardware resources include the neural processing unit (NPU). Before the current system runs the image processing program, the system administrator has pre-allocated system resources for the image processing program, and the image processing program runs within the pre-allocated system resource range.

[0037] The adaptive resource optimization device obtains the running nodes that execute various functions in the image processing program in the current system and the current system resource utilization information, including the central processing unit utilization information, the hardware resource utilization information and the system memory utilization information, during the process of the current system running the image processing program. In other embodiments, the adaptive resource optimization method is also applicable to other programs to be adapted, that is, the adaptive resource optimization device can also obtain the running nodes of other programs in the current system and the current system resource utilization information during the process of the current system running other programs. Among them, other programs can be audio processing programs, video processing programs, etc.

[0038] S120: Determine a target running node from each running node according to the node information of the running node.

[0039] The node information includes the running capacity, running time, amount of data to be run, amount of data that has been run, and thread-related information of the running node. Exemplarily, the node information of each running node can be obtained in real time during the running of the image processing program. As an example, the execution interface of each running node can be marked before and after, and the thread-related information of the running node can be counted to obtain the running time of each running node.

[0040] The target running node is also called the bottleneck running node, which can be obtained according to the node information of the running node. Exemplarily, the target running node can be one or more, and the number of target running nodes is not limited. The running node that takes the longest time among the running nodes can be used as the target running node; the running node with the largest amount of data to be run among the running nodes can also be used as the target running node. If a large number of data to be run appears too many times in the input queue of the running node, it means that the processing speed of the running node is not as fast as the processing speed of the upstream running node, and the processing time of the upstream running node is earlier than that of the running node.

[0041] The adaptive resource optimization device can select the running node with the longest running time as the target running node according to the running time of the running nodes, select the running node with the largest amount of data to be run as the target running node according to the amount of data to be run in the running node, or select the running nodes ranked in the top N according to the amount of data to be run in the running nodes as the target running nodes.

[0042] S130: In response to the current system resource utilization information satisfying the preset resource configuration information of the current system, a target optimization strategy is selected from at least two preset optimization strategies according to the current system resource utilization information.

[0043] The preset resource configuration information refers to the system resources pre-allocated to the image processing program by the system administrator. Exemplarily, the preset resource configuration information includes the preset utilization rate of the central processing unit, the preset utilization rate of the hardware resources, and the preset memory capacity. The image processing program can only run within the range of the preset utilization rate of the central processing unit, the preset utilization rate of the hardware resources, and the preset memory capacity.

[0044] The preset optimization strategy refers to the preset corresponding optimization strategy for different operating conditions. The purpose of optimization is to enable the image processing program to fully utilize the preset resource configuration information of the current system so that the image processing program can achieve the best performance in the current system. For example, the optimization strategy for the image processing program to fully utilize the central processing unit can be preset, and the optimization strategy for the image processing program to fully utilize the hardware resources can also be preset.

[0045] The target optimization strategy refers to an optimization strategy selected from preset optimization strategies according to the operating conditions. It should be noted that when running an image processing program, if multiple situations that need to be optimized occur at the same time, multiple target optimization strategies can be adopted for optimization processing. For example, when the current system runs an image processing program, if the current utilization rate of the central processing unit reaches the preset utilization rate and the current utilization rate of the hardware resources also reaches the preset utilization rate, the optimization strategy corresponding to the central processing unit and the optimization strategy corresponding to the hardware resources can be simultaneously adopted to optimize them.

[0046] When the current system resource utilization information satisfies the preset resource configuration information of the current system, the adaptive resource optimization device selects a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information.

[0047] S140: Optimizing the operation of the target operation node using the target optimization strategy.

[0048] After the adaptive resource optimization device determines the target running node from each running node according to the node information of the running node, the target running node is used as the bottleneck running node in the image processing program and is the running node with the running status deviation among the running nodes. The target running node is optimized with the target optimization strategy, and it can be directly judged whether the image processing program has achieved the best performance in the current system.

[0049] It can be seen that the adaptive resource optimization method of the embodiment of the present application obtains the running nodes of the image processing program in the current system and the current system resource utilization information during the process of the image processing program running in the current system; determines the target running node from each running node according to the node information of the running node; in response to the current system resource utilization information satisfying the preset resource configuration information of the current system, selects the target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information; and optimizes the operation of the target running node with the target optimization strategy. In this way, the image processing program is optimized by combining the system resource utilization information and the node information of the running node when the image processing program is running in the current system, and adaptive resource optimization is performed according to the current system resource utilization information and the node information, thereby improving the optimization efficiency of the image processing program.

[0050] Based on the above embodiments, the embodiments of the present application adopt Figure 2 The flowchart details how to optimize the operation of the target running node after the current CPU usage reaches the preset usage rate. Figure 2 , Figure 2 yes Figure 1The flowchart of an exemplary embodiment of step S130 in the adaptive resource optimization method is shown. Specifically, in response to the current system resource utilization information satisfying the preset resource configuration information of the current system, step S130 selects a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information, and further includes the following steps:

[0051] First of all, it should be noted that the current system resource utilization information includes the current utilization rate of the central processing unit, the preset resource configuration information includes the preset utilization rate of the central processing unit, and the preset optimization strategy includes the batch processing strategy of the target running node. Among them, the current utilization rate of the central processing unit refers to the central processing unit resources occupied by the image processing program when the current system is running. Exemplarily, the current utilization rate of the central processing unit can be obtained in real time by calling an operating system command.

[0052] S210: In response to the current usage rate of the central processing unit being greater than or equal to the preset usage rate of the central processing unit, determining the batch processing strategy of the corresponding target running node as the target optimization strategy according to the current usage rate of the central processing unit.

[0053] The batch processing strategy is to improve the efficiency of a single execution of the target running node by improving the batch processing capability of the target running node, reduce the number of executions, thereby reducing the idle waiting time of the central processing unit and improving the resource utilization of the central processing unit.

[0054] When the current utilization rate of the central processing unit is greater than or equal to the preset utilization rate of the central processing unit, the adaptive resource optimization device determines the batch processing strategy of the target operation node as the target optimization strategy, thereby improving the utilization rate of the central processing unit.

[0055] It should be noted that in actual applications, the current utilization rate of the CPU is not required to actually reach the preset utilization rate of the CPU. When the difference between the preset utilization rate of the CPU and the current utilization rate of the CPU is less than the preset value of the CPU, a batch processing strategy can be adopted, where the preset value of the CPU can be 0.01-0.1, etc.

[0056] S220: Optimizing the operation of the target operation node using the batch processing strategy of the target operation node.

[0057] When the current system runs the image processing program, the adaptive resource optimization device selects a batch processing strategy from the preset optimization strategy to optimize the operation of the target operation node when it obtains that the current usage rate of the central processing unit is greater than or equal to the preset usage rate of the central processing unit.

[0058] In other embodiments, in response to the current utilization rate of the CPU being greater than or equal to the preset utilization rate of the CPU, the priority allocation strategy of the corresponding target operation node is determined as the target optimization strategy according to the current utilization rate of the CPU; and the operation of the target operation node is optimized using the priority allocation strategy of the target operation node. The priority allocation strategy mainly refers to raising the priority of the target operation node so that the target operation node can be executed in advance and obtain a longer CPU time slice.

[0059] Specifically, the steps of the batch processing strategy of the target operation node include: obtaining the amount of operation data executed each time by the target operation node; increasing the amount of operation data executed each time by the target operation node according to the node information of the target operation node to obtain the target amount of operation data executed each time by the target operation node; and performing operation processing on the target operation node with the target amount of operation data executed each time. In this way, the amount of operation data executed each time by the target operation node is increased, the number of executions of the target operation node is reduced, and the utilization rate of the central processing unit is improved.

[0060] The node information of the target operation node includes the operation capability of the operation node. The amount of operation data is increased according to the operation capability of each target operation node. The target operation node with stronger operation capability increases the amount of operation data, and the target operation node with weaker operation capability increases less operation data. Therefore, combined with the operation capability of the operation node, the input operation data of the target operation node is synchronously combined, and multiple frames of operation data are packaged into a batch for scheduling and executing the operation node, that is, the execution of the operation node once inputs multiple frames of operation data, so that one scheduling execution can run and process multiple frames of operation data, improve processing efficiency and reduce additional scheduling overhead.

[0061] In other embodiments, the steps of the batch processing strategy of the target running nodes may also include: obtaining the amount of running data executed each time by each running node in the image processing program; increasing the amount of running data executed each time by the corresponding running node according to the node information of each running node to obtain the target running data amount executed each time by each running node; and performing running processing on the corresponding running node with the target running data amount executed each time.

[0062] In other embodiments, the adaptive resource optimization device may also randomly select some running nodes in the image processing program, and perform running processing on these running nodes using a batch processing strategy.

[0063] It can be seen that the adaptive resource optimization method of the embodiment of the present application responds to the current utilization rate of the central processing unit being greater than or equal to the preset utilization rate of the central processing unit, and determines the batch processing strategy of the corresponding target operation node as the target optimization strategy according to the current utilization rate of the central processing unit; and optimizes the operation of the target operation node according to the batch processing strategy of the target operation node. Thus, the batch processing strategy is determined as the target optimization strategy according to the current utilization rate of the central processing unit, which can improve the utilization rate of the central processing unit.

[0064] Based on the above embodiments, the embodiments of the present application adopt Figure 3 The flowchart details how to optimize the operation of the target running node after the current utilization rate of the hardware resources reaches the preset utilization rate. Figure 3 , Figure 3 yes Figure 1 A flowchart of another exemplary embodiment of step S130 in the adaptive resource optimization method is shown. Specifically, in response to the current system resource utilization information satisfying the preset resource configuration information of the current system, step S130 selects a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information, and further includes the following steps:

[0065] First of all, it should be noted that the current system resource utilization information includes the current utilization rate of hardware resources, the preset resource configuration information includes the preset utilization rate of hardware resources, and the preset optimization strategy includes the parallel processing strategy of the target running node. Among them, the current utilization rate of hardware resources refers to the hardware resources occupied by the image processing program when the current system is running. Exemplarily, the current utilization rate of hardware resources can be obtained in real time by calling operating system commands.

[0066] S310: In response to the current usage rate of the hardware resources being greater than or equal to the preset usage rate of the hardware resources, determining the parallel processing strategy of the corresponding target execution node as the target optimization strategy according to the current usage rate of the hardware resources.

[0067] The parallel processing strategy refers to loading the inference model used by the target running node as a high-batch inference model (high-batch inference model), improving the parallel processing capability of the inference model, assembling the input data in high batches, and improving the utilization of hardware resources.

[0068] When the current utilization rate of the hardware resources is greater than or equal to the preset utilization rate of the hardware resources, the adaptive resource optimization device determines the parallel processing strategy of the target operation node as the target optimization strategy, thereby improving the utilization rate of the hardware resources.

[0069] It should be noted that in actual applications, the current utilization rate of hardware resources is not required to actually reach the preset utilization rate of hardware resources. When the difference between the preset utilization rate of hardware resources and the current utilization rate of hardware resources is less than the preset value of hardware resources, a parallel processing strategy can be adopted, where the preset value of hardware resources can be 0.01-0.1, etc.

[0070] S320: Optimizing the operation of the target operation node using the parallel processing strategy of the target operation node.

[0071] When the current system runs the image processing program, the adaptive resource optimization device selects a parallel processing strategy from the preset optimization strategy to optimize the operation of the target operation node when it obtains that the current usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources.

[0072] In other embodiments, the adaptive resource optimization device determines the priority allocation policy of the corresponding target operating node as the target optimization policy in response to the current utilization rate of the hardware resources being greater than or equal to the preset utilization rate of the hardware resources according to the current utilization rate of the hardware resources; and performs operation optimization on the target operating node according to the priority allocation policy of the target operating node.

[0073] Specifically, the parallel processing strategy steps of the target operation node include: duplicating the target operation node to obtain at least two target operation nodes; grouping the data to be run of the target operation node according to the number of nodes of the target operation node; and performing operation processing on each group of data to be run by at least two target operation nodes. Thus, by increasing the number of target operation nodes to perform parallel processing on the data to be run, the processing capacity of the target operation node is improved.

[0074] The adaptive resource optimization device duplicating the target operation node can also be called multi-instance expansion of the target operation node, obtaining at least two identical target operation nodes, and the target operation node and the duplicated target operation node can be collectively referred to as multi-instance operation nodes. The number of target operation nodes refers to the total number of identical target operation nodes. The upstream operation data is used as the data to be run of the target operation node, and is evenly grouped according to the number of nodes of the target operation node, and each group of data to be run is respectively allocated to the multi-instance operation nodes for concurrent processing, so as to improve the processing capacity of the target operation node.

[0075] In some other embodiments, the parallel processing strategy step of the target operation node also includes: determining the number of copies of the target operation node according to the amount of data to be run of the target operation node and the operation capacity of the target operation node, and obtaining at least two target operation nodes; grouping the data to be run of the target operation node according to the number of nodes of the target operation node; and performing operation processing on each group of data to be run respectively with at least two target operation nodes. As an example, the ratio between the amount of data to be run of the target operation node and the maximum amount of data run at a single time of the target operation node can be determined as the number of copies of the target operation node.

[0076] It can be seen that the adaptive resource optimization method of the embodiment of the present application responds to the current utilization rate of the hardware resources being greater than or equal to the preset utilization rate of the hardware resources, and determines the parallel processing strategy of the corresponding target operation node as the target optimization strategy according to the current utilization rate of the hardware resources; and optimizes the operation of the target operation node with the parallel processing strategy of the target operation node. Thus, when the hardware resources are insufficient, the operation optimization is performed with the parallel processing strategy, which can ensure the efficient parallel operation of the system and improve the utilization rate of the hardware resources.

[0077] In combination with the above embodiments, when the current usage rate of the central processing unit is greater than or equal to the preset usage rate of the central processing unit, and the current usage rate of the hardware resources is less than the preset usage rate of the hardware resources, a batch processing strategy can be used to optimize the operation of the target operation node; when the current usage rate of the central processing unit is less than the preset usage rate of the central processing unit, and the current usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources, a parallel processing strategy can be used to optimize the operation of the target operation node; when the current usage rate of the central processing unit is greater than or equal to the preset usage rate of the central processing unit, and the current usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources, both the batch processing strategy and the parallel processing strategy can be used to optimize the operation of the target operation node.

[0078] Furthermore, in order to ensure that the image processing program runs with the best performance in the current system, the adaptive resource optimization device obtains the next system resource utilization information of the current system after resource optimization when running the image processing program, the next system resource utilization information includes the next usage rate of the central processing unit and / or the next usage rate of the hardware resources, and the acquisition time of the current system resource utilization information is earlier than the acquisition time of the next system resource utilization information; in response to the next usage rate of the central processing unit being greater than or equal to the preset usage rate of the central processing unit, and / or the next usage rate of the hardware resources being greater than or equal to the preset usage rate of the hardware resources, the current resource configuration information of the current system is obtained; and the image processing program is run and processed with the current resource configuration information of the current system. In this way, it is judged whether the corresponding system resources of the current system after resource optimization still reach the preset usage rate when running the image processing program, that is, the current system can no longer perform resource optimization and has reached the best performance, thereby ensuring that the current resource configuration information obtained is the best resource configuration information.

[0079] The current system after resource optimization refers to the current system after operation optimization with the target optimization strategy. The next system resource utilization information refers to the system resource utilization of the current system when the current system after resource optimization runs the image processing program, including the next utilization rate of the central processing unit, the next utilization rate of hardware resources and the system memory utilization rate.

[0080] It should be noted that the precondition of this embodiment is that the current usage rate of the CPU in the current system resource utilization information is greater than or equal to the preset usage rate of the CPU, and / or the current usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources. The precondition includes three situations, namely: the current usage rate of the CPU is greater than or equal to the preset usage rate of the CPU, and the current usage rate of the hardware resources is less than the preset usage rate of the hardware resources; the current usage rate of the CPU is less than the preset usage rate of the CPU, and the current usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources; the current usage rate of the CPU is greater than or equal to the preset usage rate of the CPU, and the current usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources.

[0081] When the current usage rate of the central processing unit is greater than or equal to the preset usage rate of the central processing unit, and / or the current usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources, the target operation node is optimized according to the current usage rate of the central processing unit and / or the current usage rate of the hardware resources to obtain the current system after resource optimization; the next system resource utilization information of the current system after resource optimization when running the image processing program is obtained. If the next usage rate of the central processing unit is greater than or equal to the preset usage rate of the central processing unit, and / or the next usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources. These include the following three situations: the next usage rate of the central processing unit is greater than or equal to the preset usage rate of the central processing unit, and the next usage rate of the hardware resources is less than the preset usage rate of the hardware resources; the next usage rate of the central processing unit is less than the preset usage rate of the central processing unit, and the next usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources; and the next usage rate of the central processing unit is greater than or equal to the preset usage rate of the central processing unit, and the next usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources.

[0082] If the next usage rate of the central processing unit is greater than or equal to the preset usage rate of the central processing unit, and / or the next usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources, then the current resource configuration information of the current system is obtained. The current resource configuration information refers to the resource configuration information after resource optimization. The current resource configuration information of the current system is used as the target resource configuration information of the image processing program, that is, it is determined that the current resource configuration information has achieved the best performance.

[0083] In other words, there are three criteria for judging whether the current system has achieved the best performance: first, the current memory utilization rate occupied by the current system running the image processing program has reached the preset memory capacity or has fallen by a certain range, which means that the current memory utilization rate has been limited, that is, it is impossible to tune the performance by means of parallel processing strategy or increasing the running node resource pool, that is, the current system has achieved the best performance; second, the current utilization rate of the hardware resources occupied by the current system running the image processing program has reached the preset utilization rate of the hardware resources or has fallen by a certain range, and it is judged whether it has been optimized according to the utilization rate of the hardware resources (using pre-processing scaling optimization, high batch model, etc.). If it has been optimized, the hardware resources have reached the final usage limit, and the current system has achieved the best performance; third, the current utilization rate of the central processing unit occupied by the current system running the image processing program has reached the preset utilization rate of the central processing unit or has fallen by a certain range, and it is judged whether the current system has been optimized according to the utilization rate of the central processing unit (batch processing strategy, reducing idle threads, etc.). If it has been optimized, it means that the resources of the central processing unit have reached the final usage limit, and the current system has also reached the highest throughput performance, and the optimization has been completed, and the best performance has been achieved.

[0084] Based on the above embodiments, the embodiments of the present application adopt Figure 4 and Figure 5 The flowchart details how to optimize the operation of the target operation node when the system resources are sufficient. Figure 4 yes Figure 1 A flowchart of another exemplary embodiment of step S130 in the adaptive resource optimization method is shown; Figure 5 yes Figure 1 A flowchart of another exemplary embodiment of step S130 in the adaptive resource optimization method is shown.

[0085] As an example, see Figure 4 , the target running nodes include the running nodes whose running time reaches the time threshold, the current system resource utilization information includes the current utilization rate of the central processing unit, the current utilization rate of the hardware resources and the current memory utilization rate, the preset resource configuration information of the current system includes the preset utilization rate of the central processing unit, the preset utilization rate of the hardware resources and the preset memory capacity, and the preset optimization strategy includes the resource allocation strategy and the priority allocation strategy.

[0086] The target running node includes a running node whose running time reaches a time threshold. Exemplarily, the running node with the longest running time can be used as the target running node.

[0087] The resource allocation strategy refers to a strategy for allocating system resources to each operating node according to the node information of each operating node. Exemplarily, when the target optimization strategy of the target operating node is the resource allocation strategy, the resource pool ratio of the target operating node is adjusted to increase, that is, more resources are allocated to operate the target operating node.

[0088] The priority allocation strategy refers to a strategy for adjusting the priority of each running node according to the node information of each running node. Exemplarily, when the target optimization strategy of the target running node is the priority allocation strategy, the priority of the target running node is adjusted, including increasing the priority of the target running node.

[0089] S410: In response to the current usage rate of the central processing unit being less than the preset usage rate of the central processing unit, the current usage rate of the hardware resources being less than the current usage rate of the hardware resources, and the current memory usage rate being less than the preset memory capacity, the number of active yields and / or the number of passive preemptions are obtained, the number of active yields represents the number of times the thread of the target running node actively yields the running, and the number of passive preemptions represents the number of times the thread of the target running node is preempted by other running terminals.

[0090] The number of active yields refers to the number of times the thread running the target running node actively yields the CPU control right. For example, when the target running node is suspended, the thread will actively yield the CPU control right; or when the resources of the target running node are insufficient, the thread will actively yield the CPU control right while waiting for resource recovery.

[0091] Passive preemption times refer to the number of times that the executing thread is forced to suspend execution, allowing another thread to obtain CPU control to run. Exemplarily, when threads of other running ends with a higher priority than the target running node become runnable, the thread of the target running node will be preempted so that the high-priority thread can be executed immediately.

[0092] The adaptive resource optimization device counts the running time of each running node and takes the running node with the longest running time among the running nodes as the target running node; if the current utilization rate of the central processing unit is less than the preset utilization rate of the central processing unit, the current utilization rate of the hardware resources is less than the current utilization rate of the hardware resources, and the current memory utilization rate is less than the preset memory capacity, then the number of times the thread of the running target running node actively gives up the CPU control right and the number of times the thread passively seizes the CPU control right is obtained.

[0093] S420: In response to the number of active yielding being greater than the preset yielding number, determining the resource allocation strategy of the target running node as the target optimization strategy.

[0094] The preset yield times can be preset based on experience. If the number of times the thread running the target running node actively yields is greater than the preset yield times, it may be due to a shortage of resources inside the target running node, and the situation of waiting for resource recovery often occurs. Therefore, the resource allocation strategy of the target running node can be determined as the target optimization strategy.

[0095] In other embodiments, the reason why the number of active yields of the thread running the target running node is greater than the preset yield number may be that the central processor has an unnecessary yield problem with the thread yield strategy. In this case, the yield strategy can be adjusted as the target optimization strategy. For example, an appropriate delay or conditional yield can be added in the loop.

[0096] S430: In response to the passive preemption number being greater than the preset preemption number, determining the priority allocation strategy of the target running node as the target optimization strategy.

[0097] The preset preemption times can be preset based on experience. The reason why the number of passive preemption times of the thread running the target running node is greater than the preset preemption times may be that the thread priority of other running terminals is higher than the thread priority of the target running node, causing the thread of the target running node to passively give up the CPU control to the high-priority thread. At this time, the priority allocation strategy of the target running node can be determined as the target optimization strategy, thereby improving the priority of the running target running node.

[0098] In other embodiments, when the number of passive preemption times of threads running the target running node is greater than the preset number of preemption times, the number of threads can be increased, the number of threads can be reasonably planned, and the thread pool can be used to reduce the number of thread preemptions.

[0099] As another example, the target running node includes a running node whose amount of data to be run is greater than the preset running data amount, the current system resource utilization information includes the current utilization rate of the central processing unit, the current utilization rate of the hardware resources, and the current memory utilization rate, the preset resource configuration information of the current system includes the preset utilization rate of the central processing unit, the preset utilization rate of the hardware resources, and the preset memory capacity, and the preset optimization strategy includes a parallel processing strategy. Among them, the target running node includes a running node whose amount of data to be run is greater than the preset running data amount. Exemplarily, the running node with the largest amount of accumulated data to be run can be used as the target running node.

[0100] S510: In response to the current usage of the CPU being less than the preset usage of the CPU, the current usage of the hardware resources being less than the current usage of the hardware resources, and the current memory usage being less than the preset memory capacity, the parallel processing strategy of the target running node is used as the target optimization strategy.

[0101] When the current system is running an image processing program, the adaptive resource optimization device actually obtains the amount of data to be run in the input queue of each running node, and takes the running node with the largest amount of data to be run as the target running node; when the current utilization rate of the central processing unit is less than the preset utilization rate of the central processing unit, the current utilization rate of the hardware resources is less than the current utilization rate of the hardware resources, and the current memory utilization rate is less than the preset memory capacity, the parallel processing strategy is used as the target optimization strategy for the target running node with the largest amount of data to be run.

[0102] As another example, the adaptive resource optimization device actually obtains the idle time and running time of each thread in the thread pool of the image processing program during the process of the current system running the image processing program; determines the ratio between the idle time and running time of the thread as the actual usage rate of the thread; if the actual usage rate of the thread is greater than or equal to the preset usage rate of the thread, dynamically reduces the number of threads in the thread pool to release more resources and reduce thread switching overhead; if the actual usage rate of the thread is less than the preset usage rate of the thread, dynamically increases the number of threads in the thread pool to ensure that each running node in the image processing program can perform the highest parallel operation.

[0103] As another example, during the process of the current system running the image processing program, the adaptive resource optimization device actually obtains the number of tasks in the task queue to be scheduled for execution of the image processing program thread pool and the waiting time of each task; if the time when the number of tasks is greater than the preset number of tasks is greater than the preset time threshold or the waiting time of the task is greater than the preset waiting time, the number of threads in the thread pool is dynamically increased. Among them, the task can be a running node to be executed by a thread; the waiting time of a task is the time from joining the task queue to the time when the task is acquired and executed by the thread. When the time when the number of tasks is greater than the preset number of tasks is greater than the preset time threshold or the waiting time of the task is greater than the preset waiting time, it means that there are many ready tasks that cannot be acquired and executed by the working thread in a timely manner.

[0104] In order to elaborate on the adaptive resource optimization method of the present application, Figure 6 The flowchart shown further illustrates it, and the details are as follows:

[0105] When the image processing program is adapted and optimized in the current system, it is first necessary to obtain the preset resource configuration information allocated by the current system to the image processing program, including the preset utilization rate of the central processing unit, the preset utilization rate of the hardware resources and the preset memory capacity, where the preset utilization rate of the central processing unit can be the upper limit of the utilization rate that can be used by the central processing unit, the preset utilization rate of the hardware resources can be the upper limit of the utilization rate that can be used by the hardware resources, and the preset memory capacity can be the upper limit of the available memory.

[0106] Secondly, the performance bottleneck analysis of the solution is carried out. The target running node can be determined from each running node according to the node information of the running node. The target running node is the bottleneck point of the current system running the image processing program. The running node with the longest running time and the largest amount of data to be run can be used as the target running node; then the system resource acquisition analysis is carried out, including the current utilization rate of the central processing unit, the current utilization rate of hardware resources and the current utilization rate of memory.

[0107] If the CPU reaches the threshold, that is, the current utilization rate of the central processing unit is greater than or equal to the preset utilization rate of the central processing unit, the batch processing capacity of the running node is improved, and the amount of running data executed each time by the target running node is increased.

[0108] If the NPU in the hardware resources reaches the threshold, that is, the current utilization rate of the hardware resources is greater than the preset utilization rate of the hardware resources, high-batch inference calculations are performed, and multi-batch inference calculations are performed using the high-batch model. The target running node is switched to load the high-batch model, and the input running data is batch assembled to improve the utilization efficiency of hardware resources.

[0109] If the system resources are sufficient, the optimization configuration is adjusted to solve the performance bottleneck. Sufficient system resources means that the current usage rate of the central processing unit is less than the preset usage rate of the central processing unit, the current usage rate of the hardware resources is less than the current usage rate of the hardware resources, and the current memory usage rate is less than the preset memory capacity. The solution includes: performing thread analysis on the target running node with the longest running time. If the number of times the thread actively gives up is greater than the preset number of times, the resource allocation strategy of the target running node is determined as the target optimization strategy; if the number of times the thread passively preempts is greater than the preset number of times, the priority allocation strategy of the target running node is determined as the target optimization strategy; and adopting a parallel processing strategy for the target running node with the largest amount of running data.

[0110] Finally, it is determined whether the image processing program has reached the best performance. If it has reached the best performance, the configuration details are output and saved, that is, the current system configuration information of the current system is used as the target system configuration information of the image processing program; if it has not reached the best performance, the image processing program is run with the current system after resource optimization, and the above process is repeated. Among them, the judgment criteria for the best performance include: whether the current memory usage rate reaches the preset memory capacity, if it reaches, it means that the best performance has been achieved; and / or, if the current usage rate of the central processing unit is greater than or equal to the preset usage rate of the central processing unit, it is determined whether the central processing unit has been optimized, if it has been optimized, it means that the central processing unit resources have reached the final usage limit, the overall solution has also reached the highest throughput performance, and the optimization has been completed; and / or, if the current usage rate of the hardware resources is greater than or equal to the preset usage rate of the hardware resources, it is determined whether the hardware resources have been optimized, if it has been optimized, it means that the hardware resources have reached the final usage limit, if the target running node is still using the running node of the hardware resources, it means that the optimization has been completed and the best performance has been achieved.

[0111] See also Figure 7 , Figure 7It is a structural diagram of an exemplary embodiment of the adaptive resource optimization device shown in the present application. The adaptive resource optimization device 700 includes an acquisition module 710, a determination module 720, a selection module 730 and an optimization module 740. The acquisition module 710 is used to obtain the running nodes running the image processing program in the current system and the current system resource utilization information during the process of the current system running the image processing program; the determination module 720 is used to determine the target running node from each running node according to the node information of the running node; the selection module 730 is used to select the target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information in response to the current system resource utilization information satisfying the preset resource configuration information of the current system; the optimization module 740 is used to optimize the operation of the target running node with the target optimization strategy.

[0112] In the above scheme, the adaptive resource optimization device obtains the running nodes of the image processing program in the current system and the current system resource utilization information during the process of the image processing program running in the current system; determines the target running node from each running node according to the node information of the running node; in response to the current system resource utilization information satisfying the preset resource configuration information of the current system, selects the target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information; and optimizes the operation of the target running node with the target optimization strategy. In this way, the image processing program is optimized by combining the system resource utilization information and the node information of the running node when the image processing program is running in the current system, avoiding the subjectivity and deviation of manual optimization, and greatly reducing the manpower cost and time cost of adapting and optimizing the image processing program in different systems.

[0113] The functions of each module can be found in the embodiment of the adaptive resource optimization method, which will not be described again here.

[0114] In order to implement the adaptive resource optimization method of the above embodiment, the present application proposes another electronic device, which is specifically referred to as Figure 8 , Figure 8 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application.

[0115] The electronic device 800 includes a memory 810 and a processor 820 , wherein the memory 810 and the processor 820 are coupled.

[0116] The memory 810 is used to store program data, and the processor 820 is used to execute the program data to implement the adaptive resource optimization method of the above embodiment.

[0117] In this embodiment, the processor 820 may also be referred to as a CPU (Central Processing Unit). The processor 820 may be an integrated circuit chip having signal processing capabilities. The processor 820 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 820 may also be any conventional processor, etc.

[0118] The present application also provides a computer-readable storage medium, such as Fig. 9 As shown, the computer-readable storage medium 900 is used to store program data 910. When the program data 910 is executed by the processor, it is used to implement the adaptive resource optimization method in the method embodiment of the present application.

[0119] The method involved in the embodiment of the adaptive resource optimization method of the present application, when implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a device, such as a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0120] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. An adaptive resource optimization method based on an image processing program, characterized in that: The method comprises: In the process of the current system running the image processing program, obtaining the running node running the image processing program in the current system and the current system resource utilization information; Determine a target running node from each running node according to the node information of the running node; In response to the current system resource utilization information satisfying the preset resource configuration information of the current system, selecting a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information; Performing operation optimization on the target operation node using the target optimization strategy; The current system resource utilization information includes the current utilization rate of the central processing unit, the preset resource configuration information includes the preset utilization rate of the central processing unit, and the preset optimization strategy includes the batch processing strategy of the target operation node; The step of selecting a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information in response to the current system resource utilization information satisfying the preset resource configuration information of the current system includes: In response to the current usage rate of the central processing unit being greater than or equal to the preset usage rate of the central processing unit, determining the batch processing strategy of the corresponding target operation node as the target optimization strategy according to the current usage rate of the central processing unit; The step of performing operation optimization on the target operation node using the target optimization strategy includes: Performing operation optimization on the target operation node using the batch processing strategy of the target operation node; The step of optimizing the operation of the target operation node using the batch processing strategy of the target operation node includes: Obtaining the amount of running data each time the target running node is executed; According to the node information of the target running node, the running data volume of each execution of the target running node is increased to obtain the target running data volume of each execution of the target running node; The target operation node is operated and processed by executing the target operation data volume each time.

2. The adaptive resource optimization method according to claim 1, characterized in that: The current system resource utilization information includes the current utilization rate of the hardware resources, the preset resource configuration information includes the preset utilization rate of the hardware resources, and the preset optimization strategy includes the parallel processing strategy of the target running node; The step of selecting a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information in response to the current system resource utilization information satisfying the preset resource configuration information of the current system includes: In response to the current usage rate of the hardware resource being greater than or equal to the preset usage rate of the hardware resource, determining the parallel processing strategy of the corresponding target running node as the target optimization strategy according to the current usage rate of the hardware resource; The step of performing operation optimization on the target operation node using the target optimization strategy includes: The target operation node is optimized by using the parallel processing strategy of the target operation node.

3. The adaptive resource optimization method according to claim 2, characterized in that: The step of optimizing the operation of the target operation node using the parallel processing strategy of the target operation node comprises: Duplicating the target running node to obtain at least two target running nodes; Grouping and processing the to-be-run data of the target running node according to the number of nodes of the target running node; At least two of the target running nodes respectively perform running processing on each group of data to be run.

4. The adaptive resource optimization method according to any one of claims 1 to 3, characterized in that: The adaptive resource optimization method further includes: Acquire the next system resource utilization information of the current system after resource optimization when running the image processing program, wherein the next system resource utilization information includes the next utilization rate of the central processing unit and / or the next utilization rate of the hardware resources, and the acquisition time of the current system resource utilization information is earlier than the acquisition time of the next system resource utilization information; In response to the next usage rate of the central processing unit being greater than or equal to the preset usage rate of the central processing unit, and / or the next usage rate of the hardware resource being greater than or equal to the preset usage rate of the hardware resource, obtaining current resource configuration information of the current system; The image processing program is run using the current resource configuration information of the current system.

5. The adaptive resource optimization method according to claim 1, characterized in that: The target running node includes a running node whose running time reaches a time threshold, the current system resource utilization information includes a current utilization rate of a central processing unit, a current utilization rate of hardware resources, and a current memory utilization rate, the preset resource configuration information of the current system includes a preset utilization rate of the central processing unit, a preset utilization rate of the hardware resources, and a preset memory capacity, and the preset optimization strategy includes a resource allocation strategy and a priority allocation strategy; The step of selecting a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information in response to the current system resource utilization information satisfying the preset resource configuration information of the current system includes: In response to the current usage rate of the central processing unit being less than the preset usage rate of the central processing unit, the current usage rate of the hardware resources being less than the current usage rate of the hardware resources, and the current memory usage rate being less than the preset memory capacity, the number of active yields and / or the number of passive preemptions are acquired, wherein the number of active yields represents the number of times the thread running the target running node actively yields to run, and the number of passive preemptions represents the number of times the thread running the target running node is preempted by other running terminals; In response to the active yielding times being greater than the preset yielding times, the resource allocation strategy of the target operating node is determined as the target optimization strategy, the resource allocation strategy including adjusting and increasing the resource pool ratio of the target operating node; and / or, In response to the passive preemption number being greater than the preset preemption number, the priority allocation strategy of the target running node is determined as the target optimization strategy, and the priority allocation strategy includes increasing the priority of the target running node.

6. The adaptive resource optimization method according to claim 1, characterized in that: The target running node includes a running node whose amount of data to be run is greater than a preset running data amount, the current system resource utilization information includes a current utilization rate of a central processing unit, a current utilization rate of hardware resources, and a current memory utilization rate, the preset resource configuration information of the current system includes a preset utilization rate of the central processing unit, a preset utilization rate of the hardware resources, and a preset memory capacity, and the preset optimization strategy includes a parallel processing strategy; The step of selecting a target optimization strategy from at least two preset optimization strategies according to the current system resource utilization information in response to the current system resource utilization information satisfying the preset resource configuration information of the current system includes: In response to the current usage of the central processing unit being less than the preset usage of the central processing unit, the current usage of the hardware resources being less than the current usage of the hardware resources, and the current memory usage being less than the preset memory capacity, the parallel processing strategy of the target running node is used as the target optimization strategy.

7. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores program instructions, and the processor retrieves the program instructions from the memory to execute the adaptive resource optimization method based on the image processing program as described in any one of claims 1-6.

8. A computer-readable storage medium, characterized in that: include: Program data is stored, and when the program data is executed by a processor, it is used to implement the adaptive resource optimization method based on the image processing program as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Resource adjustment method and device, equipment and storage medium

    CN115756808A

  • Load adjusting method and terminal equipment

    CN117632460A