Algorithm and equipment adaptation method and device, electronic equipment and medium
By reasonably configuring and scheduling the algorithms in the intelligent algorithm server based on the actual computing power consumption of each model and the available computing power of the equipment, the problem of how to meet different scenarios and customer needs under limited hardware resources is solved, and resource utilization and processing efficiency are improved.
Patent Information
- Application Number
- CN202411757508.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-25
AI Technical Summary
In an intelligent algorithm server, how to reasonably configure and schedule algorithms under limited hardware resources to meet the needs of different scenarios and customers, improve resource utilization, and reduce resource waste.
By accurately determining the required computing power of the target model when executing a single time on the target device based on the actual computing power consumption of each model and the available computing power of the equipment, and determining the target algorithm in the target task assigned to be performed on the target device based on the total actual computing power of each target model during the execution of each target task.
It realizes the rational and accurate configuration of algorithms and equipment under limited hardware resources, improves resource utilization and task processing efficiency, and avoids resource waste.
Smart Images

Figure CN119690661A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an algorithm and device adaptation method, apparatus, electronic device and medium. Background Art
[0002] In many fields such as modern industry, security monitoring, and intelligent transportation, intelligent algorithm servers undertake a large number of data processing and intelligent detection tasks, such as portrait recognition, helmet detection, open flame detection, and smoke detection. The computing power of these intelligent detection tasks often changes according to the model optimization, product model, and version used. Users need to reasonably configure intelligent tasks according to the computing power to ensure response speed and accuracy. Different types of intelligent algorithms have different requirements for computing resources. In addition, with the continuous updating and optimization of algorithms, the old version of the algorithm model may require more computing power, while the new version may be relatively "lightweight". At the same time, different customers may have different requirements and priorities for algorithms. Some may pay more attention to the accuracy of portrait recognition, while others may pay more attention to the real-time recognition of abnormal events. Therefore, how to reasonably configure and schedule algorithms under limited hardware resources to meet the needs of different scenarios and customers, while improving resource utilization and reducing resource waste, has become an urgent problem to be solved. Summary of the invention
[0003] The embodiments of the present application provide an algorithm and device adaptation method, apparatus, electronic device and medium to improve resource utilization by accurately configuring the algorithm and the device according to the actual computing power consumption of each model and the available computing power of the device.
[0004] According to one aspect of the present application, a method for adapting an algorithm to a device is provided, the method comprising:
[0005] Determine the computing power required for a single execution of the target model on the target device;
[0006] For a target task executed on the target device, if there is a target algorithm in the target task that adopts the target model, the required computing power is used as the actual consumed computing power of the target model in the process of executing the target task;
[0007] For each target task executed on the target device, the target algorithm in the target task to be executed on the target device is determined according to the total actual consumed computing power of each target model during the execution of each target task and the available computing power of the target device.
[0008] According to one aspect of the present application, an algorithm and device adaptation device is provided, the device comprising:
[0009] an actual consumed computing power determination module, for a target task executed on the target device, if a target algorithm in the target task adopts the target model, then using the required computing power as the actual consumed computing power of the target model in the process of executing the target task;
[0010] The target algorithm allocation module is used to determine the target algorithm in the target task to be allocated for execution on the target device for each target task executed on the target device according to the total actual consumed computing power of each target model during the execution of each target task and the available computing power of the target device.
[0011] According to another aspect of the present application, an electronic device is provided, the electronic device comprising:
[0012] at least one processor; and
[0013] A memory coupled to at least one processor algorithm and device adapter; wherein,
[0014] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the algorithm and device adaptation method of any embodiment of the present application.
[0015] According to another aspect of the present application, a computer-readable storage medium is provided, which stores computer instructions, and the computer instructions are used to implement the algorithm and device adaptation method of any embodiment of the present application when executed by a processor.
[0016] The technical solution of the embodiment of the present application determines the required computing power when the target model is executed once on the target device; for the target task executed on the target device, if there is a target algorithm in the target task that adopts the target model, the required computing power is used as the actual computing power consumed by the target model during the execution of the target task; for each target task executed on the target device, according to the total actual computing power consumed by each target model during the execution of each target task, and the available computing power of the target device, the target algorithm in the target task allocated for execution on the target device is determined. The above scheme can deduct computing power only once for models reused by different algorithms, and combined with the available computing power of the device, it can configure algorithms and devices more reasonably and accurately under limited hardware resources, thereby improving resource utilization and task processing efficiency.
[0017] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0019] Figure 1 A flowchart of an algorithm and device adaptation method provided in an embodiment of the present application;
[0020] Figure 2 A flowchart of an algorithm and device adaptation method provided by another embodiment of the present application;
[0021] Figure 3 A flowchart of an algorithm and device adaptation method provided in another embodiment of the present application;
[0022] Figure 4 This is a flowchart of the operation of the intelligent algorithm computing tool in another embodiment of the present application;
[0023] Figure 5 This is a schematic diagram of the structure of an intelligent algorithm computing tool in another embodiment of the present application;
[0024] Figure 6 A schematic diagram of the structure of an algorithm and device adaptation device provided in an embodiment of the present application;
[0025] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution 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. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first", "second", "third", "fourth", "actual", "preset", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] Figure 1 The flowchart of an algorithm and device adaptation method provided in the embodiment of the present application is applicable to the case of adapting an algorithm and a device. The method can be executed by an algorithm and device adaptation device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0029] S110, determining the required computing power of a target model when it is executed once on a target device.
[0030] Among them, the target model is a model that can obtain certain inference data by running calculations, such as obtaining inference data for safety construction detection in construction sites, obtaining inference data for fire emergency safety detection, and obtaining inference data for bright kitchen and stove safety detection. The target model includes input layer, convolution layer, pooling layer, fully connected layer, activation function, loss function, optimizer, data processing, iteration and other parts. The output layer of the target model depends on the task complexity, task label and other parts. Different businesses require different inference data, and different post-processing steps are required to process the inference data to obtain detection results. For example, to realize the tripwire population counting and regional population counting detection in a certain scenario, the common target model is the head and shoulder model class, and the model inference data is further processed according to business needs to obtain specific detection results. The target device can be a device that can execute the target model to realize task processing. The required computing power can be the computing power required by the target device to execute the target model on the target device, reflecting the consumption of target device resources.
[0031] For example, for each target model, the required computing power for a single execution of the target model on the target device can be determined, that is, the computing power required for a single execution of the target model on the target device, which can be determined in advance based on actual experience. The required computing power for a single execution of the target model may be different under different conditions, and the required computing power needs to be determined when other conditions are consistent.
[0032] In the embodiment of the present application, determining the required computing power of a target model when it is executed once on a target device includes:
[0033] Determining device performance data of the target device, a software running version in the target device, and a data volume of data to be processed;
[0034] Based on the predetermined relationship between device performance data, software running version, the amount of data to be processed and the required computing power, the computing power corresponding to the performance data of the target device, the running version of the software in the target device and the amount of data to be processed is determined as the required computing power when the target model is executed once on the target device.
[0035] Exemplarily, the correlation between device performance data, software running version, amount of data to be processed, and required computing power can be determined in advance. Taking the case where the data to be processed is video data, the correlation is shown in Table 1.
[0036] Table 1
[0037]
[0038]
[0039] As shown in Table 1, the device performance data, software running version, and the amount of data to be processed all affect the size of the required computing power. The device performance data of different target devices are different, and the required computing power when executing the target model may be different under the same other conditions. The software running versions of the software installed on the device are different, and the required computing power when executing the target model under the same other conditions may be different. Under the same other conditions, if the data to be processed is video data, the required computing power is generally positively correlated with the video resolution. It can be seen from Table 1 that when the device performance data and the software running version are the same, the larger the amount of data to be processed, that is, the higher the video resolution, the greater the required computing power. When the device performance data and the amount of data to be processed are the same, the required computing power corresponding to the software running version V2.0 is less than the required computing power corresponding to V1.0.
[0040] For example, in actual application, the device performance data of the target device, the software running version in the target device, and the amount of data to be processed can be determined, and the above data can be compared with the data in the association relationship to determine the required computing power for a single run of the target model on the target device.
[0041] In the embodiment of the present application, the process of determining the target model includes:
[0042] The target model and the business processing module used by the target algorithm are determined according to the function set to which the target algorithm belongs and the internal processing logic; wherein the target model and the business processing module are cascaded to realize the target algorithm identification process.
[0043] For the same model type detection business, the entire target algorithm detection process needs to be composed of a public model reasoning library and a business processing library, that is, the target model and the business processing module need to be cascaded to implement the entire detection process. The target model is used to detect and obtain objective reasoning data. The business processing model post-processes the reasoning data output by the target model according to specific business needs to obtain the final result. The target model and business processing model used by the target algorithm can be determined based on the function set and internal processing logic to which the target algorithm belongs.
[0044] For example: Head-and-shoulder model algorithms: regional intrusion, tripwire population counting, regional population counting, regional population anomaly, personnel stay, personnel gathering, etc. all belong to the head-and-shoulder detection category, and share the same target model, namely the head-and-shoulder model, and distinguish the specific detection results through post-processing steps based on the inference data; Machine-not-human model algorithms: regional entry (machine-not-human), regional exit (machine-not-human), etc. all belong to the machine-not-human detection category, and share the same target model, namely the machine-not-human model, and distinguish the specific detection results through post-processing steps based on the inference data.
[0045] S120. For a target task executed on the target device, if there is a target algorithm in the target task that adopts the target model, the required computing power is used as the actual consumed computing power of the target model in the process of executing the target task.
[0046] Among them, the target task is the task that needs to be executed, such as the analysis task of the video collected by the image collector, which can specifically include the detection task in the construction site, the detection task in the community, the detection task of indoor fire, the detection task of personnel in special places, etc. The target algorithm is the algorithm that needs to be used in the process of executing the target task, for example, the worker safety construction algorithm, equipment safety detection algorithm, site safety detection algorithm, etc. are needed in the task of the construction site scene.
[0047] The public model inference library is dynamically loaded to ensure the reuse of each model library, input data is only inferred once, and resources are only loaded once. The inference data is pushed into the business processing module, and each detection business has a separate post-processing library to process the business logic.
[0048] In an embodiment of the present application, when adapting the target device and the target algorithm allowed to be implemented on the target device, it is necessary to consider the computing power actually consumed by the target model adopted by the target algorithm. In an embodiment of the present application, in a target task, for a target model that is adopted by at least two target computing powers, the computing power required for a single execution of the target model on the target device is used as the actual computing power consumed for executing the target model in the target task, that is, in the process of executing the target task, no matter how many target computing powers adopt the target model, the computing power is deducted once, and the computing power required for a single execution of the target model on the target device is used as the actual computing power consumed. For other target models that are not reused, that is, target models that are only adopted by one target algorithm, the computing power required for a single execution of the target model on the target device is also used as the actual computing power consumed by the target model during the execution of the target task.
[0049] The above scheme can realize the target model that reuses multiple algorithms in the same target task by deducting computing power only once, thereby more accurately determining the actual computing power consumed by the target model during the actual execution process, avoiding repeated deductions of reused target computing power, resulting in unreasonable results of algorithm and device adaptation based on deducted computing power, and causing problems of unreasonable resource utilization.
[0050] S130. For each target task executed on the target device, determine the target algorithm in the target task to be allocated for execution on the target device according to the total actual consumed computing power of each target model during the execution of each target task and the available computing power of the target device.
[0051] Exemplarily, there may be one or more target tasks executed on the target device. For each target task executed on the same target device, the actual computing power consumed by each target model used in executing the target task can be calculated separately, and the actual computing power consumed corresponding to each target task can be added up to obtain the total actual computing power consumed by all target models executing all target tasks on the target device. According to the available computing power and the total actual computing power consumed by the target device, the target algorithm in the target task to be executed on the target device is determined, that is, which algorithms can be executed on the target device and the number of algorithms that can be executed.
[0052] The technical solution of the embodiment of the present application determines the required computing power when the target model is executed once on the target device; for the target task executed on the target device, if there is a target algorithm in the target task that adopts the target model, the required computing power is used as the actual computing power consumed by the target model during the execution of the target task; for each target task executed on the target device, according to the total actual computing power consumed by each target model during the execution of each target task, and the available computing power of the target device, the target algorithm in the target task allocated for execution on the target device is determined. The above scheme can deduct computing power only once for models reused by different algorithms, and combined with the available computing power of the device, it can configure algorithms and devices more reasonably and accurately under limited hardware resources, thereby improving resource utilization and task processing efficiency.
[0053] Figure 2 This is a flowchart of an algorithm and device adaptation method provided in another embodiment of the present application. The present embodiment is optimized based on the above embodiment. For solutions not described in detail in the present embodiment, please refer to the above embodiment. Figure 2 As shown, the method of the embodiment of the present application specifically includes the following steps:
[0054] S210: Determine the required computing power for a single execution of the target model on the target device.
[0055] S220. For a target task executed on the target device, if there is a target algorithm in the target task that adopts the target model, the required computing power is used as the actual consumed computing power of the target model in the process of executing the target task.
[0056] S230: Make the total actual consumed computing power less than or equal to the available computing power.
[0057] For example, in order for the target device to be able to process the configured target algorithm normally, it is necessary to constrain the total actual computing power consumed by the target model used by each algorithm in processing each target task to be less than or equal to the available computing power of the target device, so that the target device can support the processing of the assigned target algorithm in terms of performance.
[0058] S240: Make the number of algorithms corresponding to the target model less than or equal to the total number of algorithms allowed to be executed on the target device.
[0059] For example, the total number of algorithms allowed to be executed on the target device may be limited due to factors such as the performance of the target device and the software version. In addition, there may be a user's preset condition, that is, there is a limit on the total number of algorithms allowed to be executed on the target device. By formulating the constraint condition, the number of algorithms operated using the target model is less than or equal to the total number of algorithms allowed to be executed on the target device.
[0060] S250: Solve the target algorithm in the target task that is assigned to be executed on the target device.
[0061] Exemplarily, in the above-mentioned constraint process, the above-mentioned constraint conditions are represented by setting unknown quantities in the target algorithm of the target module used in each target task, and then the target algorithm in the target task assigned to be executed on the target device is obtained by solving the unknown quantities, including which target algorithm corresponding to which target model is specifically adapted for the target device.
[0062] In the embodiment of the present application, making the total actual consumed computing power less than or equal to the available computing power includes:
[0063] The first constraint is determined according to the following formula:
[0064]
[0065] Among them, D k is the actual computing power consumed by the k-th target model, y ik Indicates whether the target algorithm adopts the kth target model in the i-th target task. If yes, it is the first value; if not, it is the second value. The first value and the second value are adjacent integers. ik The constraint formula is: the first value ≤ y ik ≤ the second value, and is an integer; K is the total number of target models, n is the number of target tasks, D 目标设备 is the available computing power of the target device. The second value can be 1, and the first value can be 0. In the first constraint, no matter how many target algorithms the target model k is adopted by, y ik If both are 1, then D k y ik It means that for the target model k, no matter how many target algorithms use it, the computing power is the actual computing power consumed by the target model k, that is, the computing power required for a single execution on the target device. The computing power of the reused target model is deducted only once.
[0066] The number of algorithms using the target model is set to be less than or equal to the total number of algorithms allowed to be executed on the target device, including:
[0067] The second constraint is determined according to the following formula:
[0068]
[0069] Among them, x ijk Indicates whether the target model k is adopted by the jth algorithm in the i-th target task. If yes, it is the third value; if not, it is the fourth value. The third and fourth values are adjacent integers.ijk The constraint formula is: The third value ≤ x ijk ≤ the fourth value, which is an integer; m k is the number of target algorithms that can use target model k in a target task; c k is the preset number of target algorithms that are allowed to use target model k in a target task; In fact, it means the number of target algorithms that use the target model k. k y ik Indicates the total number of target algorithms that can adopt target model k if at least one target algorithm adopts the target model k. k Indicates the number of target algorithms preset by the user that are allowed to use target model k in a target task.
[0070] Solving a target algorithm in the target task assigned for execution on the target device includes:
[0071] The number of target algorithms supported by the target device is expressed based on the following formula:
[0072]
[0073] The maximum value of the target algorithm quantity based on the first constraint condition and the second constraint condition is x. ijk To solve. The maximum solution reflects which algorithms and models are configured on the target device to execute which target tasks and adopt which models to achieve the maximum number of algorithms running in the target device, thereby maximizing the utilization of device resources.
[0074] The embodiment of the present application provides an algorithm and device adaptation method, which determines the required computing power when a target model is executed once on a target device; for a target task executed on the target device, if there is a target algorithm in the target task that uses the target model, the required computing power is used as the actual computing power consumed by the target model during the execution of the target task, so that the total actual computing power consumed is less than or equal to the available computing power; the number of algorithms that use the target model is less than or equal to the total number of algorithms allowed to be executed on the target device; and the target algorithm in the target task that is allocated for execution on the target device is solved. The above scheme can enable the configured target algorithm to be executed on the target device through the limitation of computing power, and the reused target model only deducts computing power once, so that the adaptation of the algorithm and the device is more reasonable and accurate, and the utilization rate of resources is improved. The number limitation is met by limiting the number of algorithms, and personalized adjustment is achieved.
[0075] Figure 3This is a flowchart of an algorithm and device adaptation method provided by another embodiment of the present application. The present embodiment is optimized based on the above embodiment. For solutions not described in detail in the present embodiment, please refer to the above embodiment. Figure 3 As shown, the method of the embodiment of the present application specifically includes the following steps:
[0076] S310: Determine the required computing power for a single execution of the target model on the target device.
[0077] S320: For a target task executed on the target device, if there is a target algorithm in the target task that adopts the target model, the required computing power is used as the actual consumed computing power of the target model in the process of executing the target task.
[0078] S330. If there is a minimum number limit for the target algorithms of the target model used in the execution of each target task, the total number of target algorithms of the target model used in the execution of each target task is set to be greater than or equal to the minimum number.
[0079] Exemplarily, in some cases, the user may have customized settings to restrict the adaptation of algorithms and devices. For example, the user can set that the number of target algorithms using the target model cannot be less than the minimum number to meet the business detection requirements. Based on this, a constraint can be set so that the total number of target algorithms using the target model during the execution of each target task is greater than or equal to the minimum number. Exemplarily, the user can set that the number of target algorithms using the target model k cannot be less than the minimum number, and then set a constraint so that the sum of the number of target algorithms using the target model k in each target task is greater than or equal to the minimum number.
[0080] S340. Make the first total required computing power for executing each target algorithm in each target task on each target device less than or equal to the total available computing power of each target device, and make the second total required computing power for executing each target algorithm in the target task on a single target device less than or equal to the available computing power of the target device.
[0081] Exemplarily, in the process of allocating target algorithms for at least one target device, computing power constraints may be required for each target device. Specifically, the first total required computing power required for the target algorithm of the target task to be executed on each target device must be less than or equal to the total available computing power of all target devices, so that each target algorithm can be executed on each target device. In addition, for a single target device, constraints based on computing power are also required. Specifically, the second total required computing power of each target algorithm in the execution of the target task by a single target device must be less than or equal to the available computing power of the target device.
[0082] S350, solving the minimum number of required target devices.
[0083] Exemplarily, the above constraints are represented by the number of target devices, and the minimum number of target devices is solved to reflect the minimum number of target devices required to complete multiple target tasks, thereby consuming as few computing resources as possible while completing the target tasks, thereby improving resource utilization.
[0084] In the embodiment of the present application, the total number of target algorithms executing the target model in each target task is set to be less than or equal to the minimum number, including:
[0085] The third constraint is determined based on the following formula:
[0086]
[0087] Among them, t jk is the minimum number of target algorithms that use the target model in the execution of each target task, x ijk Indicates whether the target model k is selected by the jth algorithm in the i-th target task. If yes, it is the third value. If not, it is the fourth value. The third and fourth values are adjacent integers. ijk The constraint formula is: The third value ≤ x ijk ≤ the fourth value, which is an integer; represents any j and k. represents the number of target algorithms that use target model k in all target tasks, t jk The minimum number of target algorithms that can be preset by the user.
[0088] The first total required computing power for executing each target algorithm in each target task on each target device is less than or equal to the total available computing power of each target device, and the second total required computing power for executing each target algorithm in the target task on a single target device is less than or equal to the available computing power of the device, including:
[0089] The fourth constraint is determined based on the following formula:
[0090]
[0091] Among them, n represents the number of target tasks, K represents the total number of target models, and m k is the number of target algorithms that can use target model k in a target task, cp ijk The computing power required to execute target algorithm j of target task i on the target device using target model k; D 目标设备 is the available computing power of the target device, and d is the number of target devices. Indicates that for all target tasks, the first total required computing power required when executing the target model corresponding to each target algorithm needs to be less than or equal to the total available computing power of all target devices D目标设备 ×d, when the available computing power of each target device is different, the available computing power of each target device can be accumulated to obtain the total available computing power. ijk The computing power required to execute target algorithm j of target task i on the target device using target model k. In order to more intuitively indicate that the required computing power may be different when executing target model k on different target devices, subscripts are used to distinguish them. In fact, before the algorithm is adapted to the device, it is not clear on which target device the target model adopted by the target algorithm in the target task is executed. Therefore, the formula is used to bring in the maximum required computing power for a single execution of the target model on the target device. The second total required computing power when executing the target model adopted by the assigned target algorithm on the target device needs to be less than or equal to the available computing power of a single target device.
[0092] Solve for the minimum number of target devices required, including:
[0093] The minimum value of the number d of target devices is solved based on the third constraint condition and the fourth constraint condition.
[0094] Exemplarily, by referencing additional decision variables and constraints to manage complex device allocation and computing power usage, MILP and the optimization solver Gurobi are applied to find the optimal solution between device and algorithm task allocation, and the minimum value of the number of target devices d is solved based on the third and fourth constraints, so as to achieve the execution of all target tasks with the least number of target devices, thereby saving resources and improving the utilization of a single computing resource.
[0095] The embodiment of the present application provides an algorithm and device adaptation method to determine the required computing power when a target model is executed once on a target device; for a target task executed on the target device, if there is a target algorithm in the target task that uses the target model, the required computing power is used as the actual consumed computing power of the target model in the process of executing the target task. If there is a minimum number limit for the target algorithms that use the target model in the execution of each target task, the total number of target algorithms that use the target model in the execution of each target task is set to be greater than or equal to the minimum number; the first total required computing power of each target algorithm in each target task executed on each target device is set to be less than or equal to the total available computing power of each target device, and the second total required computing power of each target algorithm in the target task executed on a single target device is set to be less than or equal to the available computing power of the target device; solve the minimum number of target devices required. The above scheme can adaptively meet the needs of users and maximize resource utilization based on the logic of minimizing the number of devices maintained under the effective allocation framework of algorithms and models.
[0096] In the embodiments of the present application, an intelligent algorithm computing tool may be provided to integrate the functions of the algorithm and device configuration improved in the above embodiments and other additional functions, for example, Figure 4 shown.
[0097] Intelligent algorithm computing power tools are classified according to reused models, and the same model of algorithms are used to calculate computing power according to single functions in each intelligent analysis task, thereby improving the utilization rate of single-channel algorithms.
[0098] Intelligent algorithm computing power tools can be bound to the performance of the device, the software running version, and the amount of data that needs to be processed. Different conditions have different computing power calculation methods. After the performance of subsequent versions is optimized, customers can perceive it in real time, which can reflect the iteration of the version and improve customer usage rate.
[0099] The intelligent algorithm computing power calculation tool provides the optimal configuration plan and prompts customers to achieve the optimal configuration. Customers can directly configure according to the prompts without the need for users to consult relevant technical personnel for computing power calculations, which greatly reduces the waste of resources caused by the use of multiple devices.
[0100] The intelligent algorithm computing power calculation tool provides the optimal configuration plan based on the user's actual needs, and gives the number of related devices that meet this need and how to enable each algorithm.
[0101] This solution integrates elements such as device status monitoring panel, algorithm reuse configuration panel, real-time performance feedback display area, intelligent configuration recommendation panel, demand analysis and resource planning area, etc. Each module plays a different role, such as Figure 5 As shown, including:
[0102] Algorithm reuse configuration panel (A): used for classification and computing power calculation of intelligent algorithms to ensure efficient use of single-function algorithms.
[0103] Real-time performance feedback display area (B): displays computing power usage under conditions such as device performance data, running version, and amount of data to be processed, helping users perceive the performance improvement brought about by version iteration.
[0104] Intelligent configuration recommendation panel (C): Provides the optimal configuration solution based on current conditions to reduce resource waste.
[0105] Demand Analysis and Resource Planning Area (D): Provides recommendations on the number of devices and algorithm activation methods based on user needs to optimize resource allocation.
[0106] Equipment status monitoring panel (E): monitors equipment status and operating status to ensure stable system operation.
[0107] Figure 6This is a schematic diagram of the structure of an algorithm and device adaptation device provided in an embodiment of the present application. The device can execute the algorithm and device adaptation method provided in any embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method. Figure 6 As shown, the device comprises:
[0108] The required computing power determination module 410 is used to determine the required computing power when the target model is executed on the target device once;
[0109] The actual consumed computing power determination module 420 is used for, for a target task executed on the target device, if a target algorithm in the target task adopts the target model, taking the required computing power as the actual consumed computing power of the target model in the process of executing the target task;
[0110] The target algorithm allocation module 430 is used to determine the target algorithm in the target task to be allocated for execution on the target device for each target task executed on the target device, based on the total actual consumed computing power of each target model during the execution of each target task and the available computing power of the target device.
[0111] In the embodiment of the present application, the device further includes:
[0112] A basic component determination module is used to split each basic model in the model library to obtain basic components;
[0113] The reorganization module is used to reorganize the basic components shared by at least two basic models to obtain a target model.
[0114] In the embodiment of the present application, the required computing power determination module 410 determines the required computing power when the target model is executed once on the target device, including:
[0115] Determining device performance data of the target device, a software running version in the target device, and a data volume of data to be processed;
[0116] Based on the predetermined relationship between device performance data, software running version, the amount of data to be processed and computing power, the computing power corresponding to the performance data of the target device, the running version of the software in the target device and the amount of data to be processed is determined as the required computing power when the target model is executed once on the target device.
[0117] In the embodiment of the present application, the target algorithm allocation module 430 determines the target algorithm in the target task to be allocated and executed on the target device according to the total actual consumed computing power of each target model in the process of executing each target task and the available computing power of the target device, including:
[0118] Make the total actual consumed computing power less than or equal to the available computing power;
[0119] Make the number of algorithms using the target model less than or equal to the total number of algorithms allowed to be executed on the target device;
[0120] Solve the target algorithm in the target task that is assigned for execution on the target device.
[0121] In the embodiment of the present application, the target algorithm allocation module 430 makes the total actual consumed computing power less than or equal to the available computing power, including:
[0122] The first constraint is determined according to the following formula:
[0123]
[0124] Among them, D k is the actual computing power consumed by the k-th target model, y ik Indicates whether the target algorithm adopts the kth target model in the i-th target task. If yes, it is the first value; if not, it is the second value. The first value and the second value are adjacent integers. ik The constraint formula is: the first value ≤ y ik ≤ the second value, and is an integer; K is the total number of target models, n is the number of target tasks, D 目标设备 The available computing power of the target device;
[0125] The target algorithm allocation module 430 makes the number of algorithms using the target model less than or equal to the total number of algorithms allowed to be executed on the target device, including:
[0126] The second constraint is determined according to the following formula:
[0127]
[0128] Among them, x ijk Indicates whether the target model k is adopted by the jth algorithm in the i-th target task. If yes, it is the third value; if not, it is the fourth value. The third and fourth values are adjacent integers. ijk The constraint formula is: The third value ≤ x ijk ≤ the fourth value, which is an integer; m k is the number of target algorithms that can use target model k in a target task; c k is the preset number of target algorithms that are allowed to use target model k in a target task;
[0129] The target algorithm allocation module 430 solves the target algorithm in the target task to be allocated and executed on the target device, including:
[0130] The number of target algorithms supported by the target device is expressed based on the following formula:
[0131]
[0132] The maximum value of the target algorithm quantity based on the first constraint condition and the second constraint condition is x. ijk To solve.
[0133] In the embodiment of the present application, the device further includes:
[0134] A quantity constraint module is used to make the total number of target algorithms using the target model in the process of executing each target task greater than or equal to the minimum number if there is a minimum number limit on the number of target algorithms using the target model in the process of executing each target task;
[0135] An algorithm constraint module, used to make the first total required computing power of each target algorithm in each target task executed on each target device less than or equal to the total available computing power of each target device, and make the second total required computing power of each target algorithm in the target task executed on a single target device less than or equal to the available computing power of the target device;
[0136] A solving module is used to solve the minimum number of target devices required.
[0137] In the embodiment of the present application, the quantity constraint module makes the total number of target algorithms executing the target model in each target task less than or equal to the minimum number, including:
[0138] The third constraint is determined based on the following formula:
[0139]
[0140] Among them, t jk is the minimum number of target algorithms that use the target model in the execution of each target task, x ijk Indicates whether the target model k is selected by the jth algorithm in the i-th target task. If yes, it is the third value. If not, it is the fourth value. The third and fourth values are adjacent integers. ijk The constraint formula is: The third value ≤ x ijk ≤ the fourth value, which is an integer; represents any j and k;
[0141] The algorithm constraint module makes the first total required computing power of each target algorithm in each target task executed on each target device less than or equal to the total available computing power of each target device, and makes the second total required computing power of each target algorithm in the target task executed on a single target device less than or equal to the available computing power of the device, including:
[0142] The fourth constraint is determined based on the following formula:
[0143] and
[0144]
[0145] Among them, n represents the number of target tasks, K represents the total number of target models, and m k is the number of target algorithms that can use target model k in a target task, cp ijk The computing power required to execute target algorithm j of target task i on the target device using target model k; D 目标设备 is the available computing power of the target device, and d is the number of target devices;
[0146] The solver module solves the minimum number of target devices required, including:
[0147] The minimum value of d is solved based on the third constraint condition and the fourth constraint condition.
[0148] An algorithm and device adaptation device provided in an embodiment of the present application can execute an algorithm and device adaptation method provided in any embodiment of the present application, and has functional modules and beneficial effects corresponding to the execution method.
[0149] Figure 7 A schematic diagram of an electronic device 10 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0150] like Figure 7As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the algorithm and device adaptation of at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, ROM 12 and RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0151] Multiple components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless algorithm and device adapter transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0152] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as the algorithm and device adaptation method.
[0153] In some embodiments, the algorithm and device adaptation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the algorithm and device adaptation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the algorithm and device adaptation method in any other appropriate manner (e.g., by means of firmware).
[0154] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0155] Computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable algorithm and device adapter, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0156] In the context of the present application, a computer readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device or equipment. A computer readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer readable storage medium may be a machine readable signal medium. A more specific example of a machine readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0157] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0158] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by digital data algorithms and device adaptations (e.g., algorithm and device adaptation networks) in any form or medium. Examples of algorithm and device adaptation networks include: local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0159] The computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through an algorithm and a device adaptation network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0160] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the information expected by the technical solution of this application can be achieved, and this document is not limited here.
[0161] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. An algorithm and device adaptation method, characterized in that: The method comprises: Determine the computing power required for a single execution of the target model on the target device; For a target task executed on the target device, if there is a target algorithm in the target task that adopts the target model, the required computing power is used as the actual consumed computing power of the target model in the process of executing the target task; For each target task executed on the target device, the target algorithm in the target task to be executed on the target device is determined according to the total actual consumed computing power of each target model during the execution of each target task and the available computing power of the target device.
2. The method according to claim 1, characterized in that The process of determining the target model includes: The target model and the business processing module used by the target algorithm are determined according to the function set to which the target algorithm belongs and the internal processing logic; wherein the target model and the business processing module are cascaded to realize the target algorithm identification process.
3. The method according to claim 1, characterized in that Determine the computing power required for a single execution of the target model on the target device, including: Determining device performance data of the target device, a software running version in the target device, and a data volume of data to be processed; Based on the predetermined relationship between device performance data, software running version, the amount of data to be processed and computing power, the computing power corresponding to the performance data of the target device, the running version of the software in the target device and the amount of data to be processed is determined as the required computing power when the target model is executed once on the target device.
4. The method according to claim 1, characterized in that Determining the target algorithm in the target task to be executed on the target device according to the total actual consumed computing power of each target model in the process of executing each target task and the available computing power of the target device, including: Make the total actual consumed computing power less than or equal to the available computing power; Make the number of algorithms using the target model less than or equal to the total number of algorithms allowed to be executed on the target device; Solve the target algorithm in the target task that is assigned for execution on the target device.
5. The method according to claim 4, characterized in that Making the total actual consumed computing power less than or equal to the available computing power includes: The first constraint is determined according to the following formula: Among them, D k is the actual computing power consumed by the kth target model, y ik Indicates whether the target algorithm adopts the kth target model in the i-th target task. If yes, it is the first value; if not, it is the second value. The first value and the second value are adjacent integers. ik The constraint formula is: the first value ≤ y ik ≤ the second value, and is an integer; K is the total number of target models, n is the number of target tasks, D 目标设备 The available computing power of the target device; The number of algorithms using the target model is set to be less than or equal to the total number of algorithms allowed to be executed on the target device, including: The second constraint is determined according to the following formula: and Among them, x ijk Indicates whether the target model k is adopted by the jth algorithm in the i-th target task. If yes, it is the third value; if not, it is the fourth value. The third and fourth values are adjacent integers. ijk The constraint formula is: The third value ≤ x ijk ≤ the fourth value, which is an integer; m k is the number of target algorithms that can use target model k in a target task; c k is the preset number of target algorithms that are allowed to use target model k in a target task; Solving a target algorithm in the target task assigned for execution on the target device includes: The number of target algorithms supported by the target device is expressed based on the following formula: The maximum value of the target algorithm quantity based on the first constraint condition and the second constraint condition is x. ijk To solve.
6. The method according to claim 1, characterized in that The method further comprises: If there is a minimum number limit for the target algorithms of the target model used in the execution of each target task, the total number of target algorithms of the target model used in the execution of each target task is set to be greater than or equal to the minimum number; The first total required computing power for executing each target algorithm in each target task on each target device is less than or equal to the total available computing power of each target device, and the second total required computing power for executing each target algorithm in the target task on a single target device is less than or equal to the available computing power of the target device; Solve for the minimum number of target devices required.
7. The method according to claim 6, characterized in that The total number of target algorithms that execute the target model in each target task is less than or equal to the minimum number, including: The third constraint is determined based on the following formula: Among them, t jk is the minimum number of target algorithms that use the target model in the execution of each target task, x ijk Indicates whether the target model k is selected by the jth algorithm in the i-th target task. If yes, it is the third value. If not, it is the fourth value. The third and fourth values are adjacent integers. ijk The constraint formula is: The third value ≤ x ijk ≤ the fourth value, which is an integer; represents any j and k; The first total required computing power for executing each target algorithm in each target task on each target device is less than or equal to the total available computing power of each target device, and the second total required computing power for executing each target algorithm in the target task on a single target device is less than or equal to the available computing power of the device, including: The fourth constraint is determined based on the following formula: and Among them, n represents the number of target tasks, K represents the total number of target models, and m k is the number of target algorithms that can use target model k in a target task, cp ijk The computing power required to execute target algorithm j of target task i on the target device using target model k; D 目标设备 is the available computing power of the target device, and d is the number of target devices; Solve for the minimum number of target devices required, including: The minimum value of d is solved based on the third constraint condition and the fourth constraint condition.
8. An algorithm and device adaptation device, characterized in that: The device comprises: A required computing power determination module is used to determine the required computing power when the target model is executed once on the target device; an actual consumed computing power determination module, for a target task executed on the target device, if a target algorithm in the target task adopts the target model, then using the required computing power as the actual consumed computing power of the target model in the process of executing the target task; The target algorithm allocation module is used to determine the target algorithm in the target task to be allocated for execution on the target device for each target task executed on the target device according to the total actual consumed computing power of each target model during the execution of each target task and the available computing power of the target device.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and A memory connected to the at least one processor algorithm and device adapter; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the algorithm and device adaptation method described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the algorithm and device adaptation method described in any one of claims 1 to 7 when executed.