A training method, image processing method and device for a semi-supervised learning model

By adjusting the training set with one-bit annotation in the semi-supervised learning model and updating the model, the problem of high requirements for the number of labeled data in the prior art is solved, which improves the prediction accuracy of the model and reduces the labeling pressure.

CN112183577BActive Publication Date: 2025-03-25HUAWEI TECH CO LTD

Patent Information

Application Number
CN202010899716.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-31
Publication Date
2025-03-25
Estimated Expiration
2040-08-31

AI Technical Summary

Technical Problem

The existing semi-supervised learning model has requirements for the number of labeled data, and there is a lot of room for improvement in prediction accuracy, so it is difficult to train a model with high prediction accuracy under a small amount of labeled data.

Method used

The first half-supervised learning model after training predicts the label-free sample, obtains the prediction label, and adjusts the training set through one-bit annotation, and updates the initial semisupervised learning model, thereby improving the prediction accuracy of the model in the next training stage.

Benefits of technology

The prediction accuracy of the semi-supervised learning model is improved, the dependence on the number of labeled data is reduced, and the pressure of manual labeling is alleviated.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112183577B_ABST
    Figure CN112183577B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a training method, an image processing method and a device for a semi-supervised learning model, which can be applied to the computer vision field in the field of artificial intelligence. The method comprises: firstly, predicting the classification categories of a part of unlabeled samples through the trained first semi-supervised learning model to obtain predicted labels, and judging whether each predicted label is correct through a one-bit labeling method. If the prediction is correct, the correct label of the sample (i.e., the positive label) is obtained, otherwise, an incorrect label of the sample (i.e., the negative label) can be excluded. Then, in the next training stage, the training set (i.e., the first training set) is reconstructed using the above information, and the initial semi-supervised learning model is retrained according to the first training set, so as to improve the prediction accuracy of the model. Since the one-bit labeling only requires the annotator to answer "yes" or "no" to the predicted label, this labeling method can alleviate the pressure of manual labeling of a large amount of correctly labeled data in machine learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine learning, and in particular to a training method, image processing method and device for a semi-supervised learning model. Background Art

[0002] Traditional machine learning tasks are divided into unsupervised learning (data without labels, such as clustering, anomaly detection, etc.) and supervised learning (data with labels, such as classification, regression, etc.), while semi-supervised learning (SSL) is a key issue in the field of pattern recognition and machine learning. It is a learning method that combines supervised learning with unsupervised learning. Semi-supervised learning uses a large amount of unlabeled data and a portion of labeled data to perform pattern recognition.

[0003] In real-world scenarios, it is often very expensive to obtain data labels. However, existing semi-supervised learning models have certain requirements on the amount of labeled data. When the amount of labeled data reaches a certain level, the generalization ability of the semi-supervised learning model can be significantly enhanced, and the prediction accuracy of the semi-supervised learning model still has a lot of room for improvement.

[0004] Based on this, it is urgent to introduce a method to use a small amount of labeled data to train a semi-supervised learning model with higher prediction accuracy. Summary of the invention

[0005] The embodiments of the present application provide a training method, an image processing method and a device for a semi-supervised learning model, which are used to predict the classification category (i.e., label) of a part of unlabeled samples through a trained first semi-supervised learning model in the current training stage. If the prediction is correct, the correct label of the sample is obtained; otherwise, an erroneous label of the sample can be eliminated. Thereafter, in the next training stage, the above information is used to reconstruct the training set (i.e., the first training set) to update the initial semi-supervised learning model, thereby improving the prediction accuracy of the model.

[0006] Based on this, the embodiments of the present application provide the following technical solutions:

[0007] In the first aspect, the embodiment of the present application first provides a training method for a semi-supervised learning model, which can be used in the field of artificial intelligence. The method may include: first, the training device trains the initial semi-supervised learning model (which may be referred to as the initial model) according to the acquired initial training set, thereby obtaining a trained first semi-supervised learning model (which may be referred to as the trained first model), in which one part is labeled samples and the other part is unlabeled samples, wherein this part of labeled samples is called the first labeled sample set, and this part of unlabeled samples is called the first unlabeled sample set. After obtaining the trained first model, the training device selects an initial subset from the first unlabeled sample set in the initial training set, and each unlabeled sample in the initial subset constitutes test data for testing the trained first model, and each unlabeled sample in the selected initial subset is predicted by the trained first model, thereby obtaining the predicted label corresponding to each selected unlabeled sample (the trained first model will output the probability prediction of each selected unlabeled sample on each classification category, and usually selects the classification category with the largest probability as the predicted label of the model for the sample), and each predicted label constitutes the first predicted label set. After obtaining the first predicted label set, the training device will label the initial subset with one bit according to the first predicted label set. 22 = 1 bit of information (i.e., "yes" or "no"), so it is called one-bit labeling. As mentioned above, the one-bit labeling method is specifically as follows: the labeler answers a "yes" or "no" question for the predicted label corresponding to each predicted sample. If the predicted label is a correctly predicted classification category, the positive label (also called the correct label) of the unlabeled sample is obtained. For example, if the predicted label is "dog", the true label of the unlabeled sample is also "dog", then the prediction is correct, and the unlabeled sample obtains the positive label "dog"; if the predicted label is an incorrectly predicted classification category, the negative label of the unlabeled sample is obtained, thereby eliminating an incorrect label of the unlabeled sample. For example, if the predicted label is "cat", the true label of the unlabeled sample is indeed "dog", then the prediction is wrong, and the unlabeled sample obtains the negative label "not a cat". After one-bit labeling, the initial subset is divided into a first subset and a second subset, wherein the first subset is a sample set corresponding to the correctly predicted classification category (i.e., positive label), and the second subset is a sample set corresponding to the incorrectly predicted classification category (i.e., negative label). After obtaining the result of one-bit labeling, the corresponding number of positive labels and negative labels are obtained. After that, the training device reconstructs the training set. The reconstructed training set can be called the first training set. The specific construction method can be to put the positive label samples (i.e., the first subset) together with the existing labeled samples as the labeled samples of this stage, which can also be called the second labeled sample set; each negative label sample (i.e., the second subset) constitutes the negative label sample set of this stage; the remaining unlabeled samples in the first unlabeled sample set constitute the second unlabeled sample set of this stage. These three types of samples together constitute the first training set. After constructing the first training set, the initial model is retrained according to the first training set to obtain a second semi-supervised learning model with stronger training capabilities (which can be simply referred to as the trained second model).

[0008] In the above-mentioned implementation mode of the present application, first, the classification categories of a part of unlabeled samples are predicted by the trained first semi-supervised learning model to obtain predicted labels, and it is judged whether each predicted label is correct. If the prediction is correct, the correct label of the sample (i.e., the positive label) is obtained, otherwise an incorrect label of the sample (i.e., the negative label) can be excluded. After that, in the next training stage, the training device uses the above-mentioned information to reconstruct the training set (i.e., the first training set), and retrains the initial semi-supervised learning model according to the first training set, so as to improve the prediction accuracy of the model. Moreover, since only "yes" or "no" needs to be answered to the predicted label, this labeling method can alleviate the pressure of manual labeling of a large amount of correctly labeled data in machine learning.

[0009] In a possible implementation of the first aspect, the network structure of the initial semi-supervised learning model can have multiple specific forms, for example, it can include any one of the following models: Π-model, VAT, LPDSSL, TNAR, pseudo-label, DCT, mean teacher model.

[0010] In the above-mentioned embodiments of the present application, it is explained which semi-supervised learning models can be applied to the training method provided in the embodiments of the present application, which has universality and selectivity.

[0011] In a possible implementation manner of the first aspect, if the initial semi-supervised learning model is a learning model with only one loss function, such as any one of Π-model, VAT, LPDSSL, TNAR, pseudo-label, and DCT, then the training device trains the initial model according to the first training set, and the trained second model can be specifically: for the second labeled sample set and the second unlabeled sample set, the training device trains the initial semi-supervised learning model according to the second labeled sample set and the second unlabeled sample set using the first loss function, and the first loss function is the original loss function loss1 of the initial semi-supervised learning model; for the negative label sample set, the training device trains the initial semi-supervised learning model according to the negative label sample set using the second loss function, and the second loss function (which can be called loss2) is the difference between the predicted value and the modified value output by the model, and the modified value is a value that sets the corresponding dimension of the incorrectly predicted classification category on the predicted value to zero, and the second loss function loss2 is the new loss function constructed for the unlabeled sample set described above. Finally, the initial model is updated according to loss = loss1 + σ*loss2, where σ represents the balance coefficient, which is an adjustable parameter obtained through training, and loss is the output value of the total loss function of the entire semi-supervised learning model. The training process is to make the total loss as small as possible.

[0012] In the above implementation of the present application, it is explained that when the loss function of the initial semi-supervised learning model is one, a new loss function can be constructed for the negative label sample set, that is, different loss functions are used for different types of sample sets in the training set, and then the initial semi-supervised learning model is trained based on the total loss function, which is more targeted.

[0013] In a possible implementation of the first aspect, the training method of the embodiment of the present application can be used to train the above-mentioned semi-supervised learning model that originally had only one loss function, and can also be used to train a semi-supervised learning model with two or more loss functions. The process is similar. Specifically, the initial semi-supervised learning model can be a mean teacher model. Since the training strategy of the mean teacher model is: assume that the training samples are labeled samples (x1, y1) and unlabeled samples x2, where y1 is the label of x1. The labeled sample (x1, y1) is input into the student model to calculate the output value loss11 of the loss function 1; the unlabeled sample x2 is input into the student model to calculate the predicted label label1, and the unlabeled sample x2 is subjected to some data processing (generally a disturbance process to increase noise) and then input into the teacher model to calculate the predicted label label2. If the mean teacher model is stable enough, the predicted label label1 and the predicted label label2 should be the same, that is, the teacher model can resist the disturbance of the unlabeled sample x2. In other words, it is hoped that the predicted labels of the student model and the teacher model are as equal as possible. Therefore, the output value loss12 of the loss function 2 is obtained according to label1 and label2. Finally, the student model is updated according to loss = loss11 + λ*loss12, where λ represents the balance coefficient, which is an adjustable parameter obtained through training, and loss is the output value of the total loss function of the entire mean teacher model. The training process is to make this total loss as small as possible. Therefore, the training device trains the initial semi-supervised learning model according to the first training set, and obtains the trained second semi-supervised learning model. Specifically, it can also be: for the second labeled sample set, the training device trains the mean teacher model according to the second labeled sample set using the third loss function, and the third loss function is the loss function 1 (i.e., loss11) described above; the training device will also train the mean teacher model according to the second labeled sample set and the second unlabeled sample set using the fourth loss function, and the fourth loss function is the loss function 2 (i.e., loss12) described above. The third loss function loss11 and the fourth loss function loss12 are both the original loss functions of the mean teacher model; in addition, for the negative label sample, the training device will also train the mean teacher model according to the negative label sample set using the fifth loss function, and the fifth loss function (which can be called loss13) is the difference between the predicted value and the modified value output by the model, and the modified value is the value of setting the corresponding dimension of the wrongly predicted classification category on the predicted value to zero, and the fifth loss function loss13 is the new loss function constructed for the unlabeled sample set described above.Finally, the training device updates the initial mean teacher model according to loss = loss11 + λ*loss12 + γ*loss13, where λ and γ represent balance coefficients, which are adjustable parameters obtained through training. Loss is the output value of the total loss function of the entire mean teacher model. The training process is to make the total loss as small as possible.

