A model training method, device and equipment

By using the distribution information of labeled samples as the initial parameters for training unlabeled samples, and by cyclically using both labeled and unlabeled samples, the problem of noise interference from pseudo-label generation is solved, thereby improving the performance and accuracy of the model.

CN116433993BActive Publication Date: 2026-04-14MASHANG CONSUMER FINANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MASHANG CONSUMER FINANCE CO LTD
Filing Date
2021-12-29
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing pseudo-label-based semi-supervised learning methods are susceptible to noise interference during pseudo-label generation, leading to a decrease in model performance and accuracy.

Method used

By using a small number of labeled samples to calculate the distribution information corresponding to each category label, and using it as the initial parameters for training unlabeled samples, the model's performance and accuracy can be improved by iterating through labeled and unlabeled samples to predict the category and distribution information of unlabeled samples.

Benefits of technology

It effectively improved the model's performance and the accuracy of data distribution prediction, and reduced the noise impact of unlabeled samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116433993B_ABST
    Figure CN116433993B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification disclose a model training method, device and equipment, the method comprising: training a first model based on first samples with a first category label and initial distribution information of first samples corresponding to different first category labels, determining the first distribution information of the first samples corresponding to different first category labels, and the first model after training; continuing to train the first model based on second samples and the first distribution information of the first samples corresponding to different first category labels, determining a second category label corresponding to the second samples, and second distribution information of second samples corresponding to different second category labels and the first model after continuing to train, at least one of the second samples comprising a sample without a category label; updating the initial distribution information based on the second distribution information, and updating the first samples based on the second samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a model training method, apparatus and device. Background Technology

[0002] The purpose of semi-supervised learning is to improve the performance of semi-supervised learning models by using a small number of labeled samples and a large number of unlabeled samples.

[0003] Currently, the commonly used semi-supervised learning method is pseudo-label-based learning. This method uses a trained model to predict the label distribution of input samples, obtaining the predicted class label distribution. From this, class labels with higher confidence are selected as pseudo-labels for the corresponding samples, and the model is then trained accordingly. However, the generation of pseudo-labels inevitably introduces noise, significantly impacting the performance and accuracy of pseudo-label-based semi-supervised learning methods. Summary of the Invention

[0004] The purpose of the embodiments in this specification is to provide a technical solution to improve the performance and accuracy of model training.

[0005] To solve the above-mentioned technical problems, the embodiments in this specification are implemented as follows:

[0006] Firstly, an embodiment of this specification provides a model training method, the method comprising:

[0007] The first model is trained based on the initial distribution information of the first samples with the first category label and the first samples corresponding to different first category labels, to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model.

[0008] The first model is trained again based on the first distribution information of the second sample and the first sample corresponding to different first category labels, to determine the second category label corresponding to the second sample, the second distribution information of the second sample corresponding to different second category labels, and the first model after further training. The second sample includes at least the sample without a category label.

[0009] The initial distribution information is updated based on the second distribution information, and the first sample is updated based on the second sample;

[0010] Based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, the first model is trained again through the above steps until a first model that meets the preset convergence condition is obtained.

[0011] Secondly, an image classification method is provided in the embodiments of this specification, the method comprising:

[0012] Obtain the target image to be classified;

[0013] The target image is input into a pre-trained first model to obtain the classification result corresponding to the target image. The first model is obtained by training the model through a first sample with a first category label, the initial distribution information of the first sample corresponding to different first category labels, and a second sample, and by iteratively updating the sample and the distribution information of the sample.

[0014] Thirdly, the embodiments of this specification provide a model training apparatus, the apparatus comprising:

[0015] The first training module is configured to train the first model based on the initial distribution information of the first samples with a first category label and the first samples corresponding to different first category labels, and to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model.

[0016] The second training module is configured to continue training the first model based on the second sample and the first distribution information of the first sample corresponding to different first category labels, to determine the second category label corresponding to the second sample, the second distribution information of the second sample corresponding to different second category labels, and the first model after continued training, wherein the second sample includes at least samples without category labels;

[0017] The update module is configured to update the initial distribution information based on the second distribution information, and to update the first sample based on the second sample;

[0018] The third training model is configured to continue training the first model based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, through the above steps, until a first model that meets the preset convergence condition is obtained.

[0019] Fourthly, an image classification device is provided in the embodiments of this specification, the device comprising:

[0020] The image acquisition module is configured to acquire the target image to be classified.

[0021] The image input module is configured to input the target image into a pre-trained first model to obtain the classification result corresponding to the target image. The first model is obtained by training the model through a first sample with a first category label, initial distribution information of the first samples corresponding to different first category labels, and a second sample, and by iteratively updating the samples and the distribution information of the samples.

[0022] Fifthly, an embodiment of this specification provides a model training device, the device comprising:

[0023] Processor; and

[0024] A memory configured to store computer-executable instructions, which, when executed, cause the processor to:

[0025] The first model is trained based on the initial distribution information of the first samples with the first category label and the first samples corresponding to different first category labels, to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model.

[0026] The first model is trained again based on the first distribution information of the second sample and the first sample corresponding to different first category labels, to determine the second category label corresponding to the second sample, the second distribution information of the second sample corresponding to different second category labels, and the first model after further training. The second sample includes at least the sample without a category label.

[0027] The initial distribution information is updated based on the second distribution information, and the first sample is updated based on the second sample;

[0028] Based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, the first model is trained again through the above steps until a first model that meets the preset convergence condition is obtained.

[0029] Sixthly, an embodiment of this specification provides a storage medium for storing computer-executable instructions, which, when executed, implement the following process:

[0030] The first model is trained based on the initial distribution information of the first samples with the first category label and the first samples corresponding to different first category labels, to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model.

[0031] The first model is trained again based on the first distribution information of the second sample and the first sample corresponding to different first category labels, to determine the second category label corresponding to the second sample, the second distribution information of the second sample corresponding to different second category labels, and the first model after further training. The second sample includes at least the sample without a category label.

[0032] The initial distribution information is updated based on the second distribution information, and the first sample is updated based on the second sample;

[0033] Based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, the first model is trained again through the above steps until a first model that meets the preset convergence condition is obtained.

[0034] Seventhly, an image classification device is provided in the embodiments of this specification, the image classification device comprising:

[0035] Processor; and

[0036] A memory configured to store computer-executable instructions, which, when executed, cause the processor to:

[0037] Obtain the target image to be classified;

[0038] The target image is input into a pre-trained first model to obtain the classification result corresponding to the target image. The first model is obtained by training the model through a first sample with a first category label, the initial distribution information of the first sample corresponding to different first category labels, and a second sample, and by iteratively updating the sample and the distribution information of the sample.

[0039] Eighthly, embodiments of this specification also provide a storage medium for storing computer-executable instructions, which, when executed, perform the following process:

[0040] Obtain the target image to be classified;

[0041] The target image is input into a pre-trained first model to obtain the classification result corresponding to the target image. The first model is obtained by training the model through a first sample with a first category label, the initial distribution information of the first sample corresponding to different first category labels, and a second sample, and by iteratively updating the sample and the distribution information of the sample.

