Method and system for deploying artificial intelligence model in edge device, device, and medium
By generating AI model deployment files adapted to edge devices, it solves the integration problem of AI models in industrial scenarios, realizes convenient deployment and real-time monitoring of AI models, improves model accuracy and performance, and provides complete industrial AI. solution.
Patent Information
- Application Number
- PCT/CN2023/091847
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-04-28
- Publication Date
- 2024-10-31
AI Technical Summary
Existing technology lacks effective methods to integrate AI models into automated systems, especially in industrial scenarios. It is difficult to match the AI training framework in the IT field, and there are limitations in AI model deployment and monitoring on edge devices.
A method is proposed to obtain the trained AI model and generate a deployment file adapted to the edge device, including the AI model, workflow description file, packaging script and dependency library, for deploying and running the AI model on the edge device, and Real-time monitoring and data collection are performed through monitoring nodes to support retraining of AI models.
It realizes the convenient deployment and integration of AI models, improves the accuracy and performance of the models, provides an end-to-end AI solution, is suitable for the industrial field, and meets the real-time data processing and model monitoring needs of industrial sites.
Smart Images

Figure CN2023091847_31102024_PF_FP_ABST
Abstract
Description
Method, system, device and medium for deploying artificial intelligence models in edge devices Technical Field
[0001] The present invention relates to the field of artificial intelligence (AI) technology, and in particular to methods, systems, devices, and storage media for deploying AI models in edge devices. Background Art
[0002] In the IT sector, complex AI training frameworks exist, but they lack specific deployment methods for industrial scenarios. Meanwhile, in the OT sector, experience with model deployment and automated integration is accumulated, but only simple AI model training can be performed, making it difficult to compete with AI training frameworks in the IT sector.
[0003] So far, there is a lack of good solutions for integrating AI models into automation systems.
[0004] Summary of the Invention
[0005] The embodiments of the present invention provide methods, systems, devices, and storage media for deploying AI models in edge devices.
[0006] In a first aspect, a method for deploying an AI model in an edge device is proposed. The method includes:
[0007] Get the trained AI model;
[0008] Generate a first deployment file, the first deployment file including the AI model, a workflow description file, a packaging script, and a dependency library; wherein the workflow description file is adapted to describe a workflow in an edge device, the workflow including an inference node for deploying the AI model; the dependency library is adapted to create an operating environment for each node in the workflow; and the packaging script is adapted to run each node in the workflow;
[0009] The first deployment file is sent to an edge device, so that the edge device generates the workflow based on the workflow description file, creates a running environment for each node in the workflow based on the dependency library, and runs each node in the workflow based on the packaging script.
[0010] In a second aspect, a system for deploying AI models in edge devices is provided. The system includes:
[0011] A configuration device is configured to obtain a trained AI model; generate a first deployment file, the first deployment file including the AI model, a workflow description file, a packaging script, and a dependency library; wherein the workflow description file is adapted to describe a workflow in an edge device, the workflow including an inference node for deploying the AI model; the dependency library is adapted to create an operating environment for each node in the workflow; the packaging script is adapted to run each node in the workflow; and send the first deployment file to the edge device;
[0012] An edge device is configured to generate a workflow based on the workflow description file, create a running environment for each node in the workflow based on the dependency library, and run each node in the workflow based on the wrapper script.
[0013] In a third aspect, an electronic device is provided. The electronic device includes:
[0014] processor;
[0015] a memory for storing executable instructions of the processor;
[0016] The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the method of deploying the AI model in the edge device as described above.
[0017] In a fourth aspect, a computer-readable storage medium is provided, on which computer instructions are stored. When the computer instructions are executed by a processor, the method of deploying an AI model in an edge device as described above is implemented.
[0018] In a fifth aspect, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the method for deploying an AI model in an edge device as described above.
[0019] It can be seen from the above technical solution that in an embodiment of the present invention, a trained AI model is obtained; a first deployment file is generated, the first deployment file includes an AI model, a workflow description file, a packaging script and a dependency library; wherein the workflow description file is adapted to describe the workflow in the edge device, and the workflow contains an inference node for deploying the AI model; the dependency library is adapted to create an operating environment for each node in the workflow; the packaging script is adapted to run each node in the workflow; the first deployment file is sent to the edge device, so that the edge device generates a workflow based on the workflow description file, creates an operating environment for each node in the workflow based on the dependency library, and runs each node in the workflow based on the packaging script. It can be seen that by including the workflow description file describing the workflow in the edge device and the AI model in the deployment file, the AI model can be conveniently deployed to the edge device, which facilitates the integration of the AI model into the automation system. In addition, the real-time data of the edge device can be used to retrain the AI model, thereby improving the accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, so that those skilled in the art will understand the above and other features and advantages of the present invention more clearly. In the accompanying drawings:
[0021] FIG1 is a flowchart of a method for deploying an AI model according to an embodiment of the present invention.
[0022] FIG2 is a schematic diagram of a cyclic process for deploying an AI model according to an embodiment of the present invention.
[0023] FIG3 is a schematic diagram of generating a deployment file according to an embodiment of the present invention.
[0024] FIG4 is a schematic diagram of a workflow according to an embodiment of the present invention.
[0025] FIG5 is a structural diagram of a system for deploying an artificial intelligence model in an edge device according to an embodiment of the present invention.
[0026] FIG6 is an exemplary structural diagram of an electronic device according to an embodiment of the present invention.
[0027] The accompanying drawings are numerals as follows: DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail with reference to the following examples.
[0029] For the sake of brevity and intuitiveness in description, the solution of the present invention is explained below by describing several representative implementations. A large number of details in the implementations are only used to help understand the solution of the present invention. However, it is obvious that the technical solution of the present invention may not be limited to these details when implemented. In order to avoid unnecessarily obscuring the solution of the present invention, some implementations are not described in detail, but only a framework is given. Hereinafter, "including" means "including but not limited to", and "according to..." means "at least according to..., but not limited to only according to...". Due to the language habits of Chinese, when the number of a component is not specifically specified below, it means that the component can be one or more, or can be understood as at least one.
[0030] Currently, there is a lack of a complete end-to-end (E2E) AI solution for the industrial sector, encompassing AI solution planning, AI model training, AI model deployment on edge devices, runtime AI model monitoring and data collection, and AI model retraining. The present invention provides an E2E solution to fill this gap, particularly for the industrial sector.
[0031] Figure 1 is a flow chart of a method for deploying an AI model according to an embodiment of the present invention. As shown in Figure 1, the method includes:
[0032] Step 101: Obtain the trained AI model.
[0033] In one embodiment, step 101 specifically includes: training an untrained AI model based on predetermined training data to obtain a trained artificial intelligence model.
[0034] In another embodiment, step 101 specifically includes obtaining a trained artificial intelligence model from an AI training platform. For example, the AI training platform may include TensorFlow, PyTorch, MXNet, and CNTK, etc.
[0035] It can be seen that the embodiments of the present invention can not only train themselves to obtain trained AI models, but also obtain trained AI models from third-party platforms. The AI model is adapted to provide various specific functions for the workflow executed in the edge device. For example, the AI model can be implemented as a drilling detection model, a paint color detection model, a wrong solder joint detection model, and so on. The workflow can be simply defined as a description of a series of operation processes performed by the edge device. For example, the workflow executed in the edge device of the product sorting line can be simply described as starting, taking pictures, classifying and moving the product to the target location.
[0036] Step 102: Generate a first deployment file, which includes an AI model, a workflow description file, a wrapper script, and a dependency library; the workflow description file is adapted to describe the workflow in the edge device, and the workflow includes an inference node for deploying the AI model; the dependency library is adapted to create an operating environment for each node in the workflow; and the wrapper script is adapted to run each node in the workflow.
[0037] The workflow description file specifically contains the nodes included in the workflow and the execution order between each node. The workflow also includes inference nodes, where AI models can be deployed and used to implement inference functions. For example, the workflow description file can be implemented in YML file format or JSON file format. By parsing the workflow description file, the edge device can easily determine the specific workflow. The dependency library is adapted to create the runtime environment for each node in the workflow.
[0038] For example, the dependency library may include:
[0039] (1) Image / data processing classes, such as numpy and OpenCV;
[0040] (2) Model usage classes, such as tensorrt and torchvision;
[0041] (3) Hardware driver classes, such as pycuda, etc.
[0042] A wrapper script is used to run each node in a workflow. A wrapper script is a script that embeds a system command or tool and stores a list of parameters to pass to each node. Each node in the workflow can be run based on the parameters passed to it by the wrapper script.
[0043] The first deployment file may be implemented as a compressed file, in a ZIP file format or a RAR file format, etc.
[0044] It can be seen that the first deployment file contains both the AI model (for example, from the IT field) and the workflow description file used to describe the workflow in the edge device (for example, the workflow in the OT field) and the support file for running the workflow. In this way, the AI model and the running workflow can be deployed in the edge device at the same time, realizing the integration of the IT domain and the OT domain.
[0045] FIG3 is a schematic diagram of generating a deployment file according to an embodiment of the present invention.
[0046] In Figure 3, AI personnel 205 packages the trained AI model 21, workflow description file 22, wrapper script 23, and dependency libraries 24 into a deployment file 25. Based on the workflow description file 22, dependency libraries 24, and wrapper script 23 contained in deployment file 25, the edge device can establish and run the workflow. Furthermore, the AI model 21 is deployed in the workflow's inference node. Therefore, based on deployment file 25, a complete workflow including the AI model 21 can be deployed.
[0047] Step 103: Send the first deployment file to the edge device, so that the edge device generates a workflow based on the workflow description file, creates a running environment for each node in the workflow based on the dependency library, and runs each node in the workflow based on the packaging script.
[0048] Here, edge devices are devices that provide entry points to the enterprise or service provider core network. Examples include routers, routing switches, integrated access devices (IADs), multiplexers, and various metropolitan area network (MAN) and wide area network (WAN) access devices.
[0049] Preferably, the edge device is implemented as an industrial edge device, such as: (1) industrial Ethernet switch; (2) industrial fixed Ethernet router; (3) industrial fixed Ethernet gateway; (4) industrial fixed cellular router; (5) industrial fixed cellular gateway; (6) industrial wireless router and access point; (7) industrial wireless gateway, etc.
[0050] The edge device parses the first deployment file to extract the workflow description file, AI model, wrapper script, and dependency libraries. Based on the workflow description file, the edge device creates a workflow containing inference nodes and deploys the AI model in the inference nodes. Furthermore, based on the dependency libraries, the edge device creates a separate runtime environment for each node in the workflow and runs each node based on the wrapper script.
[0051] As the demand for AI models in different industries continues to increase, it is crucial to ensure the performance of AI models when they are deployed on edge devices (e.g., industrial edge devices). Typically deployed AI models may not work as expected due to many reasons: the quality of production input data deteriorates; the distribution of production data is different from the data distribution during the training phase. Therefore, monitoring AI models is an important part of edge AI. Currently, some cloud providers or open source software packages provide available AI monitoring solutions. However, they have limitations when applied to edge devices. These solutions require users to upload training data and production data to the cloud regularly, and the monitoring results are only displayed on the cloud. Therefore, there are at least the following limitations: (1) Data is required to be uploaded and stored on the cloud, which is usually difficult for factories to accept; (2) Production data is sent to the cloud at certain intervals, so the monitoring results are delayed; (3) The monitoring results are displayed on the cloud, but the factory's operation engineers are not directly notified, which is not conducive to the operation engineers understanding the monitoring results in a timely manner.
[0052] In one embodiment, the workflow described in the workflow description file also includes a monitoring node, which is adapted to verify the input data of the AI model and / or detect the performance of the AI model. Specifically, the monitoring node may include a first part; wherein the first part is arranged at the input end of the AI model, and is adapted to verify the input data based on the matching result of the input data of the AI model with the first boundary constraint rule, and the first boundary constraint rule is determined based on the training data of the AI model. The monitoring node may include a second part, which is arranged at the output end of the AI model, and is adapted to detect the performance of the AI model based on the matching result of the output data of the AI model with the second boundary constraint rule; wherein the second boundary constraint rule is determined based on the training data of the AI model.
[0053] Preferably, the monitoring node includes both a first part and a second part; the first part is arranged at the input end of the AI model, and is adapted to verify the input data based on the matching result between the input data of the AI model and the first boundary constraint rule; the second part is arranged at the output end of the AI model, and is adapted to detect the performance of the AI model based on the matching result between the output data of the AI model and the second boundary constraint rule; wherein the first boundary constraint rule and the second boundary constraint rule are determined based on the training data of the AI model.
[0054] The above exemplary descriptions of specific examples and specific deployment methods of monitoring nodes are provided. Those skilled in the art will appreciate that such descriptions are merely exemplary and are not intended to limit the scope of protection of the embodiments of the present invention.
[0055] and the second part; the first part is arranged at the input end of the AI model, and is adapted to verify the input data based on the matching results of the input data of the AI model and the first boundary constraint rule; the second part is arranged at the output end of the AI model, and is adapted to detect the performance of the AI model based on the matching results of the output data of the AI model and the second boundary constraint rule; wherein the first boundary constraint rule and the second boundary constraint rule are determined based on the training data of the AI model.
[0056] Figure 4 is a schematic diagram of a workflow according to an embodiment of the present invention. In Figure 4, the workflow includes a data preprocessing node 301, a first part 302 of a monitoring node, an inference node 303, a second part 304 of a monitoring node, a data post-processing node 305, and a bus 306. The data preprocessing node 301 is used to read the input data of the AI model in the inference node 303 from the bus 306 and perform preprocessing on the input data. The first part 302 of the monitoring node is used to verify the legitimacy of the preprocessed input data and send the test results to the bus 306. The AI model in the inference node performs inference based on the input data and generates output data. The second part 304 of the monitoring node detects the performance of the AI model based on the output data and sends the test results to the bus 306. The data post-processing node 305 performs data post-processing on the output data.
[0057] The above exemplary description of a typical execution process of a workflow is provided. Those skilled in the art will appreciate that the description is merely exemplary and is not intended to limit the scope of protection of the embodiments of the present invention.
[0058] The following describes in detail the process of generating the first boundary constraint rule and the second boundary constraint rule.
[0059] (1) Generation process of the first boundary constraint rule
[0060] In one embodiment, the process of generating the first boundary constraint rule includes: determining basic indicators of the input data of the AI model; determining advanced indicators of the input data based on the basic indicators of the input data; determining the input data of the AI model from the training data of the AI model; determining the value range of the advanced indicators of the input data based on the input data determined from the training data of the AI model; and determining the first boundary constraint rule based on the value range of the advanced indicators of the input data determined from the training data of the AI model. Here, the basic indicators of the input data represent the basic quality metrics of the input data of the AI model, and can be implemented as basic statistical characteristics of the input data, such as the minimum value in the input data, the maximum value in the input data, the type of input data, the required value of the input data, the average value of the input data, the median of the input data, the variance of the input data, the standard deviation of the input data, the absolute number and relative number of the input data, the percentage and percentile of the input data, the frequency and frequency of the input data, the proportion and ratio of the input data, the multiple and multiple of the input data, the year-on-year and quarter-on-quarter comparison of the input data, and the number of missing values of a certain attribute in the input data, etc. The user can select the basic indicators, and default basic indicators can also be automatically recommended for the user. The basic indicators establish a monitoring baseline. For more in-depth analysis needs, advanced indicators for monitoring and inspection can be applied. Advanced indicators of input data are indicators derived from the basic indicators of one or more input data. For example, the proportion of values less than the average value, the proportion of values greater than the average value, the proportion of values not within the range of basic indicators determined by the minimum and maximum values, the missing rate derived by dividing the number of missing values of a certain attribute in the input data by the number of data, etc. The specific values of the basic indicators of the input data in the training data are obtained, and the value range of the advanced indicators is calculated based on the specific values of the basic indicators to serve as the basis for judging the legitimacy of the subsequent input data.
[0061] In one embodiment, the process of generating a first boundary constraint rule includes: determining basic indicators for the input data of the AI model; determining advanced indicators for the input data based on the basic indicators of the input data; determining user-customized indicators for the input data based on the basic indicators and / or the advanced indicators of the input data; determining second input data for the AI model from the training data of the AI model; determining a first value range for the advanced indicator of the input data and a second value range for the user-customized indicator of the input data based on the second input data; and determining the first boundary constraint rule based on the first value range and the second value range. It can be seen that the user-customized indicator for the input data is further determined based on the basic indicators and / or the advanced indicators of the input data. The user-customized indicator for the input data can be an indicator specified by the user. The user-customized indicator for the input data can be derived from the advanced indicators of one or more input data, or can be derived from the basic indicators of one or more input data and the advanced indicators of one or more input data. For example, the basic indicator is the average value of the input data; the advanced indicator is the proportion of values less than the average value and the proportion of values greater than the average value; and the user-customized indicator is the ratio between the proportion of values less than the average value and the proportion of values greater than the average value.
[0062] (2) Generation process of the second boundary constraint rule
[0063] In one embodiment, the process of generating the second boundary constraint rule includes: determining basic indicators of the output data of the AI model; determining advanced indicators of the output data based on the basic indicators of the output data; determining the output data of the AI model from the training data of the AI model; determining the value range of the advanced indicators of the output data based on the output data determined from the training data; and determining the second boundary constraint based on the value range of the advanced indicators of the output data. Similarly, the basic indicators of the output data represent the basic quality metrics of the output data of the AI model and can be implemented as basic statistical characteristics of the output data. For example, the basic indicators of the output data may include: the minimum value of the output data, the maximum value of the output data, the type of the output data, the required value of the output data, the mean of the output data, the median of the output data, the variance of the output data, the standard deviation of the output data, the absolute number and relative number of the output data, the percentage and percentile of the output data, the frequency and frequency of the output data, the ratio and proportion of the output data, the multiple and multiple of the output data, the year-on-year and month-on-month comparison of the output data, and the number of missing values of a certain attribute in the input data, etc. The user can select the basic indicators of the output data, and default basic indicators of the output data can be automatically recommended for the user. Advanced metrics for output data are derived from one or more basic metrics of the output data. For example, the proportion of values less than the mean, the proportion of values greater than the mean, the proportion of values outside the range of the basic metric determined by the minimum and maximum values, the missingness rate derived by dividing the number of missing values for a certain attribute in the input data by the number of data points, etc.
[0064] In one embodiment, the generation process of the second boundary constraint rule includes: determining the basic indicators of the output data of the AI model; determining the advanced indicators of the output data based on the basic indicators of the output data; determining the user-customized indicators of the output data based on the basic indicators of the output data and / or the advanced indicators of the output data; determining the output data of the AI model from the training data of the AI model; determining the first value range of the advanced indicators of the output data and the second value range of the user-customized indicators of the output data based on the output data determined from the training data of the AI model; and determining the second boundary constraint based on the first value range and the second value range. It can be seen that the user-customized indicators of the output data are further determined based on the basic indicators of the output data and / or the advanced indicators of the output data. The user-customized indicators of the output data can be indicators specified by the user himself. Among them: the user-customized indicators of the output data can be obtained by deducing the advanced indicators of the output data individually or multiple times, or can be obtained by deducing the basic indicators of the output data individually or multiple times and the advanced indicators of the output data individually or multiple times. For example, the basic indicator of output data is the average value of the output data; the advanced indicator of output data is the proportion of values less than the average value and the proportion of values greater than the average value; the user-customized indicator of output data is the ratio between the proportion of values less than the average value and the proportion of values greater than the average value, and so on.
[0065] After the workflow is deployed, run the workflow. During the workflow, at the monitoring node, the real-time input data of the AI model can be verified based on the matching results of the first boundary constraint rule with the real-time input data of the AI model during the workflow execution. The performance of the AI model can also be tested based on the matching results of the real-time output data of the AI model during the workflow execution with the second boundary constraint rule. For example:
[0066] (1): When the value of the advanced indicator of the real-time input data is not within the value range, it is determined that the first boundary constraint rule is not matched, wherein the verification result indicates that the real-time input data is illegal;
[0067] (2): When the value of the advanced indicator of the real-time input data is within the value range, it is determined that the first boundary constraint rule is matched, wherein the verification result indicates that the real-time input data is legal;
[0068] (3): When the value of the advanced indicator of the real-time output data is not within the value range, it is determined that the second boundary constraint rule is not matched, and the detection result indicates that the performance of the AI model is unqualified.
[0069] (4): When the value of the advanced indicator of the real-time output data is within the value range, it is determined that the second boundary constraint rule is matched, wherein the detection result indicates that the performance of the AI model is qualified.
[0070] Real-time data from industrial sites facilitates model retraining. In one embodiment, the method shown in Figure 1 further includes: obtaining real-time input data for the AI model during workflow execution; determining updated training data based on the real-time input data and labeling operations performed on the real-time input data; retraining the AI model based on the updated training data; and sending the retrained AI model to the edge device, whereupon the edge device updates the AI model based on the retrained AI model. In this embodiment, the business logic of the workflow itself does not change; only the AI model needs to be updated.
[0071] When the business logic of the workflow itself changes, the workflow and retrained AI model can be updated by issuing a new deployment file.
[0072] In one embodiment, the method shown in Figure 1 further includes: obtaining real-time input data of the AI model during workflow execution; determining updated training data based on the real-time input data and a labeling operation performed on the real-time input data; retraining the AI model based on the updated training data; generating a second deployment file, the second deployment file including the retrained AI model, an updated workflow description file, an updated wrapper script, and an updated dependency library; wherein the updated workflow description file is adapted to describe the updated workflow in the edge device, the updated workflow including an inference node for deploying the retrained AI model; the updated dependency library is adapted to create an operating environment for each node in the updated workflow; the updated wrapper script is adapted to run each node in the updated workflow; and sending the second deployment file to the edge device, whereby the edge device generates an updated workflow based on the updated workflow description file, creates an operating environment for each node in the updated workflow based on the updated dependency library, and runs each node in the updated workflow based on the updated wrapper script. In this embodiment, the business logic of the workflow itself changes and the AI model is updated. With a single deployment file, both the workflow and the AI model can be updated simultaneously.
[0073] It can be seen that the embodiments of the present invention realize a complete E2E AI solution (especially suitable for the industrial field), including AI solution planning, AI model training, AI model deployment on edge devices, AI model monitoring and data collection during runtime, and AI model retraining.
[0074] FIG2 is a schematic diagram of a cyclical process for deploying an AI model according to an embodiment of the present invention. In FIG2 , an AI personnel 205 performs a model training process 201 to train an AI model and generate a deployment file. A deployment engineer 206 performs a model deployment process 202 based on the deployment file at the edge device's operating site. A field management engineer 207 performs a monitoring and data collection process 203, in which real-time input data is collected. The AI personnel retrain the AI model based on the real-time input data and generate a deployment file containing the retrained AI model, thus completing the cycle.
[0075] Specifically: The loop starts with the model training step. AI personnel 205 participates in the model training step, trains one or more AI models, and generates a deployment file (e.g., a deployable package) containing the trained AI model. Next, the deployment file is sent to the deployment engineer 206. The deployment engineer 206 configures and deploys the file on the edge device and runs the workflow. Then, the on-site management engineer 207 observes the running workflow, receives logs and warning messages, etc., and communicates with the AI personnel 205 to ensure that the model runs as expected. At the same time, data is collected from the model prediction and model monitoring results and retained for the next step. AI personnel 205 will use the saved data to analyze data quality, model performance, etc. If AI personnel 205 wishes, they can also label the data and reuse the labeled data to retrain the AI model and generate a new deployment file. The deployment engineer 206 can then deploy the new deployment file on the edge device.
[0076] The entire cycle can be a model deployment and optimization cycle. Model training, model deployment, and application of monitoring methods to the running model can be performed separately or in combination. The embodiment of the present invention proposes a set of operating procedures to guide AI personnel 205 to train AI models and encapsulate the AI models in deployment files for edge devices. The deployment file describes a workflow (e.g., a pipeline) that defines how to deploy and monitor models on edge devices. Typically, a workflow consists of one or more nodes and a data bus. For each node, input data can come from the data bus or other nodes in the workflow, and output data can be sent to other nodes or data buses. The deployment file can be simply imported into the application on the edge device and can be easily run on the edge device with smaller parameter settings.
[0077] When a workflow starts running on an edge device, real-time data (input data, inference data, and monitoring data) will be sent to the data bus. Industrial edge management (e.g., IEM) or third-party software can listen to the data bus, collect this data, and post-process it for further use, such as large-scale data analysis or retraining models. In addition, the retrained model can be packaged in a new deployment file and a new workflow can be run on the edge device, and so on. An inference node is a node that contains a trained AI model that will generate model prediction results through input data from the data bus. Other nodes can be freely added to the pipeline for various purposes, such as data parsing functions or adding monitoring functions. The node connections in the workflow can be sequential or parallel, depending on their functional dependencies.
[0078] The complete implementation process of the embodiment of the present invention is described below.
[0079] Step 1: Prepare training data.
[0080] In this step, the training data template can be used to help the AI personnel 205 collect the visualization data set and guide the AI personnel 205 to manually or automatically label the data set.
[0081] Step 2: Train and save the AI model.
[0082] In this step, the AI personnel 205 trains and saves the AI model based on the dataset. Considering that the AI personnel 205 currently usually rely on the AI training framework provided by third-party platforms to train high-performance, high-precision models, the user is also allowed to import models saved from other AI training frameworks.
[0083] Step 3: Create a wrapper script.
[0084] The AI person 205 will need a script and provide it with parsed data from the configured data source. The template will guide you through how each node works in the workflow.
[0085] Step 4: Configure the monitoring node.
[0086] In this step, AI scientists will add monitoring functions as nodes and add them to the workflow.
[0087] Step 5: Create deployment files for edge devices.
[0088] Step 6: Configure and run the workflow.
[0089] In this step, the deployment engineer can import the deployment file into the application on the edge device. Then, configure the topic for each output result on the data bus and configure the parameters in the wrapper script (if any). After the configuration is completed, the workflow can be run on the edge device. The workflow will obtain input data from the data bus, execute tasks on each node, and send various output data back to the data bus.
[0090] Step 7: Runtime data collection and post-processing.
[0091] During runtime, if a monitoring node detects abnormal data, it can generate a warning message. Warning messages can be viewed in logs, which field management engineers can use to troubleshoot pipelines or models. Warning messages are also sent to the data bus, which IEM or third-party software can use to provide real-time alerts by sending emails or using this data to visualize error rates.
[0092] Step 8: Data post-processing and model retraining.
[0093] The runtime output data of the previous step on the data bus can be obtained by the edge device management system or other software / systems listening to the data bus. Many data analysis methods / algorithms are not feasible at runtime due to batch size, but once this output data is accumulated for weeks, months, or even years, the analysis of these large-scale data sets will be more accurate and convincing.
[0094] Considering that many factories are transforming from traditional models to more digital models. Many potential customers may be interested in cloud services for easier management or higher computing performance. In order to meet this demand, certain steps in the embodiments of the present invention can be transferred to the cloud. For example, steps 1 to 5 can be implemented as cloud APIs. The high computing power and easy file management capabilities of cloud services can be fully utilized to prepare their training data sets, train models, and generate deployable packages. Steps 7 and 8 require IEM or other software systems to expose certain APIs for the cloud platform to call, so that users can get deployment files directly from the cloud, collect runtime data and save it to the cloud. Step 8 can also be implemented as a cloud API, and data scientists can post-process the data and retrain the model on the cloud.
[0095] Figure 5 is a structural diagram of a system for deploying an artificial intelligence model in an edge device according to an embodiment of the present invention. As shown in Figure 5, the system includes:
[0096] Configuration device 501 is configured to obtain a trained artificial intelligence model; generate a first deployment file, the first deployment file including the artificial intelligence model, a workflow description file, a packaging script, and a dependency library; wherein the workflow description file is adapted to describe a workflow in edge device 502, the workflow including an inference node for deploying the artificial intelligence model; the dependency library is adapted to create an operating environment for each node in the workflow; the packaging script is adapted to run each node in the workflow; and the first deployment file is sent to edge device 502;
[0097] The edge device 502 is configured to generate a workflow based on a workflow description file, create a running environment for each node in the workflow based on a dependency library, and run each node in the workflow based on a packaging script.
[0098] In an implementation visit, the system also includes: a management device 503, used to obtain real-time input data of the artificial intelligence model during the execution of the workflow; determining updated training data based on the real-time input data and the labeling operation for the real-time input data; wherein the configuration device 501 is used to retrain the artificial intelligence model based on the updated training data; sending the retrained artificial intelligence model to the edge device 502; the edge device 502 is used to update the artificial intelligence model based on the retrained artificial intelligence model.
[0099] In the configuration device 501, the training data collection process 51, the model training process 52, and the deployment file generation process 53 can be executed. In the edge device 502, the workflow 54 can be configured and the workflow 55 can be run. In the management device 503, the data processing process 56 and the training data generation process 57 can be executed.
[0100] Preferably, the configuration device 501 can be implemented as a PC device, the edge device 502 is an industrial edge device, and the management device 503 is implemented as a device running an IEM management platform.
[0101] In one embodiment, the system also includes: a management device 503, which is used to obtain real-time input data of the AI model during the execution of the workflow; determine updated training data based on the real-time input data and the labeling operation for the real-time input data; wherein the configuration device 501 is used to retrain the AI model based on the updated training data; generate a second deployment file, the second deployment file includes the retrained AI model, an updated workflow description file, an updated packaging script and an updated dependency library; wherein the updated workflow description file is adapted to describe the updated workflow in the edge device, and the updated workflow contains an inference node for deploying the retrained AI model; the updated dependency library is adapted to create a running environment for each node in the updated workflow; the updated packaging script is adapted to run each node in the updated workflow; the second deployment file is sent to the edge device 502; the edge device 502 is used to generate an updated workflow based on the updated workflow description file, create a running environment for each node in the updated workflow based on the updated dependency library, and run each node in the updated workflow based on the updated packaging script.
[0102] In summary, embodiments of the present invention provide an E2E AI solution for the industrial sector, encompassing AI solution planning, AI model training, AI model deployment on edge devices, runtime AI model monitoring and data collection, and AI model retraining. Furthermore, embodiments of the present invention provide a method for deploying AI models on edge devices as a configurable workflow, a real-time model monitoring method, and a method for retraining models using real-time data. Embodiments of the present invention standardize the pipeline workflow for model deployment and provide users with the ability to customize model-related functionality. Embodiments of the present invention provide a simple E2E AI solution, divided into several components, each with clear guidance and defined roles for participants within each component. This allows for a well-defined and more efficient process when each role possesses sufficient expertise to complete the work. Furthermore, embodiments of the present invention provide an edge device management system or other software to collect real-time data generated by the workflow for further analysis and improvement. Furthermore, embodiments of the present invention offer separate on-premises and cloud-based solutions for each step, meeting the needs of both traditional and modern digital factories.
[0103] An embodiment of the present invention also proposes an electronic device with a processor-memory architecture. Figure 6 is an exemplary structural diagram of an electronic device according to an embodiment of the present invention. As shown in Figure 6, the electronic device 600 includes a processor 61, a memory 602, and a computer program stored on the memory 602 and executable on the processor 601. When the computer program is executed by the processor 601, a method for deploying an AI model in an edge device as described above is implemented. Among them, the memory 602 can be specifically implemented as a variety of storage media such as an electrically erasable programmable read-only memory (EEPROM), a flash memory (Flash memory), and a programmable read-only memory (PROM). The processor 601 can be implemented to include one or more central processing units or one or more field programmable gate arrays, wherein the field programmable gate array integrates one or more central processing unit cores. Specifically, the central processing unit or the central processing unit core can be implemented as a CPU, an MCU, or a DSP, and so on.
[0104] It should be noted that not all steps and modules in the above processes and structure diagrams are required, and certain steps or modules can be omitted based on actual needs. The execution order of the steps is not fixed and can be adjusted as needed. The division of the modules is merely for the convenience of describing the functional division adopted. In actual implementation, a module can be implemented by multiple modules, and the functions of multiple modules can be implemented by the same module. These modules can be located in the same device or in different devices.
[0105] The hardware modules in each embodiment can be implemented mechanically or electronically. For example, a hardware module may include a specially designed permanent circuit or logic device (such as a dedicated processor, such as an FPGA or ASIC) for performing a specific operation. The hardware module may also include a programmable logic device or circuit (such as a general-purpose processor or other programmable processor) temporarily configured by software to perform a specific operation. As for whether to implement the hardware module mechanically, or using a dedicated permanent circuit, or using a temporarily configured circuit (such as configured by software), it can be decided based on cost and time considerations.
[0106] The above are only preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for deploying an artificial intelligence model in an edge device, characterized in that: The method comprises: Obtain (101) a trained artificial intelligence model; Generate (102) a first deployment file, the first deployment file comprising the artificial intelligence model, a workflow description file, a packaging script and a dependency library; wherein the workflow description file is adapted to describe a workflow in an edge device, the workflow comprising an inference node for deploying the artificial intelligence model; the dependency library is adapted to create an operating environment for each node in the workflow; and the packaging script is adapted to run each node in the workflow; The first deployment file is sent (103) to an edge device, so that the edge device generates the workflow based on the workflow description file, creates an operating environment for each node in the workflow based on the dependency library, and runs each node in the workflow based on the packaging script.
2. The method according to claim 1, characterized in that The workflow includes a monitoring node, which is adapted to verify input data of the artificial intelligence model and / or detect the performance of the artificial intelligence model.
3. The method according to claim 1, characterized in that include: Acquiring real-time input data of the artificial intelligence model during the execution of the workflow; Determining updated training data based on the real-time input data and a labeling operation on the real-time input data; Retraining the artificial intelligence model based on the updated training data; The retrained artificial intelligence model is sent to the edge device, so that the edge device updates the artificial intelligence model based on the retrained artificial intelligence model.
4. The method according to claim 1, characterized in that include: Acquiring real-time input data of the artificial intelligence model during the execution of the workflow; Determining updated training data based on the real-time input data and a labeling operation on the real-time input data; Retraining the artificial intelligence model based on the updated training data; Generate a second deployment file, the second deployment file includes the retrained artificial intelligence model, an updated workflow description file, an updated packaging script and an updated dependency library; wherein the updated workflow description file is adapted to describe the updated workflow in the edge device, and the updated workflow contains an inference node for deploying the retrained artificial intelligence model; the updated dependency library is adapted to create an operating environment for each node in the updated workflow; the updated packaging script is adapted to run each node in the updated workflow; The second deployment file is sent to the edge device, so that the edge device generates an updated workflow based on the updated workflow description file, creates an operating environment for each node in the updated workflow based on the updated dependent library, and runs each node in the updated workflow based on the updated wrapper script.
5. The method according to claim 1, characterized in that The step of obtaining the trained artificial intelligence model includes: Training an untrained artificial intelligence model based on predetermined training data to obtain the trained artificial intelligence model; or Obtain the trained artificial intelligence model from the artificial intelligence model training platform.
6. The method according to claim 2, characterized in that The monitoring node comprises a first part; The first part is arranged at the input end of the artificial intelligence model and is adapted to verify the input data based on the matching result between the input data of the artificial intelligence model and the first boundary constraint rule; The first boundary constraint rule is determined based on the training data of the artificial intelligence model.
7. The method according to claim 2, characterized in that The monitoring node comprises a second part; The second part is arranged at the output end of the artificial intelligence model, and is adapted to detect the performance of the artificial intelligence model based on the matching result between the output data of the artificial intelligence model and the second boundary constraint rule; wherein the second boundary constraint rule is determined based on the training data of the artificial intelligence model.
8. The method according to claim 2, characterized in that: The monitoring node includes a first part and a second part; The first part is arranged at the input end of the artificial intelligence model and is adapted to verify the input data based on the matching result between the input data of the artificial intelligence model and the first boundary constraint rule; The second part is arranged at the output end of the artificial intelligence model and is adapted to detect the performance of the artificial intelligence model based on the matching result between the output data of the artificial intelligence model and the second boundary constraint rule; The first boundary constraint rule and the second boundary constraint rule are determined based on the training data of the artificial intelligence model.
9. A system for deploying an artificial intelligence model in an edge device, characterized in that: include: Configuration means (501) for obtaining a trained artificial intelligence model; Generate a first deployment file, the first deployment file comprising the artificial intelligence model, a workflow description file, a packaging script and a dependency library; wherein the workflow description file is adapted to describe a workflow in an edge device (502), the workflow comprising an inference node for deploying the artificial intelligence model; the dependency library is adapted to create an operating environment for each node in the workflow; the packaging script is adapted to run each node in the workflow; and send the first deployment file to the edge device (502); The edge device (502) is used to generate a workflow based on the workflow description file, create an operating environment for each node in the workflow based on the dependency library, and run each node in the workflow based on the packaging script.
10. The system according to claim 9, characterized in that Also includes: A management device (503) for acquiring real-time input data of the artificial intelligence model during the execution of the workflow; Determining updated training data based on the real-time input data and a labeling operation on the real-time input data; The configuration device (501) is used to retrain the artificial intelligence model based on the updated training data; send the retrained artificial intelligence model to the edge device (502); and the edge device (502) is used to update the artificial intelligence model based on the retrained artificial intelligence model.
11. The system according to claim 9, characterized in that Also includes: A management device (503) for acquiring real-time input data of the artificial intelligence model during the execution of the workflow; Determining updated training data based on the real-time input data and a labeling operation on the real-time input data; wherein the configuration device (501) is used to retrain the artificial intelligence model based on the updated training data; Generate a second deployment file, the second deployment file includes the retrained artificial intelligence model, an updated workflow description file, an updated packaging script and an updated dependency library; wherein the updated workflow description file is adapted to describe the updated workflow in the edge device, and the updated workflow contains an inference node for deploying the retrained artificial intelligence model; the updated dependency library is adapted to create an operating environment for each node in the updated workflow; the updated packaging script is adapted to run each node in the updated workflow; The second deployment file is sent to an edge device (502); the edge device (502) is used to generate an updated workflow based on the updated workflow description file, create an operating environment for each node in the updated workflow based on the updated dependency library, and run each node in the updated workflow based on the updated wrapper script.
12. An electronic device, characterized in that: include: Processor (601); A memory (602), configured to store executable instructions of the processor (601); The processor (601) is used to read the executable instructions from the memory (602) and execute the executable instructions to implement the method for deploying an artificial intelligence model in an edge device described in any one of claims 1-8.
13. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed by the processor, the method for deploying an artificial intelligence model in an edge device described in any one of claims 1-8 is implemented.
14. A computer program product, characterized in that It includes a computer program, which, when executed by a processor, implements the method for deploying an artificial intelligence model in an edge device described in any one of claims 1-8.
Citation Information
Patent Citations
Deployment method and calling method of artificial intelligence model, equipment and storage medium
CN113868330A
Machine learning model automatic production line construction method and system
CN114115857A
Model deployment method and device, electronic equipment and storage medium
CN114546425A
Business management method and system, configuration server and edge computing device
CN114979246A
AI application deployment method and related platform, cluster, medium and program product
CN115237428A
Cited By
Intelligent edge device and operation method and system thereof
CN119578555A
Edge AI model-oriented automatic deployment and updating method and system
CN119987810A
Methods and systems for automated deployment and updating of edge AI models
CN119987810B
