Algorithm model deployment method, device, readable medium and electronic device

By separating the application and algorithm models and using Docker mirroring and load balancing technology, multiple algorithm models are integrated into one image, solving the problems of hardware resource exclusivity and maintenance difficulties, realizing resource sharing and cost savings.

CN114661412BActive Publication Date: 2025-08-19BEIJING KANSHI HIGH-TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210178874.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-25
Publication Date
2025-08-19
Estimated Expiration
2042-02-25

AI Technical Summary

Technical Problem

In the existing algorithm model deployment scheme, each algorithm model needs to apply for hardware resources separately, resulting in the inability to share resources, the hardware cost is large and the algorithm application maintenance is difficult.

Method used

Separate the application and algorithm model, integrate multiple algorithm models into one image through Docker image, each algorithm model corresponds to a middleware, uses algorithm model table to manage the load state, and deploy it through load balancing technology.

Benefits of technology

Resource sharing of algorithm models is realized, hardware cost expenditure is reduced, and application maintenance process is simplified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114661412B_ABST
    Figure CN114661412B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the field of Docker container technology, and specifically, to an algorithm model deployment method, device, readable medium, and electronic device. The algorithm model deployment method, device, readable medium, and electronic device separate the application and the algorithm model. Each application can integrate multiple algorithm models, and multiple algorithm models and an application can be packaged and encapsulated into a Docker image. Therefore, in the solution provided by the embodiment of the present disclosure, each algorithm model does not need to apply for hardware resources separately, and resources can be shared. Moreover, as the number of algorithm models increases, there is no need to increase the number of applications, which saves hardware cost expenditure and is also beneficial to the maintenance of the application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Docker container technology, and in particular, to an algorithm model deployment method, device, readable medium, and electronic device. Background Art

[0002] like Figure 1 As shown in the figure, the existing algorithm model deployment solution is: each algorithm model has its own set of algorithm applications, and each algorithm application and algorithm model are packaged into a Docker image.

[0003] The existing algorithm model deployment solution has the following shortcomings:

[0004] Each algorithm model requires a separate hardware resource application, monopolizing the resources and preventing resource sharing. Furthermore, as the number of algorithm models increases, hardware costs increase significantly. Each algorithm model corresponds to a set of algorithm applications. Multiple algorithm models require multiple algorithm applications, which often overlap. This overlap requires multiple rewrites, and having too many algorithm applications also hinders maintenance. Summary of the Invention

[0005] The purpose of the present disclosure is to provide an algorithm model deployment method, device, readable medium and electronic device that separate applications and algorithm models, so as to solve the problems of resource sharing, high hardware cost expenditure and difficulty in application maintenance.

[0006] To achieve the above objectives, the present disclosure provides an algorithm model deployment method, the method comprising:

[0007] The application is packaged and encapsulated to build a Docker image, wherein at least two algorithm middlewares are set in the application, each of the algorithm middlewares corresponds to an algorithm model, each of the algorithm models is deployed outside the Docker image, and each of the algorithm middlewares is used to load the corresponding algorithm model into the application.

[0008] Optionally, an algorithm model table is further provided in the application, and the algorithm model table is used to store the algorithm models loaded into the application and display the loading status of each algorithm model in the application. The method further includes:

[0009] After loading each algorithm model, the application records the status of the algorithm model as loaded in the algorithm model table.

[0010] Optionally, the method further includes:

[0011] When the application is started, the algorithm models used in the last preset number of days are loaded into the algorithm model table according to the usage of each algorithm model.

[0012] Optionally, the method further includes:

[0013] When calling each of the algorithm middleware, the application queries the algorithm model table, and when it is determined that the algorithm model corresponding to the called algorithm middleware is not in the algorithm model table, and the corresponding algorithm model is on the physical machine where the Docker image is located, the algorithm model is loaded from the physical machine to the algorithm model table.

[0014] Optionally, the method further includes:

[0015] When calling each of the algorithm middleware, the application queries the algorithm model table, and when it is determined that the algorithm model corresponding to the called algorithm middleware is not in the algorithm model table, and the corresponding algorithm model is not in the physical machine where the Docker image is located, the algorithm model is downloaded from the cloud repository to the physical machine and then loaded into the algorithm model table.

[0016] Optionally, the method further includes:

[0017] When the memory occupancy rate of the physical machine where the application is located is greater than a preset threshold, the unused algorithm models in the algorithm model table are uninstalled.

[0018] The present disclosure also provides an algorithm model deployment device, the device comprising:

[0019] The image building module is used to package and encapsulate the application to build a Docker image, wherein at least two algorithm middlewares are set in the application, each of the algorithm middlewares corresponds to an algorithm model, each of the algorithm models is deployed outside the Docker image, and each of the algorithm middlewares is used to load the corresponding algorithm model into the application.