[0042] As can be seen, in the embodiments of this specification, by using a small number of labeled samples, the distribution information of the labeled samples corresponding to each category label is calculated, and the sample distribution information corresponding to the category label of the labeled samples is used as the initial parameters for training unlabeled samples to predict the distribution information of the category corresponding to the unlabeled samples. In this way, by continuously using labeled samples and unlabeled samples, the category of the unlabeled samples and the true distribution of the unlabeled samples corresponding to that category are predicted, thereby effectively improving the performance of the model and the accuracy of the model in predicting the data distribution. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a schematic flowchart of a model training method provided in the embodiments of this specification;

[0045] Figure 2 This is another flowchart illustrating the model training method provided in the embodiments of this specification;

[0046] Figure 3 This is another flowchart illustrating the model training method provided in the embodiments of this specification;

[0047] Figure 4 This is a schematic diagram of the system architecture of the image classification method provided in the embodiments of this specification;

[0048] Figure 5 This is a schematic flowchart of an image classification method provided in the embodiments of this specification;

[0049] Figure 6 A schematic diagram of the module composition of the model training device provided in the embodiments of this specification;

[0050] Figure 7 This is a schematic diagram of the module composition of an image classification device provided in the embodiments of this specification;

[0051] Figure 8 This is a schematic diagram of the structure of a model training device provided in an embodiment of this specification. Detailed Implementation

[0052] This specification provides a model training method, apparatus, and device through its embodiments.

[0053] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.

[0054] The inventive concept of this application is as follows: Currently, deep learning methods have achieved significant success in artificial intelligence fields such as computer vision and speech recognition. The quality of deep learning is highly dependent on the amount of labeled data used in the learning process; the more labeled data, the more effective the trained deep learning method. However, due to factors such as the high cost of manual annotation and the ever-increasing amount of data, it is impossible to annotate an unlimited amount of data. Therefore, a large amount of unlabeled data urgently needs to be utilized. Currently, to address the problem of a small amount of labeled data and a large amount of unlabeled data, semi-supervised learning methods are commonly used to improve the performance of neural networks by utilizing a small number of labeled samples and a large number of unlabeled samples. The semi-supervised learning method commonly used in the semi-supervised learning process is a pseudo-label-based learning method. The pseudo-label-based learning method uses an intermediate model trained to a certain extent to predict the label distribution of input samples, and based on the results, selects samples with high confidence as pseudo-labeled samples, and uses them to train the corresponding model subsequently. However, the inevitable noise interference during the generation of pseudo-labels significantly impacts the pseudo-label-based semi-supervised learning method, thereby reducing the model's performance and the accuracy of data processing using the model.

[0055] Based on the above problems, this technical solution utilizes a small number of labeled samples to calculate the distribution information of the labeled samples corresponding to each category label. The distribution information of the labeled samples corresponding to each category label is then used as the initial parameters for training unlabeled samples to predict the distribution information of the category corresponding to the unlabeled samples. By continuously using labeled and unlabeled samples, the distribution of the category of the unlabeled samples and the true distribution of the unlabeled samples corresponding to that category are predicted, thereby effectively improving the performance of the model and the accuracy of the model's prediction of data distribution.

[0056] like Figure 1 As shown in the embodiments of this specification, a model training method is provided. The execution entity of this method can be a server, which can be a single independent server or a server cluster composed of multiple different servers, depending on the actual situation. This method can be applied to semi-supervised model training, etc.

[0057] This method may specifically include the following steps:

[0058] In step S102, the first model is trained based on the initial distribution information of the first samples with the first category label and the first samples corresponding to different first category labels, to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model.

[0059] Here, the aforementioned sample refers to a specific instance of data. One sample represents an object, and a sample can usually be represented by a feature vector. The aforementioned first sample refers to data that simultaneously contains features and labels. Specifically, the aforementioned first sample can be an image sample, a text sample, etc. The aforementioned first model can be any model that can be trained using a semi-supervised learning method. For example, the first model can be a risk control model applied in financial business. The aforementioned initial distribution information of the first sample can be the prior distribution information of the first samples corresponding to different first category labels obtained through a preset method. This prior distribution information can be a type of probability distribution, which is unrelated to the experimental results or the sampling results. It reflects the distribution information obtained before conducting the statistical experiment based on knowledge of other relevant parameters. For example, if the labels include A, B, and C, the label of samples X1 and X2 is A, the label of samples X3, X4, and X5 is B, and the label of samples X6, X7, X8, X9, and X10 is C, and the total number of samples is 10, then the probability distribution of the sample corresponding to label A is 20%, the probability distribution of the sample corresponding to label B is 30%, and the probability distribution of the sample corresponding to label C is 50%. In this way, the prior distribution information of the first sample can be represented numerically based on the specific numerical values ​​of the sample distribution probability corresponding to each category label, or graphically based on the specific numerical values ​​of the sample distribution probability corresponding to the different category labels. This prior distribution information can be obtained from experimental data, expert judgment, or personal experience data. This data can be represented through historical data, confidence intervals, quantiles, or upper and lower limits of preset reliability parameters. Before use, this prior distribution information needs to undergo compatibility testing and credibility analysis. The compatibility testing can include significance testing, robustness analysis, and Smirnov testing. The selection methods for the prior distribution information can include Bayesian hypothesis and conjugate distribution method. The first distribution information of the first sample corresponding to the first category label can be a more realistic posterior distribution information of the first sample corresponding to the first category label, with a specific information distribution form similar to the initial distribution information. The trained first model can be the first model obtained by updating the model parameters based on the first distribution information of the first samples corresponding to the different first category labels.

[0060] In some optional implementations, the initial distribution information of the first samples corresponding to the first category label can be obtained in advance based on the first samples with the first category label, and a first model can be constructed based on the initial distribution information of the first samples. Then, a preset number of first samples with the first category are input into the constructed first model to train the first samples, and the first distribution information of the first samples corresponding to different first category labels and the trained first model are determined through the first model.

[0061] In step S104, the first model is trained again based on the first distribution information of the second sample and the first samples corresponding to different first category labels, to determine the second category label corresponding to the second sample, the second distribution information of the second samples corresponding to different second category labels, and the first model after further training. The second sample includes at least samples without category labels.

[0062] The second sample mentioned above can be a sample without a category label, that is, an unlabeled sample, or it can be a sample that contains both category labels and unlabeled samples. This specification is just an example and does not make any specific limitations.

[0063] In one alternative implementation, it can be assumed that the different first category labels corresponding to the first sample are the same as or similar to the initial category labels of the second sample, and the first distribution information of the first samples corresponding to the different first category labels is used as the initial distribution information of the second samples corresponding to the initial category labels. The first model after training is then trained to determine the second category label corresponding to the second sample, the second distribution information of the second samples corresponding to the different second category labels, and the first model after further training.

[0064] In step S106, the initial distribution information is updated based on the second distribution information, and the first sample is updated based on the second sample.

[0065] In one optional implementation, the second category label corresponding to the second sample can be obtained through the above method. In this case, the second sample with the second category label can be considered as a sample with a category label. Thus, the initial first sample in the above steps can be updated using the sample with the category label to obtain the updated first sample. Then, based on the second distribution information of the second samples corresponding to different second category labels, the initial distribution information of the first samples corresponding to different first category labels is updated to obtain the updated initial distribution information of the first samples corresponding to different first category labels. Afterwards, based on the updated first sample and the updated initial distribution information of the first samples corresponding to different first category labels, the first model obtained in step S104 is trained.

