Model deployment method and device, electronic device and storage medium
By encapsulating the deep learning algorithm into an algorithm container image and defining the interface functions of each stage, the problems of complex, slow and high error rates in the existing technology are solved, and fast and accurate model deployment is achieved.
Patent Information
- Application Number
- CN202110569859.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-25
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-05-25
AI Technical Summary
When the existing technology requires the use of different deep learning algorithms in complex scenarios, the model deployment logic is complex, slow and prone to human errors.
By encapsulating the target deep learning algorithm into an algorithm container image and defining interface functions at each stage in the image, model training, evaluation and transformation can be implemented, so as to quickly build a workflow and complete model deployment.
Simplifies the logic of model deployment, improves deployment speed and accuracy, and reduces human-adjusting errors.
Smart Images

Figure CN113342361B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer vision technology, and in particular to a model deployment method and device, an electronic device, and a storage medium. Background Art
[0002] For complex scenarios, different deep learning algorithms are often required to be used in combination. Therefore, for an intelligent AI training platform, it is very important to be able to quickly access different deep learning algorithms and implement the engineering implementation of the algorithms.
[0003] At present, for different deep learning algorithms, it is necessary to pay attention to the underlying details in order to implement their various stages of the process and complete the model deployment. Not only is the integration logic complex and the model deployment slow, but it also requires manual adjustments and is prone to errors. Summary of the invention
[0004] The embodiments of the present disclosure are intended to provide a model deployment method and device, an electronic device, and a storage medium.
[0005] The technical solution of the embodiment of the present disclosure is implemented as follows:
[0006] The present disclosure provides a model deployment method, the method comprising:
[0007] Encapsulating the target deep learning algorithm into an algorithm container image; wherein the algorithm container image includes at least one interface function corresponding to at least one stage of the target deep learning algorithm;
[0008] From the algorithm container image, call the at least one interface function to execute the at least one stage to obtain a target model.
[0009] In the above model deployment method, the target deep learning algorithm is encapsulated into an algorithm container image, including:
[0010] Performing container image packaging on the target deep learning algorithm to obtain a first container image;
[0011] Abstract encapsulation of the interface functions of the at least one stage is performed on the first container image to obtain the algorithm container image.
[0012] In the above-mentioned model deployment method, the at least one stage includes: a model training stage, a model evaluation stage and a model conversion stage, the at least one interface function includes: a first interface function corresponding to the model training stage, a second interface function corresponding to the model evaluation stage, and a third interface function corresponding to the model conversion stage, and calling the at least one interface function from the algorithm container image to execute the at least one stage to obtain the target model includes:
[0013] From the algorithm container image, calling the first interface function to perform model training to obtain an algorithm model;
[0014] From the algorithm container image, calling the second interface function to perform model evaluation on the algorithm model to obtain a model evaluation result;
[0015] When the model evaluation result meets the preset model effect condition, the third function interface is called from the algorithm container image to convert the algorithm model to obtain the target model.
[0016] In the above-mentioned model deployment method, the first interface function includes: a data set interface function, an optimizer interface function, a learning rate adjustment interface function, a loss function interface function and a back propagation interface function;
[0017] The second interface function includes: the data set interface function and the evaluation index interface function;
[0018] The third interface function includes: a model conversion interface function.
[0019] In the above-mentioned model deployment method, after calling the at least one interface function from the algorithm container image to execute the at least one stage and obtaining the target model, the method further includes:
[0020] Obtain a model reasoning verification image corresponding to the target deep learning algorithm;
[0021] The model reasoning verification image is used to perform reasoning verification on the target model to obtain a reasoning verification result.
[0022] The present disclosure provides a model deployment device, including:
[0023] A packaging module, used to package the target deep learning algorithm into an algorithm container image; wherein the algorithm container image includes at least one interface function corresponding to at least one stage of the target deep learning algorithm;
[0024] A deployment module is used to call the at least one interface function from the algorithm container image to execute the at least one stage and obtain a target model.
[0025] In the above-mentioned model deployment device, the encapsulation module is specifically used to perform container image encapsulation on the target deep learning algorithm to obtain a first container image; and perform abstract encapsulation of the interface function of at least one stage on the first container image to obtain the algorithm container image.
[0026] In the above-mentioned model deployment device, the at least one stage includes: a model training stage, a model evaluation stage and a model conversion stage, and the at least one interface function includes: a first interface function corresponding to the model training stage, a second interface function corresponding to the model evaluation stage, and a third interface function corresponding to the model conversion stage.
[0027] The deployment module is specifically used to call the first interface function from the algorithm container image to perform model training to obtain the algorithm model; call the second interface function from the algorithm container image to perform model evaluation on the algorithm model to obtain the model evaluation result; when the model evaluation result meets the preset model effect condition, call the third function interface from the algorithm container image to convert the algorithm model to obtain the target model.
[0028] In the above-mentioned model deployment device, the first interface function includes: a data set interface function, an optimizer interface function, a learning rate adjustment interface function, a loss function interface function and a back propagation interface function;
[0029] The second interface function includes: the data set interface function and the evaluation index interface function;
[0030] The third interface function includes: a model conversion interface function.
[0031] In the above-mentioned model deployment device, the deployment module is also used to obtain the model reasoning verification image corresponding to the target deep learning algorithm; use the model reasoning verification image to perform reasoning verification on the target model to obtain a reasoning verification result.
[0032] The present disclosure provides an electronic device, the electronic device comprising: a processor, a memory and a communication bus; wherein:
[0033] The communication bus is used to realize the connection and communication between the processor and the memory;
[0034] The processor is used to execute the model deployment program stored in the memory to implement the above-mentioned model deployment method.
[0035] An embodiment of the present disclosure provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the above-mentioned model deployment method.
[0036] The disclosed embodiments provide a model deployment method and device, an electronic device, and a storage medium, the method comprising: encapsulating a target deep learning algorithm into an algorithm container image; wherein the algorithm container image includes at least one interface function corresponding to at least one stage of the target deep learning algorithm; and calling at least one interface function from the algorithm container image to execute at least one stage to obtain a target model. The technical solution provided by the disclosed embodiments encapsulates a deep learning algorithm into an algorithm container image, quickly constructs a corresponding workflow, and the algorithm container image includes interface functions corresponding to each stage of the algorithm, which can quickly schedule the corresponding interface functions to complete model deployment, which not only makes the model deployment logic simple and fast, but also has a high accuracy rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A flowchart of a model deployment method provided by an embodiment of the present disclosure;
[0038] Figure 2 A schematic diagram of an exemplary workflow for industrial-grade model deployment provided in an embodiment of the present disclosure;
[0039] Figure 3 A schematic diagram of the structure of a model deployment device provided in an embodiment of the present disclosure;
[0040] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0041] The technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure.
[0042] The embodiment of the present disclosure provides a model deployment method, the execution subject of which may be a model deployment device, for example, the model deployment method may be executed by a terminal device or a server or other electronic device, wherein the terminal device may be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the model deployment method may be implemented by a processor calling a computer-readable instruction stored in a memory.
[0043] Figure 1 A flow chart of a model deployment method provided by an embodiment of the present disclosure. Figure 1 As shown, in the embodiment of the present disclosure, the model deployment method mainly includes the following steps:
[0044] S101. Encapsulate a target deep learning algorithm into an algorithm container image; wherein the algorithm container image includes at least one interface function corresponding to at least one stage of the target deep learning.
[0045] In an embodiment of the present disclosure, the model deployment device can encapsulate the target deep learning algorithm into an algorithm container image.
[0046] It should be noted that in the embodiments of the present disclosure, the target deep learning algorithm can be any deep learning algorithm. The specific target deep learning algorithm can be set according to actual needs and application scenarios, and the embodiments of the present disclosure are not limited.
[0047] Specifically, in an embodiment of the present disclosure, the model deployment device encapsulates the target deep learning algorithm into an algorithm container image, including: encapsulating the target deep learning algorithm into a container image to obtain a first container image; and abstractly encapsulating at least one stage of interface functions of the first container image to obtain an algorithm container image.
[0048] It can be understood that in the embodiments of the present disclosure, the model deployment device encapsulates the target deep learning algorithm into a first container image. The first container image itself is an underlying environment, and the target deep learning algorithm can be quickly accessed in the form of a virtualized image. The first container image performs interface function abstraction encapsulation of at least one stage of the target deep learning algorithm. Subsequently, a unified workflow can be used to call the interface function to implement the corresponding function call and complete the corresponding stage.
[0049] S102: Call at least one interface function from the algorithm container image to execute at least one stage to obtain a target model.
[0050] In an embodiment of the present disclosure, after obtaining the algorithm container image encapsulated by the target deep learning algorithm, the model deployment device can call at least one interface function corresponding to at least one stage of the target deep learning algorithm from the algorithm container image, execute at least one stage, and thus obtain the target model.
[0051] It should be noted that in the embodiments of the present disclosure, the algorithm container image may include interface functions corresponding to the three stages of the target deep learning algorithm, namely: model training stage, model evaluation stage and model conversion stage. Among them, the interface function corresponding to the model training stage is the first interface function, the interface function corresponding to the model evaluation stage is the second interface function, and the interface function corresponding to the model conversion stage is the third interface function.
[0052] Specifically, in an embodiment of the present disclosure, the model deployment device calls at least one interface function from the algorithm container image to execute at least one stage to obtain a target model, including: calling a first interface function from the algorithm container image to perform model training to obtain an algorithm model; calling a second interface function from the algorithm container image to perform model evaluation on the algorithm model to obtain a model evaluation result; when the model evaluation result meets the preset model effect condition, calling a third function interface from the algorithm container image to convert the algorithm model to obtain a target model.
[0053] It should be noted that in the embodiment of the present disclosure, the first interface function includes: a data set interface function, an optimizer interface function, a learning rate adjustment interface function, a loss function interface function, and a reverse interface function. The model deployment device can implement the model training phase by calling each specific interface function included in the first interface function and completing the content of each specific interface function.
[0054] It should be noted that in the embodiments of the present disclosure, the second interface function includes: a data set interface function and an evaluation index interface function, wherein, since the data set needs to be called for corresponding training in the model training stage, and the data set needs to be called for corresponding evaluation in the model evaluation stage, the data set interface function that implements the data set call involves both the model training stage and the model evaluation stage, and therefore, the data set interface function belongs to both the first interface function and the second interface function. The model deployment device calls the two specific interface functions included in the second interface function, completes the contents of the two interface functions, and can implement the evaluation of the algorithm model and obtain the model evaluation results. The model evaluation results characterize the pros and cons of the performance of the algorithm model.
[0055] It should be noted that in the embodiments of the present disclosure, if the model evaluation results meet the preset model effect conditions, it means that the performance of the algorithm model is excellent. Therefore, the model deployment device can continue to the subsequent model conversion stage. If the model evaluation results do not meet the preset model effect conditions, it means that the performance of the algorithm model is poor, which may be caused by inaccurate data sets called during the model training stage.
[0056] It should be noted that, in the embodiment of the present disclosure, the third interface function includes a model conversion interface function, which can convert the trained algorithm model into a model available for a specific platform, thereby obtaining a target model.
[0057] It should be noted that, in the embodiments of the present disclosure, the specific interface functions included in the above-mentioned first interface function, second interface function and third interface function are only exemplary functions provided, and the embodiments of the present disclosure do not limit the interface functions corresponding to different stages of the target deep learning algorithm.
[0058] In an embodiment of the present disclosure, after the model deployment device calls at least one interface function from the algorithm container image to execute at least one stage and obtains the target model, it can also perform the following steps: obtain the model reasoning verification image corresponding to the target deep learning algorithm; use the model reasoning verification image to perform reasoning verification on the target model to obtain the reasoning verification result.
[0059] It is understandable that in the embodiments of the present disclosure, after the model deployment device generates a usable target model, it can further perform reasoning verification on the target model, thereby characterizing the reasoning verification result of the target model performance. Of course, if the reasoning verification result characterizes that the target model has excellent performance, the target model can be further deployed in the platform that needs the model; if the reasoning verification result characterizes that the target model has poor performance, it can be adjusted and processed.
[0060] It can be understood that in the embodiments of the present disclosure, for each deep learning algorithm, the model deployment device can actually adopt the above-mentioned solution to implement model deployment, that is, use a unified interface function to implement the encapsulation of the functions of at least one stage of the algorithm, and encapsulate the deep learning algorithm into an algorithm container image to facilitate calling in the workflow. By calling the interface function, each stage of the algorithm can be executed to complete the entire process, and finally a usable model can be directly produced.
[0061] It should be noted that in the embodiments of the present disclosure, the above-mentioned model deployment method can be applied to various scenarios where model deployment needs to be implemented. For example, in complex industrial scenarios, it is usually necessary to use various deep learning algorithms to produce industrial-grade models. In industrial scenarios, the model deployment device can use the above model deployment method to produce industrial-grade models and realize industrial-grade model deployment.
[0062] Figure 2 The following is a workflow diagram of an exemplary industrial-level model deployment provided by the present disclosure. Figure 2As shown, in the scenario of industrial-grade model deployment, the deep learning algorithm used is the detection algorithm. The access and implementation of the industrial-grade model deployment of the detection algorithm is only a sub-workflow in a complete panoramic workflow. It can also have corresponding upstream and downstream workflows, which are not limited by the embodiments of the present disclosure. The algorithm container image of the detection algorithm includes interface functions corresponding to the three stages, among which, for the model training stage, it depends on the data set interface function, the optimizer interface function, the learning rate adjustment interface function, the loss function interface function and the back propagation interface function. For the model evaluation stage, it depends on the data set interface function and the evaluation index interface function. The interface function of the model conversion stage is not specifically shown in the figure, but in fact, the algorithm container image contains the corresponding interface function. The interface function of the model conversion stage is specifically used to convert the trained algorithm model into an industrial-grade model M1 that can be used by the target industrial platform. Finally, the model reasoning verification image can be used to realize the reasoning verification of the industrial-grade model M1. In addition, for the data set interface function in the algorithm container image, it actually involves the model training stage and the model evaluation stage, and the call of the data set D1 can be realized through the data set interface function.
[0063] The disclosed embodiment provides a model deployment method, including: encapsulating a target deep learning algorithm into an algorithm container image; wherein the algorithm container image includes at least one interface function corresponding to at least one stage of the target deep learning algorithm; and calling at least one different interface function from the algorithm container image to execute at least one stage to obtain a target model. The model deployment method provided by the disclosed embodiment encapsulates a deep learning algorithm into an algorithm container image, quickly builds a corresponding workflow, and the algorithm container image includes interface functions corresponding to each stage of the algorithm, which can quickly schedule the corresponding interface functions to complete model deployment. Not only is the logic of model deployment simple and fast, but also the accuracy is high.
[0064] An embodiment of the present disclosure provides a model deployment device. Figure 3 This is a schematic diagram of the structure of a model deployment device provided by an embodiment of the present disclosure. Figure 3 As shown, in an embodiment of the present disclosure, the model deployment device includes:
[0065] The encapsulation module 301 is used to encapsulate the target deep learning algorithm into an algorithm container image; wherein the algorithm container image includes at least one interface function corresponding to at least one stage of the target deep learning algorithm;
[0066] The deployment module 302 is used to call the at least one interface function from the algorithm container image to execute the at least one stage to obtain the target model.
[0067] In one embodiment of the present disclosure, the encapsulation module 301 is specifically used to perform container image encapsulation on the target deep learning algorithm to obtain a first container image; and perform abstract encapsulation of the interface function of at least one stage on the first container image to obtain the algorithm container image.
[0068] In one embodiment of the present disclosure, the at least one stage includes: a model training stage, a model evaluation stage and a model conversion stage, and the at least one interface function includes: a first interface function corresponding to the model training stage, a second interface function corresponding to the model evaluation stage, and a third interface function corresponding to the model conversion stage.
[0069] The deployment module 302 is specifically used to call the first interface function from the algorithm container image to perform model training to obtain an algorithm model; call the second interface function from the algorithm container image to perform model evaluation on the algorithm model to obtain a model evaluation result; when the model evaluation result meets the preset model effect condition, call the third function interface from the algorithm container image to convert the algorithm model to obtain the target model.
[0070] In one embodiment of the present disclosure, the first interface function includes: a data set interface function, an optimizer interface function, a learning rate adjustment interface function, a loss function interface function, and a back propagation interface function;
[0071] The second interface function includes: the data set interface function and the evaluation index interface function;
[0072] The third interface function includes: a model conversion interface function.
[0073] In one embodiment of the present disclosure, the deployment module 302 is also used to obtain a model reasoning verification image corresponding to the target deep learning algorithm; use the model reasoning verification image to perform reasoning verification on the target model to obtain a reasoning verification result.
[0074] The disclosed embodiment provides a model deployment device, which encapsulates the target deep learning algorithm into an algorithm container image; wherein the algorithm container image includes at least one interface function corresponding to at least one stage of the target deep learning algorithm; from the algorithm container image, at least one interface function is called to execute at least one stage to obtain the target model. The model deployment device provided by the disclosed embodiment encapsulates the deep learning algorithm into an algorithm container image, quickly builds the corresponding workflow, and the algorithm container image includes interface functions corresponding to each stage of different deep learning algorithms, which can quickly schedule the corresponding interface functions to complete the model deployment, which not only has simple logic and fast speed of model deployment, but also has high accuracy.
[0075] The embodiment of the present disclosure also provides an electronic device. Figure 4 The structure diagram of an electronic device provided by the embodiment of the present disclosure is shown in FIG. Figure 4 As shown, in an embodiment of the present disclosure, the electronic device includes: a processor 401, a memory 402 and a communication bus 403; wherein,
[0076] The communication bus 403 is used to realize the connection and communication between the processor 401 and the memory 402;
[0077] The processor 401 is used to execute the program stored in the memory 402 to implement the above-mentioned model deployment method.
[0078] The present disclosure embodiment provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned model deployment method. The computer-readable storage medium can be a volatile memory (volatile memory), such as a random access memory (Random-Access Memory, RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (Read-Only Memory, ROM), a flash memory (flash memory), a hard disk (Hard Disk Drive, HDD) or a solid-state drive (Solid-State Drive, SSD); or it can be a respective device including one or any combination of the above-mentioned memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.
[0079] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0080] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable signal processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable signal processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0081] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable signal processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0082] These computer program instructions may also be loaded onto a computer or other programmable signal processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0083] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the protection scope of the present disclosure.
Claims
1. A model deployment method, characterized in that: The method comprises: Encapsulate the target deep learning algorithm into an algorithm container image; wherein the algorithm container image includes at least one interface function corresponding to at least one stage of the target deep learning algorithm; the at least one stage includes: a model training stage, a model evaluation stage, and a model conversion stage, and the at least one interface function includes: a first interface function corresponding to the model training stage, a second interface function corresponding to the model evaluation stage, and a third interface function corresponding to the model conversion stage; From the algorithm container image, calling the at least one interface function to execute the at least one stage to obtain a target model; Obtain a model reasoning verification image corresponding to the target deep learning algorithm; The target model is subjected to reasoning verification using the model reasoning verification image to obtain a reasoning verification result.
2. The method according to claim 1, characterized in that Encapsulate the target deep learning algorithm into an algorithm container image, including: Performing container image packaging on the target deep learning algorithm to obtain a first container image; Abstract encapsulation of the interface functions of the at least one stage is performed on the first container image to obtain the algorithm container image.
3. The method according to claim 1, characterized in that The step of calling the at least one interface function from the algorithm container image to execute the at least one stage to obtain the target model includes: From the algorithm container image, calling the first interface function to perform model training to obtain an algorithm model; From the algorithm container image, calling the second interface function to perform model evaluation on the algorithm model to obtain a model evaluation result; When the model evaluation result meets the preset model effect condition, the third interface function is called from the algorithm container image to convert the algorithm model to obtain the target model.
4. The method according to claim 3, characterized in that The first interface function includes: a data set interface function, an optimizer interface function, a learning rate adjustment interface function, a loss function interface function and a back propagation interface function; The second interface function includes: the data set interface function and the evaluation index interface function; The third interface function includes: a model conversion interface function.
5. A model deployment device, characterized in that: include: A packaging module, used to package a target deep learning algorithm into an algorithm container image; wherein the algorithm container image includes at least one interface function corresponding to at least one stage of the target deep learning algorithm; the at least one stage includes: a model training stage, a model evaluation stage, and a model conversion stage, and the at least one interface function includes: a first interface function corresponding to the model training stage, a second interface function corresponding to the model evaluation stage, and a third interface function corresponding to the model conversion stage; A deployment module, configured to call the at least one interface function from the algorithm container image to execute the at least one stage and obtain a target model; The deployment module is also used to obtain a model reasoning verification image corresponding to the target deep learning algorithm; use the model reasoning verification image to perform reasoning verification on the target model to obtain a reasoning verification result.
6. The device according to claim 5, characterized in that The encapsulation module is specifically used to perform container image encapsulation on the target deep learning algorithm to obtain a first container image; and perform abstract encapsulation of the interface function of at least one stage on the first container image to obtain the algorithm container image.
7. The device according to claim 5, characterized in that The deployment module is specifically used to call the first interface function from the algorithm container image to perform model training to obtain an algorithm model; call the second interface function from the algorithm container image to perform model evaluation on the algorithm model to obtain a model evaluation result; when the model evaluation result meets a preset model effect condition, call the third interface function from the algorithm container image to convert the algorithm model to obtain the target model.
8. An electronic device, characterized in that: The electronic device comprises: a processor, a memory and a communication bus; wherein, The communication bus is used to realize the connection and communication between the processor and the memory; The processor is used to execute the model deployment program stored in the memory to implement the model deployment method described in any one of claims 1 to 4.
9. A computer-readable storage medium, characterized in that: The computer readable storage medium stores There are one or more programs, the one or more programs being executable by one or more processors, To implement the model deployment method described in any one of claims 1-4.
Citation Information
Patent Citations
Deep learning model online reasoning method and device, electronic equipment and storage medium
CN111461332A
Virtual object control method and device, electronic equipment and storage medium
CN112121419A