Semi-supervised learning optimization method and operation device
By dynamically adjusting the pseudo-label threshold and model capacity, the problems of traditional semi-supervised learning technology in the limited data set and the adaptability of category difficulty are solved, and more efficient model training and recognition accuracy are achieved.
Patent Information
- Application Number
- CN202310851418.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-06-26
- Filing Date
- 2023-07-12
- Publication Date
- 2024-12-27
AI Technical Summary
Traditional semi-supervised learning technology is difficult to effectively utilize label-free data when the data set is limited, and it cannot adapt to the difficulty differences in different categories, resulting in suppression of model performance and being sensitive to hyperparameters, consuming a lot of computing resources. .
The pseudo-labeled threshold and model capacity are dynamically adjusted through machine learning models, the pseudo-labeled threshold is determined based on the confidence scores of the labeled data set and the unlabeled data set, and the model is updated, which is applicable to different categories of difficulty, reduces the initial training time and Improve recognition accuracy.
Effectively utilize labelless data to reduce the initial training time of the model, improve recognition accuracy, reduce dependence on hyperparameters, adapt to the differences in difficulty of different categories, and improve model performance.
Smart Images

Figure CN119204252A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a machine learning technology, and more particularly to an optimization method and computing device for semi-supervised learning. Background Art
[0002] Traditional semi-supervised learning techniques rely on a fixed and high threshold to generate effective pseudo-labels. In practical applications, the number of data sets is often limited. In addition, using a high threshold will waste a large amount of unlabeled data, which not only prolongs the initial training time, but may also inhibit the performance of the final model.
[0003] Traditional semi-supervised learning techniques use the same threshold for all unlabeled data. However, there may be differences in difficulty between multiple categories in the learning task. Different strategies should be adopted for categories of different difficulty. If the same threshold is used, there will be less pseudo-labeled data for the more difficult category, which will indirectly cause the problem of data imbalance and make this category unable to be effectively learned.
[0004] In traditional machine learning technology, continuously increasing the amount of training data helps the model accuracy grow linearly. Assuming that the amount of learnable data of the model is defined as the capacity of the model, after the amount of training data accumulates to a certain amount, the growth of model accuracy will gradually saturate. Even if a large amount of data is collected, the model accuracy cannot be further improved.
[0005] In addition, traditional semi-supervised learning techniques are sensitive to hyperparameters and require fine-tuning of parameters such as pseudo-labeling threshold, data set characteristics, and data set size, which consumes a lot of computing resources. Even poorly selected hyperparameters can easily affect the final accuracy of the model. Summary of the invention
[0006] The present invention provides an optimization method and a computing device for semi-supervised learning, which can dynamically provide appropriate thresholds for different categories and appropriately adjust the capacity of the model.
[0007] The optimization method of semi-supervised learning of the embodiment of the present invention can be applied to labeled data sets and unlabeled data sets. One or more first samples in the labeled data set have been labeled as one of multiple categories, and one or more second samples in the unlabeled data set have not yet been labeled as one of those categories. The optimization method includes (but is not limited to the following steps): determining the first prediction result of the labeled data set and the second prediction result of the unlabeled data set respectively through a machine learning model; determining a pseudo-labeling threshold based on a first confidence score of the first prediction result of the first sample in the labeled data set; and updating the machine learning model based on a comparison result of the second confidence score of the second prediction result of the second sample in the unlabeled data set and the pseudo-labeling threshold.
[0008] The computing device of an embodiment of the present invention can be applied to labeled data sets and unlabeled data sets. One or more first samples in the labeled data set have been labeled as one of multiple categories, and one or more second samples in the unlabeled data set have not yet been labeled as one of those categories. The computing device includes (but is not limited to the following steps) a memory and a processor. The memory stores program code. The processor is coupled to the memory. The processor loads the program code and executes: determining the first prediction result of the labeled data set and the second prediction result of the unlabeled data set respectively through the machine learning model; determining the pseudo-label threshold based on the first confidence score of the first prediction result of the first sample in the labeled data set; and updating the machine learning model based on the comparison result of the second confidence score of the second prediction result of the second sample in the unlabeled data set and the pseudo-label threshold.
[0009] Based on the above, according to the optimization method and computing device of semi-supervised learning of the embodiment of the present invention, the confidence score obtained by predicting the labeled samples can be used to determine the threshold for judging the pseudo-label. In this way, the unlabeled data can be used more efficiently, the initial training time of the model can be reduced, and the recognition accuracy can be improved.
[0010] In order to make the above features and advantages of the present invention more clearly understood, embodiments are given below with reference to the accompanying drawings for detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is a block diagram of components of a computing device according to an embodiment of the present invention.
[0012] Figure 2 is a flow chart of an optimization method for semi-supervised learning according to an embodiment of the present invention.
[0013] Figure 3 is a flow chart of a method for determining a false label threshold according to an embodiment of the present invention.
[0014] FIG. 4A to FIG. 4Dis a schematic diagram of an application scenario according to an embodiment of the present invention.
[0015] Figure 5 It is a flow chart of the whole system according to one embodiment of the present invention.
[0016] Description of reference numerals:
[0017] 10: Computing device
[0018] 11: Memory
[0019] 12: Processor
[0020] S210~S230, S310~S360, S510~S530: Steps
[0021] S 1: First sample
[0022] S2: Second sample
[0023] MLM: Machine Learning Model
[0024] P1: First prediction result
[0025] P2: Second prediction result
[0026] PLB: Pseudo-labeling
[0027] PT: Pseudo-labeling threshold
[0028] LB: Category
[0029] RC: Trust Level Index
[0030] GT: Real Results
[0031] TL: Total loss
[0032] IM: Initial Model
[0033] CM: Compression Model
[0034] S2': updated second sample DETAILED DESCRIPTION
[0035] Figure 1 is a block diagram of components of a computing device 10 according to an embodiment of the present invention. Figure 1 The computing device 10 includes (but is not limited to) a memory 11 and a processor 12. The computing device 10 may be one or more desktop computers, laptop computers, smart phones, tablet computers, wearable devices, servers or other electronic devices.
[0036] The memory 11 may be any type of fixed or removable random access memory (RAM), read only memory (ROM), flash memory, hard disk drive (HDD), solid-state drive (SSD) or similar element. In one embodiment, the memory 11 is used to store program code, software modules, configurations, data or files (e.g., data sets, model parameters, or pseudo-labeling thresholds), and will be described in detail in subsequent embodiments.
[0037] The processor 12 is coupled to the memory 11. The processor 12 may be a central processing unit (CPU), a graphics processing unit (GPU), or other programmable general-purpose or special-purpose microprocessor, a digital signal processor (DSP), a programmable controller, a field programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a neural network accelerator, or other similar elements or a combination of the above elements. In one embodiment, the processor 12 is used to execute all or part of the operations of the computing device 10, and can load and execute various program codes, software modules, files, and data stored in the memory 11.
[0038] Hereinafter, the method described in the embodiment of the present invention will be described with various devices, elements and modules in the computing device 10. Each process of the method can be adjusted according to the implementation situation, and is not limited thereto.
[0039] Figure 2It is a flow chart of an optimization method for semi-supervised learning according to an embodiment of the present invention. The processor 12 determines the first prediction result of the labeled data set and the second prediction result of the unlabeled data set respectively through the machine learning model (step S210). Specifically, one or more first samples in the labeled data set have been marked as one of multiple categories. That is, the labeled data set includes one or more first samples, and each first sample can be marked by a classifier or user operation so that each first sample has a corresponding category. According to different design requirements, the first / second sample can be an image or a sound. In addition, the category is, for example, the type of object, the name of a person, or identification information. On the other hand, one or more second samples in the unlabeled data set have not yet been marked as one of those categories. That is, the unlabeled data set includes one or more second samples, and each second sample has not yet been marked by a classifier or user operation, so that each second sample does not yet have a corresponding category.
[0040] A machine learning model refers to a model based on a machine learning algorithm (e.g., Convolutional Neural Network (CNN), Long Short-Term Memory (LSTM), Generative Adversarial Network (GAN), ResNet, VGG, or MobileNet-v2). A machine learning algorithm can analyze the relationship between training samples (e.g., data sets) and corresponding labels (e.g., a certain category) or real results to obtain rules from them, thereby predicting unknown data through rules. The machine learning model can be used to infer the evaluation data (e.g., the first sample and / or the second sample) to generate a prediction result. This prediction result is one or more categories and their confidence scores. The confidence score reflects the confidence of the machine learning model in the predicted category and / or the accuracy of the prediction. If the confidence score of a category is higher, it means that there is a higher confidence that the prediction of this category is correct. If the confidence score of a category is lower, it means that there is a lower confidence that the prediction of this category is correct.
[0041] Figure 3 is a flow chart of a method for determining a false label threshold according to an embodiment of the present invention. Figure 3 , the first prediction result P1 is the category and its (first) confidence score obtained by the machine learning model MLM for predicting the first sample S1 (step S310). The second prediction result P2 is the category and its (second) confidence score obtained by the machine learning model MLM for predicting the second sample S2 (step S310). That is, each category predicted for each first sample S1 / second sample S2 corresponds to its confidence score.
[0042] It should be noted that this machine learning model can be used for image recognition / classification, object detection, semantic analysis or other inferences, and the embodiments of the present invention do not limit its use. In an application scenario, the machine learning model used for the initial training is an initial model that has not been trained. In some application scenarios, the machine learning model used for initial training or subsequent training is a pre-trained model that has been trained, and the pre-trained model that has been trained may meet the preset accuracy standard.
[0043] Please refer to Figure 2 , the processor 12 determines the pseudo-label threshold value based on the first confidence score of the first prediction result of one or more first samples in the labeled data set (step S220). Specifically, in order to avoid artificially adjusting the hyperparameters, the threshold value required for screening pseudo-labels (referred to as the pseudo-label threshold value in the context) can be dynamically adjusted according to the immediate learning state of the machine learning model. In general, for each (first / second) sample, the category corresponding to the highest score in the (first / second) confidence score in the (first / second) prediction result can be selected as such a label. The label for the second sample can be called a pseudo-label. This pseudo-label also needs to be compared with the pseudo-label threshold value. In response to the pseudo-label not being less than the pseudo-label threshold value, the processor 12 can regard the pseudo-label as valid and can use the pseudo-label for subsequent training or other application requirements. On the other hand, in response to the pseudo-label being less than the pseudo-label threshold value, the processor 12 can regard the pseudo-label as invalid and prohibit the use of the pseudo-label for subsequent training or other application requirements (for example, directly ignoring or deleting the pseudo-label).
[0044] Since the actual result of the first sample is known (i.e., it has been marked as one of the multiple categories), the learning state of the machine learning model can be known from the difference between the first predicted result and the actual result. If there is no difference between the first predicted result and the actual result or the difference is smaller, the learning state of the machine learning model is better (which may represent a higher prediction accuracy). If the difference between the first predicted result and the actual result is larger, the learning state of the machine learning model is worse (which may represent a lower prediction accuracy).
[0045] In one embodiment, the processor 12 may select one of the first confidence scores of the first prediction results of one or more first samples as the pseudo-label threshold. In other words, the pseudo-label threshold is the first confidence score of a certain category predicted by the machine learning model for a certain first sample. For example, if the first confidence scores of a certain category are 0.4, 0.5, and 0.6, the pseudo-label threshold may be 0.6.
[0046] In one embodiment, the plurality of categories include the first category. The processor 12 may select the highest score among the second confidence scores of the second prediction results of the second sample, and the highest score corresponds to the first category. Figure 3For example, the second confidence scores of the three categories predicted for a second sample are 0.8, 0.7, and 0.6 respectively. The processor 12 takes the maximum value 0.8 (i.e., the highest score among 0.8, 0.7, and 0.6) (step S320), and uses the first category with the maximum value as the pseudo label PLB of the second sample.
[0047] In addition, the processor 12 can select one of the first confidence scores corresponding to the first category from the first prediction result of the first sample marked as the first category as the pseudo-labeling threshold for comparing the first category in the second sample. For example, the first confidence scores of the first category are 0.9, 0.5, and 0.4, respectively. The processor 12 selects 0.9 (i.e., the highest of 0.9, 0.5, and 0.4) as the pseudo-labeling threshold. It should be noted that some categories may require more training to achieve a predetermined accuracy rate (which can be called a higher training difficulty). Therefore, selecting pseudo-labeling thresholds for different categories can help avoid or reduce the problem of data imbalance caused by the original use of the same threshold for all categories, thereby improving the recognition accuracy of each category.
[0048] In one embodiment, the processor 12 may add the first confidence score corresponding to the first category in the first prediction result of the first sample that has been marked as the first category to the first score table (or first score list). Since there may be multiple first samples in the current training that have been marked as the first category in advance (that is, these first samples have been marked before the machine learning model obtains the first prediction result, and this mark can be regarded as the true result of these first samples), the first confidence scores corresponding to the first category of these first samples are the reference basis for selecting the pseudo-label threshold corresponding to the first category. Figure 3 For example, the processor 12 may select a first score corresponding to the true result GT (a certain category) from the first prediction result of the first sample, add the selected first score to the first score table, and generate or update the score table accordingly (step S330). In addition, the processor 12 may prohibit adding other first confidence scores whose true results are not of the first type to the score table.
[0049] In one embodiment, the processor 12 may define the capacity of the first score table. This capacity represents the number of first confidence scores allowed to be stored. For example, 3, 5 or 10 first confidence scores. In response to the number of first confidence scores of one or more first samples added to the first score table being greater than this capacity, the processor 12 may delete part of the first confidence scores of one or more first samples in the first score table according to the order in which they are added to the first score table. In order to reflect the latest or newer learning state of the machine learning model, those first confidence scores added to the first score table earlier may be appropriately deleted. The processor 12 may sort those confidence scores in the first score table according to the time or training sequence number added to the first score table to generate the order added to the first score table. Then, the processor 12 may give priority to deleting those first confidence scores added to the first score table earlier or deleting those first confidence scores with lower training sequence numbers, and give priority to retaining those first confidence scores added to the first score table later or retaining those first confidence scores with higher training sequence numbers. That is to say, the first score table will be designed in a first-in, first-out (FIFO) format, retaining only the latest / newer labeled scores output by the machine learning model and discarding the older first confidence scores.
[0050] In one embodiment, the processor 12 may sort the first confidence scores of one or more first samples in the first score table according to the score size. For example, if the first confidence scores are 0.5, 0.4, and 0.7, then sorting these first confidence scores from large to small (i.e., in descending order) may yield 0.7, 0.5, and 0.4.
[0051] Next, the processor 12 may select a first confidence score from the first score table according to the confidence level indicator (or recall value) as the pseudo-labeling threshold of the first category. The confidence level indicator is, for example, 85, 90, or 95%, but is not limited thereto. The processor 12 finds the first confidence score corresponding to the percentage point or ranking of the confidence level indicator in the first score table as the pseudo-labeling threshold. Figure 3 For example, if the first confidence scores in the first confidence score table of the pseudo label PLB (eg, the first category) are 0.5, 0.65, 0.67, 0.8, 0.85 and the confidence level indicator RC is 90%, 0.85 will be used to update the (new) pseudo label threshold (step S340).
[0052] Alternatively, the processor 12 may select the highest first confidence score from the first score table of pseudo-labels PLB (e.g., the first category) as the pseudo-label threshold of the first category. For example, if the first confidence scores in the first confidence score table are 0.5, 0.4, and 0.7, 0.7 will be used to update the (new) pseudo-label threshold (step S340).
[0053] It should be noted that in other application scenarios, multiple categories may also include a second category, a third category or other categories. The determination of the pseudo-labeling thresholds for other categories and / or the updating of the corresponding score table can refer to the aforementioned description for the first category and will not be repeated here.
[0054] Please refer to Figure 2 , the processor 12 updates the machine learning model according to the comparison result of the second confidence score of the second prediction result of the second sample in the unlabeled data set and the pseudo-label threshold (step S230). Specifically, the pseudo-label threshold is a threshold used to confirm whether the pseudo-label is effective. Figure 3 For example, the second prediction result P2 of a second sample S2 includes multiple categories and their second confidence scores. The processor 12 only selects the category with the highest second confidence score among these categories and compares the second confidence score of the selected category (i.e., the highest score) with the pseudo-label threshold PT (corresponding to this category).
[0055] In one embodiment, the processor 12 may prohibit the use of one or more second samples (the comparison result is that) the highest score in its second confidence score is less than the pseudo-label threshold and / or their corresponding second prediction results for updating the machine learning model. Specifically, the difference (loss) between the second prediction result output by the machine learning model and the pseudo-label of the second sample can be used to evaluate the learning state of the machine learning model and can be used to update / correct the parameters (e.g., weights or functions) of the machine learning model. However, if the highest score in the second confidence scores corresponding to multiple categories of a second sample is less than the pseudo-label threshold, the second sample can be regarded as a sample that is not helpful for training, and the difference between its second prediction result and the corresponding pseudo-label can be ignored / prohibited.
[0056] On the other hand, the processor 12 may allow one or more second samples (the comparison result is that) the highest score among the second confidence scores is not less than the pseudo-label threshold and / or their corresponding second prediction results to be used to update the machine learning model. If the highest score among the second confidence scores corresponding to a second sample of multiple categories is equal to or greater than the pseudo-label threshold, then the second sample may be regarded as a sample that is helpful for training, and the difference between its second prediction result and the corresponding pseudo-label may be further determined.
[0057] In one embodiment, for the second sample whose highest score among the second confidence scores is not less than the corresponding pseudo-label threshold, the processor 12 may establish a loss function according to the second confidence scores corresponding to the multiple categories in the second prediction result of the second sample and the label corresponding to the highest score (i.e., pseudo-label). The loss function may be a cross-entropy, mean squared error (MSE), root mean squared error (RMSE), or other error functions. These loss functions are derived based on the error between the prediction result and the pseudo-label. Figure 3 For example, if the second confidence score of a pseudo-label PLB is greater than or equal to the pseudo-label threshold PT, the processor 12 can use the difference between the pseudo-label PLB whose second confidence score is greater than or equal to the pseudo-label threshold PT and the prediction result of the second sample S2 to establish a loss function and obtain the unlabeled loss (i.e., the value obtained by the loss function) (step S350). Depending on the type of different loss functions, other categories and their second confidence scores can also be used to establish a loss function. Taking the cross entropy and three categories as an example, the second confidence scores and pseudo-labels of the three categories can be used to compare and establish a cross entropy function.
[0058] Then, the processor 12 may update the machine learning model according to the loss function. For example, the processor 12 may use the value obtained by the loss function to correct / update the machine learning model through algorithms such as gradient descent or other parameter optimization.
[0059] In one embodiment, the processor 12 may establish another loss function according to the first confidence scores corresponding to the multiple categories in the first prediction result of each first sample and the marked categories. The state and function of the loss function can be referred to the above description and will not be repeated here. Figure 3 For example, the processor 12 can use the difference between the first confidence scores of the first prediction result P1 of the first sample S1 corresponding to the first categories and the actual result of the first sample S1 (i.e., the labeled category LB) to establish a loss function and obtain the labeled loss (i.e., the value obtained by the loss function) (step S360). In one embodiment, the processor 12 can further add up the unlabeled loss and the labeled loss to obtain the total loss TL (i.e., the sum of the values obtained by the two loss functions). This total loss TL can be further used to update the machine learning model MLM.
[0060] Then, the processor 12 may update the machine learning model according to the other loss function. For example, the processor 12 may use the value obtained by the other loss function to correct / update the machine learning model through an algorithm such as a gradient descent method or other parameter optimization algorithms.
[0061] The following is an application scenario for illustration. However, the numerical values in the application scenario are only for illustration purposes.
[0062] FIG. 4A to FIG. 4D is a schematic diagram of an application scenario according to an embodiment of the present invention. Figure 4A In the first training, the labeled data set includes three first samples that are respectively labeled as categories A, B, and C (true results), and the unlabeled data set includes three unlabeled second samples. The first prediction result Out of the machine learning model MLM for the three first samples L The first confidence scores corresponding to the three categories A, B, and C are (0.53, 0.26, 0.21), (0.43, 0.36, 0.21), and (0.36, 0.33, 0.31). Therefore, the score tables Score_listA, Score_listB, and Score_listC corresponding to categories A, B, and C are 0.53 in (0.53, 0.26, 0.21) corresponding to category A, 0.36 in (0.43, 0.36, 0.21) corresponding to category B, and 0.31 in (0.36, 0.33, 0.31) corresponding to category C. In addition, since there is only one first confidence score in each score table, the first confidence score in each score table is used as the pseudo-label threshold of the corresponding category.
[0063] On the other hand, the second prediction result of the machine learning model MLM for the three second samples is Out U The second confidence scores corresponding to the three categories A, B, and C are (0.51, 0.27, 0.22), (0.41, 0.37, 0.22), and (0.34, 0.33, 0.33). For each second sample, the category corresponding to the highest score (i.e., the maximum value) is the pseudo-label. For example, (0.51, 0.27, 0.22) corresponds to category A of 0.51, (0.41, 0.37, 0.22) corresponds to category A of 0.41, and (0.34, 0.33, 0.33) corresponds to category A of 0.34. The second confidence scores of these pseudo-labels are compared with the pseudo-label threshold corresponding to category A (i.e., 0.53). Since these second confidence scores are all less than the pseudo-label threshold, the unlabeled loss Loss U is 0, and these second confidence scores are not used to update the machine learning model MLM. The first confidence scores and the corresponding true results can be used to determine the labeling loss Loss through cross entropy L .
[0064] Please refer to Figure 4BIn the second training, the labeled data set includes three first samples that are respectively labeled as categories A, B, and C (true results), and the unlabeled data set includes three unlabeled second samples. The first prediction results Out of the machine learning model MLM for the three first samples L The first confidence scores corresponding to the three categories A, B, and C are (0.59, 0.20, 0.21), (0.36, 0.43, 0.21), and (0.31, 0.33, 0.36). Therefore, 0.59 corresponding to category A in (0.59, 0.20, 0.21), 0.43 corresponding to category B in (0.36, 0.43, 0.21), and 0.36 corresponding to category C in (0.31, 0.33, 0.36) are added to the score tables Score_listA, Score_listB, and Score_listC corresponding to categories A, B, and C, respectively. In addition, assuming that the confidence level index is 90%, the pseudo-label thresholds corresponding to categories A, B, and C are 0.53, 0.36, and 0.31.
[0065] On the other hand, the second prediction result of the machine learning model MLM for the three second samples is Out U The second confidence scores corresponding to the three categories A, B, and C are (0.61, 0.27, 0.12), (0.36, 0.42, 0.22), and (0.39, 0.25, 0.36). For each second sample, the category corresponding to its highest score (i.e., the maximum value) is the pseudo-label. For example, (0.61, 0.27, 0.12) corresponds to category A with 0.61, (0.36, 0.42, 0.22) corresponds to category B with 0.42, and (0.39, 0.25, 0.36) corresponds to category A with 0.39. The second confidence scores of these pseudo-labels are compared with the pseudo-label thresholds corresponding to categories A and B (i.e., 0.53 and 0.36, respectively). Some of the second confidence scores are greater than the pseudo-label thresholds, so the unlabeled loss Loss U The cross entropy based on the pseudo label and the second confidence score corresponding to the category A and B can be used to obtain and update the machine learning model MLM accordingly. Similarly, the first confidence score and the corresponding true result can be used to determine the label loss Loss through the cross entropy L .
[0066] Please refer to Figure 4C In the third training, the labeled data set includes three first samples that are respectively labeled as categories A, B, and C (true results), and the unlabeled data set includes three unlabeled second samples. The first prediction result Out of the machine learning model MLM for the three first samples LThe first confidence scores corresponding to the three categories A, B, and C are (0.65, 0.20, 0.15), (0.32, 0.47, 0.21), and (0.31, 0.31, 0.38). Therefore, 0.65 of (0.65, 0.20, 0.15) corresponding to category A, 0.47 of (0.32, 0.47, 0.21) corresponding to category B, and 0.38 of (0.31, 0.31, 0.38) corresponding to category C are added to the score tables Score_listA, Score_listB, and Score_listC corresponding to categories A, B, and C, respectively. In addition, assuming that the confidence level index is 90%, the pseudo-label thresholds corresponding to categories A, B, and C are 0.59, 0.43, and 0.36.
[0067] On the other hand, the second prediction result of the machine learning model MLM for the three second samples is Out U The second confidence scores corresponding to the three categories A, B, and C are (0.64, 0.24, 0.12), (0.22, 0.36, 0.42), and (0.20, 0.44, 0.36). For each second sample, the category corresponding to its highest score (i.e., the maximum value) is the pseudo-label. For example, (0.64, 0.24, 0.12) corresponds to category A with 0.64, (0.22, 0.36, 0.42) corresponds to category C with 0.42, and (0.20, 0.44, 0.36) corresponds to category B with 0.44. The second confidence scores of these pseudo-labels are compared with the pseudo-label thresholds corresponding to categories A, C, and B (i.e., 0.59, 0.36, and 0.43, respectively). All the second confidence scores are greater than the pseudo-label threshold, so the unlabeled loss Loss U The cross entropy based on the pseudo-label and the second confidence score corresponding to the categories A, B, and C can be used to obtain and update the machine learning model MLM accordingly. Similarly, the first confidence score and the corresponding true result can be used to determine the label loss Loss through the cross entropy L .
[0068] Please refer to Figure 4D In the fourth training, the labeled data set includes three first samples that are respectively labeled as categories A, B, and C (true results), and the unlabeled data set includes three unlabeled second samples. The first prediction results Out of the machine learning model MLM for the three first samples LThe first confidence scores corresponding to the three categories A, B, and C are (0.75, 0.10, 0.15), (0.22, 0.57, 0.21), and (0.31, 0.21, 0.48). Therefore, 0.75 of (0.75, 0.10, 0.15) corresponding to category A, 0.57 of (0.22, 0.57, 0.21) corresponding to category B, and 0.48 of (0.31, 0.21, 0.48) corresponding to category C are added to the score tables Score_listA, Score_listB, and Score_listC corresponding to categories A, B, and C, respectively. Assuming that the capacity of the score tables Score_listA, Score_listB, and Score_listC is 3, each Score_listA, Score_listB, and Score_listC only retains the last three first confidence scores. In addition, assuming that the confidence level index is 90%, the pseudo-labeling thresholds corresponding to categories A, B, and C are 0.65, 0.47, and 0.38.
[0069] On the other hand, the second prediction result of the machine learning model MLM for the three second samples is Out U The second confidence scores corresponding to the three categories A, B, and C are (0.74, 0.14, 0.12), (0.22, 0.56, 0.22), and (0.20, 0.34, 0.46). For each second sample, the category corresponding to its highest score (i.e., the maximum value) is the pseudo-label. For example, (0.74, 0.14, 0.12) corresponds to category A with 0.74, (0.22, 0.56, 0.22) corresponds to category B with 0.56, and (0.20, 0.34, 0.46) corresponds to category C with 0.46. The second confidence scores of these pseudo-labels are compared with the pseudo-label thresholds corresponding to categories A, B, and C (i.e., 0.65, 0.47, and 0.38, respectively). All the second confidence scores are greater than the pseudo-label threshold, so the unlabeled loss Loss U The cross entropy based on the pseudo-label and the second confidence score corresponding to the categories A, B, and C can be used to obtain and update the machine learning model MLM accordingly. Similarly, the first confidence score and the corresponding true result can be used to determine the label loss Loss through the cross entropy L .
[0070] Figure 5 This is a flow chart of the overall system according to an embodiment of the present invention. Figure 5In the first training, the processor 12 can perform semi-supervised learning on the first sample S1 and the second sample S2 through the initial model IM (i.e., the initial machine learning model) (step S510). The first sample S1 has been marked as one of the multiple categories, and the second sample S2 has not been marked as one of the multiple categories. The detailed steps of semi-supervised learning can be referred to the aforementioned Figures 2 to 4D The first prediction result of the first sample S1 and the second prediction result of the second sample S2 can be used to update the machine learning model MLM.
[0071] In one embodiment, for model compression or lightweighting (step S520), the processor 12 may prune the machine learning model MLM (step S521) and remove one or more redundant neurons in the updated machine learning model MLM. The pruning judgment criterion is: the larger the absolute value of the weight value of the neuron, the more important the neuron is considered to be; the smaller the absolute value of the weight value of the neuron, the less important the neuron is considered to be and the more redundant the neuron is. The pruning steps are: for the trained machine learning model MLM, the processor 12 may take the absolute value of the weight value of the neurons in each layer and sort the absolute values of these weight values from small to large. The processor 12 may remove neurons with smaller weight values (e.g., 50% of smaller weight values) according to the pruning ratio (e.g., it is desired to reduce the weight by 50%).
[0072] For example, the original weight values are 3.27, -1.15, 0.22, -6.17, 1.03, -4.31, 0.16, -0.29, 0.56, and their absolute values are 3.27, 1.15, 0.22, 6.17, 1.03, 4.31, 0.16, 0.29, 0.56. Sorting these absolute values from small to large is 6.17, 4.31, 3.27, 1.15, 1.03, 0.56, 0.29, 0.22, 0.16. Suppose 0.29, 0.22, 0.16 are removed, and the remaining weight values are retained.
[0073] It should be noted that the pruning algorithm can also be channel, weight, filter, excitation, gradient, hidden layer pruning or pruning search method.
[0074] In one embodiment, the processor 12 may adjust the weights corresponding to other neurons other than the redundant neurons in the updated machine learning model (step S522). Specifically, after each pruning, the processor 12 may retrain the pruned machine learning model MLM. For example, the processor 12 may initialize the weight values of the remaining other neurons back to the parameters of the initial model IM, and then retrain the pruned machine learning model MLM to generate a compressed model CM.
[0075] Next, the processor 12 can obtain the second prediction result of the second sample S2 through the compression model CM, and use the category corresponding to the highest score in the second prediction result of each second sample S2 as a pseudo label, so that the second sample S2 is labeled and becomes an updated second sample S2'. This updated second sample S2' can be regarded as a labeled sample and can be further used for supervised learning.
[0076] In one embodiment, the processor 12 may increase the parameter capacity of the machine learning model MLM (step S530). This parameter capacity is the number of parameter inputs for the machine learning model MLM. For example, the dimension of the filter of the convolutional layer (i.e., the parameter of the machine learning model MLM) is x*y*c (all positive integers), and the c direction / dimension can be regarded as the number of filters. Increasing the model width means enlarging it in the c direction to n*c (n is a positive integer). Not only the number of input parameters of this layer (i.e., the first sample or the second sample input) can be increased, but also the number of output feature maps (output feature maps) generated by this layer can be increased. Therefore, the parameter capacity is increased by enlarging the c direction.
[0077] In summary, the optimization method and computing device for semi-supervised learning of the embodiment of the present invention include the following features:
[0078] Dynamically adjust the pseudo-label threshold: Dynamically adjust the pseudo-label threshold based on the current learning state of the machine learning model. In the early stages of model learning, use a lower pseudo-label threshold to obtain more pseudo-label data to quickly train the model to reach basic recognition capabilities. In the middle and late stages of model learning, adjust the label threshold to a higher value to obtain more accurate pseudo-labels, thereby further improving the model's recognition capabilities.
[0079] Formulate appropriate pseudo-label thresholds according to categories: adjust the pseudo-label thresholds for each category according to the current learning status of the model for each category. For more difficult categories (for example, more learning times are required to achieve the predetermined recognition ability), use a lower pseudo-label threshold to obtain more pseudo-label data than before to strengthen the learning of this category; for simpler categories (for example, fewer learning times can achieve the predetermined recognition ability), use a higher pseudo-label threshold to obtain more accurate pseudo-labels to further improve the model's recognition ability for this category.
[0080] Increase model capacity: After a machine learning model uses a certain amount of training data, the model capacity will gradually become saturated and the accuracy growth will begin to slow down. By increasing the width of the model to increase the model's parameter capacity, the extent of model capacity saturation can be slowed down and a large amount of data can be effectively used to improve model accuracy.
[0081] Model compression: In some application scenarios, increasing the model capacity by enlarging the model width will cause a significant increase in model parameters, which in turn affects the speed at which the model runs on edge devices. Therefore, model pruning technology can be used to remove a large number of redundant neurons in the model and fine-tune the remaining neurons so that the model is composed of only important neurons and the growth of model parameters can be slowed down.
[0082] Although the present invention has been disclosed as above by way of embodiments, it is not intended to limit the present invention. Any person skilled in the art may make some changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the appended claims.
Claims
1. A semi-supervised learning optimization method, applicable to a labeled data set and an unlabeled data set, wherein at least one first sample in the labeled data set has been labeled as one of a plurality of categories, and at least one second sample in the unlabeled data set has not been labeled as one of the plurality of categories, and the optimization method comprises: Determine a first prediction result of the labeled data set and a second prediction result of the unlabeled data set respectively by a machine learning model; Determining a pseudo-labeling threshold according to a first confidence score of the first prediction result of the at least one first sample in the labeled data set; as well as The machine learning model is updated according to a comparison result between a second confidence score of the second prediction result of the at least one second sample in the unlabeled data set and the pseudo-label threshold.
2. The optimization method for semi-supervised learning according to claim 1, wherein the step of determining the pseudo-labeling threshold according to the first confidence score of the first prediction result of the at least one first sample in the labeled data set comprises: One of the first confidence scores of the first prediction result of the at least one first sample is selected as the false labeling threshold.
3. The optimization method for semi-supervised learning according to claim 2, wherein the plurality of categories include a first category, and the step of selecting one from the first confidence score of the first prediction result of the at least one first sample as the pseudo-labeling threshold comprises: Selecting a highest score among the second confidence scores of the second prediction result of the second sample, wherein the highest score corresponds to the first category; as well as One of the first confidence scores corresponding to the first category in the first prediction result of at least one of the first samples labeled as the first category is selected as the pseudo-labeling threshold for comparing the first category in the second sample.
4. The optimization method for semi-supervised learning according to claim 3, wherein the step of selecting one of the first confidence scores corresponding to the first category in the first prediction result of the at least one first sample labeled as the first category as the pseudo-labeling threshold for comparing the first category in the second sample comprises: Adding the first confidence score corresponding to the first category in the first prediction result of the at least one first sample marked as the first category to a first score table; Sort the first confidence scores of the at least one first sample in the first score table according to the scores; as well as The first confidence score is selected from the first score table according to the trust level indicator, or the highest of the first confidence scores is selected from the first score table as the pseudo-label threshold.
5. The optimization method for semi-supervised learning according to claim 4, further comprising: defining the capacity of the first score table; as well as In response to the number of the first confidence scores of the at least one first sample added to the first score table being greater than the capacity, a portion of the first confidence scores of the at least one first sample in the first score table is deleted according to the order of addition to the first score table.
6. The optimization method for semi-supervised learning according to claim 1, wherein the step of updating the machine learning model according to the comparison result of the second confidence score of the second prediction result of the at least one second sample in the unlabeled data set and the pseudo-label threshold comprises: It is prohibited to use at least one of the second samples whose highest score among the second confidence scores is less than the pseudo-label threshold or the second prediction result corresponding thereto for updating the machine learning model; as well as At least one of the second samples whose highest score among the second confidence scores is not less than the pseudo-label threshold or the corresponding second prediction result is allowed to be used to update the machine learning model.
7. The optimization method for semi-supervised learning according to claim 6, wherein the step of allowing the second prediction result whose highest score among the second confidence scores is not less than the pseudo-label threshold to be used for updating the machine learning model comprises: Establishing a loss function according to the second confidence scores corresponding to the plurality of categories and the label corresponding to the highest score in the second prediction result of the second sample; as well as The machine learning model is updated according to the loss function.
8. The optimization method for semi-supervised learning according to claim 7, further comprising: Establishing another loss function according to the first confidence scores corresponding to the plurality of categories and the labeled category in the first prediction result of each of the first samples; and The machine learning model is updated according to the other loss function.
9. The optimization method for semi-supervised learning according to claim 1, further comprising: removing at least one redundant neuron in the updated machine learning model; as well as Adjust the weights corresponding to other neurons other than the at least one redundant neuron in the updated machine learning model.
10. The optimization method for semi-supervised learning according to claim 1, further comprising: Increase the parameter capacity of the machine learning model, where the parameter capacity is the number of parameter inputs for the machine learning model.
11. A computing device, applicable to a labeled data set and an unlabeled data set, wherein at least one first sample in the labeled data set has been labeled as one of a plurality of categories, and at least one second sample in the unlabeled data set has not been labeled as one of the plurality of categories, and the computing device comprises: Memory, storing program codes; as well as A processor is coupled to the memory and loads the program code to execute: Determine a first prediction result of the labeled data set and a second prediction result of the unlabeled data set respectively by a machine learning model; Determining a pseudo-labeling threshold according to a first confidence score of the first prediction result of the at least one first sample in the labeled data set; as well as The machine learning model is updated according to a comparison result between a second confidence score of the second prediction result of the at least one second sample in the unlabeled data set and the pseudo-label threshold.
12. The computing device according to claim 11, wherein the processor further executes: One of the first confidence scores of the first prediction result of the at least one first sample is selected as the false labeling threshold.
13. The computing device of claim 12, wherein the plurality of categories include a first category, and the processor further executes: Selecting a highest score among the second confidence scores of the second prediction result of the second sample, wherein the highest score corresponds to the first category; and One of the first confidence scores corresponding to the first category in the first prediction result of at least one of the first samples labeled as the first category is selected as the pseudo-labeling threshold for comparing the first category in the second sample.
14. The computing device according to claim 13, wherein the processor further executes: Adding the first confidence score corresponding to the first category in the first prediction result of the at least one first sample marked as the first category to a first score table; sorting the first confidence scores of the at least one first sample in the first score table according to the scores; and The first confidence score is selected from the first score table according to the trust level indicator, or the highest of the first confidence scores is selected from the first score table as the pseudo-label threshold.
15. The computing device according to claim 14, wherein the processor further executes: defining a capacity of the first score table; and In response to the number of the first confidence scores of the at least one first sample added to the first score table being greater than the capacity, a portion of the first confidence scores of the at least one first sample in the first score table is deleted according to the order of addition to the first score table.
16. The computing device according to claim 11, wherein the processor further executes: prohibiting at least one of the second samples whose highest score among the second confidence scores is less than the pseudo-label threshold or the second prediction result corresponding thereto from being used to update the machine learning model; and At least one of the second samples whose highest score among the second confidence scores is not less than the pseudo-label threshold or the corresponding second prediction result is allowed to be used to update the machine learning model.
17. The computing device according to claim 16, wherein the processor further executes: Establishing a loss function according to the second confidence scores corresponding to the plurality of categories and the category corresponding to the highest score in the second prediction result of the second sample; and The machine learning model is updated according to the loss function.
18. The computing device according to claim 17, wherein the processor further executes: Establishing another loss function according to the first confidence scores corresponding to the plurality of categories and the labeled category in the first prediction result of each of the first samples; and The machine learning model is updated according to the other loss function.
19. The computing device according to claim 11, wherein the processor further executes: removing at least one redundant neuron in the updated machine learning model; and Adjust the weights corresponding to other neurons other than the at least one redundant neuron in the updated machine learning model.
20. The computing device according to claim 11, wherein the processor further executes: Increase the parameter capacity of the machine learning model, where the parameter capacity is the number of parameter inputs for the machine learning model.