[0066] In step S108, based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, the first model is trained again through the above steps until a first model that meets the preset convergence condition is obtained.

[0067] In one optional implementation, based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, the training process from step S102 to step S106 is repeatedly executed to iteratively train the first model. When the number of iterations reaches the preset number of iterations, the first model that currently satisfies the preset convergence condition can be obtained. Alternatively, when the loss value corresponding to the first model reaches the preset threshold, the first model that currently satisfies the preset convergence condition can be obtained.

[0068] As can be seen, in the embodiments of this specification, by using a small number of labeled samples, the distribution information of the labeled samples corresponding to each category label is calculated, and the sample distribution information corresponding to the category label of the labeled samples is used as the initial parameters for training unlabeled samples to predict the distribution information of the category corresponding to the unlabeled samples. In this way, by continuously using labeled samples and unlabeled samples, the category of the unlabeled samples and the true distribution of the unlabeled samples corresponding to that category are predicted, thereby effectively improving the performance of the model and the accuracy of the model in predicting the data distribution.

[0069] In one or more embodiments of this specification, in order to further improve the model performance of the trained first model, the model convergence conditions for training the first model can be set, such as... Figure 2 As shown, there are many different processing methods for step S106. Here is another optional processing method. For details, please refer to the specific processing procedures of steps S1062-S1066 below.

[0070] In step S1062, the first sample is input into the first model after further training, and the first model outputs the third category label corresponding to the first sample.

[0071] In one alternative implementation, after the execution entity obtains the first model after further training through the processing in step S104, it can input the first sample into the first model after further training and output the third category label corresponding to the first sample through the first model after further training.

[0072] In step S1064, the loss information corresponding to the first model is determined based on the first category label corresponding to the first sample and the third category label corresponding to the first sample.

[0073] In some optional implementations, since the first category label is the true category label corresponding to the first sample, and the third category label is the category label information predicted by the first distribution information of the second sample and the first samples corresponding to different first category labels, the execution entity can determine the loss information corresponding to the first model based on the first category label corresponding to the first sample and the third category label corresponding to the first sample.

[0074] In step S1066, if the loss information does not meet the preset convergence condition, the initial distribution information is updated based on the second distribution information, and the first sample is updated based on the second sample.

[0075] In one optional implementation, the execution entity can determine the loss information corresponding to the first model based on the determined first category label and the third category label corresponding to the first sample, and adjust the model parameters of the first model based on the loss information. Specifically, if the loss information does not meet the preset convergence condition, the initial distribution information of the first samples corresponding to different first category labels will continue to be updated based on the second distribution information of the second samples corresponding to different second category labels, and the first samples will be updated based on the second samples until the determined loss information meets the preset convergence condition, and the trained first model is obtained.

[0076] In one or more embodiments of this specification, considering the noise and other issues present in unlabeled data in semi-supervised deep learning methods, which may affect the performance of the trained model, this embodiment utilizes a small amount of labeled data (first samples) to calculate the distribution information of the first samples corresponding to each category label, and uses this distribution information as the initial distribution information of unlabeled samples to predict the category labels and distribution information of unlabeled samples, thereby effectively reducing the noise problem of unlabeled samples and further improving the performance of the model.

[0077] In one or more embodiments of this specification, before training the first model, it is necessary to determine the true distribution information corresponding to different first category labels of the first sample based on the category labels of the first sample. In the process of determining the true distribution information of the first sample corresponding to the first category label, since the true distribution information of the first sample corresponding to the first category label is not easy to express and not easy to solve, the embodiments of this specification may adopt variational inference or use the MCMC Markov chain Monte Carlo algorithm to determine the distribution information of the first sample, etc. The embodiments of this specification do not specifically limit the method of determining the distribution information of the first sample corresponding to different first category labels.

[0078] As an example, taking the determination of the distribution information of the first samples corresponding to different first category labels using variational inference as described above, variational inference can be used to determine the initial distribution information corresponding to the true distribution information of the first samples corresponding to the first category labels. That is, the initial distribution information is the distribution information predicted based on the relevant information of the true distribution information of the first samples corresponding to the first category labels. This initial distribution information is a distribution information that is relatively close to the true distribution information, and it is easy to express and solve. Thus, the true distribution information of the first samples corresponding to the first category labels can be determined by determining the initial distribution information using variational inference. Then, the first model can be trained based on the first samples and the initial distribution information of the first samples corresponding to different first category labels, thereby determining the first distribution information of the first samples corresponding to different first category labels, and the trained first model.

[0079] Specifically, in the field of deep learning classification technology, a common scenario considers a set of latent variables z = z1, ..., z m and samples x = x1, ..., x n The joint density distribution is shown in the following formula:

[0080] p(z,x)=p(z)p(x|z)

[0081] In a Bayesian model, the latent variable z controls the distribution of a sample x. The Bayesian model extracts the latent variables z from the prior density p(z) and then associates them with the sample x through a likelihood function p(x|z). Inference in a Bayesian model is equivalent to adjusting the sample x and calculating the posterior probability p(z|x). In complex Bayesian models, this calculation often requires approximation.

[0082] For a given sample x, the goal of variational inference is to approximate the conditional density of the latent variable z. The core idea of ​​variational inference is to solve the problem using optimization. For the latent variable z, the free variational parameters are parameterized using a family of density functions. The goal of optimization is to discover members of this family of density functions. The inference problem is to compute the conditional density function p(z|x) of the latent variable z, given a sample x. This conditional density function can be used as a point estimate or interval estimate of the latent variable z, forming a predictive density function for new data.

[0083] The conditional density function is:

[0084]

[0085] Where p(x) is the marginal density function of sample x, also known as evidence.

[0086] The formula for the edge density function p(x) is as follows:

[0087] p(x)=∫p(z,x)dz

[0088] For many models, the marginal density function p(x) or the integral of evidence is infeasible in closed form or requires exponential computation time. Considering the difficulty of calculating p(x), it is impossible to directly calculate p(z|x).

[0089] Consider a Bayesian mixture of a univariate Gaussian with unit variance, having K mixture components, corresponding to K means μ = {μ1,...,μ}. k The Gaussian distribution of}. Prior probability p(μ) k It follows a Gaussian normal distribution. Prior variance σ 2 These are hyperparameters. They are used to generate sample x from the first model. i First, select a cluster c. i It indicates that x i From which potential cluster does it originate, and from the classification distribution {1,...,K}, is it extracted? From the corresponding Gaussian distribution... Extract sample x i .

[0090] The complete hierarchical model is

[0091]

[0092]

[0093]

[0094] For any x iThe process of generating it from the model can be divided into two steps: First, select x based on the category distribution. i The corresponding class tag c i , as in the formula

[0095]

[0096] As shown; the second step is to start from the class tag c i The corresponding Gaussian distribution produces point x i , as in the formula

[0097]

[0098] As shown.

[0099] For a sample size of n, the joint density function of the latent variable z and the sample x is:

[0100]

