Training method, device, equipment and readable storage medium for quality inspection model
By loading the quality inspection model to be trained, labeled and unlabeled sample sets are obtained, and feature labels are used for labeling and pre-training, which solves the problem of low recall rate of the existing quality inspection system and improves the robustness and accuracy of the model.
Patent Information
- Application Number
- CN202011488573.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-16
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-12-16
AI Technical Summary
The recall rate of the existing quality inspection system is low, and there are serious missed inspections. Moreover, the training of the deep learning model requires a large number of labeled samples, which results in high sample labeling costs and affects the robustness of the model.
By loading the quality inspection model to be trained, obtain the labeled first sample set and the unlabeled mixed sample set, use feature labels to label the mixed sample set, perform pre-training and adversarial training, optimize model parameters, and reduce sample labeling cost and improve model robustness.
It realizes rapid labeling of unlabeled samples, reduces the impact of inaccurate labeling on model training, and improves the accuracy and robustness of the quality inspection model.
Smart Images

Figure CN112633344B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a training method, training device, computer equipment and computer-readable storage medium for a quality inspection model based on sample learning. Background Art
[0002] At present, most quality inspection systems actually use quality inspection technology based on "keywords + regular expressions". The main advantages of this method are fast development and deployment and high accuracy, but there are also certain problems, such as serious missed detections, that is, low recall rate.
[0003] In recent years, with the development of deep learning technology, the use of deep learning models for intelligent quality inspection has become a new trend, and it can often achieve good results in practice. When obtaining the quality inspection model, it is necessary to use labeled positive and negative samples to train the model in order to obtain an intelligent quality inspection model that can be used. In practical applications, in order to obtain a better intelligent quality inspection model, there are more stringent requirements for the training sample set used, such as sample richness and sample quantity.
[0004] Therefore, there is an urgent need for a sample learning-based quality inspection model training method that can improve the robustness of the model. Summary of the invention
[0005] The present application provides a training method, apparatus, computer equipment and storage medium for a quality inspection model based on sample learning to improve the robustness of the quality inspection model.
[0006] In a first aspect, the present application provides a training method for a quality inspection model based on sample learning, the method comprising:
[0007] Load the quality inspection model to be trained;
[0008] Acquire a first sample set with annotations and an unlabeled mixed sample set, and process the first sample set and the mixed sample set to obtain feature labels corresponding to the first sample set;
[0009] Annotating the mixed sample set according to the feature label to obtain an annotated mixed sample set;
[0010] Training the quality inspection model to be trained according to the first sample set and the labeled mixed sample set, and determining whether the trained quality inspection model converges;
[0011] If it is determined that the trained quality inspection model converges, the trained quality inspection model is stored.
[0012] In a second aspect, the present application also provides a training device for a quality inspection model based on sample learning, the device comprising:
[0013] Model loading module, used to load the quality inspection model to be trained;
[0014] A label determination module, used to obtain a first sample set with labels and an unlabeled mixed sample set, and process the first sample set and the mixed sample set to obtain a feature label corresponding to the first sample set;
[0015] A sample generation module, used to label the mixed sample set according to the feature label to obtain a labeled mixed sample set;
[0016] A model training module, used to train the quality inspection model to be trained according to the first sample set and the labeled mixed sample set, and determine whether the trained quality inspection model converges;
[0017] The data storage module is used to store the trained quality inspection model if it is determined that the trained quality inspection model has converged.
[0018] In a third aspect, the present application also provides a computer device, comprising a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the training method of the quality inspection model based on sample learning as described above when executing the computer program.
[0019] In a fourth aspect, the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the training method of the quality inspection model based on sample learning as described above.
[0020] The present application discloses a training method, device, computer equipment and storage medium for a quality inspection model based on sample learning. When a first sample set with labeled sample categories belonging to the same category is obtained, the first sample set is analyzed and processed accordingly to obtain feature labels corresponding to the first sample set. Specifically, the samples contained in the first sample set are segmented to obtain feature labels, and then the obtained feature labels are used to obtain a second sample set corresponding to the category of the first sample set in a hybrid model, so that the first sample set and the second sample set are used to pre-train the quality inspection model to be trained, and an intermediate quality inspection model is obtained when the pre-training is completed. Then, the intermediate quality inspection model is filtered and processed on the second sample set, and noise samples (samples whose categories originally belong to the first sample set) in the second sample set are deleted to obtain a third sample set. Finally, the first sample set and the third sample set are used to further train the intermediate quality inspection model. Through continuous adversarial defense training, continuous optimization of relevant parameters in the model is achieved to obtain a final quality inspection model. It is achieved that during model training, feature labels can be used to quickly label unlabeled samples, reducing the cost increase caused by sample labeling. Through model pre-training and further training, the problem of inaccurate training caused by inaccurate labeling on model training is reduced, so that the final quality inspection model has better quality inspection effect and robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 A flowchart of a training method for a quality inspection model based on sample learning provided in one embodiment of the present application;
[0023] Figure 2 A flowchart of the steps of obtaining feature labels of a first sample set provided in an embodiment of the present application;
[0024] Figure 3 A schematic flow chart of steps for obtaining a labeled mixed sample provided in one embodiment of the present application;
[0025] Figure 4 A flowchart of the steps of training a model to be trained provided in one embodiment of the present application;
[0026] Figure 5 A schematic block diagram of a training device for a quality inspection model based on sample learning provided by one embodiment of the present application;
[0027] Figure 6 A schematic block diagram of the structure of a computer device provided for one embodiment of the present application. DETAILED DESCRIPTION
[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0029] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0030] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0031] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0032] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0033] See also Figure 1 , Figure 1 A flowchart of a method for training a quality inspection model based on sample learning is provided for one embodiment of the present application.
[0034] like Figure 1 As shown, the training method of the quality inspection model based on sample learning includes steps S101 to S105.
[0035] Step S101: Load the quality inspection model to be trained.
[0036] The quality inspection model to be trained is obtained based on the neural network model, and is used to meet different quality inspection requirements in different scenarios, such as quality inspection of customer service conversations to find deficiencies in the conversations and make improvements. Therefore, when it is necessary to obtain a quality inspection model for quality inspection, first determine the initial network model that needs to be trained, that is, the quality inspection model to be trained, and then obtain a quality inspection model that meets actual needs through corresponding training.
[0037] Step S102: Acquire a first sample set with annotations and an unlabeled mixed sample set, and process the first sample set and the mixed sample set to obtain feature labels corresponding to the first sample set.
[0038] Before training the quality inspection model to be trained, it is necessary to determine the input data for training. In practical applications, the training data required for model training needs to have corresponding labels to adjust the relevant parameters in the model and complete the training of the model.
[0039] Generally, the training data required for model training is huge, which can improve the accuracy of the model after training to a certain extent. Therefore, the training data for training needs to be labeled accordingly. If the training data is labeled manually, a lot of manual labor is required. Therefore, in one embodiment, PU-learning (positive unlabeled learning) is used to implement the labeling of unlabeled samples. That is, the first sample set with labels is obtained by PU-learning.
[0040] In practical applications, the first sample set is obtained from a number of labeled positive samples, where the positive samples and negative samples are for the current application scenario. For example, for a face recognition application in a certain environment, such as face recognition of students in a classroom, the face belongs to the category of positive samples, while the walls, windows, body and clothes of the classroom belong to the category of negative samples.
[0041] In practical applications, a first sample set with annotations is first obtained, and the samples included in the first sample set are samples of the same type, such as positive samples or negative samples. For better explanation, the first sample set is set to be positive samples.
[0042] When the first sample set with annotations is obtained, a large number of unlabeled mixed sample sets will also be obtained. For the first sample set and the mixed sample set, the first sample set represents positive samples, and the mixed sample set is a mixed set of positive samples and negative samples. After obtaining the first sample set and the mixed sample set, the first sample set and the mixed sample set are respectively processed accordingly to determine the feature labels corresponding to the first sample set according to the obtained processing results.
[0043] Further, see Figure 2 , Figure 2 A flowchart of the steps of obtaining feature labels of a first sample set provided in an embodiment of the present application.
[0044] Wherein, step S102 includes:
[0045] Step S201: performing word segmentation processing on the samples included in the first sample set to obtain a first word segmentation set;
[0046] Step S202: performing word segmentation processing on the samples included in the mixed sample set to obtain a second word segmentation set;
[0047] Step S203: Count the word frequency of each word in the first word set, and count the word frequency of each word in the second word set, and select several words in the first word set as feature labels corresponding to the first sample set through word frequency comparison.
[0048] When determining the feature label corresponding to the first sample set, it is determined by analyzing and processing the first sample set and the mixed sample set. The feature label corresponding to the first sample set is obtained by analyzing each sample in the first sample set and the mixed sample set.
[0049] Specifically, when the first sample set is obtained, each sample in the first sample set is segmented, so that after the segmentation processing of all samples is completed, a first segmentation set corresponding to the first sample set is obtained, and at the same time, each sample in the mixed sample set is segmented, so that after the segmentation processing of all samples is completed, a second segmentation set corresponding to the mixed sample set is obtained. Then, all the segmentations in the first segmentation set and the second segmentation set are counted to finally determine the feature label corresponding to the first sample set.
[0050] In practical applications, after obtaining the first word segmentation set and the second word segmentation set, the word segmentations contained in the first word segmentation set and the second word segmentation set are counted to determine the word frequency corresponding to each word, and then several word segmentations are selected as feature labels corresponding to the first sample set through corresponding comparison.
[0051] In one embodiment, the first sample set is samples of the same category, namely, positive samples, and the mixed sample set includes positive samples and negative samples. Therefore, when determining the feature labels corresponding to the first sample set, corresponding comparison is required to determine. Since the mixed sample set includes negative samples, the word frequency of the feature labels of the first sample set in the mixed samples will be lower. Therefore, the feature labels corresponding to the first sample set can be determined by word frequency comparison.
[0052] In actual application, after obtaining the word segmentation set corresponding to the labeled first sample set (positive sample set) and the word segmentation set corresponding to the unlabeled mixed sample set, the word frequency of the same word segmentation in the two word segmentation sets is counted to obtain the word frequency A1 corresponding to the first sample set and the word frequency A2 corresponding to the mixed sample set, and then the current corresponding feature label is determined by the ratio A1 / A2 of A1 to A2.
[0053] When determining the feature label, the obtained ratio is compared with the preset ratio threshold. When the obtained ratio is greater than or equal to the ratio threshold, the word is determined to be a feature label. For example, the ratio corresponding to the word "hello" is 4. Since it is greater than 3 (ratio threshold), "hello" is determined to be a feature label. In this way, the feature label corresponding to the first sample set (positive sample) is determined.
[0054] In practical applications, take the conversation between a salesperson and a customer as an example. In a general conversation, the salesperson's polite communication can better promote communication with the customer. Therefore, in the conversation, more polite words, such as please or you, will play a positive role. By performing word segmentation on all samples in the first sample set (positive sample set), the feature labels of the positive samples are determined through counting statistics. For example, "please" and "you" in the conversation can be some of the feature labels.
[0055] It should be noted that, in actual application, there is no definite order between step S201 and step S202. The two can be performed simultaneously or at the same time, and no limitation is imposed here.
[0056] Step S103: label the mixed sample set according to the feature label to obtain a labeled mixed sample set.
[0057] During model training, in order to improve the robustness of the model and the accuracy of training, certain adversarial training is required. Therefore, after obtaining the first sample set representing the positive sample, it is necessary to obtain the corresponding negative sample, so as to use the positive sample and the negative sample to train the model to be trained accordingly, thereby obtaining a more accurate and more robust model.
[0058] Therefore, when obtaining the first sample set, an unlabeled mixed sample set is obtained, wherein the samples contained in the mixed sample set may be negative samples or a set of positive samples and negative samples. However, in actual use, when the mixed samples are a set of positive samples and negative samples, it can be more conducive to model training. Therefore, the preferred mixed samples are a set of positive samples and negative samples. Then, the samples contained in the unlabeled mixed sample set are labeled by the feature labels corresponding to the first sample set obtained in advance. After the labeling is completed, the labeled mixed sample set is obtained.
[0059] For the annotated mixed sample set, the mixed sample set is annotated and classified. The mixed sample set is annotated by the feature label corresponding to the first sample set to determine in the mixed sample set samples with the same category as the first sample set and samples with different categories from the first sample set, where samples with the same category belong to the same positive example.
[0060] Further, refer to Figure 3 , Figure 3 A flowchart of steps for obtaining a labeled mixed sample is provided in one embodiment of the present application.
[0061] Wherein, step S103 includes:
[0062] Step S301: Based on the second word segmentation set, determine a sub-word segmentation set corresponding to each sample in the unlabeled mixed sample set;
[0063] Step S302: label each sample according to the sub-word set and the feature label to obtain a labeled mixed sample.
[0064] After the feature labels are obtained, the samples in the previously obtained unlabeled mixed sample set are labeled using the feature labels to obtain a labeled mixed sample set.
[0065] Specifically, when an unlabeled mixed sample set is annotated, each sample is annotated, a sub-partition set corresponding to each sample is obtained, and then each sample is annotated using the obtained sub-partition set and the obtained feature label.
[0066] When labeling each sample, the sub-segmentation set is compared with the feature label, and the sample is labeled based on the comparison result. For example, when the number of feature labels contained in the sub-segmentation set of the sample is greater than the set number, the sample is labeled, that is, labeled with the same label as the first sample set, otherwise it is not labeled.
[0067] Furthermore, when the unlabeled mixed sample set is labeled, not all samples can be used to train the model. Therefore, after the mixed sample set is labeled, the method also includes: screening the labeled mixed sample set to delete the labeled samples in the labeled mixed sample set to obtain a second sample set.
[0068] In one embodiment, after the mixed sample set is labeled, the mixed samples are screened according to the labeling results to obtain a second sample set. When screening, samples with the same category as the first sample set are deleted to obtain a second sample set with a different category from the first sample set in the mixed sample set.
[0069] In one embodiment, when a mixed sample set is obtained after annotation, the mixed sample set after annotation can be classified to obtain two sub-sample sets, one of which is a sample set of the same category as the first sample set, and the other is a sample set of a different category from the first sample set. During adversarial training, samples of different categories are required. Therefore, after the mixed samples are labeled, a sample set of a different category from the first sample set can be obtained, and the sample set can be called the second sample set.
[0070] For the second sample set, it is a sample set obtained from samples that are opposite to the first sample set. For example, when the samples contained in the first sample set are positive samples, then the samples contained in the second sample set are negative samples. The two different sample sets are then merged to obtain training samples for training the model that needs to be trained.
[0071] In practical applications, when classifying unlabeled samples, each sample contained in the unlabeled mixed sample is segmented, and then the phrases obtained by the segmentation are compared with the pre-obtained feature labels (feature words). For example, when the phrase contains a certain number of feature labels, the category corresponding to the feature label is determined. For example, when there are 5 words belonging to the feature label in the phrase, it is determined that the sample corresponding to the phrase is the same as the category of the first sample set, otherwise it is different.
[0072] Step S104: training the quality inspection model to be trained according to the first sample set and the labeled mixed sample set, and determining whether the trained quality inspection model converges.
[0073] After the mixed sample set is labeled, the quality inspection model to be trained will be trained using the first sample set obtained in advance and the mixed sample set after the labeling is completed. Since the mixed sample set is classified when the mixed sample set is labeled, after the labeling is completed, a sample set of a different category from the first sample set is selected from the labeled mixed sample set as the currently used sample set to complete the training of the quality inspection model to be trained, and then the trained quality inspection model is judged to determine whether it has converged.
[0074] In one embodiment, referring to Figure 4 , Figure 4 A flowchart of the steps of training a model to be trained is provided in one embodiment of the present application. Specifically, when training a quality inspection model to be trained, it includes:
[0075] Step S401: merge the first sample set and the second sample set to obtain a training sample set.
[0076] Since the demand for samples for adversarial training is large, it is necessary to obtain more labeled samples to realize adversarial training of the quality inspection model to be trained, thereby improving the robustness of the obtained target detection model.
[0077] Therefore, after obtaining the second sample set, the first sample set and the second sample set are used to train the quality inspection model to be trained, so the first sample set and the second sample set are merged to obtain a training sample set for training, and then the quality inspection model to be trained is trained according to the obtained training sample set to obtain the desired quality inspection model.
[0078] Step S402: pre-train the quality inspection model to be trained according to the training sample set, and determine whether the quality inspection model is pre-converged after the pre-training is completed.
[0079] When training the model, a biased SVM is used to train the quality inspection model to be trained. Therefore, when the first sample set and the second sample set are obtained, after the first sample set and the second sample set, the samples contained in the first sample set and the second sample set are marked to obtain a training sample set for pre-training.
[0080] In one embodiment, when using a training sample set to pre-train a quality inspection model to be trained, it includes: marking each sample in the first sample set with a first label, and marking each sample in the second sample set with a second label; inputting the labeled training sample set into the quality inspection model to be trained to obtain the minimized value currently corresponding to the quality inspection model to be trained; and determining the model parameters currently corresponding to the quality inspection model to be trained based on the minimized value, so as to pre-train the quality inspection model to be trained.
[0081] Specifically, before training, each sample in the training sample set is labeled. When labeling, 1 can be used to represent a positive sample (the first sample set), -1 can be used to represent a negative sample (the second sample set), and (x i ,y i ) represents a sample, where x i Represents a sample, y i Indicates the label corresponding to the sample. After the sample is labeled, the labeled sample is input into the quality inspection model to be trained to realize pre-training of the quality inspection model to be trained.
[0082] During the pre-training process, the model parameters in the quality inspection model to be trained are continuously adjusted and optimized so that the trained model meets the current needs. When optimizing the model, the following optimization problem can be formalized:
[0083] Minimize:
[0084] Satisfied: y i (W T x i +b)≥1-ξ i ,ξ i ≥0,i=1,2,...,n
[0085] Among them, W is the parameter to be learned by the model. and They are the penalties for misclassification of positive samples and negative samples, respectively. It can be seen that we assign different weights to the penalties for misclassification of positive samples and negative samples. This is because positive samples are selected based on the selected labels. We are more confident about the labels of positive samples and believe that there is less noise in positive samples, so we give a greater penalty to misclassified positive samples. In this way, by adjusting the parameter C + and C - , the optimization objective of the model can take the noise of the samples into account.
[0086] During training, the convergence of the quality inspection model after the current training is determined by the minimized value. For example, through numerical comparison, when the obtained minimized value is less than the set threshold, it is determined to be converged, otherwise it is determined to be non-converged. Exemplarily, when determining whether the quality inspection model after pre-training has converged, it includes: obtaining a preset minimization threshold, and comparing the minimization value with the minimization threshold; if the minimization value is less than or equal to the minimization threshold, it is determined that the quality inspection model after pre-training has converged; if the minimization value is greater than the minimization threshold, it is determined that the quality inspection model after pre-training has not converged.
[0087] Step S403: If it is determined that the quality inspection model after training is pre-converged, an intermediate quality inspection model is obtained.
[0088] When the quality inspection model to be trained is pre-trained based on the first sample set and the second sample set, when it is determined that the model converges after the pre-training is completed, an intermediate model corresponding to the completion of the training will be obtained, wherein the intermediate quality inspection model is not the final quality inspection model for use, but an intermediate quality inspection model that needs further training, and then by training the intermediate quality inspection model, the final usable quality inspection model is obtained.
[0089] Step S404: Filter the second sample set according to the intermediate quality inspection model to obtain a third sample set.
[0090] In practical applications, when the mixed sample set is labeled according to the obtained feature labels to obtain the second sample set, some noise will inevitably exist, that is, classification errors, such as labeling samples belonging to the first sample set to the second sample set, which will affect the training effect of the model during the training process. Therefore, in order to ensure the robustness of the model and the accuracy after training, the second sample set will be screened accordingly to delete the noise samples in the second sample set.
[0091] After obtaining the intermediate quality inspection model, the second sample set is input into the intermediate quality inspection model to re-label the labels of each sample in the second sample set, and then the re-labeled second sample set is filtered to remove the noise samples in the re-labeled second sample set to obtain the third sample set.
[0092] Since the samples in the first sample set are positive samples and the samples in the second sample set are negative samples, during filtering, the positive samples in the re-labeled second sample set are removed, and only samples with confidence greater than the set threshold are retained to obtain a third sample set containing only negative samples.
[0093] Step S405: training the intermediate quality inspection model according to the first sample set and the third sample set, and determining whether the trained intermediate quality inspection model converges.
[0094] After obtaining the third sample set, the first sample set and the third sample set are merged to obtain new training samples for training, and then the intermediate quality inspection model is trained again according to the new training samples. When the trained intermediate quality inspection model converges, the final trained quality inspection model is obtained and the obtained quality inspection model is stored.
[0095] It should be noted that when determining whether the model has converged, the determination of whether the model has converged can be implemented according to the method described in step S403, so no specific description is given here.
[0096] Step S105: If it is determined that the trained quality inspection model has converged, the trained quality inspection model is stored.
[0097] By judging the model parameters in the trained quality inspection model, when it is determined that the obtained model parameters meet the set conditions, it is determined that the quality inspection model obtained by the training at this time converges, that is, it meets the actual needs of the model. Therefore, the trained target detection model at this time will be recorded and stored for subsequent use.
[0098] In one embodiment, for the trained quality inspection model, in addition to determining convergence, it is possible that the model still does not converge, that is, it still does not meet the actual requirements for the model, and therefore the quality inspection model needs to continue to be trained.
[0099] Therefore, when determining whether it has converged, if it is determined that the trained quality inspection model has not converged, the above step S104 is performed: the quality inspection model to be trained is trained according to the first sample set and the labeled mixed sample set, and it is determined whether the trained quality inspection model has converged. Until the quality inspection model obtained by training converges, the quality inspection model corresponding to the convergence is recorded and stored.
[0100] In the training method of the quality inspection model based on sample learning described above, when a first sample set with labeled sample categories belonging to the same category is obtained, the first sample set is subjected to corresponding analysis and processing to obtain feature labels corresponding to the first sample set. Specifically, the samples contained in the first sample set are subjected to word segmentation processing to obtain feature labels, and then the obtained feature labels are used to obtain a second sample set corresponding to the category of the first sample set in the hybrid model, so that the first sample set and the second sample set are used to pre-train the quality inspection model to be trained, and an intermediate quality inspection model is obtained when the pre-training is completed. Then, the intermediate quality inspection model is used to filter the second sample set, and the noise samples (samples whose categories originally belong to the first sample set) in the second sample set are deleted to obtain a third sample set. Finally, the first sample set and the third sample set are used to further train the intermediate quality inspection model. Through continuous adversarial defense training, the relevant parameters in the model are continuously optimized to obtain the final quality inspection model. It is achieved that during model training, feature labels can be used to quickly label unlabeled samples, reducing the cost increase caused by sample labeling. Through model pre-training and further training, the problem of inaccurate training caused by inaccurate labeling on model training is reduced, so that the final quality inspection model has better quality inspection effect and robustness.
[0101] See also Figure 5 , Figure 5 A schematic block diagram of a training device for a quality inspection model based on sample learning provided in one embodiment of the present application, wherein the device is used to execute the aforementioned training method for a quality inspection model based on sample learning.
[0102] like Figure 5 As shown, the training device 500 of the quality inspection model based on sample learning includes:
[0103] Model loading module 501, used to load the quality inspection model to be trained;
[0104] The label determination module 502 is used to obtain a first sample set with labels and an unlabeled mixed sample set, and process the first sample set and the mixed sample set to obtain a feature label corresponding to the first sample set;
[0105] A sample generation module 503 is used to label the mixed sample set according to the feature label to obtain a labeled mixed sample set;
[0106] A model training module 504 is used to train the quality inspection model to be trained according to the first sample set and the labeled mixed sample set, and determine whether the trained quality inspection model converges;
[0107] The data storage module 505 is used to store the trained quality inspection model if it is determined that the trained quality inspection model has converged.
[0108] Furthermore, in one embodiment, the tag determination module 502 is further configured to:
[0109] Performing word segmentation processing on the samples included in the first sample set to obtain a first word segmentation set;
[0110] Performing word segmentation processing on the samples included in the mixed sample set to obtain a second word segmentation set;
[0111] Counting the word frequency of each word in the first word set, and counting the word frequency of each word in the second word set, and selecting a number of words in the first word set as feature labels corresponding to the first sample set through word frequency comparison;
[0112] Among them, the word frequencies corresponding to the several word segments are greater than or equal to a preset threshold.
[0113] Furthermore, in one embodiment, the sample generation module 503 is further configured to:
[0114] Based on the feature label, label each sample in the mixed sample set;
[0115] The mixed samples are screened according to the labeling result to obtain a second sample set.
[0116] Furthermore, in one embodiment, the model training module 504 is further configured to:
[0117] Merging the first sample set and the second sample set to obtain a training sample set;
[0118] Pre-training the quality inspection model to be trained according to the training sample set, and determining whether the quality inspection model after the pre-training is pre-converged;
[0119] If it is determined that the quality inspection model after the training is pre-converged, an intermediate quality inspection model is obtained;
[0120] filtering the second sample set according to the intermediate quality inspection model to obtain a third sample set;
[0121] The intermediate quality inspection model is trained according to the first sample set and the third sample set, and it is determined whether the trained intermediate quality inspection model converges.
[0122] Furthermore, in one embodiment, the model training module 504 is further configured to:
[0123] Marking each sample in the first sample set with a first mark, and marking each sample in the second sample set with a second mark;
[0124] Inputting the labeled training sample set into the quality inspection model to be trained to obtain the minimized value currently corresponding to the quality inspection model to be trained;
[0125] According to the minimized value, the model parameters currently corresponding to the quality inspection model to be trained are determined to pre-train the quality inspection model to be trained.
[0126] Furthermore, in one embodiment, the model training module 504 is further configured to:
[0127] Obtaining a preset minimization threshold, and comparing the minimization value with the minimization threshold;
[0128] If the minimization value is less than or equal to the minimization threshold, it is determined that the quality inspection model after the pre-training has converged;
[0129] If the minimization value is greater than the minimization threshold, it is determined that the quality inspection model after the pre-training has not converged.
[0130] Furthermore, in one embodiment, the data storage module 505 is further configured to:
[0131] If it is determined that the trained target detection model has not converged, the following steps are performed: the quality inspection model to be trained is trained according to the first sample set and the labeled mixed sample set, and it is determined whether the trained quality inspection model has converged.
[0132] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0133] The above-mentioned device can be implemented in the form of a computer program. Figure 6 Runs on the computer device shown.
[0134] See also Figure 6 , Figure 6 A schematic block diagram of the structure of a computer device provided for one embodiment of the present application. The computer device may be a server.
[0135] See also Figure 6 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0136] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any training method of a quality inspection model based on sample learning.
[0137] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0138] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any training method of the quality inspection model based on sample learning.
[0139] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0140] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0141] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0142] Load the quality inspection model to be trained;
[0143] Acquire a first sample set with annotations and an unlabeled mixed sample set, and process the first sample set and the mixed sample set to obtain feature labels corresponding to the first sample set;
[0144] Annotating the mixed sample set according to the feature label to obtain an annotated mixed sample set;
[0145] Training the quality inspection model to be trained according to the first sample set and the labeled mixed sample set, and determining whether the trained quality inspection model converges;
[0146] If it is determined that the trained quality inspection model converges, the trained quality inspection model is stored.
[0147] In one embodiment, when the processor processes the first sample set to obtain a feature label corresponding to the first sample set, the processor is further configured to implement:
[0148] Performing word segmentation processing on the samples included in the first sample set to obtain a first word segmentation set;
[0149] Performing word segmentation processing on the samples included in the mixed sample set to obtain a second word segmentation set;
[0150] Counting the word frequency of each word in the first word set, and counting the word frequency of each word in the second word set, and selecting a number of words in the first word set as feature labels corresponding to the first sample set through word frequency comparison;
[0151] Among them, the word frequencies corresponding to the several word segments are greater than or equal to a preset threshold.
[0152] In one embodiment, when the processor implements labeling the mixed sample set according to the feature label to obtain the labeled mixed sample set, the processor is further configured to implement:
[0153] Based on the feature label, label each sample in the mixed sample set;
[0154] The mixed samples are screened according to the labeling result to obtain a second sample set.
[0155] In one embodiment, when the processor implements the training of the quality inspection model to be trained according to the first sample set and the labeled mixed sample set and determines whether the trained quality inspection model converges, it is also used to implement:
[0156] Merging the first sample set and the second sample set to obtain a training sample set;
[0157] Pre-training the quality inspection model to be trained according to the training sample set, and determining whether the quality inspection model after the pre-training is pre-converged;
[0158] If it is determined that the quality inspection model after the training is pre-converged, an intermediate quality inspection model is obtained;
[0159] filtering the second sample set according to the intermediate quality inspection model to obtain a third sample set;
[0160] The intermediate quality inspection model is trained according to the first sample set and the third sample set, and it is determined whether the trained intermediate quality inspection model converges.
[0161] In one embodiment, when implementing the pre-training of the quality inspection model to be trained according to the training sample set, the processor is further used to implement:
[0162] Marking each sample in the first sample set with a first mark, and marking each sample in the second sample set with a second mark;
[0163] Inputting the labeled training sample set into the quality inspection model to be trained to obtain the minimized value currently corresponding to the quality inspection model to be trained;
[0164] According to the minimized value, the model parameters currently corresponding to the quality inspection model to be trained are determined to pre-train the quality inspection model to be trained.
[0165] In one embodiment, when the processor implements the determining whether the quality inspection model after the pre-training is pre-converged, it is also used to implement:
[0166] Obtaining a preset minimization threshold, and comparing the minimization value with the minimization threshold;
[0167] If the minimization value is less than or equal to the minimization threshold, it is determined that the quality inspection model after the pre-training has converged;
[0168] If the minimization value is greater than the minimization threshold, it is determined that the quality inspection model after the pre-training has not converged.
[0169] In one embodiment, after determining whether the trained quality inspection model has converged, the processor is further configured to:
[0170] If it is determined that the trained target detection model has not converged, the following steps are performed: the quality inspection model to be trained is trained according to the first sample set and the labeled mixed sample set, and it is determined whether the trained quality inspection model has converged.
[0171] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any one of the sample learning-based quality inspection model training methods provided in the embodiments of the present application.
[0172] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0173] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0174] In addition, the blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0175] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A training method for a quality inspection model based on sample learning, characterized in that: The method comprises: Load the quality inspection model to be trained; A first sample set with annotations and an unlabeled mixed sample set are obtained, and the first sample set and the mixed sample set are processed to obtain a feature label corresponding to the first sample set; a first segmentation set is obtained by performing segmentation processing on the samples included in the first sample set; a second segmentation set is obtained by performing segmentation processing on the samples included in the mixed sample set; the word frequency of each segmentation in the first segmentation set is counted, and the word frequency of each segmentation in the second segmentation set is counted, and a number of segmentations are selected from the first segmentation set as feature labels corresponding to the first sample set through word frequency comparison; wherein the word frequency corresponding to the number of segmentations is greater than or equal to a preset threshold; annotating the mixed sample set according to the feature label to obtain an annotated mixed sample set; determining the sub-partition set corresponding to each sample in the unannotated mixed sample set based on the second participle set; annotating each sample according to the sub-partition set and the feature label to obtain an annotated mixed sample set; when annotating each sample, comparing the sub-partition set with the feature label, annotating the sample according to the comparison result, and marking the sample when the number of feature labels contained in the sub-partition set of the sample is greater than the set number, marking the sample, that is, marking it with the same label as the first sample set, otherwise not marking it; Training the quality inspection model to be trained according to the first sample set and the labeled mixed sample set, and determining whether the trained quality inspection model converges; If it is determined that the trained quality inspection model converges, the trained quality inspection model is stored.
2. The method according to claim 1, characterized in that After labeling the mixed sample set according to the feature label to obtain the labeled mixed sample set, the method further includes: The annotated mixed sample set is screened to delete the annotated samples in the annotated mixed sample set to obtain a second sample set.
3. The method according to claim 2, characterized in that The step of training the quality inspection model to be trained according to the first sample set and the labeled mixed sample set, and determining whether the trained quality inspection model converges, includes: Merging the first sample set and the second sample set to obtain a training sample set; Pre-training the quality inspection model to be trained according to the training sample set, and determining whether the quality inspection model after the pre-training is pre-converged; If it is determined that the quality inspection model after the training is pre-converged, an intermediate quality inspection model is obtained; filtering the second sample set according to the intermediate quality inspection model to obtain a third sample set; The intermediate quality inspection model is trained according to the first sample set and the third sample set, and it is determined whether the trained intermediate quality inspection model converges.
4. The method according to claim 3, characterized in that The pre-training of the quality inspection model to be trained according to the training sample set includes: Marking each sample in the first sample set with a first mark, and marking each sample in the second sample set with a second mark; Inputting the labeled training sample set into the quality inspection model to be trained to obtain the minimized value currently corresponding to the quality inspection model to be trained; According to the minimized value, the model parameters currently corresponding to the quality inspection model to be trained are determined to pre-train the quality inspection model to be trained.
5. The method according to claim 4, characterized in that The determining whether the quality inspection model after the pre-training is pre-converged includes: Obtaining a preset minimization threshold, and comparing the minimization value with the minimization threshold; If the minimization value is less than or equal to the minimization threshold, it is determined that the quality inspection model after the pre-training has converged; If the minimization value is greater than the minimization threshold, it is determined that the quality inspection model after the pre-training has not converged.
6. A training device for a quality inspection model based on sample learning, characterized in that: The device comprises: Model loading module, used to load the quality inspection model to be trained; A label determination module is used to obtain a first sample set with annotations and an unlabeled mixed sample set, and process the first sample set and the mixed sample set to obtain a feature label corresponding to the first sample set; obtain a first segmentation set by performing segmentation processing on the samples included in the first sample set; obtain a second segmentation set by performing segmentation processing on the samples included in the mixed sample set; count the word frequency of each segmentation in the first segmentation set, and count the word frequency of each segmentation in the second segmentation set, and select several segmentations in the first segmentation set as feature labels corresponding to the first sample set through word frequency comparison; wherein the word frequency corresponding to the several segmentations is greater than or equal to a preset threshold; A sample generation module is used to label the mixed sample set according to the feature label to obtain a labeled mixed sample set; determine the sub-partition word set corresponding to each sample in the unlabeled mixed sample set based on the second partition word set; label each sample according to the sub-partition word set and the feature label to obtain a labeled mixed sample set; when labeling each sample, compare the sub-partition word set with the feature label, and label the sample according to the comparison result. When the number of feature labels included in the sub-partition word set of the sample is greater than the set number, the sample is labeled, that is, it is labeled with the same label as the first sample set, otherwise it is not labeled; A model training module, used to train the quality inspection model to be trained according to the first sample set and the labeled mixed sample set, and determine whether the trained quality inspection model converges; The data storage module is used to store the trained quality inspection model if it is determined that the trained quality inspection model has converged.
7. A computer device, characterized in that: Including memory and processor: The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the training method of the quality inspection model based on sample learning as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, one or more processors execute the steps of the training method of the quality inspection model based on sample learning as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Generation device and method for text classification model and a computer readable memory medium
CN108804512A
Text classification model training method and device, computer device and storage medium
CN110110080A
Text categorization model training method, apparatus, computer device, and storage medium
WO2020199591A1