[0020] Optionally, an algorithm model table is further provided in the application, the algorithm model table is used to store the algorithm models loaded into the application, and to display the loading status of each algorithm model in the application. The device further includes:

[0021] The recording module is used for recording the status of each algorithm model as loaded in the algorithm model table after the application loads the algorithm model.

[0022] The present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which implements the steps of the above method when executed by a processor.

[0023] The present disclosure also provides an electronic device, comprising:

[0024] a memory having a computer program stored thereon;

[0025] A processor is used to execute the computer program in the memory to implement the steps of the above method.

[0026] Through the above technical solution, applications and algorithm models are separated. Each application can integrate multiple algorithm models, and multiple algorithm models and an application can be packaged and encapsulated into a single Docker image. Therefore, the solution provided by the embodiment of the present disclosure does not require each algorithm model to apply for hardware resources separately, and resources can be shared. Moreover, the number of algorithm models can be increased without adding more applications, saving hardware costs and facilitating application maintenance.

[0027] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following detailed description, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:

[0029] Figure 1 It is a schematic diagram of the existing algorithm model deployment solution.

[0030] Figure 2 This is a flowchart of an algorithm model deployment method provided by an embodiment of the present disclosure.

[0031] Figure 3 This is an application diagram of an algorithm model deployment method provided by an embodiment of the present disclosure.

[0032] Figure 4 It is a block diagram of an algorithm model deployment device provided by an embodiment of the present disclosure.

[0033] Figure 5 It is a block diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0034] The following describes the specific embodiments of the present disclosure in detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present disclosure and are not intended to limit the present disclosure.

[0035] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0036] The embodiments of the present disclosure provide an algorithm model deployment method. Figure 2 This is a flow chart of an algorithm model deployment method according to an embodiment of the present disclosure. Figure 2 As shown, the method includes the following steps:

[0037] Step S10: Package and encapsulate the application to build a Docker image. The application is provided with at least two algorithm middlewares. Each of the algorithm middlewares corresponds to an algorithm model. Each of the algorithm models is deployed outside the Docker image. Each of the algorithm middlewares is used to load the corresponding algorithm model into the application.

[0038] The algorithm middleware may be an inference program for each algorithm model. By calling the algorithm middleware, the algorithm model corresponding to the called algorithm middleware can be loaded into the application.

[0039] Through the above configuration, applications and algorithm models are separated. Each application can integrate multiple algorithm models, achieving the effect of packaging multiple algorithm models and one application into a single Docker image. Therefore, the solution provided by the embodiments of the present disclosure eliminates the need to apply for separate hardware resources for each algorithm model, enabling resource sharing. Furthermore, increasing the number of algorithm models does not require adding additional applications, saving hardware costs and facilitating application maintenance.

[0040] Optionally, the application is further provided with an algorithm model table, the algorithm model table being used to store the algorithm models loaded into the application and to display the loading status of each algorithm model in the application. The loading status includes loaded and unloaded. The method further includes:

[0041] After loading each algorithm model, the application records the status of the algorithm model as loaded in the algorithm model table.

[0042] Similarly, the method may further include: after the application program uninstalls each algorithm model, recording the status of the algorithm model as unloaded in the algorithm model table.

[0043] In the above technical solution, the algorithm model table is used to uniformly manage and record the loading of the algorithm model in the application, which is more intuitive and convenient.

[0044] Optionally, the method further includes: when the application is started, based on the usage of each algorithm model, loading the algorithm models used within the last preset number of days into the algorithm model table.

[0045] Among them, the most recent preset number of days is the number of days from the current preset number, which can be set flexibly, and can be the most recent day, the most recent two days, the most recent three days, the most recent four days, etc. For example, if the most recent preset number of days is the most recent day, then the above scheme is that when the application is started, the algorithm models used in the most recent day are loaded into the algorithm model table according to the usage of each of the algorithm models. Through the above setting, when the algorithm model is not called, the most recently used algorithm model can be loaded into the application (memory) in advance, which is convenient for users to use. Similarly, the loading and unloading of algorithm models in the application can be managed according to the LRU (Least Recently Used) algorithm. Through the above technical solution, for an application, when it is started, it can not fully load the algorithm model corresponding to the algorithm middleware, and can load some or not load the algorithm model in advance as needed (the algorithm model is loaded only when the algorithm model is called), thereby reducing memory occupancy.

[0046] Optionally, the method further includes:

[0047] When calling each of the algorithm middleware, the application queries the algorithm model table, and when it is determined that the algorithm model corresponding to the called algorithm middleware is not in the algorithm model table, and the corresponding algorithm model is on the physical machine where the Docker image is located, the algorithm model is loaded from the physical machine to the algorithm model table.