[0101] The latent variable z = {μ, c} has K class averages and n class assignments.

[0102] The marginal density function or evidence for the observation x is:

[0103]

[0104] In K, the calculation of the marginal density function or evidence for sample x grows exponentially, making it difficult to handle.

[0105] In variational inference, for the latent variable z = {μ, c}, the embodiments in this specification specify a family of density functions. Each These are all candidate approximate density functions of the exact conditional density function. The goal of the embodiments in this specification is to find the optimal set of conditional density candidates, such that their corresponding density functions are closer to the true conditional density functions in terms of KL divergence. Therefore, the inference problem is transformed into an optimal solution process.

[0106]

[0107] q ★ (·) represents a family of density distributions. Candidate approximations for the exact conditions.

[0108] However, because the marginal density function of sample x requires the calculation of logp(x), the optimization process is not computationally achievable or is very difficult to compute.

[0109] The KL divergence is:

[0110]

[0111] All expectations E correspond to q(z). The extended KL divergence is:

[0112]

[0113] Thus, the calculation of the KL divergence depends on logp(x).

[0114] Since KL divergence cannot be calculated directly, it is usually equivalent to calculating KL divergence by using the marginal density function of sample x or the evidence lower bound (ELBO).

[0115] The ELBO calculation formula is as follows:

[0116]

[0117] As the sum of the KL divergence between the prior probability density function p(z) and the approximately true posterior probability density function q(z), and the log-likelihood exponent of the sample x, ELBO is rewritten as...

[0118]

[0119] Among them, the first item above The first term is the expectation term, which prompts the model to focus its latent variable z on the configuration that can explain the sample x. The second term, KL(q(z)||p(z)), is the negative of the KLdivergence between the variational distribution and the prior distribution of the latent variable z. It prompts the variational distribution to approach the prior distribution. Therefore, the objective function of the variational model is a balance between the likelihood and the prior distribution.

[0120] Because the value of KL divergence is non-negative, one of the properties of ELBO is the lower bound of the marginal density function or evidence of sample x, logp(x)≥ELBO(q).

[0121] logp(x)=KL(q(z)||p(z|x))+ELBO(q)

[0122] The relationship between ELBO and logp(x) leads to the use of the variational boundary as a model selection criterion. The boundary is a good approximation of the marginal likelihood density function, which provides a basis for selecting the first-line model.

[0123] Regarding the selection of the family of variational density functions, in variational inference, for the latent variable z, this invention specifies a family of density functions. Each These are all candidate approximate density functions of the exact conditional density function. The purpose of variational inference is to optimize the problem; for the objective function ELBO, a variational family that is easy to compute is usually chosen. This patent selects a mean-field variational family, where the latent variables are independent, and each variable is controlled by a different factor in the variational density function. The typical composition of a mean-field variational family is:

[0124]

[0125] Where the variational factor density q is for each latent variable z j Control the corresponding latent variable z j During the optimization process, an appropriate variational factor is selected to maximize the objective function ELBO.

[0126] For Gaussian-Bayesian mixture models, the mean-field variational family contains an approximate posterior probability density form:

[0127]

[0128] Following the rules of the mean-field variational family, each variational factor controls its own latent variable z. Variational factors The mean parameter of the k-th mixture component is the Gaussian distribution average parameter, and its mean is ρ. k Variance is It is the distribution of the mixed assignments of the i-th sample, and its assignment probability is a K-dimensional vector.

[0129] The variational factors take the following forms: the mixture component is a Gaussian distribution with variational parameters (mean and variance) specific to the k-th family; the cluster assignment is a classification with variational parameters (cluster probability) specific to the i-th data point, which is the optimal form of the mixture Gaussian mean field variational density.

[0130] The variational optimization problem is to maximize the ELBO with variational parameters, such as the Gaussian parameters (mean and variance) for each mixture component and the class parameters for each cluster assignment.

[0131] Regarding the solution process of variational inference, the embodiments in this specification use ELBO and mean-field variational families, and this embodiment treats approximate conditional inference as an optimization problem. This embodiment uses coordinate ascending variational inference (CAVI) as the algorithm for solving the optimization problem. CAVI iteratively optimizes each factor of the mean-field variational density while keeping other factors fixed, achieving a local optimum of ELBO.

[0132] Algorithm: For the j-th latent variable z j , z j The complete condition is that p(z) of all other latent variables and samples in the given model j |z-j The conditional density of (x, q). With other variational variables fixed, the factor q is used. l (z l ), l≠j.