[0014] In the above implementation of the present application, it is explained that when the initial semi-supervised learning model is a mean teacher model, a new loss function can also be constructed for the negative label sample set, that is, different loss functions are used for different types of sample sets in the training set, and then the initial semi-supervised learning model is trained based on the total loss function, which is more targeted.

[0015] In a possible implementation manner of the first aspect, the third loss function may be a cross entropy loss function; and / or, the fourth loss function may be a mean square error loss function.

[0016] In the above implementation of the present application, the specific forms of the third loss function and the fourth loss function in the mean teacher model are explained, which are feasible.

[0017] In a possible implementation manner of the first aspect, the second unlabeled sample set is used as a new first unlabeled sample set, and the second semi-supervised learning model is used as a new first semi-supervised learning model, and the above steps are repeated until the second unlabeled sample set is empty.

[0018] In the above implementation of the present application, when more training samples with correct labels are available, the accuracy of the model will be improved. Therefore, the most direct method is to divide the training process into multiple stages, select some samples from the first unlabeled sample set for prediction in each stage, reconstruct the training set for the predicted labels, and then use the reconstructed training set to update the model, so that the generalization ability and prediction accuracy of the second semi-supervised learning model obtained after training in each stage are stronger than those of the second semi-supervised learning model obtained in the previous stage.

[0019] In a possible implementation of the first aspect, after training the initial semi-supervised learning model according to the first training set to obtain the trained second semi-supervised learning model, the method further includes: deploying the trained second semi-supervised learning model on a target device, the target device is used to acquire a target image, and the trained second semi-supervised learning model is used to perform label prediction on the target image.

[0020] In the above-mentioned embodiment of the present application, the specific use of the trained second semi-supervised learning model is explained, that is, it is deployed on the target device to perform label prediction on the target image, that is, it is used to predict the category of the image. Compared with the semi-supervised learning model trained by the existing training method, the trained second semi-supervised learning model provided in the embodiment of the present application improves the accuracy of target image recognition.

[0021] In a possible implementation manner of the first aspect, the training device may select the initial subset from the first unlabeled sample set by randomly selecting a preset number of unlabeled samples from the first unlabeled sample set to form the initial subset.

[0022] In the above-mentioned embodiment of the present application, an implementation method of how to select unlabeled samples from the first unlabeled sample set to form an initial subset is described, and the random selection method ensures the balance of the selected samples.

[0023] The second aspect of an embodiment of the present application also provides an image processing method, which specifically includes: first, an execution device obtains a target image; then, the execution device uses the target image as an input of a trained semi-supervised learning model, and outputs a prediction result for the target image, wherein the trained semi-supervised learning model is a second semi-supervised learning model obtained in the above-mentioned first aspect or any possible implementation method of the first aspect.

[0024] In the above-mentioned embodiment of the present application, an application method of the trained second semi-supervised learning model is explained, that is, it is used to predict the category of images. Compared with the semi-supervised learning model trained by the existing training method, the semi-supervised learning model provided by the embodiment of the present application improves the accuracy of target image recognition.

[0025] A third aspect of the embodiments of the present application provides a training device, which has the function of implementing the method of the first aspect or any possible implementation of the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0026] The fourth aspect of the embodiment of the present application provides an execution device, which has the function of implementing the method of the second aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0027] The fifth aspect of the embodiment of the present application provides a training device, which may include a memory, a processor and a bus system, wherein the memory is used to store programs, and the processor is used to call the programs stored in the memory to execute the method of the first aspect of the embodiment of the present application or any possible implementation method of the first aspect.

[0028] The sixth aspect of the embodiment of the present application provides a training device, which may include a memory, a processor and a bus system, wherein the memory is used to store programs, and the processor is used to call the programs stored in the memory to execute the method of the second aspect of the embodiment of the present application.

[0029] The seventh aspect of the embodiments of the present application provides a computer-readable storage medium, which stores instructions. When the computer-readable storage medium is run on a computer, it enables the computer to execute the method of the first aspect or any possible implementation of the first aspect, or enables the computer to execute the method of the second aspect.

[0030] An eighth aspect of an embodiment of the present application provides a computer program or a computer program product, which, when executed on a computer, enables the computer to execute the method of the first aspect or any possible implementation of the first aspect, or enables the computer to execute the method of the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 A schematic diagram of a process of training and reasoning of a semi-supervised learning model provided in an embodiment of the present application;

[0032] Figure 2 A schematic diagram of a process of active learning model training and reasoning provided in an embodiment of the present application;

[0033] Figure 3 A schematic diagram of the mean teacher model;

[0034] Figure 4 A schematic diagram of the structure of the artificial intelligence main framework provided in the embodiment of the present application;

[0035] Figure 5 An overall flow chart of the training method of the semi-supervised learning model provided in the embodiment of the present application;

[0036] Figure 6 A schematic diagram of a system architecture of a task processing system provided in an embodiment of the present application;

[0037] Figure 7 A flowchart of a training method for a semi-supervised learning model provided in an embodiment of the present application;

[0038] Figure 8 A flowchart of a training method for a semi-supervised learning model provided in an embodiment of the present application;

[0039] Fig. 9 A schematic diagram of the mean teacher model training process provided in an embodiment of the present application;

[0040] Fig.10 A schematic diagram of a flow chart of an image processing method provided in an embodiment of the present application;

[0041] Fig.11 A schematic diagram of an application scenario provided by an embodiment of the present application;

[0042] Fig.12 Another schematic diagram of an application scenario provided by an embodiment of the present application;

[0043] Fig.13 Another schematic diagram of an application scenario provided by an embodiment of the present application;

[0044] Fig.14 A schematic diagram of a training device provided in an embodiment of the present application;

[0045] Fig.15 A schematic diagram of an execution device provided in an embodiment of the present application;

[0046] Fig.16 Another schematic diagram of the training device provided in the embodiment of the present application;

[0047] Fig.17 Another schematic diagram of an execution device provided in an embodiment of the present application;

[0048] Fig.18 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] The embodiments of the present application provide a training method, an image processing method and a device for a semi-supervised learning model, which are used to predict the classification category (i.e., label) of a part of unlabeled samples through a trained first semi-supervised learning model in the current training stage. If the prediction is correct, the correct label of the sample is obtained; otherwise, an erroneous label of the sample can be eliminated. Thereafter, in the next training stage, the above information is used to reconstruct the training set (i.e., the first training set) to update the initial semi-supervised learning model, thereby improving the prediction accuracy of the model.

[0050] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0051] The embodiments of the present application involve a lot of relevant knowledge about semi-supervised learning, learning models, etc. In order to better understand the solutions of the embodiments of the present application, the relevant terms and concepts that may be involved in the embodiments of the present application are introduced below. It should be understood that the interpretation of relevant terms and concepts may be limited due to the specific circumstances of the embodiments of the present application, but it does not mean that the present application is limited to the specific circumstances. There may also be differences in the specific circumstances of different embodiments, which are not specifically limited here.

[0052] (1) Neural Network

[0053] A neural network can be composed of neural units. Specifically, it can be understood as a neural network with an input layer, a hidden layer, and an output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all hidden layers. Among them, a neural network with many hidden layers is called a deep neural network (DNN). The work of each layer in the neural network can be expressed mathematically. To describe, from a physical level, the work of each layer in the neural network can be understood as completing the transformation from input space to output space (i.e., from the row space to the column space of the matrix) through five operations on the input space (the set of input vectors). These five operations include: 1. Dimension increase / reduction; 2. Enlargement / reduction; 3. Rotation; 4. Translation; 5. "Bending". Operations 1, 2, and 3 are represented by Completed, operation 4 is completed by "+b", and operation 5 is implemented by "a()". The word "space" is used here because the classified object is not a single thing, but a class of things. Space refers to the collection of all individuals of this class of things, where W is the weight matrix of each layer of the neural network, and each value in the matrix represents the weight value of a neuron in the layer. The matrix W determines the spatial transformation from the input space to the output space described above, that is, the W of each layer of the neural network controls how to transform the space. The purpose of training a neural network is to eventually obtain the weight matrices of all layers of the trained neural network. Therefore, the training process of a neural network is essentially about learning how to control spatial transformation, or more specifically, learning the weight matrix.

[0054] It should be noted that in the embodiments of the present application, the learning models (also referred to as learners, models, etc.) used in tasks based on machine learning (such as active learning, supervised learning, unsupervised learning, semi-supervised learning, etc.) are essentially neural networks.

[0055] (2) Loss function

[0056] In the process of training a neural network, because we hope that the output of the neural network is as close as possible to the value we really want to predict, we can compare the current network's predicted value with the target value we really want, and then update the weight matrix of each layer of the neural network according to the difference between the two (of course, there is usually an initialization process before the first update, that is, pre-configuring parameters for each layer in the neural network). For example, if the network's predicted value is high, adjust the weight matrix to make it predict lower, and keep adjusting until the neural network can predict the target value we really want. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function or objective function, which are important equations used to measure the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training of the neural network becomes a process of minimizing this loss as much as possible.

[0057] In the training process of the neural network, the error back propagation (BP) algorithm can be used to correct the size of the parameters in the initial neural network model, so that the reconstruction error loss of the neural network model becomes smaller and smaller. Specifically, the forward transmission of the input signal to the output will generate error loss, and the parameters in the initial neural network model are updated by back propagating the error loss information, so that the error loss converges. The back propagation algorithm is a back propagation movement dominated by error loss, which aims to obtain the optimal parameters of the neural network model, such as the weight matrix.

[0058] (3) Features

[0059] A feature is an input variable, i.e. the x variable in a simple linear regression. A simple machine learning task might use a single feature, while a more complex machine learning task might use millions of features.

[0060] (4) Tags

[0061] The label is the y variable in a simple linear regression. The label can be the future price of wheat, the species of animals or plants shown in the picture, the meaning of an audio clip, or anything else. In an embodiment of the present application, a label refers to the classification category of a picture. For example, if there is a picture of a cat, everyone knows that it is a cat, but the computing device does not know that it is a cat. What should I do? Then give this picture a label, and the label is used to indicate to the computing device that the information contained in the picture is "cat". Then the computing device knows that it is a cat. The computing device can learn all cats according to this label and can recognize all cats through this cat. Therefore, labeling the data is to tell the computing device what the multiple features of the input variable describe (i.e., y). y can be called a label or a target (i.e., target value).

[0062] (5) Sample

[0063] A sample refers to a specific instance of data. A sample x represents an object. Sample x is usually represented by a feature vector x = (x 1 ,x 2 ,…,x d )∈R d Represents, where d represents the dimension of sample x (i.e. the number of features). Samples are divided into labeled samples and unlabeled samples. Labeled samples contain both features and labels, and unlabeled samples contain features but not labels. The task of machine learning is often to learn the potential patterns in the input d-dimensional training sample set (which can be referred to as the training set).

[0064] (6) Model

[0065] In the embodiments of the present application, the learning models (also referred to as learners, models, etc.) used in machine learning tasks (such as active learning, supervised learning, unsupervised learning, semi-supervised learning, etc.) are essentially neural networks. The model defines the relationship between features and labels. The application of the model generally includes two stages: training and reasoning. The training stage is used to train the model according to the training set to obtain the trained model; the reasoning stage is used to use the trained model to predict labels for real unlabeled instances, and the prediction accuracy is one of the important indicators to measure the quality of a model training.

[0066] (7) Semi-supervised learning (SSL)