[0048] The algorithm model can be stored in a local physical machine, for example, a model pool is constructed in the local physical machine to store multiple algorithm models. Of course, the algorithm model can also be stored in a cloud repository, and when needed, the algorithm model is downloaded from the cloud repository to the local physical machine. When calling each of the algorithm middleware, the application queries the algorithm model table to determine whether the algorithm model corresponding to the called algorithm middleware is in the algorithm model table. If the algorithm model is in the algorithm model table, the algorithm model can be used directly. If the algorithm model is not in the algorithm model table, determine whether the algorithm model is in the local physical machine. If the algorithm model is in the local physical machine, load the algorithm model from the physical machine to the algorithm model table. If the algorithm model is not in the local physical machine, download the algorithm model from the cloud repository to the local physical machine, and then load it from the local physical machine to the algorithm model table.

[0049] Therefore, optionally, the method further comprises:

[0050] When calling each of the algorithm middleware, the application queries the algorithm model table, and when it is determined that the algorithm model corresponding to the called algorithm middleware is not in the algorithm model table, and the corresponding algorithm model is not in the physical machine where the Docker image is located, the algorithm model is downloaded from the cloud repository to the physical machine and then loaded into the algorithm model table.

[0051] Optionally, the method further includes:

[0052] When the memory occupancy rate of the physical machine where the application is located is greater than a preset threshold, the unused algorithm models in the algorithm model table are uninstalled.

[0053] Through the above technical solution, when the physical machine memory cannot meet the usage requirements, the application program will remove non-essential algorithm models from the memory according to the algorithm model registry to release resources.

[0054] Obviously, the solution provided by the embodiment of the present disclosure is as follows: Figure 3 As shown, each application can load the algorithm model based on load balancing technology. And each Docker image can also be deployed on the physical machine based on load balancing technology.

[0055] Based on the above-mentioned inventive concept, the embodiment of the present disclosure also provides an algorithm model deployment device. Figure 4 FIG. 1 is a block diagram of an algorithm model deployment device according to an embodiment of the present disclosure. Figure 4 As shown, the algorithm model deployment device includes:

[0056] The image building module is used to package and encapsulate the application to build a Docker image, wherein at least two algorithm middlewares are set in the application, each of the algorithm middlewares corresponds to an algorithm model, each of the algorithm models is deployed outside the Docker image, and each of the algorithm middlewares is used to load the corresponding algorithm model into the application.

[0057] Through the above configuration, applications and algorithm models are separated. Each application can integrate multiple algorithm models, achieving the effect of packaging multiple algorithm models and one application into a single Docker image. Therefore, the solution provided by the embodiments of the present disclosure eliminates the need to apply for separate hardware resources for each algorithm model, enabling resource sharing. Furthermore, increasing the number of algorithm models does not require adding additional applications, saving hardware costs and facilitating application maintenance.

[0058] Optionally, an algorithm model table is further provided in the application, the algorithm model table is used to store the algorithm models loaded into the application, and to display the loading status of each algorithm model in the application. The device further includes:

[0059] The recording module is used to enable the application to record the status of each algorithm model as loaded in the algorithm model table after loading the algorithm model.

[0060] In the above technical solution, the algorithm model table is implemented through the recording module to uniformly manage and record the loading of the algorithm model in the application, which is more intuitive and convenient.

[0061] Optionally, the device further comprises:

[0062] The loading module is used to load the algorithm models used within the last preset number of days into the algorithm model table according to the usage of each algorithm model when the application is started.

[0063] Through the above technical solution, for an application, when it starts, it does not need to fully load the algorithm model corresponding to the algorithm middleware. It can load some or not load the algorithm model in advance as needed (the algorithm model is only loaded when it is called), thereby reducing memory usage.

[0064] The device further comprises:

[0065] A query module is used to enable the application to query the algorithm model table when calling each of the algorithm middleware, and when it is determined that the algorithm model corresponding to the called algorithm middleware is not in the algorithm model table, and the corresponding algorithm model is on the physical machine where the Docker image is located, load the algorithm model from the physical machine to the algorithm model table.

[0066] The query module is also used to:

[0067] When calling each of the algorithm middleware, the application queries the algorithm model table, and when it is determined that the algorithm model corresponding to the called algorithm middleware is not in the algorithm model table, and the corresponding algorithm model is not in the physical machine where the Docker image is located, the algorithm model is downloaded from the cloud repository to the physical machine and then loaded into the algorithm model table.

[0068] The device further comprises:

[0069] The uninstall module is used to uninstall the unused algorithm models in the algorithm model table when the memory occupancy rate of the physical machine where the application is located is greater than a preset threshold.

[0070] Through the above technical solution, when the physical machine memory cannot meet the usage requirements, the application program will remove non-essential algorithm models from the memory according to the algorithm model registry to release resources.

[0071] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0072] Figure 5 1 is a block diagram of an electronic device 1900 according to an exemplary embodiment. For example, the electronic device 1900 may be provided as a server. Figure 5 The electronic device 1900 includes a processor 1922, which may be one or more, and a memory 1932 for storing a computer program executable by the processor 1922. The computer program stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processor 1922 may be configured to execute the computer program to perform the above-mentioned algorithm model deployment method.

[0073] In addition, the electronic device 1900 may further include a power supply component 1926 and a communication component 1950. The power supply component 1926 may be configured to perform power management of the electronic device 1900, and the communication component 1950 may be configured to implement communication of the electronic device 1900, for example, wired or wireless communication. In addition, the electronic device 1900 may further include an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2003. TM , Mac OS X TM , Unix TM , Linux TM etc.

[0074] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided. When executed by a processor, the program instructions implement the steps of the algorithm model deployment method described above. For example, the non-transitory computer-readable storage medium may be the memory 1932 including the program instructions described above. The program instructions may be executed by the processor 1922 of the electronic device 1900 to perform the algorithm model deployment method described above.

[0075] In another exemplary embodiment, a computer program product is also provided, which includes a computer program that can be executed by a programmable device, and the computer program has a code portion for executing the above-mentioned algorithm model deployment method when executed by the programmable device.

[0076] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings. However, the present disclosure is not limited to the specific details of the above embodiments. Within the technical concept of the present disclosure, various simple modifications can be made to the technical solutions of the present disclosure, and these simple modifications all fall within the scope of protection of the present disclosure.

[0077] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any appropriate manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.

[0078] In addition, the various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.

Claims

1. A method for deploying an algorithm model, characterized in that: The method includes: packaging and encapsulating an application to construct a Docker image, wherein at least two algorithm middlewares are provided in the application, each of the algorithm middlewares corresponds to an algorithm model, each of the algorithm models is deployed outside the Docker image, and each of the algorithm middlewares is used to load the corresponding algorithm model into the application; The application is further provided with an algorithm model table, the algorithm model table being used to store the algorithm models loaded into the application and to display the loading status of each algorithm model in the application. The method further comprises: When the application is started, the algorithm models used in the last preset number of days are loaded into the algorithm model table according to the usage of each algorithm model.

2. The algorithm model deployment method according to claim 1, characterized in that: The method further comprises: After loading each algorithm model, the application records the status of the algorithm model as loaded in the algorithm model table.

3. The algorithm model deployment method according to claim 1, characterized in that: The method further comprises: When calling each of the algorithm middleware, the application queries the algorithm model table, and when it is determined that the algorithm model corresponding to the called algorithm middleware is not in the algorithm model table, and the corresponding algorithm model is on the physical machine where the Docker image is located, the algorithm model is loaded from the physical machine to the algorithm model table.

4. The algorithm model deployment method according to claim 1, characterized in that: The method further comprises: When calling each of the algorithm middleware, the application queries the algorithm model table, and when it is determined that the algorithm model corresponding to the called algorithm middleware is not in the algorithm model table, and the corresponding algorithm model is not in the physical machine where the Docker image is located, the algorithm model is downloaded from the cloud repository to the physical machine and then loaded into the algorithm model table.

5. The algorithm model deployment method according to claim 1, characterized in that: The method further comprises: When the memory occupancy rate of the physical machine where the application is located is greater than a preset threshold, the unused algorithm models in the algorithm model table are uninstalled.

6. An algorithm model deployment device, characterized in that: The device comprises: An image building module is used to package and encapsulate the application to build a Docker image, wherein the application is provided with at least two algorithm middlewares, each of which corresponds to an algorithm model, each of which is deployed outside the Docker image, and each of which is used to load the corresponding algorithm model into the application; The application is further provided with an algorithm model table, the algorithm model table being used to store the algorithm models loaded into the application and to display the loading status of each algorithm model in the application. The device further comprises: The loading module is used to load the algorithm models used within the last preset number of days into the algorithm model table according to the usage of each algorithm model when the application is started.

7. The algorithm model deployment device according to claim 6, characterized in that: The device further comprises: The recording module is used for recording the status of each algorithm model as loaded in the algorithm model table after the application loads the algorithm model.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

9. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Delivery method and device based on Docker software and hardware integration

    CN111831396A

  • Method for dynamically loading algorithm in Android application

    CN112596821A

  • Method and device for deploying application

    CN113407203A