[0133] q j (z j The optimization of the condition is proportional to the logarithm of the expected value when the condition is fully exponentially applied:

[0134]

[0135] The expectation in the equation corresponds to the current fixed variational density z. -j , that is, ∏ l≠j q l (z l Equally, q j (z j The optimization of the distribution is proportional to the expected logarithm of the joint distribution:

[0136]

[0137] Because of the assumption of the mean-field variational family, all latent variables z are independent, meaning the expectation of the right-hand side formula does not include the j-th variational factor. This is the efficient coordinate update.

[0138] Furthermore, such as Figure 3 As shown, there are many different processing methods for step S102 above. Here is another optional processing method. For details, please refer to the specific processing procedure of step S1022 below.

[0139] In step S1022, a first objective function corresponding to the initial distribution information of the first sample is obtained. The first model is trained based on the initial distribution information of the first sample with the first category label and the first samples corresponding to different first category labels. The lower limit of the first objective function is determined. Based on the lower limit and the mean field variational family, the first distribution information of the first samples corresponding to different first category labels is determined.

[0140] As an example, the initial distribution information of the first sample above follows a Gaussian-Bayes mixture distribution.

[0141] In one alternative implementation, it is typically assumed that the initial distribution of the first sample follows a Gaussian-Bayes mixture distribution. There are K mixture components, corresponding to K means μ = {μ1,...,μ}. k The Gaussian distribution of}. Prior probability p(μ) k It follows a Gaussian normal distribution. Prior variance σ 2 It is a hyperparameter. The first sample is represented as (X,Y)={(x1,y1),…,(x m ,ym )}, where x i This represents the first sample of the i-th input. y i ∈{1,…,K}, label y i This indicates that the first input sample belongs to the target category among K classes.

[0142] The complete prior information for the hierarchical model is:

[0143]

[0144]

[0145]

[0146] When the sample size of the first sample is m, the joint density function of the latent variable z and the first sample (x,y) can be expressed as shown in the following formula, where the latent variable z = {μ}, K-class average, and m samples.

[0147] The embodiments in this specification can be solved using the ELBO objective function formed by the joint density function and the mean-field variational family, which is used for labeled variational inference. The variational factor for the variational inference corresponding to the first sample mentioned above is ρ,s. 2 (Gaussian distribution average parameters of the mixed components: mean and variance).

[0148]

[0149] In this objective function, each expectation can be computed in a closed-form manner.

[0150] Based on the solution process of variational inference, the embodiments in this specification use the coordinate ascent method to calculate ELBO. label (ρ,s 2 ).

[0151]

[0152] renew The expression for the mean and variance of the first sample corresponding to different category labels can be determined using the variational inference method described above:

[0153]

[0154]

[0155] Thus, by using the lower bound of the first objective function and the mean-field variational family, the first distribution information of the first samples corresponding to different first-class labels can be determined. That is, for variational inference of labeled data, Gaussian parameters (mean and variance) belonging to different distributions are obtained; in variational inference of unlabeled data, the parameters of different Gaussian distributions obtained from labeled data are used as the initial parameters of different unlabeled Gaussian distributions, and this process is repeated to obtain the precise parameters (mean and variance) of Gaussian distributions belonging to different classes of unlabeled data.

[0156] Furthermore, such as Figure 3 As shown, there are many different processing methods for step S104 above. Here is another optional processing method. For details, please refer to the specific processing procedure of step S1042 below.

[0157] In step S1042, the second objective function corresponding to the second distribution information of the second sample is obtained. Based on the first distribution information of the second sample and the first samples corresponding to different first category labels, the first model is trained again to determine the lower limit of the second objective function. Based on the lower limit and the mean field variational family, the second category label corresponding to the second sample and the second distribution information of the second samples corresponding to different second category labels are determined.

[0158] In one alternative implementation, it is considered that the second samples of different categories follow a Gaussian-Bayes mixture distribution. The second sample x = x 1:n The latent variable z = {μ, y} has K mixture components, corresponding to K means μ = {μ1, ..., μ}. k The Gaussian distribution of}. Prior probability p(μ) k It follows a Gaussian normal distribution. Prior variance σ 2 These are hyperparameters. They are used to generate the second sample x from the first model. i First, select a cluster and assign y. i It indicates that x i From which potential cluster does it originate, and from the classification distribution {1,...,K}, is it extracted? From the corresponding Gaussian distribution... Extract the second sample x from the middle. i .

[0159] The complete prior information for the hierarchical model is:

[0160]

[0161]

[0162]

[0163] When the number of samples in the second sample is n, the joint density function of the latent variable z and the second sample x can be expressed by the following formula, where the latent variable z = {μ, y}, K-class average, and n-class assignment.

[0164]

[0165] The latent variables are K real-valued average parameters μ = μ 1:K Assigning y = y to n potential classes 1n: Assign y i This indicates that the second sample x i From which potential cluster does y originate? Essentially, y i It is a K-dimensional vector, except that it corresponds to x i The value at the position of the cluster is 1, and all other values ​​are 0. The embodiments in this specification assume an observation variance of 1 and use a uniform prior for the mixed components.

[0166] For the second distribution information of the second sample, the embodiments in this specification use the joint density function and the mean-field variational family to form the objective function ELBO for unlabeled variational inference and solve it. The variational factor for unlabeled variational inference is ρ,s. 2 (Gaussian distribution average parameters of the mixed components: mean and variance) and (Assignment probability).

[0167]

[0168] In this objective function, each expectation can be computed in a closed-form manner.

[0169] Based on the solution process of variational inference, the coordinate ascent method is used to calculate...

[0170]

[0171]

[0172] renew The expression for the mean and variance of the second sample corresponding to different category labels can be determined using the variational inference method described above:

[0173]

[0174]

[0175] At this point, the first model is trained again using the variational inference method described above, based on the first distribution information of the second sample and the first samples corresponding to different first category labels. This determines the second category label corresponding to the second sample, and the second distribution information of the second samples corresponding to different second category labels. The update of these parameters is closely related to the complete conditional density of the Kth component in the first model. Given the data assigned to the Kth component, the complete condition is a posterior Gaussian distribution. The variational inference update is a weighted complete condition, where each data point is weighted by the variational probability of its assigned component K.

[0176] Based on variational inference strategies for classifying labeled samples and unlabeled samples, this embodiment of the specification performs semi-supervised joint training based on variational inference using both labeled and unlabeled samples. The objective function is:

[0177]

[0178] For classifying samples with class labels, the objective function is... For semi-supervised joint training of labeled and unlabeled samples, the objective function includes the ELBO of labeled samples. label (ρ,s 2 ) and unlabeled samples Objective function optimization is achieved by using a coordinate-updated variational inference algorithm to calculate the mean ρ and variance s of the samples corresponding to the class labels. 2 And the classification parameters corresponding to unlabeled samples.

[0179] Existing variational inference methods perform classification prediction and determine parameters for each class from unlabeled data. This patent utilizes both labeled data and variational inference to obtain the Gaussian distribution parameters (mean and variance) for each predicted class. The Gaussian distribution parameters predicted from labeled data are used as initial parameters for the Gaussian distribution of each class in the unlabeled variational inference. This process is then iteratively calculated to obtain optimized Gaussian distribution parameters for different classes of unlabeled data and parameters indicating which class the unlabeled data belongs to. The parameters (Gaussian distribution parameters) and classification parameters obtained from the unlabeled data variational inference are added to the labeled data, and the variational inference for both labeled and unlabeled data is iteratively performed until the iteration cycle is satisfied.

[0180] As can be seen, in the embodiments of this specification, by using a small number of labeled samples, the distribution information of the labeled samples corresponding to each category label is calculated, and the sample distribution information corresponding to the category label of the labeled samples is used as the initial parameters for training unlabeled samples to predict the distribution information of the category corresponding to the unlabeled samples. In this way, by continuously using labeled samples and unlabeled samples, the category of the unlabeled samples and the true distribution of the unlabeled samples corresponding to that category are predicted, thereby effectively improving the performance of the model and the accuracy of the model in predicting the data distribution.

[0181] The following section details the application process of the first model trained using the above model training method, through specific application scenarios. This may include the following:

[0182] like Figure 4 As shown, the system architecture corresponding to the image classification method in the embodiments of this specification may include a server 401 and one or more terminal devices 402. A communication connection is established between the server 401 and each terminal device 402. The terminal device 402 can be any terminal device, such as a mobile terminal device like a mobile phone or tablet, a terminal device like a laptop, or a wearable device like a smartwatch or bracelet. The terminal device 402 can send a target image to be classified to the server 401. The server 401 inputs the received target image to be classified into the pre-trained first model to obtain the classification result corresponding to the target image. Then, the server 401 can send the classification result corresponding to the target image to the terminal device 402.

[0183] The above describes the model training method provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide an image classification method. The execution subject of this method can be a server, which can be a single independent server or a server cluster composed of multiple different servers. The server can be the backend server of a website, etc. This image classification method can use a first model trained based on the above model training method to classify the target image input to the first model, such as... Figure 5 As shown, the method may specifically include the following steps:

[0184] In step S202, the target image to be classified is obtained;

[0185] In step S204, the target image is input into the pre-trained first model to obtain the classification result corresponding to the target image. The first model is obtained by training the model through the initial distribution information of the first sample with the first category label, the first sample corresponding to different first category labels, and the second sample, and by iteratively updating the sample and the distribution information of the sample.

[0186] As an example, the first model mentioned above could be an image classification model.

[0187] In one optional implementation, the execution entity can pre-calculate the distribution information of the labeled samples corresponding to each category label using a small number of labeled samples. This distribution information is then used as the initial parameters for training unlabeled samples to predict the distribution information of the categories corresponding to the unlabeled samples. This process is repeated iteratively, using both labeled and unlabeled samples, to predict the category of the unlabeled samples and the true distribution of the unlabeled samples corresponding to that category, until a first model that meets a preset convergence condition is obtained. Afterward, the execution entity can use the trained first model to classify the acquired target image to be classified. Specifically, in practical applications, after the server acquires the target image to be classified, it can input the target image into the pre-trained first model to obtain the classification result corresponding to the target image. This image classification implementation can be applied to specific scenarios such as image recognition and identity recognition.

[0188] As an example, the first model mentioned above could be a text classification model.

[0189] In one optional implementation, the execution entity can pre-calculate the distribution information of the labeled samples corresponding to each category label using a small number of labeled samples. This distribution information is then used as the initial parameters for training unlabeled samples to predict the distribution information of the categories corresponding to the unlabeled samples. This process is repeated iteratively, using both labeled and unlabeled samples, to predict the category of the unlabeled samples and the true distribution of the unlabeled samples corresponding to that category, until a first model that meets a preset convergence condition is obtained. Afterward, the execution entity can use the trained first model to classify the acquired target text. Specifically, in practical applications, after the server acquires the target text to be classified, it can input the target text into the pre-trained first model to obtain the classification result corresponding to the target text. This text classification implementation can be applied to specific scenarios such as intent recognition and semantic recognition.

[0190] It should be noted that the specific training process of the first model described above in this embodiment can be found in the appendix of the foregoing embodiments. Figure 1 To be continued Figure 3 The specific training process of the corresponding embodiments will not be described in detail here.

[0191] As can be seen, the first model in this embodiment calculates the distribution information of the labeled samples corresponding to each category label using a small number of labeled samples, and uses the sample distribution information corresponding to the category labels of the labeled samples as the initial parameters for training unlabeled samples to predict the distribution information of the category corresponding to the unlabeled samples. This process continuously uses labeled and unlabeled samples to predict the category of the unlabeled samples and the true distribution of the unlabeled samples corresponding to that category, thereby effectively improving the performance of the first model and the accuracy of the data distribution prediction. Thus, when the acquired target image to be classified is input into the pre-trained first model, the classification result corresponding to the target image is more accurate. The above is the model training method provided in this embodiment. Based on the same idea, this embodiment also provides a model training device, which includes all the functional units of the server as described in the above embodiment, such as... Figure 6 As shown.

[0192] The model training device includes: a first training module 601, a second training module 602, an update module 603, and a third training module 604, wherein:

[0193] The first training module 601 is configured to train the first model based on the initial distribution information of the first samples with a first category label and the first samples corresponding to different first category labels, to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model.

[0194] The second training module 602 is configured to continue training the first model based on the second sample and the first distribution information of the first sample corresponding to different first category labels, to determine the second category label corresponding to the second sample, the second distribution information of the second sample corresponding to different second category labels, and the first model after continued training, wherein the second sample includes at least samples without category labels;

[0195] The update module 603 is configured to update the initial distribution information based on the second distribution information, and to update the first sample based on the second sample;

[0196] The third training module 604 is configured to continue training the first model based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, through the above steps, until a first model that meets the preset convergence condition is obtained.

[0197] In this embodiment of the specification, the update module 603 includes:

[0198] The first determining unit is configured to input the first sample into the first model after further training, and output the third category label corresponding to the first sample through the first model;

[0199] The second determining unit is configured to determine the loss information corresponding to the first model based on the first category label corresponding to the first sample and the third category label corresponding to the first sample;

[0200] The update unit is configured to update the initial distribution information based on the second distribution information and update the first sample based on the second sample if the loss information does not meet the preset convergence condition.

[0201] In this embodiment of the specification, the initial distribution information is obtained by predicting the distribution information based on the relevant information of the true distribution information of the first sample corresponding to the first category label.

[0202] In the embodiments of this specification, the first training module is configured as follows:

[0203] Obtain a first objective function corresponding to the initial distribution information of the first sample; train the first model based on the initial distribution information of the first sample with a first category label and the first samples corresponding to different first category labels; determine the lower limit of the first objective function; and determine the first distribution information of the first samples corresponding to different first category labels based on the lower limit and the mean field variational family.

[0204] and or,

[0205] The second training module is configured as follows:

[0206] Obtain the second objective function corresponding to the second distribution information of the second sample, continue to train the first model based on the first distribution information of the second sample and the first samples corresponding to different first category labels, determine the lower limit of the second objective function, and determine the second category label corresponding to the second sample and the second distribution information of the second samples corresponding to different second category labels based on the lower limit and the mean field variational family.

[0207] In the embodiments described in this specification, the initial distribution information of the first sample follows a Gaussian-Bayes mixture distribution.

[0208] As can be seen, in the embodiments of this specification, by using a small number of labeled samples, the distribution information of the labeled samples corresponding to each category label is calculated, and the sample distribution information corresponding to the category label of the labeled samples is used as the initial parameters for training unlabeled samples to predict the distribution information of the category corresponding to the unlabeled samples. In this way, by continuously using labeled samples and unlabeled samples, the category of the unlabeled samples and the true distribution of the unlabeled samples corresponding to that category are predicted, thereby effectively improving the performance of the model and the accuracy of the model in predicting the data distribution.

[0209] The above describes the model training apparatus provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide an image classification apparatus. This image classification apparatus can use a first model trained based on the above model training method to classify target images input to the first model, such as... Figure 7 As shown, the image classification device includes an image acquisition module 701 and an image input module 702.

[0210] Image acquisition module 701 is configured to acquire target images to be classified.

[0211] The image input module 702 is configured to input the target image into a pre-trained first model to obtain the classification result corresponding to the target image. The first model is obtained by training the model through a first sample with a first category label, initial distribution information of the first samples corresponding to different first category labels, and a second sample, and by iteratively updating the samples and the distribution information of the samples.

[0212] As can be seen, the first model in this embodiment calculates the distribution information of the labeled samples corresponding to each category label using a small number of labeled samples, and uses the sample distribution information corresponding to the category labels of the labeled samples as the initial parameters for training unlabeled samples to predict the distribution information of the category corresponding to the unlabeled samples. By continuously using labeled and unlabeled samples, the model predicts the category of the unlabeled samples and the true distribution of the unlabeled samples corresponding to that category, thereby effectively improving the performance of the first model and the accuracy of the data distribution prediction by the first model. Thus, when the target image to be classified is input into the pre-trained first model, the classification result corresponding to the target image is more accurate.

[0213] The image classification apparatus provided in the embodiments of this specification can implement the various processes in the embodiments corresponding to the above-described image classification methods. To avoid repetition, these processes will not be described again here.

[0214] It should be noted that the image classification device and the image classification method provided in the embodiments of this specification are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned model training method, and the repeated parts will not be described again.

[0215] Corresponding to the model training method provided in the above embodiments, based on the same technical concept, this specification also provides a model training device for performing the above-described model training method. Figure 8 This document presents a schematic diagram of the hardware structure of a model training device as described in the various embodiments of this specification. Figure 8 The model training device 800 shown includes, but is not limited to, components such as: a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a user input unit 806, an interface unit 807, a memory 808, a processor 809, and a power supply 810. Those skilled in the art will understand that... Figure 8 The model training device structure shown does not constitute a limitation on the model training device. The model training device may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0216] The processor 809 is used to train the first model based on the initial distribution information of the first samples with a first category label and the first samples corresponding to different first category labels, to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model.

