Reasoning acceleration card algorithm deployment method and device, electronic equipment and storage medium
By placing the operating environments of inference accelerator cards from different manufacturers in independent containers and encapsulating them as Hypertext Transfer Protocol services, the problem of software version conflicts of inference accelerator cards is solved, achieving stable deployment and flexible application, and reducing costs.
Patent Information
- Application Number
- CN202311605776.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-28
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-11-28
AI Technical Summary
Software version conflicts exist between inference accelerator cards from different manufacturers, resulting in poor performance when multiple inference accelerator cards are used in combination on a single server.
The runtime environments of multiple inference accelerator cards from different manufacturers are placed in separate containers, and their decoding and inference functions are encapsulated as Hypertext Transfer Protocol services, published to designated ports, and called from the host machine or edge nodes to achieve runtime environment isolation.
This avoids software version conflicts, ensures normal deployment performance when combining inference accelerator cards from different manufacturers, improves usage flexibility, and reduces deployment costs.
Smart Images

Figure CN117707692B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, electronic device and storage medium for deploying inference accelerator card algorithms. Background Technology
[0002] With the continuous development of artificial intelligence technology, more and more object detection and recognition algorithms are being applied. As the application scenarios of these algorithms expand, the number of video streams connected to them increases, the variety of algorithms grows, and the required decoding capabilities and computing power increases. Meanwhile, in recent years, AI chip technology has advanced rapidly, and many chip manufacturers' inference accelerator cards have entered the market and are being used. However, different manufacturers' inference accelerator cards have different strengths and are suitable for different specific functions. Relying on an inference accelerator card from only one manufacturer for object detection and recognition algorithm inference will yield poor results.
[0003] Existing technologies often employ a combination of inference accelerator cards from different manufacturers, leveraging the individual strengths of each card to achieve rapid inference of video stream images. However, this approach is susceptible to software version differences between the various inference accelerator cards, posing a risk of software version conflicts and resulting in poor inference performance. Summary of the Invention
[0004] This application provides a method, apparatus, electronic device, and readable storage medium for deploying algorithms on inference accelerator cards. By forming different containers for the operating environments of multiple inference accelerator cards from different manufacturers and calling them from the host machine or edge node, isolation of the operating environments of different inference accelerator cards from different manufacturers is achieved, solving the problem of software version conflicts and poor inference performance between different inference accelerator cards.
[0005] Firstly, this application provides a method for deploying an inference accelerator card algorithm, the method comprising:
[0006] Obtain the inference accelerator card algorithm deployment request, wherein the inference accelerator card algorithm deployment request includes a video stream decoding channel request and a computing power requirement request;
[0007] A first configuration file is generated based on the video stream decoding path request;
[0008] A second configuration file is generated based on the computing power requirement request;
[0009] According to the first configuration file, the corresponding accelerator card service is retrieved from the pre-set first container, and according to the second configuration file, the corresponding accelerator card service is retrieved from the pre-set second container to obtain the first accelerator card deployment result. The images corresponding to the first container and the second container are independent of each other.
[0010] Optionally, the inference accelerator card algorithm deployment method provided in this application also includes:
[0011] Determine the inference accelerator card model and the number of inference accelerator cards corresponding to the video stream decoding number request;
[0012] The first image is loaded according to the inference accelerator card model and the number of inference accelerator cards corresponding to the number of video stream decoding paths, wherein the first image pre-sets the operating environment of the inference accelerator card corresponding to the number of video stream decoding paths;
[0013] Determine the inference accelerator card model and quantity corresponding to the computing power requirement based on the computing power requirement request;
[0014] The second image is loaded according to the inference accelerator card model and number of inference accelerator cards corresponding to the computing power requirement, wherein the second image is pre-set with the operating environment of the inference accelerator card corresponding to the computing power requirement;
[0015] The first container is generated based on the first image, and the second container is generated based on the second image.
[0016] Optionally, the inference accelerator card algorithm deployment method provided in this application also includes:
[0017] The first configuration file is generated based on the video stream address corresponding to the video stream decoding path request, the inference accelerator card model corresponding to the video stream decoding path, and the number of inference accelerator cards.
[0018] Optionally, the inference accelerator card algorithm deployment method provided in this application also includes:
[0019] The operating environment of the inference accelerator card is placed in multiple independent mirrors to obtain multiple intermediate mirrors;
[0020] The service functions of the inference accelerator card are encapsulated into multiple Hypertext Transfer Protocol services.
[0021] The ports corresponding to the intermediate mirrors of the multiple Hypertext Transfer Protocol services are published to obtain the first mirror and the second mirror.
[0022] Optionally, the inference accelerator card algorithm deployment method provided in this application also includes:
[0023] A third configuration file is generated based on the video stream algorithm deployment request;
[0024] The corresponding accelerator card service is retrieved from the first container according to the first configuration file, the corresponding accelerator card service is retrieved from the second container according to the second configuration file, and the corresponding accelerator card service is retrieved from the pre-set third container according to the third configuration file to obtain the second accelerator card deployment result. The images corresponding to the first container, the second container, and the third container are independent of each other.
[0025] Optionally, the inference accelerator card algorithm deployment method provided in this application also includes:
[0026] The inference accelerator card decoding function is encapsulated as a first hypertext transfer protocol service;
[0027] The function of acquiring decoded image data is encapsulated as a second hypertext transfer protocol service;
[0028] The inference accelerator card decoding stop function is encapsulated as a third hypertext transfer protocol service;
[0029] The algorithm model initialization function is encapsulated as a fourth hypertext transfer protocol service;
[0030] The algorithm reasoning function is encapsulated as a fifth hypertext transfer protocol service;
[0031] The algorithm's stop function is encapsulated as a sixth hypertext transfer protocol service.
[0032] Optionally, the inference accelerator card algorithm deployment method provided in this application also includes:
[0033] According to the first configuration file, the video stream is decoded by calling the inference accelerator card decoding function from the first container through the first hypertext transfer protocol service to obtain the decoding result;
[0034] According to the second configuration file, the model initialization service is called from the second container through the fourth hypertext transfer protocol service to load the algorithm model;
[0035] According to the first configuration file, the function of obtaining decoded image data is called from the first container through the second hypertext transfer protocol service, and the image is obtained from the decoding result;
[0036] According to the second configuration file, the inference accelerator card's service functions are invoked from the second container; according to the third configuration file, the algorithm execution service functions are invoked from the third container.
[0037] Based on the service functions of the inference acceleration card and the service functions of the algorithm, the image is inferred to obtain the deployment result of the second acceleration card.
[0038] Secondly, this application also provides an inference accelerator card algorithm deployment device, comprising:
[0039] The deployment request acquisition module is used to acquire inference accelerator card algorithm deployment requests, wherein the inference accelerator card algorithm deployment requests include video stream decoding channel requests and computing power requirement requests;
[0040] The first configuration file generation module is used to generate a first configuration file based on the video stream decoding path request.
[0041] The second configuration file generation module is used to generate a second configuration file according to the computing power requirement request.
[0042] The first accelerator card deployment module is used to retrieve the corresponding accelerator card service from the pre-set first container according to the first configuration file, and retrieve the corresponding accelerator card service from the pre-set second container according to the second configuration file, so as to obtain the first accelerator card deployment result, wherein the images corresponding to the first container and the second container are independent of each other.
[0043] Thirdly, this application also provides an electronic device including a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions being executed by the processor to implement the steps of the inference accelerator card algorithm deployment method as described in the first aspect.
[0044] Fourthly, embodiments of this application provide a readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the inference accelerator card algorithm deployment method as described in the first aspect.
[0045] In the technical solution provided in this application, since the containers of different inference accelerator cards are independent of each other, the isolation of the operating environment of different inference accelerator cards from different manufacturers is achieved, thereby avoiding the software version conflict problem that occurs when multiple inference accelerator cards are called in combination and run on a single server at the same time, and ensuring the normal deployment effect of the combination of inference accelerator cards from different manufacturers.
[0046] Furthermore, since the operating environments of inference accelerator cards from different manufacturers are separate, users can freely combine multiple inference accelerator cards according to their own needs to apply target detection or recognition algorithms, which improves the flexibility of inference accelerator card usage. Users can select appropriate inference accelerator cards for algorithm deployment and application based on their actual decoding channels and computing power requirements, saving deployment costs of inference accelerator cards.
[0047] The above description is merely an overview of the technical solution provided in this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are described below. Attached Figure Description
[0048] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0049] Figure 1 This is one of the schematic diagrams of the inference accelerator card algorithm deployment method provided in the embodiments of this application;
[0050] Figure 2 This is the second schematic diagram of the inference accelerator card algorithm deployment method provided in the embodiments of this application;
[0051] Figure 3 This is the third schematic diagram of the inference accelerator card algorithm deployment method provided in the embodiments of this application;
[0052] Figure 4 This is the fourth schematic diagram of the inference accelerator card algorithm deployment method provided in the embodiments of this application;
[0053] Figure 5 This is the fifth schematic diagram of the inference accelerator card algorithm deployment method provided in the embodiments of this application;
[0054] Figure 6 This is the sixth schematic diagram of the inference accelerator card algorithm deployment method provided in the embodiments of this application;
[0055] Figure 7 This is the seventh schematic diagram of the inference accelerator card algorithm deployment method provided in the embodiments of this application;
[0056] Figure 8 This application provides an example of an inference accelerator card algorithm deployment process;
[0057] Figure 9 This is a schematic diagram of the inference accelerator card algorithm deployment device provided in the embodiments of this application;
[0058] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0059] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.
[0060] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0061] With the continuous development of artificial intelligence technology, more and more object detection and recognition algorithms are being applied. As the application scenarios of these algorithms expand, the number of video streams connected to them increases, the variety of algorithms grows, and the required decoding capabilities and computing power rises. Meanwhile, in recent years, AI chip technology has advanced rapidly, and many chip manufacturers' inference accelerator cards have entered the market and are being used. However, different manufacturers' inference accelerator cards have different strengths and are suitable for different specific functions. For scenarios requiring high decoding streams and high computing power, the combined application of multiple inference accelerator cards from different manufacturers is a trend, depending on their decoding and computing power. However, implementing decoding and inference functions on the same server with multiple inference accelerator cards, while simultaneously deploying them quickly and replicating their application in more scenarios, remains a challenge.
[0062] To address the software version conflicts that arise from different manufacturers' inference accelerator cards in existing technologies, this application provides an inference accelerator card algorithm deployment method. This method pre-places the operating environments of multiple inference accelerator cards from different manufacturers within independent images, such as Docker images. The decoding and inference functions of the inference accelerator cards are then published as services, for example, via Hypertext Transfer Protocol (HTTP) services in a pre-defined manner, to designated ports and invoked from the host machine or edge nodes. This isolates the operating environments of different inference accelerator cards from different manufacturers, thus avoiding software version conflicts that occur when multiple inference accelerator cards are combined and run on a single server, ensuring the normal deployment effect of combinations of inference accelerator cards from different manufacturers.
[0063] Furthermore, since the operating environments of inference accelerator cards from different manufacturers are separate, users can freely combine multiple inference accelerator cards according to their own needs to apply target detection or recognition algorithms, which improves the flexibility of inference accelerator card usage. Users can select appropriate inference accelerator cards for algorithm deployment and application based on their actual decoding channels and computing power requirements, saving deployment costs of inference accelerator cards.
[0064] Furthermore, since the operating environments of different inference accelerator cards are placed in different Docker images, and the relevant functions are encapsulated as HTTP services in a unified manner, Docker images are easy to port and reuse, which improves the algorithm deployment efficiency of inference accelerator cards. It can quickly realize the deployment and application of algorithms based on multiple inference accelerator cards and shorten the delivery cycle.
[0065] The following description, in conjunction with the accompanying drawings, details the inference accelerator card algorithm deployment method, apparatus, electronic device, and non-volatile readable storage medium provided in this application through specific embodiments and application scenarios.
[0066] The first embodiment of this application relates to a method for deploying inference accelerator card algorithms, such as... Figure 1 As shown, it includes:
[0067] Step 101: Obtain the inference accelerator card algorithm deployment request, wherein the inference accelerator card algorithm deployment request includes a video stream decoding channel request and a computing power requirement request;
[0068] Step 102: Generate a first configuration file based on the video stream decoding path request;
[0069] Step 103: Generate a second configuration file based on the computing power requirement request;
[0070] Step 104: Retrieve the corresponding accelerator card service from the pre-set first container according to the first configuration file, and retrieve the corresponding accelerator card service from the pre-set second container according to the second configuration file to obtain the first accelerator card deployment result. The images corresponding to the first container and the second container are independent of each other.
[0071] Specifically, the inference accelerator card algorithm deployment method provided in this application first obtains the algorithm deployment request for the inference accelerator card. This request includes both a request for the number of decoding paths of the video streams to be processed by the object detection algorithm or object recognition algorithm, and a request for computing power requirements. Then, based on the video stream decoding path request, video stream addresses are added, and the requirements for the inference accelerator card used for decoding each video stream are determined, such as the model of the inference accelerator card and its identity information in the server, thus forming a first configuration file. Based on the computing power requirements of the object detection algorithm or object recognition algorithm, corresponding algorithms are added, and the requirements for the inference accelerator card used during the operation of each algorithm are determined, such as the model of the inference accelerator card and its identity information in the server, thus forming a second configuration file.
[0072] Finally, based on the first configuration file, the corresponding accelerator card services are called from the pre-set first container, such as video stream decoding services, video stream decoded image extraction services, and other services related to video stream decoding. Based on the second configuration file, the corresponding accelerator card services are called from the pre-set second container, such as algorithm model initialization services, algorithm inference services, and algorithm stop services.
[0073] Finally, the algorithm deployment of the inference accelerator card is completed based on the first and second containers called, the video stream is processed, and the deployment result of the first accelerator card is obtained.
[0074] The images corresponding to the first and second containers, such as Docker images, are independent of each other. The operating environments of different inference accelerator cards do not affect each other. The inference accelerator cards provided by the first and second containers formed according to their respective Docker images will also not interfere with each other, ensuring the stability of the server.
[0075] In the technical solution provided in this application, since the containers of different inference accelerator cards are independent of each other, the isolation of the operating environment of different inference accelerator cards from different manufacturers is achieved, thereby avoiding the software version conflict problem that occurs when multiple inference accelerator cards are called in combination and run on a single server at the same time, and ensuring the normal deployment effect of the combination of inference accelerator cards from different manufacturers.
[0076] Furthermore, since the operating environments of inference accelerator cards from different manufacturers are separate, users can freely combine multiple inference accelerator cards according to their own needs to apply target detection or recognition algorithms, which improves the flexibility of inference accelerator card usage. Users can select appropriate inference accelerator cards for algorithm deployment and application based on their actual decoding channels and computing power requirements, saving deployment costs of inference accelerator cards.
[0077] Based on the above implementation methods, such as Figure 2As shown, in the inference accelerator card algorithm deployment method provided in this application, after step 101 and before step 104, it further includes:
[0078] Step 105: Determine the inference accelerator card model and the number of inference accelerator cards corresponding to the video stream decoding number request;
[0079] Step 106: Load the first image according to the inference accelerator card model and the number of inference accelerator cards corresponding to the number of video stream decoding paths, wherein the first image pre-sets the operating environment of the inference accelerator card corresponding to the number of video stream decoding paths;
[0080] Step 107: Determine the inference accelerator card model and quantity corresponding to the computing power requirement based on the computing power requirement request;
[0081] Step 108: Load the second image according to the inference accelerator card model and number of inference accelerator cards corresponding to the computing power requirement, wherein the second image is pre-set with the operating environment of the inference accelerator card corresponding to the computing power requirement;
[0082] Step 109: Generate the first container based on the first image, and generate the second container based on the second image.
[0083] Specifically, the inference accelerator card algorithm deployment method provided in this application also provides specific examples of constructing the first container and the second container.
[0084] For example, based on the number of video stream decoding requests required in the algorithm deployment request of the inference accelerator card, the model and number of inference accelerator cards needed for video stream decoding are determined. After obtaining the model and number of inference accelerator cards needed for video stream decoding, the corresponding first image, such as the algorithm runtime environment Docker image, is loaded into the system, and the corresponding first container is generated based on the first image.
[0085] Simultaneously with the generation of the first container, the model and number of inference accelerator cards required for algorithm inference are determined based on the computing power requirements in the algorithm deployment request of the inference accelerator cards. After obtaining the required model and number of inference accelerator cards for algorithm inference, the corresponding second image, such as the algorithm runtime environment Docker image, is loaded into the system, and the corresponding second container is generated based on the second image. Once both the first and second containers are generated, the decoding service of the first container and the inference service of the second container are started for subsequent operation and processing of the video stream.
[0086] Among them, the first image, the second image, and other images can be pre-configured according to different inference accelerator cards in the server. The operating environment of different inference accelerator cards is placed in different images, and the decoding, inference, and other inference accelerator card services are encapsulated as HTTP services and published to pre-defined designated ports. Users can determine different first and second images according to different inference accelerator card algorithm deployment requirements, and achieve the effect of unified calling of different inference accelerator cards by accessing services on different ports within the host machine.
[0087] Based on the above implementation method, since the operating environments of different inference accelerator cards are placed in different Docker images and the relevant functions are encapsulated as HTTP services in a unified manner, Docker images are easy to port and reuse, which improves the algorithm deployment efficiency of inference accelerator cards and enables the rapid deployment and application of algorithms based on multiple inference accelerator cards, thus shortening the delivery cycle.
[0088] Based on the above implementation methods, such as Figure 3 As shown, in the inference accelerator card algorithm deployment method provided in this application, step 102 includes:
[0089] Step 121: Generate the first configuration file based on the video stream address corresponding to the video stream decoding path request, the inference accelerator card model corresponding to the video stream decoding path, and the number of inference accelerator cards.
[0090] Specifically, in the inference accelerator card algorithm deployment method provided in this application, after obtaining the video stream decoding channel request and determining the corresponding first image, the first configuration file can be constructed based on the video stream address corresponding to the video stream decoding channel request, the inference accelerator card model used for decoding each video stream, and the identity information used by the inference accelerator card in the server to distinguish it, such as ID.
[0091] For example, once the first container is generated and the video stream decoding service within it has been started, the video stream addresses are first added according to the video stream decoding request, and the model and ID of the inference accelerator card used for decoding are determined for each of the multiple video streams. Then, a first configuration file is generated based on the inference accelerator card model, ID, and video stream addresses, for subsequent calls to the video stream decoding service corresponding to the first container based on the first configuration file.
[0092] Once the computing power demand request is obtained and the corresponding second image is determined, the second configuration file can be constructed based on the algorithm corresponding to the computing power demand request, the inference accelerator card model used by each algorithm, and the identification information used to distinguish the inference accelerator card within the server, such as the ID.
[0093] For example, once the second container is generated and the algorithm inference service within it has been started, algorithms are first added based on the computing power requirements. For each algorithm, the model and ID of the inference accelerator card used during runtime are determined. Then, a second configuration file is generated based on the inference accelerator card model, ID, and the algorithm, for subsequent calls to the corresponding algorithm inference service within the second container.
[0094] Based on the above implementation methods, such as Figure 4 As shown, in the inference accelerator card algorithm deployment method provided in this application, before step 106, the method further includes:
[0095] Step 110: Place the operating environment of the inference accelerator card in multiple independent mirrors to obtain multiple intermediate mirrors;
[0096] Step 111: Encapsulate the service functions of the inference accelerator card into multiple Hypertext Transfer Protocol services;
[0097] Step 112: Publish the ports corresponding to the intermediate mirrors of the multiple Hypertext Transfer Protocol services to obtain the first mirror and the second mirror.
[0098] Specifically, in the inference accelerator card algorithm deployment method provided in this application, the first image and the second image can be generated in the following ways:
[0099] First, the runtime environment of each inference accelerator card in the server is placed in a separate Docker image, resulting in multiple intermediate images that do not interfere with each other. Then, the decoding, inference, and other service functions of each inference accelerator card are encapsulated into HTTP services in a unified manner and published to a pre-defined port, thus obtaining the first image and the second image. At this point, the technical solution provided in this application can, within the host machine, access services on different ports and generate corresponding containers based on different images, enabling unified access to multiple inference accelerator cards.
[0100] Based on the above implementation method, since both the first image and the second image are encapsulated as HTTP services in a unified manner, it ensures that the host machine can make unified calls to multiple inference accelerator cards, thereby improving the versatility of this application.
[0101] Based on the above implementation methods, such as Figure 5 As shown, the inference accelerator card algorithm deployment request also includes a video stream algorithm deployment request. In the inference accelerator card algorithm deployment method provided in this application, after step 103, it further includes:
[0102] Step 113: Generate a third configuration file based on the video stream algorithm deployment request;
[0103] Step 114: Retrieve the corresponding accelerator card service from the first container according to the first configuration file, retrieve the corresponding accelerator card service from the second container according to the second configuration file, and retrieve the corresponding accelerator card service from the pre-set third container according to the third configuration file to obtain the second accelerator card deployment result. The images corresponding to the first container, the second container, and the third container are independent of each other.
[0104] Specifically, in the inference accelerator card algorithm deployment method provided in this application, the algorithm deployment request of the inference accelerator card also includes a request to deploy the algorithm for each video stream. The technical solution provided in this application can also configure a corresponding algorithm for each video stream according to the request to deploy the algorithm for each video stream, and generate a corresponding third configuration file. Finally, based on the first configuration file, the second configuration file, and the third configuration file, the corresponding inference accelerator card services are called from the first container, the second container, and the third container, respectively, to complete the algorithm deployment of the inference accelerator card, and decode and infer the video stream to obtain the inference result.
[0105] Based on the above implementation, since this application can also configure different algorithms for each of the multiple video streams and generate a third configuration file, users can use different algorithms for different video streams according to actual needs and provide inference services through different inference accelerator cards, which further improves the flexibility of using inference accelerator cards.
[0106] Based on the above implementation methods, such as Figure 6 As shown, the services of the inference accelerator card include inference accelerator card decoding function, inference accelerator card decoding stop function, algorithm model initialization function, algorithm inference function, and algorithm stop function. In the inference accelerator card algorithm deployment method provided in this application, step 111 includes:
[0107] Step 115: Encapsulate the inference acceleration card decoding function into a first hypertext transfer protocol service;
[0108] Step 116: Encapsulate the function of obtaining the decoded image data into a second hypertext transfer protocol service;
[0109] Step 117: Encapsulate the inference acceleration card decoding stop function as a third hypertext transfer protocol service;
[0110] Step 118: Encapsulate the algorithm model initialization function as a fourth hypertext transfer protocol service;
[0111] Step 119: Encapsulate the algorithm reasoning function as a fifth Hypertext Transfer Protocol service;
[0112] Step 120: Encapsulate the algorithm's stop function as a sixth hypertext transfer protocol service.
[0113] Specifically, in the inference accelerator card algorithm deployment method provided in this application, the services of the inference accelerator card include, but are not limited to, inference accelerator card decoding function, decoding image data acquisition function, algorithm model initialization function, algorithm inference function, and algorithm stopping function. The technical solution provided in this application can encapsulate different inference accelerator card services into HTTP services and publish them to a specified port in the following ways:
[0114] The inference accelerator card's decoding function is encapsulated as a first HTTP service. For example, the format could be set to "http: / / <ip> : <port>The request parameter " / / decoder" is set to the video stream address and the inference accelerator card ID. The image data obtained after decoding the video stream can be stored in an array for subsequent object recognition or detection algorithms to use for inference. To save space, this application can save only the newly decoded image data to the array, and previously inferred image data is not stored.
[0115] The function of the inference accelerator card to acquire decoded image data is encapsulated as a second HTTP service. For example, the format could be set to "http: / / <ip> : <port>" / / getframe" requests the video stream address as the parameter and return the latest image data, such as newly decoded image data.
[0116] The inference accelerator card's decoding stop function can be encapsulated as a third-party HTTP service. For example, the format could be set to "http: / / <ip> : <port>" / / decoder_free", the request parameter is set to the video stream address.
[0117] The algorithm model initialization function of the inference accelerator card can be encapsulated as a fourth HTTP service. For example, the format could be set to "http: / / <ip> : <port>" / / model_load", the request parameters are set to the model address, algorithm name, and inference accelerator card ID.
[0118] The algorithm inference function of the inference accelerator card can be encapsulated as a fifth HTTP service. For example, the format could be set to "http: / / <ip> : <port>" / / model_infer" requests the image data and algorithm name as parameters, and returns the inference result as the return parameter.
[0119] The algorithm stop function of the inference accelerator card can be encapsulated as a sixth HTTP service. For example, the format could be set to "http: / / <ip> : <port>" / / model_free", the request parameter is set to the algorithm name.
[0120] Based on the above implementation methods, such as Figure 7 As shown, in the inference accelerator card algorithm deployment method provided in this application, step 114 includes:
[0121] Step 141: According to the first configuration file, the video stream is decoded by calling the inference acceleration card decoding function from the first container through the first hypertext transfer protocol service to obtain the decoding result;
[0122] Step 142: According to the second configuration file, the model initialization service is called from the second container through the fourth hypertext transfer protocol service to load the algorithm model;
[0123] Step 143: According to the first configuration file, call the function to obtain the decoded image data from the first container through the second Hypertext Transfer Protocol service, and obtain the image from the decoding result;
[0124] Step 144: According to the second configuration file, call the service function of the inference accelerator card from the second container; according to the third configuration file, call the service function of the algorithm execution from the third container.
[0125] Step 145: Based on the service functions of the inference acceleration card and the service functions of the algorithm, inference is performed on the image to obtain the deployment result of the second acceleration card.
[0126] Specifically, in the inference accelerator card algorithm deployment method provided in this application, firstly, according to the first configuration file, the corresponding decoding service of the inference accelerator card is called for each video stream via the first HTTP service to decode and obtain the decoding result. Then, according to the second configuration file, the corresponding model initialization service of the inference accelerator card is called for each algorithm in the video stream processing via the fourth HTTP service to load the algorithm model. After the algorithm model is loaded, according to the first configuration file, the corresponding function to obtain decoded image data is called for each video stream via the second HTTP service to obtain the image from the decoding result. Afterwards, according to the second and third configuration files, the inference service of the corresponding inference accelerator card is called with the image obtained from the decoding result to obtain the inference result. Once all images obtained from the video stream decoding have been inferred, the decoding stop function of the inference accelerator card can be called to stop decoding of multiple video streams, and the algorithm stop function can be called to stop the algorithm's inference action.
[0127] The second configuration file mainly includes the correspondence between each algorithm and the inference accelerator card, while the third configuration file mainly includes the correspondence between each video stream and the deployed algorithm. By combining the second and third configuration files, the inference service of the corresponding inference accelerator card can be called for each acquired image to obtain the result.
[0128] When only the latest decoded image data is retained in the array, the decoding results can be read in a loop by calling the function to obtain decoded image data according to the first configuration file, and the inference service of the inference acceleration card can be called in a loop to obtain inference results according to the second and third configuration files. This saves space while ensuring that all decoded image data participates in inference, thereby guaranteeing the quality of image inference.
[0129] Based on the above implementation method, the technical solution provided in this application can also realize the cyclic reading and cyclic reasoning of the decoded image data, which saves space, reduces array storage pressure, and ensures the quality of reasoning results.
[0130] Based on the above implementation methods, such as Figure 8 As shown, this application also provides an example of an inference accelerator card algorithm deployment process:
[0131] First, select a suitable inference accelerator card based on the requirements. For example, determine the model and quantity of inference accelerator cards to be used based on the number of video stream decoding paths and computing power requirements. Next, based on the model of the inference accelerator card to be used, load the corresponding algorithm runtime environment Docker image into the system, generate a container from the Docker image, and start the decoding and inference services within the container, waiting for it to run. Then, add the video stream address, configure the inference accelerator card model and ID used for decoding each video stream, generating configuration file 1. Add the algorithm, configure the inference accelerator card model and ID used for each algorithm, generating configuration file 2. Deploy the algorithm for each video stream, generating configuration file 3. Once configuration files 1, 2, and 3 are generated, according to configuration file 1, call the decoding service of the corresponding inference accelerator card for each video stream to start decoding. According to configuration file 2, for each algorithm, call the model initialization service of the corresponding inference accelerator card to load the model into the inference accelerator card. After the algorithm model initialization is complete, according to configuration file 1, call the image acquisition service of the corresponding inference accelerator card for each video stream to read the decoded images in a loop.
[0132] Furthermore, according to configuration files 2 and 3, the images will be read in a loop, and the inference service of the corresponding inference accelerator card will be called to perform loop inference to obtain the inference result, thereby realizing the deployment of the inference accelerator card.
[0133] Specifically, the decoding and inference processes of the inference accelerator card are published to a designated port via an HTTP service in a unified manner. For example, the decoding function of the inference accelerator card is encapsulated as an HTTP service, in the format http: / / <ip> : <port> / / decoder, the request parameters are the video stream address and inference accelerator card ID, saves the decoded image data to an array, to save space, only the latest decoded data can be kept; the function of obtaining the decoded image data is encapsulated as an HTTP service, format
[0134] http: / / <ip> : <port> / / getframe, the request parameter is the video stream address, and the return parameter is the latest image data; the inference accelerator card decoding stop function is encapsulated as an HTTP service, in the format...
[0135] http: / / <ip> : <port> / / decoder_free, the request parameter is the video stream address; the algorithm inference function is encapsulated as an HTTP service, in the format http: / / <ip> : <port> / / model_infer, the request parameters are image data and algorithm name, the returned data is the inference result; the algorithm stop function is encapsulated as an HTTP service, in the format http: / / <ip> : <port> / / model_free, the request parameter is the algorithm name.
[0136] Among them, after the encapsulation inference accelerator card stops decoding and switches to HTTP service, it can also determine whether the video stream address contains symbols. If the determination is correct, the video stream address is segmented, and it is determined whether each of the segmented parts contains only numbers. When the segmentation result contains only numbers, the IP address is extracted from the segmentation result as the address of the video stream. When the segmentation result still contains symbols, it returns and continues to segment until the segmented parts contain only numbers, at which point the IP address is extracted. In addition, when it is determined that the segmentation result contains more than just numbers, an error can be returned directly for the user to adjust. This application does not impose any restrictions.
[0137] The second embodiment of this application relates to an algorithm deployment device for an inference accelerator card, such as... Figure 9 As shown, it includes:
[0138] The deployment request acquisition module 201 is used to acquire the inference accelerator card algorithm deployment request, wherein the inference accelerator card algorithm deployment request includes a video stream decoding channel request and a computing power requirement request;
[0139] The first configuration file generation module 202 is used to generate a first configuration file according to the video stream decoding path request;
[0140] The second configuration file generation module 203 is used to generate a second configuration file according to the computing power requirement request.
[0141] The first accelerator card deployment module 204 is used to retrieve the corresponding accelerator card service from the pre-set first container according to the first configuration file, and retrieve the corresponding accelerator card service from the pre-set second container according to the second configuration file to obtain the first accelerator card deployment result, wherein the images corresponding to the first container and the second container are independent of each other.
[0142] Based on the above embodiments, the inference accelerator card algorithm deployment device provided in this application further includes:
[0143] The first requirement acquisition module is used to determine the inference accelerator card model and the number of inference accelerator cards corresponding to the video stream decoding number request based on the video stream decoding number request.
[0144] The first image generation module is used to load the first image according to the inference accelerator card model and the number of inference accelerator cards corresponding to the video stream decoding path number, wherein the first image pre-sets the operating environment of the inference accelerator card corresponding to the video stream decoding path number;
[0145] The second demand acquisition module is used to determine the inference accelerator card model and the number of inference accelerator cards corresponding to the computing power demand based on the computing power demand request.
[0146] The second image generation module is used to load a second image according to the inference accelerator card model and the number of inference accelerator cards corresponding to the computing power requirement. The second image is pre-set with the operating environment of the inference accelerator card corresponding to the computing power requirement.
[0147] The container generation module is used to generate the first container based on the first image and the second container based on the second image.
[0148] Based on the above embodiments, the first configuration file generation module 202 in the inference accelerator card algorithm deployment device provided in this application includes:
[0149] The first configuration file construction unit is used to generate the first configuration file based on the video stream address corresponding to the video stream decoding path request, the inference accelerator card model corresponding to the video stream decoding path, and the number of inference accelerator cards.
[0150] Based on the above embodiments, the inference accelerator card algorithm deployment device provided in this application further includes:
[0151] The intermediate mirror placement module is used to place the operating environment of the inference accelerator card in multiple independent mirrors to obtain multiple intermediate mirrors;
[0152] The HTTP encapsulation module is used to encapsulate the service functions of the inference accelerator card into multiple Hypertext Transfer Protocol services.
[0153] The port publishing module is used to publish the ports corresponding to the intermediate mirrors of multiple Hypertext Transfer Protocol services to obtain the first mirror and the second mirror.
[0154] Based on the above embodiments, the inference accelerator card algorithm deployment request also includes a video stream algorithm deployment request. The inference accelerator card algorithm deployment device provided in this application further includes:
[0155] The third configuration file generation module is used to generate a third configuration file based on the video stream algorithm deployment request.
[0156] The second accelerator card deployment module is used to retrieve the corresponding accelerator card service from the first container according to the first configuration file, retrieve the corresponding accelerator card service from the second container according to the second configuration file, and retrieve the corresponding accelerator card service from the pre-set third container according to the third configuration file to obtain the second accelerator card deployment result, wherein the images corresponding to the first container, the second container, and the third container are independent of each other.
[0157] Based on the above embodiments, the services of the inference accelerator card include inference accelerator card decoding function, decoding image data acquisition function, inference accelerator card decoding stop function, algorithm model initialization function, algorithm inference function, and algorithm stop function. In the inference accelerator card algorithm deployment device provided in this application, the HTTP encapsulation module includes:
[0158] The first HTTP encapsulation unit is used to encapsulate the inference accelerator card decoding function into a first hypertext transfer protocol service.
[0159] The second HTTP encapsulation unit is used to encapsulate the function of obtaining decoded image data into a second Hypertext Transfer Protocol service.
[0160] The third HTTP encapsulation unit is used to encapsulate the inference accelerator card decoding stop function into a third hypertext transfer protocol service.
[0161] The fourth HTTP encapsulation unit is used to encapsulate the algorithm model initialization function into a fourth Hypertext Transfer Protocol service;
[0162] The fifth HTTP encapsulation unit is used to encapsulate the algorithm reasoning function into a fifth Hypertext Transfer Protocol service;
[0163] The sixth HTTP encapsulation unit is used to encapsulate the algorithm stop function into a sixth Hypertext Transfer Protocol service.
[0164] Based on the above embodiments, the second accelerator card deployment module in the inference accelerator card algorithm deployment device provided in this application includes:
[0165] The video stream decoding unit is used to decode the video stream by calling the inference accelerator card decoding function from the first container through the first hypertext transfer protocol service according to the first configuration file, and to obtain the decoding result.
[0166] The algorithm model loading unit is used to load the algorithm model by calling the model initialization service from the second container through the fourth hypertext transfer protocol service according to the second configuration file.
[0167] The image acquisition unit is used to, according to the first configuration file, call the function to acquire decoded image data from the first container through the second hypertext transfer protocol service, and acquire the image from the decoding processing result;
[0168] The algorithm function invocation unit is used to invoke the service functions of the inference acceleration card from the second container according to the second configuration file, and to invoke the service functions of the algorithm execution from the third container according to the third configuration file.
[0169] The image reasoning unit is used to reason about the image based on the service functions of the reasoning acceleration card and the service functions of the algorithm to obtain the deployment result of the second acceleration card.
[0170] The third embodiment of this application relates to an electronic device, such as... Figure 10 As shown, it includes:
[0171] At least one processor 301; and,
[0172] The memory 302 is communicatively connected to the at least one processor 301; wherein,
[0173] The memory 302 stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor 301 to enable the at least one processor 301 to implement the inference accelerator card algorithm deployment method described in the first embodiment of this application.
[0174] The memory and processor are connected via a bus, which can include any number of interconnecting buses and bridges, connecting various circuits of one or more processors and memories. The bus can also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and will not be described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor is transmitted over the wireless medium via an antenna, which further receives data and transmits it to the processor.
[0175] The processor manages the bus and general processing, and also provides various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory is used to store data used by the processor during operation.
[0176] The fourth embodiment of this application relates to a non-volatile computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the inference accelerator card algorithm deployment method described in the first embodiment of this application.
[0177] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0178] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0179] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.< / port> < / ip> < / port> < / ip> < / port> < / ip> < / port> < / ip> < / port> < / ip> < / port> < / ip> < / port> < / ip> < / port> < / ip> < / port> < / ip> < / port> < / ip> < / port> < / ip>
Claims
1. A method for deploying an inference accelerator card algorithm, characterized in that, The method includes: Obtain the inference accelerator card algorithm deployment request, wherein the inference accelerator card algorithm deployment request includes a video stream decoding channel request and a computing power requirement request; A first configuration file is generated based on the video stream decoding path request; A second configuration file is generated based on the computing power requirement request; The operating environment of the inference accelerator card is placed in multiple independent mirrors to obtain multiple intermediate mirrors; The service functions of the inference accelerator card are encapsulated into multiple Hypertext Transfer Protocol services. By publishing the ports corresponding to the intermediate mirrors of the multiple Hypertext Transfer Protocol services, a first mirror and a second mirror are obtained; According to the first configuration file, the corresponding accelerator card service is retrieved from the pre-set first container, and according to the second configuration file, the corresponding accelerator card service is retrieved from the pre-set second container to obtain the first accelerator card deployment result. The images corresponding to the first container and the second container are independent of each other.
2. The method according to claim 1, characterized in that, After obtaining the inference accelerator card algorithm deployment request, and before retrieving the corresponding accelerator card service from the pre-set first container according to the first configuration file, and retrieving the corresponding accelerator card service from the pre-set second container according to the second configuration file, and obtaining the first accelerator card deployment result, the method further includes: Determine the inference accelerator card model and the number of inference accelerator cards corresponding to the video stream decoding number request; The first image is loaded according to the inference accelerator card model and the number of inference accelerator cards corresponding to the number of video stream decoding paths, wherein the first image pre-sets the operating environment of the inference accelerator card corresponding to the number of video stream decoding paths; Determine the inference accelerator card model and quantity corresponding to the computing power requirement based on the computing power requirement request; The second image is loaded according to the inference accelerator card model and number of inference accelerator cards corresponding to the computing power requirement, wherein the second image is pre-set with the operating environment of the inference accelerator card corresponding to the computing power requirement; The first container is generated based on the first image, and the second container is generated based on the second image.
3. The method according to claim 2, characterized in that, The step of generating the first configuration file based on the video stream decoding path request includes: The first configuration file is generated based on the video stream address corresponding to the video stream decoding path request, the inference accelerator card model corresponding to the video stream decoding path, and the number of inference accelerator cards.
4. The method according to claim 1, characterized in that, The inference accelerator card algorithm deployment request also includes a video streaming algorithm deployment request. After generating the second configuration file based on the computing power requirement request, the process further includes: A third configuration file is generated based on the video stream algorithm deployment request; The corresponding accelerator card service is retrieved from the first container according to the first configuration file, the corresponding accelerator card service is retrieved from the second container according to the second configuration file, and the corresponding accelerator card service is retrieved from the pre-set third container according to the third configuration file to obtain the second accelerator card deployment result. The images corresponding to the first container, the second container, and the third container are independent of each other.
5. The method according to claim 4, characterized in that, The services provided by the inference accelerator card include inference accelerator card decoding function, function to acquire decoded image data function, inference accelerator card decoding stop function, algorithm model initialization function, algorithm inference function, and algorithm stop function. The encapsulation of the inference accelerator card's service functions into multiple Hypertext Transfer Protocol services includes: The inference accelerator card decoding function is encapsulated as a first hypertext transfer protocol service; The function of acquiring decoded image data is encapsulated as a second hypertext transfer protocol service; The inference accelerator card decoding stop function is encapsulated as a third hypertext transfer protocol service; The algorithm model initialization function is encapsulated as a fourth hypertext transfer protocol service; The algorithm reasoning function is encapsulated as a fifth hypertext transfer protocol service; The algorithm's stop function is encapsulated as a sixth hypertext transfer protocol service.
6. The method according to claim 5, characterized in that, The step of retrieving the corresponding accelerator card service from the first container according to the first configuration file, retrieving the corresponding accelerator card service from the second container according to the second configuration file, and retrieving the corresponding accelerator card service from the pre-set third container according to the third configuration file to obtain the second accelerator card deployment result includes: According to the first configuration file, the video stream is decoded by calling the inference accelerator card decoding function from the first container through the first hypertext transfer protocol service to obtain the decoding result; According to the second configuration file, the algorithm model is loaded by calling the algorithm model initialization function from the second container through the fourth hypertext transfer protocol service; According to the first configuration file, the function of obtaining decoded image data is called from the first container through the second hypertext transfer protocol service, and the image is obtained from the decoding result; According to the second configuration file, the inference accelerator card's service functions are invoked from the second container; according to the third configuration file, the algorithm execution service functions are invoked from the third container. Based on the service functions of the inference acceleration card and the service functions of the algorithm, the image is inferred to obtain the deployment result of the second acceleration card.
7. An algorithm deployment device for an inference accelerator card, characterized in that, include: The deployment request acquisition module is used to acquire inference accelerator card algorithm deployment requests, wherein the inference accelerator card algorithm deployment requests include video stream decoding channel requests and computing power requirement requests; The first configuration file generation module is used to generate a first configuration file based on the video stream decoding path request. The second configuration file generation module is used to generate a second configuration file according to the computing power requirement request. The intermediate mirror placement module is used to place the operating environment of the inference accelerator card in multiple independent mirrors to obtain multiple intermediate mirrors; The HTTP encapsulation module is used to encapsulate the service functions of the inference accelerator card into multiple Hypertext Transfer Protocol services. The port publishing module is used to publish the ports corresponding to the intermediate mirrors of multiple Hypertext Transfer Protocol services to obtain the first mirror and the second mirror. The first accelerator card deployment module is used to retrieve the corresponding accelerator card service from the pre-set first container according to the first configuration file, and retrieve the corresponding accelerator card service from the pre-set second container according to the second configuration file, so as to obtain the first accelerator card deployment result, wherein the images corresponding to the first container and the second container are independent of each other.
8. An electronic device, characterized in that, It includes a processor and a memory, the memory storing programs or instructions that can run on the processor, the programs or instructions being executed by the processor to implement the steps of the inference accelerator card algorithm deployment method as described in any one of claims 1-6.
9. A readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the inference accelerator card algorithm deployment method as described in any one of claims 1-6.
Citation Information
Patent Citations
Method, apparatus, and system for extracting configuration file from mirror image
CN108563461A
Intelligent acceleration card and data processing method based on intelligent acceleration card
CN113377529A
