Model generation method, system and device and medium
By training the initial model based on preset parameters in the neural network model, and performing expanded training and updating under target conditions, the problem of difficulty in model iteration and multi-task execution is solved, and efficient and automated model updating and multi-tasking are achieved. implement.
Patent Information
- Application Number
- CN202310149546.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing technology, it is difficult to quickly iterate and automatically update neural network models, the degree of automation is low, and it is difficult to quickly respond to the needs of different tasks.
By training the initial model based on preset training parameters, and performing extended training when the target conditions are triggered, the collected images are used to update the model or derive a second model for different tasks, realizing automatic iteration and multiplexing of the model. Task execution.
It improves the rapid iteration and automation of the neural network model, realizes automatic optimization and multi-task execution of the model, reduces the difficulty of labeling and collecting image samples, and improves the flexibility and efficiency of model deployment.
Smart Images

Figure CN118537668A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a model generation method, system, device and medium. Background Art
[0002] Artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce new intelligent machines that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems.
[0003] Among them, in order to realize artificial intelligence for a certain task, a neural network model is generally trained for the task. Summary of the invention
[0004] In view of the above problems, a model generation method, device, system and medium according to an embodiment of the present disclosure are proposed to overcome the above problems or at least partially solve the above problems.
[0005] In order to solve the above problems, the first aspect of the present disclosure discloses a model generation method, the method comprising:
[0006] Based on preset training parameters, the initial model is trained using a pre-acquired image sample set to obtain a first model; wherein the initial model is used to perform a first task;
[0007] In response to triggering of the target condition, performing extended training on the first model, the extended training comprising:
[0008] Updating the first model based on the collected images; and / or training at least one second model based on the collected images and the first model;
[0009] The second model is used to perform a second task different from the first task.
[0010] In some optional examples, after the initial model is trained using the pre-acquired image sample set to obtain the first model, the method further includes:
[0011] Based on the training content of training the first model, a training template is obtained, where the training content includes: algorithm code, hyperparameters, and operating environment parameters;
[0012] The updating of the first model based on the collected images includes:
[0013] Based on the operating environment parameters in the training template, the first model is updated using the collected images as training samples; and / or, based on the training template, a third model is trained using the collected images as training samples, and the first model is updated based on the third model.
[0014] In some optional examples, after obtaining the first model, the method further includes:
[0015] In the process of multiple devices calling the first model, saving images uploaded by multiple devices, the images being the images to be processed by the first model;
[0016] In response to the triggering of the target condition, the first model is subjected to extended training, including:
[0017] In response to triggering a target condition that the number of stored images exceeds a preset number, performing extended training on the first model, wherein the collected images include the stored images uploaded by the device.
[0018] In some optional examples, updating the first model based on the operating environment parameter using the collected images includes:
[0019] Automatically annotating the collected images to obtain an annotation label for each of the images;
[0020] Based on the annotation labels, the collected images are divided into a training set and a test set;
[0021] Retraining the first model based on the training set; and verifying the trained first model based on the test set to determine whether the performance parameters of the retrained model are better than those of the first model;
[0022] After the verification is passed, the updated first model is obtained.
[0023] In some optional examples, retraining the first model based on the training set includes:
[0024] Using the training set to update parameters of the first model;
[0025] Performing model pruning and / or model distillation on the first model after parameter update;
[0026] The performance parameter may include at least one of the recognition accuracy and operation time of the model.
[0027] In some optional examples, the annotation label is a location box of the location of the text in the image; and the automatically annotating the collected images to obtain the annotation label of each of the images includes:
[0028] Invoking multiple position frame determination strategies to respectively determine the position frame of the position of the text in the same image, and obtaining an initial position frame determined by each position frame determination strategy;
[0029] Based on a plurality of initial position frames obtained from the same image and the confidence level corresponding to each initial position frame, the image is automatically annotated to obtain each annotated label.
[0030] In some optional examples, the first task is used to identify target content in an image, and the training of at least one second model based on the collected images and the first model includes:
[0031] Identifying target content in the collected images by using the first model;
[0032] Based on the identified target content, determining the categories corresponding to each of the collected images;
[0033] Clustering the collected images according to the categories to obtain multiple data sets;
[0034] The multiple data sets are respectively used as image sample sets corresponding to multiple second tasks to train at least one of the second models.
[0035] In some optional examples, the target content is text content, and determining the corresponding category of the collected images based on the identified target content includes:
[0036] Get the information extraction script uploaded by the user;
[0037] Based on the information extraction script, determining a text category corresponding to the identified text content;
[0038] Based on the text category, the categories corresponding to the collected images are determined.
[0039] In some optional examples, a plurality of the second models are included, and different second models correspond to different second tasks. The first task is used to identify target content in an image:
[0040] The second task is a downstream task of the first task, and the downstream task includes at least one of a classification task based on the target content, a permission verification task based on the target content, and a content decomposition task based on the target content.
[0041] In some optional examples, the first task is used to identify target content in an image, and the pre-acquisition process of the image sample set includes:
[0042] Acquire the labeled images and unlabeled images uploaded by multiple target terminals; the labeled images carry labels of the target content;
[0043] For the unlabeled image, outputting a labeling interface, wherein the labeling interface is used to instruct a user to label the target content;
[0044] In response to a labeling operation on an unlabeled image in the labeling interface, obtaining a label of the unlabeled image;
[0045] The labeled images and the unlabeled images with labels are determined as the image sample set.
[0046] In some optional examples, the first task is used to identify target content in an image, and the pre-acquisition process of the image sample set includes:
[0047] Synthesizing the content at the target position in the preset template image to obtain a synthesized image; wherein the synthesis is used to generate target content located at the target position;
[0048] Based on the annotated label corresponding to the target position in the template image, the label of the synthetic image is determined to obtain the image sample set.
[0049] In some optional examples, the first task is used to recognize text content in an image, and the synthesizing a target position in a preset template image to obtain a synthesized image includes:
[0050] For different target positions in the template image, using different text generation rules, text contents of different target positions are generated;
[0051] The text contents at different target positions are converted into text images, and the text images are fused into the corresponding target positions in the template image to obtain the composite image.
[0052] In some optional examples, before training the initial model using the pre-acquired image sample set based on the preset training parameters corresponding to the initial model, the method further includes:
[0053] In response to a model creation operation, acquiring the created initial model, wherein the model creation operation includes a selection operation of a preset model and / or an upload operation of a custom model;
[0054] Output a parameter configuration interface corresponding to the initial model, and obtain the preset training parameters through the parameter configuration interface.
[0055] In some optional examples, the outputting a parameter configuration interface corresponding to the initial model includes:
[0056] When the initial model is the model selected by the selection operation, outputting a parameter configuration interface corresponding to the selected model from a plurality of preset parameter configuration interfaces;
[0057] In the case where the initial model is the model uploaded by the upload operation, a container corresponding to the uploaded model is initialized, and the parameter configuration interface is output through the container.
[0058] In some optional examples, the first task is to recognize text content in an image, and after obtaining the first model, the method further includes:
[0059] The first model obtained by training is deployed into the local area networks to which the various devices belong, so that the devices can call the first model in the local area networks to which they belong;
[0060] Alternatively, the first model is deployed to the cloud, and a calling interface of the first model is provided to a plurality of the devices, so that the devices call the first model from the cloud through the calling interface.
[0061] In some optional examples, the target content includes text content, and after obtaining the first model, the method further includes:
[0062] In response to a call request for the first model, identifying text content in the image to be identified carried in the call request;
[0063] Determine the text category of the text content recognized by the first model based on a preset information extraction script;
[0064] Based on the text category and the recognized text content, a recognition result is fed back to the device that sent the call request.
[0065] A second aspect of the present disclosure provides a model generation system, comprising: a terminal and a plurality of devices communicating with the terminal; wherein a training platform is deployed on the terminal, and the training platform is used to execute the model generation method;
[0066] The device is used to call the first model to perform the first task based on the calling interface provided by the training platform, and upload images to the training platform during the process of calling the first model; and / or call the second model to perform the second task.
[0067] According to a third aspect of the present disclosure, a model generating device is provided, the device comprising:
[0068] A first training module, configured to train an initial model using a pre-acquired image sample set based on preset training parameters to obtain a first model; wherein the initial model is used to perform a first task, the first task comprising a task of identifying target content of an image, and the preset training parameters comprising operating environment parameters and hyperparameters of the initial model;
[0069] The second training module is used to perform extended training on the first model in response to the triggering of the target condition, and the extended training includes:
[0070] Based on the operating environment parameters, updating the first model using the collected images; and / or, training at least one second model based on the collected images and the first model;
[0071] The second model is used to perform a second task different from the first task.
[0072] The present disclosure also discloses an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the model generating method as described in the first aspect of the embodiment when executed.
[0073] According to a fourth aspect of the embodiments of the present disclosure, there is also disclosed a computer-readable storage medium, which stores a computer program that enables a processor to execute the model generating method as described in the embodiments of the first aspect of the present disclosure.
[0074] The model generation method proposed in the embodiment of the present disclosure can train the initial model based on preset training parameters using a pre-acquired image sample set to obtain a first model; then, in response to the triggering of the target condition, the first model can be subjected to extended training, and the extended training includes: updating the first model using the collected images, and / or, based on the collected images and the first model, training at least one second model; wherein the second model is used to perform a second task different from the first task.
[0075] On the one hand, since the first model can be automatically generated based on pre-set preset training parameters, automatic training of the first model can be achieved; wherein, the preset training parameters can be reused for subsequent optimization and updating of the first model, thereby achieving automatic optimization and iteration of the first model.
[0076] On the other hand, in response to the triggering of the target condition, the following strategy for the first model can be automatically triggered: the first model is updated based on the collected images, and / or, based on the collected images, the first model is trained as a second model for completing a second task different from the first task. The produced second model can be understood as a derivative model of the first model. In this way, the first model can be used as the base model and the collected images can be used to derive multiple second models for performing multiple different second tasks, thereby automatically triggering the iterative update of the first model and automatically producing the second model for performing different tasks, thereby improving the automation level of rapid iteration of the neural network model.
[0077] The above description is only an overview of the technical solution of the present disclosure. In order to more clearly understand the technical means of the present disclosure, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present disclosure more obvious and easy to understand, the specific implementation methods of the present disclosure are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the description of the embodiments of the present disclosure will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0079] Figure 1 is a schematic diagram showing an implementation environment of a model generation method in an embodiment of the present disclosure;
[0080] Figure 2 is a flowchart of the steps of the model generation method in the embodiment of the present disclosure;
[0081] Figure 3 A schematic diagram of a display interface of a training platform disclosed in the present invention is exemplarily shown;
[0082] Figure 4 A flowchart of the steps of updating the first model using the collected images based on the operating environment parameters is shown;
[0083] Figure 5 is a flowchart of the steps of training to obtain at least one second model in an embodiment of the present disclosure;
[0084] Figure 6 is a modular design diagram of a model generation method in an embodiment of the present disclosure;
[0085] Figure 7 It is a schematic diagram of the overall process of the model generation method in the embodiment of the present disclosure;
[0086] Figure 8It is a structural schematic diagram of a model generating device in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0087] In order to make the above-mentioned purposes, features and advantages of the present disclosure more obvious and understandable, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0088] In the related art, a training platform is provided to facilitate users to train neural network models. When using the training platform to train neural network models, the degree of automation is low, and it is difficult to quickly iterate and update the model. In view of this, the present disclosure provides a model generation method, the core purpose of which is to automatically update and optimize the trained model based on automatically collected images. To achieve this core purpose, a first model for performing a first task can be automatically trained based on preset training parameters. Then, when the target condition is triggered, the optimization of the first model can be automatically triggered, and / or, through the collected images, multiple second models that perform tasks different from the first task can be derived from the first model. In this way, the degree of automation of model output can be improved, and the efficiency of model output can be improved.
[0089] First, to facilitate understanding of the technical solution of the present application, the implementation environment of the present application is introduced.
[0090] Reference Figure 1 As shown, a schematic diagram of the implementation environment of the present application is shown, such as Figure 1 As shown, it includes a variety of devices and terminals; the terminal may be a personal computer or a server, and the various devices may include devices of different models and brands, such as mobile phones, tablet computers, personal computers, electrophoretic display screens, etc. No limitation is made here.
[0091] Among them, the terminal is configured with an AI (Artificial Intelligence) training platform for generating a neural network model. The AI training platform can actually be understood as a client system. In one case, the AI training platform can be independently configured on a personal computer, which does not rely on the computing power support of the server; or, the AI training platform can be configured on a personal computer, and the personal computer communicates with the server, and the server is used to provide computing power support and image sample sets for the training of the neural network model.
[0092] In actual application scenarios, users can log in to the AI training platform to produce models. Using the model generation method of the embodiment of the present application, users only need to configure the preset training parameters of the initial model and provide an initial set of image samples (including image samples) when training the model for the first time. The AI training platform can train the initial model to the first model according to the configuration; and in the extended training of the first model, user participation is no longer required or can be avoided as much as possible. The AI training platform automatically updates the first model based on the operating environment parameters when training the first model and using the collected images, and / or automatically derives at least one second model for performing the second task based on the first model and the collected images, thereby improving the degree of automation of the AI training platform in producing neural network models, thereby improving output efficiency.
[0093] Among them, the device is the user device of the first model and the second model produced, and the model produced by the AI training platform on the terminal can be called by the device so that the device can perform processing related to the first task and the second task. In some subsequent embodiments, in order to further improve the automation of model output and reduce the difficulty of collecting image samples, the image uploaded to the first model by the device when calling the first model will be automatically saved by the terminal. In other words, as the number of users using the first model increases, the number of saved images increases. When the number reaches a certain number, it can be considered that the target condition is triggered, thereby automatically triggering the expansion training of the first model.
[0094] Combination Figure 1 The implementation environment diagram shown in the figure is used to illustrate the model generation method of the present application. Figure 2 As shown, a flow chart of the steps of a model generation method of the present application is shown, such as Figure 2 As shown, the following steps may be specifically included:
[0095] Step S201: Based on preset training parameters corresponding to the initial model, the initial model is trained using a pre-acquired image sample set to obtain a first model;
[0096] The initial model is used to execute the first task, and the preset training parameters include at least the operating environment parameters and hyperparameters of the initial model.
[0097] In this embodiment, the initial model can be a custom model uploaded by the user to the AI training platform, or it can be a model pre-configured in the AI training platform. Depending on the first task, the structure and basic algorithm of the selected initial model may also be different.
[0098] Among them, in some examples, the first task includes a task of identifying the target content of the image. For example, the first task may be a task of identifying the category / position of the target content in the image. In some scenarios, the target content may be text content according to the needs. For example, in the OCR (optical character recognition) scenario, the first task may be a task of identifying the text in the image. In other scenarios, the target content may be a portrait, and the first task may be a task of identifying the face in the image. Of course, in practice, it is not limited to the above scenarios, and it can also be applied in other scenarios where the content in the image needs to be identified.
[0099] The identification of the target content may include identification of the type of the target content, and may also include identification of the location of the target content, that is, location detection.
[0100] Taking the target content as text content as an example, the preset algorithms of the initial model include commonly used OCR algorithms. For position detection, the initial model can be CTPN (connection text proposal network), PSENet (Shape Robust Text Detection with Progressive Scale Expansion Network), DBNet (Differentiable Binarizationnet) and other models. For content recognition, the initial model can be CRNN (Convolutional Recurrent Neural Network), ASTER (Attentional Scene Text Recognizer with Flexible Rectification), MORAN (Multi-Object Rectified Attention Network), etc.
[0101] Among them, the preset training parameters can be input by the user in the AI training platform, and the operating environment parameters may include the configuration parameters of the software and hardware environment in which the algorithm runs when training the model.
[0102] Among them, hyperparameters can refer to model parameters in the initial model, such as parameters such as weights in convolution kernels, which can be continuously updated during the training process.
[0103] Among them, the image sample set used to train the initial model may include multiple image samples, each image sample may carry a label for the first task for supervised training, and the label varies depending on the first task. For example, if the first task is to detect the location of text content, the label may be a location box where the text content of the image sample is located.
[0104] Among them, the process of training to obtain the first model can be: when the initial model training iteration reaches a certain number of times or time, the prediction result of the initial model can be obtained based on all image samples in the test set (text detection is the text box, and text recognition is the text content), the prediction result is compared with the true value, the accuracy of the initial model is calculated, and the model with the highest accuracy is selected as the first model.
[0105] Step S202: in response to the triggering of the target condition, performing extended training on the first model, the extended training comprising: updating the first model based on the collected images; and / or, training at least one second model based on the collected images and the first model;
[0106] The second model is used to perform a second task different from the first task.
[0107] In this embodiment, after the first model is produced, the first model is put online for reasoning and use, wherein the deployment and online deployment of the first model can be: publishing the first model so that multiple devices can download and run it on the devices, so that users can use the first model to perform the first task; or, publishing the calling interface of the first model, and multiple devices can use the first model through the calling interface.
[0108] In the process of using the first model, the target condition can be detected, and if it is detected that the target condition is met, the extended training of the first model can be automatically triggered. The target condition can be that the online running time of the first model exceeds the preset time, so that when the first model runs for the preset time, the extended training of the first model can be triggered; or the target condition can be that the number of images collected for the first task exceeds the preset number, so that when more than the preset number of images are collected, the extended training of the first model can be triggered.
[0109] The collected images may include a pre-acquired image sample set and an image sample uploaded by the device when the first model is called by the device online.
[0110] The expansion training may also include updating the first model and training the derivative training of at least one second model. In practice, the first model may be updated or at least one second model may be obtained based on the first model training according to the actual situation.
[0111] Wherein, in the case of updating the first model based on the collected images, the update may refer to updating the hyperparameters in the first model, such as incrementally training the first model with new images to improve the accuracy of the first model. When updating, in one example, the first model may be updated with the collected images based on the operating environment parameters when training the first model. That is to say, the software and hardware environment parameters configured when training the first model may be reused for updating the first model. In this way, the AI training platform may automatically start updating the first model directly based on the operating environment parameters when detecting that the target condition is triggered. In another example, the preset update parameters configured for the first model may also be obtained. The preset update parameters may include the operating environment parameters, algorithm code, training process, etc. when updating the first model. When updating the first model, the first model may be updated directly based on the preset update parameters using the collected image samples.
[0112] Among them, when using the collected images to train a second model for performing the second task based on the first model, the second task can be a downstream task of the first task. For example, the first task is a text detection task, and the second task can be a text content recognition task (converting text content into text content, that is, converting text in image format into text format); for another example, the first task is a text recognition task, and the second task can be a task of classifying images based on the recognized text content. For example, if the recognized text content includes: name, gender, and ID number, then the image can be classified as an ID card in the classification task.
[0113] Among them, different second models can correspond to different second tasks. For example, the first task is a text detection task, the second model may include a model for text content recognition, and may also include a model for image classification. The second models that perform different second tasks may include different neural network structures.
[0114] In some examples, a base model for performing the second task can be connected to the output end of the first model, for example, a base model for text content recognition. During training, an image sample set for training the second model can be constructed based on the collected images, and then the images in the image sample set are input into the first model, and the output results of the first model are input into the base model. The base model can perform the second task based on the output of the first model, thereby outputting the results of the second task, and updating the parameters in the base model based on the labels of the images in the image sample set and the results. When the training end conditions are met, the base model can be used as the second model.
[0115] Of course, in some embodiments, when the training end condition is reached, the overall structure of the basic model and the first model can also be used as the second model.
[0116] In some embodiments, after the first model is trained, the training process of the first model can be saved as a task template, wherein the task template includes saved content including algorithm code, hyperparameter configuration, data set selection, software and hardware environment, etc.; when needed, the template can be directly selected in the task template interface to create a task, so as to achieve the reproduction of the training process of the first model, that is, the training process of the first model can be reproduced, thereby training to obtain the same model as the previous first model.
[0117] By adopting the implementation scheme provided by the present disclosure, a first model can be automatically generated based on pre-set preset training parameters, and then the first model can be automatically updated based on the collected images in response to the triggering of the target conditions, and / or the first model can be trained as a second model for completing a second task different from the first task based on the collected images. In this way, the first model can be used as a base model and multiple second models can be derived using the collected images to perform multiple different second tasks, thereby automatically triggering the iterative update of the first model and automatically generating the second model for performing different tasks, thereby improving the automation level of rapid iteration of the neural network model.
[0118] In some embodiments, the model generation method provided by the present disclosure proposes the following improvement goals for the entire model generation process in order to achieve high automation of the entire process and meet different model training requirements:
[0119] ① Automation of model training and iterative optimization, including training automation and automatic triggering of iterative optimization;
[0120] ② It can satisfy users to develop their own algorithms and support customizable model training and prediction;
[0121] ③ Improve the flexibility of model deployment;
[0122] ④ The model optimization process and performance indicators can be intuitively displayed;
[0123] ⑤Support the development of functional services derived from the trained models.
[0124] Among them, the present disclosure achieves the above five improvements through the following technical solutions:
[0125] Regarding point ①:
[0126] The automated training of its model includes automated iteration, automated image collection, and automated image sample annotation.
[0127] <1> After deploying the first model, automated image collection
[0128] In some examples, images used for extended training can be automatically collected. Specifically, when the device calls the first model to perform the first task, the images uploaded by the device can be saved. The uploaded images are images to be processed by the first model. In this way, as the number of users using the first model increases, the number of saved images increases. When the number reaches a certain number, extended training of the first model is automatically triggered.
[0129] In some embodiments, in the process of multiple devices using the first model, when saving images uploaded by multiple devices, the target device that has obtained the image usage permission can be determined; and in response to the target device's request to use the first model, based on the image usage permission, through the interface corresponding to the target application on the target device, the image acquisition device of the target device is called to acquire the image; then, the acquired image is saved to the database.
[0130] In this example, after the first model is deployed to multiple devices, an image usage permission request can be sent to the device. The device can determine whether to agree to the image usage permission request to allow the terminal to save the image uploaded when calling the first model. If agreed, it means that the terminal has obtained the image usage permission of the device. The device that obtains the image usage permission is called the target device. In practice, when the target device calls the first model, the terminal can call the camera of the target device through the interface corresponding to the target application on the target device to capture images, and then save the captured images to the database.
[0131] In some examples, when saving an image uploaded by a device calling the first model, the terminal can generate an API service, which is only used to receive image data uploaded by the device. In practice, the API service can be associated with a target application in a target device. The target application can, for example, be a WeChat applet in the device. The target application can call the device's image acquisition module, such as a camera, and based on user selection, upload the image in the device's album to the terminal's API service through the target application, and then the terminal saves it to a database.
[0132] Since the images uploaded when the device calls the first model are automatically saved, the saving process may not be known by other devices and terminals. In other words, the images uploaded to the first model directly enter the database, and the subsequent AI training platform can directly call the images in the database to perform extended training. Therefore, the process of collecting images after the first model is generated may not be viewed by other users, and the real data uploaded by the users of the first model is invisible to developers, which effectively protects the privacy of service users and ensures data security.
[0133] Of course, the above is only one implementation method. In other implementation methods of collecting images, the terminal can also be connected to a third-party data platform to synchronize image data from the third-party data platform.
[0134] <2> Automated iterative optimization
[0135] Since images uploaded by multiple devices are saved in the process of calling the first model by multiple devices, the images are images to be processed by the first model; accordingly, when the first model is subjected to extended training in response to the triggering of the target condition, the first model may be subjected to extended training in response to the triggering of the target condition that the number of saved images exceeds a preset number; wherein the collected images include the images uploaded by the saved devices.
[0136] When the number of images saved in the database exceeds the preset number, it can be regarded as the target condition being triggered, and the extended training of the first model can be automatically triggered. Since the iterative update of the first model is automatically triggered based on the number of collected images, the model can be iteratively updated when the number of collected images reaches a sufficient number, thereby increasing the richness of the image sample set for iterative optimization and update.
[0137] In some embodiments, when updating the first model, not only can the update be automatically triggered, but also the updating process can be automated after the update is triggered without manual intervention. Specifically, after the first model is trained, the training content of the first model can be saved, and then when the extended training is triggered, the first model can be automatically updated with the collected images according to the saved training content.
[0138] Among them, a training template can be obtained based on the training content of training the first model, and then, based on the training template, the first model is updated with the collected images as training samples; and / or, based on the training template, a third model is trained using the collected images, and the first model is updated based on the third model.
[0139] Among them, the training content includes: algorithm code, hyperparameters, and operating environment parameters.
[0140] In one example, the software and hardware environment of the first model can be deployed and updated based on the operating environment parameters in the training template, and the parameters of the first model can be updated using the collected images as training samples. In this way, the parameters of the first model can be fine-tuned to optimize the performance of the first model.
[0141] In another example, the training process of the first model can be reproduced based on the training template and the collected image samples. During the reproduction process, since the collected image samples may be different from the pre-acquired image samples, a third model is obtained through training, and the third model is used for model deployment.
[0142] Specifically, based on the operating environment parameters in the training template, the software and hardware environment of the first model can be deployed and updated, based on the hyperparameters in the training template, the hyperparameters in the first model to be updated can be set, and based on the algorithm code, the operators in the first model to be updated can be set. In this way, the process of training the first model can be reproduced, except that the training samples are different, and the parameters of the trained third model are different from those of the old first model. By updating in this way, it can be ensured that the third model is applicable to the collected images, so that it can dynamically adapt to changes in the images to be identified.
[0143] Among them, the old first model can be replaced by the third model, and the device can use the new first model by calling the interface. In specific implementation, the hyperparameters of the third model can also be migrated to the first model to obtain a new first model. In the actual update, the parameters of the first model can be fine-tuned, and the third model can be trained, and the first model with fine-tuned parameters and the obtained third model can be deployed online together.
[0144] <3> Automatic annotation of image samples
[0145] Among them, when training the initial model to obtain the first model, the annotation of its image sample set can also be automatic annotation, or it can be semi-automatic annotation. Automatic annotation can refer to annotation by the AI training platform, and the AI training platform itself generates images with labels. Semi-automatic annotation can refer to annotation by users on the AI training platform, and the platform generates image labels based on the user's annotations.
[0146] In a semi-automated implementation, the AI training platform can provide annotation tools to annotate images. Specifically, it can obtain annotated images and unannotated images uploaded by multiple target terminals, and the annotated images carry labels of the target content;
[0147] Among them, for unlabeled images, an annotation interface can be output, and the annotation interface is used to instruct the user to annotate the target content; and in response to the annotation operation on the unlabeled image located in the annotation interface, the label of the unlabeled image is obtained; then, the annotated image and the unlabeled image with label are determined as an image sample set.
[0148] In this embodiment, the annotation operation is different according to the target content and the first task. For example, if the target content is text content and the first task is a text content location detection task, the annotation operation can be a user clicking on a location on the image, for example, the user clicks on the endpoint of the text location area to obtain a rectangular frame, which contains the text content and is used to indicate the location of the text content. Alternatively, in some cases, the annotation operation can be an operation of moving, zooming in or out, etc., a preset rectangular frame so that the rectangular frame can select the target content.
[0149] Of course, for the face detection task, its annotation operation can refer to the position annotation operation of the text content.
[0150] In some other scenarios, if the target content is a face image, the first task is to detect the gender of the face image, and the labeling operation can be an operation in which the user labels the gender of the face, such as inputting "0" to indicate the gender is "female" and inputting 1 to indicate the gender is "male".
[0151] The labeling results can be used as labels for unlabeled images, and both labeled images and unlabeled images with labels can be used as image sample sets.
[0152] Taking the target content as text content and the first task as the position detection task of the text content as an example, when annotating, the image to be annotated is uploaded to the platform; then a annotation task is created and the data set in the platform is associated. After entering the annotation task, the terminal pops up an annotation interface, and the image is located in the annotation interface. The user can drag and draw a rectangular box on the image, or click to draw a polygonal box as the annotation result of text content detection; further, if the first task includes a text content recognition operation, after drawing the rectangular box, the text content selected by the rectangular box can be edited in the pop-up dialog box as the annotation result of text recognition.
[0153] In some embodiments, after the annotation is completed, the annotation result is saved in the form of a dictionary, wherein the annotation result includes information such as the image size, the position of the rectangular frame in the image, and the text content.
[0154] In an automated implementation, the content of a target position in a preset template image can be synthesized to obtain a synthesized image; based on the annotation label corresponding to the target position in the template image, the label of the synthesized image is determined to obtain an image sample set; wherein the synthesis is used to generate the target content located at the target position.
[0155] Among them, the template image can be an image in which each image content is arranged according to a preset format, such as an ID card image. The target position can be fixed in different template images. For example, taking the ID card image as an example, the various contents in the ID card are arranged according to a fixed format, and the layout positions of different image contents in the ID card image are fixed. The target position can refer to the position where the target content is located, which is fixed in each template image.
[0156] This embodiment can be applied to OCR recognition, that is, the first task is the OCR-related text position detection task and text content recognition task, and the text content at the text location (that is, the content at the target location) can be synthesized. In this scenario, the template image can be various document images, such as identity card document images, and specifically, the target location can be the location of the text in the document image. In this scenario, the text content can be intercepted from the dictionary library or article, and the image drawing tool, such as opencv or pillow, is used to convert the intercepted text content into an image, and then the image is pasted to the target location to obtain a synthesized image.
[0157] Of course, this embodiment can also be applied to other first tasks, for example, to gender recognition of faces in face ID images. The target position is the position of the face. During synthesis, faces of different genders can be captured from an existing face library, or a virtual face image can be synthesized and pasted to the target position to obtain a synthesized image.
[0158] Among them, each target position in the template image corresponds to a label, which can be pre-carried in the template image and is used to indicate the recognition result of the target content, for example, the target position where the target content is located, the classification result of the target content, the text recognition result, etc.
[0159] When the target content of the target location is automatically synthesized, there is no need to collect a large number of real images, thereby reducing the difficulty of image collection and solving the problem of difficulty in obtaining image sample sets in model training.
[0160] Accordingly, in the case where the target content includes text content, the target position in the preset template image is synthesized to obtain a synthesized image. For different target positions in the template image, different text generation rules can be used to generate text content for different target positions; and the text content at different target positions is converted into text images, and the text images are fused to the corresponding target positions in the template image to obtain a synthesized image.
[0161] In this embodiment, when the target content is text content, the first task may be a task of detecting the location of the text content, or may be a task of recognizing the text content, wherein the template image may be an ID image, including multiple target locations, and the target contents in different target locations may be different or the same. When synthesizing the contents of the target locations, different text generation rules may be used for different target locations to generate corresponding text contents.
[0162] Among them, the text generation rule can be understood as a generation algorithm that converts text content into images, such as OpenCV and Pillow, which convert the intercepted text content into a text image; then, the text image is pasted into the corresponding target position to obtain a synthetic image.
[0163] In some embodiments, Gaussian noise, different light and dark changes, horizontal and vertical lines, etc. may be added to the background of the template image to simulate an image captured in a real shooting scene, thereby obtaining a synthetic image.
[0164] When this implementation is adopted, different text generation rules are used at different locations to synthesize the content of the target location, which can increase the difficulty of model recognition. Therefore, through training, the recognition accuracy of the model can be improved to meet the recognition of images taken under different shooting conditions.
[0165] Regarding point ②:
[0166] In some embodiments, during the training of the first model, in order to improve the degree of automation and meet the model training of different requirements, an environment for customizable model training and automated training may be provided, which may include an environment that supports customized training parameters and an environment that supports customized model algorithms.
[0167] Before entering the training of the initial model, it is necessary to obtain the initial model and preset training parameters. In specific implementation, the created initial model can be obtained in response to the model creation operation, and a parameter configuration interface corresponding to the initial model can be output, and the preset training parameters can be obtained through the parameter configuration interface;
[0168] The model creation operation includes a selection operation of a preset model and / or an upload operation of a custom model.
[0169] As described above, the initial model can be a model pre-configured by the AI training platform or a user-defined model. In this embodiment, the AI training platform of the terminal can provide a parameter configuration interface for the operating environment parameter configuration and hyperparameter configuration of the user-defined model, so as to facilitate the user to set the operating environment parameters and hyperparameters of the customized model in the parameter configuration interface.
[0170] Among them, the model creation operation can represent the need to select an initial model for the first task. In specific implementation, a model selection interface can be output in response to the model creation operation. The model selection interface can include multiple virtual function buttons. The multiple virtual function buttons can include buttons for selecting models preset in the platform, for example, a button named "preset algorithm", and buttons for uploading customized models, for example, a button named "custom algorithm". Of course, the multiple virtual function buttons can also include other buttons for providing other settings of the initial model, such as name settings, image sample set settings, etc.
[0171] Among them, the initial model selected by the user can be obtained through the model selection interface, and then the parameter configuration interface corresponding to the initial model can be output. In some embodiments, the parameter configuration interface may also include multiple virtual buttons, specifically virtual buttons for setting operating environment parameters, and virtual buttons for setting hyperparameters. As described in the above embodiment, the operating environment parameters can be used to indicate the hardware and software selected for training the initial model. The hardware may include a GPU (graphics processing unit), a CPU (central processing unit), an NPU (Neural-network Processing Unit), etc. When the hardware and software to be run are selected, the operating environment parameters can be obtained.
[0172] In some embodiments, for the preset models preset on the AI training platform, each preset model can be equipped with a parameter configuration interface to configure the hyperparameters and operating environment of the preset model. For the custom model uploaded by the user himself, the container of the custom model can be initialized based on the custom model, and then the parameter configuration interface can be output.
[0173] Wherein, when the initial model is the model selected by the selection operation, a parameter configuration interface corresponding to the selected model is output from a plurality of preset parameter configuration interfaces;
[0174] Wherein, when the initial model is a model uploaded by an upload operation, a container corresponding to the uploaded model is initialized, and a parameter configuration interface is output through the container.
[0175] In this embodiment, if the initial model is a selected preset model, the terminal can output a parameter configuration interface corresponding to the initial model. That is to say, when a preset model is pre-installed in the AI training platform of the terminal, there will be a parameter configuration interface corresponding to each preset model, and hyperparameters and operating environment parameters are input through the parameter configuration interface.
[0176] If the initial model is a model uploaded by the user, that is, the initial model is a user-defined model, then the container corresponding to the initial model can be initialized first. The container can be understood as a running environment of the customized model on the terminal, so that the parameter configuration interface corresponding to the customized model can be output through the container. The process of initializing the corresponding container based on the uploaded initial model can be referred to the relevant technology, which will not be repeated here.
[0177] Through this implementation method, whether it is a preset model preset in the platform or a customized model, the configuration of preset training parameters and the automatic training of the first model can be realized, so that model training no longer depends on the content preset by the platform, but can be customized by the user according to the needs, thereby improving the degree of automatic training of the model and achieving the above-mentioned improvement goal of point ②, that is, it can meet the needs of users to develop their own algorithms and support customizable model training and prediction.
[0178] Regarding point ③:
[0179] In some examples, the first model can be automatically deployed to multiple devices. When automatically deployed, its deployment can include private deployment and public deployment. Private deployment can mean that the first model can only be used by devices that meet the same conditions, for example, it can only be called by devices in a local area network; public deployment can mean that the first model can be open to devices in need, for example, it can be deployed to the cloud, and devices in need can download it from the cloud.
[0180] Accordingly, the following deployments are provided:
[0181] The trained first model can be deployed to local area networks to which multiple devices belong, so that the devices can call the first model in their respective local area networks;
[0182] Alternatively, the first model is deployed in the cloud, and a calling interface of the first model is provided to multiple devices, so that the devices call the first model from the cloud through the calling interface.
[0183] In this embodiment, when the terminal deploys the first model to a local area network to which multiple devices belong, the terminal can first send the first model to a management device in the local area network. The management device can load the model data of the first model and provide an interface that can be called by multiple devices in the local area network, so that multiple devices can call the first model on the management device through the interface to perform the first task.
[0184] Among them, since in some embodiments, it is necessary to save the image data uploaded when the device calls the first model, in this deployment method, the management device can send the uploaded image data to the terminal again, so that the terminal can save the image uploaded by the device.
[0185] When the terminal deploys the first model to the cloud corresponding to the first task, the first model can be uploaded to the cloud server. The cloud server can generate a calling interface of the first model for multiple devices, wherein the device that can call the calling interface can obtain the calling permission in advance, and then call the calling interface of the first model based on the calling permission, thereby using the first model to perform the first task.
[0186] Among them, the device may have a target application corresponding to the calling interface. As described in the above embodiment, the target application may be a small program on the device, or other types of applications. When the device needs to use the first model, the calling interface can be called out through the target application, and then the image data can be uploaded through the target application. The image data is then input into the first model in the cloud to obtain the result of executing the first task. The result can be returned to the target application via the calling interface so that the user on the device can obtain the execution result.
[0187] When using any of the above deployment methods, the user can select the task to run the software and hardware environment and inference script online on the web page; when the first model is trained by the initial model preset by the AI training platform, the user can directly select the name of the initial model to launch the trained first model online; when the first model is trained by the user-defined initial model, the user can quickly deploy and launch the model after completing the writing of the inference script of the first model. When deployed and launched to the cloud, the terminal immediately generates a public cloud API and associates it with the WeChat applet or APP.
[0188] By adopting the technical solution provided in this example, since it can be deployed to a local area network where multiple devices are located, or to the cloud, all devices in need can call the first model, thereby achieving the improvement goal mentioned in point ③, that is, to increase the flexibility of model deployment.
[0189] Regarding point ④:
[0190] In this embodiment, the AI training platform can provide various interfaces during the model training process to help users intuitively understand the results and progress of model training. Figure 3 As shown, a display interface diagram of a training platform of the present application is exemplarily shown, combined with Figure 3 As shown, the training process of the present invention is intuitively explained.
[0191] Among them, the target content can be output in response to the received target operation, and the target operation is used to characterize the training of the first model, or the optimization of the first model, or the training of the second model; the target operation can be a single-click or double-click operation on the function button displayed in the display interface. By way of example, for the training of the first model, it can output a function button of "New Model", and click the function button to output the target content; by way of another example, for the optimization of the first model, its target operation can be a double-click operation on the "first model", and the first model is generally deployed as a model file on the AI training platform, and a double-click operation on the model triggers the output of the target content; by way of another example, for the training of the second model, its target operation can be a right-click operation on the "first model", for example, selecting the model file of the first model and right-clicking to trigger the output of the target content.
[0192] The target content may include at least three virtual buttons corresponding to the training nodes, and the position order of the multiple virtual buttons on the display interface may be consistent with the order of the training nodes during the training process. Figure 3 As shown, the training nodes include data uploading and labeling, automated training, model verification and publishing, and correspondingly three virtual buttons are arranged in a certain order on the display interface.
[0193] In practice, in response to the triggering of the virtual button in the target content, the training task corresponding to the training node can be executed, and the task information of the training task can be output on the display interface. The task information can be different according to different training nodes. Specifically, the task information can include training progress information, training result information and operation information. Figure 3 As shown, for example, click "Upload and label data" to display operation information to prompt the user what operation to perform; click "Automated training", and as the training progresses, the training progress can be displayed in real time, such as the completion of data set division, deployment of model parameters, start of training, current number of training times, etc.; click "Model verification and release", the task information includes the name of the trained model and the application scenario, such as the model is "face recognition model" and the application scenario is "face recognition scenario".
[0194] In this embodiment, after "data upload and annotation" is triggered, the uploaded image can be displayed in the display interface in response to the image sample uploaded by the user, and an annotation template can be provided. The annotation template can be different depending on the content to be annotated. Taking the need to annotate a rectangular box as an example, a rectangular box can be provided. The user can drag the rectangular box to the corresponding position and change the size of the rectangular box by mouse operation to achieve annotation of the content to be annotated.
[0195] In some annotations, each time an image is uploaded, the image can be enlarged and displayed, and a annotation template can be generated. After the user completes the annotation using the annotation template, the image is automatically reduced and the annotation label is retained; then, the next image is annotated.
[0196] In this embodiment, the AI training platform can realize the visualization of model automated training by outputting target content and achieve information interaction with users. Through the triggered virtual button, it can automatically enter the training link of the corresponding training node to perform training in the background, which greatly simplifies the user's operation and realizes the automated production deployment of the neural network model.
[0197] For example, taking the training of the first model as an example, the user right-clicks "New", and the output is Figure 3 The target content shown, the user clicks "Upload and Annotate Data" in the target content, and an image upload dialog box pops up. The user uploads 1000 image samples through the dialog box, which can be uploaded in batches or in batches. Some of the 1000 image samples uploaded are displayed in the interface, and the first image sample is automatically enlarged and displayed, and a labeled rectangular box is output at the same time. The user drags the labeled rectangular box and moves it to the content to be annotated in the image sample. Release the mouse, the annotation is completed, and the annotation label of the image sample is automatically saved. Specifically, the annotation label can be the position coordinates of the labeled rectangular box in the image sample; then, the image sample is reduced, and then the second image sample is enlarged, and a labeled rectangular box is output at the same time. The user drags the labeled rectangular box and moves it to the content to be annotated in the image sample, and so on, thereby realizing the annotation of the image samples.
[0198] Then, in response to the user clicking on "Automatic Training", the background starts to deploy the initial model according to the preset training parameters, and uses the labeled image samples to train the book publishing model, wherein the training progress is displayed in real time on the display interface.
[0199] Afterwards, when the end condition is reached, the training is displayed to be completed. After that, in response to the user clicking on "Model Verification and Release", the verification and automatic deployment of the first model will begin, and the name of the first model obtained and the terminal to which it is deployed will be displayed on the display interface. The name of the first model can be input in advance by the user.
[0200] In this way, the entire training process can be visualized, automated and simplified.
[0201] Regarding point ⑤:
[0202] As described above, when the target condition is triggered, the first model can be extended and trained to produce a second model that performs different tasks, thereby deriving different functional services.
[0203] The extended training is introduced below. In some examples, the extended training can be to update the first model, or to derive and train a second model based on the first model and the collected images, or to both update the first model and derive and train the second model.
[0204] Among them, for the update of the first model, in some embodiments, in order to achieve automatic optimization iteration, it can include automatic labeling and division of the training set and test set used by the first model, and automatic screening of the model.
[0205] Reference Figure 4 As shown, a flowchart of the steps of updating the first model using the collected images based on the operating environment parameters is shown, such as Figure 4 As shown, the following steps may be specifically included:
[0206] Step S301: automatically annotating the collected images to obtain an annotation label for each image;
[0207] Step S302: Divide the collected images into a training set and a test set based on the annotation labels;
[0208] Step S303: retraining the first model based on the training set;
[0209] Step S304: Verify the trained first model using the test set to determine whether the performance parameters of the retrained model are better than those of the first model;
[0210] Step S305: After verification, an updated first model is obtained.
[0211] In this embodiment, the collected images, as described above, may be images uploaded when the device calls the first model. When the number of uploaded images reaches a preset number, the update of the first model may be triggered. First, it is necessary to obtain an image sample set for updating the first model based on the collected images. Specifically, the collected images may be automatically annotated to obtain an annotation label for each image. The automatic annotation may be performed based on the first model. The first model may obtain an annotation label for each collected image and a corresponding confidence level. The annotation label with a higher confidence level is used as the annotation label.
[0212] The annotation labels for this image.
[0213] In practice, the images with annotated labels can be divided into a training set and a test set, and the division can be based on a preset ratio, for example, randomly divided according to a ratio of 8:2, that is, the ratio of the number of images in the training set to the number of images in the test set is 8:2. The preset ratio can be determined by the user according to actual conditions.
[0214] Next, a training environment is constructed based on the operating environment parameters, and the first model is trained in the training environment, wherein the hardware and software environment for updating the first model, i.e., the training environment, can be initialized based on the operating environment parameters of the first model. Then, in the training environment, the first model is retrained using the training set, wherein the retraining process can refer to the above-mentioned process of training the initial model. The retraining can iteratively optimize and update the hyperparameters in the first model, so as to obtain a first model with higher accuracy through training with the collected images.
[0215] During the retraining process, the current first model can be verified using the test set at preset time intervals or after each preset number of trainings to verify the performance parameters of the current first model and the original first model, wherein the performance parameters can be represented by the recognition accuracy of the images in the test set.
[0216] In specific implementation, the current first model can be used to identify the target content in the images in the test set, and the original first model can be used to identify the target content in the test set, and then based on the recognition results of the two, such as the recognition accuracy of the two, it is determined whether the performance of the current first model is better than that of the original first model; wherein, if the recognition accuracy of the current first model is high, it can be determined that the retraining has optimized the original first model, so that the training can be terminated to obtain the updated first model; if the recognition accuracy of the current first model is low, retraining can continue until the recognition accuracy of the current first model is high.
[0217] The recognition accuracy rate refers to the proportion of images in the test set whose difference between the recognition result and the annotated label is less than the preset difference, that is, the proportion of correctly recognized images in the test set.
[0218] In some embodiments, when the annotation label is a location box of the text location, when the collected images are automatically annotated, a fusion algorithm can be called to perform data annotation to improve the accuracy of the annotation.
[0219] Specifically, multiple position box determination strategies can be called, and the position box determination strategies are used to determine the initial position box where the same text is located in the image; based on the initial position boxes determined by the multiple position box determination strategies and the confidence corresponding to each initial position box, the image is automatically annotated to obtain each annotation label.
[0220] Among them, the automatic annotation of the collected images, when applied to OCR recognition, may refer to the location box where the annotated text content is located. In some embodiments, the location box determination strategy may refer to a location box determination algorithm, for example, the CR-OTSU (maximum between-class variance method) algorithm is used to extract the edge box where the text content is located, and the BP (backpropagation, feedforward) neural network is used to obtain the location box where the text content is located. Among them, the initial location box determined by different location box determination strategies corresponds to a confidence level, which is used to characterize the credibility of the initial location box. The higher the confidence level, the more accurate the determination of the initial location box.
[0221] Among them, the initial position box with the highest confidence can be used as the annotation label of the image.
[0222] In some embodiments, retraining of the first model may include native model training, pruned model training, distilled model training, etc.; wherein, native model training refers to updating the model parameters (hyperparameters) of the first model, pruned model training refers to pruning the first model to reduce the complexity of the model structure, and distilled model training may refer to distilling the first model to reduce the computational complexity of the first model.
[0223] Accordingly, when the first model is retrained based on the training set, the training set can be used to update the parameters of the first model; and the first model after the parameter update is subjected to model pruning and / or model distillation;
[0224] The performance parameter may include at least one of the recognition accuracy and operation time of the model.
[0225] In this embodiment, the hyperparameters of the first model may be updated using the training set, and then model pruning, or model distillation, or both may be performed on the first model after the parameter update.
[0226] Among them, model pruning and model distillation can both be used to simplify the network structure of the model. Model distillation is to transfer the generalization ability "knowledge" of the trained first model to a network with a simpler structure, thereby reducing the amount of calculation and model complexity.
[0227] In which, when performing verification, the performance parameters may also include the operation time of the model, which may refer to the time taken by the first model to process the input image and obtain the execution result after the network structure is streamlined. If the operation time is also less than the operation time of the original first model, it is determined that the retrained first model is better than the original first model.
[0228] In practice, the iterative optimization can be determined to be successful when the recognition accuracy of the first model after retraining is high, or when the operation time of the first model after retraining is short. Or, the iterative optimization can be determined to be successful when the recognition accuracy of the first model after retraining is high, or when the recognition accuracy of the first model after retraining is high and the operation time is short.
[0229] The output and iterative optimization of the first model are illustrated below with a specific example.
[0230] For example, taking the initial model as the model preset by the platform, the user selects a suitable initial model from multiple preset models, selects a training set and a test set, and clicks to start training; after the training is completed, the platform saves the model with the best accuracy on the verification data set (the first model) in the database;
[0231] The first model is published, and the images uploaded by the device are saved when the device calls the first model. When the uploaded images exceed 10,000, an update process for the first model is triggered. In the update process, the 10,000 images are automatically labeled. After the labeling is completed, the 10,000 images are automatically divided into a training set and a test set in a ratio of 8:2.
[0232] The first model is trained using the training set. After the training is completed, the trained model is pruned and distilled. Pruning and distillation are to ensure that the model accuracy decays slightly (generally within 1%), reduce the model size, and improve the model reasoning speed. The best model is published and the original first model is deleted, so that the updated first model can be called when the device calls it.
[0233] This implementation scheme can automate model training and iterative optimization.
[0234] Among them, based on the collected images and the first model, the process of training at least one second model can be: determining the category of each image according to the recognition result of the target content by the first model, and then clustering multiple images according to the category, and then, the images in different categories are used for model training of different second tasks.
[0235] Reference Figure 5 As shown, a flowchart of the steps of training to obtain at least one second model is shown, such as Figure 5 As shown, the following steps may be specifically included:
[0236] Step S401: identifying target content in the collected images using a first model;
[0237] Step S402: determining the categories corresponding to the collected images based on the identified target content;
[0238] Step S403: clustering the collected images according to categories to obtain multiple data sets;
[0239] Step S404: using the multiple data sets as image sample sets corresponding to the multiple second tasks respectively, so as to train and obtain at least one second model.
[0240] Among them, when the second model is trained, as described above, the second task performed by the second model can be a downstream task of the first task, that is, the second task is performed based on the execution result of the first task; the target content can be identified through the first model. For example, when the target content is text content, the first task can refer to the recognition of text in the text content. When the target content is a face image, the first task can refer to the recognition of the gender of the face.
[0241] Among them, when the recognition result is obtained, the category corresponding to each of the collected images can be determined based on the recognition result, and the category can refer to the category to which the image belongs. In the OCR recognition scenario, the first model can be used to recognize the text in the text content, and then based on the recognized text, it can be determined to which document category the image belongs, such as whether it belongs to an ID card or an invoice; in the face recognition scenario, the first model can be used to identify the gender of the face in the image, and then based on the recognized gender, it can be determined whether the image belongs to a male face image or a female face image.
[0242] For example, in the recognition of text content, an NLP (Natural Language Processing) text classification algorithm can be used to determine the category to which the image belongs. The NLP text classification algorithm can determine what type of input content is, such as a press release, an invoice, an ID card, and the like.
[0243] Next, the collected images can be clustered according to the categories to which the images belong. For example, images belonging to the same category can be aggregated into one data set. In this way, multiple data sets can be obtained, where different data sets correspond to different categories, and each data set can include at least one collected image.
[0244] Next, each data set may be scheduled to the corresponding second task as an image sample set of the second task, and the second model may be trained using the image sample set.
[0245] Specifically, different categories of data sets can be scheduled to different second tasks as image sample sets, where the second task can be a downstream task of the first task, or another task different from the first task. For example, in an OCR recognition scenario, the collected images are divided into a data set of ID cards, a data set of invoices, and a data set of bank cards. For the ID card data set, it can be used as an image sample set for the ID card authenticity verification task to train a second model, which can be used to verify the authenticity of the ID card;
[0246] For the invoice data set, it can be used as an image sample set to determine whether the invoice is a legal invoice, and a second model can be trained. The second model can be used to verify whether the invoice is a legal invoice. For example, by identifying the invoice code in the invoice, it can be queried whether the invoice is a legally issued invoice.
[0247] For the bank card data set, it can be used as an image sample set for extracting the name of the bank to which the bank card belongs, and the second model can be trained.
[0248] In a specific implementation, when training the second model, the model to be trained used in training the second model can be obtained, and then the model to be trained can be trained with the data set as the image sample set, thereby obtaining the second model. Among them, since only the data set is divided, in practice, in the process of training the second model, the images in the data set can also be annotated to add image labels for supervised training.
[0249] Of course, the above is only an exemplary description. Since the second task can also be a downstream task of the first task, for example, in the OCR recognition scenario, the first task can be a task of recognizing the text content. According to the recognition result, the collected images are divided into a data set of ID cards, a data set of invoices, and a data set of bank cards. For the data set of ID cards, it can be used as an image sample set for identity authentication to train a second model. The second model can be used to verify whether the user's identity is legal based on the recognized content;
[0250] The invoice data set can be used as an image sample set for determining whether the invoice amount exceeds the limit, and a second model can be trained. The second model can be used to verify whether the invoice amount exceeds the limit.
[0251] For the bank card data set, it can be used as an image sample set for extracting the name of the bank to which the bank card belongs, and the second model can be trained.
[0252] Accordingly, when the second task is a downstream task of the first task, before training to obtain the second model, the corresponding task execution module can be connected to the output end of the first model for the second task. In practice, it is to connect a network layer with a preset algorithm to execute the second task. After the connection, the model to be trained is obtained. During training, the data set can be used to train the model to be trained to obtain the second model. Of course, in this case, the images in the data set can still be annotated, for example, with labels of legal or illegal identities, so as to perform supervised training.
[0253] In some application scenarios, such as OCR recognition scenarios, the first model may be a model for OCR recognition, which may output the text content in the image as content in text format. Accordingly, when determining the category of the image based on the target content, the text format content output by the first model may be used to determine the category of each image.
[0254] In specific implementation, when determining the corresponding categories of the collected images based on the identified target content, an information extraction script uploaded by the user can be obtained; and based on the information extraction script, the text category corresponding to the identified text content is determined; then, based on the text category, the corresponding categories of each of the collected images are determined.
[0255] In some embodiments, the second task is a downstream task of the first task, and the downstream task includes: at least one of a classification task based on target content, a permission verification task based on target content, and a content decomposition task based on target content.
[0256] In this embodiment, the authority verification task can be to verify whether the identified target content is legal. For example, in the data set of ID cards, the second model can be to verify whether the identity of the user of the ID card is an authorized identity. The classification task can be to further subdivide the image. For example, for the data set of invoices, the second model can be to classify the invoices more finely according to the amount of the invoices. The content decomposition task can refer to decomposing the identified target content according to certain rules to obtain multiple paragraphs of text content. For example, for the data set of bank cards, the identified bank card number and bank name can be decomposed to obtain the text content of the bank card number and bank name. These decomposed text contents can be subsequently filled into the corresponding edit box of the specified application, such as filling the bank card number into the bank card number edit box of the receiving bank of the insurance policy to avoid users manually filling in the bank card number.
[0257] In some application scenarios, such as OCR recognition scenarios, the first model may be a model for performing OCR recognition. In some embodiments, in order to expand the service scope of the first model, after obtaining the first model, the text recognition result output by the first model may be further processed to provide further recognition results to the user.
[0258] In specific implementation, after obtaining the first model, in response to a call request for the first model, the text content in the image to be identified carried in the call request can be identified; based on a preset information extraction script, the text category of the text content identified by the first model can be determined; and based on the text category and the identified text content, the recognition result can be fed back to the device that sent the call request.
[0259] In this embodiment, the information extraction script includes preset text content corresponding to each text category. After the target content is identified, the identified text content can be matched with the preset text content. If they match, the text category of the identified text content can be determined. Then, based on the identified text category and text content, a recognition result can be generated and fed back to the device that calls the first model.
[0260] For example, the first model is used to recognize text content in an image. When the mobile phone calls the first model to recognize text content, if the image uploaded by the mobile phone is an ID card image, the first model recognizes the text content in the ID card image and recognizes "Name: Chen Moumou", gender "male", ID card number "7××××××××××", and household registration address "×××××". According to the information extraction script, it is determined that it belongs to an ID card. The above-mentioned recognized content and the category of the ID card can be fed back in the world result. For example, the recognition result can be "The ID card information is as follows: "Name: Chen Moumou", gender "male", ID card number "7××××××××××", and household registration address "×××××", so that the user can obtain the recognition result of the ID card.
[0261] When this implementation scheme is adopted, a second model can be trained based on the first model and the collected images to perform a second task different from the first task. Therefore, the service scope of automatic optimization and update can be broadened, thereby achieving the above-mentioned improvement goal of point ⑤, namely, supporting the development of functional services derived from the trained model.
[0262] The following is an example of the model generation method of the embodiment of the present application. Figure 6 and Figure 7 As shown, Figure 6 A modular design diagram of a model generation method in some embodiments is shown, Figure 7 The overall flow chart of the model generation method is shown in FIG. Figure 5 and Figure 6 As shown in the figure, the OCR scenario is taken as an example, and the data flow and training sequence are explained:
[0263] 1. Data access:
[0264] In response to the creation operation of the new model, the target content is output to the display interface, which includes multiple function buttons arranged in the order of operation, and each function button corresponds to a training node, such as Figure 3 As shown, it includes three function buttons.
[0265] In response to the click operation on "Upload and label data", the uploaded image is received and displayed. Specifically, according to different OCR task requirements, the data required for training is uploaded and labeled. The platform can accept the uploaded labeled image data and unlabeled image data. The unlabeled image data platform provides a labeling box for labeling, such as the semi-automatic labeling described in the above embodiment; wherein, in response to the click operation on synthesizing an image, the required image can be automatically synthesized based on the uploaded labeled image, for example, an invoice template is provided in advance, the corresponding target position is marked, different target positions use different data generation rules to synthesize the invoice content of the target position, and use data enhancement methods such as rotation, translation, and simulated illumination changes to simulate the real shooting scene as much as possible to obtain an image sample set for training the first model.
[0266] 2. Algorithm selection:
[0267] When the data is labeled, in response to the user's click on "Automated Training", the model configuration interface is output, and the user selects a preset model or uploads a custom model through the model configuration interface. Specifically, according to different OCR project requirements, create corresponding training models. The platform will preset some classic OCR algorithms for users to choose, and users can also directly import or upload their own algorithm models. This step can get the initial model.
[0268] 3. Algorithm configuration:
[0269] After the model is uploaded, a parameter configuration interface may pop up and receive the training parameters entered by the user through the parameter configuration interface. The training parameters are the preset training parameters, which include hyperparameters, operating environment parameters, and algorithm codes. Specifically, for the algorithms preset in the platform, hyperparameters can be configured on the page; for custom uploaded algorithms, online editing and debugging tools (such as Jupyter Notebook interactive notebooks) are provided for algorithm configuration and debugging. This step can obtain the hyperparameters in the preset training parameters. The setting of the operating environment parameters can be: select the hardware environment (such as CPU, memory, GPU, etc.) and software environment (such as system, compilation environment, etc.) for the training task to run on the platform page to obtain the operating environment parameters in the preset training parameters;
[0270] 4. Model output:
[0271] After the parameter configuration is completed, in response to the operation of starting training, the platform can automatically divide the labeled image samples into a training data set and a verification data set, and then start the model self-training, wherein the algorithm can be verified according to the verification data set to automatically produce the first model with the most ideal effect.
[0272] Among them, the training content of the first model can be saved as a training template, and the saved content includes the algorithm code (the network structure of the initial model and the operators in the network layer), hyperparameter configuration, data set selection, software and hardware environment, etc., to record the training configuration, reproduce the training process, and can also be used for model self-training tasks, etc.
[0273] 5. Algorithm launch:
[0274] After the model training is completed, a deployment interface pops up, and the user's deployment settings for the first model are received through the deployment interface, and the first model is automatically deployed based on the deployment settings. Specifically, in response to the automated deployment, an API (Application Programming Interface) can be generated for the device to call, and its API can be associated with the WeChat applet or APP (Application, mobile software), so that the device can call the first model through the API; of course, the user can select the task online running software and hardware environment, reasoning script (platform preset algorithm selects the algorithm name; for user-defined algorithms, users are required to complete the writing and uploading of the reasoning script according to the template provided by the platform) on the web page, and quickly deploy it online.
[0275] 6. The algorithm online module platform can selectively save the images uploaded by the service user when calling the first model according to the service use agreement. Specifically, a data collection task can be created. The task is associated with the WeChat applet or APP in an API manner. The terminal camera is used to collect real data and upload it. When the platform obtains the image to be recognized, it saves it to the database and returns the recognition result to the device.
[0276] 7. When the data in the database accumulates to a certain amount (such as 10,000 images), the extended training is automatically triggered, including:
[0277] ① It can automatically call the multi-model fusion algorithm to annotate 10,000 images and expand the training data set of the first model; then, based on the training template saved by the user, including the operating environment parameters and training parameters, it can perform native model training, pruning model training, and distillation model training in sequence, automatically train the model, improve the model accuracy, and use the test data set to automatically verify that the performance parameters of the model are optimized, thereby obtaining the updated first model;
[0278] ② Use the preset NLP text classification algorithm or the information extraction script written by the user to classify the 10,000 images into bills, certificates, etc., thereby dividing the 10,000 images into a data set of bills and a data set of certificates. For different types of data sets, train the second model for ID card recognition, invoice recognition, and business card recognition;
[0279] Launch a new second model to expand functional services.
[0280] Among them, the above examples can be applied to scenarios related to upstream and downstream tasks, such as scenarios where faces need to be recognized, and after recognition, faces need to be classified according to gender, and after classification, the age of the faces needs to be recognized; and scenarios where faces need to be recognized, and after recognition, the authenticity of the faces needs to be identified; of course, it can also be applied to other application scenarios, such as upstream and downstream tasks related to text content recognition.
[0281] Based on the same inventive concept, the present disclosure also provides a model generation system. The structural diagram of the model generation system can be referred to Figure 1 As shown, it includes: a terminal and a variety of devices communicating with the terminal; wherein a training platform is deployed on the terminal, and the training platform is used to execute the model generation method;
[0282] The device is used to call the first model to perform the first task based on the calling interface provided by the training platform, and upload the image to the training platform during the process of calling the first model; and / or call the second model to perform the second task.
[0283] The model generation system of the embodiment of the present application can automatically generate a first model based on pre-set operating environment parameters and hyperparameters, and automatically trigger the update of the first model when the target conditions are met, and / or, based on the collected images, train the first model to be a second model for completing a task different from the first task. In this way, the first model can be used as a base model, and the collected images can be used to derive multiple second models for performing multiple different second tasks, thereby automatically triggering the iterative update of the first model and automatically generating the second model for performing different tasks, thereby improving the automation of the rapid iteration of the neural network model.
[0284] Based on the same inventive concept, the present disclosure also provides a model generating device, referring to Figure 8 As shown, a schematic diagram of the structure of the model generating device is shown. The model generating device can be located in a terminal, and specifically includes the following modules:
[0285] The first training module 701 is used to train the initial model based on preset training parameters using a pre-acquired image sample set to obtain a first model; wherein the initial model is used to perform the first task;
[0286] The second training module 702 is used to perform extended training on the first model in response to the triggering of the target condition. The extended training includes:
[0287] Updating the first model based on the collected images; and / or training at least one second model based on the collected images and the first model;
[0288] The second model is used to perform a second task different from the first task.
[0289] Optionally, the device further comprises:
[0290] A saving module, used to obtain a training template based on the training content of training the first model, wherein the training content includes: algorithm code, hyperparameters, and operating environment parameters;
[0291] The step of updating the first model based on the collected images comprises:
[0292] Based on the operating environment parameters in the training template, the first model is updated using the collected images as training samples; and / or, based on the training template, a third model is trained using the collected images as training samples, and the first model is updated based on the third model.
[0293] Optionally, the device further comprises:
[0294] An image saving module, used for saving images uploaded by multiple devices in the process of multiple devices calling the first model, wherein the images are images to be processed by the first model;
[0295] The second training module 702 is specifically used to perform extended training on the first model in response to the triggering of a target condition that the number of stored images exceeds a preset number, wherein the collected images include the stored images uploaded by the device.
[0296] Optionally, the second training module 702 includes a model updating unit, and the model updating unit is used to perform the following steps:
[0297] Automatically annotating the collected images to obtain an annotation label for each of the images;
[0298] Based on the annotation labels, the collected images are divided into a training set and a test set;
[0299] Retraining the first model based on the training set;
[0300] Using the test set to verify the trained first model to determine whether the performance parameters of the retrained model are better than those of the first model;
[0301] After the verification is passed, the updated first model is obtained.
[0302] Optionally, the step of retraining the first model based on the training set includes:
[0303] Using the training set to update parameters of the first model;
[0304] Performing model pruning and / or model distillation on the first model after parameter update;
[0305] The performance parameter may include at least one of the recognition accuracy and operation time of the model.
[0306] Optionally, the annotation label is a location box of the location of the text in the image; the step of automatically annotating the collected images to obtain the annotation label of each image includes:
[0307] Invoking multiple position frame determination strategies to respectively determine the position frame of the position of the text in the same image, and obtaining an initial position frame determined by each position frame determination strategy;
[0308] Based on a plurality of initial position frames obtained from the same image and the confidence level corresponding to each initial position frame, the image is automatically annotated to obtain each annotated label.
[0309] Optionally, the second training module 702 includes a derivative model output unit, which is specifically used to perform the following steps:
[0310] Identifying target content in the collected images by using the first model;
[0311] Based on the identified target content, determining the categories corresponding to each of the collected images;
[0312] Clustering the collected images according to the categories to obtain multiple data sets;
[0313] The multiple data sets are respectively used as image sample sets corresponding to multiple second tasks to train at least one of the second models.
[0314] Optionally, the target content is text content, and the step of determining the category corresponding to the collected images based on the identified target content includes:
[0315] Get the information extraction script uploaded by the user;
[0316] Based on the information extraction script, determining a text category corresponding to the identified text content;
[0317] Based on the text category, the categories corresponding to the collected images are determined.
[0318] Optionally, a plurality of the second models are included, and different second models correspond to different second tasks;
[0319] The second task is a downstream task of the first task, and the downstream task includes at least one of a classification task based on the target content, a permission verification task based on the target content, and a content decomposition task based on the target content.
[0320] Optionally, the device further comprises a first sample acquisition module, configured to perform the following steps:
[0321] Acquire the labeled images and unlabeled images uploaded by multiple target terminals; the labeled images carry labels of the target content;
[0322] For the unlabeled image, outputting a labeling interface, wherein the labeling interface is used to instruct a user to label the target content;
[0323] In response to a labeling operation on an unlabeled image in the labeling interface, obtaining a label of the unlabeled image;
[0324] The labeled images and the unlabeled images with labels are determined as the image sample set.
[0325] Optionally, the device further comprises a second sample acquisition module, configured to perform the following steps:
[0326] Synthesizing the content at the target position in the preset template image to obtain a synthesized image; wherein the synthesis is used to generate target content located at the target position;
[0327] Based on the annotated label corresponding to the target position in the template image, the label of the synthetic image is determined to obtain the image sample set.
[0328] Optionally, the target content includes text content, and the step of synthesizing the target position in the preset template image to obtain a synthesized image includes:
[0329] For different target positions in the template image, using different text generation rules, text contents of different target positions are generated;
[0330] The text contents at different target positions are converted into text images, and the text images are fused into the corresponding target positions in the template image to obtain the composite image.
[0331] Optionally, the device further comprises:
[0332] An initial model acquisition module, used for acquiring the created initial model in response to a model creation operation, wherein the model creation operation includes a selection operation of a preset model and / or an upload operation of a custom model;
[0333] The parameter configuration module is used to output a parameter configuration interface corresponding to the initial model, and obtain the preset training parameters through the parameter configuration interface.
[0334] Optionally, the parameter configuration module includes:
[0335] A first configuration unit, configured to output a parameter configuration interface corresponding to the selected model from a plurality of preset parameter configuration interfaces when the initial model is the model selected by the selection operation;
[0336] The second configuration unit is used to initialize a container corresponding to the uploaded model when the initial model is the model uploaded by the upload operation, and output the parameter configuration interface through the container.
[0337] Optionally, the device further comprises:
[0338] A first deployment module is used to deploy the trained first model into the local area networks to which the multiple devices belong, so that the devices can call the first model in the local area networks to which they belong;
[0339] Or, a second deployment module is used to deploy the first model to the cloud and provide a calling interface of the first model to multiple devices, so that the devices call the first model from the cloud through the calling interface.
[0340] Optionally, the target content includes text content, and the device further includes:
[0341] A recognition module, configured to recognize text content in an image to be recognized carried in the call request in response to a call request for the first model;
[0342] A category determination module, used to determine the text category of the text content recognized by the first model based on a preset information extraction script;
[0343] A feedback module is provided, which is used to feed back the recognition result to the device sending the call request based on the text category and the recognized text content.
[0344] It should be noted that the device embodiment is similar to the method embodiment, so the description is relatively simple, and the relevant parts can be referred to the method embodiment.
[0345] Based on the same inventive concept, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the model generating method described in the embodiment when executing.
[0346] The embodiment of the present disclosure also provides a computer-readable storage medium, which stores a computer program that enables a processor to execute the model generation method as described in the embodiment of the present disclosure.
[0347] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0348] Those skilled in the art will appreciate that the embodiments of the disclosed embodiments may be provided as methods, devices, or computer program products. Therefore, the disclosed embodiments may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the disclosed embodiments may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0349] The embodiments of the present disclosure are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0350] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0351] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0352] Although the preferred embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present disclosure.
[0353] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0354] The above is a detailed introduction to a model generation method, device, system and storage medium provided by the present disclosure. Specific examples are used in this article to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method of the present disclosure and its core idea. At the same time, for those skilled in the art, according to the idea of the present disclosure, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present disclosure.
Claims
1. A model generation method, It is characterized in that The method comprises: Based on preset training parameters, the initial model is trained using a pre-acquired image sample set to obtain a first model; wherein the initial model is used to perform a first task; In response to triggering of the target condition, performing extended training on the first model, the extended training comprising: updating the first model based on the collected images; and / or, training at least one second model based on the collected images and the first model; The second model is used to perform a second task different from the first task.
2. The method according to claim 1, It is characterized in that After the initial model is trained using the pre-acquired image sample set to obtain the first model, the method further includes: Based on the training content of training the first model, a training template is obtained, where the training content includes: algorithm code, hyperparameters, and operating environment parameters; The updating of the first model based on the collected images includes: Based on the operating environment parameters in the training template, the first model is updated using the collected images as training samples; and / or, based on the training template, a third model is trained using the collected images as training samples, and the first model is updated based on the third model.
3. The method according to claim 1, It is characterized in that After obtaining the first model, the method further includes: In the process of multiple devices calling the first model, saving images uploaded by multiple devices, the images being the images to be processed by the first model; In response to the triggering of the target condition, the first model is subjected to extended training, including: In response to triggering a target condition that the number of stored images exceeds a preset number, performing extended training on the first model, wherein the collected images include images uploaded by the device.
4. The model generation method according to claim 1, It is characterized in that The updating of the first model based on the collected images includes: Automatically annotating the collected images to obtain an annotation label for each of the images; Based on the annotation labels, the collected images are divided into a training set and a test set; Retraining the first model based on the training set, and verifying the trained first model based on the test set to determine whether the performance parameters of the retrained model are better than those of the first model; After the verification is passed, the updated first model is obtained.
5. The model generation method according to claim 4, It is characterized in that The retraining of the first model based on the training set includes: Using the training set to update parameters of the first model; Performing model pruning and / or model distillation on the first model after parameter update; The performance parameter may include at least one of the recognition accuracy and operation time of the model.
6. The model generation method according to claim 4, It is characterized in that The annotation label is a location box of the location of the text in the image; the automatic annotation of the collected images to obtain the annotation label of each image includes: triggering a plurality of position frame determination strategies respectively, wherein the position frame determination strategies are used to determine an initial position frame where the same text in the image is located; Based on the initial position frames respectively determined by the plurality of position frame determination strategies and the confidence corresponding to each of the initial position frames, the image is automatically annotated to obtain each of the annotated labels.
7. The model generation method according to claim 1, It is characterized in that The first task is used to identify target content in an image, and the training of at least one second model based on the collected images and the first model includes: Identifying target content in the collected images by using the first model; Based on the identified target content, determining the categories corresponding to each of the collected images; Clustering the collected images according to the categories to obtain multiple data sets; The multiple data sets are respectively used as image sample sets corresponding to multiple second tasks to train at least one of the second models.
8. The model generation method according to claim 7, It is characterized in that The target content includes text content, and determining the corresponding category of the collected images based on the identified target content includes: Get the information extraction script uploaded by the user; Based on the information extraction script, determining a text category corresponding to the identified text content; Based on the text category, the categories corresponding to the collected images are determined.
9. The model generation method according to any one of claims 1 to 8, It is characterized in that comprising a plurality of the second models, wherein different second models correspond to different second tasks, the first task is used to identify target content in an image, and the second task is a downstream task of the first task; The downstream task includes: at least one of a classification task based on the target content, a permission verification task based on the target content, and a content decomposition task based on the target content.
10. The model generation method according to claim 1, It is characterized in that The first task is used to identify target content in an image, and the pre-acquisition process of the image sample set includes: Acquire the labeled images and unlabeled images uploaded by multiple target terminals; the labeled images carry labels of the target content; For the unlabeled image, outputting a labeling interface, wherein the labeling interface is used to instruct a user to label the target content; In response to a labeling operation on an unlabeled image in the labeling interface, obtaining a label of the unlabeled image; The image sample set is constructed based on the labeled images and the unlabeled images with labels.
11. The model generation method according to claim 1, It is characterized in that The first task is used to identify target content in an image, and the pre-acquisition process of the image sample set includes: Synthesizing the content at the target position in the preset template image to obtain a synthesized image; wherein the synthesis is used to generate target content located at the target position; Based on the annotated label corresponding to the target position in the template image, the label of the synthetic image is determined to obtain the image sample set.
12. The model generation method according to claim 11, It is characterized in that The target content includes text content, and synthesizing the target position in the preset template image to obtain a synthesized image includes: For different target positions in the template image, using different text generation rules, text contents of different target positions are generated; The text contents at different target positions are converted into text images, and the text images are fused into the corresponding target positions in the template image to obtain the composite image.
13. The model generation method according to claim 1, It is characterized in that Before training the initial model using the pre-acquired image sample set based on the preset training parameters corresponding to the initial model, the method further includes: In response to a model creation operation, acquiring the created initial model, wherein the model creation operation includes a selection operation of a preset model and / or an upload operation of a custom model; Output a parameter configuration interface corresponding to the initial model, and obtain the preset training parameters through the parameter configuration interface.
14. The model generation method according to claim 13, It is characterized in that The output is a parameter configuration interface corresponding to the initial model, including: When the initial model is the model selected by the selection operation, outputting a parameter configuration interface corresponding to the selected model from a plurality of preset parameter configuration interfaces; In the case where the initial model is the model uploaded by the upload operation, a container corresponding to the uploaded model is initialized, and the parameter configuration interface is output through the container.
15. The model generation method according to claim 1, It is characterized in that After obtaining the first model, the method further includes: The first model obtained by training is deployed into the local area networks to which the various devices belong, so that the devices can call the first model in the local area networks to which they belong; Alternatively, the first model is deployed to the cloud, and a calling interface of the first model is provided, so that the device calls the first model from the cloud through the calling interface.
16. The model generation method according to claim 1, It is characterized in that The first task is used to recognize text content in an image. After obtaining the first model, the method further includes: In response to a call request for the first model, identifying text content in the image to be identified carried in the call request; Determine the text category of the text content recognized by the first model based on a preset information extraction script; Based on the text category and the recognized text content, a recognition result is fed back to the device that sent the call request.
17. A model generation system, It is characterized in that include: A terminal and a plurality of devices communicating with the terminal; wherein a training platform is deployed on the terminal, and the training platform is used to execute the model generation method according to any one of claims 1 to 16; The device is used to call the first model to perform the first task based on the calling interface provided by the training platform, and in the process of calling the first model, upload the image to the training platform, and / or call the second model to perform the second task.
18. A model generating device, It is characterized in that The device comprises: A first training module, used to train the initial model using a pre-acquired image sample set based on preset training parameters to obtain a first model; wherein the initial model is used to perform the first task, and the preset training parameters include operating environment parameters and hyperparameters of the initial model; The second training module is used to perform extended training on the first model in response to the triggering of the target condition, and the extended training includes: Based on the operating environment parameters, updating the first model using the collected images; and / or, training at least one second model based on the collected images and the first model; The second model is used to perform a second task different from the first task.
19. A computer-readable storage medium, It is characterized in that The computer program stored therein enables the processor to execute the model generation method as described in any one of claims 1 to 16.
Citation Information
Patent Citations
Image recognition model training method and image recognition method and device
CN111401445A
Classification model training method and device, electronic equipment and storage medium
CN112560912A
Image task model training method, image recognition method and related device
CN115496970A
Robust pattern recognition system and method using socratic agents
US20080069437A1
System, method and apparatus for organizing photographs stored on a mobile computing device
US20180107660A1
