Computer vision algorithm integration method and device, computer equipment, readable storage medium and program product
By generating and allocating container task details, downloading and running the basic image of the computer vision algorithm, the problem of poor flexibility of the intelligent monitoring platform integration algorithm is solved, the algorithm is plug-and-play, the integration process is simplified, and the scalability and efficiency are improved. .
Patent Information
- Application Number
- CN202410865940.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-28
AI Technical Summary
When integrating computer vision algorithms, smart monitoring platforms have poor flexibility, resulting in poor scalability. R&D personnel need to manually adapt new algorithms, which increases manpower and time costs.
By obtaining the algorithm file and parameter configuration file of the target computer vision algorithm, generate container task details, asynchronously start the task to allocate resources, download the basic image, run the inference script and register the algorithm, realize the plug-and-play of the algorithm, reduce the integration complexity and Labor costs and improved ductility.
There is no need to manually develop adaptations, which simplifies the algorithm integration process, improves integration efficiency and flexibility, enables plug-and-play algorithms, reduces labor and time costs, and significantly improves the scalability of the smart monitoring platform.
Smart Images

Figure CN118606006A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an integrated method, apparatus, computer device, computer-readable storage medium and computer program product for a computer vision algorithm. Background Art
[0002] With the rapid development of deep learning technology, the application of computer vision algorithms in the field of smart monitoring has become a trend. On the basis of the previous management of cameras, the smart monitoring platform integrates different computer vision algorithms to achieve real-time analysis of monitoring videos of smart parks, petrochemicals, and safe production, and real-time alarms based on abnormal results obtained from the analysis. The smart monitoring platform accesses the camera through the network and integrates the computer vision algorithms used in real scenes into the platform. The system regularly extracts video frames from the camera, inputs them into the integrated computer vision algorithm for analysis, and generates alarms.
[0003] In related technologies, since different algorithms require different input and output parameters, and there are many types of algorithm frameworks and dependent environments, R&D personnel often develop and adapt computer vision algorithms in advance in the smart monitoring platform, and reasonably allocate GPU (graphics processing unit) resources for computer vision algorithms to integrate computer vision algorithms into the smart monitoring platform. This means that if you want to integrate new computer vision algorithms into the smart monitoring platform, you need to involve R&D personnel to develop and adapt new computer vision algorithms on the smart monitoring platform.
[0004] It can be seen that the algorithm integration method of the smart monitoring platform in the relevant technology has poor flexibility, which in turn leads to poor scalability of the smart monitoring platform. Summary of the invention
[0005] Based on this, it is necessary to provide an integration method, device, computer equipment, computer-readable storage medium and computer program product for computer vision algorithms that can improve the algorithm integration flexibility of the smart monitoring platform and improve the scalability of the smart monitoring platform in response to the above-mentioned technical problems.
[0006] In a first aspect, the present application provides a method for integrating computer vision algorithms, the method comprising:
[0007] Obtain an algorithm file and a parameter configuration file of a target computer vision algorithm service, wherein the algorithm file includes an inference script and a target computer vision algorithm;
[0008] In response to an activation operation for the target computer vision algorithm service, generating at least one container task detail according to the container parameters and the algorithm parameters in the parameter configuration file, and storing the at least one container task detail in a container task detail table;
[0009] Acquire target container task details from the container task detail table by asynchronously starting a task, and allocate target resources to the target container task details;
[0010] Download the base image of the target computer vision algorithm service from the image repository to the target server, create and start the target container based on the target resources, and download the algorithm file to the base image;
[0011] The inference script is run in the base image to start the target computer vision algorithm service, and the target computer vision algorithm is registered in a registration center.
[0012] In one embodiment, the step of obtaining an algorithm file and a parameter configuration file of a target computer vision algorithm service includes:
[0013] Get the data compression package of the target computer vision algorithm service;
[0014] Decompressing the data compression package to obtain the algorithm file and parameter configuration file of the target computer vision algorithm service;
[0015] Generate a container parameter configuration table based on the container parameters in the parameter configuration file, and generate an algorithm parameter configuration table based on the algorithm parameters in the parameter configuration file;
[0016] The algorithm file is uploaded to the target server, and the download address of the algorithm file is recorded in the algorithm parameter configuration table.
[0017] In one embodiment, generating at least one container task detail according to the container parameters and algorithm parameters in the parameter configuration file includes:
[0018] According to the download address of the algorithm file in the algorithm parameter configuration table, and the container configuration information and the number of instances N recorded in the container parameter configuration table, N container task details are generated, and the container task details include task status, container status, the container configuration information, and the download address of the algorithm file.
[0019] In one embodiment, allocating target resources to the target container task details includes:
[0020] Collecting statistics on resource information of each server, and obtaining candidate servers that meet resource screening conditions from each server;
[0021] A target GPU whose GPU video memory free space satisfies a GPU video memory screening condition is determined from the GPUs of the candidate servers, and the target GPU is used as a target resource for starting the target computer vision algorithm container.
[0022] In one embodiment, registering the target computer vision algorithm in a registration center includes:
[0023] Register the IP address and port information of the target computer vision algorithm in the registration center.
[0024] In one embodiment, the method further comprises:
[0025] Receiving a service request for scheduling the target computer vision algorithm service, the service request including a target request parameter, the target request parameter being configured based on the algorithm request parameter in the algorithm parameter configuration table;
[0026] According to the service identifier of the target computer vision algorithm service, the IP address and port information of the target computer vision algorithm are obtained from the registration center, and the target computer vision algorithm service is called through the IP address and port information to process the target request parameters, and the processing result is obtained and fed back.
[0027] In one embodiment, the task status includes: a waiting state, an entering running state, a waiting state, and an ending state, and the method further includes:
[0028] After the container task details are generated, the task status of the container task details is recorded in the container task details table as a pending execution status;
[0029] The asynchronous task obtains the target container task details in the waiting state from the container task details table, and after starting the target container according to the target container task details, changes the task state of the container task details in the container task details table to entering the running state;
[0030] In response to a deactivation operation on the target computer vision algorithm service, changing the task status of the container task details in the container task list that are in a pending state and in a running state to a pending end state;
[0031] By asynchronously deactivating the task, the container task corresponding to the container task detail whose task status is to be ended in the container task detail table is ended, and the task status of the container task detail is changed to ended in the container task detail table.
[0032] In one of the embodiments, the parameter configuration file includes algorithm service configuration parameters and algorithm service container operating parameters; wherein the algorithm service configuration parameters include the algorithm identifier of the target computer vision algorithm, the service identifier of the target computer vision algorithm service, and algorithm request parameters; the algorithm service container operating parameters include resource constraints, number of instances, image identifier, and path mapping parameters when the target container of the target computer vision algorithm is started.
[0033] In a second aspect, the present application further provides an integrated device for a computer vision algorithm, the device comprising:
[0034] An acquisition module, used to acquire an algorithm file and a parameter configuration file of a target computer vision algorithm service, wherein the algorithm file includes an inference script and a target computer vision algorithm;
[0035] a generating module, configured to generate at least one container task detail in response to an activation operation for the target computer vision algorithm service, according to the container parameters and the algorithm parameters in the parameter configuration file, and store the at least one container task detail in a container task detail table;
[0036] A resource allocation module, used for acquiring target container task details from the container task detail table by asynchronously starting tasks, and allocating target resources to the target container task details;
[0037] A download module, used to download the base image of the target computer vision algorithm service from the image repository to the target server, create and start the target container based on the target resource, and download the algorithm file to the base image;
[0038] A registration module is used to run the inference script in the base image to start the target computer vision algorithm service and register the target computer vision algorithm in a registration center.
[0039] In one embodiment, the acquisition module is further used for:
[0040] Get the data compression package of the target computer vision algorithm service;
[0041] Decompressing the data compression package to obtain the algorithm file and parameter configuration file of the target computer vision algorithm service;
[0042] Generate a container parameter configuration table based on the container parameters in the parameter configuration file, and generate an algorithm parameter configuration table based on the algorithm parameters in the parameter configuration file;
[0043] The algorithm file is uploaded to the target server, and the download address of the algorithm file is recorded in the algorithm parameter configuration table.
[0044] In one embodiment, the generating module is further used for:
[0045] According to the download address of the algorithm file in the algorithm parameter configuration table, and the container configuration information and the number of instances N recorded in the container parameter configuration table, N container task details are generated, and the container task details include task status, container status, the container configuration information, and the download address of the algorithm file.
[0046] In one embodiment, the resource allocation module is further used to:
[0047] Collecting statistics on resource information of each server, and obtaining candidate servers that meet resource screening conditions from each server;
[0048] A target GPU whose GPU video memory free space satisfies a GPU video memory screening condition is determined from the GPUs of the candidate servers, and the target GPU is used as a target resource for starting the target computer vision algorithm container.
[0049] In one embodiment, the registration module is further used to:
[0050] Register the IP address and port information of the target computer vision algorithm in the registration center.
[0051] In one embodiment, the device further comprises:
[0052] The receiving module is further used to receive a service request for scheduling the target computer vision algorithm service, wherein the service request includes a target request parameter, and the target request parameter is configured based on the algorithm request parameter in the algorithm parameter configuration table;
[0053] The scheduling module is used to obtain the IP address and port information of the target computer vision algorithm from the registration center according to the service identifier of the target computer vision algorithm service, call the target computer vision algorithm service through the IP address and port information to process the target request parameters, and obtain and feedback the processing results.
[0054] In one embodiment, the task status includes: a waiting state, an entering running state, a waiting state, and an ending state. The device further includes: a task status management module, and the task status management module is used to:
[0055] After the container task details are generated, the task status of the container task details is recorded in the container task details table as a pending execution status;
[0056] The asynchronous task obtains the target container task details in the waiting state from the container task details table, and after starting the target container according to the target container task details, changes the task state of the container task details in the container task details table to entering the running state;
[0057] In response to a deactivation operation on the target computer vision algorithm service, changing the task status of the container task details in the container task list that are in a pending state and in a running state to a pending end state;
[0058] By asynchronously deactivating the task, the container task corresponding to the container task detail whose task status is to be ended in the container task detail table is ended, and the task status of the container task detail is changed to ended in the container task detail table.
[0059] In one of the embodiments, the parameter configuration file includes algorithm service configuration parameters and algorithm service container operating parameters; wherein the algorithm service configuration parameters include the algorithm identifier of the target computer vision algorithm, the service identifier of the target computer vision algorithm service, and algorithm request parameters; the algorithm service container operating parameters include resource constraints, number of instances, image identifier, and path mapping parameters when the target container of the target computer vision algorithm is started.
[0060] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements any of the above methods when executing the computer program.
[0061] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements any of the above methods when executed by a processor.
[0062] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements any of the above methods when executed by a processor.
[0063] The above-mentioned computer vision algorithm integration method, apparatus, computer equipment, computer-readable storage medium and computer program product obtain the algorithm file and parameter configuration file of the target computer vision algorithm service, and in response to the activation operation for the target computer vision algorithm service, generate at least one container task detail according to the container parameters and algorithm parameters in the parameter configuration file, and store at least one container task detail in the container task detail table. The target container task details are obtained from the container task detail table by asynchronously starting the task, and the target container task details are allocated with target resources. The base image of the target computer vision algorithm service is downloaded from the image repository to the target server, and the target container is created and started based on the target resources. The algorithm file is downloaded to the base image, and the reasoning script is run in the base image to start the target computer vision algorithm service, and the target computer vision algorithm is registered in the registration center for subsequent callers to call. That is, by adopting the computer vision algorithm integration method, apparatus, computer equipment, computer-readable storage medium and computer program product provided in the embodiments of the present disclosure, the target computer vision algorithm can be automatically integrated into the smart monitoring platform by uploading the algorithm file and parameter configuration file of the target computer vision algorithm service to the smart monitoring platform. There is no need for R&D personnel to manually develop and adapt the new computer vision algorithm on the smart monitoring platform, which simplifies the algorithm integration process of the smart monitoring platform, reduces the manpower and time costs of the algorithm integration process, improves the flexibility and efficiency of algorithm integration, and greatly improves the scalability of the smart monitoring platform.
[0064] Moreover, the computer vision algorithm integration method provided in this case can realize the plug-and-play of the algorithm by one-click import of the compressed files of the algorithm file and the parameter configuration file, reducing the complexity of the integrated algorithm of the smart monitoring platform. At least one container task detail is generated through the parameter configuration file, and the container creation is controlled by the container task detail. Since one algorithm instance corresponds to a table record of one container task detail, independent control at the algorithm instance level can be achieved, and then the start and stop of multiple instances of the same algorithm can be achieved independently, greatly improving the flexibility of algorithm start and stop. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions 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 related drawings can be obtained based on these drawings without paying creative work.
[0066] FIG1 is a schematic diagram of the architecture of a smart monitoring platform in one embodiment;
[0067] FIG2 is a schematic diagram of a flow chart of a method for integrating computer vision algorithms in one embodiment;
[0068] FIG3 is a schematic diagram of an integration method of a computer vision algorithm in one embodiment;
[0069] FIG4 is a flow chart of step 202 in a method for integrating computer vision algorithms in one embodiment;
[0070] FIG5 is a schematic diagram of a flow chart of step 206 in a method for integrating computer vision algorithms in one embodiment;
[0071] FIG6 is a schematic diagram of an integration method of computer vision algorithms in one embodiment;
[0072] FIG7 is a schematic diagram of an integration method of a computer vision algorithm in one embodiment;
[0073] FIG8 is a schematic diagram of a flow chart of a method for integrating computer vision algorithms in one embodiment;
[0074] FIG9 is a schematic diagram of the transition of task states in an integrated method of computer vision algorithms in one embodiment;
[0075] FIG10 is a schematic diagram of an integration method of a computer vision algorithm in one embodiment;
[0076] FIG11 is a schematic diagram of an integration method of a computer vision algorithm in one embodiment;
[0077] FIG12 is a schematic diagram of an integration method of a computer vision algorithm in one embodiment;
[0078] FIG13 is a block diagram of an integrated device for a computer vision algorithm in one embodiment;
[0079] FIG. 14 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0080] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0081] The integration method of computer vision algorithms provided in the embodiment of the present application can be applied in the application environment shown in FIG1. As shown in FIG1, in the architecture of the smart monitoring platform in the embodiment of the present application, the system layer relies on the Docker container to shield the differences of the operating system, the algorithm service and the application service register themselves to the registration center, and the application layer routes to the algorithm service of the next layer through the load balancing of the registration center. The application service includes the algorithm management service and the container management service. The algorithm management service is used to manage the configuration of the integrated algorithm, and the container management service is used to manage the start and stop of the algorithm container. The external and internal systems obtain the reasoning service through the application layer. Among them, the smart monitoring platform can be implemented through a terminal or a server. Among them, the terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0082] In an exemplary embodiment, as shown in FIG2 , a method for integrating a computer vision algorithm is provided, which is described by taking the method applied to a server as an example, and includes the following steps 202 to 210. Among them:
[0083] Step 202, obtaining an algorithm file and a parameter configuration file of a target computer vision algorithm service, wherein the algorithm file includes an inference script and a target computer vision algorithm.
[0084] In the disclosed embodiments, for the target computer vision algorithm, the operating environment of the target computer vision algorithm can be pre-built as a universal basic image. Exemplarily, the environment and dependencies in which the reasoning framework of the target computer vision algorithm runs can be packaged into a Docker image (basic image) and uploaded to the image repository. Among them, algorithms of different architectures can be packaged with different basic images. If the basic image required by the reasoning framework of the target computer vision algorithm already exists in the image repository, the basic image can be directly used without repeating the construction of the basic image.
[0085] In this way, when algorithms of different architectures need to be run, the running conditions can be met by replacing the basic image of the corresponding framework. The basic image is relatively lightweight, and loading and replacement are relatively simple and convenient, which can improve the integration speed of the algorithm.
[0086] In the disclosed embodiment, the target computer vision algorithm and the reasoning script can be encapsulated into an algorithm file of the target computer vision algorithm service, and the target computer vision algorithm service can be managed using the Web server gateway interface. Taking the Flask Web framework in Python as an example, as shown in FIG3 , a PyTorch reasoning script is written in Python, and the reasoning script is run to call the target computer vision algorithm for reasoning. The target computer vision algorithm and the reasoning script are encapsulated into the target computer vision algorithm service with the help of Flask, which can solve the problem of inconsistent languages between the caller and the algorithm service when providing the corresponding algorithm service to the outside.
[0087] For example, taking the commonly used Web server gateway interface Gunicorn as an example, Gunicorn sets the number of threads for the algorithm service to 3 and the number of processes to 1, which can greatly improve the algorithm reasoning performance and reduce the problem of excessive CPU (Central Processing Unit) usage of the algorithm service due to a large number of requests.
[0088] Taking the algorithm of PyTorch architecture as an example, the computer vision algorithm model file trained by PyTorch, the called reasoning script, Flask service script, Gunicorn control script and other complete running script files are put into a folder to obtain the algorithm file, which lays the foundation for direct operation after downloading the algorithm file in the basic image. In the disclosed embodiment, the differentiation between algorithms is solved by the algorithm itself, and only a standardized HTTP (Hypertext Transfer Protocol) reasoning interface is provided to the outside.
[0089] In the disclosed embodiment, the base image has a built-in run.sh script (startup script), and run.sh is used as the startup command when the base image is running, for receiving the algorithm file download address and algorithm startup command parameters, and downloading the algorithm file through the received algorithm file download address. After the algorithm file is downloaded, the algorithm service is started according to the startup command parameters, which can solve the problem of dynamically running different algorithms according to the received parameters for the same type of base image.
[0090] In the disclosed embodiment, the algorithm service configuration parameters and the algorithm service container operation parameters of the target computer vision algorithm service may be pre-written to obtain a parameter configuration file.
[0091] In an exemplary embodiment, the parameter configuration file includes algorithm service configuration parameters and algorithm service container operating parameters; wherein the algorithm service configuration parameters include the algorithm identifier of the target computer vision algorithm, the service identifier of the target computer vision algorithm service, and the algorithm request parameters; the algorithm service container operating parameters include the resource constraints, number of instances, image identifier, and path mapping parameters when the target container of the target computer vision algorithm is started.
[0092] The parameter configuration file written by the present invention, the algorithm service configuration parameters play the role of configuring the algorithm, and the algorithm service container operation parameters play the role of configuring the algorithm operation container conditions and quantity. Among them, the resource constraints when the target container is started can include CPU, memory, GPU memory, GPU usage, number of instances, image name, path mapping parameters, including CPU, memory, GPU memory, GPU usage parameters; the number of instances is used to configure the number of instances to start this algorithm service, and dynamically match the number of instances required by the algorithm service; the image identifier specifies the basic image of the operating environment when the algorithm service is started; the path mapping configuration is used to configure the mapping between the host machine and the container.
[0093] The algorithm identifier and service identifier constitute the algorithm service identifier of the target computer vision algorithm service; the algorithm request parameters configure the necessary parameters for requesting the algorithm service interface, which are used to dynamically control the algorithm threshold. Among them, the algorithm request parameters can be used to standardize the input and output parameters of the inference interface of the target computer vision algorithm service, so as to provide corresponding algorithm services to the smart monitoring platform through the HTTP inference interface.
[0094] The algorithm request parameters standardize the input parameters and output parameters of the HTTP reasoning interface. For example, the input parameters include the algorithm threshold, the image download address, the image converted to base64 string, the detection area coordinates, and the exclusion area coordinates. The standard output parameters include whether the request is successful, the response status code, the response information, the detected target coordinates, and the reasoning alarm content. The standardized input and output of the algorithm interface parameters facilitate the caller of the algorithm service to unify the processing logic, which is used to solve the differences in the access of different algorithms to the smart monitoring platform. By formulating the algorithm input standard, output standard, and service mode requirements, it can achieve compatibility with any algorithm access, greatly improving the scalability of the smart monitoring platform.
[0095] Finally, the algorithm file and parameter configuration file are compressed together into a data compression package, and the data compression package is imported into the smart monitoring platform.
[0096] In an exemplary embodiment, as shown in FIG. 4 , the above step 202 may be implemented through steps 402 to 408, wherein:
[0097] Step 402, obtaining a data compression package of a target computer vision algorithm service;
[0098] Step 404, decompressing the data compression package to obtain the algorithm file and parameter configuration file of the target computer vision algorithm service;
[0099] Step 406, generating a container parameter configuration table based on the container parameters in the parameter configuration file, and generating an algorithm parameter configuration table based on the algorithm parameters in the parameter configuration file;
[0100] Step 408: upload the algorithm file to the target server, and record the download address of the algorithm file in the algorithm parameter configuration table.
[0101] In the embodiment of the present disclosure, taking the commonly used zip compression method as an example, the algorithm file and parameter configuration file of the target computer vision algorithm service are placed in the same folder, and the folder is compressed into a zip file to reduce the file size and speed up the import. In the algorithm import module of the smart monitoring platform, the packaged zip file is imported, and the parameter configuration file and algorithm file are decompressed inside the smart monitoring platform.
[0102] The decompressed parameter configuration file is further parsed to obtain the algorithm service configuration parameters (algorithm file for short) and the algorithm service container operation parameters (container parameters), the algorithm parameters are stored in the algorithm parameter configuration table, the container configuration interface of the container management service is called, and the container parameters are stored in the container parameter configuration table. In the disclosed embodiment, the algorithm parameter configuration table and the container parameter configuration table are obtained by parsing the JSON parameter file after one-click import, without the need for manual configuration, which simplifies the operation when configuring the algorithm. The decompressed algorithm file can be uploaded to the target server for storage, and the download address of the algorithm file can be written into the algorithm parameter configuration table, laying the foundation for downloading and running the algorithm file when the subsequent container is started.
[0103] In the disclosed embodiment, by one-click import of compressed files of algorithm files and parameter configuration files, plug-and-play of the algorithm is achieved, reducing the complexity of the integrated algorithm of the smart monitoring platform.
[0104] Step 204, in response to the activation operation for the target computer vision algorithm service, at least one container task detail is generated according to the container parameters and algorithm parameters in the parameter configuration file, and the at least one container task detail is stored in the container task detail table.
[0105] In the disclosed embodiment, after the target computer vision algorithm is imported into the intelligent monitoring platform, the corresponding target computer vision algorithm service can be displayed in the algorithm service list displayed in the display interface of the algorithm management center. The user can trigger the enable button after selecting the target computer vision algorithm service in the display interface. After receiving the user's enable operation for the target computer vision algorithm service, a plurality of container task details to be executed can be generated in response to the enable operation according to the container parameters and algorithm parameters of the target computer vision algorithm service, and stored in the container task details table, wherein the container task details are used to describe how to configure and start the container for the algorithm service, that is, to guide the startup and creation of subsequent containers.
[0106] In an exemplary embodiment, the above step 204 may include the following steps:
[0107] According to the download address of the algorithm file in the algorithm parameter configuration table, and the container configuration information and instance number N recorded in the container parameter configuration table, N container task details are generated. The container task details include task status, container status, the container configuration information, and the download address of the algorithm file.
[0108] In the disclosed embodiment, in response to the user's activation operation for the target computer vision algorithm in the algorithm management center, the container management service's create container task details interface is called, and the container startup parameter field is encapsulated according to the container configuration information, the number of instances N, and the download address of the algorithm file in the algorithm parameter configuration table recorded in the container parameter configuration table, and N container task details are generated in the container task details table. Among them, each algorithm instance corresponds to a record in the container task details table, and each record contains the task status, container status, container configuration information, and the download address of the algorithm file. By having one algorithm instance correspond to one table record, independent control at the algorithm instance level is achieved, and the start and stop of multiple instances of the same algorithm can be independent of each other.
[0109] Step 206, obtaining target container task details from the container task detail table by asynchronously starting the task, and allocating target resources to the target container task details;
[0110] Step 208, downloading the base image of the target computer vision algorithm service from the image repository to the target server, creating and starting the target container based on the target resources, and downloading the algorithm file to the base image;
[0111] Step 210: Run the inference script in the base image to start the target computer vision algorithm service and register the target computer vision algorithm in the registration center.
[0112] In the disclosed embodiment, the asynchronous start task obtains the target container task details to be started from the container task details table, and then calls the routing selector interface to allocate target resources for the target container task details.
[0113] In an exemplary embodiment, as shown in FIG. 5 , in step 206, allocating target resources to the target container task details may include steps 502 to 504.
[0114] Step 502, collecting statistics on resource information of each server, and obtaining candidate servers that meet resource screening conditions from each server;
[0115] Step 504 : Determine a target GPU whose GPU memory availability satisfies the GPU memory screening condition from the GPUs of the candidate servers, and use the target GPU as a target resource for starting the target computer vision algorithm container.
[0116] For example, as shown in FIG6 , the resource information of the server is counted, including the resource status of multiple dimensions of GPU, CPU, and memory. The servers are sorted based on the remaining resources of each server, so as to select the server with the most idle resources as the candidate server. Exemplarily, the resource information is counted by executing Linux commands as an example, and the CPU information command iostat -c -o JSON 1 3 is obtained, the memory information free -m |grep 'memory' | awk '{print $2"|"$3"|"$7}' is obtained, and the GPU information nvidia-smi -q -x is obtained.
[0117] In an example, the resource screening conditions can be set as follows: CPU usage < 80%, memory free> container memory requirement parameter M, GPU video memory free> container video memory requirement parameter K, GPU idle rate> GPU usage parameter L, etc. Servers that meet the resource screening conditions are selected as candidate servers, and a list of graphics cards on all candidate servers that meet the conditions is summarized. The GPU video memory is sorted in reverse order, and the GPU with the largest GPU video memory free is selected as the target GPU, and the target GPU is selected as the target resource for starting the target computer vision algorithm container.
[0118] In the disclosed embodiment, GPU resource screening is performed in combination with container parameter requirements. Through an automatic routing selection strategy, it is possible to solve the problem that video memory allocation requires human participation when the algorithm service is started, which can greatly improve the integration efficiency of the algorithm and the scalability of the smart monitoring platform.
[0119] In an exemplary embodiment, as shown in FIG7 , after determining the target resource, the corresponding container instance can be set based on the algorithm parameter configuration table and the container parameter configuration table. For example, call the Docker API to create a container startup instance, set the base image identifier used by the algorithm, add CPU and memory usage restrictions, configure port mapping parameters, path mapping parameters, set the transmission parameters required by the built-in run.sh script of the base image, including the IP of the registration center, access to the target computer vision algorithm service IP address and port information, the GPU number used by the target computer vision algorithm service, the download address of the target computer vision algorithm and reasoning script, etc.
[0120] Call the Docker API to download the base image from the image repository to the locally created Docker environment according to the base image identifier, and call the Docker API to execute the container startup command run.sh to start the target container. In the embodiment of the present disclosure, Docker shields the underlying differences of the operating system, so that the same base image can run on Windows, Linux, and Mac.
[0121] After the target container is started, you can execute the run.sh internal commands in sequence to download the algorithm file to the base image based on the download address of the algorithm file, use the target resource specified by the GPU number, run the downloaded algorithm file, and start the target computer vision algorithm service.
[0122] The disclosed embodiment can control the start and stop of the algorithm container based on the Docker API. Because the computing power server is usually composed of several servers in a cluster, the target resources selected by the routing selector will appear on different servers. Through the Docker API, the algorithm container can be remotely started and stopped on the target server, solving the problem of starting and stopping the algorithm container across servers.
[0123] In an exemplary embodiment, in step 210, registering the target computer vision algorithm in the registration center may include:
[0124] Register the IP address and port information of the target computer vision algorithm in the registration center.
[0125] In the disclosed embodiment, after the target computer vision algorithm service is started, the algorithm itself will be registered to the registration center according to the parameters of the registration center passed by the run.sh script to complete the container startup. By registering the algorithm service with the help of the registration center, load balancing between multiple instances of the same algorithm service can be achieved. When the inference throughput of the algorithm service needs to be increased, rapid capacity expansion can be achieved by increasing the number of corresponding algorithm instances. Exemplarily, when the number of examples is 3, the target computer vision algorithm can be registered three times in the registration center for the same algorithm service. The three registrations correspond to the service identifier of the same target computer vision algorithm service, and correspond to different algorithm IP addresses and port information. In the subsequent process of calling the target computer vision algorithm service, load balancing between different instances of the same target computer vision algorithm service can be achieved through different algorithm IP addresses and port information.
[0126] The above-mentioned computer vision algorithm integration method obtains the algorithm file and parameter configuration file of the target computer vision algorithm service, and in response to the activation operation for the target computer vision algorithm service, generates at least one container task detail according to the container parameters and algorithm parameters in the parameter configuration file, and stores at least one container task detail in the container task detail table. The target container task details are obtained from the container task detail table by asynchronously starting the task, and the target resources are allocated to the target container task details. The base image of the target computer vision algorithm service is downloaded from the image repository to the target server, and the target container is created and started based on the target resources. The algorithm file is downloaded to the base image, and the reasoning script is run in the base image to start the target computer vision algorithm service, and the target computer vision algorithm is registered in the registration center for subsequent callers to call. By adopting the computer vision algorithm integration method provided in the embodiment of the present disclosure, the target computer vision algorithm can be automatically integrated into the smart monitoring platform by uploading the algorithm file and parameter configuration file of the target computer vision algorithm service to the smart monitoring platform. There is no need for R&D personnel to manually develop and adapt the new computer vision algorithm on the smart monitoring platform, which simplifies the algorithm integration process of the smart monitoring platform, reduces the manpower and time costs of the algorithm integration process, and increases the flexibility and efficiency of algorithm integration, thereby greatly improving the scalability of the smart monitoring platform.
[0127] In an exemplary embodiment, as shown in FIG. 8 , the method may further include:
[0128] Step 802, receiving a service request for scheduling a target computer vision algorithm service, the service request including target request parameters, the target request parameters being configured based on the algorithm request parameters in the algorithm parameter configuration table;
[0129] Step 804, according to the service identifier of the target computer vision algorithm service, obtain the IP address and port information of the target computer vision algorithm from the registration center, call the target computer vision algorithm service through the IP address and port information to process the target request parameters, and obtain and feedback the processing result.
[0130] In the disclosed embodiment, the algorithm request parameters of the target computer vision algorithm are stored in the algorithm parameter configuration table. When the smart monitoring platform uses the target computer vision algorithm, it can first obtain the algorithm parameter configuration table, and configure the target request parameters based on the algorithm request parameters of the request algorithm interface recorded in the algorithm parameter configuration table, supplement the necessary request parameters, or attach the extracted video frame converted into a base64 string. The integrated method of the computer vision algorithm provided by the disclosed embodiment solves the need for personalized request parameters of the algorithm service, and the image parameters passed to the algorithm are base64 strings, which solves the problem that images cannot be transmitted in HTTP requests.
[0131] Based on the service identifier of the target computer vision algorithm service carried in the service request, the algorithm IP address and port information of the target computer vision algorithm service load balancing can be obtained from the registration center, and the target request parameters can be passed to the target computer vision algorithm service for data processing through the HTTP interface specified by the algorithm IP address and port information, and the corresponding processing results can be obtained and fed back to realize the call of the target computer vision algorithm service. The intelligent monitoring platform synchronously waits for the processing results, determines whether there is an alarm, and stores the processing results in the alarm record table.
[0132] In the disclosed embodiment, the interaction between the caller and the algorithm service is completed through an HTTP interface with standardized input and output, which shields the language differences between the caller and the algorithm service implementer, and any algorithm that conforms to the standard input and output can be connected to the smart monitoring platform.
[0133] In an exemplary embodiment, the task status includes: a waiting state, an entering running state, a waiting end state, and an end state. The method further includes:
[0134] After the container task details are generated, the task status of the container task details is recorded in the container task details table as a pending execution status;
[0135] The asynchronous task obtains the target container task details in the waiting state from the container task details table, and after starting the target container according to the target container task details, changes the task state of the container task details in the container task details table to the entering running state;
[0136] In response to the deactivation operation on the target computer vision algorithm service, the task status of the container task details in the waiting state and the running state in the container task detail table is changed to the waiting state;
[0137] By asynchronously deactivating the task, the container task corresponding to the container task detail whose task status is to be ended in the container task detail table is ended, and the task status of the container task detail is changed to ended in the container task detail table.
[0138] Exemplarily, the task status transition is shown in FIG9 . After the container task details are generated, the task enters the waiting state, and the task status of the container task details is recorded as the waiting state (ready state) in the container task details table; asynchronously start the scheduled task, select the container task details with the task status of the waiting state from the container task details table every preset time (for example, 10s), call the Docker start API to start the container, and change the task status of the container task in the container task details table to the running state (running state); when the algorithm service needs to be terminated, for example, when the user receives the deactivation operation for the target computer vision algorithm service in the algorithm management center, the task status of the container task details in the waiting state and the running state is changed to the waiting state (clean state) in the container task details table.
[0139] As shown in Figure 10, the asynchronous stop task obtains the container task details with the task status of "to be ended" from the container task details table every preset time (for example, 10s), calls the Docker end API, ends the container task corresponding to the container task details, and updates the task status corresponding to the container task details in the container task details table to the end state (stop state). In the embodiment of the present disclosure, the problem that the start and stop of the algorithm container is difficult to be controlled by the platform is solved by changing four states.
[0140] The container status is the actual running status of the synchronized container. The container uploads the actual status to this field through the callback interface to solve the problem of inconsistency between the data in the table and the actual status. The necessary parameters when the container is running are used to configure the container and start the command. When the container is started, the basic image is selected based on the necessary parameters, the parameters are set, and the container is started. This is used to solve the problem of which image to use to start which algorithm service.
[0141] When the update algorithm configuration table is enabled, the task is not actually started at this time. The real startup is completed by the asynchronous task of the algorithm container. Every few seconds, a container task detail record to be started is obtained from the container task detail table. Since the deactivation time of the synchronous container is affected by the number of instances, the more instances there are, the slower it stops, which affects the user experience. In the embodiment of the present disclosure, a waiting state is added, and the start and stop of the container is controlled by the asynchronous task, which solves the problem of response timeout due to slow algorithm startup, and can give users a better experience.
[0142] In order to enable those skilled in the art to better understand the embodiments of the present disclosure, the embodiments of the present disclosure are described below through specific examples.
[0143] As shown in Figure 11, the operating environment of the computer vision algorithm can be constructed as a general algorithm service basic image; the computer vision algorithm model and reasoning script are encapsulated into a Web algorithm service, the Web server gateway interface is used to manage the Web algorithm service, the input and output parameters of the algorithm service reasoning interface are standardized, and reasoning services are provided to the smart monitoring platform through the HTTP interface. All scripts and model files required for the algorithm service runtime constitute an algorithm file; the algorithm service configuration parameters and the algorithm service container operating parameters are written as a parameter configuration file; the algorithm file and the parameter configuration file are compressed together into a compressed file, the compressed file is imported into the smart monitoring platform, the parameter configuration file and the algorithm file are parsed, and stored, and the algorithm enters the waiting state.
[0144] As shown in Figure 12, in the algorithm management center, the enable button of the algorithm is triggered, and according to the configured container parameters and algorithm parameters, multiple container task details to be executed are generated and stored in the table. The task execution timer and the asynchronous task timing obtain the tasks to be executed from the container task detail table, and the routing selector selects the optimal GPU to start the algorithm container; when calling the algorithm inference service, first assemble the standardized request parameters, obtain the address of the algorithm service from the registration center, call the API of the algorithm service corresponding to the address, and return the standard result after inference; after using the algorithm, click the algorithm deactivate button in the algorithm management center, the task status is marked as the cleanup status, and the container is stopped through the asynchronous task to release the resources occupied by the container.
[0145] By adopting the algorithm integration method of the computer vision algorithm provided in the embodiment of the present disclosure, the plug-and-play of the algorithm can be realized, and the problem that the server needs to modify the code to adapt the new algorithm can be solved; through the automatic routing selection strategy, the problem that the video memory allocation needs human participation when the algorithm service is started can be solved; by formulating the algorithm input standard, output standard, and service mode requirements, the access compatible with any algorithm can be achieved.
[0146] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0147] Based on the same inventive concept, the embodiment of the present application also provides an integrated device for implementing the above-mentioned integrated method of computer vision algorithms. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in the embodiments of the integrated device for one or more computer vision algorithms provided below can be referred to the limitations of the integrated method of computer vision algorithms above, and will not be repeated here.
[0148] In an exemplary embodiment, as shown in FIG. 13 , an integrated device for a computer vision algorithm is provided, comprising: an acquisition module 1302 , a generation module 1304 , a resource allocation module 1306 , a download module 1308 and a registration module 1310 , wherein:
[0149] An acquisition module 1302 is used to acquire an algorithm file and a parameter configuration file of a target computer vision algorithm service, wherein the algorithm file includes an inference script and a target computer vision algorithm;
[0150] A generating module 1304 is used to generate at least one container task detail in response to an activation operation for the target computer vision algorithm service according to the container parameters and the algorithm parameters in the parameter configuration file, and store the at least one container task detail in a container task detail table;
[0151] A resource allocation module 1306 is used to obtain target container task details from the container task detail table by asynchronously starting a task, and allocate target resources to the target container task details;
[0152] A download module 1308 is used to download the base image of the target computer vision algorithm service from the image repository to the target server, create and start a target container based on the target resource, and download the algorithm file to the base image;
[0153] The registration module 1310 is used to run the reasoning script in the basic image to start the target computer vision algorithm service and register the target computer vision algorithm in a registration center.
[0154] By adopting the integrated device of the computer vision algorithm provided by the embodiment of the present disclosure, the target computer vision algorithm can be automatically integrated into the smart monitoring platform by uploading the algorithm file and parameter configuration file of the target computer vision algorithm service to the smart monitoring platform, without the need for R&D personnel to manually develop and adapt the new computer vision algorithm on the smart monitoring platform, simplifying the process of integrating the algorithm of the smart monitoring platform, reducing the manpower cost and time cost of the algorithm integration process, and making the algorithm integration more flexible and efficient, greatly improving the scalability of the smart monitoring platform. In addition, the integrated device of the computer vision algorithm provided in this case can realize the plug-and-play of the algorithm by one-click import of the compressed files of the algorithm file and the parameter configuration file, reducing the complexity of the integrated algorithm of the smart monitoring platform. At least one container task detail is generated through the parameter configuration file, and the container creation is controlled through the container task detail. Since one algorithm instance corresponds to a table record of a container task detail, independent control at the algorithm instance level can be achieved, and then the start and stop of multiple instances of the same algorithm can be achieved independently, greatly improving the flexibility of algorithm start and stop.
[0155] In one embodiment, the acquisition module 1302 is further used to:
[0156] Get the data compression package of the target computer vision algorithm service;
[0157] Decompressing the data compression package to obtain the algorithm file and parameter configuration file of the target computer vision algorithm service;
[0158] Generate a container parameter configuration table based on the container parameters in the parameter configuration file, and generate an algorithm parameter configuration table based on the algorithm parameters in the parameter configuration file;
[0159] The algorithm file is uploaded to the target server, and the download address of the algorithm file is recorded in the algorithm parameter configuration table.
[0160] In one embodiment, the generating module 1304 is further configured to:
[0161] According to the download address of the algorithm file in the algorithm parameter configuration table, and the container configuration information and the number of instances N recorded in the container parameter configuration table, N container task details are generated, and the container task details include task status, container status, the container configuration information, and the download address of the algorithm file.
[0162] In one embodiment, the resource allocation module 1306 is further configured to:
[0163] Collecting statistics on resource information of each server, and obtaining candidate servers that meet resource screening conditions from each server;
[0164] A target GPU whose GPU video memory free space satisfies a GPU video memory screening condition is determined from the GPUs of the candidate servers, and the target GPU is used as a target resource for starting the target computer vision algorithm container.
[0165] In one embodiment, the registration module 1310 is further used to:
[0166] Register the IP address and port information of the target computer vision algorithm in the registration center.
[0167] In one embodiment, the device further comprises:
[0168] The receiving module is further used to receive a service request for scheduling the target computer vision algorithm service, wherein the service request includes a target request parameter, and the target request parameter is configured based on the algorithm request parameter in the algorithm parameter configuration table;
[0169] The scheduling module is used to obtain the IP address and port information of the target computer vision algorithm from the registration center according to the service identifier of the target computer vision algorithm service, call the target computer vision algorithm service through the IP address and port information to process the target request parameters, and obtain and feedback the processing results.
[0170] In one embodiment, the task status includes: a waiting state, an entering running state, a waiting state, and an ending state. The device further includes: a task status management module, and the task status management module is used to:
[0171] After the container task details are generated, the task status of the container task details is recorded in the container task details table as a pending execution status;
[0172] The asynchronous task obtains the target container task details in the waiting state from the container task details table, and after starting the target container according to the target container task details, changes the task state of the container task details in the container task details table to entering the running state;
[0173] In response to a deactivation operation on the target computer vision algorithm service, changing the task status of the container task details in the container task list that are in a pending state and in a running state to a pending end state;
[0174] By asynchronously deactivating the task, the container task corresponding to the container task detail whose task status is to be ended in the container task detail table is ended, and the task status of the container task detail is changed to ended in the container task detail table.
[0175] In one of the embodiments, the parameter configuration file includes algorithm service configuration parameters and algorithm service container operating parameters; wherein the algorithm service configuration parameters include the algorithm identifier of the target computer vision algorithm, the service identifier of the target computer vision algorithm service, and algorithm request parameters; the algorithm service container operating parameters include resource constraints, number of instances, image identifier, and path mapping parameters when the target container of the target computer vision algorithm is started.
[0176] Each module in the integrated device of the above-mentioned computer vision algorithm can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0177] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG14. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a method for integrating a computer vision algorithm is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0178] Those skilled in the art will understand that the structure shown in FIG. 14 is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0179] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0180] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0181] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0182] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0183] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0184] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0185] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An integration method for computer vision algorithms, It is characterized in that The method comprises: Obtain an algorithm file and a parameter configuration file of a target computer vision algorithm service, wherein the algorithm file includes an inference script and a target computer vision algorithm; In response to an activation operation for the target computer vision algorithm service, generating at least one container task detail according to the container parameters and the algorithm parameters in the parameter configuration file, and storing the at least one container task detail in a container task detail table; Acquire target container task details from the container task detail table by asynchronously starting a task, and allocate target resources to the target container task details; Download the base image of the target computer vision algorithm service from the image repository to the target server, create and start the target container based on the target resources, and download the algorithm file to the base image; The inference script is run in the base image to start the target computer vision algorithm service, and the target computer vision algorithm is registered in a registration center.
2. The method according to claim 1, It is characterized in that The algorithm file and parameter configuration file of the target computer vision algorithm service are obtained, including: Get the data compression package of the target computer vision algorithm service; Decompressing the data compression package to obtain the algorithm file and parameter configuration file of the target computer vision algorithm service; Generate a container parameter configuration table based on the container parameters in the parameter configuration file, and generate an algorithm parameter configuration table based on the algorithm parameters in the parameter configuration file; The algorithm file is uploaded to the target server, and the download address of the algorithm file is recorded in the algorithm parameter configuration table.
3. The method according to claim 2, It is characterized in that The generating at least one container task detail according to the container parameters and algorithm parameters in the parameter configuration file includes: According to the download address of the algorithm file in the algorithm parameter configuration table, and the container configuration information and the number of instances N recorded in the container parameter configuration table, N container task details are generated, and the container task details include task status, container status, the container configuration information, and the download address of the algorithm file, where N is a positive integer.
4. The method according to any one of claims 1 to 3, It is characterized in that The allocating target resources to the target container task details includes: Collecting statistics on resource information of each server, and obtaining candidate servers that meet resource screening conditions from each server; A target GPU whose GPU video memory free space satisfies a GPU video memory screening condition is determined from the GPUs of the candidate servers, and the target GPU is used as a target resource for starting the target computer vision algorithm container.
5. The method according to claim 3, It is characterized in that The step of registering the target computer vision algorithm in a registration center includes: Register the IP address and port information of the target computer vision algorithm in the registration center.
6. The method according to claim 5, It is characterized in that The method further comprises: Receiving a service request for scheduling the target computer vision algorithm service, the service request including a target request parameter, the target request parameter being configured based on the algorithm request parameter in the algorithm parameter configuration table; According to the service identifier of the target computer vision algorithm service, the IP address and port information of the target computer vision algorithm are obtained from the registration center, and the target computer vision algorithm service is called through the IP address and port information to process the target request parameters, and the processing result is obtained and fed back.
7. The method according to claim 3, It is characterized in that The task status includes: waiting to be executed, entering running, waiting to end, and ending. The method further includes: After the container task details are generated, the task status of the container task details is recorded in the container task details table as a pending execution status; The asynchronous task obtains the target container task details in the waiting state from the container task details table, and after starting the target container according to the target container task details, changes the task state of the container task details in the container task details table to entering the running state; In response to a deactivation operation on the target computer vision algorithm service, changing the task status of the container task details in the container task list that are in a pending state and in a running state to a pending end state; By asynchronously deactivating the task, the container task corresponding to the container task detail whose task status is to be ended in the container task detail table is ended, and the task status of the container task detail is changed to ended in the container task detail table.
8. The method according to claim 1, It is characterized in that The parameter configuration file includes algorithm service configuration parameters and algorithm service container operating parameters; wherein the algorithm service configuration parameters include the algorithm identifier of the target computer vision algorithm, the service identifier of the target computer vision algorithm service, and algorithm request parameters; the algorithm service container operating parameters include resource constraints, number of instances, image identifier, and path mapping parameters when the target container of the target computer vision algorithm is started.
9. An integrated device for computer vision algorithms, It is characterized in that The device comprises: An acquisition module, used to acquire an algorithm file and a parameter configuration file of a target computer vision algorithm service, wherein the algorithm file includes an inference script and a target computer vision algorithm; a generating module, configured to generate at least one container task detail in response to an activation operation for the target computer vision algorithm service, according to the container parameters and the algorithm parameters in the parameter configuration file, and store the at least one container task detail in a container task detail table; A resource allocation module, used for acquiring target container task details from the container task detail table by asynchronously starting tasks, and allocating target resources to the target container task details; A download module, used to download the base image of the target computer vision algorithm service from the image repository to the target server, create and start the target container based on the target resource, and download the algorithm file to the base image; A registration module is used to run the inference script in the base image to start the target computer vision algorithm service and register the target computer vision algorithm in a registration center.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
12. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Algorithm file processing method, device and system
CN110347389A
Docker-based remote sensing intelligent processing algorithm management method
CN112527319A
Algorithm software starting method and device, storage medium and electronic device
CN113721944A
Cloud service implementation method and apparatus
WO2023246398A1