[0217] The processor 809 is configured to continue training the first model based on the second sample and the first distribution information of the first sample corresponding to different first category labels, determine the second category label corresponding to the second sample, the second distribution information of the second sample corresponding to different second category labels, and the first model after continued training, wherein the second sample includes at least samples without category labels;

[0218] The processor 809 is configured to update the initial distribution information based on the second distribution information, and to update the first sample based on the second sample.

[0219] The processor 809 is used to continue training the first model through the above steps based on the updated first sample, the updated initial distribution information of the first sample, and the second sample, until a first model that meets the preset convergence condition is obtained.

[0220] In this embodiment of the specification, the processor 809 is further configured to input the first sample into the first model after further training, and output a third category label corresponding to the first sample through the first model;

[0221] The processor 809 is used to determine the loss information corresponding to the first model based on the first category label corresponding to the first sample and the third category label corresponding to the first sample.

[0222] The processor 809 is configured to update the initial distribution information based on the second distribution information and update the first sample based on the second sample if the loss information does not meet the preset convergence condition.

[0223] As can be seen, in the embodiments of this specification, by using a small number of labeled samples, the distribution information of the labeled samples corresponding to each category label is calculated, and the sample distribution information corresponding to the category label of the labeled samples is used as the initial parameters for training unlabeled samples to predict the distribution information of the category corresponding to the unlabeled samples. In this way, by continuously using labeled samples and unlabeled samples, the category of the unlabeled samples and the true distribution of the unlabeled samples corresponding to that category are predicted, thereby effectively improving the performance of the model and the accuracy of the model in predicting the data distribution.

