A label screening method and apparatus
Patent Information
- Application Number
- CN202111164295.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-30
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2041-09-30
AI Technical Summary
然而对于一些复杂的场景,老师模型由于结构复杂可以通过自己学习训练进而达到较高的精度,但是在这种场景中,由老师模型指导学生模型不仅不能使学生模型获得较高的精度,还可能导致任务场景过于复杂导致学生模型相对于本来对于单个场景下精度的再次下降
[0022]本申请提供的标签筛选方法通过筛选条件对多个老师模型预测的指导标签进行筛选,以筛选出适用于对学生模型进行蒸馏指导的目标标签,利用筛选获得的目标标签对学生模型进行蒸馏训练,由此获得的学生模型能够学习到至少一个老师模型的有利优势,从而有利于结构简单的学生模型在短时间内能够在单一场景或多个场景下都有较高精度。
Smart Images

Figure CN114021720B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of neural network technology, and in particular to a label selection method and apparatus. Background Technology
[0002] When deploying and applying models, teacher models can guide student models to achieve higher accuracy. However, in complex scenarios, while teacher models, due to their complex structures, can achieve high accuracy through self-training, guiding student models in such scenarios not only fails to improve student accuracy but may also lead to a further decrease in accuracy compared to the original accuracy for a single scenario due to the complexity of the task. Summary of the Invention
[0003] This application provides a label screening method and apparatus to at least solve the above-mentioned technical problems existing in the prior art.
[0004] This application provides a label selection method, which includes: obtaining guidance labels corresponding to multiple teacher models, wherein the guidance labels are obtained by the teacher models predicting training samples; selecting the guidance labels according to real labels to determine target labels that meet the selection criteria; and distilling guidance for student models according to the target labels to obtain updated student models.
[0005] In one embodiment, obtaining guidance labels corresponding to multiple teacher models includes: obtaining training samples, wherein the training samples are single-scene training samples and the single-scene training samples are labeled with at least one dimension of real labels; obtaining multiple teacher models for a single scene, wherein different teacher models have different advantages for the training samples; and predicting the training samples using the multiple teacher models to obtain the guidance labels of the at least one dimension.
[0006] In one possible implementation, obtaining guidance labels corresponding to multiple teacher models includes: obtaining training samples, wherein the training samples are multiple scene training samples, and the multiple scene training samples are labeled with real labels of multiple dimensions; obtaining a teacher model for each of the multiple scenes; each teacher model is used to predict the real label of at least one dimension in a scene; and training the training samples through the multiple teacher models to obtain the guidance labels of the multiple dimensions.
[0007] In one possible implementation, the step of filtering the guidance label based on the real label to determine the target label that meets the filtering conditions includes: comparing the guidance label and the real label to obtain a first comparison value; and adjusting the guidance label based on the first comparison value to determine the target label.
[0008] In one possible implementation, adjusting the guidance label based on the first comparison value to determine the target label includes: filtering the first comparison values corresponding to the same training sample to determine the first comparison value with the smallest value; and determining the guidance label corresponding to the first comparison value with the smallest value as the target label.
[0009] In one possible implementation, adjusting the guidance label based on the first comparison value to determine the target label includes: determining an advantage weight based on the first comparison value corresponding to the same training sample; and weighting the guidance label according to the advantage weight to obtain the target label.
[0010] In one embodiment, the step of distilling the student model according to the target label to obtain an updated student model includes: training the student model using training samples corresponding to the target label to obtain training labels; determining guidance data based on the target label and the training labels; and distilling the student model according to the guidance data to obtain an updated student model.
[0011] In one possible implementation, determining guidance data based on the target label and the training label includes: comparing the target label and the training label to obtain a second comparison value; comparing the target label and the real label to obtain a third comparison value; and integrating the second comparison value and the third comparison value to obtain guidance data.
[0012] In one possible implementation, determining the guidance data based on the target label and the training label includes: extracting data from the intermediate layer of the teacher model corresponding to the target label to obtain first intermediate data; extracting data from the intermediate layer of the student model corresponding to the training label to obtain second intermediate data; integrating the first intermediate data and the second intermediate data to determine a fourth comparison value; and integrating the fourth comparison value and the second comparison value to obtain a fifth comparison value; wherein the fifth comparison value is used to determine the guidance data.
[0013] This application also provides a label filtering device, the device comprising: an acquisition module for acquiring guidance labels corresponding to multiple teacher models, the guidance labels being obtained by the teacher models predicting training samples; a filtering module for filtering the guidance labels based on real labels to determine target labels that meet the filtering conditions; and a guidance module for distilling guidance onto a student model based on the target labels to obtain an updated student model.
[0014] In one embodiment, the obtaining module includes: an obtaining submodule for obtaining training samples, wherein the training samples are single-scene training samples and the single-scene training samples are labeled with at least one dimension of real labels; the obtaining submodule is further used to obtain multiple teacher models for a single scene, wherein different teacher models have different advantages for the training samples; and a first training submodule for predicting the training samples using the multiple teacher models to obtain the at least one dimension of guidance labels.
[0015] In one embodiment, the obtaining submodule is further configured to obtain training samples, which are multiple scene training samples labeled with real labels in multiple dimensions; the obtaining submodule is further configured to obtain a teacher model for each of the multiple scenes; each teacher model is used to predict the real label in at least one dimension of a scene; the first training submodule is further configured to train the training samples using the multiple teacher models to obtain the guidance labels in the multiple dimensions.
[0016] In one embodiment, the filtering module includes: a comparison submodule for comparing the guidance label and the real label to obtain a first comparison value; and an adjustment submodule for adjusting the guidance label according to the first comparison value to determine the target label.
[0017] In one possible implementation, the adjustment submodule includes: filtering first comparison values corresponding to the same training sample to determine the first comparison value with the smallest value; and determining the guidance label corresponding to the first comparison value with the smallest value as the target label.
[0018] In one possible implementation, the adjustment submodule includes: determining an advantage weight based on a first comparison value corresponding to the same training sample; and weighting the guidance label according to the advantage weight to obtain a target label.
[0019] In one possible implementation, the guidance module includes: a second training submodule, used to train the student model using training samples corresponding to the target label to obtain training labels; a determination submodule, used to determine guidance data based on the target label and the training labels; and a distillation submodule, used to perform distillation guidance on the student model based on the guidance data to obtain an updated student model.
[0020] In one possible implementation, the determining submodule includes: comparing the target label and the training label to obtain a second comparison value; comparing the target label and the real label to obtain a third comparison value; and integrating the second comparison value and the third comparison value to obtain guidance data.
[0021] In one possible implementation, the determining submodule includes: extracting data from the intermediate layer of the teacher model corresponding to the target label to obtain first intermediate data; extracting data from the intermediate layer of the student model corresponding to the training label to obtain second intermediate data; integrating the first intermediate data and the second intermediate data to determine a fourth comparison value; and integrating the fourth comparison value and the second comparison value to obtain a fifth comparison value; wherein the fifth comparison value is used to determine the guidance data.
[0022] The label selection method provided in this application filters the guidance labels predicted by multiple teacher models through screening conditions to select target labels suitable for distillation guidance of student models. The student models are then trained using the selected target labels, and the resulting student models can learn the advantages of at least one teacher model. This allows the simple student models to achieve high accuracy in a single or multiple scenarios in a short period of time. Attached Figure Description
[0023] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. Several embodiments of this application are illustrated in the drawings by way of example and not limitation, in which:
[0024] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
[0025] Figure 1 This is a schematic diagram illustrating the implementation process of a tag filtering method according to the first embodiment of this application;
[0026] Figure 2 This is a schematic diagram illustrating the implementation process of a tag filtering method according to the second embodiment of this application;
[0027] Figure 3This is a schematic diagram illustrating the implementation process of a tag filtering method according to the third embodiment of this application;
[0028] Figure 4 This is a schematic diagram illustrating the implementation process of a tag filtering method according to the fourth embodiment of this application;
[0029] Figure 5 This is a schematic diagram illustrating the implementation process of a tag filtering method according to the fifth embodiment of this application;
[0030] Figure 6 This is a single-scenario distillation architecture diagram of a label screening method according to the sixth embodiment of this application;
[0031] Figure 7 This is a multi-scenario distillation architecture diagram of a label screening method according to the seventh embodiment of this application;
[0032] Figure 8 This is a single-scenario distillation flowchart of a label screening method according to the seventh embodiment of this application;
[0033] Figure 9 This is a schematic diagram of the implementation module of a label screening device according to the first embodiment of this application. Detailed Implementation
[0034] To make the objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0035] Figure 1 This is a schematic diagram illustrating the implementation process of a tag filtering method according to the first embodiment of this application.
[0036] See Figure 1 This application provides a label filtering method, which includes: operation 101, obtaining guidance labels corresponding to multiple teacher models, wherein the guidance labels are obtained by the teacher models predicting training samples; operation 102, filtering the guidance labels according to the real labels to determine the target labels that meet the filtering conditions; and operation 103, distilling the guidance of the student model according to the target labels to obtain the updated student model.
[0037] The label selection method provided in this application filters the guidance labels predicted by multiple teacher models using specific selection criteria to identify target labels suitable for distillation guidance of student models. The student model is then trained using these selected target labels, allowing it to learn the strengths of each teacher model and ultimately create a student model that rivals or even surpasses all teacher models. The target labels obtained using this method can be used for distillation guidance of student models, enabling simple student models to achieve high recognition accuracy in single or multiple scenarios within a short timeframe. This allows for the rapid acquisition of simple, high-precision learning models that can be deployed on resource-constrained edge devices.
[0038] In operation 101 of this method, the teacher model is a pre-trained model. Multiple teacher models have different parameters; specifically, these models can be models with different architectures, different preset parameters, different types of models, or models trained on different teacher training samples, as long as there are differences between the trained teacher models. Furthermore, the teacher model can be selected as a model with a more complex structure and a larger number of parameters compared to the student model. Furthermore, the teacher model can be selected as a model that has an accuracy advantage on the training samples corresponding to the student model. Furthermore, the teacher training samples used to train the teacher model can be the same as or different from the student training samples used to train the student model.
[0039] The guidance labels are obtained by the trained teacher model predicting the input training samples. It should be explained that the training samples here refer to the student training samples used to train the student models. Specifically, each teacher model predicts each training sample in the student training samples to obtain the guidance label corresponding to each training sample. For example, given trained teacher models T1, T2, T3… with different model parameters, and a student training sample set D used to train the student model, where training samples D contain multiple training samples D1, D2, D3…, the teacher model T1 predicts the multiple training samples D1, D2, D3… to obtain the guidance labels T1d1, T1d2, T1d3… corresponding to each training sample. Similarly, guidance labels T2d1, T2d2, T2d3… corresponding to teacher model T2, and guidance labels T3d1, T3d2, T3d3… corresponding to student model T3 can be obtained. Further details are omitted below.
[0040] In operation 102 of this method, the true label is the labeled label corresponding to the student training samples used to train the student model. The true label can be obtained by manually labeling the student training samples or by prediction from other models besides any teacher model. The filtering criteria can be to select the most accurate guidance label, or to select guidance labels that reflect the advantages of the teacher model's guidance, or other selection criteria that help to distill guidance for the student model to achieve higher accuracy. For example, the filtering criteria can be set to the guidance label closest to the true label, or to guidance labels whose proximity to the true label is within a certain threshold range. Guidance labels that meet the filtering criteria are determined as target labels. It should be noted that, depending on the setting of the filtering criteria, one or more target labels can be obtained. Specifically, based on the above implementation scenario, the true label corresponding to training sample D1 is d1, the true label corresponding to training sample D2 is d2, the true label corresponding to training sample D3 is d3, and so on. We filter T1d1, T2d1, and T3d1 using the true label d1; we filter T1d2, T2d2, and T3d2 using the true label d2; and we filter T1d3, T2d3, and T3d3 using the true label d3. This process yields target labels that meet the filtering criteria. For example, if the filtering criteria are set to guide labels whose proximity to the true label is within a certain threshold range, the resulting target labels are the guide label T1d1 corresponding to training sample D1, the guide labels T1d2 and T2d2 corresponding to training sample D2, and the guide label T1d3… corresponding to training sample D3.
[0041] In operation 103 of this method, the student model can be directly distilled using the target labels to learn the strengths of the teacher models corresponding to that target label. Alternatively, the student model can be distilled by combining the target labels with other training data to obtain a student model that has learned the main strengths of each teacher model. In the above implementation scenario, using the student training samples D1, D2, D3… and the selected target labels T1d1, T1d2, T2d2, T1d3…, the student model is distilled using these target labels and student training samples. This allows the model to learn the most effective parts of each model corresponding to the student training samples, enabling effective updates to the student model in a short time. Even with a smaller structure and fewer parameters, the student model can still demonstrate the advantages of multiple teacher models, thus achieving higher prediction accuracy.
[0042] It can be observed that this method can reduce the training time of student models in complex scenarios. If student models train independently on training samples corresponding to complex scenarios, they require a significant increase in training time to achieve the highest possible accuracy. However, with distillation guidance from teacher models, student models can reduce learning costs and achieve the same high accuracy through long-term independent training with only a small amount of training time. Furthermore, this method fully leverages the different strengths of each teacher model for different training samples, analyzing the teacher models' expertise in specific knowledge points and their importance in contributing to accuracy across different training samples. This improves the accuracy of student models on various training samples during training. The method also utilizes the teacher models' guidance labels to assess their strengths and weaknesses, accelerating the robustness of student models' accuracy growth on complex training samples during distillation. In this way, this method can simultaneously produce high-accuracy student models for single or multiple scenarios, accelerating the deployment and improving the quality of this type of small model.
[0043] Figure 2 This is a schematic diagram illustrating the implementation process of a tag filtering method according to the second embodiment of this application.
[0044] See Figure 2 In one possible implementation, operation 101, obtaining guidance labels corresponding to multiple teacher models, includes: operation 1011, obtaining training samples, the training samples being single-scene training samples, the single-scene training samples being labeled with at least one dimension of real labels; operation 1012, obtaining multiple teacher models for a single scene, wherein different teacher models have different advantages for the training samples; operation 1013, predicting the training samples through multiple teacher models to obtain guidance labels of at least one dimension.
[0045] Specifically, based on the different training needs of the student model, corresponding student training samples can be selected, and the guidance labels obtained by the teacher model prediction can be selected using the selected student training samples to obtain the most advantageous prediction guidance for the training samples.
[0046] In Operation 1011, the training requirement for the student model is to obtain a student model adapted to a single scenario. The term "single scenario" is explained below as predicting the same type of information to be predicted and obtaining prediction results of the same dimension. Further, the term "dimension" is explained below as "same dimension," referring to labels of the same type, such as face recognition result labels, gender recognition result labels, etc. Prediction results of the same dimension can contain one or more types of dimensions. For example, when the model is an image recognition model, the information to be predicted can be an image containing a face. When the prediction result of the same dimension is a single dimension, the prediction result can be a face recognition result. When the prediction result of the same dimension has more than one dimension, the prediction result can include face recognition results, gender recognition results, etc. It should also be noted that the labels referred to in this method can also be annotations of a specific range in the image. For example, when the prediction result of the same dimension has more than one dimension, the prediction result can include face recognition results, gender recognition results, face annotation ranges, etc. In one specific implementation scenario, the training samples consist of road images captured by road cameras. Each image is manually labeled with a real label corresponding to four dimensions: road type, number of cars, car color, and car model.
[0047] In operation 1012, multiple teacher models are obtained corresponding to training samples for a single scenario. These teacher models can be trained using training samples that are partially the same as or completely different from the training samples for the single scenario. Specifically, teacher models can be trained using training samples of the same type but not entirely the same content as the training samples for the single scenario. Furthermore, the training samples used to train the teacher models can be labeled with all or part of the labels corresponding to the real labels, enabling the teacher models to fully or partially predict the guidance labels corresponding to the training samples for the single scenario. Specifically, the dimensions of the training labels corresponding to the teacher models are determined based on the strengths of the teacher models. In the specific implementation scenario described above, if the teacher model to be trained is good at predicting road types, then the training samples and corresponding training labels used to train the teacher model can be training samples and training labels corresponding to road types, so that the trained teacher model can accurately predict road types. Similarly, if the teacher model to be trained is good at predicting labels for both the number of cars and car colors, then the training samples and corresponding training labels used to train the teacher model can include these two dimensions, so that the trained teacher model can accurately predict the number of cars and car colors. The strengths of the model can be predetermined based on existing knowledge.
[0048] In Operation 1013, after training the teacher model, each trained model predicts the student training samples used to train the student model to obtain guidance labels for each dimension that the student model needs to predict. In the specific implementation scenario described above, each trained teacher model needs to predict four dimensions: road type, number of cars, car color, and car model, to obtain guidance labels corresponding to these four dimensions.
[0049] Figure 3 This is a schematic diagram illustrating the implementation process of a tag filtering method according to the third embodiment of this application.
[0050] See Figure 3 In one possible implementation, operation 101, obtaining guidance labels corresponding to multiple teacher models, includes: operation 1014, obtaining training samples, the training samples being multiple scene training samples, the multiple scene training samples being labeled with real labels of multiple dimensions; operation 1015, obtaining a teacher model for each of the multiple scenes; each teacher model is used to predict at least one real label of a scene; operation 1016, training the training samples through multiple teacher models to obtain guidance labels of multiple dimensions.
[0051] In operation 1014, the training requirement for the student model is to obtain a student model adaptable to multiple scenarios. Depending on different training needs, this method can obtain guidance labels by executing operations 1011-1013, operations 1014-1016, or a combination of both. It's important to clarify that operations 1011-1013 and 1014-1016 represent two methods of obtaining guidance labels. Operations 1011-1016 are for ease of description and differentiation of the steps; there is no requirement for a specific execution order between them.
[0052] The following explains several scenarios, referring to predicting different types of information to be predicted and obtaining prediction results with the same or different dimensions. Different types of information to be predicted refer to completely unrelated information. For example, when the student model is an image recognition model, the information to be predicted could include images of only vehicles, images of only faces, images of multiple people, pet images, etc. Multiple dimensions refer to the presence of multiple types of labels in the student training sample set, such as face recognition result labels, vehicle color detection labels, pet type detection labels, etc. It's important to clarify that multiple dimensions refer to the fact that all training sample labels have multiple dimensions, while the true label corresponding to a single training sample can contain one or more dimensions. For example, in a specific implementation scenario, the training sample set containing multiple training samples includes vehicle images, face images, and pet images. Pet images are labeled with one or more pet-related labels, vehicle images are labeled with one or more vehicle-related labels, and face images are labeled with one or more face-related labels.
[0053] In operation 1015, based on the features and label features of the information to be predicted in each scene, one or more teacher models with high prediction accuracy in that scene are selected to obtain guidance labels. Similarly, the teacher models are pre-trained teacher models. The selection of one or more teacher models with high prediction accuracy in that scene can be made based on existing knowledge. Furthermore, it can be understood that when the training samples for the same scene correspond to multiple dimensions of real labels, a teacher model proficient in each dimension can be selected to predict the guidance label corresponding to each dimension. In the specific implementation scenario described above, pet images include pet coat color dimension, pet type dimension, and pet size dimension. Therefore, teacher models proficient in predicting pet coat color dimension, pet type dimension, and pet size dimension can be selected to obtain guidance labels.
[0054] In operation 1016, similar to operation 1013, each teacher model makes predictions on the student training samples used to train the student model, and predicts the guidance label for each dimension that the student model needs to predict, so that each teacher model predicts the guidance label for each dimension corresponding to the training sample.
[0055] Figure 4 This is a schematic diagram illustrating the implementation process of a tag filtering method according to the fourth embodiment of this application.
[0056] In one possible implementation, operation 102, filtering the guidance label based on the real label to determine the target label that meets the filtering conditions, includes: operation 1021, comparing the guidance label and the real label to obtain a first comparison value; operation 1022, adjusting the guidance label based on the first comparison value to determine the target label.
[0057] In a specific implementation scenario, this method sets the selection criteria to be associated with a first comparison value between the guided label and the true label. The larger the first comparison value, the greater the difference between the guided label and the true label. This method can determine the difference between the guided label and the true label based on the first comparison value. The smaller the difference, the more accurate the prediction result, meaning the greater the advantage of the teacher model in predicting the training sample. Based on this, it can be understood that this method can determine the target label through the first comparison value. Furthermore, depending on the actual adjustment method, the target label can be the same as or different from the guided label.
[0058] In one possible implementation, operation 1022, adjusting the guidance label based on the first comparison value to determine the target label, includes: firstly, filtering the first comparison values corresponding to the same training sample to determine the first comparison value with the smallest value; then, determining the guidance label corresponding to the first comparison value with the smallest value as the target label.
[0059] In one implementation scenario, the target label is the same as one of the guidance labels. Specifically, first, a first comparison value is determined for each teacher model corresponding to the same training sample. These first comparison values are compared, and the first comparison value with the smallest value is determined. This smallest value is the prediction result with the smallest difference from the true label for that training sample, i.e., the most advantageous guidance label. This guidance label can be directly determined as the target label to provide distillation guidance for the student model when training with that training sample.
[0060] In one possible implementation, operation 1022, adjusting the guidance label based on a first comparison value to determine the target label, includes: first, determining an advantage weight based on the first comparison value corresponding to the same training sample; then, weighting the guidance label according to the advantage weight to obtain the target label.
[0061] In another implementation scenario, the target label and the guidance label are different. Specifically, a first comparison value can be determined for each teacher model and the same training sample. Based on the specific values of these first comparison values, the advantage weights corresponding to the guidance labels are determined. Specifically, the smaller the first comparison value, the better the teacher model is at predicting that training sample, the better its advantage, and the larger its advantage weight. This process determines the advantage weights corresponding to each guidance label. Then, the guidance labels are integrated by multiplication or addition to determine the target label. It should be added that this application can also amplify the target label through the advantage weights. By amplifying the target label, the difference between the target label and the true label during knowledge distillation can be increased, which helps the student model to more closely approximate the teacher model's prediction scheme, thereby further shortening the training time of the student model and improving its prediction accuracy.
[0062] Figure 5 This is a schematic diagram illustrating the implementation process of a tag filtering method according to the fifth embodiment of this application.
[0063] See Figure 5 In one possible implementation, operation 103, which involves distilling the student model according to the target label to obtain an updated student model, includes: operation 1031, training the student model using training samples corresponding to the target label to obtain training labels; operation 1032, determining guidance data based on the target label and training labels; and operation 1033, performing distillation guidance on the student model based on the guidance data to obtain an updated student model.
[0064] The specific method for distilling guidance for the student model using target labels is as follows: First, the student model is trained forward using one of the training samples in the training sample set to obtain training labels. Then, based on this training sample, a guidance label for the corresponding teacher model is determined. By filtering the guidance labels, the corresponding target labels can be identified. Next, the target labels and training labels are integrated based on the ground truth labels to obtain guidance data for backpropagation of the student model. This guidance data guides the student model through backpropagation, updating the model and resulting in an updated student model. This process is repeated for each training sample to update the student model multiple times until it meets the preset prediction accuracy, thus obtaining a satisfactory student model. It is important to understand that the integration method for combining the target labels and training labels based on the ground truth labels can be different.
[0065] In one possible implementation, operation 1032, determining guidance data based on the target label and training label, includes: first, comparing the target label and training label to obtain a second comparison value; then, comparing the target label and the true label to obtain a third comparison value; and finally, integrating the second comparison value and the third comparison value to obtain guidance data.
[0066] In one specific implementation scenario, the integration of target and training labels involves comparing the target label with the training label to obtain the difference between them, i.e., the second comparison value. This second comparison value characterizes the gap between the training label and the target label corresponding to the student model. Then, the target label is compared with the true label to obtain the difference between them, i.e., the third comparison value. This third comparison value also characterizes the gap between the target label and the true label. Finally, the second and third comparison values are integrated to obtain guidance data. This guidance data contains information from both the true and target labels. The student model uses this guidance data for direction propagation, which allows it to obtain information from both the superior teacher model and the true labels. The student model can comprehensively consider these factors to obtain a more advantageous learning target. Therefore, this helps to identify important information that improves the prediction accuracy of the student model, enabling further guidance to help the student model achieve better training results.
[0067] In one possible implementation, operation 1032, determining guidance data based on target label and training label, includes: first, extracting data from the intermediate layer of the teacher model corresponding to the target label to obtain first intermediate data; then, extracting data from the intermediate layer of the student model corresponding to the training label to obtain second intermediate data; next, integrating the first intermediate data and the second intermediate data to determine a fourth comparison value; and then, integrating the fourth comparison value and the second comparison value to obtain a fifth comparison value; wherein the fifth comparison value is used to determine guidance data.
[0068] In another specific implementation scenario, this method can also extract data from the intermediate layers of the teacher model and the student model to further associate the model parameters of the student model and the teacher model, so that the student model can obtain more information related to the superior teacher model and obtain a more comprehensive consideration as the learning object of the student model.
[0069] Specifically, this method extracts intermediate layer data from the superior teacher model. It should be noted that when the target label is determined to be the guidance label with the smallest first comparison value, the superior teacher model is the teacher model corresponding to that target label. When the target label is obtained by comprehensively considering multiple guidance labels and weighting them using a superior weighting method, intermediate layer data corresponding to multiple teacher models can be extracted, and the first intermediate data can be obtained through a corresponding weighted approach.
[0070] This method can extract intermediate layer data from the student model. It should be noted that since the model architectures of the student model and different teacher models are different, and the number of model layers of the student model and different teacher models are also different, this method can pre-define the intermediate layers that need to be extracted for each model so that the extracted intermediate layers can be compared. For example, the same matrix data can be extracted and compared to obtain the second intermediate data.
[0071] The first and second intermediate data are integrated through summation or other integration methods to determine a fourth comparison value. This fourth comparison value characterizes the gap between the student model and the superior teacher model, allowing the student model to acquire this information during training. In one implementation scenario, this method can determine guidance data based on the fourth comparison value data.
[0072] In another implementation scenario, this method can comprehensively consider the target label, training label, and intermediate layer data information. That is, this method can integrate the second comparison value corresponding to the target label and the fourth comparison value corresponding to the intermediate layer data in the above implementation by summing or other methods to obtain a fifth comparison value. Then, the guidance data is determined based on the fifth comparison value.
[0073] It should be added that, depending on the actual situation, this method can also determine the known data by integrating the third and fourth comparison values. It can also determine the guiding data by integrating the second, third, and fourth comparison values. The method for determining the guiding data is the same as in the aforementioned implementation method, and will not be repeated below.
[0074] To facilitate a further understanding of the above implementation methods, several specific implementation scenarios are provided below.
[0075] Figure 6 This is a single-scenario distillation architecture diagram of a label screening method according to the sixth embodiment of this application.
[0076] See Figure 6 In a specific implementation scenario, it is necessary to train a student model that is good at predicting a single scenario.
[0077] First, obtain the training samples corresponding to the single scene, i.e., the single scene data (D1) for distillation training;
[0078] Then, select several pre-trained teacher models that are good at this single scenario, namely teacher model T1, teacher model T2, and teacher model T3. Teacher model T1, teacher model T2, and teacher model T3 are different models.
[0079] Then, the trained teacher models T1, T2, and T3 are used to predict the single scene data (D1) to obtain the guidance label corresponding to the single scene data (D1).
[0080] Next, the guidance label and the real label are guided by the guidance function to determine the corresponding guidance data. The student model S is then trained by distillation based on the single scene data (D1) and the guidance data to obtain a student model that is good at predicting a single scene.
[0081] The guiding function can be a combination of one or more of the following functions.
[0082] The first type of guidance function: guidance is provided by comparing the guidance labels output by the teacher model with the real labels. The comparison value with the loss function corresponding to each real label is calculated, and the comparison value with the smallest value is determined as the guidance data.
[0083] The second type of guidance function: guidance is provided by comparing the guidance labels output by the teacher model with the real labels, integrating the loss values corresponding to all guidance labels, and determining the comparison value as the guidance data by comparing the loss function corresponding to the real label with the integrated loss value corresponding to all guidance labels.
[0084] The third type of guidance function: It uses the intermediate layer data of the teacher model and the intermediate layer data of the student model for guidance, calculates the comparison value of the intermediate layer data of the teacher model and the student model, and integrates the intermediate value with the guidance data obtained by the first type of guidance function to obtain the final guidance data.
[0085] The fourth type of guidance function: It uses the intermediate layer data of the teacher model and the intermediate layer data of the student model to obtain the comparison value of the intermediate layer data of the teacher model and the student model, and integrates the intermediate value with the guidance data obtained by the second type of guidance function to obtain the final guidance data.
[0086] It's important to understand that the guidance function can be selected and adjusted based on the actual scenario. Furthermore, the specific intermediate layer and the number of layers selected can be tailored to different scenarios and models. When comprehensively considering all teacher models, they can be sorted by the quality of the guidance labels output by each teacher model, and then weighted at 70%, 20%, and 10% respectively.
[0087] From the guidance calculation formulas of the intermediate layers and the final output layer of each teacher model, we can see that these formulas fully consider the contributions of each teacher model and also take into account the information of the real labels, thus making the guidance function more comprehensive. Therefore, this effectively distinguishes the importance of each teacher model's accuracy performance across multiple scenarios or within the same scenario, allowing for the effective filtering of information crucial to accuracy, and facilitating subsequent guidance to help student models achieve optimal results.
[0088] Figure 7 This is a multi-scenario distillation architecture diagram of a label screening method according to the seventh embodiment of this application.
[0089] Figure 8 This is a single-scenario distillation flowchart of a label screening method according to the seventh embodiment of this application.
[0090] See Figure 7 and Figure 8 In a specific implementation scenario, it is necessary to train a student model S that is adept at predicting multiple scenarios. This student model S is an improved YOLOv4_tiny model.
[0091] Several scenarios include:
[0092] Application scenario D1 is a face detection scenario, used to detect face-related labels;
[0093] Application scenario D2 is a pedestrian detection scenario, used to detect pedestrian-related tags;
[0094] Application scenario D3 is a head and shoulder detection scenario, used to detect head and shoulder related labels.
[0095] Determine the well-trained teacher model T1, which is good at scene D1, and design it as a YOLOv3 model.
[0096] Determine the well-trained teacher model T2, which is good at scene D2, and design it as a YOLOv4 model;
[0097] We identified a well-trained teacher model T3 that excels in scene D3, which is a YOLOv5 model.
[0098] During the distillation process, training samples corresponding to scenarios D1, D2, and D3 are obtained. Each sample is labeled with the real labels L1, L2, and L3. The training samples of the three scenarios are mixed together without distinction to obtain multi-scenario training samples D1 / D2 / D3.
[0099] The student model is trained using training samples D1 / D2 / D3 from multiple scenarios, and the output result Os of the student model S is obtained.
[0100] The teacher models T1, T2, and T3 predict the outputs Ot1, Qt2, and Qt3 for the current batch of input data D1. These outputs are then compared with the true label L1. Each of these three outputs is compared with the true label L1 using a guidance function. The output corresponding to the smallest comparison value is determined, and this output is used to train the student model against the guidance data corresponding to the training sample. For example, for data D1, the output Qt1 of teacher T1 is closer to the true label L1. Therefore, for training data D1, teacher model T1 is used to distill and train the student model S. Similarly, for scene data D2, teacher model T2, which has higher accuracy for that scene, is used to distill and train the student model S; for scene data D3, teacher model T3, which has higher accuracy for that scene, is used to distill and train the student model S. In this way, by the end of the training, the student model has learned the knowledge points that each of the three teachers excels at, thereby improving its recognition accuracy in multi-task scenarios.
[0101] Figure 9 This is a schematic diagram of the implementation module of a label screening device according to the first embodiment of this application.
[0102] See Figure 9 In another aspect, this application provides a label filtering device, which includes: an obtaining module 901 for obtaining guidance labels corresponding to multiple teacher models, wherein the guidance labels are obtained by the teacher models predicting training samples; a filtering module 902 for filtering the guidance labels according to the real labels to determine the target labels that meet the filtering conditions; and a guidance module 903 for distilling guidance on the student model according to the target labels to obtain an updated student model.
[0103] In one embodiment, the obtaining module 901 includes: an obtaining submodule 9011, used to obtain training samples, wherein the training samples are single-scene training samples and the single-scene training samples are labeled with at least one dimension of real labels; the obtaining submodule 9011 is also used to obtain multiple teacher models for a single scene, wherein different teacher models have different advantages for the training samples; and a first training submodule 9012, used to predict the training samples through multiple teacher models to obtain at least one dimension of guidance labels.
[0104] In one embodiment, the obtaining submodule 9011 is further used to obtain training samples, which are training samples of multiple scenarios, and the training samples of multiple scenarios are labeled with real labels of multiple dimensions; the obtaining submodule 9011 is further used to obtain a teacher model for each of the multiple scenarios; each teacher model is used to predict the real label of at least one dimension in a scenario; the first training submodule 9012 is further used to train the training samples through multiple teacher models to obtain guidance labels of multiple dimensions.
[0105] In one embodiment, the screening module 902 includes: a comparison submodule 9021, used to compare the guidance label and the real label to obtain a first comparison value; and an adjustment submodule 9022, used to adjust the guidance label according to the first comparison value to determine the target label.
[0106] In one possible implementation, the adjustment submodule 9022 includes: filtering first comparison values corresponding to the same training sample to determine the first comparison value with the smallest value; and determining the guidance label corresponding to the first comparison value with the smallest value as the target label.
[0107] In one implementation, the adjustment submodule 9022 includes: determining an advantage weight based on a first comparison value corresponding to the same training sample; and weighting the guide label according to the advantage weight to obtain a target label.
[0108] In one embodiment, the guidance module 903 includes: a second training submodule 9031, used to train the student model using training samples corresponding to the target label to obtain training labels; a determination submodule 9032, used to determine guidance data based on the target label and the training labels; and a distillation submodule 9033, used to distill the guidance data into the student model to obtain an updated student model.
[0109] In one possible implementation, the determining submodule 9032 includes: comparing the target label and the training label to obtain a second comparison value; comparing the target label and the real label to obtain a third comparison value; and integrating the second comparison value and the third comparison value to obtain guidance data.
[0110] In one embodiment, the determining submodule 9032 includes: extracting data from the intermediate layer of the teacher model corresponding to the target label to obtain first intermediate data; extracting data from the intermediate layer of the student model corresponding to the training label to obtain second intermediate data; integrating the first intermediate data and the second intermediate data to determine a fourth comparison value; and integrating the fourth comparison value and the second comparison value to obtain a fifth comparison value; wherein the fifth comparison value is used to determine the guidance data.
[0111] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.
[0112] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0113] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A tag filtering method, the method comprising: Obtain guidance labels corresponding to multiple teacher models. The guidance labels are obtained by the teacher models predicting training samples, where the training samples are image data. Filtering the guidance labels based on real labels to determine target labels that meet the filtering criteria includes: comparing the guidance labels and the real labels to obtain a first comparison value; adjusting the guidance labels based on the first comparison value to determine the target labels; Distillation guidance is applied to the student model based on the target label to obtain an updated student model.
2. The method according to claim 1, wherein obtaining the guidance labels corresponding to the multiple teacher models includes: Obtain training samples, wherein the training samples are single-scene training samples and the single-scene training samples are labeled with at least one dimension of real labels; Multiple teacher models are obtained for a single scenario, wherein different teacher models have different advantages for the training samples; The training samples are predicted using the multiple teacher models to obtain the guidance label for at least one dimension.
3. The method according to claim 1, wherein obtaining the guidance labels corresponding to the multiple teacher models includes: Obtain training samples, which are multiple scene training samples, and the multiple scene training samples are labeled with real labels in multiple dimensions; Obtain a teacher model for each of the multiple scenarios; each teacher model is used to predict the true label for at least one dimension in a scenario. The training samples are predicted using the multiple teacher models to obtain guidance labels in multiple dimensions.
4. The method according to claim 1, wherein adjusting the guidance label based on the first comparison value to determine the target label comprises: The first comparison value corresponding to the same training sample is selected by filtering and the first comparison value with the smallest value is determined. The guide label corresponding to the first comparison value with the smallest value is determined as the target label.
5. The method according to claim 1, wherein adjusting the guidance label based on the first comparison value to determine the target label comprises: The advantage weight is determined based on the first comparison value corresponding to the same training sample; The target label is obtained by weighting the guidance label with the advantage weight.
6. The method according to claim 1, wherein the step of distilling the student model based on the target label to obtain an updated student model comprises: The student model is trained using training samples corresponding to the target label to obtain training labels; The guidance data is determined based on the target label and the training label; The student model is distilled based on the guidance data to obtain an updated student model.
7. The method according to claim 6, wherein determining the guidance data based on the target label and the training label comprises: The target label and the training label are compared to obtain a second comparison value; The target label and the real label are compared to obtain a third comparison value; The second and third comparison values are integrated to obtain guidance data.
8. The method according to claim 7, wherein determining the guidance data based on the target label and the training label comprises: Data is extracted from the intermediate layer of the teacher model corresponding to the target label to obtain the first intermediate data; Data is extracted from the intermediate layer of the student model corresponding to the training labels to obtain the second intermediate data; The first intermediate data and the second intermediate data are integrated to determine the fourth comparison value; The fourth comparison value and the second comparison value are integrated to obtain a fifth comparison value; wherein the fifth comparison value is used to determine the guidance data.
9. A label screening device, the device comprising: The module is used to obtain guidance labels corresponding to multiple teacher models. The guidance labels are obtained by the teacher models predicting training samples, and the training samples are image data. The filtering module is used to filter the guidance tags based on the real tags to determine the target tags that meet the filtering conditions; The filtering module is further configured to compare the guidance label and the real label to obtain a first comparison value; and adjust the guidance label according to the first comparison value to determine the target label; The guidance module is used to perform distillation guidance on the student model based on the target label to obtain an updated student model.
Citation Information
Patent Citations
Method and system for improving model training effect
CN111582500A
Training of student neural network with teacher neural networks
US20200034703A1