Application generation method based on algorithm model, electronic device and storage medium
Patent Information
- Application Number
- CN202110861385.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-29
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2041-07-29
AI Technical Summary
但是深度学习需要依赖于终端设备的AI(Artificial Intelligence,人工智能)计算能力等,由于AI计算能力的差异,导致深度学习无法随意部署到终端设备上,例如智能视频终端等终端设备,而智能视频终端的开发技术不同,具备的AI计算能力不同,有些具备AI计算能力的智能视频终端不能按业务需求,对终端设备中内置算法进行在线升级、扩展及替换,导致相关的AI算法无法有效应用到具体业务领域
[0007] The application generation method based on the algorithm model according to the embodiment of the present application has at least the following beneficial effects: by obtaining the initial data set, preprocessing the initial data set to obtain a training data set, and based on the training data set, the preset initial algorithm The model is trained, a cloud algorithm model is generated, the network structure of the cloud algorithm model is adjusted, a terminal algorithm model is obtained, and an application program applied to the terminal is generated based on the terminal algorithm model, which can flexibly realize the generation and application of AI algorithms on smart terminal devices. , to meet business needs.
Smart Images

Figure CN113741863B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to an application generation method based on an algorithm model, an electronic device, and a storage medium. Background Art
[0002] As a branch of machine learning, deep learning has been continuously developed in recent years and has been widely used in different fields. Deep learning models can be used for visual processing, speech recognition, natural language processing, etc. of terminal devices. However, deep learning needs to rely on the AI (Artificial Intelligence) computing power of terminal devices. Due to the difference in AI computing power, deep learning cannot be deployed on terminal devices at will, such as smart video terminals. Smart video terminals have different development technologies and different AI computing capabilities. Some smart video terminals with AI computing capabilities cannot upgrade, expand, and replace the built-in algorithms in the terminal devices online according to business needs, resulting in the inability to effectively apply related AI algorithms to specific business areas. Summary of the invention
[0003] This application aims to solve at least one of the technical problems existing in the prior art. To this end, this application proposes an application generation method based on an algorithm model, which can flexibly realize the generation and application of AI algorithms on smart terminal devices to meet business needs.
[0004] The present application also proposes an electronic device having the above-mentioned algorithm model-based application generation method.
[0005] The present application also proposes a computer-readable storage medium having the above-mentioned algorithm model-based application generation method.
[0006] According to the first aspect of the present application, the algorithm model-based application generation method includes: obtaining an initial data set; preprocessing the initial data set to obtain a training data set; training a preset initial algorithm model according to the training data set to generate a cloud algorithm model; adjusting the network structure of the cloud algorithm model to obtain a terminal algorithm model; and generating an application for a terminal according to the terminal algorithm model.
[0007] The method for generating an application based on an algorithm model according to the embodiment of the present application has at least the following beneficial effects: by acquiring an initial data set, preprocessing the initial data set to obtain a training data set, training a preset initial algorithm model according to the training data set, generating a cloud algorithm model, adjusting the network structure of the cloud algorithm model to obtain a terminal algorithm model, and generating an application for the terminal according to the terminal algorithm model, the generation and application of AI algorithms can be flexibly realized on smart terminal devices to meet business needs.
[0008] According to some embodiments of the present application, the initial data set is preprocessed to obtain a training data set, including: standardizing the initial data set to obtain a standardized data set; performing data enhancement processing on the standardized data to obtain an enhanced data set; and labeling the enhanced data to obtain the training data set.
[0009] According to some embodiments of the present application, the preset initial algorithm model is trained according to the training data set to generate a cloud algorithm model, including: optimizing the model parameters of the initial algorithm model to obtain an optimized algorithm model; iteratively training the optimized algorithm model a preset number of times according to the training data set to obtain multiple iterative algorithm models; and selecting the cloud algorithm model from the multiple iterative algorithm models.
[0010] According to some embodiments of the present application, the cloud algorithm model is selected from the multiple iterative algorithm models, including: obtaining a verification data set in the initial data set; inputting the verification data set into the iterative algorithm model to obtain the accuracy of the multiple iterative algorithm models; and selecting the cloud algorithm model from the iterative algorithm model according to a preset accuracy threshold and the accuracy.
[0011] According to some embodiments of the present application, the method further includes: inputting the verification data set into the iterative algorithm model to obtain a verification result; obtaining an error data set in the verification data set based on the verification result; and training the iterative algorithm model based on the error data set.
[0012] According to some embodiments of the present application, the structural processing of the cloud algorithm model to obtain the terminal algorithm model includes: adjusting the network structure of the cloud algorithm model according to the resource processing capability of the terminal to obtain the terminal algorithm model.
[0013] According to some embodiments of the present application, generating an application program applied to a terminal based on the terminal algorithm model includes: adjusting configuration information of a preset application inference library of the cloud algorithm model to obtain a model application inference library of the terminal algorithm model; and generating the application program based on the model application inference library and preset model resources.
[0014] According to some embodiments of the present application, the method also includes: sending the application to the terminal for installation; obtaining the recognition result returned by the terminal based on the application; updating the terminal algorithm model based on the recognition result; and updating the application based on the updated terminal algorithm model.
[0015] According to an electronic device of an embodiment of the second aspect of the present application, the device comprises: at least one processor, and a memory communicatively connected to the at least one processor; wherein the memory stores instructions, and the instructions are executed by the at least one processor so that when the at least one processor executes the instructions, the algorithm model-based application generation method as described in the first aspect is implemented.
[0016] The electronic device according to the present application has at least the following beneficial effects: by executing the application generation method based on the algorithm model mentioned in the embodiment of the first aspect, it is possible to flexibly realize the generation and application of AI algorithms on smart terminal devices to meet business needs.
[0017] According to the computer-readable storage medium of the fourth aspect embodiment of the present application, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the application generation method based on the algorithm model as described in the first aspect.
[0018] The computer-readable storage medium according to the present application has at least the following beneficial effects: by executing the application generation method based on the algorithm model mentioned in the embodiment of the first aspect, the generation and application of AI algorithms can be flexibly implemented on smart terminal devices to meet business needs.
[0019] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A schematic diagram of a specific process of the method for generating an application based on an algorithm model in an embodiment of the present application;
[0021] Figure 2 Generate methods for algorithmic model-based applications Figure 1 A specific flow chart of step S200;
[0022] Figure 3 Generate methods for algorithmic model-based applications Figure 1 A specific flow chart of step S300;
[0023] Figure 4 Generate methods for algorithmic model-based applications Figure 3 A specific flow chart of step S330;
[0024] Figure 5 Generate methods for algorithmic model-based applications Figure 3 Another specific flow chart of step S330;
[0025] Figure 6 Generate methods for algorithmic model-based applications Figure 1 A specific flow chart of step S500;
[0026] Figure 7 This is a partial flowchart of a method for generating an application based on an algorithm model in another embodiment of the present application. DETAILED DESCRIPTION
[0027] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0028] It should be noted that the logical order is shown in the flow chart, but in some cases, the steps shown or described can be performed in the order in different flow charts. If it is related to "several", it means more than one, if it is related to "multiple", it means more than two, if it is related to "below", it should be understood to include this number. The use of any and all examples or exemplary language ("for example", "such as", etc.) provided herein is only intended to better illustrate the embodiments of the present application, and unless otherwise required, it will not impose restrictions on the scope of the present application. Greater than, less than, exceed, etc. are understood to exclude this number, and above, below, within, etc. are understood to include this number. If there is a description of the first and second, it is only for the purpose of distinguishing technical features, and it cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the order of technical features indicated.
[0029] It should be noted that, unless otherwise specified, the singular forms of "a", "said" and "the" used in the embodiments are also intended to include plural forms, unless the context clearly indicates other meanings. In addition, unless otherwise defined, all technical and scientific terms used herein have the same meanings as those generally understood by those skilled in the art. The terms used in this specification are only for describing specific embodiments, not for limiting this application. The term "and / or" used herein includes any combination of one or more related listed items.
[0030] As a branch of machine learning, deep learning has been continuously developed in recent years and has been widely used in different fields. Deep learning models can be used for visual processing, speech recognition, natural language processing, etc. of terminal devices. However, deep learning needs to rely on the AI (Artificial Intelligence) computing power of terminal devices. Due to the difference in AI computing power, deep learning cannot be deployed on terminal devices at will, such as smart video terminals. Smart video terminals have different development technologies and different AI computing capabilities. Some smart video terminals with AI computing capabilities cannot upgrade, expand, and replace the built-in algorithms in the terminal devices online according to business needs, resulting in the inability to effectively apply related AI algorithms to specific business areas.
[0031] Based on this, the embodiments of the present application provide an application generation method, electronic device and storage medium based on an algorithm model, which can flexibly realize the generation and application of AI algorithms on smart terminal devices to meet business needs.
[0032] In a first aspect, an embodiment of the present application provides a method for generating an application based on an algorithm model.
[0033] It should be noted that the algorithm model-based application generation method mentioned in the embodiment of the present application is executed on the cloud server, and the algorithm model and the corresponding application that can be sent to the terminal device are obtained by executing the method at the cloud server. The terminal device mentioned in the embodiment of the present application can be a mobile terminal device or a non-mobile terminal device. The mobile terminal device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal device, a wearable device, a super mobile personal computer, a netbook, a personal digital assistant, a CPE, a UFI (wireless hotspot device), etc.; the non-mobile terminal device can be a personal computer, a television, a teller machine or a self-service machine, etc.; the embodiment of the present application takes the intelligent video terminal device as an example for explanation.
[0034] In some embodiments, reference Figure 1, shows a flow chart of the method for generating an application based on an algorithm model in an embodiment of the present application. It specifically includes the following steps:
[0035] S100, obtaining an initial data set;
[0036] S200, preprocessing the initial data set to obtain a training data set;
[0037] S300, training a preset initial algorithm model according to a training data set to generate a cloud algorithm model;
[0038] S400, adjusting the network structure of the cloud algorithm model to obtain the terminal algorithm model;
[0039] S500: Generate an application program applied to the terminal according to the terminal algorithm model.
[0040] In step S100, a certain number of initial data sets are obtained through data collection. The initial data set can be a collection of pictures based on different scenes, different object shapes, different object types, different scales and different shooting angles, that is, the initial data set contains several collected pictures, which can be used for subsequent training of the algorithm model.
[0041] In step S200, before using the data set to train the preset initial algorithm model, the initial data set needs to be preprocessed to obtain a preprocessed training data set in a unified form of the initial data set, wherein preprocessing refers to processing the initial data set from multiple angles, such as the size, size, color channel components, etc. of the data set.
[0042] In some embodiments, reference Figure 2 Step S200 specifically further includes the following steps:
[0043] S210, performing standardization processing on the initial data set to obtain a standardized data set;
[0044] S220, performing data enhancement processing on the standardized data set to obtain an enhanced data set;
[0045] S230: labeling the enhanced data set to obtain a training data set.
[0046] In step S210, the initial data set is standardized to obtain a standardized data set, wherein the data set takes the collected picture set as an example, and each picture in the picture set is standardized, for example, the picture format of each picture is unified into jpg or png; the picture size of each picture is processed into 416*416 according to the input requirements of the darknet53 backbone network, and three channel components of R (red), G (green), and B (blue) are provided for standardized processing.
[0047] In step S220, in order to improve the recognition accuracy of the preset initial algorithm model after training, the standardized data set can be subjected to data enhancement processing to obtain an enhanced data set, wherein the data enhancement data is an adjustment of the data set in terms of form, data parameters, etc. For example, taking the image data in the data set as an example, the image can be processed by any one or more data enhancement means such as horizontal flipping, angle rotation, saturation adjustment, exposure adjustment, hue adjustment, random cropping, translation transformation, and illumination transformation to obtain a processed enhanced data set, thereby improving the recognition accuracy of the initial algorithm model after training.
[0048] In step S230, the enhanced data set after data enhancement processing is labeled to obtain a labeled training data set, wherein the labeling process refers to labeling the key information in the enhanced data set so that when the model is trained, the labeled information can be trained intensively. Taking a picture in the enhanced data set as an example, the key parts of the picture are labeled by using the LabelImg tool, such as the information representing objects, people, scenery, etc. in the picture. LabelImg is a graphic image annotation tool written in Python technology and uses Qt (application development framework) as its graphical interface.
[0049] In step S300, the preset initial algorithm model is trained according to the acquired training data set to generate a cloud algorithm model. The training data set refers to the training data set obtained by executing the preprocessing mentioned in step S200, and the training data set is respectively subjected to standardization processing, data enhancement processing and annotation processing to be suitable for the subsequent training of the algorithm model; the initial algorithm model is the initial algorithm model to be trained. Taking the power grid industry as an example, the algorithm model of deep learning applied to the power grid is selected; the cloud algorithm model refers to a network structure applied to the cloud server, and the network structure is constructed based on the resource capacity, computing power, battery power and other aspects of the cloud server. In practical applications, the initial algorithm model is trained by selecting the yolov3 algorithm with darknet53 as the backbone network to obtain the algorithm model applied to the cloud server.
[0050] In some embodiments, reference Figure 3 Step S300 specifically further includes the following steps:
[0051] S310, optimizing the model parameters of the initial algorithm model to obtain an optimized algorithm model;
[0052] S320, performing a preset number of iterative training on the optimization algorithm model according to the training data set to obtain multiple iterative algorithm models;
[0053] S330, selecting a cloud algorithm model from multiple iterative algorithm models.
[0054] In step S310, the model parameters in the initial algorithm model are optimized to obtain an optimized algorithm model after optimization, wherein the optimized algorithm model refers to the algorithm model obtained after tuning the model parameters in the initial algorithm model; optimization refers to adjusting the model parameters in the initial algorithm model so that the model parameters in the initial algorithm model can further adapt to the training process, such as adjusting the model parameters such as the learning rate, momentum parameter, and weight decay regularization term of the algorithm model. In practical applications, different model parameters have different effects on the training process of the algorithm model. For example, taking the tuning of the learning rate as an example, when the value of the learning rate in the algorithm model is larger, the training speed of the algorithm model is faster, and it is easy to produce gradient explosion and oscillation, resulting in the inability to converge to the optimal solution training result of the training; when the value of the learning rate in the algorithm model is smaller, the training speed of the algorithm model is slower, and it is easy to over-train and fit and the convergence speed of the model training is slow. Taking the tuning of the momentum parameter as an example, the momentum parameter updates the gradient value after performing exponential weighted averaging of the gradient at the current moment and the gradient at the historical moment. The training mechanism of the momentum parameter can be used to alleviate the oscillations generated during the gradient descent process, smooth the original gradient, reduce the oscillation amplitude of the gradient descent process, and converge to the optimal solution in the same direction, thereby speeding up the training speed. Taking the weight attenuation regularization term as an example, the larger the weight attenuation regularization term parameter, the stronger the ability to suppress overfitting, and the smaller the weight attenuation regularization term parameter, the weaker the ability to suppress overfitting.
[0055] In practical applications, for the tuning of the learning rate parameter, a larger learning rate parameter can be set in the initial training to increase the learning speed, and after a certain number of rounds of training, the learning rate parameter can be gradually reduced; for the tuning of the momentum parameter, a smaller momentum parameter can be set in the initial trainer, and after a certain number of rounds of training, the momentum parameter can be gradually increased; for the tuning of the weight decay regularization term parameter, in order to prevent overfitting, the learned parameters can be reduced according to a fixed ratio, for example, the weight decay regularization term parameter can be usually set to 0.0005 at the beginning, and when overfitting occurs, the weight decay regularization term parameter can be appropriately increased to alleviate the fitting phenomenon. Through the above tuning of each model parameter, the adequacy and accuracy of the algorithm model training process can be guaranteed, and the recognition accuracy of the algorithm model can be improved.
[0056] In step S320, after the model parameters of the initial algorithm model are optimized, the optimized algorithm model corresponding to the tuned model parameters is obtained, the training data set is used as the input of the optimized algorithm model, the optimized algorithm model is iteratively trained according to the preset number of iterations, and multiple corresponding iterative algorithm models are generated according to the number of iterative trainings, that is, after each iterative training, an iterative algorithm model is generated, and further iterative training is performed on the original iterative algorithm model to generate a new iterative algorithm model. In practical applications, the process of training the initial algorithm model through the training data set is carried out together with the tuning of the model parameters. For example, the training data set is input in sequence to train the algorithm model, and after a certain number of training rounds, a new iterative algorithm model is generated. At this time, the model parameters of the generated new iterative algorithm model can be tuned, and the training data set is input into the algorithm model after tuning, so as to obtain another new iterative algorithm model, and the iterative training steps are executed cyclically to finally obtain multiple iterative algorithm models.
[0057] In step S330, an algorithm model is selected from multiple iterative algorithm models generated by training as a cloud algorithm model applied to the cloud server. In actual applications, the recognition accuracy of the iterative algorithm model can be verified, and the algorithm model with the highest recognition accuracy among the iterative algorithm models is selected as the cloud algorithm model.
[0058] In some embodiments, reference Figure 4 , step S330 specifically also includes the following steps:
[0059] S331, obtaining a verification data set from the initial data set;
[0060] S332, inputting the verification data set into the iterative algorithm model to obtain the accuracy of multiple iterative algorithm models;
[0061] S333, selecting a cloud algorithm model from the iterative algorithm model according to a preset accuracy threshold and accuracy rate.
[0062] In step S331, a verification data set in the initial data set is obtained. In practical applications, the initial data set includes a data set for subsequent model training and a verification data set for verifying the recognition accuracy of the trained algorithm model. The verification data set is a data set that has not been preprocessed and can be directly used as the input of the trained algorithm model to verify the recognition accuracy of the algorithm model; the method for obtaining the verification data set can be to divide or mark the data set required for verification when collecting the initial data set, so as to facilitate subsequent acquisition. This application does not limit the acquisition method.
[0063] In step S332, the verification data set is used as the input of the iterative algorithm model, that is, the verification data set is recognized by the iterative algorithm model to obtain a recognition result, and the recognition accuracy of the iterative algorithm model can be calculated based on the recognition result. Specifically, the verification data set includes a number of verification pictures for verifying the accuracy of the algorithm model, and the several verification pictures are input into the multiple iterative algorithm models obtained by executing step S320. After each iterative algorithm model recognizes the several verification pictures, it can obtain a corresponding recognition result, and the number of correct recognitions and the number of incorrect recognitions in the recognition results are calculated, thereby calculating the accuracy corresponding to each iterative algorithm model.
[0064] In step S333, the preset accuracy threshold and the calculated accuracy of the iterative algorithm model are compared, and the iterative algorithm model with an accuracy greater than the accuracy threshold is selected as the cloud algorithm model. If there are multiple iterative algorithm models with an accuracy greater than the accuracy threshold, the iterative algorithm model with the highest accuracy is selected as the cloud algorithm model. The accuracy threshold refers to a threshold set according to the actual business scenario, which is used to determine whether the recognition accuracy of the algorithm model meets the conditions. For example, if the algorithm model is used to identify hidden dangers, the accuracy threshold can be set to a lower value, such as 90%; if the algorithm model is used to identify defects, the accuracy threshold can be set to a higher value, such as 95%.
[0065] In some embodiments, reference Figure 5 , the embodiment of the present application specifically also includes the steps of:
[0066] S334, inputting the verification data set into the iterative algorithm model to obtain a verification result;
[0067] S335, obtaining an error data set in the verification data set according to the verification result;
[0068] S336, training the iterative algorithm model according to the error data set.
[0069] In step S334 and step S335, the verification data set is used as the input of the iterative algorithm model, that is, the verification data set is identified by the iterative algorithm model to obtain a verification result, and according to the verification result, a data set that is correctly identified and a data set that is incorrectly identified after the iterative algorithm model identifies the verification data set can be obtained, wherein the data set that is incorrectly identified is defined as an error data set. Specifically, the verification data set includes a number of verification images for verifying the accuracy of the algorithm model, and the several verification images are input into the multiple iterative algorithm models obtained by executing step S320. After each iterative algorithm model identifies the several verification images, a corresponding verification result can be obtained, and the error data set that is incorrectly identified by the iterative algorithm model can be obtained through the verification result.
[0070] In step S336, after preprocessing the obtained error data set, it is used as a training data set and input into the iterative algorithm model for training to improve the recognition accuracy of the algorithm model; or a data set with more expression information is collected as a training data set and input into the iterative algorithm model for training to improve the recognition accuracy of the algorithm model. The specific method for improving the accuracy of the algorithm model is not specifically limited in this application. In the embodiment of the present application, the error data set with recognition errors is input into the iterative algorithm model again for training, which can further improve the recognition accuracy of the iterative algorithm model.
[0071] In step S400, after selecting the iterative algorithm model with the highest accuracy from multiple iterative algorithm models as the cloud algorithm model, the cloud algorithm model is subjected to structural processing to obtain the terminal algorithm model. The structural processing refers to adjusting the network structure of the algorithm model to be suitable for a specific application scenario. It should be noted that the cloud algorithm model in the embodiment of the present application has a network structure applied to a cloud server, while the terminal algorithm model has a network structure applied to a terminal device; the differences and similarities of the network structure depend on the environment to which the algorithm model is applicable. For example, the cloud server is superior to the terminal device in terms of computing power, storage resources, and battery power, and the cloud server is also superior to the network structure of the terminal device in terms of network structure. And since the terminal device is often an embedded device, it is limited in terms of computing power, storage resources, and battery power, so it is necessary to process the network structure of the algorithm model, converting it from a network structure applicable to the cloud server to a network structure applicable to the terminal device, thereby improving the algorithm operation efficiency and the applicability of the algorithm model. In some embodiments, it is necessary to obtain the resource processing capability of the terminal device, wherein the resource processing capability includes but is not limited to the computing capability, storage resources and battery power of the terminal device. The network structure of the cloud algorithm model is adjusted by the resource processing capability corresponding to the terminal device to obtain the adjusted algorithm model, i.e., the terminal algorithm model. In practical applications, the network structure of the cloud algorithm model can be pruned and compressed, such as channel and layer pruning. First, the cloud algorithm model is sparsely trained, and the regularization term is induced to update the weight so that most of the parameters are 0, making it more sparse; then, according to the weight of the layer, the channels and layers that are not within the threshold range are pruned to achieve the compression of the depth and width of the algorithm model, and the network structure of the cloud algorithm is converted into the network structure of the algorithm model that can be run by the terminal device, thereby improving the algorithm operation efficiency. In addition, the parameters, weights and data of the cloud algorithm model can be processed by low-bit quantization compression, such as compressing the floating point 32-bit weights and bias parameters into int8-bit values, so that the network structure of the algorithm model is more lightweight, thereby saving the storage space of the algorithm model, reducing transmission delay, improving computing efficiency, and achieving the goal of performance improvement and optimization.
[0072] In step S500, an application program applied to the terminal device is generated according to the algorithm model obtained after adjusting the network structure, that is, the terminal algorithm model. It should be noted that the generation of the application program is executed on the cloud server, and the cloud server generates the application program based on the cloud development reasoning library. In actual applications, due to the different chip architectures and instruction sets in the cloud, the generation of the application program of the terminal device running the algorithm model depends on the reasoning library of the intelligent video terminal, so it is necessary to use the C language to develop an algorithm application that supports installation, update and uninstallation.
[0073] In some embodiments, reference Figure 6 , step S500 specifically also includes:
[0074] S510, adjusting the configuration information of the preset application reasoning library of the cloud algorithm model to obtain the model application reasoning library of the terminal algorithm model;
[0075] S520, generating an application program according to the model application reasoning library and preset model resources.
[0076] In step S510 and step S520, after adjusting the configuration information of the preset application reasoning library of the cloud algorithm model, the model application reasoning library corresponding to the terminal algorithm model is obtained, and the application is developed and generated according to the model resources required by the terminal algorithm model of the model application reasoning library. The application reasoning library provides dedicated image acceleration operators such as image scaling, cropping, conversion and statistical histogram, provides an open interface, and supports the development and implementation of private layers that are not supported by the application reasoning library, thereby realizing the forward reasoning of the neural network algorithm model; the model resources refer to the memory required for application generation and the memory resources occupied by the algorithm model; the configuration information of the application reasoning library includes but is not limited to the NPU (network processor, neural-network processing units) hard core, data type and network input scale and channel information. In actual applications, the memory required for application generation and the memory required for the algorithm model are obtained, and the power grid algorithm model and the inference library handle of the intelligent video terminal are created. The configuration information required by the inference library, such as the NPU hard core, data type, and scale and channel of the network input used by the application inference library, is set. The application inference library of the terminal device is used to implement forward reasoning and recognition of the algorithm model. Finally, the model resources of the application inference library and the algorithm model are released, so that the deep learning algorithm corresponding to the algorithm model can be run and recognized on the terminal device.
[0077] In some embodiments, reference Figure 7 , the embodiment of the present application specifically also includes the steps of:
[0078] S610, sending the application to the terminal for installation;
[0079] S620, obtaining the recognition result returned by the terminal according to the application;
[0080] S630, updating the terminal algorithm model according to the recognition result;
[0081] S640: Update the application program according to the updated terminal algorithm model.
[0082] In step S610, the cloud server sends the generated application to the terminal device so that the terminal device can install the application for use. In actual applications, the application can be sent to the terminal device in the form of http (Hypertext Transfer Protocol). When the terminal device receives the data corresponding to the application sent by the http protocol, it can be installed. The application is equipped with a well-constructed terminal algorithm model, which can perform deep learning and recognition, etc., and obtain the corresponding recognition results directly at the terminal device.
[0083] In step S620, when the terminal device has installed the application, it can obtain the data set to be identified through the application, identify the data set, and obtain the corresponding identification result locally on the terminal device. In addition, the cloud server can also obtain the identification result obtained by the terminal device through the application, that is, the terminal device has the ability to communicate with the cloud server, and returns the identification result to the cloud server through the communication connection, so that the cloud server can receive the operating status of the terminal device and the working status of the algorithm model in real time.
[0084] In step S630, after the cloud server obtains the recognition result of the terminal device, it can determine whether it is necessary to update the terminal algorithm model installed by the application installed in the terminal device according to the recognition result to ensure the accuracy of the recognition result. Specifically, the recognition result is the result obtained by the terminal device after identifying the data set to be identified through the application, and the result can intuitively express the recognition accuracy of the data set. The cloud server can obtain whether the algorithm in the terminal device needs to be updated through the recognition result. For example, when the recognition accuracy does not meet the expected expected value, the terminal algorithm model generation process mentioned in steps S100 to S400 can be executed, that is, a new data set is re-acquired to train the terminal algorithm model, and a new terminal algorithm model is generated by retraining, and the accuracy of the terminal algorithm model is guaranteed to be higher than the algorithm model in the terminal device, and the generated new terminal algorithm model is sent to the application in the terminal device for installation to update the originally installed terminal algorithm model. In addition, in actual applications, the cloud server can perform online installation, online update and online uninstallation of applications installed in the terminal device in real time. The specific process is similar to the method of updating the terminal algorithm model, and this application will not go into details.
[0085] In an embodiment of the present application, an initial data set is obtained, the initial data set is preprocessed to obtain a training data set, a preset initial algorithm model is trained according to the training data set, a cloud algorithm model is generated, the cloud algorithm model is structurally processed to obtain a terminal algorithm model, and an application program applied to the terminal is generated according to the terminal algorithm model. The generation and application of AI algorithms can be flexibly realized on smart terminal devices to meet business needs.
[0086] In a second aspect, an embodiment of the present application further provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor;
[0087] The processor is used to execute the algorithm model-based application generation method in the embodiment of the first aspect by calling the computer program stored in the memory.
[0088] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer executable programs, such as the algorithm model-based application generation method in the first aspect of the present application. The processor implements the algorithm model-based application generation method in the first aspect of the present application by running the non-transitory software programs and instructions stored in the memory.
[0089] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store an application generation method based on an algorithm model for executing the above-mentioned first aspect embodiment. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0090] The non-transient software programs and instructions required to implement the algorithm model-based application generation method in the above-mentioned first aspect embodiment are stored in the memory, and when executed by one or more processors, the algorithm model-based application generation method in the above-mentioned first aspect embodiment is executed.
[0091] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to: execute the algorithm model-based application generation method in the embodiment of the first aspect;
[0092] In some embodiments, the computer-readable storage medium stores computer-executable instructions, which are executed by one or more control processors, for example, by a processor in the electronic device of the second aspect embodiment, so that the one or more processors can execute the algorithm model-based application generation method in the first aspect embodiment.
[0093] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0094] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0095] In the description of this specification, the description with reference to the terms "some embodiments", "examples", "specific examples", or "some examples" means that the specific features or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example.
Claims
1. An application generation method based on an algorithm model, characterized in that: include: Get the initial data set; The initial data set includes a training data set for model training and a verification data set for verifying the recognition accuracy of the trained algorithm model; Performing standardization on the initial data set to obtain a standardized data set; Performing data enhancement processing on the standardized data set to obtain an enhanced data set; Performing labeling processing on the enhanced data set to obtain a training data set; If the initial data set is an initial picture set, the picture format of each picture in the initial picture set is unified, the picture size of each picture is processed to 416*416 according to the input requirements of the darknet53 backbone network, and the red channel component, green channel component and blue channel component are provided for standardization; If the standardized data set is a standardized picture set, the pictures in the standardized picture set are processed by any one or more data enhancement means selected from the group consisting of horizontal flipping, angle rotation, saturation adjustment, exposure adjustment, hue adjustment, random cropping, translation transformation, and illumination transformation; If the enhanced data set is an enhanced picture set, use the LabelImg tool to label the parts of the pictures in the enhanced picture set that represent objects, people and scenery; Optimizing the model parameters of the preset initial algorithm model to obtain an optimized algorithm model; Iteratively train the optimization algorithm model for a preset number of iterations according to the training data set to obtain multiple iterative algorithm models; Obtaining a verification data set from the initial data set; Inputting the verification data set into the multiple iterative algorithm models to obtain the accuracy of the multiple iterative algorithm models; Compare a preset accuracy threshold with the accuracy rate, and select an iterative algorithm model with an accuracy rate greater than the accuracy threshold from the multiple iterative algorithm models as the cloud algorithm model; if there are multiple iterative algorithm models with an accuracy rate greater than the accuracy threshold, select the iterative algorithm model with the highest accuracy rate as the cloud algorithm model; The network structure of the cloud algorithm model is cut and compressed according to the resource processing capability of the terminal to obtain a terminal algorithm model; wherein the cloud algorithm model has a network structure applied to a cloud server, the terminal algorithm model has a network structure applied to the terminal, and the resource processing capability includes the computing capability, storage resources and battery power of the terminal; An application program applied to the terminal is generated according to the terminal algorithm model.
2. The method for generating an application based on an algorithm model according to claim 1, characterized in that: The method further comprises: Inputting the verification data set into the iterative algorithm model to obtain a verification result; Acquire an error data set in the verification data set according to the verification result; The iterative algorithm model is trained according to the error data set.
3. The method for generating an application based on an algorithm model according to claim 1, characterized in that: The step of generating an application program applied to a terminal according to the terminal algorithm model comprises: Adjusting the configuration information of the preset application reasoning library of the cloud algorithm model to obtain the model application reasoning library of the terminal algorithm model; wherein the configuration information of the application reasoning library includes the network processor hard core, data type, and scale and channel of network input; The application is generated according to the model application reasoning library and preset model resources; wherein the model resources refer to the memory required for application generation and the memory resources occupied by the algorithm model.
4. The method for generating an application based on an algorithm model according to claim 1, characterized in that: The method further comprises: Sending the application to the terminal for installation; Obtaining the recognition result returned by the terminal according to the application; Updating the terminal algorithm model according to the recognition result; The application is updated according to the updated terminal algorithm model.
5. An electronic device, characterized in that include: at least one processor, and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions, and the instructions are executed by the at least one processor so that the at least one processor implements the algorithm model-based application generation method as described in any one of claims 1 to 4 when executing the instructions.
6. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the algorithm model-based application generation method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Method and device for debugging application
CN111316227A
Edge calculation model compression optimization method, device and equipment and readable medium
CN112232509A
