CN117668543A - Model training method and device, storage medium and electronic equipment - Google Patents

Model training method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN117668543A
CN117668543A CN202311619315.XA CN202311619315A CN117668543A CN 117668543 A CN117668543 A CN 117668543A CN 202311619315 A CN202311619315 A CN 202311619315A CN 117668543 A CN117668543 A CN 117668543A
Authority
CN
China
Prior art keywords
model
samples
sample set
training
sample
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311619315.XA
Other languages
Chinese (zh)
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Moore Threads Technology Co Ltd
Original Assignee
Moore Threads Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Moore Threads Technology Co Ltd filed Critical Moore Threads Technology Co Ltd
Priority to CN202311619315.XA priority Critical patent/CN117668543A/en
Publication of CN117668543A publication Critical patent/CN117668543A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The specification discloses a model training method, a device, a storage medium and electronic equipment, wherein a first model is subjected to semi-supervised training through a non-labeled sample set and a target sample set, after the semi-supervised training is finished, a target sample is redetermined from the non-labeled sample set through an active learning algorithm, and is added into the target sample set, and further the semi-supervised training is continuously performed on the first model based on the non-labeled sample set and the redetermined target sample set until a preset iteration termination condition is reached. According to the model training method provided by the specification, the target sample with higher model training effect improvement can be determined through the active learning algorithm and added into the target sample set, so that the first model is better guided to be trained, the accuracy of the first model obtained through training is ensured, and meanwhile, the sample determining efficiency and the model training efficiency are considered.

Description