[0067] According to whether the training samples are labeled, traditional machine learning tasks are divided into supervised learning and unsupervised learning. Supervised learning refers to learning tasks where the training samples contain label information (i.e., the data is labeled), such as common classification and regression algorithms; unsupervised learning refers to learning tasks where the training samples do not contain label information (i.e., the data is unlabeled), such as clustering algorithms, anomaly detection algorithms, etc. In real life, the situation encountered is often a compromise between the two, that is, only some samples are labeled, and the other part of the samples are unlabeled. If only labeled or unlabeled samples are used, on the one hand, some samples will be wasted, and on the other hand, due to the small number of samples used, the effect of the trained model is not very good. For example, when making web page recommendations, users need to mark the web pages they are interested in, but few users are willing to spend time to provide labels. If the unlabeled sample set is directly discarded, using traditional supervised learning methods, the model's ability to depict the overall distribution is often weakened due to insufficient training samples, thereby affecting the generalization performance of the model.

[0068] Based on this, semi-supervised learning came into being. Semi-supervised learning is a learning method that combines supervised learning and unsupervised learning. The corresponding model used can be called a semi-supervised learning model, such as Figure 1 As shown, Figure 1 The diagram shows the training and reasoning process of a semi-supervised learning model. The training set used by the model consists of a part of labeled samples (a small part) and another part of unlabeled samples (a large part). The basic idea of ​​semi-supervised learning is to use the model assumptions on the data distribution to establish a model to label unlabeled samples, so that the model does not rely on external interactions and automatically uses unlabeled samples to improve learning performance.

[0069] (8) Active learning

[0070] When using some traditional supervised learning methods for classification, the larger the size of the training sample, the better the classification effect. However, in many scenarios in real life, it is difficult to obtain labeled samples, which requires experts in the field (i.e., annotators) to manually label the correct labels, which takes a lot of time and money. Moreover, if the size of the training sample is too large, the training time will also be more expensive. So is there a way to use fewer labeled samples to obtain a model with better performance? Active learning provides this possibility.

[0071] The training set used in active learning is similar to that used in semi-supervised learning, such as Figure 2 As shown, Figure 2The diagram shows the training and reasoning process of the active learning model. The training set used by the model is also composed of a part of labeled samples (a small part) and another part of unlabeled samples (a large part). However, the difference from the semi-supervised learning model is that the basic idea of ​​active learning is to first train the active learning model with only the labeled samples in the training set, and then predict the unlabeled samples based on the active learning model, and select samples with high uncertainty or low classification confidence (such as Figure 2 The unlabeled samples a) found in the query are consulted by experts and labeled. For example, if the expert manually identifies the selected unlabeled sample as "horse", the unlabeled sample is labeled with "horse". After that, the samples marked with the true label by the expert are classified as the labeled samples in the training set. The active learning model is retrained with the expanded labeled samples to improve the accuracy of the model. The problem with active learning is that it requires experts to participate in the correct labeling of samples (i.e., labeling the true label).

[0072] (9) Mean Teacher Model

[0073] The mean teacher model can also be called the teacher-student model. It is a semi-supervised learning model. The relevant structure of this model is as follows Figure 3 As shown in the figure, the model includes two sub-models, one is the student model and the other is the teacher model. In other words, the mean teacher model acts as both a student and a teacher. As a teacher, it generates the learning target of the student model through the teacher model; as a student model, it uses the target generated by the teacher model to learn. The network parameters of the teacher model are obtained by weighted average of the network parameters of the student model in history (previous steps). The network structures of the two sub-models in the mean teacher model are the same. During the training process, the network parameters of the student model are updated according to the gradient descent method of the loss function; the network parameters of the teacher model are obtained by iterating the network parameters of the student model.

[0074] Since the mean teacher model is a kind of semi-supervised learning model, the training set it uses is also partly labeled samples and partly unlabeled samples. The following introduces the training strategy of the mean teacher model: Assume that the training samples are labeled samples (x1, y1) and unlabeled samples x2, where y1 is the label of x1. Input the labeled sample (x1, y1) into the student model to calculate the output value loss11 of loss function 1; input the unlabeled sample x2 into the student model to calculate the predicted label label1, and input the unlabeled sample x2 into the teacher model after some data processing (generally perturbation processing with added noise) to calculate the predicted label label2. If the mean teacher model is stable enough, then the predicted label label1 and the predicted label label2 should be the same, that is, the teacher model can resist the perturbation of the unlabeled sample x2, that is, it is hoped that the predicted labels of the student model and the teacher model are as equal as possible, so the output value loss12 of loss function 2 is obtained according to label1 and label2. Finally, the student model is updated according to loss = loss11 + λ*loss12, where λ represents the balance coefficient, which is an adjustable parameter obtained through training, and loss is the output value of the total loss function of the entire mean teacher model. The training process is to make this total loss as small as possible. In each step, after updating the network parameters of the student model, the network parameters of the teacher model are then used to update the network parameters of the student model. Figure 3 The network parameters θ' in the teacher model are updated by the network parameters θ in the student model through exponential moving average. Figure 3 The η' in the teacher model is a parameter that adds perturbation processing to the input.

[0075] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0076] First, the overall workflow of the AI ​​system is described in Figure 4 , Figure 4The figure shows a structural diagram of the main framework of artificial intelligence. The following is an explanation of the above artificial intelligence theme framework from the two dimensions of "intelligent information chain" (horizontal axis) and "IT value chain" (vertical axis). Among them, the "intelligent information chain" reflects a series of processes from data acquisition to processing. For example, it can be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has undergone a condensation process of "data-information-knowledge-wisdom". The "IT value chain" reflects the value that artificial intelligence brings to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecology process of the system.

[0077] (1) Infrastructure

[0078] The infrastructure provides computing power support for the AI ​​system, enables communication with the outside world, and supports it through the basic platform. It communicates with the outside world through sensors; computing power is provided by smart chips (CPU, NPU, GPU, ASIC, FPGA and other hardware acceleration chips); the basic platform includes distributed computing frameworks and networks and other related platform guarantees and support, which can include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.

[0079] (2) Data

[0080] The data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, text, and IoT data of traditional devices, including business data of existing systems and perception data such as force, displacement, liquid level, temperature, and humidity.

[0081] (3) Data processing

[0082] Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.

[0083] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.

[0084] Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.

[0085] Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.

[0086] (4) General ability

[0087] After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as an algorithm or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.

[0088] (5) Smart products and industry applications

[0089] Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical application. Its application areas mainly include: smart terminals, smart manufacturing, smart transportation, smart homes, smart medical care, smart security, autonomous driving, safe cities, etc.

[0090] The embodiments of the present application can be applied to the optimization of training methods of various learning models in machine learning, and the learning model trained by the training method of the present application can be specifically applied to various sub-fields in the field of artificial intelligence, such as computer vision, image processing, etc. Specifically, combined with Figure 4 Generally speaking, the data in the data set acquired by the infrastructure in the embodiments of the present application can be multiple data of different types acquired by sensors such as cameras and radars (also referred to as training data or training samples, and multiple training data constitute a training set), or multiple image data or multiple video data, as long as the training set meets the function of iteratively training the learning model. Specifically, the data type in the training set is not limited here. For ease of understanding, the following embodiments of the present application are illustrated by taking the training set as image data as an example. It should be noted here that the training set used in the embodiments of the present application includes a part of labeled samples (a small part) and another part of unlabeled samples (a large part), and this part of labeled samples can be manually marked with real labels by the annotator in advance.

[0091] The overall process of the training method of the semi-supervised learning model in the embodiment of the present application is as follows: Figure 5 As shown, first, the initial semi-supervised learning model (which may be referred to as the initial model) is trained according to the labeled samples and unlabeled samples of the initial training set to obtain the first semi-supervised learning model after training (which may be referred to as the first model after training). Then, a part of the unlabeled samples are selected from all the unlabeled samples in the initial training set as the input of the first model after training. The first model after training predicts the selected unlabeled samples to obtain the predicted label of each selected unlabeled sample, and then each predicted label is labeled with one bit. Since this method provides log 22 = 1 bit of information (i.e. "yes" or "no"), so it is called one-bit labeling. The specific one-bit labeling method is: the labeler answers a "yes" or "no" question for the predicted label corresponding to each predicted sample. If the predicted label is a correctly predicted classification category, the positive label (also called the correct label) of the unlabeled sample is obtained. For example, if the predicted label is "dog", and the true label of the unlabeled sample is also "dog", then the prediction is correct, and the unlabeled sample obtains the positive label "dog"; if the predicted label is an incorrectly predicted classification category, the negative label of the unlabeled sample is obtained, and an incorrect label of the unlabeled sample can be excluded. For example, if the predicted label is "cat", and the true label of the unlabeled sample is indeed "dog", then the prediction is wrong, and the unlabeled sample obtains the negative label "not a cat". After obtaining the one-bit labeling result in each stage, the corresponding number of positive labels and negative labels are obtained. The positive label samples are put together with the existing labeled samples as the labeled samples of this stage. For the negative label samples, they are merged with the previously available negative label samples. In addition, there are the remaining unlabeled samples, which constitute all three types of samples in this stage. These three types of samples together constitute the first training set. After that, the initial model is trained according to the first training set to obtain a second semi-supervised learning model with stronger training capability (which can be referred to as the second model after training). Finally, the predicted labels of the second model after training are used for one-bit labeling again to obtain more positive labels. By repeating this process continuously, new models with increasingly stronger capabilities can be obtained.