[0224] It should be noted that the model training device 800 provided in the embodiments of this specification can realize all the processes implemented by the model training device in the above-described model training method embodiments. To avoid repetition, it will not be described again here.

[0225] Preferably, this specification also provides a model training device, including a processor 809, a memory 808, and a computer program stored in the memory 808 and executable on the processor 809. When the computer program is executed by the processor 809, it implements the various processes of the above-described model training method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0226] Furthermore, based on the above Figures 1 to 3 The method shown in this specification, along with one or more embodiments, also provides a storage medium for storing computer-executable instruction information. In one specific embodiment, the storage medium can be a USB flash drive, optical disc, hard disk, etc. When the computer-executable instruction information stored in the storage medium is executed by a processor, it can achieve the following process:

[0227] The first model is trained based on the initial distribution information of the first samples with the first category label and the first samples corresponding to different first category labels, to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model.

[0228] The first model is trained again based on the first distribution information of the second sample and the first sample corresponding to different first category labels, to determine the second category label corresponding to the second sample, the second distribution information of the second sample corresponding to different second category labels, and the first model after further training. The second sample includes at least the sample without a category label.

[0229] The initial distribution information is updated based on the second distribution information, and the first sample is updated based on the second sample;

[0230] Based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, the first model is trained again through the above steps until a first model that meets the preset convergence condition is obtained.

[0231] It should be noted that the storage medium provided in the embodiments of this specification can realize the various processes implemented by the model training device in the above-described model training method embodiments. To avoid repetition, it will not be described again here.

[0232] Corresponding to the model training method provided in the above embodiments, based on the same technical concept, this specification also provides an image classification device for performing the above-described image classification method. Figure 8 This is a schematic diagram illustrating the hardware structure of an image classification device according to various embodiments of this specification. Figure 8 The image classification device 800 shown includes, but is not limited to, components such as: a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a user input unit 806, an interface unit 807, a memory 808, a processor 809, and a power supply 810. Those skilled in the art will understand that... Figure 8 The image classification device structure shown does not constitute a limitation on the image classification device. The image classification device may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0233] The processor 809 is used to acquire the target image to be classified.

[0234] The processor 809 is used to input the target image into a pre-trained first model to obtain the classification result corresponding to the target image. The first model is obtained by training the model through a first sample with a first category label, initial distribution information of the first samples corresponding to different first category labels, and a second sample, and by iteratively updating the samples and the distribution information of the samples.

[0235] As can be seen, the first model in this embodiment calculates the distribution information of the labeled samples corresponding to each category label using a small number of labeled samples, and uses the sample distribution information corresponding to the category labels of the labeled samples as the initial parameters for training unlabeled samples to predict the distribution information of the category corresponding to the unlabeled samples. By continuously using labeled and unlabeled samples, the model predicts the category of the unlabeled samples and the true distribution of the unlabeled samples corresponding to that category, thereby effectively improving the performance of the first model and the accuracy of the data distribution prediction by the first model. Thus, when the target image to be classified is input into the pre-trained first model, the classification result corresponding to the target image is more accurate.

[0236] It should be noted that the image classification device 800 provided in the embodiments of this specification can implement all the processes implemented by the image classification device in the above-described image classification method embodiments. To avoid repetition, these processes will not be described again here.

[0237] Preferably, this specification also provides an image classification device, including a processor 809, a memory 808, and a computer program stored in the memory 808 and executable on the processor 809. When the computer program is executed by the processor 809, it implements the various processes of the above-described image classification method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0238] Furthermore, based on the above Figure 5 The method shown in this specification, along with one or more embodiments, also provides a storage medium for storing computer-executable instruction information. In one specific embodiment, the storage medium can be a USB flash drive, optical disc, hard disk, etc. When the computer-executable instruction information stored in the storage medium is executed by a processor, it can achieve the following process:

[0239] Obtain the target image to be classified;

[0240] The target image is input into a pre-trained first model to obtain the classification result corresponding to the target image. The first model is obtained by training the model through a first sample with a first category label, the initial distribution information of the first sample corresponding to different first category labels, and a second sample, and by iteratively updating the sample and the distribution information of the sample.

[0241] It should be noted that the storage medium provided in the embodiments of this specification can realize the various processes implemented by the model training device in the above-described model training method embodiments. To avoid repetition, it will not be described again here.

[0242] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0243] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0244] One or more embodiments of this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a particular task or implement a particular abstract data type. One or more embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0245] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0246] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.

Claims

1. A model training method, characterized in that, The method includes: The image classification model is trained based on the initial distribution information of the first image samples with the first category label and the first image samples corresponding to different first category labels, to determine the first distribution information of the first image samples corresponding to different first category labels, and the trained image classification model. The image classification model is further trained based on the second image sample and the first distribution information of the first image samples corresponding to different first category labels, to determine the second category label corresponding to the second image sample, the second distribution information of the second image samples corresponding to different second category labels, and the image classification model after further training. The second image sample includes at least samples without category labels. The initial distribution information is updated based on the second distribution information, and the first image sample is updated based on the second image sample; Based on the updated first image sample, the initial distribution information of the updated first image sample, and the second image sample, the image classification model is trained again through the above steps until an image classification model that meets the preset convergence condition is obtained.

2. The method according to claim 1, characterized in that, The step of updating the initial distribution information based on the second distribution information and updating the first image sample based on the second image sample includes: The first image sample is input into the image classification model after further training, and the image classification model outputs a third category label corresponding to the first image sample. The loss information corresponding to the image classification model is determined based on the first category label corresponding to the first image sample and the third category label corresponding to the first image sample. If the loss information does not meet the preset convergence condition, the initial distribution information is updated based on the second distribution information, and the first image sample is updated based on the second image sample.