Model training method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of artificial intelligence, and in particular, to a model training method, apparatus, storage medium, and electronic device.
Background
At present, with the development of technology and the requirement of business fusion, artificial intelligence technology is increasingly widely applied in a plurality of fields. Among them, the use of models to execute services is one of the most common application scenarios for artificial intelligence technology.
In general, a precondition for executing a service using a model is to train in advance to obtain a model for executing the service. Based on this, the present specification provides a model training method.
Disclosure of Invention
The present disclosure provides a model training method, system, device, storage medium and electronic apparatus, so as to partially solve the above-mentioned problems in the prior art.
The technical scheme adopted in the specification is as follows:
the specification provides a model training method, comprising:
semi-supervised training is carried out on a first model to be trained according to samples in a target sample set, labels of the samples and samples in a non-labeled sample set;
according to a first model after semi-supervised training, selecting a specified number of samples in a non-labeling sample set through an active learning algorithm, adding the samples as target samples in the target sample set, and determining labels of all samples in the target sample set;
and continuing to perform semi-supervised training on the first model according to the re-determined samples and labels in the target sample set and the samples in the unlabeled sample set until a preset iteration termination condition is reached.
Optionally, the method further comprises:
acquiring a sample set without labels;
selecting a target sample from the unlabeled sample set according to a first model to be trained, and adding the target sample to the target sample set;
and obtaining the label of the target sample.
Optionally, performing semi-supervised training on the first model to be trained according to the samples in the target sample set and the labels thereof and the samples in the unlabeled sample set, including:
determining a specified number of specified samples from the unlabeled sample set, the specified samples being unlabeled samples for training the first model;
for each specified sample, determining a pseudo label of the specified sample according to the similarity of the specified sample and each sample in the target sample set and the labels of each sample in the target sample set;
determining output results corresponding to all samples in the target sample set respectively and output results corresponding to all specified samples respectively through the first model to be trained;
and training the first model according to the difference between the output result of each sample in the target sample set and the labels thereof and the difference between the output result of each appointed sample and the pseudo labels thereof.
Optionally, training the first model according to the difference between the output result of each sample in the target sample set and the label thereof, and the difference between the output result of each specified sample and the pseudo label thereof, including:
for each sample in the target sample set, determining the correlation between the sample and the first model according to at least one of a first correlation between sample characteristics of the sample and sample characteristics of other samples, a labeling type of the sample and a second correlation between task types of a first task corresponding to the first model;
according to the correlation, determining the weight of the sample, wherein the weight is positively correlated with the correlation;
determining a first loss according to the output result of each sample in the target sample set and the difference between labels of the output result and the difference, and weights corresponding to the samples in the target sample set;
determining a second loss according to the output result of each specified sample and the difference between pseudo labels of the specified samples;
determining a total loss according to the first loss and the second loss, and training the first model by taking the total loss as a training target.
Optionally, the first model corresponds to a first task;
the method further comprises the steps of:
receiving a training request corresponding to a second model, and determining a second task corresponding to the second model;
when the first task and the second task are related, taking the model parameters of the first model as initial model parameters of the second model;
and determining samples and labels thereof in a reference sample set for training the second model, and training the second model to be trained through the reference sample set.
Optionally, determining samples in a reference sample set for training the second model and labels thereof, and training the second model to be trained through the reference sample set, including:
determining a specified number of samples from the unlabeled sample set through an active learning algorithm according to the second model to be trained, adding the specified number of samples as reference samples to a reference sample set, and determining a specified number of target samples from the target sample set, adding the specified number of target samples as reference samples to the reference sample set;
determining labels corresponding to all samples in the reference sample set respectively;
and training the second model to be trained according to the samples and labels in the reference sample set.
The present specification provides a model training system, the system comprising a sample determination unit and a training unit; wherein:
the sample determining unit is used for determining a sample set without labels, a target sample set and labels of all samples in the target sample set; according to the first model after semi-supervised training, re-determining the samples and labels thereof in the target sample set through an active learning algorithm;
the training unit is used for performing semi-supervised training on the first model according to the samples in the unlabeled sample set, the samples in the target sample set and the labels thereof until the iteration termination condition is met.
The present specification provides a model training apparatus comprising:
the first determining module is used for performing semi-supervised training on a first model to be trained according to the samples in the target sample set, the labels of the samples and the samples in the unlabeled sample set;
the training module is used for selecting a specified number of samples in a non-labeling sample set through an active learning algorithm according to the first model after semi-supervised training, adding the samples as target samples in the target sample set, and determining labels of all samples in the target sample set;
And the second determining module is used for continuing to perform semi-supervised training on the first model according to the re-determined samples and labels in the target sample set and the samples in the unlabeled sample set until a preset iteration termination condition is reached.
The present specification provides a computer readable storage medium storing a computer program which when executed by a processor implements the model training method described above.
The present specification provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the above model training method when executing the program.
The above-mentioned at least one technical scheme that this specification adopted can reach following beneficial effect:
and performing semi-supervised training on the first model through the non-marked sample set and the target sample set, and after the semi-supervised training is finished, re-determining the target sample from the non-marked sample set through an active learning algorithm, adding the target sample into the target sample set, and further continuing performing the semi-supervised training on the first model based on the non-marked sample set and the re-determined target sample set until a preset iteration termination condition is reached.
According to the model training method provided by the specification, the target sample with higher model training effect improvement can be determined through the active learning algorithm and added into the target sample set, so that the first model is better guided to be trained, the accuracy of the first model obtained through training is ensured, and meanwhile, the sample determining efficiency and the model training efficiency are considered.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification, illustrate and explain the exemplary embodiments of the present specification and their description, are not intended to limit the specification unduly. In the drawings:
FIG. 1 is a schematic flow chart of a model training method provided in the present specification;
FIG. 2 is a schematic flow chart of the model training method provided in the present specification;
FIG. 3 is a schematic diagram of a model training system provided in the present disclosure;
FIG. 4 is a schematic structural diagram of the model training apparatus provided in the present specification;
fig. 5 is a schematic view of the electronic device corresponding to fig. 1 provided in the present specification.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the present specification more apparent, the technical solutions of the present specification will be clearly and completely described below with reference to specific embodiments of the present specification and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present specification. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
The following describes in detail the technical solutions provided by the embodiments of the present specification with reference to the accompanying drawings.
Generally, in the process of training a model at present, a training sample with marks for training the model is usually required to be determined first, and after the training sample is determined, the model is subjected to supervised training according to the determined training sample, so that an iteration process in the model training process is completed.
However, in one iteration, the model can be trained based on the labeled training samples only if all the training samples are labeled. It can be seen that the sample labeling phase and the model training process are completely separated.
Or, a sample set for training the model can be predetermined at present, all samples in the sample set are labeled, a designated number of labeled training samples can be determined from the sample set in each iteration process, and the model parameters are adjusted according to the determined designated number of labeled training samples in the iteration process.
However, under the condition that the training samples are required to be marked manually, the method has the characteristics of high manual marking cost and long time consumption, so that the time required by one iteration process is longer in the process of training the model at present. The model training requires multiple iterations, which results in longer time consumption and lower training efficiency of the current model training.
Based on the above, the specification provides a model training method, which performs semi-supervised training on a first model through a non-labeled sample set and a target sample set, and after the semi-supervised training is completed, re-determines a target sample from the non-labeled sample set through an active learning algorithm, adds the target sample into the target sample set, and further continues to perform the semi-supervised training on the first model based on the non-labeled sample set and the re-determined target sample set until a preset iteration termination condition is reached.
Therefore, according to the model training method provided by the specification, the target sample with higher model training effect improvement can be determined through the active learning algorithm and added into the target sample set, so that the first model is better guided to be trained, the accuracy of the first model obtained through training is ensured, and meanwhile, the sample determining efficiency and the model training efficiency are both considered.
Fig. 1 is a schematic flow chart of a model training method provided in the present specification, specifically including the following steps:
s100: and performing semi-supervised training on the first model to be trained according to the samples in the target sample set, the labels thereof and the samples in the unlabeled sample set.
The present specification provides a model training method, the execution of which can be performed by a server for performing model training.
Based on the above brief description of the model training method in the present specification, it can be seen that the model training method in the present specification can perform semi-supervised training on the first model based on the unlabeled sample set and the target sample set. The first model may be used to execute a specified service, where the specified service may be a wind control service, an image segmentation service, or a classification service, and a specific service type corresponding to the specified service may be set as required, which is not limited in this specification.
Specifically, the server may determine a specified number of specified samples from each unlabeled training sample contained in the unlabeled sample set. The specified sample is an unlabeled sample for training the first model, and the unlabeled sample is an unlabeled training sample. The specific number may be one or more, and specific values corresponding to the specific number may be set as required, which is not limited in this specification.
Then, the server may determine, for each specified sample, a similarity between the specified sample and other samples in the target sample set, and determine a pseudo-label for the specified sample according to each determined similarity and labels corresponding to the other samples in the target sample set, respectively.
The server may then input each sample in the target sample set and each specified sample determined as input to the first model to be trained, to obtain output results corresponding to each sample in the target sample set output by the first model, and output results corresponding to each specified sample.
Finally, the server can determine loss according to the difference between the output result of each sample in the target sample set and the label thereof and the difference between the output result of each specified result and the pseudo label thereof, train the first model by taking the loss minimization as an optimization target,
of course, the first model in this specification may also be semi-supervised trained in the following manner:
first, the server may iterate the first model a specified number of times through the labeled target samples to pre-train the first model.
The server may then determine a specified sample from each unlabeled training sample contained in the unlabeled exemplar set.
And secondly, the server can input a specified sample into the first model to obtain an output result of the specified sample determined by the first model.
The server may then determine a label for the specified sample based on the output of the specified sample. Wherein the server can directly adopt the output result of the specified sample as the labeling of the specified sample
The server may input the specified sample and the target sample into the first model in a subsequent iteration process, obtain an output result of the specified sample and an output result of the target sample output by the first model, determine a loss according to the output result and the label of the specified sample and the output result and the label of the target sample, and train the first model with the loss minimized as a training target.
In addition, in the above-mentioned process of determining the labeling of the specified sample, the server may also determine the labeling of the specified sample by determining the labeling of the specified sample according to the historical output result and the current output result corresponding to the specified sample. If the first model is trained according to the output result of the specified sample in the current iteration process and the label of the specified sample determined last time, determining the label of the specified sample again every 100 iteration processes, and training the first model according to the redetermined label.
It should be noted that the above two semi-supervised training processes are only examples of the semi-supervised training process for the first model by using the target sample and each sample of the labeled and unlabeled training samples in the present specification. The server specifically adopts a semi-supervision mode to train the first model, and can be set according to the needs, which is not limited in the specification. It should be noted that, no matter what semi-supervised mode is adopted to train the first model in the present specification, the method of determining the target sample through the active learning mode and training the first model through the semi-supervised mode in the independent claims of the present specification is not affected.
S102: selecting a specified number of samples in a non-labeling sample set through an active learning algorithm according to a first model after semi-supervised training, adding the samples as target samples in the target sample set, determining labels of all samples in the target sample set,
in one or more embodiments provided in the present disclosure, after performing semi-supervised training on the first model, as described above, the server may determine, from each unlabeled training sample included in the unlabeled sample set, a target sample corresponding to the first model after the semi-supervised training again by using an active learning manner, so as to avoid a situation that all training samples need to be labeled to train the model.
The server may input each training sample included in the unlabeled exemplar set into the first model after semi-supervised training, to obtain output results corresponding to each unlabeled exemplar output by the first model.
Then, the server can determine the accuracy of each unlabeled training sample according to the output result of the training sample.
Taking the first model corresponding to the classification task as an example, assuming that the result output by the model is the probability that the training sample belongs to the preset classification, the accuracy of the training sample with the output result being 40% -60% can be considered to be lower, and the accuracy of the training sample with the output result being in the range of lower than 40% or higher than 60% can be considered to be higher.
Finally, the server can determine a training sample with the accuracy lower than the preset accuracy from the unlabeled training samples, take the training sample as a redetermined target sample, add the redetermined target sample into a target sample set, and determine the label of the redetermined target sample.
The above-described method of determining the target sample based on the output result corresponding to each unlabeled sample is only one example of the active learning. The server can also determine the difference between each sample in the unlabeled sample set and each sample in the target sample set by determining each sample in the unlabeled sample set, and then determine the sample with the largest difference from the unlabeled sample set according to the determined difference, and the sample with the largest difference is taken as the target sample and added into the target sample set. The server can also adopt various active learning modes such as feedback sampling, custom rules, minimum promise, multi-mode sampling and the like to determine the target sample. The server determines the target sample by adopting an active learning mode, and can be set according to the needs, and the specification does not limit the target sample.
In addition, after the server determines the target sample, the determined target sample can be directly added into the target sample set, or the sample in the target sample set can be emptied first, and then the determined target sample is added into the target sample set. In particular, how to add the target sample to the target sample set may be set according to need, which is not limited in this specification.
S104: and continuing to perform semi-supervised training on the first model according to the re-determined samples and labels in the target sample set and the samples in the unlabeled sample set until a preset iteration termination condition is reached.
In one or more embodiments provided herein, after re-determining the target sample set, the server may continue semi-supervised training of the first model based on the re-determined samples in the target sample set and the samples in the unlabeled sample set.
Specifically, the server may re-use the first model after the semi-supervised training as the first model to be trained, and continuously re-determine the specified sample from each unlabeled training sample included in the unlabeled sample set. Wherein the specified sample is a non-annotated training sample for training the first model.
The server may then determine a pseudo-annotation for the specified sample based on the re-determined similarities between the specified sample and other samples in the target sample set.
And then, respectively taking each sample in the target sample set and each appointed sample as input, and inputting the input into a first model to be trained to obtain output results respectively corresponding to each sample in the target sample set output by the first model and output results respectively corresponding to each appointed sample.
Finally, the server can determine loss according to the difference between the output result of each sample and the label thereof in the target sample set and the difference between the output result of each appointed sample and the pseudo label thereof, train the first model by taking the loss minimization as an optimization target,
the process of performing the semi-supervised training on the first model in the step S100 and the step S104 is only one example of the semi-supervised training modes, and the server specifically adopts which semi-supervised mode to train the first model, which can be set according to the need, and the present specification is not limited thereto.
Based on the model training method shown in fig. 1, performing semi-supervised training on the first model through a non-labeled sample set and a target sample set, after the semi-supervised training is finished, re-determining a target sample from the non-labeled sample set through an active learning algorithm, adding the target sample set, and further continuing performing the semi-supervised training on the first model based on the non-labeled sample set and the re-determined target sample set until a preset iteration termination condition is reached. According to the model training method provided by the specification, the target sample with higher model training effect improvement can be determined through the active learning algorithm and added into the target sample set, so that the first model is better guided to be trained, the accuracy of the first model obtained through training is ensured, and meanwhile, the sample determining efficiency and the model training efficiency are considered. The model training method in the present specification may first determine a set of unlabeled samples and targets.
In addition, the model is trained by first determining a training sample for training the model. As described above, the model training method in the present specification may perform semi-supervised training on the first model based on the unlabeled sample set and the target sample set. The server may then first determine a non-annotated sample set and a target sample set.
Specifically, the first model trained by the model training method may have a training task corresponding to the first model, and the server may determine a sample set without labels according to the training task.
Taking the training task as an image segmentation task as an example, the server can determine a plurality of unlabeled images, and the unlabeled images are used as unlabeled training samples and added into an unlabeled sample set. Taking the training task as an obstacle recognition task as an example, a plurality of unlabeled obstacle images can be determined at the server and used as unlabeled training samples.
Then, the server randomly selects a specified number of training samples from the non-labeled training samples included in the determined non-labeled sample set as target samples. The specific number of the specified number may be one or a plurality, and may be set as required, which is not limited in this specification.
The server may then add the determined target sample to the target sample set.
Finally, the server may determine an annotation for the target sample.
The server can send an annotation request to the equipment for annotating according to the identification of the target sample, and receive the target sample with the annotation returned by the annotation equipment according to the annotation request, so as to determine the annotation of the target sample. Of course, the server may also determine the similarity between the target sample and other samples in the target sample set, and determine the label of the target sample according to the determined similarities and the labels of the other samples in the target sample set. The specification is not limited to how the determined label of the target sample can be set according to the needs.
Furthermore, in the process of determining the labeling of the target sample, a man-machine interaction mode can be adopted.
Specifically, after the server determines the target sample for training the first model, the target sample and the prompt information may be displayed to the user. The target sample and the prompt message are displayed in a screen panel for information display, and the prompt message is used for prompting a user to mark the target sample.
The server may then monitor the user's operation and, upon monitoring the user's annotation of the target sample, determine the annotation of the target sample.
Further, for the model, the more concentrated the training samples, the more common the training samples can be learned by the model obtained by training. Thus, the server may also train the model based on the correlation of each sample, respectively, while training the first model.
Specifically, the server may determine, for each sample in the target set of samples, a sample characteristic of the sample, and determine a first correlation between the sample characteristic of the sample and other sample characteristics.
The server may then determine a correlation of the sample and the first model based on the first correlation, and determine a weight of the sample based on the correlation. Wherein the weight and the correlation are positively correlated.
Finally, the server may determine, for each sample in the target sample set, a first gap that the sample brings for the first model based on a gap between an output result of the sample and a label of the sample, and a weight of the sample. The server may determine a first loss according to a first gap corresponding to each sample in the target sample set, and determine a second loss according to a difference between an output result of each specified sample and a pseudo label thereof, and may determine a total loss according to the first loss and the second loss, and train the first model with the total loss minimized as a training target.
Wherein the first correlation and the weight are positively correlated, that is, for each training sample, the more correlated the training sample is with other training samples, the more correlated the training sample is with the first model, the higher the weight is assigned to the training sample, and the higher the contribution of the training sample to the loss is.
In addition, for a model, some samples in the unlabeled sample set have their corresponding labels, but these labels may not match the first model. Taking the first model as a multi-classification task for example, there are some training samples with labels, but the labels correspond to the case of the two classification tasks, in which case, the server should train the first model according to the labels corresponding to the training samples and the relevance of the first model for each training sample.
Specifically, the server may determine, for each training sample, a label type of the training sample, and a task type of a first task corresponding to the first model.
The server may then determine a second degree of correlation between the task type and the annotation type for the first task. Taking the task type of the first task as an n-class task, the label type corresponds to an m-class task as an example, if n=m, the second correlation degree between the task type of the first task and the label type is 100%, the smaller the difference between n and m is, the higher the second correlation degree is, the larger the difference between n and m is, and the smaller the second correlation degree is.
The server may then determine a correlation of the sample with the first model based on the second correlation, and determine a weight of the sample based on the correlation. Wherein the weight and the correlation are positively correlated.
Finally, the server may determine, for each sample in the target sample set, a first gap that the sample brings for the first model based on a gap between an output result of the sample and a label of the sample, and a weight of the sample. The server may determine a first loss according to a first gap corresponding to each sample in the target sample set, and determine a second loss according to a difference between an output result of each specified sample and a pseudo label thereof, and may determine a total loss according to the first loss and the second loss, and train the first model with the total loss minimized as a training target.
Wherein the second phase Guan Du is positively correlated with the weights, that is, for each training sample, the more correlated the labeling type of the training sample is with the task type corresponding to the first model, the more correlated the training sample is with the first model, the higher the weight is assigned to the training sample, and the higher the contribution of the training sample to the loss is.
That is, for each sample in the target sample set, the correlation between the sample and the first model is determined according to at least one of a first correlation between a sample feature of the sample and sample features of other samples, a labeling type of the sample, and a second correlation between a task type of a first task corresponding to the first model.
Further, for models, different models correspond to not exactly the same task. Thus, there are situations where two models correspond to a more closely trained task. In this case, if the training task of the second model to be trained is closer to that of the first model already trained, the model parameters of the first model can be directly used as the initial model parameters of the second model to perform migration training on the second model, so as to improve the model training efficiency.
Specifically, the server may receive a training request for the second model. The server may then determine a second task carried in the training request as a second task corresponding to the second model.
Then, the server may determine a degree of association of the second task with the first task corresponding to the first model. The server can respectively perform feature extraction on the first task and the second task, determine a first feature corresponding to the first task and a second feature corresponding to the second task, and determine the association degree by taking the similarity between the first feature and the second feature as the association degree of the second task and the first task.
Of course, the server may be preset with a matching rule, for example, if the first task and the second task correspond to the same type of task (for example, the object classification task, the image segmentation task, the semantic segmentation task, etc.), the association degree of the first task and the second task is higher than 70%, etc. The server may determine a degree of association between the first task and the second task according to the first task and the second task and a preset matching rule. How the association degree is determined can be set according to the needs, and the specification does not limit the association degree.
The server may then determine whether the first task and the second task are related based on the degree of association. If so, the server may use the model parameters of the first model after the training as the initial model parameters of the second model to be trained corresponding to the second task. If not, the server may initialize model parameters of the second model.
Finally, the server may determine labeled reference samples for training the second model, add to a reference sample set, and train the second model to be trained according to the reference sample set. The reference sample may be carried in the training request, or may be determined by the server with reference to the above manner of determining the target sample set.
Of course, the server may perform supervised training on the second model directly according to the reference sample set, or may use the reference sample set as the target sample set, use the second model as the first model, and perform training on the second model directly according to the steps of steps S100-S104.
Further, where the first model and the second model are related, the server may determine the reference sample directly from the target sample set.
Specifically, first, the server may determine a reference sample from the unlabeled exemplar set based on the second model and add the reference sample to the reference exemplar set.
The server may then determine a particular number of target samples from the set of target samples, adding to the set of reference samples. That is, the server may train the second model with a large number of training samples associated with the second model and a small portion of training samples associated with the first model.
Finally, the server can determine labels corresponding to the samples in the reference sample set, and train the second model according to the samples and labels in the reference sample set. The training process of the second model can adopt various training modes such as full supervision, self supervision, semi supervision and the like.
Based on the same thought, the present disclosure provides a flow diagram of a model training method, as shown in fig. 2.
Fig. 2 is a schematic flow chart of the model training method provided in the present specification. The model training method is applied to a training system, and the training system comprises a sample determining unit and a training unit. The sample determining unit is used for determining a label-free sample set, a target sample set and labels of target samples in the target sample set. The training unit is used for performing semi-supervised training on the first model according to the samples and labels in the target sample set and the samples in the unlabeled sample set.
The sample determination unit may then determine the target sample from the unlabeled sample set and determine the label of the target sample, resulting in a labeled training sample.
The training unit may perform semi-supervised training on the first model according to the determined labeled training samples and the samples in the unlabeled sample set.
The sample determining unit may re-determine the target sample from the unlabeled sample set according to the first model after the semi-supervised training after the first model is completed, and determine the labeled target sample according to the re-determined target sample.
The training unit may continue the iterative process described above based on the redefined labeled target samples. Until an iteration termination condition is reached.
Based on the same thought, the specification also provides a model training system, as shown in fig. 3.
Fig. 3 is a schematic structural diagram of a model training system provided in the present specification, where the model training system includes a sample determining unit and a training unit.
The sample determining unit can determine the target sample from the unlabeled sample set, determine the label of the target sample, obtain the target sample with the label, and add the target sample into the target sample set.
The training unit can respectively input the samples in the target sample set and the samples in the non-labeling sample set into the first model, determine loss according to the output result and labeling of each sample in the target sample set output by the first model and the output result and pseudo labeling of each sample in the non-labeling sample set output by the first model, and perform parameter adjustment on the first model according to the loss to obtain a first model after semi-supervision training.
The sample determination unit may continue to re-determine the target sample from the unlabeled sample set and add it to the target sample set based on the first model after the semi-supervised training of the first model is completed.
The training unit may continue the iterative process described above based on the redefined labeled target samples. Until an iteration termination condition is reached.
The specific execution steps of the sample determining unit and the training unit may be referred to the descriptions of steps S100 to S104, which are not repeated in the present specification.
Based on the same thought, the specification also provides a model training device, as shown in fig. 4.
Fig. 4 is a schematic structural diagram of a model training device provided in the present specification, wherein:
the first determining module 200 is configured to perform semi-supervised training on a first model to be trained according to the samples in the target sample set and the labels thereof, and the samples in the unlabeled sample set;
the training module 202 is configured to select, according to the first model after the semi-supervised training, a specified number of samples in a non-labeling sample set through an active learning algorithm, add the samples as target samples in the target sample set, and determine labels of samples in the target sample set;
and the second determining module 204 is configured to continue performing semi-supervised training on the first model according to the re-determined samples and labels in the target sample set and the samples in the unlabeled sample set until a preset iteration termination condition is reached.
Optionally, the first determining module 200 is configured to obtain a non-labeling sample set, select a target sample from the non-labeling sample set according to a first model to be trained, and add the target sample to the target sample set to obtain a label of the target sample.
Optionally, the training module 202 is configured to determine a specified number of specified samples from the non-labeled sample set, where the specified samples are non-labeled samples for training the first model, determine, for each specified sample, a pseudo label of the specified sample according to a similarity between the specified sample and each sample in the target sample set and a label of each sample in the target sample set, determine, by the first model to be trained, an output result corresponding to each sample in the target sample set and an output result corresponding to each specified sample respectively, and train the first model according to a difference between an output result and a label of each sample in the target sample set and a difference between an output result and a pseudo label of each specified sample.
Optionally, the training module 202 is configured to determine, for each sample in the target sample set, a correlation between the sample and the first model according to at least one of a first correlation between a sample feature of the sample and a sample feature of other samples, a second correlation between a label type of the sample and a task type of a first task corresponding to the first model, determine a weight of the sample according to the correlation, determine a positive correlation between the weight and the correlation, determine a first loss according to a difference between an output result of each sample in the target sample set and a label thereof, and a weight corresponding to each sample in the target sample set, determine a second loss according to a difference between an output result of each specified sample and a pseudo label thereof, determine a total loss according to the first loss and the second loss, and train the first model with the total loss minimized as a training target.
Optionally, the first determining module 200 is configured to receive a training request corresponding to a second model, determine a second task corresponding to the second model, and when the first task is related to the second task, determine a sample in a reference sample set for training the second model and a label thereof by using a model parameter of the first model as an initial model parameter of the second model; the training module 202 is configured to train the second model to be trained through the reference sample set, where the first model corresponds to a first task.
Optionally, the first determining module 200 is configured to determine, according to the second model to be trained, a specified number of samples from the unlabeled sample set through an active learning algorithm, and add the specified number of samples as reference samples to a reference sample set, and determine, from the target sample set, a specified number of target samples, and add the specified number of samples as reference samples to the reference sample set, and determine labels corresponding to each sample in the reference sample set; and the training module 202 is configured to train the second model to be trained according to the samples and labels in the reference sample set.
The present specification also provides a computer readable storage medium having stored thereon a computer program operable to perform the model training method provided in fig. 1 above.
The present specification also provides a schematic structural diagram of the electronic device shown in fig. 5. At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile storage, as illustrated in fig. 5, although other hardware required by other services may be included. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs to implement the model training method described above with respect to fig. 1. Of course, other implementations, such as logic devices or combinations of hardware and software, are not excluded from the present description, that is, the execution subject of the following processing flows is not limited to each logic unit, but may be hardware or logic devices.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable Gate Array, FPGA)) is an integrated circuit whose logic function is determined by the programming of the device by a user. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented by using "logic compiler" software, which is similar to the software compiler used in program development and writing, and the original code before the compiling is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but not just one of the hdds, but a plurality of kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), lava, lola, myHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers, and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present specification.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present description is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable lesion detection device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable lesion detection device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable lesion detection device to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing is merely exemplary of the present disclosure and is not intended to limit the disclosure. Various modifications and alterations to this specification will become apparent to those skilled in the art. Any modifications, equivalent substitutions, improvements, or the like, which are within the spirit and principles of the present description, are intended to be included within the scope of the claims of the present description.

