A model training method, device and equipment
By configuring task activation information and loss backpropagation mechanism, combining labeled and pseudo-labeled data, selecting the target training dataset for model training, and manually labeling model difference data when necessary, the problem of insufficient data in multi-task mode is solved, achieving efficient and low-cost model training results.
Patent Information
- Application Number
- CN202211076663.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-05
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2042-09-05
AI Technical Summary
Existing multi-task model training requires a large amount of data support, but there is a lack of open-source data with multiple labels, pseudo-labels have errors, and manual labeling is costly, resulting in poor model training performance and excessively high data labeling costs.
By acquiring the model and training dataset used in the training, utilizing labeled and pseudo-labeled data, configuring task effectiveness information and loss backpropagation mechanism, selecting the target training dataset for model training, and manually labeling model difference data when conditions are met, redundant labeling is reduced.
It effectively reduces data annotation costs, improves model training performance in multi-task mode, avoids redundant annotations, and improves model training speed and accuracy.
Smart Images

Figure CN115511074B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of machine learning, and particularly relates to a model training method, device and equipment. BACKGROUND
[0002] The existing model training method usually follows a cyclic process of dataset iteration (including data collection-data labeling) to model iteration (including model optimization-model training-model evaluation), that is, after completing certain data collection and data labeling, the model is trained and optimized based on the labeled data, and after a certain number of optimizations, the dataset can be iterated as needed to further improve the model performance.
[0003] Model training in a multi-task mode extracts common features among multiple tasks, and performs different task inferences based on the extracted features, so that the trained model can complete several tasks, for example, both sequence labeling tasks and classification tasks.
[0004] Model training in a multi-task mode requires a large amount of data support, however, there is currently less open-source data with multiple labels, that is, the labeled data on a certain task does not necessarily have labels on other tasks, so the training effect of the model cannot be guaranteed. In order to solve the above problem, the method of pseudo-labeling and manual labeling can be used for data labeling, but on the one hand, pseudo-labeling has certain errors, on the other hand, the labeling cost of manual labeling is too high, and in addition, there is also a situation of redundant labeling to ensure the data quantity. Therefore, the existing solution cannot improve the model training effect in a multi-task mode, and cannot effectively reduce the data labeling cost. SUMMARY
[0005] The embodiments of the present application provide a model training method, device and equipment, which can solve the above problems.
[0006] In a first aspect, an embodiment of the present application provides a model training method, comprising: obtaining a model participating in training, a plurality of training data sets, and first task validity information corresponding to each training data set; wherein there is at least one same task in the model participating in training, each training data set contains labeled data and / or pseudo-labeled data, and the first task validity information corresponding to the training data set is used to determine whether a loss generated by the training data set on a task is back-propagated to update parameters of the model in model training; selecting a target training data set used in current round of model training, and training the model according to data in the target training data set to obtain a loss generated by the target training data set on the task; back-propagating to update the parameters of the model according to the first task validity information corresponding to the target training data set and the loss generated by the target training data set on the task; if a preset current round of training termination condition is not met, reselecting a target training data set used in a next round of model training, and iteratively training the model; if the preset current round of training termination condition is met, determining whether a preset total training termination condition is met; if not, obtaining model difference data, and retraining the model according to the model difference data after artificial labeling; wherein inference results of the model on the model difference data are different; and if yes, stopping training the model.
[0007] Further, the method further comprises: obtaining second task validity information corresponding to the target training data set; wherein the second task validity information corresponding to the target training data set is used to determine whether the loss generated by the target training data set on the task is back-propagated to update the parameters of the model in the current round of model training; and back-propagating to update the parameters of the model according to the first task validity information corresponding to the target training data set and the loss generated by the target training data set on the task comprises: back-propagating to update the parameters of the model according to the first task validity information corresponding to the target training data set, the second task validity information corresponding to the target training data set, and the loss generated by the target training data set on the task.
[0008] Further, the second task validity information corresponding to at least one target training data set indicates that the loss generated by the target training data set on the task is used to back-propagate to update the parameters of the model in the current round of model training.
[0009] Further, the method further comprises: obtaining model validity information corresponding to the training data set; wherein the model validity information corresponding to the training data set is used to determine whether the loss generated by the training data set is back-propagated to update the parameters of the model in model training; and back-propagating to update the parameters of the model according to the first task validity information corresponding to the target training data set and the loss generated by the target training data set on the task comprises: back-propagating to update the parameters of the model according to the first task validity information corresponding to the target training data set, the model validity information corresponding to the target training data set, and the loss generated by the target training data set on the task.
[0010] Further, before obtaining the model participating in training, the plurality of training data sets, and the first task effective information corresponding to each training data set, the method further includes: obtaining at least one same task existing in the initial data set and the model; and adding pseudo-labels corresponding to the task to the initial data set to obtain the training data set if the initial data set does not contain labels corresponding to the task.
[0011] Further, the first task effective information is divided into effective, ineffective, and random effective; the random effective refers to that a loss generated by the training data set on the task is updated to the parameters of the model in the model training with a random probability.
[0012] Further, the loss generated by the target training data set on the task includes: selecting a preset number of target data from the target training data set; and training the model according to the target data to obtain the loss generated by the target training data set on the task.
[0013] Further, if the preset round training termination condition is met, whether the preset total training termination condition is met includes the steps of: if the preset round training termination condition is met, obtaining the iteration training frequency, the inference accuracy of the model, and / or the inference difference degree of the model; and determining whether the iteration training frequency reaches the preset first model iteration frequency, whether the inference accuracy of the model reaches the preset first inference accuracy, and / or whether the inference difference degree of the model reaches the preset first inference difference degree.
[0014] In a second aspect, an embodiment of the present application provides a model training device, including:
[0015] The obtaining unit is configured to obtain a model participating in training, a plurality of training data sets, and first task effective information corresponding to each training data set; wherein at least one same task exists in the model participating in training, each training data set contains labeled data and / or pseudo-labeled data, and the first task effective information corresponding to each training data set is used to determine whether a loss generated by the training data set on the task is updated to the parameters of the model in the model training.
[0016] The training unit is configured to select a target training data set used in the round model training, and train the model according to data in the target training data set to obtain a loss generated by the target training data set on the task.
[0017] The updating unit is configured to update the parameters of the model in the reverse direction according to the first task effective information corresponding to the target training data set and the loss generated by the target training data set on the task.
[0018] The first judging unit is configured to reselect the target training data set used in the next round of model training if the preset round training termination condition is not met, and iteratively train the model.
[0019] The second judging unit is configured to judge whether the preset total training termination condition is met if the preset round training termination condition is met, and retrain the model according to the model difference data if the preset total training termination condition is not met, wherein the inference results of the model on the model difference data are different.
[0020] Further, the model training device further comprises a first obtaining unit configured to obtain second task effectiveness information corresponding to the target training data set, wherein the second task effectiveness information corresponding to the target training data set is used to judge whether the loss generated by the target training data set on the task is used to update the parameters of the model by back propagation in the round model training.
[0021] Further, the second task effectiveness information corresponding to at least one target training data set in the first obtaining unit indicates that the loss generated by the target training data set on the task is used to update the parameters of the model by back propagation in the round model training.
[0022] Further, the model training device further comprises a second obtaining unit configured to obtain model effectiveness information corresponding to the training data set, wherein the model effectiveness information corresponding to the training data set is used to judge whether the loss generated by the training data set in the model training is used to update the parameters of the model by back propagation; and the updating unit is specifically configured to update the parameters of the model by back propagation according to the first task effectiveness information corresponding to the target training data set, the model effectiveness information corresponding to the target training data set, and the loss generated by the target training data set on the task.
[0023] Further, the model training device further comprises a third obtaining unit configured to obtain at least one same task existing in the initial data set and the model, and a labeling unit configured to add pseudo-labels corresponding to the task to the initial data set to obtain the training data set if the initial data set does not contain labels corresponding to the task.
[0024] Further, the first task effectiveness information in the obtaining unit is divided into effectiveness, ineffectiveness and random effectiveness, wherein the random effectiveness means that the loss generated by the training data set on the task in the model training is used to update the parameters of the model by back propagation with a random probability.
[0025] Further, the training unit is specifically configured to: select a preset number of target data from the target training data set; and train the model according to the target data to obtain a loss generated by the target training data set on the task.
[0026] Further, the second judging unit is specifically configured to: if the preset round training termination condition is met, obtain the iteration training number, the inference accuracy of the model, and / or the inference difference degree of the model; and judge whether the iteration training number reaches the preset first model iteration number, whether the inference accuracy of the model reaches the preset first inference accuracy, and / or whether the inference difference degree of the model reaches the preset first inference difference degree.
[0027] In a third aspect, an embodiment of the present application provides a model training device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method in the first aspect when executing the computer program.
[0028] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executable on a processor to implement the method in the first aspect.
[0029] The embodiment of the application obtains a model participating in training, a plurality of training data sets, and first task effective information corresponding to each training data set. At least one same task exists in the model participating in training, each training data set contains labeled data and / or pseudo-labeled data, and the first task effective information corresponding to the training data set is used to determine whether the loss generated by the training data set on the task is updated in the model training. A target training data set used in the current round of model training is selected, and the model is trained according to the data in the target training data set to obtain the loss generated by the target training data set on the task. The parameters of the model are updated by back propagation according to the first task effective information corresponding to the target training data set and the loss generated by the target training data set on the task. If the preset termination condition of the current round of training is not met, the target training data set used in the next round of model training is reselected, and the model is iteratively trained. If the preset termination condition of the current round of training is met, it is determined whether the preset total training termination condition is met. If not, the model difference data is obtained, and the model is retrained according to the model difference data labeled by artificial labeling. The inference results of the model on the model difference data are different. If yes, the training of the model is stopped. The above method trains the model with at least one same task together, and configures whether different training data sets are effective on the task, thereby controlling whether the training data sets have an impact on the trainable parameters in the model. The trained model can extract different knowledge, and then use the model difference to troubleshoot the data beneficial to training, and only manually label this part of data, which can effectively avoid redundant labeling, reduce data labeling cost, and improve the model training effect in the multi-task mode. BRIEF DESCRIPTION OF DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0031] Figure 1 is a schematic flow chart of a model training method provided by the first embodiment of the present application;
[0032] Figure 2 is a schematic flow chart of S102 in the model training method provided by the first embodiment of the present application;
[0033] Figure 3 is another schematic flow chart of a model training method provided by the first embodiment of the present application;
[0034] Figure 4is another schematic flowchart of a model training method provided by a first embodiment of the present application;
[0035] Figure 5 is a schematic flowchart of S105 in a model training method provided by a first embodiment of the present application;
[0036] Figure 6 is a schematic diagram of a model training apparatus provided by a second embodiment of the present application;
[0037] Figure 7 is a schematic diagram of a model training device provided by a third embodiment of the present application. DETAILED DESCRIPTION
[0038] In the following description, for the purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc., in order to provide a thorough understanding of the embodiments of the application. However, it will be apparent to those skilled in the art that the application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the application with unnecessary detail.
[0039] It should be understood that the term “includes” when used in the specification and the appended claims herein, specifies the presence of stated features, integers, steps, operations, elements, and / or components but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0040] It should also be understood that the term “and / or” when used in the specification and the appended claims herein, means any one or more of the associated listed items and includes all possible combinations of the associated listed items.
[0041] As used in the description of the application and the appended claims herein, the term “if’ can be interpreted as meaning “when” or “upon” or “in response to a determination” or “in response to a detection” depending on the context. Similarly, the phrase “if determined” or “if detected [the described condition or event]” can be interpreted as meaning “upon a determination” or “in response to a determination” or “upon a detection of [the described condition or event]” or “in response to a detection of [the described condition or event]” depending on the context.
[0042] In addition, in the description of the application and the appended claims herein, the terms “first”, “second”, “third”, etc. are used only to distinguish descriptions, and cannot be understood as indicating or implying relative importance.
[0043] Reference within the specification of this application to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places within specified
[0044] See Figure 1 , Figure 1 is a schematic flow chart of a model training method provided by the first embodiment of the application. In the embodiment, the execution subject of the model training method is a device with a model training function. The device can be a personal computer, a server, a mobile phone, or the like. The device can also be a control chip or a microcontroller. As shown in the model training method can include: Figure 1
[0045] S101: Obtain a model participating in training, a plurality of training data sets, and first task activation information corresponding to each training data set. Among the models participating in training, there is at least one same task. Each training data set contains labeled data and / or pseudo-labeled data. The first task activation information corresponding to the training data set is used to determine whether the loss generated by the training data set on the task is back-propagated to update the parameters of the model in the model training.
[0046] Before explaining step S101, the invention idea of the application will be briefly described. In the application, the samples that cannot achieve similar representation in different models are identified based on active learning. Such samples generally have two possible sources, one of which is that the number of samples is insufficient to support the classification boundary division, and the other of which is that the feature space corresponding to the sample does not cover the annotation information.
[0047] For the first case, for example, when classifying animal images, suppose that the images of dogs include images of white dogs and images of black dogs, and the images of cats only include images of white cats. After training, the model will consider black images as images of dogs. At this time, black cats will be misclassified. Therefore, only by introducing images of black cats for training can the animal images be more accurately classified. This case is that the number of samples is insufficient to support the classification boundary division.
[0048] For the second case, for example: when classifying animal images, if there are only cat and dog images in the training data set, the classification result of other animals such as jaguars cannot be determined and is greatly affected by random parameters. In this case, the feature space corresponding to the sample does not cover the label information.
[0049] The sample that cannot be similarly represented in different models is referred to as model difference data in the embodiments of the present application. Since the model difference data is very representative, adding the model difference data to the training can have a greater positive impact on the model. The model difference data is found, and the model difference data is manually labeled. Then, the model is iterated after the manual labeling, and the iteration is terminated until the termination condition is reached. This is extremely beneficial to improve the model training speed, reduce the data labeling cost, and reduce the redundant labeling situation.
[0050] As described above, the model training in the multi-task mode needs a large amount of data support. However, there is currently less open source data with multiple labels, that is, the labeled data on a certain task does not necessarily have a label on other tasks, so that the training effect of the model cannot be guaranteed. At this time, the data needs to be pseudo-labeled.
[0051] Specifically, before step S101 is performed, the device obtains an initial data set and at least one same task existing in the model. If the initial data set does not contain the label corresponding to the task, the pseudo-label corresponding to the task is added to the initial data set to obtain a training data set.
[0052] Specifically, the data is divided into three types: data with all task labels, data with partial task labels, and data without task labels. The pseudo-label corresponding to the task is added to the data without task labels and the data with partial task labels.
[0053] Among them, the existing pseudo-labeling method can be used to add the pseudo-label corresponding to the task to the initial data set, which is not limited in detail.
[0054] For example: in a model containing sentiment classification tasks and article field classification characters, the data of the article field "law" can be set to the sentiment classification "no inclination", thereby obtaining pseudo-labeled data.
[0055] In step S101, the device obtains a model participating in training, a plurality of training data sets, and first task activation information corresponding to each training data set.
[0056] Wherein, there is at least one same task in the model participating in training. It can be understood that there is an intersection of tasks in the participating model, and finally the result of the same task can be output. For example: two models are used for classification and sequence labeling, and the other is used for classification. Then, the two models can be trained for the classification task.
[0057] It should be noted that the structure of the model participating in training can be homogeneous or constructed, which is not limited here, but at least one of the model training or the structure of the model is different, so that the trainable parameters in the model are different, and the model difference data in the training data set is identified by using the difference.
[0058] It should also be noted that if the model participating in training is 2, the tasks of model 1 include A, B and C, and the tasks of model 2 include B, so the common task B is trained this time. However, if the A task and / or the C task is beneficial to feature extraction, the A task and / or the C task can be added to the model 2 as a common task for training.
[0059] Each training data set contains labeled data and / or pseudo-labeled data. The labeled data and / or pseudo-labeled data have been described in the foregoing.
[0060] The first task effectiveness information corresponding to the training data set is used to determine whether the loss generated by the training data set on the task is used to update the parameters of the model in the model training.
[0061] For example, assume that there are data sets P, Q and K, among the data sets P, Q and K, the data set P and the data set Q are effective on the task B, and the data set K is not effective on the task B. Therefore, the loss generated by the data set K on the task B cannot be used to update the parameters of the model.
[0062] Since the method provided by the embodiment of the application can simultaneously train multiple tasks, the modification cost of the training setting can be effectively reduced through the effectiveness information of the data set.
[0063] In an optional implementation, the first task effectiveness information is divided into effective and ineffective.
[0064] In another optional implementation, the first task effectiveness information is divided into effective, ineffective and random. Wherein, the random effectiveness means that the loss generated by the training data set on the task is updated in the model training with a random probability.
[0065] S102: Select the target training data set used in the current round of model training, and train the model according to the data in the target training data set to obtain the loss generated by the target training data set on the task.
[0066] In a round of model training, a part of the data set in the training data set is selected as a target training data set.
[0067] The device trains the model according to the data in the target training data set, and obtains the loss generated by the target training data set on the task. Details of the model training process are not limited here, and there are many possibilities based on different model structures. It can be confirmed that the loss generated on the task can be calculated after the round of model training, that is, the loss is calculated according to the current model output result, the annotation of the data, and the preset loss function.
[0068] In an optional embodiment, please refer to Figure 2 , Figure 2 is a schematic flowchart of S102 in a model training method provided by the first embodiment of the present application. S102 includes:
[0069] S1021: Select a preset number of target data from the target training data set.
[0070] S1022: Train the model according to the target data, and obtain the loss generated by the target training data set on the task.
[0071] If the training data set is understood as an iterator, then selecting the target training data set used in the model training in the round is switching the iterator, and selecting a preset number of target data from the target training data set is outputting a preset number of target data by the iterator.
[0072] In the embodiment, only the target data is used to train the model to obtain the loss generated by the target training data set on the task, so as to accelerate the model training speed.
[0073] S103: According to the first task effective information corresponding to the target training data set and the loss generated by the target training data set on the task, the parameters of the model are updated by back propagation.
[0074] The device updates the parameters of the model by back propagation according to the first task effective information corresponding to the target training data set and the loss generated by the target training data set on the task.
[0075] That is, the target training data set is effective on the task in the model training, and then the loss generated by the target training data set on the task is used to update the parameters of the model by back propagation.
[0076] In addition to the above-mentioned first task effective information, second task effective information is also configured, which will be described below. Please refer to Figure 3 , Figure 3 is another schematic flowchart of a model training method provided by the first embodiment of the present application. The method further includes:
[0077] S106: Obtain second task activation information corresponding to the target training data set; wherein the second task activation information corresponding to the target training data set is used to determine whether the loss generated by the target training data set on the task in the current round of model training is used to update the parameters of the model through back propagation.
[0078] The device obtains the second task activation information corresponding to the target training data set.
[0079] The second task activation information corresponding to the target training data set is used to determine whether the loss generated by the target training data set on the task in the current round of model training is used to update the parameters of the model through back propagation.
[0080] The role of configuring the second task activation information is: (1) For training of different tasks, the convergence speed is inconsistent, and overfitting cannot be avoided. For tasks that converge too quickly, the loss generated by the target training data set on the task can be suspended for updating the model parameters through back propagation, for example, the target training data set can be activated every few rounds of training. (2) Some tasks need to rely on the results of other tasks to determine whether to activate, for example, identifying identity first needs to judge whether the target is a living body and other pre-limitations, therefore, the second task activation information can be configured to control whether it is activated in each round of model training.
[0081] It should be noted that the second task activation information corresponding to at least one target training data set indicates that the loss generated by the target training data set on the task in the current round of model training is used to update the parameters of the model through back propagation.
[0082] That is, at least one target training data set generates loss on the task in the current round of model training, which is used to update the parameters of the model through back propagation, so as to ensure the normal progress of model training iteration.
[0083] On the basis of step S106, S103 includes:
[0084] S1031: According to the first task activation information corresponding to the target training data set, the second task activation information corresponding to the target training data set, and the loss generated by the target training data set on the task, the parameters of the model are updated through back propagation.
[0085] The device updates the parameters of the model through back propagation according to the first task activation information corresponding to the target training data set, the second task activation information corresponding to the target training data set, and the loss generated by the target training data set on the task.
[0086] Specifically, the device needs to use the loss generated by the target training data set on the task to update the parameters of the model in reverse only when the first task validity information corresponding to the target training data set is valid and the second task validity information corresponding to the target training data set is valid.
[0087] In the embodiment, by configuring the second task validity information, the model training process can be efficiently controlled, the overfitting phenomenon can be prevented, and the task dependency problem can be solved.
[0088] In addition to the first task validity information and the second task validity information, model validity information can also be configured, which will be described below. Please refer to Figure 4 , Figure 4 is another schematic flowchart of a model training method provided by the first embodiment of the application. The method further includes:
[0089] S107: Obtain model validity information corresponding to the training data set; wherein the model validity information corresponding to the training data set is used to determine whether the loss generated by the training data set in the model training is used to update the parameters of the model in reverse.
[0090] The device obtains the model validity information corresponding to the training data set.
[0091] The model validity information corresponding to the training data set is used to determine whether the loss generated by the training data set in the model training is used to update the parameters of the model in reverse.
[0092] The function of configuring the model validity information is to control whether each training data set is valid on different models according to the model validity information, and only when it is valid, the loss generated by the training data set is used to update the parameters of the model in reverse. As mentioned above, the training of the model or the structure of the model is different, so that the trainable parameters in the model are different. Therefore, by configuring the model validity information, the training of the model can be controlled from the perspective of the training data set, so that the trainable parameters in the model are different.
[0093] On the basis of step S107, S103 includes:
[0094] S1032: According to the first task validity information corresponding to the target training data set, the model validity information corresponding to the target training data set, and the loss generated by the target training data set on the task, update the parameters of the model in reverse.
[0095] The device updates the parameters of the model in reverse according to the first task validity information corresponding to the target training data set, the model validity information corresponding to the target training data set, and the loss generated by the target training data set on the task.
[0096] The device can obtain the model activation information corresponding to the target training data set from the model activation information corresponding to the training data set.
[0097] Specifically, the device uses the loss generated by the target training data set on the task to update the parameters of the model in reverse propagation only when the first task activation information corresponding to the target training data set is activated, the model activation information corresponding to the target training data set is activated, and the loss generated by the target training data set on the task.
[0098] In the embodiment, by configuring the model activation information, the training of the model can be controlled from the perspective of the training data set, and the training control can be efficiently implemented.
[0099] In an optional implementation, the first task activation information, the second task activation information, and the model activation information are configured simultaneously.
[0100] The device updates the parameters of the model in reverse propagation according to the first task activation information corresponding to the target training data set, the second task activation information corresponding to the target training data set, the model activation information corresponding to the target training data set, and the loss generated by the target training data set on the task.
[0101] Specifically, the device uses the loss generated by the target training data set on the task to update the parameters of the model in reverse propagation only when the first task activation information corresponding to the target training data set is activated, the first task activation information corresponding to the target training data set is activated, and the model activation information corresponding to the target training data set is activated.
[0102] S104: If the preset training termination condition in the current round is not met, a target training data set used in the next round of model training is reselected, and the model is iteratively trained.
[0103] The preset training termination condition in the current round can be that the number of iterations of training is not less than the preset second model iteration number, the inference accuracy of the model is not less than the preset second inference accuracy, and / or the inference difference degree of the model is less than the preset second inference difference degree.
[0104] The inference difference degree refers to the proportion of model difference data to pseudo-labeled data. The inference results obtained by inputting the model difference data into different models are different.
[0105] S105: If the preset training termination condition in the current round is met, it is determined whether the preset total training termination condition is met; if not, model difference data is obtained, and the model is retrained according to the model difference data labeled by the artificial; the inference results of the model on the model difference data are different; if yes, the training of the model is stopped.
[0106] If the preset round training termination condition is met, the device continues to determine whether the preset total training termination condition is met.
[0107] If not, the model difference data is obtained, and the model is retrained according to the model difference data after manual labeling. That is, the model difference data is manually labeled to ensure the labeling accuracy of the model difference data.
[0108] If yes, the model training is stopped.
[0109] The inference result of the model on the model difference data is different, which is simply understood as the inference result of the model difference data after inputting different models.
[0110] In an optional embodiment, please refer to Figure 5 , Figure 5 is a schematic flowchart of S105 in the model training method provided in the first embodiment of the present application, and S105 includes:
[0111] S1051: If the preset round training termination condition is met, the iteration training number, the inference accuracy of the model, and / or the inference difference degree of the model are obtained.
[0112] S1052: It is determined whether the iteration training number reaches the preset first model iteration number, the inference accuracy of the model reaches the preset first inference accuracy, and / or the inference difference degree of the model reaches the preset first inference difference degree.
[0113] In the present embodiment, the preset first model iteration number, the preset first inference accuracy, and the preset first inference difference degree are generally different from the preset second model iteration number, the preset second inference accuracy, and the preset second inference difference degree in value, but in some optional embodiments, there is also a possibility that the values are partially the same.
[0114] In addition, it should be noted that the preset first model iteration number can refer to the cumulative number of model iteration training (i.e., the cumulative number of times that the device performs the process of target training data set selection, loss calculation, model parameter updating, and determination of whether the preset round training termination condition is met), or can refer to the total number of model iteration (i.e., the number of times that the process of obtaining model difference data, manually labeling the model difference data, and retraining the model is performed when the total training termination condition is not met).
[0115] The embodiment of the application obtains a model participating in training, a plurality of training data sets, and first task effective information corresponding to each training data set. At least one same task exists in the model participating in training, each training data set contains labeled data and / or pseudo-labeled data, and the first task effective information corresponding to the training data set is used to determine whether the loss generated by the training data set on the task is updated in the model training. A target training data set used in the current round of model training is selected, and the model is trained according to the data in the target training data set to obtain the loss generated by the target training data set on the task. The parameters of the model are updated by back propagation according to the first task effective information corresponding to the target training data set and the loss generated by the target training data set on the task. If the preset training termination condition in the current round is not met, the target training data set used in the next round of model training is reselected, and the model is iteratively trained. If the preset training termination condition in the current round is met, it is determined whether the preset total training termination condition is met. If not, the model difference data is obtained, and the model is retrained according to the model difference data labeled by artificial labeling. The inference results of the model on the model difference data are different. If yes, the training of the model is stopped. The above method trains the model with at least one same task together, and configures whether different training data sets are effective on the task, so as to control whether the training data sets have an impact on the trainable parameters in the model. The trained model can extract different knowledge, and then use the model difference to troubleshoot the data beneficial to training, and only manually label this part of data. This can effectively avoid redundant labeling, reduce data labeling cost, and improve the model training effect in the multi-task mode.
[0116] It should be understood that the size of the serial number of each step in the above embodiment does not mean the order of execution. The execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiment of the application.
[0117] Please refer to Figure 6 , Figure 6 is a schematic diagram of a model training device provided by the second embodiment of the application. Each unit included is used to execute Figure 1 each step in the corresponding embodiment. For details, please refer to Figure 1 the related description in the corresponding embodiment. For ease of illustration, only the part related to the present embodiment is shown. Please refer to Figure 6 , the model training device 6 comprises:
[0118] The acquisition unit 61 is configured to acquire a model participating in training, a plurality of training data sets, and first task effective information corresponding to each training data set; wherein there is at least one same task in the model participating in training, each training data set contains labeled data and / or pseudo-labeled data, and the first task effective information corresponding to the training data set is used to determine whether the loss generated by the training data set on the task is used to update the parameters of the model in the model training.
[0119] The training unit 62 is configured to select a target training data set used in the current round of model training, and train the model according to the data in the target training data set to obtain the loss generated by the target training data set on the task.
[0120] The updating unit 63 is configured to update the parameters of the model in the reverse direction according to the first task effective information corresponding to the target training data set and the loss generated by the target training data set on the task.
[0121] The first judging unit 64 is configured to reselect a target training data set used in the next round of model training if the preset termination condition of the current round of training is not met, and iteratively train the model.
[0122] The second judging unit 65 is configured to determine whether the preset total training termination condition is met if the preset termination condition of the current round of training is met; if not, acquire model difference data, and retrain the model according to the model difference data after manual labeling; wherein the inference results of the model on the model difference data are different; if yes, stop training the model.
[0123] Further, the model training device 6 further comprises a first acquisition unit configured to acquire second task effective information corresponding to the target training data set; wherein the second task effective information corresponding to the target training data set is used to determine whether the loss generated by the target training data set on the task in the current round of model training is used to update the parameters of the model; and the updating unit 63 is specifically configured to update the parameters of the model in the reverse direction according to the first task effective information corresponding to the target training data set, the second task effective information corresponding to the target training data set, and the loss generated by the target training data set on the task.
[0124] Further, the second task effective information corresponding to at least one target training data set in the first acquisition unit indicates that the loss generated by the target training data set on the task in the current round of model training is used to update the parameters of the model.
[0125] Further, the model training apparatus 6 further comprises a second obtaining unit, configured to obtain model effectiveness information corresponding to the training data set; wherein the model effectiveness information corresponding to the training data set is used to determine whether the loss generated by the training data set in the model training is used to update the parameters of the model in a reverse propagation manner; and an updating unit 63, specifically configured to update the parameters of the model in a reverse propagation manner according to the first task effectiveness information corresponding to the target training data set, the model effectiveness information corresponding to the target training data set, and the loss generated by the target training data set in the task.
[0126] Further, the model training apparatus 6 further comprises a third obtaining unit, configured to obtain at least one same task existing in the initial data set and the model; and a labeling unit, configured to add pseudo-labels corresponding to the task to the initial data set to obtain the training data set if the initial data set does not contain labels corresponding to the task.
[0127] Further, the first task effectiveness information in the obtaining unit is divided into effectiveness, non-effectiveness, and random effectiveness; the random effectiveness means that the loss generated by the training data set in the task is used to update the parameters of the model in a reverse propagation manner with a random probability.
[0128] Further, the training unit 62 is specifically configured to select a preset number of target data from the target training data set; and train the model according to the target data to obtain the loss generated by the target training data set in the task.
[0129] Further, the second determining unit 65 is specifically configured to, if the preset round training termination condition has been met, obtain the iteration training number, the inference accuracy of the model, and / or the inference difference degree of the model; and determine whether the iteration training number reaches the preset first model iteration number, whether the inference accuracy of the model reaches the preset first inference accuracy, and / or whether the inference difference degree of the model reaches the preset first inference difference degree.
[0130] Please refer to Figure 7 , Figure 7 is a schematic diagram of a model training device provided by the third embodiment of the present application. As shown in Figure 7 , the model training device 7 of this embodiment comprises a processor 70, a memory 71, and a computer program 72 stored in the memory 71 and executable on the processor 70, such as a model training program. The processor 70 implements the steps in each of the above model training method embodiments when executing the computer program 72, such as steps S101-S105 shown in Figure 1 . Alternatively, the processor 70 implements the functions of each module / unit in each of the above device embodiments when executing the computer program 72, such as the functions of the obtaining unit 61 to the second determining unit 65 shown in Figure 6 .
[0131] Exemplarily, the computer program 72 can be divided into one or more modules / units stored in the memory 71 and executed by the processor 70 to complete the present application. The one or more modules / units can be a series of computer program instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program 72 in the model training device 7. For example, the computer program 72 can be divided into an acquisition unit, a training unit, an updating unit, a first judgment unit, and a second judgment unit, and the specific functions of each unit are as follows:
[0132] The acquisition unit is configured to acquire a model participating in training, a plurality of training data sets, and first task effective information corresponding to each training data set. The model participating in training includes at least one same task, each training data set includes labeled data and / or pseudo-labeled data, and the first task effective information corresponding to the training data set is used to determine whether a loss generated by the training data set on the task is back-propagated to update parameters of the model in model training.
[0133] The training unit is configured to select a target training data set used in the current round of model training, and train the model according to data in the target training data set to obtain a loss generated by the target training data set on the task.
[0134] The updating unit is configured to back-propagate to update the parameters of the model according to the first task effective information corresponding to the target training data set and the loss generated by the target training data set on the task.
[0135] The first judgment unit is configured to, if a preset current round training termination condition is not met, reselect a target training data set used in a next round of model training, and iteratively train the model.
[0136] The second judgment unit is configured to, if the preset current round training termination condition is met, determine whether a preset total training termination condition is met. If not, model difference data is acquired, and the model is retrained according to the model difference data after manual labeling. The inference results of the model on the model difference data are different. If yes, the training of the model is stopped.
[0137] The model training device can include, but is not limited to, the processor 70 and the memory 71. Those skilled in the art can understand that, Figure 7 The model training device 7 is only an example and does not constitute a limitation on the model training device 7, and can include more or fewer components than the illustration, or combine certain components, or different components, for example, the model training device can also include an input / output device, a network access device, a bus, etc.
[0138] The processor 70 can be a central processing unit (CPU), and can also be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0139] The memory 71 can be an internal storage unit of the model training device 7, for example, a hard disk or a memory of the model training device 7. The memory 71 can also be an external storage device of the model training device 7, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the model training device 7 can also include both the internal storage unit and the external storage device of the model training device 7. The memory 71 is used to store the computer program and other programs and data required by the model training device. The memory 71 can also be used to temporarily store data that has been output or will be output.
[0140] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units, since based on the same concept as the method embodiments of the present application, the specific functions and the technical effects brought by them can be referred to the method embodiment part, and will not be repeated here.
[0141] The embodiments of the present application also provide a network device, which comprises at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps in any of the above method embodiments when executing the computer program.
[0142] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program, wherein the computer program is executable by a processor to implement the steps in any of the above method embodiments.
[0143] The embodiments of the present application provide a computer program product, which, when executed on a mobile terminal, enables the mobile terminal to implement the steps in any of the above method embodiments.
[0144] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the present application can implement all or part of the processes in the above-mentioned embodiment methods through a computer program to instruct related hardware to complete, and the computer program can be stored in a computer readable storage medium. When the processor executes the computer program, the steps of each method embodiment described above can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms. The computer readable medium can at least include any entity or device capable of carrying the computer program code to the photographing device / terminal equipment, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium can not be an electrical carrier signal and a telecommunication signal.
[0145] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0146] Those skilled in the art can appreciate that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0147] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / network device and method can be implemented in other ways. For example, the above-described apparatus / network device embodiments are merely schematic, for example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0148] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may also be distributed to multiple network units. Part or all of the units can be selected to achieve the purpose of the embodiment scheme according to actual needs.
[0149] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can still be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A model training method, characterized in that, The method comprises the following steps: obtaining a plurality of models participating in training, a plurality of training data sets, and first task effective information corresponding to each of the training data sets; wherein at least one same task exists in the plurality of models participating in training, the task includes an image classification task, each of the training data sets contains labeled data and / or pseudo-labeled data, and the first task effective information corresponding to the training data set is used to determine whether a loss generated by the training data set on the task in model training is used to update parameters of the model through back propagation; selecting a target training data set used in current round of model training, and training the model according to data in the target training data set to obtain a loss generated by the target training data set on the task; updating the parameters of the model through back propagation according to the first task effective information corresponding to the target training data set and the loss generated by the target training data set on the task; if a preset current round of training termination condition is not met, reselecting a target training data set used in next round of model training, and iteratively training the model; if the preset current round of training termination condition is met, determining whether a preset total training termination condition is met; if not, obtaining model difference data, and retraining the model according to the model difference data after artificial labeling; wherein an inference result of the model on the model difference data is different; and if yes, stopping training the model. 2.The model training method of claim 1, wherein, The method further comprises the following steps: obtaining second task effective information corresponding to the target training data set; wherein the second task effective information corresponding to the target training data set is used to determine whether the loss generated by the target training data set on the task in the current round of model training is used to update the parameters of the model through back propagation; the step of updating the parameters of the model through back propagation according to the first task effective information corresponding to the target training data set and the loss generated by the target training data set on the task comprises the following steps: updating the parameters of the model through back propagation according to the first task effective information corresponding to the target training data set, the second task effective information corresponding to the target training data set, and the loss generated by the target training data set on the task. 3.The model training method of claim 2, wherein: The second task effective information corresponding to at least one of the target training data sets indicates that the loss generated by the target training data set on the task in the current round of model training is used to update the parameters of the model through back propagation. 4.The model training method of claim 1, wherein, The method further comprises the following steps: obtaining model effective information corresponding to the training data set; wherein the model effective information corresponding to the training data set is used to determine whether the loss generated by the training data set in model training is used to update the parameters of the model through back propagation; the step of updating the parameters of the model through back propagation according to the first task effective information corresponding to the target training data set and the loss generated by the target training data set on the task comprises the following steps: updating the parameters of the model through back propagation according to the first task effective information corresponding to the target training data set, the model effective information corresponding to the target training data set, and the loss generated by the target training data set on the task.
5. The model training method according to any one of claims 1 to 4, characterized in that, Before the acquiring the multiple models participating in training, the several training data sets, and the first task effective information corresponding to each of the training data sets, the method comprises: acquiring at least one same task existing in the multiple models and an initial data set; if the initial data set does not contain the label corresponding to the task, adding the pseudo label corresponding to the task to the initial data set to obtain the training data set. 6.The model training method of any one of claims 1 to 4, characterized in that: The first task effective information is divided into effective, ineffective and random effective. The random effective means that the loss generated by the training data set on the task in the model training is updated to the parameters of the model with a random probability.
7. The model training method according to any one of claims 1 to 4, characterized by, The training of the model according to the data in the target training data set comprises: selecting a preset number of target data from the target training data set; training the model according to the target data to obtain the loss generated by the target training data set on the task.
8. The model training method according to any one of claims 1 to 3, characterized by, If the preset round training termination condition is met, whether the preset total training termination condition is met comprises the steps of: if the preset round training termination condition is met, acquiring the iteration training frequency, the inference accuracy of the model and / or the inference difference degree of the model; judging whether the iteration training frequency reaches the preset first model iteration frequency, whether the inference accuracy of the model reaches the preset first inference accuracy and / or whether the inference difference degree of the model reaches the preset first inference difference degree.
9. A model training apparatus characterized by comprising: comprise: an acquisition unit, configured to acquire a plurality of models participating in training, a plurality of training data sets, and first task effective information corresponding to each of the training data sets; wherein at least one same task exists in the plurality of models participating in training, the task comprises an image classification task, each of the training data sets contains labeled data and / or pseudo-labeled data, and the first task effective information corresponding to the training data set is used to determine whether the loss generated by the training data set on the task in the model training is updated to the parameters of the model through back propagation; a training unit, configured to select a target training data set used in the current round of model training, and train the model according to the data in the target training data set to obtain the loss generated by the target training data set on the task; an update unit, configured to update the parameters of the model through back propagation according to the first task effective information corresponding to the target training data set and the loss generated by the target training data set on the task; a first judgment unit, configured to reselect a target training data set used in the next round of model training and iteratively train the model if the preset round training termination condition is not met; a second judgment unit, configured to judge whether the preset total training termination condition is met if the preset round training termination condition is met; if not, acquire model difference data, and retrain the model according to the model difference data after artificial labeling; wherein the inference results of the model on the model difference data are different; if yes, stop training the model.
10. A model training device comprising: Processor, memory, and computer program stored in the memory and loadable in the processor, characterized in that the said processor implements the steps of the method as claimed in any one of Claims 1 to 8 when said computer program is executed by said processor.
Citation Information
Patent Citations
Content processing method and device, computer equipment and storage medium
CN114328904A
Model training method and device
CN114492592A