3. The method according to claim 1, characterized in that, The step of training the image classification model based on the initial distribution information of first image samples with first category labels and first image samples corresponding to different first category labels, and determining the first distribution information of first image samples corresponding to different first category labels, includes: Obtain a first objective function corresponding to the initial distribution information of the first image sample; train the image classification model based on the initial distribution information of the first image sample with a first category label and the first image sample corresponding to different first category labels; determine the lower limit of the first objective function; and determine the first distribution information of the first image sample corresponding to different first category labels based on the lower limit and the mean field variational family. And / or, The image classification model is further trained based on the first distribution information of the second image sample and the first image samples corresponding to different first category labels, to determine the second category label corresponding to the second image sample, and the second distribution information of the second image samples corresponding to different second category labels, including: Obtain the second objective function corresponding to the second distribution information of the second image sample, continue to train the image classification model based on the first distribution information of the second image sample and the first image samples corresponding to different first category labels, determine the lower limit of the second objective function, and determine the second category label corresponding to the second image sample and the second distribution information of the second image samples corresponding to different second category labels based on the lower limit and the mean field variational family.

4. An image classification method, characterized in that, The method includes: Obtain the target image to be classified; The target image is input into a pre-trained first model to obtain the classification result corresponding to the target image; The training process of the first model includes: The first model is trained based on the initial distribution information of the first samples with the first category label and the first samples corresponding to different first category labels, to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model. The first model is trained again based on the first distribution information of the second sample and the first sample corresponding to different first category labels, to determine the second category label corresponding to the second sample, the second distribution information of the second sample corresponding to different second category labels, and the first model after further training. The second sample includes at least the sample without a category label. The initial distribution information is updated based on the second distribution information, and the first sample is updated based on the second sample; Based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, the first model is trained again through the above steps until a first model that meets the preset convergence condition is obtained.

5. A model training device, characterized in that, The device includes: The first training module is configured to train an image classification model based on the initial distribution information of the first image samples with a first category label and the first image samples corresponding to different first category labels, and to determine the first distribution information of the first image samples corresponding to different first category labels, as well as the trained image classification model. The second training module is configured to continue training the image classification model based on the second image sample and the first distribution information of the first image sample corresponding to different first category labels, to determine the second category label corresponding to the second image sample, the second distribution information of the second image sample corresponding to different second category labels, and the image classification model after further training, wherein the second image sample includes at least samples without category labels; The update module is configured to update the initial distribution information based on the second distribution information, and to update the first image sample based on the second image sample; The third training module is configured to continue training the image classification model based on the updated first image sample, the updated initial distribution information of the first image sample, and the second image sample, through the above steps, until an image classification model that meets the preset convergence condition is obtained.

6. An image classification device, characterized in that, The device includes: The image acquisition module is configured to acquire the target image to be classified. An image input module is configured to input the target image into a pre-trained first model to obtain a classification result corresponding to the target image; The training process of the first model includes: The first model is trained based on the initial distribution information of the first samples with the first category label and the first samples corresponding to different first category labels, to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model. The first model is trained again based on the first distribution information of the second sample and the first sample corresponding to different first category labels, to determine the second category label corresponding to the second sample, the second distribution information of the second sample corresponding to different second category labels, and the first model after further training. The second sample includes at least the sample without a category label. The initial distribution information is updated based on the second distribution information, and the first sample is updated based on the second sample; Based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, the first model is trained again through the above steps until a first model that meets the preset convergence condition is obtained.

7. A model training device, the model training device comprising: processor; as well as A memory configured to store computer-executable instructions, which, when executed, cause the processor to: The image classification model is trained based on the initial distribution information of the first image samples with the first category label and the first image samples corresponding to different first category labels, to determine the first distribution information of the first image samples corresponding to different first category labels, and the trained image classification model. The image classification model is further trained based on the second image sample and the first distribution information of the first image samples corresponding to different first category labels, to determine the second category label corresponding to the second image sample, the second distribution information of the second image samples corresponding to different second category labels, and the image classification model after further training. The second image sample includes at least samples without category labels. The initial distribution information is updated based on the second distribution information, and the first image sample is updated based on the second image sample; Based on the updated first image sample, the initial distribution information of the updated first image sample, and the second image sample, the image classification model is trained again through the above steps until an image classification model that meets the preset convergence condition is obtained.

8. A storage medium for storing computer-executable instructions, which, when executed by a processor, perform the following process: The image classification model is trained based on the initial distribution information of the first image samples with the first category label and the first image samples corresponding to different first category labels, to determine the first distribution information of the first image samples corresponding to different first category labels, and the trained image classification model. The image classification model is further trained based on the second image sample and the first distribution information of the first image samples corresponding to different first category labels, to determine the second category label corresponding to the second image sample, the second distribution information of the second image samples corresponding to different second category labels, and the image classification model after further training. The second image sample includes at least samples without category labels. The initial distribution information is updated based on the second distribution information, and the first image sample is updated based on the second image sample; Based on the updated first image sample, the initial distribution information of the updated first image sample, and the second image sample, the image classification model is trained again through the above steps until an image classification model that meets the preset convergence condition is obtained.

9. An image classification device, the image classification device comprising: processor; as well as A memory configured to store computer-executable instructions, which, when executed, cause the processor to: Obtain the target image to be classified; The target image is input into a pre-trained first model to obtain the classification result corresponding to the target image; The training process of the first model includes: The first model is trained based on the initial distribution information of the first samples with the first category label and the first samples corresponding to different first category labels, to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model. The first model is trained again based on the first distribution information of the second sample and the first sample corresponding to different first category labels, to determine the second category label corresponding to the second sample, the second distribution information of the second sample corresponding to different second category labels, and the first model after further training. The second sample includes at least the sample without a category label. The initial distribution information is updated based on the second distribution information, and the first sample is updated based on the second sample; Based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, the first model is trained again through the above steps until a first model that meets the preset convergence condition is obtained.

10. A storage medium for storing computer-executable instructions, which, when executed by a processor, perform the following process: Obtain the target image to be classified; The target image is input into a pre-trained first model to obtain the classification result corresponding to the target image; in, The training process of the first model includes: The first model is trained based on the initial distribution information of the first samples with the first category label and the first samples corresponding to different first category labels, to determine the first distribution information of the first samples corresponding to different first category labels, and the trained first model. The first model is trained again based on the first distribution information of the second sample and the first sample corresponding to different first category labels, to determine the second category label corresponding to the second sample, the second distribution information of the second sample corresponding to different second category labels, and the first model after further training. The second sample includes at least the sample without a category label. The initial distribution information is updated based on the second distribution information, and the first sample is updated based on the second sample; Based on the updated first sample, the initial distribution information of the updated first sample, and the second sample, the first model is trained again through the above steps until a first model that meets the preset convergence condition is obtained.

Citation Information

Patent Citations

  • Mail classification method suitable for different label distribution occasions

    CN111563721A

  • Vein recognition model training method, vein image recognition method and device

    CN113505716A