Claims (10)

1. A method of model training, the method comprising:
semi-supervised training is carried out on a first model to be trained according to samples in a target sample set, labels of the samples and samples in a non-labeled sample set;
according to a first model after semi-supervised training, selecting a specified number of samples in a non-labeling sample set through an active learning algorithm, adding the samples as target samples in the target sample set, and determining labels of all samples in the target sample set;
And continuing to perform semi-supervised training on the first model according to the re-determined samples and labels in the target sample set and the samples in the unlabeled sample set until a preset iteration termination condition is reached.
2. The method of claim 1, wherein the method further comprises:
acquiring a sample set without labels;
selecting a target sample from the unlabeled sample set according to a first model to be trained, and adding the target sample to the target sample set;
and obtaining the label of the target sample.
3. The method of claim 1, wherein semi-supervised training the first model to be trained based on the samples in the target sample set and their labels, and the samples in the unlabeled sample set, comprises:
determining a specified number of specified samples from the unlabeled sample set, the specified samples being unlabeled samples for training the first model;
for each specified sample, determining a pseudo label of the specified sample according to the similarity of the specified sample and each sample in the target sample set and the labels of each sample in the target sample set;
determining output results corresponding to all samples in the target sample set respectively and output results corresponding to all specified samples respectively through the first model to be trained;
And training the first model according to the difference between the output result of each sample in the target sample set and the labels thereof and the difference between the output result of each appointed sample and the pseudo labels thereof.
4. A method according to claim 3, wherein training the first model based on the differences between the output results of each sample in the target sample set and its labels, and the differences between the output results of each given sample and its pseudo labels, comprises:
for each sample in the target sample set, determining the correlation between the sample and the first model according to at least one of a first correlation between sample characteristics of the sample and sample characteristics of other samples, a labeling type of the sample and a second correlation between task types of a first task corresponding to the first model;
according to the correlation, determining the weight of the sample, wherein the weight is positively correlated with the correlation;
determining a first loss according to the output result of each sample in the target sample set and the difference between labels of the output result and the difference, and weights corresponding to the samples in the target sample set;
Determining a second loss according to the output result of each specified sample and the difference between pseudo labels of the specified samples;
determining a total loss according to the first loss and the second loss, and training the first model by taking the total loss as a training target.
5. The method of claim 1, wherein the first model corresponds to a first task;
the method further comprises the steps of:
receiving a training request corresponding to a second model, and determining a second task corresponding to the second model;
when the first task and the second task are related, taking the model parameters of the first model as initial model parameters of the second model;
and determining samples and labels thereof in a reference sample set for training the second model, and training the second model to be trained through the reference sample set.
6. The method of claim 5, wherein determining samples and their annotations in a reference sample set used to train the second model and training the second model to be trained through the reference sample set comprises:
determining a specified number of samples from the unlabeled sample set through an active learning algorithm according to the second model to be trained, adding the specified number of samples as reference samples to a reference sample set, and determining a specified number of target samples from the target sample set, adding the specified number of target samples as reference samples to the reference sample set;
Determining labels corresponding to all samples in the reference sample set respectively;
and training the second model to be trained according to the samples and labels in the reference sample set.
7. A model training system, characterized in that the system comprises a sample determination unit and a training unit; wherein:
the sample determining unit is used for determining a sample set without labels, a target sample set and labels of all samples in the target sample set; according to the first model after semi-supervised training, re-determining the samples and labels thereof in the target sample set through an active learning algorithm;
the training unit is used for performing semi-supervised training on the first model according to the samples in the unlabeled sample set, the samples in the target sample set and the labels thereof until the iteration termination condition is met.
8. A model training apparatus, the apparatus comprising:
the first determining module is used for performing semi-supervised training on a first model to be trained according to the samples in the target sample set, the labels of the samples and the samples in the unlabeled sample set;
the training module is used for selecting a specified number of samples in a non-labeling sample set through an active learning algorithm according to the first model after semi-supervised training, adding the samples as target samples in the target sample set, and determining labels of all samples in the target sample set;
And the second determining module is used for continuing to perform semi-supervised training on the first model according to the re-determined samples and labels in the target sample set and the samples in the unlabeled sample set until a preset iteration termination condition is reached.
9. A computer readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the method of any of the preceding claims 1-6.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of the preceding claims 1-6 when executing the program.
CN202311619315.XA 2023-11-29 2023-11-29 Model training method and device, storage medium and electronic equipment Pending CN117668543A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311619315.XA CN117668543A (en) 2023-11-29 2023-11-29 Model training method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311619315.XA CN117668543A (en) 2023-11-29 2023-11-29 Model training method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117668543A true CN117668543A (en) 2024-03-08