[0092] It should be noted that Figure 5 The application process described can be deployed on the training device, see Figure 6 , Figure 6 A system architecture diagram of a task processing system provided in an embodiment of the present application, in Figure 6 In the example, the task processing system 200 includes an execution device 210, a training device 220, a database 230, a client device 240, a data storage system 250, and a data acquisition device 260. The execution device 210 includes a computing module 211. The data acquisition device 260 is used to obtain the open source large-scale data sets (i.e. Figure 4The training device 220 trains the target model / rule 201 (i.e., the initial model of each stage described above) based on the training sets of each stage maintained in the database 230, and the trained model (e.g., the second model described above) obtained by training is then used on the execution device 210. The execution device 210 can call the data, code, etc. in the data storage system 250, and can also store data, instructions, etc. in the data storage system 250. The data storage system 250 can be placed in the execution device 210, or the data storage system 250 can be an external memory relative to the execution device 210.

[0093] The second model trained by the training device 220 can be applied to different systems or devices (i.e., the execution device 210), which can be edge devices or end-side devices, such as mobile phones, tablets, laptops, monitoring systems (such as cameras), security systems, etc. Figure 6 In the embodiment, the execution device 210 is configured with an I / O interface 212 for data interaction with external devices, and a “user” can input data into the I / O interface 212 through a client device 240 . For example, the client device 240 may be a camera device of a monitoring system, and the target image captured by the camera device is input as input data to the computing module 211 of the execution device 210, and the computing module 211 detects the input target image and obtains the detection result (i.e., the predicted label), and then outputs the detection result to the camera device or directly displays it on the display interface of the execution device 210 (if any); in addition, in some embodiments of the present application, the client device 240 may also be integrated in the execution device 210, such as, when the execution device 210 is a mobile phone, the target task can be directly obtained through the mobile phone (such as the target image can be captured by the camera of the mobile phone, or the target voice can be recorded by the recording module of the mobile phone, etc., and the target task is not limited here) or received from other devices (such as another mobile phone), and then the computing module 211 in the mobile phone detects the target task and obtains the detection result, and directly presents the detection result on the display interface of the mobile phone. The product form of the execution device 210 and the client device 240 is not limited here.

[0094] It is worth noting that Figure 6 This is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 6 In the embodiment, the data storage system 250 is an external memory relative to the execution device 210. In other cases, the data storage system 250 may also be placed in the execution device 210; Figure 6 In the embodiment, the client device 240 is an external device relative to the execution device 210. In other cases, the client device 240 may also be integrated into the execution device 210.

[0095] It should also be noted that the training of the initial model described in the above embodiment can be implemented on the cloud side. For example, the training set can be obtained by the training device 220 on the cloud side (the training device 220 can be set on one or more servers or virtual machines), and the initial model is trained according to the training samples in the training set to obtain a trained second model. After that, the trained second model is sent to the execution device 210 for application, for example, it is sent to the execution device 210 for label prediction. Exemplarily, Figure 6 As described in the corresponding system architecture, the initial model is trained as a whole by the training device 220, and the trained second model is then sent to the execution device 210 for use; the training of the initial model described in the above embodiment can also be implemented on the terminal side, that is, the training device 220 can be located on the terminal side. For example, the training set can be obtained by a terminal device (such as a mobile phone, a smart watch, etc.), a wheeled mobile device (such as an autonomous driving vehicle, an assisted driving vehicle, etc.), etc., and the initial model is trained according to the training samples in the training set to obtain the trained second model. The trained second model can be used directly on the terminal device, or it can be sent by the terminal device to other devices for use. The specific embodiment of the present application does not limit on which device (cloud side or terminal side) the second model is trained or applied.

[0096] Next, we will introduce the training method of the semi-supervised learning model provided in the embodiment of the present application. Figure 7 , Figure 7 A flow chart of a training method for a semi-supervised learning model provided in an embodiment of the present application may specifically include the following steps:

[0097] 701. Train an initial semi-supervised learning model according to an initial training set to obtain a trained first semi-supervised learning model, wherein the initial training set includes a first labeled sample set and a first unlabeled sample set.

[0098] First, the training device trains an initial semi-supervised learning model (which may be referred to as the initial model) according to the acquired initial training set, so as to obtain a first semi-supervised learning model after training (which may be referred to as the first model after training). In the initial training set, one part is labeled samples and the other part is unlabeled samples, wherein this part of labeled samples is called the first labeled sample set, and this part of unlabeled samples is called the first unlabeled sample set.

[0099] It should be noted here that how to train an initial semi-supervised learning model with a known network structure based on the initial training set is known, and the details will not be repeated here.

[0100] 702. Select an initial subset from the first unlabeled sample set, and predict the initial subset using the trained first semi-supervised learning model to obtain a first predicted label set.

[0101] After the training device obtains the trained first model, it selects an initial subset from the first unlabeled sample set in the initial training set. The unlabeled samples in the initial subset constitute test data for testing the trained first model. The trained first model is used to predict the unlabeled samples in the selected initial subset, so as to obtain the predicted label corresponding to each selected unlabeled sample (the trained first model will output the probability prediction of each selected unlabeled sample in each classification category, and usually the classification category with the largest probability is selected as the model's predicted label for the sample), and the predicted labels constitute the first predicted label set.

[0102] For ease of understanding, the following example is used for illustration: Assume that the initial training set includes 330 training samples, of which 30 are labeled samples and 300 are unlabeled samples, then these 30 labeled samples constitute the first labeled sample set mentioned above, and these 300 unlabeled samples constitute the first unlabeled sample set mentioned above. First, the initial model is trained according to the 330 training samples in the initial training set to obtain the trained first model. After that, some unlabeled samples are selected from the 300 unlabeled samples to form an initial subset. Assuming that 100 unlabeled samples are selected, then these 100 unlabeled samples are sequentially input into the trained first model for prediction, and the corresponding 100 prediction labels are obtained respectively. These 100 prediction labels constitute the first prediction label set mentioned above.

[0103] It should be noted that, in some embodiments of the present application, the training device selects the initial subset from the first unlabeled sample set in a manner including but not limited to the following manner: randomly selecting a preset number of unlabeled samples from the first unlabeled sample set to form the initial subset. For example, assuming that the first unlabeled sample set includes 300 unlabeled samples, a preset number (e.g., 100, 150, etc.) of unlabeled samples can be randomly selected therefrom to form the initial subset.

[0104] 703. Divide the initial subset into a first subset and a second subset according to the first predicted label set, wherein the first subset is a sample set corresponding to a correctly predicted classification category, and the second subset is a sample set corresponding to an incorrectly predicted classification category.

[0105] After the training device obtains the first predicted label set, it will label the initial subset with one bit according to the first predicted label set. 2 2 = 1 bit of information (i.e., "yes" or "no"), so it is called one-bit labeling. As mentioned above, the one-bit labeling method is specifically as follows: the labeler answers a "yes" or "no" question for the predicted label corresponding to each predicted sample. If the predicted label is a correctly predicted classification category, the positive label (also called the correct label) of the unlabeled sample is obtained. For example, if the predicted label is "dog", the true label of the unlabeled sample is also "dog", then the prediction is correct, and the unlabeled sample obtains the positive label "dog"; if the predicted label is an incorrectly predicted classification category, the negative label of the unlabeled sample is obtained, thereby eliminating an incorrect label of the unlabeled sample. For example, if the predicted label is "cat", the true label of the unlabeled sample is indeed "dog", then the prediction is wrong, and the unlabeled sample obtains the negative label "not a cat". After one-bit labeling, the initial subset is divided into a first subset and a second subset, wherein the first subset is a sample set corresponding to the correctly predicted classification category (i.e., positive label), and the second subset is a sample set corresponding to the incorrectly predicted classification category (i.e., negative label).

[0106] It should be noted that in some embodiments of the present application, the annotator may be a manual annotator in the field, that is, the manual annotator is used to determine whether these predicted labels are correct, that is, the annotator needs to answer whether the sample belongs to the predicted category after observing the sample. If the prediction is correct, the correct label of the sample (i.e., positive label) is obtained, and if the prediction is wrong, the wrong label of the sample (i.e., negative label) is obtained. In other embodiments of the present application, the annotator may be a computing device, which knows the true labels of each unlabeled sample. The computing device compares the true label of the same unlabeled sample with the predicted label to determine whether the sample belongs to the predicted category. If the prediction is correct, the correct label of the sample (i.e., positive label) is obtained, and if the prediction is wrong, the wrong label of the sample (i.e., negative label) is obtained. The specific embodiments of the present application do not limit the specific form of expression of the annotator.

[0107] 704. Construct a first training set, where the first training set includes a second labeled sample set, a second unlabeled sample set, and a negative labeled sample set.

[0108] After obtaining the result of one-bit labeling, the training device obtains the corresponding number of positive labels and negative labels. After that, the training device will reconstruct the training set. The reconstructed training set can be called the first training set. The specific construction method can be: put the positive label samples (i.e., the first subset) together with the existing labeled samples as the labeled samples of this stage, which can also be called the second labeled sample set; each negative label sample (i.e., the second subset) constitutes the negative label sample set of this stage; the remaining unlabeled samples in the first unlabeled sample set constitute the second unlabeled sample set of this stage. These three types of samples together constitute the first training set.

[0109] 705. Train an initial semi-supervised learning model according to the first training set to obtain a trained second semi-supervised learning model.

[0110] After constructing the first training set, the training device retrains the initial model based on the first training set to obtain a second semi-supervised learning model with stronger training capabilities (which may be referred to as the trained second model for short).

[0111] It should be noted that the first training set constructed in the present application is different from the initial training set in that there is an additional negative label sample set. For the labeled sample set and the unlabeled sample set, the original method is still used for training. For the negative label sample set, a new loss function is constructed, and the negative label sample set is trained using the newly constructed loss function. The newly constructed loss function is defined as the difference between the predicted value and the modified value output by the model, and the modified value is the value that sets the corresponding dimension of the wrongly predicted classification category on the predicted value to zero.

[0112] To facilitate the construction of the corresponding loss function for negative label samples, the following example is used to illustrate: Generally speaking, the model predicts a certain input sample (assuming that the sample is a picture), and the output prediction value is an n-dimensional vector. The n dimensions represent n classification categories, and the values ​​on these n dimensions represent the prediction probability of each corresponding classification category. Usually, the classification category with the largest prediction probability is selected as the model's prediction label for the sample. The prediction probability is generally the normalized prediction probability, that is, the sum of the prediction probabilities of all classification categories is 1. Assuming that there are 6 classification categories, namely "pig", "dog", "cat", "horse", "sheep", and "goose", after the sample is input into the model, the model will output the probability prediction of the sample in each of the above classification categories. Assuming that the prediction value output by the model is [0.05, 0.04, 0.01, 0.5, 0.32, 0.08], and the classification categories of each dimension of the prediction value correspond to the 6 classification categories of "pig", "dog", "cat", "horse", "sheep", and "goose" in turn, then from the output prediction value, it can be seen that the corresponding "horse" The prediction probability of the classification category is the largest, so the model predicts the label of the sample as "horse". Suppose after one-bit annotation, it is found that the predicted label for the sample is a negative label, that is, the negative label of the sample is "not a horse", so the value of the dimension corresponding to "horse" is changed to zero, that is, 0.5 is changed to 0, then the modified value is [0.05, 0.04, 0.01, 0, 0.32, 0.08], and then the difference between the above predicted value and the modified value is defined as the loss function constructed for the negative label sample set.

[0113] It should be noted that in some embodiments of the present application, the semi-supervised learning model (referred to as the model) used is different, so the training process according to the first training set will also be somewhat different, which are described below:

[0114] (1) The case where the loss function of the initial semi-supervised learning model is one.

[0115] In some embodiments of the present application, the training device trains the initial model according to the first training set, and the trained second model can be specifically: for the second labeled sample set and the second unlabeled sample set, the training device trains the initial semi-supervised learning model according to the second labeled sample set and the second unlabeled sample set using the first loss function, and the first loss function is the original loss function loss1 of the initial semi-supervised learning model; for the negative label sample set, the training device trains the initial semi-supervised learning model according to the negative label sample set using the second loss function, and the second loss function (which can be called loss2) is the difference between the predicted value and the modified value output by the model, and the modified value is a value that sets the corresponding dimension of the wrongly predicted classification category on the predicted value to zero, and the second loss function loss2 is the new loss function constructed for the unlabeled sample set as described above, which will not be described in detail here.

[0116] Finally, the initial model is updated according to loss = loss1 + σ*loss2, where σ represents the balance coefficient, which is an adjustable parameter obtained through training, and loss is the output value of the total loss function of the entire semi-supervised learning model. The training process is to make the total loss as small as possible.

[0117] It should be noted that, in some embodiments of the present application, the initial semi-supervised learning model includes any one of the following models: Π-model, VAT, LPDSSL, TNAR, pseudo-label, DCT. The original loss functions of these models are all one and known.

[0118] (2) The case where the initial semi-supervised learning model has multiple loss functions.

[0119] In some embodiments of the present application, the training method of the embodiment of the present application can be used not only to train the above-mentioned semi-supervised learning model that originally had only one loss function, but also to train a semi-supervised learning model with two or more loss functions. The process is similar. Below, taking the semi-supervised learning model as a mean teacher model as an example, the situation where the initial semi-supervised learning model has multiple loss functions is illustrated.

[0120] The following is an introduction to the training strategy of the mean teacher model: Assume that the training samples are labeled samples (x1, y1) and unlabeled samples x2, where y1 is the label of x1. Input the labeled sample (x1, y1) into the student model to calculate the output value loss11 of loss function 1; input the unlabeled sample x2 into the student model to calculate the predicted label label1, and input the unlabeled sample x2 into the teacher model after some data processing (generally noise perturbation processing) to calculate the predicted label label2. If the mean teacher model is stable enough, the predicted label label1 and the predicted label label2 should be the same, that is, the teacher model can resist the perturbation of the unlabeled sample x2. In other words, it is hoped that the predicted labels of the student model and the teacher model are as equal as possible. Therefore, the output value loss12 of loss function 2 is obtained according to label1 and label2. Finally, the student model is updated according to loss = loss11 + λ*loss12, where λ represents the balance coefficient, which is an adjustable parameter obtained through training, and loss is the output value of the total loss function of the entire mean teacher model. The training process is to make this total loss as small as possible.

[0121] Based on the mean teacher model, for the second labeled sample set, the training device trains the mean teacher model according to the second labeled sample set using the third loss function, and the third loss function is the loss function 1 (i.e., loss11) described above; the training device will also train the mean teacher model according to the second labeled sample set and the second unlabeled sample set using the fourth loss function, and the fourth loss function is the loss function 2 (i.e., loss12) described above. The third loss function loss11 and the fourth loss function loss12 are both the original loss functions of the mean teacher model; in addition, for the negative label samples, the training device will also train the mean teacher model according to the negative label sample set using the fifth loss function, and the fifth loss function (which can be called loss13) is the difference between the predicted value and the modified value output by the model, and the modified value is a value that sets the corresponding dimension of the incorrectly predicted classification category on the predicted value to zero. The fifth loss function loss13 is the new loss function constructed for the unlabeled sample set described above, and the details are not repeated here.

[0122] It should be noted that, in some embodiments of the present application, the third loss function loss11 may be a cross loss function, and the fourth loss function loss12 may be a mean square error loss function.

[0123] Finally, the initial mean teacher model is updated according to loss = loss11 + λ*loss12 + γ*loss13, where λ and γ represent balance coefficients, which are adjustable parameters obtained through training, and loss is the output value of the total loss function of the entire mean teacher model. The training process is to make the total loss as small as possible.

[0124] 706. Use the second unlabeled sample set as a new first unlabeled sample set and the second semi-supervised learning model as a new first semi-supervised learning model, and repeat steps 702 to 705 until the second unlabeled sample set is empty.

[0125] The process from step 702 to step 705 is a stage (referred to as stage 1) of obtaining the trained second model. Usually, when more training samples with correct labels are available, the accuracy of the model will be improved. The most direct method is to divide the training process into multiple stages. Therefore, in some embodiments of the present application, in order to make the second model with stronger generalization ability, it will generally go through multiple stages of training, that is, the predicted label of the trained second model is used to perform one-bit labeling again, so that more positive labels can be obtained. Repeating this process continuously can obtain a new model with increasingly stronger capabilities. Specifically, the training device uses the second unlabeled sample set as the new first unlabeled sample set, and the second semi-supervised learning model as the new first semi-supervised learning model, and repeats steps 702 to 705 until the second unlabeled sample set is empty.

[0126] It should be noted that in some implementations of the present application, step 706 may not be included, that is, only one stage of training is performed to obtain a second model after training in one training stage. The generalization ability of the second model is also improved compared to the existing training method.

[0127] It should also be noted that, in some embodiments of the present application, assuming that the unlabeled samples constituting the initial subset are all samples in the first unlabeled samples, then in the first training stage, the second unlabeled samples are empty, and step 706 is not included in this case.

[0128] It should also be noted that after obtaining the trained second model, the second model can be deployed on the target device for application. In the embodiment of the present application, the target device can be a mobile device, such as a camera, a smart home and other edge devices, or a mobile phone, a personal computer, a computer workstation, a tablet computer, a smart wearable device (such as a smart watch, a smart bracelet, a smart headset, etc.), a game console, a set-top box, a media consumption device and other end-side devices. The type of the target device is not specifically limited here.

[0129] It should also be noted that the training of the semi-supervised learning model described in the above embodiment can be implemented on the cloud side, for example, based on Figure 6 The architecture diagram of the task processing system shown in the figure can be that the training device 220 on the cloud side (the training device 220 can be set on one or more servers or virtual machines) obtains the training set, and trains the initial semi-supervised learning model according to the training samples in the training set to obtain the trained semi-supervised learning model (e.g., the trained first model and the second model). After that, the trained second model is sent to the execution device 210 for application, for example, to the execution device 210 for label prediction. Exemplarily, Figure 6 As described in the corresponding system architecture, the training device 220 trains the models of each stage, and the trained second model is then sent to the execution device 210 for use; the training of the initial semi-supervised learning model described in the above embodiment can also be implemented on the terminal side, that is, the training device 220 can be located on the terminal side. For example, the training set can be obtained by a terminal device (such as a mobile phone, a smart watch, etc.), a wheeled mobile device (such as an autonomous driving vehicle, an assisted driving vehicle, etc.), etc., and trained according to the training samples in the training set to obtain a trained semi-supervised learning model (such as the trained first model and the second model). The trained second model can be used directly on the terminal device, or it can be sent by the terminal device to other devices for use. The specific embodiment of the present application does not limit on which device (cloud side or terminal side) the second model is trained or applied.

[0130] In the above-mentioned embodiment of the present application, first, the training device predicts the classification categories of a part of unlabeled samples through the trained first semi-supervised learning model to obtain predicted labels, and guesses whether each predicted label is correct through one-bit labeling. If the prediction is correct, the correct label of the sample (i.e., the positive label) is obtained, otherwise an incorrect label of the sample (i.e., the negative label) can be excluded. Then, in the next training stage, the training device uses the above information to reconstruct the training set (i.e., the first training set), and retrains the initial semi-supervised learning model based on the first training set, thereby improving the prediction accuracy of the model. In addition, since the one-bit labeling only requires the annotator to answer "yes" or "no" to the predicted label, this labeling method can alleviate the pressure of manual labeling in machine learning that requires a large amount of correctly labeled data.

[0131] To facilitate understanding of the above Figure 7 Corresponding to the training method described in this application, the following example illustrates the entire training process: Please refer to Figure 8 , Figure 8A flow chart of the training method of the semi-supervised learning model provided in the embodiment of the present application is provided. Assume that the initial training set includes 330 training samples, of which 30 are labeled samples (such as Figure 8 The black triangle in the middle shows the image), and 300 are unlabeled samples (such as Figure 8 The 30 labeled samples constitute the first labeled sample set mentioned above, and the 300 unlabeled samples constitute the first unlabeled sample set mentioned above. First, the initial model is trained based on the 330 training samples in the initial training set (i.e. Figure 8 Initialization in, corresponding to stage 0), obtain the first model after training, then select some unlabeled samples from the 300 unlabeled samples to form the initial subset. Assuming that 100 unlabeled samples are randomly selected to form the initial subset, then these 100 unlabeled samples are sequentially input into the first model after training for prediction, and the corresponding 100 prediction labels are obtained respectively. These 100 prediction labels constitute the first prediction label set mentioned above. Afterwards, the training device divides the 100 selected unlabeled samples into positive label samples (such as Figure 8 The white triangle in the figure) and negative label samples (such as Figure 8 Assume that there are 40 positive label samples and 60 negative label samples, then these 40 positive label samples are integrated with the original 30 labeled samples to form a second labeled sample set. After removing the 100 selected unlabeled samples from the original 300 unlabeled samples, there are 200 unlabeled samples left. Then the remaining 200 unlabeled samples constitute the second unlabeled samples. The 60 negative label samples obtained according to the one-bit annotation constitute the negative label sample set. Therefore, the second labeled sample set, the second unlabeled sample set and the negative label sample set constitute the first training set of the first stage. According to the first training set, the trained second model (i.e. Figure 8 The model M1 in the first stage is the second model after the first training. Figure 8 Afterwards, the training device selects some unlabeled samples from the second unlabeled sample set to form the second stage (i.e. Figure 8Assume that 100 unlabeled samples are randomly selected to form the initial subset of the second stage (it can also be other numbers, not limited here), then these 100 unlabeled samples are sequentially input into the trained second model for prediction, and 100 corresponding prediction labels are obtained respectively. These 100 prediction labels constitute the first prediction label set (also called the second prediction label set) of the second stage. Afterwards, the training device divides the 100 selected unlabeled samples into positive labeled samples and negative labeled samples based on a one-bit labeling method. Assuming that the number of positive labeled samples is 65 and the number of negative labeled samples is 35, the 65 positive labeled samples are integrated with the existing 70 labeled samples to form the second labeled sample set of the second stage. After removing the 100 unlabeled samples selected in the second stage from the remaining 200 unlabeled samples in the first stage, there are still 100 unlabeled samples left. The remaining 100 unlabeled samples constitute the second unlabeled samples of the second stage. The 35 negative labeled samples obtained according to the one-bit labeling and the 60 negative labeled samples obtained in the first stage constitute the negative labeled sample set of the second stage. Therefore, the second labeled sample set, the second unlabeled sample set and the negative labeled sample set of the second stage constitute the first training set of the second stage (which can be called the second training set). According to the first training set of the second stage, the second model after training in the second stage (which can be called the third model, i.e., Figure 8 The second model after the second training is the second stage (i.e. Figure 8 Stage 2 in the above process). And so on, in the above manner, until the second unlabeled sample set is empty.

[0132] In addition, to further understand the implementation details of the semi-supervised learning model, the following takes the mean teacher model as an example to illustrate the entire training process of the mean teacher model (the training sample is a picture as an example): Fig. 9 , Fig. 9 This is a schematic diagram of the mean teacher model training process. The traditional semi-supervised learning method is based on the data set is the training set, where N is the number of all training samples, x n is the nth sample in the image data. Represents sample x n The true label of It is unknown to the training algorithm, especially only a small part of the set containing L samples is relevant is provided (i.e., the first labeled sample set described above in this application), generally speaking, L is smaller than N. That is, Divided into two subsets and Represent the labeled sample set and the unlabeled sample set respectively. The training method of this application is to divide the training set into three parts in, is the set of samples for one-bit labeling, There is no limit on the number of samples in . For each example in the model, the annotator is provided with the corresponding image and the model's predicted label for the image. The annotator's job is to determine whether the image belongs to the classification category specified by the true label to which the image belongs. If the prediction is correct, the image is assigned a positive label. Otherwise it is assigned a negative label, denoted as From the perspective of information theory, the annotator provides 1 bit of supervision information to the system by answering a yes or no question. For the labeling method that needs to obtain the correct label of the sample, the obtained supervision information is log 2 C is the total number of classification categories. For example, for a 100-category dataset, you can choose to annotate 10K correct labels, which provides 10K×log 2 100 = 66.4K bits of information. Or accurately label 5K samples, which provides 33.2K bits of information, and then the remaining 33.2K information is completed by answering yes or no questions. Since the annotator only needs to answer yes or no questions, this approach provides one bit of information, so the loss of labeling an image is reduced, and more one-bit labeling information can be obtained at the same loss.

[0133] Usually, when more training samples with correct labels are available, the accuracy of the model will be improved. Therefore, the most direct method is to divide the training process into multiple stages, each stage The model is strengthened by predicting some samples of the dataset, reconstructing the training set for the predicted labels, and then updating the model with the reconstructed training set. is As labeled data, Under the condition of unlabeled data, it is obtained through a semi-supervised learning process. In the embodiment of the present application, the Mean Teacher model is used for illustration, assuming that the following training is divided into T stages (the termination condition of the training is that all unlabeled samples have been selected). represents the set of unlabeled samples in the t-1th stage (that is, the set of negative label samples and unlabeled samples), Here we use and Denote the sample sets with correct prediction and wrong prediction respectively, and these two sets are initialized to empty sets. In the tth stage, firstly, A fixed number of subsets are randomly selected Then, using the model obtained in the previous stage for By checking the correct label, the sample predicted correctly is added to the positive label set Mispredicted samples are added to the negative label set So the entire training set is divided into three parts: a set with accurate labels Negatively labeled collection and unlabeled sample set final Then Updated to Get a stronger model.

[0134] Afterwards, the embodiment of the present application designs a label suppression method based on the mean Teacher model, that is, designs a loss function corresponding to negative label samples. The mean Teacher model consists of two parts: a teacher model and a student model. Given a training image, if it has a correct label, the corresponding cross entropy loss function is calculated. Regardless of whether the training image has a correct label or not, the distance between the output of a teacher model and a student model is calculated as an additional loss function. The additional loss function is the mean square error loss function. Also, let f(x; θ) be the expression function of the student model, where θ represents the corresponding network parameters of the learning model, and the teacher model is expressed as f(x; θ′), where θ′ is the corresponding network parameter of the teacher model. The corresponding loss function (i.e., the total loss) is defined as follows:

[0135]

[0136] Among them, λ and γ both represent balance coefficients, which are adjustable parameters obtained through training. It means taking the average of the predicted values ​​of all sample outputs at a certain stage, CE means the cross entropy loss function, and MSE means the mean square error loss function. Represents a positive label. For samples with correct labels, the output of the model is constrained by both the cross entropy term and the consistency term. For samples with negative labels, this method adds a new loss function based on the value of the relevant position of the output f(x; θ′) of the second term teacher model in the modified loss function, so that the probability score of the category corresponding to the negative label is suppressed to 0. For example, assuming there are 100 classification categories, the predicted value output by the mean teacher model is a 100-dimensional vector, and each dimension represents the predicted probability of the output prediction value corresponding to the classification category. Assuming that a certain picture is a negative label "not a dog", the second dimension is the probability of "dog", then for this picture, the second dimension can be set to 0, and the difference between the predicted value before modification and the predicted value after modification (i.e., the modified value) is the third term of the loss function described in this application.

[0137] In order to have a more intuitive understanding of the beneficial effects brought by the embodiments of the present application, the following is a further comparison of the technical effects brought by the embodiments of the present application. Based on the mean teacher model, the training method of semi-supervised learning provided by the embodiments of the present application is experimented on three popular image classification data sets, namely CIFAR100, Mini-Imagenet and Imagenet. For CIFAR100, this application uses a 26-layer shake-shake regularized deep residual network. For Mini-Imagenet and Imagenet, this application uses a 50-layer residual network. On CIFAR100 and Mini-Imagenet, this application trains a total of 180 epochs (i.e., the process of training the training sample once), and trains 60 epochs on Imagenet. The mean square error loss function is used as the consistency loss function on all three data sets. The weight parameter of the consistency loss function is 1000 on CIFAR100 and 100 on Mini-Imagenet and Imagenet. The size of each batch of samples (batch size) is adjusted according to the hardware conditions. The remaining parameter settings refer to the original settings of the mean teacher model. As can be seen from Table 1, experiments have proved that under the same number of bits of supervised information, the performance of the training method provided in the embodiment of the present application exceeds that of other semi-supervised training methods. The experimental results on three data sets (i.e., prediction accuracy) demonstrate the effectiveness of the method in the embodiment of the present application.

[0138] Table 1: Comparison of test results

[0139]

[0140] The present application also provides an image processing method. Fig.10 , Fig.10 A flowchart of an image processing method provided in an embodiment of the present application may include the following steps:

[0141] 1001. Acquire a target image.

[0142] The second semi-supervised learning model after the above training can be deployed on the execution device for application. Specifically, the execution device first obtains the target image.

[0143] 1002. Use the target image as input of the trained semi-supervised learning model, and output a prediction result of the target image.

[0144] Afterwards, the execution device uses the target image as the input of the trained semi-supervised learning model and outputs a prediction result of the target image. The trained semi-supervised learning model is the trained second semi-supervised learning model described in the above embodiment.

[0145] In the above-mentioned embodiment of the present application, an application method of the trained second semi-supervised learning model is explained, that is, it is used to predict the category of images. Compared with the semi-supervised learning model trained by the existing training method, the semi-supervised learning model provided by the embodiment of the present application improves the accuracy of target image recognition.

[0146] Since the trained semi-supervised learning model (i.e., the trained second model) of the embodiment of the present application can be used in the fields of intelligent security, safe cities, and intelligent terminals for image classification processing, for example, the trained semi-supervised learning model of the present application can be applied to various scenarios and problems in the fields of computer vision, such as some common tasks: face recognition, image classification, target detection, etc. Each type of scenario involves many trained semi-supervised learning models provided by the embodiment of the present application, and multiple application scenarios implemented in products will be introduced below.

[0147] (1) Album classification

[0148] Users store a large number of pictures on their mobile phones and cloud disks, and classifying and managing albums by category can improve the user experience. By using the trained semi-supervised learning model of the embodiment of the present application to classify the pictures in the album, an album arranged or stored by category can be obtained, which can facilitate users to classify and manage different object categories, thereby facilitating user searches, saving user management time, and improving the efficiency of album management.

[0149] Specifically, Fig.11As shown, when the semi-supervised learning model trained by the embodiment of the present application is used to classify the album, the pictures in the album can be first input into the trained semi-supervised learning model for feature extraction, and the predicted labels of the pictures (i.e., the predicted classification categories) are obtained based on the extracted features. Next, the pictures in the album are classified according to the classification categories of the pictures to obtain an album arranged according to the classification categories. Among them, when arranging the pictures in the album according to the classification categories, pictures belonging to the same category can be arranged in one row or one row. For example, in the final album, the pictures in the first row all belong to airplanes, and the pictures in the second row all belong to cars.

[0150] (2) Photographing and identifying objects

[0151] When taking photos, users can use the semi-supervised learning model trained in the embodiment of the present application to process the photos taken, and can automatically identify the category of the photographed object, for example, it can automatically identify what kind of flower, animal, etc. the photographed object is. For example, using the semi-supervised learning model trained in the embodiment of the present application to identify a shared bicycle taken in a photo, it can be identified that the object is a bicycle, and further, the relevant information of the bicycle can be displayed, as shown in the following example. Fig.12 shown.

[0152] (3) Target recognition

[0153] For the obtained pictures, the semi-supervised learning model trained in the embodiment of the present application can also be used to find pictures containing the target object, for example, Fig.13 As shown, the semi-supervised learning model trained in the embodiment of the present application can be used to find whether there is a target object in the street scene image obtained by taking a photo, such as whether there is Fig.13 The face model on the left.

[0154] (4) Object recognition for intelligent driving

[0155] In the application scenario of autonomous driving, the semi-supervised learning model trained in the embodiment of the present application can be used to process image data or images in video data captured by sensors (such as cameras) installed on the vehicle, so as to automatically identify the categories of various obstacles on the road during driving. For example, it can automatically identify whether there are obstacles on the road ahead of the vehicle and what kind of obstacles they are (such as key obstacles such as oncoming trucks, pedestrians, cyclists, or non-key obstacles such as roadside bushes, trees, buildings, etc.).

[0156] It should be understood that the album classification, photo object recognition, target recognition, object recognition for intelligent driving, etc. introduced above are only a few specific scenarios in which the image classification method of the embodiments of the present application is applied. The semi-supervised learning model trained in the embodiments of the present application is not limited to the above-mentioned scenarios when applied. It can be applied to any scenario that requires image classification or image recognition. As long as the fields and equipment can use the semi-supervised learning model, the trained semi-supervised learning model provided by the embodiments of the present application can be applied. No examples are given here.

[0157] On the basis of the above corresponding embodiments, in order to better implement the above solutions of the embodiments of the present application, the following also provides related devices for implementing the above solutions. Fig.14 , Fig.14 A structural schematic diagram of a training device provided in an embodiment of the present application, the training device 1400 includes: a selection module 1401, a guessing module 1402, a construction module 1403 and a training module 1404, wherein the selection module 1401 is used to select an initial subset from a first unlabeled sample set, and predict the initial subset through a trained first semi-supervised learning model to obtain a first predicted label set, the first semi-supervised learning model is obtained by training the initial semi-supervised learning model through an initial training set, and the initial training set includes a first labeled sample set and the first unlabeled sample set; the guessing module 1402 is used to divide the initial subset into a first subset and a second subset according to the first predicted label set, the first subset is a first subset for predicting the correct classification A sample set corresponding to a category, and the second subset is a sample set corresponding to a classification category predicted incorrectly; a construction module 1403 is used to construct a first training set, the first training set includes a second labeled sample set, a second unlabeled sample set and a negative label sample set, the second labeled sample set is a sample set with a correct classification category including the first labeled sample set and the first subset, the second unlabeled sample set is a set of unlabeled samples in the first unlabeled sample set except the initial subset, and the negative label sample set is a sample set with an incorrect classification category including the second subset; a training module 1404 is used to train the initial semi-supervised learning model according to the first training set to obtain a trained second semi-supervised learning model.

[0158] In the above-mentioned implementation mode of the present application, first, the classification categories of a part of unlabeled samples are predicted by the trained first semi-supervised learning model to obtain predicted labels, and the guessing module 1402 is used to determine whether each predicted label is correct. If the prediction is correct, the correct label of the sample (i.e., the positive label) is obtained, otherwise an incorrect label of the sample (i.e., the negative label) can be excluded. Then, in the next training stage, the construction module 1403 uses the above-mentioned information to reconstruct the training set (i.e., the first training set), and the training module 1404 is used to retrain the initial semi-supervised learning model according to the first training set, so as to improve the prediction accuracy of the model. In addition, since the guessing module 1402 only needs to answer "yes" or "no" to the predicted label, this labeling method can alleviate the pressure of manual labeling of a large amount of correctly labeled data in machine learning.

[0159] In one possible design, the network structure of the initial semi-supervised learning model can have multiple specific forms, for example, it can include any one of the following models: Π-model, VAT, LPDSSL, TNAR, pseudo-label, DCT, mean teacher model.

[0160] In the above-mentioned embodiments of the present application, it is explained which semi-supervised learning models can be applied to the training method provided in the embodiments of the present application, which has universality and selectivity.

[0161] In one possible design, if the initial semi-supervised learning model is a learning model with only one loss function, such as any one of Π-model, VAT, LPDSSL, TNAR, pseudo-label, and DCT, then the training module 1404 is specifically used to: for the second labeled sample set and the second unlabeled sample set, the initial semi-supervised learning model is trained using the first loss function according to the second labeled sample set and the second unlabeled sample set, and the first loss function is the original loss function loss1 of the initial semi-supervised learning model; for the negative label sample set, the initial semi-supervised learning model is trained using the second loss function according to the negative label sample set, and the second loss function (which can be called loss2) is the difference between the predicted value and the modified value output by the model, and the modified value is a value that sets the corresponding dimension of the incorrectly predicted classification category on the predicted value to zero, and the second loss function loss2 is the new loss function constructed for the unlabeled sample set described above. Finally, the initial model is updated according to loss = loss1 + σ*loss2, where σ represents the balance coefficient, which is an adjustable parameter obtained through training, and loss is the output value of the total loss function of the entire semi-supervised learning model. The training process is to make the total loss as small as possible.

[0162] In the above implementation of the present application, it is explained that when the loss function of the initial semi-supervised learning model is one, a new loss function can be constructed for the negative label sample set, that is, different loss functions are used for different types of sample sets in the training set, and then the initial semi-supervised learning model is trained based on the total loss function, which is more targeted.

[0163] In a possible design, the training method of the embodiment of the present application can be used to train the above-mentioned semi-supervised learning model that originally had only one loss function, and can also be used to train a semi-supervised learning model with two or more loss functions. The process is similar. Specifically, the initial semi-supervised learning model can be a mean teacher model. Since the training strategy of the mean teacher model is: assume that the training samples are labeled samples (x1, y1) and unlabeled samples x2, where y1 is the label of x1. The labeled sample (x1, y1) is input into the student model to calculate the output value loss11 of the loss function 1; the unlabeled sample x2 is input into the student model to calculate the predicted label label1, and the unlabeled sample x2 is subjected to some data processing (generally a disturbance process to increase noise) and then input into the teacher model to calculate the predicted label label2. If the mean teacher model is stable enough, the predicted label label1 and the predicted label label2 should be the same, that is, the teacher model can resist the disturbance of the unlabeled sample x2, that is, it is hoped that the predicted labels of the student model and the teacher model are as equal as possible, so the output value loss12 of the loss function 2 is obtained according to label1 and label2. Finally, the student model is updated according to loss = loss11 + λ*loss12, where λ represents the balance coefficient, which is an adjustable parameter obtained through training, and loss is the output value of the total loss function of the entire mean teacher model. The training process is to make this total loss as small as possible. Therefore, the training module 1404 is specifically used for: for the second labeled sample set, according to the second labeled sample set, using the third loss function to train the mean teacher model, the third loss function is the loss function 1 (i.e., loss11) described above; the training device will also train the mean teacher model according to the second labeled sample set and the second unlabeled sample set, using the fourth loss function, the fourth loss function is the loss function 2 (i.e., loss12) described above, the third loss function loss11 and the fourth loss function loss12 are both the original loss functions of the meanteacher model; in addition, for the negative label sample, the mean teacher model will also be trained according to the negative label sample set using the fifth loss function, the fifth loss function (which can be called loss13) is the difference between the predicted value and the modified value output by the model, the modified value is the value of setting the corresponding dimension of the predicted incorrect classification category on the predicted value to zero, the fifth loss function loss13 is the new loss function constructed for the unlabeled sample set described above.Finally, the initial mean teacher model is updated according to loss = loss11 + λ*loss12 + γ*loss13, where λ and γ represent balance coefficients, which are adjustable parameters obtained through training, and loss is the output value of the total loss function of the entire mean teacher model. The training process is to make the total loss as small as possible.

[0164] In the above implementation of the present application, it is explained that when the initial semi-supervised learning model is a mean teacher model, a new loss function can also be constructed for the negative label sample set, that is, different loss functions are used for different types of sample sets in the training set, and then the initial semi-supervised learning model is trained based on the total loss function, which is more targeted.

[0165] In one possible design, the third loss function may be a cross entropy loss function; and / or, the fourth loss function may be a mean square error loss function.

[0166] In the above implementation of the present application, the specific forms of the third loss function and the fourth loss function in the mean teacher model are explained, which are feasible.

[0167] In one possible design, the training device 1400 may also include: a trigger module 1405, which is used to use the second unlabeled sample set as a new first unlabeled sample set, and the second semi-supervised learning model as a new first semi-supervised learning model, triggering the selection module 1401, the guessing module 1402, the construction module 1403 and the training module 1404 to repeat corresponding steps until the second unlabeled sample set is empty.

[0168] In the above implementation of the present application, when more training samples with correct labels are available, the accuracy of the model will be improved. Therefore, the most direct method is to divide the training process into multiple stages, select some samples from the first unlabeled sample set for prediction in each stage, reconstruct the training set for the predicted labels, and then use the reconstructed training set to update the model, so that the generalization ability and prediction accuracy of the second semi-supervised learning model obtained after training in each stage are stronger than those of the second semi-supervised learning model obtained in the previous stage.

[0169] In one possible design, after training the initial semi-supervised learning model according to the first training set to obtain the trained second semi-supervised learning model, the trigger module 1405 can also be used to: deploy the trained second semi-supervised learning model on a target device, which is used to acquire a target image, and the trained second semi-supervised learning model is used to predict labels for the target image.

[0170] In the above-mentioned embodiment of the present application, the specific use of the trained second semi-supervised learning model is explained, that is, it is deployed on the target device to perform label prediction on the target image, that is, it is used to predict the category of the image. Compared with the semi-supervised learning model trained by the existing training method, the trained second semi-supervised learning model provided in the embodiment of the present application improves the accuracy of target image recognition.

[0171] In a possible design, the selection module 1401 is specifically configured to randomly select a preset number of unlabeled samples from the first unlabeled sample set to form an initial subset.

[0172] In the above-mentioned embodiment of the present application, an implementation method of how to select unlabeled samples from the first unlabeled sample set to form an initial subset is described, and the random selection method ensures the balance of the selected samples.

[0173] It should be noted that Fig.14 The information interaction, execution process, etc. between the modules / units in the training device 1400 described in the corresponding embodiment are the same as those in the present application. Figure 5-9 The corresponding embodiments are based on the same concept, and the specific contents can be found in the description of the aforementioned embodiments of this application, which will not be repeated here.

[0174] The present application also provides an execution device, see Fig.15 , Fig.15 A structural schematic diagram of an execution device provided in an embodiment of the present application, the execution device 1500 includes: an acquisition module 1501 and a recognition module 1502, wherein the acquisition module 1501 is used to acquire a target image; the recognition module 1502 is used to use the target image as an input of a trained semi-supervised learning model to output a prediction result of the target image, and the trained semi-supervised learning model is the trained second semi-supervised learning model described in the above embodiment.

[0175] In the above-mentioned embodiment of the present application, an application method of the trained second semi-supervised learning model is explained, that is, it is used to predict the category of images. Compared with the semi-supervised learning model trained by the existing training method, the semi-supervised learning model provided by the embodiment of the present application improves the accuracy of target image recognition.

[0176] It should be noted that Fig.15 The information interaction, execution process, etc. between the modules / units in the execution device 1500 described in the corresponding embodiment are the same as those in the present application. Fig.10 The corresponding embodiments are based on the same concept, and the specific contents can be found in the description of the aforementioned embodiments of this application, which will not be repeated here.

[0177] Next, a training device provided by an embodiment of the present application is introduced. Fig.16 , Fig.16 A schematic diagram of a structure of a training device provided in an embodiment of the present application, wherein the training device 1600 may be deployed with Fig.14 The training device 1400 described in the corresponding embodiment is used to implement Figure 5-9 The functions of the training device in the corresponding embodiment, specifically, the training device 1600 is implemented by one or more servers, and the training device 1600 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1622 (for example, one or more central processing units) and memory 1632, one or more storage media 1630 (for example, one or more mass storage devices) storing application programs 1642 or data 1644. Among them, the memory 1632 and the storage medium 1630 can be short-term storage or permanent storage. The program stored in the storage medium 1630 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device 1600. Furthermore, the central processing unit 1622 can be configured to communicate with the storage medium 1630 to execute a series of instruction operations in the storage medium 1630 on the training device 1600.

[0178] The training device 1600 may also include one or more power supplies 1626, one or more wired or wireless network interfaces 1650, one or more input and output interfaces 1658, and / or, one or more operating systems 1641, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0179] In the embodiment of the present application, the central processor 1622 is used to execute Figure 7The training method of the semi-supervised learning model executed by the training device in the corresponding embodiment. Specifically, the central processor 1622 is used to: first, train the initial semi-supervised learning model (which can be referred to as the initial model) according to the acquired initial training set, so as to obtain the first semi-supervised learning model after training (which can be referred to as the first model after training), in which one part of the initial training set is labeled samples and the other part is unlabeled samples, wherein this part of labeled samples is called the first labeled sample set, and this part of unlabeled samples is called the first unlabeled sample set. After obtaining the trained first model, an initial subset is selected from the first unlabeled sample set in the initial training set, and each unlabeled sample in the initial subset constitutes test data for testing the trained first model, and each unlabeled sample in the selected initial subset is predicted by the trained first model, so as to obtain the prediction label corresponding to each selected unlabeled sample (the trained first model will output the probability prediction of each selected unlabeled sample on each classification category, and usually select the classification category with the largest probability as the model's prediction label for the sample), and each prediction label constitutes the first prediction label set. After obtaining the first predicted label set, the initial subset will be labeled with one bit according to the first predicted label set. 22 = 1 bit of information (i.e., "yes" or "no"), so it is called one-bit labeling. As mentioned above, the one-bit labeling method is specifically as follows: the labeler answers a "yes" or "no" question for the predicted label corresponding to each predicted sample. If the predicted label is a correctly predicted classification category, the positive label (also called the correct label) of the unlabeled sample is obtained. For example, if the predicted label is "dog", the true label of the unlabeled sample is also "dog", then the prediction is correct, and the unlabeled sample obtains the positive label "dog"; if the predicted label is an incorrectly predicted classification category, the negative label of the unlabeled sample is obtained, thereby eliminating an incorrect label of the unlabeled sample. For example, if the predicted label is "cat", the true label of the unlabeled sample is indeed "dog", then the prediction is wrong, and the unlabeled sample obtains the negative label "not a cat". After one-bit labeling, the initial subset is divided into a first subset and a second subset, wherein the first subset is a sample set corresponding to the correctly predicted classification category (i.e., positive label), and the second subset is a sample set corresponding to the incorrectly predicted classification category (i.e., negative label). After obtaining the result of one-bit labeling, the corresponding number of positive labels and negative labels are obtained. After that, the training set is reconstructed. The reconstructed training set can be called the first training set. The specific construction method can be to put the positive label samples (i.e., the first subset) together with the existing labeled samples as the labeled samples of this stage, which can also be called the second labeled sample set; each negative label sample (i.e., the second subset) constitutes the negative label sample set of this stage; the remaining unlabeled samples in the first unlabeled sample set constitute the second unlabeled sample set of this stage. These three types of samples together constitute the first training set. After constructing the first training set, the initial model is retrained based on the first training set to obtain a second semi-supervised learning model with stronger training capabilities (which can be simply referred to as the trained second model).

[0180] It should be noted that the specific manner in which the CPU 1622 performs the above steps is different from that in the present application. Figure 7 The corresponding method embodiments are based on the same concept, and the technical effects they bring are the same as those in this application. Figure 7 The corresponding embodiments are the same, and the specific contents can be found in the description of the method embodiments shown above in this application, which will not be repeated here.

[0181] Next, an execution device provided by an embodiment of the present application is introduced. Fig.17 , Fig.17 A schematic diagram of the structure of the execution device provided in the embodiment of the present application, the execution device 1700 can be specifically manifested as various terminal devices, such as virtual reality VR devices, mobile phones, tablets, laptops, smart wearable devices, monitoring data processing devices or radar data processing devices, etc., which are not limited here. Among them, the execution device 1700 can be deployed with Fig.15The execution device 1500 described in the corresponding embodiment is used to implement Fig.10 The function of the execution device in the corresponding embodiment. Specifically, the execution device 1700 includes: a receiver 1701, a transmitter 1702, a processor 1703 and a memory 1704 (wherein the number of the processor 1703 in the execution device 1700 can be one or more, Fig.17 In the example of FIG. 1701 , a processor 1703 is used, where the processor 1703 may include an application processor 17031 and a communication processor 17032. In some embodiments of the present application, the receiver 1701, the transmitter 1702, the processor 1703 and the memory 1704 may be connected via a bus or other means.

[0182] The memory 1704 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1703. A portion of the memory 1704 may also include a non-volatile random access memory (NVRAM). The memory 1704 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.

[0183] The processor 1703 controls the operation of the execution device 1700. In a specific application, the various components of the execution device 1700 are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are referred to as bus systems in the figure.

[0184] This application Figure 4 The method disclosed in the corresponding embodiment can be applied to the processor 1703, or implemented by the processor 1703. The processor 1703 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 1703 or instructions in software form. The above-mentioned processor 1703 can be a general-purpose processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 1703 can implement or execute the present application Fig.10The methods, steps and logic block diagrams disclosed in the corresponding embodiments. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor, or a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1704, and the processor 1703 reads the information in the memory 1704, and completes the steps of the above method in combination with its hardware.

[0185] The receiver 1701 can be used to receive input digital or character information, and generate signal input related to the relevant settings and function control of the execution device 1700. The transmitter 1702 can be used to output digital or character information through the first interface; the transmitter 1702 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1702 can also include a display device such as a display screen.

[0186] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a program for performing signal processing. When the program is run on a computer, the computer executes the steps executed by the execution device in the description of the embodiment shown above.

[0187] The training device, execution device, etc. provided in the embodiments of the present application may be specifically a chip, and the chip includes: a processing unit and a communication unit, the processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit, etc. The processing unit may execute the computer execution instructions stored in the storage unit, so that the chip in the training device executes the above Figure 5-9 The training method of the semi-supervised learning model described in the embodiment shown, or the chip in the execution device executes the above Fig.10 The image processing method described in the illustrated embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc., and the storage unit may also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

[0188] For details, please refer to Fig.18 , Fig.18A schematic diagram of the structure of a chip provided in an embodiment of the present application, the chip can be expressed as a neural network processor NPU 200, NPU 200 is mounted on the host CPU (Host CPU) as a coprocessor, and the host CPU assigns tasks. The core part of the NPU is the operation circuit 2003, which is controlled by the controller 2004 to extract matrix data from the memory and perform multiplication operations.

[0189] In some implementations, the operation circuit 2003 includes multiple processing units (Process Engine, PE) inside. In some implementations, the operation circuit 2003 is a two-dimensional systolic array. The operation circuit 2003 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the operation circuit 2003 is a general-purpose matrix processor.

[0190] For example, suppose there is an input matrix A, a weight matrix B, and an output matrix C. The operation circuit takes the corresponding data of matrix B from the weight memory 2002 and caches it on each PE in the operation circuit. The operation circuit takes the matrix A data from the input memory 2001 and performs matrix operation with matrix B. The partial result or final result of the matrix is ​​stored in the accumulator 2008.

[0191] The unified memory 2006 is used to store input data and output data. The weight data is directly transferred to the weight memory 2002 through the direct memory access controller (DMAC) 2005. The input data is also transferred to the unified memory 2006 through the DMAC.

[0192] BIU stands for Bus Interface Unit 2010 , which is used for the interaction between the AXI bus and the DMAC and the instruction fetch buffer (IFB) 2009 .

[0193] The bus interface unit 2010 (Bus Interface Unit, BIU for short) is used for the instruction fetch memory 2009 to obtain instructions from the external memory, and is also used for the storage unit access controller 2005 to obtain the original data of the input matrix A or the weight matrix B from the external memory.

[0194] DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 2006 or to transfer weight data to the weight memory 2002 or to transfer input data to the input memory 2001.

[0195] The vector calculation unit 2007 includes multiple operation processing units, which further process the output of the operation circuit when necessary, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as Batch Normalization, pixel-level summation, upsampling of feature planes, etc.

[0196] In some implementations, the vector calculation unit 2007 can store the processed output vector to the unified memory 2006. For example, the vector calculation unit 2007 can apply a linear function and / or a nonlinear function to the output of the operation circuit 2003, such as linear interpolation of the feature plane extracted by the convolution layer, and then, for example, a vector of accumulated values ​​to generate an activation value. In some implementations, the vector calculation unit 2007 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 2003, for example, for use in a subsequent layer in a neural network.

[0197] An instruction fetch buffer 2009 connected to the controller 2004, for storing instructions used by the controller 2004;

[0198] The unified memory 2006, the input memory 2001, the weight memory 2002 and the instruction fetch memory 2009 are all on-chip memories. The external memory is private to the NPU hardware architecture.

[0199] The processor mentioned in any of the above places may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the program of the above-mentioned first aspect method.

[0200] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0201] Through the description of the above implementation mode, the technicians in the relevant field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0202] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0203] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (digital video disc, DVD), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.

Claims

1. A training method for a semi-supervised learning model, characterized in that: include: Selecting an initial subset from the first unlabeled sample set, and predicting the initial subset through a trained first semi-supervised learning model to obtain a first predicted label set, wherein the first semi-supervised learning model is obtained by training the initial semi-supervised learning model through an initial training set, and the initial training set includes a first labeled sample set and the first unlabeled sample set; Performing one-bit labeling on the initial subset according to the first prediction label set, dividing the initial subset into a first subset and a second subset, wherein the first subset is a set of samples corresponding to a correctly predicted classification category, and the second subset is a set of samples corresponding to an incorrectly predicted classification category, wherein the one-bit labeling is used to indicate that 1 bit of information is provided; Constructing a first training set, wherein the first training set includes a second labeled sample set, a second unlabeled sample set, and a negative labeled sample set, wherein the second labeled sample set is a set of samples with correctly classified categories including the first labeled sample set and the first subset, the second unlabeled sample set is a set of unlabeled samples in the first unlabeled sample set except the initial subset, and the negative labeled sample set is a set of samples with incorrectly classified categories including the second subset; The initial semi-supervised learning model is trained according to the first training set to obtain a trained second semi-supervised learning model, wherein, in the case where the initial semi-supervised learning model is a mean teacher model, the method of training the initial semi-supervised learning model according to the first training set includes: according to the second labeled sample set, the mean teacher model is trained using a third loss function, according to the second labeled sample set and the second unlabeled sample set, the mean teacher model is trained using a fourth loss function, the third loss function and the fourth loss function are the original loss functions of the mean teacher model, according to the negative label sample set, the mean teacher model is trained using a fifth loss function, the fifth loss function is the difference between the predicted value and the modified value output by the model, and the modified value is a value that sets the corresponding dimension of the wrongly predicted classification category on the predicted value to zero; The trained second semi-supervised learning model is deployed on a target device, the target device is used to obtain a target image, and the trained second semi-supervised learning model is used to perform label prediction on the target image.

2. The method according to claim 1, characterized in that The third loss function is a cross entropy loss function; and / or, The fourth loss function is a mean square error loss function.

3. The method according to any one of claims 1 to 2, characterized in that: The method further comprises: The second unlabeled sample set is used as a new first unlabeled sample set, and the second semi-supervised learning model is used as a new first semi-supervised learning model, and the above steps are repeated until the second unlabeled sample set is empty.

4. The method according to any one of claims 1 to 3, characterized in that The selecting an initial subset from the first unlabeled sample set comprises: A preset number of unlabeled samples are randomly selected from the first unlabeled sample set to form the initial subset.

5. An image processing method, characterized in that: include: Get the target image; The target image is used as the input of the trained semi-supervised learning model, and a prediction result of the target image is output. The trained semi-supervised learning model is the second semi-supervised learning model in the method according to any one of claims 1 to 4.

6. A training device, characterized in that: include: A selection module is used to select an initial subset from a first unlabeled sample set, and predict the initial subset through a trained first semi-supervised learning model to obtain a first predicted label set, wherein the first semi-supervised learning model is obtained by training the initial semi-supervised learning model through an initial training set, and the initial training set includes a first labeled sample set and the first unlabeled sample set; a guessing module, configured to perform one-bit labeling on the initial subset according to the first prediction label set, and divide the initial subset into a first subset and a second subset, wherein the first subset is a sample set corresponding to a correctly predicted classification category, and the second subset is a sample set corresponding to an incorrectly predicted classification category, wherein the one-bit labeling is used to indicate that 1 bit of information is provided; A construction module is used to construct a first training set, wherein the first training set includes a second labeled sample set, a second unlabeled sample set and a negative labeled sample set, wherein the second labeled sample set is a set of samples with correct classification categories including the first labeled sample set and the first subset, the second unlabeled sample set is a set of unlabeled samples in the first unlabeled sample set except the initial subset, and the negative labeled sample set is a set of samples with incorrect classification categories including the second subset; A training module, used to train the initial semi-supervised learning model according to the first training set to obtain a trained second semi-supervised learning model, wherein, when the initial semi-supervised learning model is a mean teacher model, the method of training the initial semi-supervised learning model according to the first training set includes: according to the second labeled sample set, using a third loss function to train the mean teacher model, according to the second labeled sample set and the second unlabeled sample set, using a fourth loss function to train the mean teacher model, the third loss function and the fourth loss function are the original loss functions of the mean teacher model, according to the negative label sample set, using a fifth loss function to train the mean teacher model, the fifth loss function is the difference between the predicted value and the modified value output by the model, and the modified value is a value that sets the corresponding dimension of the incorrectly predicted classification category on the predicted value to zero; A trigger module is used to deploy the trained second semi-supervised learning model on a target device, where the target device is used to obtain a target image, and the trained second semi-supervised learning model is used to perform label prediction on the target image.

7. The device according to claim 6, characterized in that The third loss function is a cross entropy loss function; and / or, The fourth loss function is a mean square error loss function.

8. The device according to any one of claims 6-7, characterized in that The trigger module is further used for: The second unlabeled sample set is used as a new first unlabeled sample set, and the second semi-supervised learning model is used as a new first semi-supervised learning model, triggering the selection module, the guessing module, the construction module and the training module to repeat the corresponding steps until the second unlabeled sample set is empty.

9. The device according to any one of claims 6 to 8, characterized in that The selection module is specifically used for: A preset number of unlabeled samples are randomly selected from the first unlabeled sample set to form the initial subset.

10. An execution device, characterized in that: include: An acquisition module, used for acquiring a target image; A recognition module is used to use the target image as an input of a trained semi-supervised learning model and output a prediction result of the target image. The trained semi-supervised learning model is the second semi-supervised learning model in the method according to any one of claims 1 to 4.

11. A training device, comprising a processor and a memory, characterized in that: The processor is coupled to the memory, and is characterized in that: The memory is used to store programs; The processor is used to execute the program in the memory so that the training device executes the method as described in any one of claims 1-4.

12. An execution device, comprising a processor and a memory, characterized in that: The processor is coupled to the memory, and is characterized in that: The memory is used to store programs; The processor is used to execute the program in the memory so that the execution device executes the method according to claim 5.

13. A computer-readable storage medium comprising a program, characterized in that: When the method is executed on a computer, the method enables the computer to execute the method according to any one of claims 1 to 4, or enables the computer to execute the method according to claim 5.

14. A computer program product comprising instructions, characterized in that When the method is executed on a computer, the method enables the computer to execute the method according to any one of claims 1 to 4, or enables the computer to execute the method according to claim 5.

15. A chip, comprising a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface to execute the method according to any one of claims 1 to 4, or executes the method according to claim 5.

Citation Information

Patent Citations

  • High-efficiency SVM active half-supervision learning algorithm

    CN104318242A

  • Model training method and apparatus, and data recognizing method

    CN106548190A

  • Data sample tag processing method and apparatus

    CN108021931A

Cited By

  • Training method for semi-supervised learning model, image processing method, and device

    WO2022042002A1