Family

ID=90078237

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311619315.XA Pending CN117668543A (en) 2023-11-29 2023-11-29 Model training method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117668543A (en)

Similar Documents

Publication Publication Date Title
CN109034183B (en) Target detection method, device and equipment
CN113221555B (en) Keyword recognition method, device and equipment based on multitasking model
CN115618964B (en) Model training method and device, storage medium and electronic equipment
CN112308113A (en) Target identification method, device and medium based on semi-supervision
CN116188971A (en) Robot character recognition method, device and storage medium
CN116663618A (en) Operator optimization method and device, storage medium and electronic equipment
CN111222315B (en) Movie scenario prediction method
CN116502633A (en) Method and device for executing service, storage medium and electronic equipment
CN116127305A (en) Model training method and device, storage medium and electronic equipment
CN111652286A (en) Object identification method, device and medium based on graph embedding
CN116757278B (en) Training method and device of prediction model, storage medium and electronic equipment
CN117409466A (en) Three-dimensional dynamic expression generation method and device based on multi-label control
CN116342888B (en) Method and device for training segmentation model based on sparse labeling
CN116402113B (en) Task execution method and device, storage medium and electronic equipment
CN116151355B (en) Method, device, medium and equipment for model training and service execution
CN117668543A (en) Model training method and device, storage medium and electronic equipment
CN111598092A (en) Method for determining target area in image, method and device for identifying target
CN114926437A (en) Image quality evaluation method and device
CN116434787B (en) Voice emotion recognition method and device, storage medium and electronic equipment
CN112115952B (en) Image classification method, device and medium based on full convolution neural network
CN116186272B (en) Combined training method and device, storage medium and electronic equipment
CN115862675B (en) Emotion recognition method, device, equipment and storage medium
CN116755862B (en) Training method, device, medium and equipment for operator optimized scheduling model
CN117520850A (en) Model training method and device, storage medium and electronic equipment
CN116453615A (en) Prediction method and device, readable storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination