Semi-supervised classification method for feature distribution inconsistency and related device
By adopting adversarial domain adaptation strategies and improving mixup strategies in semi-supervised learning, the semi-supervised classification model is optimized, and the algorithm performance instability caused by inconsistent feature distribution is solved, and higher classification accuracy and stability are achieved.
Patent Information
- Application Number
- CN202411614435.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-11-12
AI Technical Summary
The existing semi-supervised learning algorithms have unstable algorithm performance and low classification accuracy when facing unlabeled data sets with inconsistent feature distribution.
Adversarial domain adaptation strategies and improved mixup strategies are adopted to build a semi-supervised classification model, optimize the model to reduce the difference in feature distribution between labeled and unlabeled samples, and learn domain-invariant features of continuous latent spaces.
In the case of inconsistent feature distribution, the accuracy and stability of the classifier are improved, the cost of sample labeling is reduced, and there is no need to ensure that the feature distribution of labeled samples and unlabeled samples is consistent.
Smart Images

Figure CN119557762A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data classification, and in particular to a semi-supervised classification method and related devices for inconsistent feature distribution. Background Art
[0002] Current classifiers often rely on large labeled data sets to achieve high accuracy. However, obtaining these labeled samples is time-consuming and laborious. Semi-supervised learning algorithms are usually used in the prior art to train classifiers, making full use of limited labeled samples and a large number of unlabeled samples. However, traditional semi-supervised learning algorithms rely on the independent and identically distributed assumption, that is, labeled samples and unlabeled samples are independently sampled from the same feature distribution. But in actual scenarios, when a large number of unlabeled samples are collected, the feature distribution of the collected unlabeled samples may be affected by the time, place and method of collecting the data, so the feature distribution of labeled samples and unlabeled samples may be inconsistent. When traditional semi-supervised learning encounters an unlabeled data set with inconsistent feature distribution, the performance of the algorithm will become unstable or even drop significantly. Therefore, it is particularly important to develop a semi-supervised classification method that can face inconsistent feature distribution. Summary of the invention
[0003] The purpose of this application is to provide a semi-supervised classification method and related devices for inconsistent feature distribution, which can achieve accurate classification when the feature distribution of labeled data sets and unlabeled data sets are inconsistent.
[0004] To achieve the above objectives, this application provides the following solutions:
[0005] In a first aspect, the present application provides a semi-supervised classification method for inconsistent feature distribution, comprising the following steps:
[0006] A labeled data set and an unlabeled data set with inconsistent feature distribution are obtained; the labeled data set includes a number of labeled samples, classification labels and domain labels corresponding to the labeled samples; the unlabeled data set includes a number of unlabeled samples and domain labels corresponding to the unlabeled samples.
[0007] A semi-supervised classification model is constructed, and the adversarial domain adaptation strategy and the improved mixup strategy are adopted to optimize the semi-supervised classification model based on labeled data sets and unlabeled data sets to obtain a locally optimized semi-supervised classification model; the semi-supervised classification model includes a feature extractor, a classifier and a domain discriminator; the adversarial domain adaptation strategy is used to reduce the marginal distribution difference between the feature representations extracted by the feature extractor according to the labeled samples and the unlabeled samples; the improved mixup strategy is used to enable the feature extractor to learn the domain-invariant features of the continuous latent space between the feature distributions of the labeled data sets and the unlabeled data sets.
[0008] For any unlabeled sample in the unlabeled data set, based on the locally optimized semi-supervised classification model, the feature representation and classification probability prediction results of the unlabeled sample are obtained.
[0009] Based on the category prototypes of each category in the labeled data set and the unlabeled data set, the classification probability prediction results of the unlabeled samples are corrected to obtain the classification labels of the unlabeled samples.
[0010] Based on the labeled data set and the unlabeled data set, the locally optimized semi-supervised classification model is optimized to obtain a globally optimized semi-supervised classification model.
[0011] The samples with unknown classification labels are input into the globally optimized semi-supervised classification model to obtain the classification probability prediction results corresponding to the samples, and the classification labels of the samples are determined according to the classification probability prediction results of the samples.
[0012] Optionally, a semi-supervised classification model is constructed, and an adversarial domain adaptation strategy and an improved mixup strategy are adopted to optimize the semi-supervised classification model based on a labeled data set and an unlabeled data set to obtain a locally optimized semi-supervised classification model, specifically including the following steps:
[0013] Based on the feature extractor, classifier and domain discriminator, a semi-supervised classification model is constructed; the feature extractor is used to extract the feature representation of the input data; the classifier is used to output the corresponding classification probability prediction result according to the feature representation; the domain discriminator is used to output the corresponding domain label prediction result according to the feature representation.
[0014] An adversarial domain adaptation strategy is adopted to optimize the semi-supervised classification model based on labeled data sets and unlabeled data sets to obtain the semi-supervised classification model after initial optimization; the adversarial domain adaptation strategy is used to reduce the marginal distribution difference between the feature representations extracted by the feature extractor based on labeled samples and unlabeled samples.
[0015] An improved mixup strategy is adopted to optimize the semi-supervised classification model after initial optimization based on labeled data sets and unlabeled data sets to obtain a locally optimized semi-supervised classification model; the improved mixup strategy is used to enable the feature extractor to learn the domain-invariant features of the continuous latent space between the feature distributions of the labeled data sets and the unlabeled data sets.
[0016] Optionally, the domain label of the labeled sample is 0, and the domain label of the unlabeled sample is 1; an adversarial domain adaptation strategy is adopted to optimize the semi-supervised classification model based on the labeled data set and the unlabeled data set to obtain the semi-supervised classification model after initial optimization, which specifically includes the following steps:
[0017] A labeled sample and an unlabeled sample are selected from the labeled data set and the unlabeled data set respectively, and a feature extractor is used to extract feature representations of the labeled sample and feature representations of the unlabeled sample respectively.
[0018] The adversarial domain adaptation loss function is constructed by using the domain label prediction results output by the domain discriminator according to the feature representation of labeled samples and the feature representation of unlabeled samples respectively.
[0019] With the goal of minimizing the adversarial domain adaptation loss function, the parameters of the semi-supervised classification model are optimized to obtain the semi-supervised classification model after initial optimization.
[0020] Optionally, an improved mixup strategy is adopted to optimize the semi-supervised classification model after the initial optimization based on the labeled data set and the unlabeled data set to obtain a locally optimized semi-supervised classification model, which specifically includes the following steps:
[0021] For any unlabeled sample in the unlabeled data set, the semi-supervised classification model after initial optimization is used to obtain the classification probability prediction result of the unlabeled sample, and determine the pseudo classification label of the unlabeled sample.
[0022] A labeled sample with the same pseudo classification label as the unlabeled sample is selected in the labeled data set, and a mixup operation is performed on the unlabeled sample and the labeled sample to obtain a mixed feature representation and a mixed domain label.
[0023] Based on hybrid feature representation and hybrid domain labeling, a hybrid loss function is constructed.
[0024] With the goal of minimizing the mixed loss function, the parameters of the semi-supervised classification model after the initial optimization are optimized to obtain a locally optimized semi-supervised classification model.
[0025] Optionally, based on the category prototypes of each category of the labeled data set and the unlabeled data set, the classification probability prediction result of the unlabeled sample is corrected to obtain the classification label of the unlabeled sample, which specifically includes the following steps:
[0026] According to the labeled data set, the category prototypes of each category of the labeled data set and the unlabeled data set are calculated.
[0027] Calculate the similarity between the category prototype of each category and the feature representation of the unlabeled samples.
[0028] According to the similarity between the category prototype of each category and the feature representation of the unlabeled sample, the classification probability prediction result of the unlabeled sample is corrected to obtain the classification label of the unlabeled sample.
[0029] Optionally, based on the labeled data set and the unlabeled data set, the locally optimized semi-supervised classification model is optimized to obtain a globally optimized semi-supervised classification model, which specifically includes the following steps:
[0030] A labeled sample and an unlabeled sample are selected from the labeled data set and the unlabeled data set respectively, and the labeled sample and the unlabeled sample are input into the locally optimized semi-supervised classification model to obtain the classification probability prediction results of the labeled sample and the classification probability prediction results of the unlabeled sample.
[0031] A combined cross entropy loss function is constructed based on the classification probability prediction results of labeled samples, the classification labels of labeled samples, the classification probability prediction results of unlabeled samples, and the classification labels of unlabeled samples.
[0032] With the goal of minimizing the combined cross entropy loss function, the parameters of the classifier in the locally optimized semi-supervised classification model are updated to obtain the globally optimized semi-supervised classification model.
[0033] In the second aspect, the present application provides a semi-supervised classification system for inconsistent feature distribution, including the following modules:
[0034] The training data set acquisition module is used to acquire labeled data sets and unlabeled data sets with inconsistent feature distribution; the labeled data sets include a number of labeled samples, classification labels and domain labels corresponding to the labeled samples; the unlabeled data sets include a number of unlabeled samples and domain labels corresponding to the unlabeled samples.
[0035] The semi-supervised classification model building module is used to build a semi-supervised classification model; the semi-supervised classification model includes a feature extractor, a classifier, and a domain discriminator.
[0036] The model local optimization module is used to optimize the semi-supervised classification model based on labeled data sets and unlabeled data sets by adopting the adversarial domain adaptation strategy and the improved mixup strategy to obtain a locally optimized semi-supervised classification model; the adversarial domain adaptation strategy is used to reduce the marginal distribution difference between the feature representations extracted by the feature extractor based on labeled samples and unlabeled samples; the improved mixup strategy is used to enable the feature extractor to learn the domain-invariant features of the continuous latent space between the feature distributions of the labeled data sets and the unlabeled data sets.
[0037] The unlabeled sample pseudo prediction module is used to obtain the feature representation and classification probability prediction results of any unlabeled sample in the unlabeled data set based on the locally optimized semi-supervised classification model.
[0038] The unlabeled sample prediction result correction module is used to correct the classification probability prediction result of the unlabeled sample based on the category prototypes of each category of the labeled data set and the unlabeled data set to obtain the classification label of the unlabeled sample.
[0039] The classifier partial optimization module is used to optimize the locally optimized semi-supervised classification model based on the labeled data set and the unlabeled data set to obtain the globally optimized semi-supervised classification model.
[0040] The classification label prediction module is used to input samples with unknown classification labels into the globally optimized semi-supervised classification model to obtain the classification probability prediction results corresponding to the samples, and determine the classification labels of the samples based on the classification probability prediction results of the samples.
[0041] In a third aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the semi-supervised classification method for inconsistent feature distribution described above.
[0042] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the semi-supervised classification method for inconsistent feature distribution described above.
[0043] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the semi-supervised classification method for inconsistent feature distribution described above.
[0044] According to the specific embodiments provided in this application, this application discloses the following technical effects:
[0045] The present application provides a semi-supervised classification method and related devices for inconsistent feature distribution. In the method, a semi-supervised classification model is constructed, and an adversarial domain adaptation strategy and an improved mixup strategy are adopted to optimize the semi-supervised classification model based on a labeled data set and an unlabeled data set. The adversarial domain adaptation strategy is adopted to reduce the marginal distribution difference between the feature representations extracted by the feature extractor according to the labeled samples and the unlabeled samples; the improved mixup strategy is adopted to enable the feature extractor to learn the domain-invariant features of the continuous latent space between the feature distributions of the labeled data set and the unlabeled data set, and then based on the category prototypes of each category of the labeled data set and the unlabeled data set, the classification probability prediction results of the unlabeled samples are corrected. Finally, based on the labeled data set and the unlabeled data set both having corresponding classification labels, the locally optimized semi-supervised classification model is optimized to obtain a globally optimized semi-supervised classification model, which can be used to generate corresponding classification probability prediction results and determine classification labels according to samples with unknown classification labels. The above-mentioned scheme of the present application reduces the difference in marginal distribution between labeled samples and unlabeled samples and ensures the domain invariance of their continuous latent space by using the adversarial domain adaptation strategy and improving the mixup algorithm. At the same time, the category prototype of the labeled samples is used to guide the updating of the pseudo-labels of the unlabeled samples, and the pseudo-labels of the unlabeled samples are used to assist the labeled samples in training the classifier. The inconsistent feature distribution data only uses a small number of labeled samples, and there is no need to ensure that the feature distribution of the labeled samples and the unlabeled samples are consistent, which reduces the sample labeling cost and solves the problem of low classification accuracy in inconsistent feature distribution data. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 A flowchart of a semi-supervised classification method for inconsistent feature distribution is provided in one embodiment of the present application.
[0048] Figure 2 A schematic diagram of the structure of a semi-supervised classification model used in a semi-supervised classification method for inconsistent feature distribution provided in one embodiment of the present application.
[0049] Figure 3 A flowchart of step A2 in a semi-supervised classification method for inconsistent feature distribution provided in one embodiment of the present application.
[0050] Figure 4Flowchart of step A4 in a semi-supervised classification method for inconsistent feature distributions provided by an embodiment of the present application.
[0051] Figure 5 Flowchart of step A5 in a semi-supervised classification method for inconsistent feature distributions provided by an embodiment of the present application.
[0052] Figure 6 Schematic diagram of functional modules of a semi-supervised classification system for inconsistent feature distributions provided by another embodiment of the present application.
[0053] Figure 7 Schematic diagram of the structure of a computer device provided by an embodiment of the present application. Detailed implementation manners
[0054] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0055] To make the above objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below with reference to the accompanying drawings and specific implementation manners.
[0056] A semi-supervised classification method for inconsistent feature distributions provided by an embodiment of the present application is executed by a computer device. Specifically, it can be executed alone by a computer device such as a terminal or a server, or jointly executed by a terminal and a server. In the embodiments of the present application, the method includes the following steps:
[0057] A1. Obtain a labeled data set and an unlabeled data set with inconsistent feature distributions; the labeled data set includes a number of labeled samples, classification labels and domain labels corresponding to the labeled samples; the unlabeled data set includes a number of unlabeled samples and domain labels corresponding to the unlabeled samples.
[0058] Specifically in this embodiment, the set composed of labeled samples is denoted as the labeled data set which contains l labeled samples, and the i-th labeled sample x i has a classification label of y i ; the set composed of unlabeled samples is denoted as the unlabeled data set which includes u unlabeled samples. Moreover, the number of labeled samples is much smaller than the number of unlabeled samples, that is, l << u. The feature distribution of the labeled data set is p l , and the feature distribution of the unlabeled data set is p u , and p l≠p u Since the feature distributions of labeled samples and unlabeled samples in the training set are inconsistent, the unlabeled samples are regarded as the source domain, and the corresponding domain is labeled as d i = 1, the labeled sample is regarded as the target domain, and the corresponding domain is marked as d i =0.
[0059] A2. Build a semi-supervised classification model, and use the adversarial domain adaptation strategy and improved mixup strategy to optimize the semi-supervised classification model based on labeled data sets and unlabeled data sets to obtain a locally optimized semi-supervised classification model; Figure 2 As shown, the semi-supervised classification model includes a feature extractor F, a classifier C and a domain discriminator D; the adversarial domain adaptation strategy is used to reduce the marginal distribution difference between the feature representations extracted by the feature extractor according to the labeled samples and the unlabeled samples; the improved mixup strategy is used to enable the feature extractor to learn the domain invariant features of the continuous latent space between the feature distributions of the labeled data set and the unlabeled data set.
[0060] In this embodiment, if Figure 3 As shown, step A2 specifically includes the following steps:
[0061] A21. Based on the feature extractor, classifier and domain discriminator, a semi-supervised classification model is constructed; the feature extractor is used to extract the feature representation of the input data; the classifier is used to output the corresponding classification probability prediction result according to the feature representation; the domain discriminator is used to output the corresponding domain label prediction result according to the feature representation. Given an input instance x, the feature representation z = F(x) of instance x is obtained through the feature extractor F, and the feature representation z is input to the classifier C to obtain the corresponding classification probability prediction result f c =C(F(x)), according to f c The classification mark can be obtained; the feature representation z is input into the domain discriminator D to obtain the corresponding domain probability prediction result f d =D(F(x)), according to f d Domain tags are available.
[0062] A22. An adversarial domain adaptation strategy is used to optimize the semi-supervised classification model based on labeled data sets and unlabeled data sets to obtain the semi-supervised classification model after initial optimization. The adversarial domain adaptation strategy is used to reduce the marginal distribution difference between the feature representations extracted by the feature extractor based on labeled samples and unlabeled samples.
[0063] The principle of adversarial domain adaptation strategy is:
[0064] The domain discriminator is used to identify the features that distinguish labeled samples from unlabeled samples. The output of the discriminator is f d=D(F(x)) can be considered as the domain similarity of the input instance x. Since the domain label of the unlabeled sample is 1 and the domain label of the labeled sample is 0, the larger the domain similarity is, the more likely the input instance x is a sample in the unlabeled sample set. That is, the accuracy of the discriminator D describes the difference in the marginal distribution of the domain of the labeled sample and the unlabeled sample data.
[0065] The goal of the feature extractor F is to deceive the domain discriminator D. It is hoped that the obtained feature representation z will not allow the domain discriminator to distinguish which feature distribution the instance x belongs to, so that the features extracted by the feature extractor F reduce the marginal distribution difference between labeled samples and unlabeled samples.
[0066] Specifically in this embodiment, step A22 includes the following steps:
[0067] A221. Select a labeled sample and an unlabeled sample from the labeled data set and the unlabeled data set respectively, and use a feature extractor to extract feature representations of the labeled sample and the unlabeled sample respectively.
[0068] A222. Use the domain discriminator to output the domain label prediction results according to the feature representation of the labeled sample and the feature representation of the unlabeled sample, respectively, to construct an adversarial domain adaptation loss function. In this embodiment, the adversarial domain adaptation loss function is shown as follows:
[0069]
[0070] Among them, L adv is the adversarial domain adaptation loss function value, x i is the labeled sample, p l is the feature distribution of the labeled dataset, D() is the processing function of the domain discriminator, F() is the processing function of the feature extractor, and x j is an unlabeled sample, p u is the feature distribution of the unlabeled dataset.
[0071] A223. Optimize the parameters of the semi-supervised classification model with the goal of minimizing the adversarial domain adaptation loss function to obtain the semi-supervised classification model after initial optimization. Optimize the parameters of the feature extractor F and the domain discriminator D by minimizing the adversarial domain adaptation loss function.
[0072] If only labeled samples and unlabeled samples are used for adversarial domain adaptation learning, then the domain discriminator D only judges the domain to which the instance belongs under the guidance of the hard labels of labeled samples and unlabeled samples, so the learned feature extractor It is not possible to guarantee domain-invariant feature representation in the potential intermediate region between the feature distribution of labeled samples and the feature distribution of unlabeled samples. Therefore, the mixup strategy is introduced to construct mixed samples in the potential intermediate region between the feature distribution of labeled samples and the feature distribution of unlabeled samples.
[0073] A23, using an improved mixup strategy, optimizing the semi-supervised classification model after the initial optimization based on the labeled data set and the unlabeled data set to obtain a locally optimized semi-supervised classification model; the improved mixup strategy is used to enable the feature extractor to learn the domain-invariant features of the continuous latent space between the feature distributions of the labeled data set and the unlabeled data set. In this embodiment, step A23 specifically includes the following steps:
[0074] A231. For any unlabeled sample in the unlabeled data set, the semi-supervised classification model after initial optimization is used to obtain the classification probability prediction result of the unlabeled sample, and determine the pseudo classification label of the unlabeled sample.
[0075] A232. Select a labeled sample in the labeled data set that has the same pseudo classification label as the unlabeled sample, and perform a mixup operation on the unlabeled sample and the labeled sample to obtain a mixed feature representation and a mixed domain label. In this embodiment, the mixed feature representation and the mixed domain label are obtained according to the following formulas:
[0076] z mix =λz i +(1-λ)z j .
[0077] d mix =1-λ.
[0078] Among them, z mix is a mixed feature representation, d mix is a mixed domain marker, z i is the feature representation of the labeled sample, z j is the feature representation of unlabeled samples, λ is sampled from Beta(α, α) distribution, and α is a hyperparameter.
[0079] A233. Based on the hybrid feature representation and the hybrid domain labeling, a hybrid loss function is constructed. In this embodiment, the hybrid loss function is shown in the following formula:
[0080]
[0081] Among them, L mix is the mixed loss function value.
[0082] A234. Optimize the parameters of the semi-supervised classification model after the initial optimization with the goal of minimizing the hybrid loss function to obtain a locally optimized semi-supervised classification model. Optimize the parameters of the feature extractor F and the domain discriminator D by minimizing the above hybrid loss function to ensure the domain invariance of the continuous latent space between the feature distribution of the labeled samples and the feature distribution of the unlabeled samples.
[0083] A3. For any unlabeled sample in the unlabeled data set, based on the locally optimized semi-supervised classification model, the feature representation and classification probability prediction results of the unlabeled sample are obtained.
[0084] A4. Based on the category prototypes of each category in the labeled data set and the unlabeled data set, the classification probability prediction results of the unlabeled samples are corrected to obtain the classification labels of the unlabeled samples. Figure 4 As shown, step A4 specifically includes the following steps:
[0085] A41. Calculate the category prototypes of each category in the labeled dataset and the unlabeled dataset according to the labeled dataset. In this step, the category prototypes {P1, P2, ..., P c}, the labeled sample x i Input the feature extractor F optimized in the previous step to obtain the feature representation z i , use the following formula to calculate the category prototype P k .
[0086]
[0087] Among them, P k represents the category prototype of category k, 1(y i =k) is the indicator function, when the labeled sample x i Label y i When k is equal to 1(y i = k) is equal to 1; otherwise it is 0, n k Indicates the number of samples belonging to the kth class.
[0088] A42. Calculate the similarity between the category prototype of each category and the feature representation of the unlabeled sample. j Input the feature extractor F optimized in the previous step to obtain the unlabeled sample feature representation z j , calculate the feature representation z of the unlabeled samples according to the following formula j With each category prototype P k The similarity S between j,k :
[0089]
[0090] Among them, d(,) is used to calculate the distance between the feature representation and the category prototype.
[0091] A43. According to the similarity between the category prototype of each category and the feature representation of the unlabeled sample, the classification probability prediction result of the unlabeled sample is corrected to obtain the classification label of the unlabeled sample. In this step, the classification probability prediction result of the unlabeled sample is corrected according to the following formula:
[0092]
[0093] Among them, y j is the corrected classification probability prediction result of the unlabeled sample, S j To represent the features of unlabeled samples z j With each category prototype P k The similarities between them are concatenated into a vector [S j,1 , S j,2 , ..., S j,C ], and then normalize the vector to get the similarity probability, β is a hyperparameter.
[0094] A5. Based on the labeled data set and the unlabeled data set, the locally optimized semi-supervised classification model is optimized to obtain a globally optimized semi-supervised classification model. Figure 5 As shown, step A5 specifically includes the following steps:
[0095] A51. Select a labeled sample and an unlabeled sample from the labeled data set and the unlabeled data set respectively, input the labeled sample and the unlabeled sample into the locally optimized semi-supervised classification model, and obtain the classification probability prediction results of the labeled sample and the classification probability prediction results of the unlabeled sample.
[0096] A52. Construct a combined cross entropy loss function based on the classification probability prediction results of the labeled samples, the classification labels of the labeled samples, the classification probability prediction results of the unlabeled samples, and the classification labels of the unlabeled samples. The combined cross entropy loss function is shown in the following formula:
[0097]
[0098] Among them, L ce is the combined cross entropy loss function value, and H(,) is the cross entropy calculation function.
[0099] A53. With the goal of minimizing the combined cross entropy loss function, update the parameters of the classifier in the locally optimized semi-supervised classification model to obtain the globally optimized semi-supervised classification model.
[0100] A6. Input samples with unknown classification labels into the globally optimized semi-supervised classification model to obtain the classification probability prediction results corresponding to the samples, and determine the classification labels of the samples based on the classification probability prediction results of the samples.
[0101] In the following specific example, a PACS dataset is used as a dataset processed by a semi-supervised classification method for inconsistent feature distribution to verify the effectiveness of the semi-supervised classification method for inconsistent feature distribution provided in the above embodiment of the present application. The data in the PACS dataset are sampled from four different domains, namely photos, art paintings, cartoon images, and sketches, and each domain contains 7 categories. In this example, the labeled samples are images sampled from photos, and the unlabeled samples are images sampled from art paintings. The classification results of the semi-supervised classification method for inconsistent feature distribution provided in the above embodiment of the present application are verified when the number of labeled samples in each category is 5, 10, 20, and 100, respectively. The verification results are shown in Table 1:
[0102] Table 1 Classification accuracy of the above schemes under different numbers of labeled samples
[0103] Number of markers 5 10 20 100 Accuracy (%) 77.65 84.12 91.54 94.12
[0104] According to the results shown in Table 1, the method provided in the above embodiments of the present application can also achieve good prediction results under different numbers of labeled samples and has good application value.
[0105] In the solution provided by the above embodiment of the present application, when training the classifier, the labeled data and the unlabeled data can be obtained first, and the classification model can be optimized using the adversarial domain adaptation strategy and the improved mixup strategy to reduce the difference in the marginal distribution of the labeled samples and the unlabeled samples and ensure the domain invariance of the continuous latent space. At the same time, the category prototype of the labeled sample is used to guide the update of the classification probability prediction results of the unlabeled samples, and finally the labeled samples and the unlabeled samples are used to update the classifier network parameters to train the classifier. The training process of the classifier fully takes into account the influence of the feature distribution factors, thereby effectively improving the accuracy of the trained classifier.
[0106] Based on the same inventive concept, the embodiment of the present application also provides a system for implementing the above-mentioned semi-supervised classification method for inconsistent feature distribution. The implementation scheme for solving the problem provided by the system is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more system embodiments provided below can refer to the limitations of the semi-supervised classification method for inconsistent feature distribution above, and will not be repeated here.
[0107] In an exemplary embodiment, Figure 6As shown, a semi-supervised classification system for inconsistent feature distribution is provided, including the following modules:
[0108] The training data set acquisition module is used to acquire labeled data sets and unlabeled data sets with inconsistent feature distribution; the labeled data sets include a number of labeled samples, classification labels and domain labels corresponding to the labeled samples; the unlabeled data sets include a number of unlabeled samples and domain labels corresponding to the unlabeled samples.
[0109] The semi-supervised classification model building module is used to build a semi-supervised classification model; the semi-supervised classification model includes a feature extractor, a classifier, and a domain discriminator.
[0110] The model local optimization module is used to optimize the semi-supervised classification model based on labeled data sets and unlabeled data sets by adopting the adversarial domain adaptation strategy and the improved mixup strategy to obtain a locally optimized semi-supervised classification model; the adversarial domain adaptation strategy is used to reduce the marginal distribution difference between the feature representations extracted by the feature extractor based on labeled samples and unlabeled samples; the improved mixup strategy is used to enable the feature extractor to learn the domain-invariant features of the continuous latent space between the feature distributions of the labeled data sets and the unlabeled data sets.
[0111] The unlabeled sample pseudo prediction module is used to obtain the feature representation and classification probability prediction results of any unlabeled sample in the unlabeled data set based on the locally optimized semi-supervised classification model.
[0112] The unlabeled sample prediction result correction module is used to correct the classification probability prediction result of the unlabeled sample based on the category prototypes of each category of the labeled data set and the unlabeled data set to obtain the classification label of the unlabeled sample.
[0113] The classifier partial optimization module is used to optimize the locally optimized semi-supervised classification model based on the labeled data set and the unlabeled data set to obtain the globally optimized semi-supervised classification model.
[0114] The classification label prediction module is used to input samples with unknown classification labels into the globally optimized semi-supervised classification model to obtain the classification probability prediction results corresponding to the samples, and determine the classification labels of the samples based on the classification probability prediction results of the samples.
[0115] certainly, Figure 6 The architecture shown is only exemplary and can be omitted according to actual needs when implementing different functions. Figure 6 One or at least two components of the system shown.
[0116] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps of the semi-supervised classification method for inconsistent feature distribution provided in the above embodiment can be implemented or the functions of the semi-supervised classification system for inconsistent feature distribution provided in the above embodiment can be implemented.
[0117] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0118] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0119] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0120] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0121] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0122] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0123] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.
[0124] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0125] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A semi-supervised classification method for inconsistent feature distribution, characterized in that: include: Obtaining a labeled data set and an unlabeled data set with inconsistent feature distribution; the labeled data set includes a plurality of labeled samples, classification labels and domain labels corresponding to the labeled samples; the unlabeled data set includes a plurality of unlabeled samples and domain labels corresponding to the unlabeled samples; A semi-supervised classification model is constructed, and an adversarial domain adaptation strategy and an improved mixup strategy are adopted to optimize the semi-supervised classification model based on the labeled data set and the unlabeled data set to obtain a locally optimized semi-supervised classification model; the semi-supervised classification model includes a feature extractor, a classifier, and a domain discriminator; the adversarial domain adaptation strategy is used to reduce the marginal distribution difference between the feature representations extracted by the feature extractor according to the labeled samples and the unlabeled samples; the improved mixup strategy is used to enable the feature extractor to learn the domain invariant features of the continuous latent space between the feature distributions of the labeled data set and the unlabeled data set; For any unlabeled sample in the unlabeled data set, based on the locally optimized semi-supervised classification model, obtain a feature representation and a classification probability prediction result of the unlabeled sample; Based on the category prototypes of each category of the labeled data set and the unlabeled data set, the classification probability prediction result of the unlabeled sample is corrected to obtain the classification label of the unlabeled sample; Based on the labeled data set and the unlabeled data set, optimizing the locally optimized semi-supervised classification model to obtain a globally optimized semi-supervised classification model; The samples with unknown classification labels are input into the globally optimized semi-supervised classification model to obtain the classification probability prediction results corresponding to the samples, and the classification labels of the samples are determined according to the classification probability prediction results of the samples.
2. The semi-supervised classification method for inconsistent feature distribution according to claim 1, characterized in that: A semi-supervised classification model is constructed, and an adversarial domain adaptation strategy and an improved mixup strategy are adopted to optimize the semi-supervised classification model based on the labeled data set and the unlabeled data set to obtain a locally optimized semi-supervised classification model, specifically including: Based on the feature extractor, the classifier and the domain discriminator, a semi-supervised classification model is constructed; the feature extractor is used to extract the feature representation of the input data; the classifier is used to output the corresponding classification probability prediction result according to the feature representation; the domain discriminator is used to output the corresponding domain label prediction result according to the feature representation; Adopting an adversarial domain adaptation strategy, the semi-supervised classification model is optimized based on the labeled data set and the unlabeled data set to obtain a semi-supervised classification model after initial optimization; the adversarial domain adaptation strategy is used to reduce the marginal distribution difference between the feature representations extracted by the feature extractor based on the labeled samples and the unlabeled samples; An improved mixup strategy is adopted to optimize the semi-supervised classification model after the initial optimization based on the labeled data set and the unlabeled data set to obtain a locally optimized semi-supervised classification model; the improved mixup strategy is used to enable the feature extractor to learn domain-invariant features of the continuous latent space between the feature distributions of the labeled data set and the unlabeled data set.
3. The semi-supervised classification method for inconsistent feature distribution according to claim 2, characterized in that: The domain label of the labeled sample is 0, and the domain label of the unlabeled sample is 1; the semi-supervised classification model is optimized based on the labeled data set and the unlabeled data set by using an adversarial domain adaptation strategy to obtain a semi-supervised classification model after initial optimization, specifically including: Selecting a labeled sample and an unlabeled sample from the labeled data set and the unlabeled data set respectively, and using the feature extractor to extract feature representations of the labeled sample and the unlabeled sample respectively; Using the domain label prediction results output by the domain discriminator according to the feature representation of the labeled sample and the feature representation of the unlabeled sample, respectively, to construct an adversarial domain adaptation loss function; With the goal of minimizing the adversarial domain adaptation loss function, the parameters of the semi-supervised classification model are optimized to obtain a semi-supervised classification model after initial optimization.
4. The semi-supervised classification method for inconsistent feature distribution according to claim 2, characterized in that: The improved mixup strategy is adopted to optimize the semi-supervised classification model after the initial optimization based on the labeled data set and the unlabeled data set to obtain a locally optimized semi-supervised classification model, specifically including: For any unlabeled sample in the unlabeled data set, using the semi-supervised classification model after the initial optimization to obtain a classification probability prediction result of the unlabeled sample, and determine a pseudo classification label of the unlabeled sample; Selecting a labeled sample in the labeled data set that has the same pseudo classification label as the unlabeled sample, performing a mixup operation on the unlabeled sample and the labeled sample to obtain a mixed feature representation and a mixed domain label; constructing a hybrid loss function based on the hybrid feature representation and the hybrid domain label; With the goal of minimizing the hybrid loss function, the parameters of the semi-supervised classification model after the initial optimization are optimized to obtain a locally optimized semi-supervised classification model.
5. The semi-supervised classification method for inconsistent feature distribution according to claim 1, characterized in that: Based on the category prototypes of each category of the labeled data set and the unlabeled data set, the classification probability prediction result of the unlabeled sample is corrected to obtain the classification label of the unlabeled sample, specifically including: According to the labeled data set, the category prototypes of each category of the labeled data set and the unlabeled data set are calculated; Calculate the similarity between the category prototype of each category and the feature representation of the unlabeled sample; According to the similarity between the category prototype of each category and the feature representation of the unlabeled sample, the classification probability prediction result of the unlabeled sample is corrected to obtain the classification label of the unlabeled sample.
6. The semi-supervised classification method for inconsistent feature distribution according to claim 1, characterized in that: Based on the labeled data set and the unlabeled data set, optimizing the locally optimized semi-supervised classification model to obtain a globally optimized semi-supervised classification model specifically includes: Selecting a labeled sample and an unlabeled sample from the labeled data set and the unlabeled data set respectively, inputting the labeled sample and the unlabeled sample into the locally optimized semi-supervised classification model, and obtaining a classification probability prediction result of the labeled sample and a classification probability prediction result of the unlabeled sample; Constructing a combined cross entropy loss function according to the classification probability prediction result of the labeled sample, the classification label of the labeled sample, the classification probability prediction result of the unlabeled sample and the classification label of the unlabeled sample; With the goal of minimizing the combined cross entropy loss function, the parameters of the classifier in the locally optimized semi-supervised classification model are updated to obtain a globally optimized semi-supervised classification model.
7. A semi-supervised classification system for inconsistent feature distribution, characterized in that: include: A training data set acquisition module is used to acquire a labeled data set and an unlabeled data set with inconsistent feature distribution; the labeled data set includes a number of labeled samples, classification labels and domain labels corresponding to the labeled samples; the unlabeled data set includes a number of unlabeled samples and domain labels corresponding to the unlabeled samples; A semi-supervised classification model building module, used to build a semi-supervised classification model; the semi-supervised classification model includes a feature extractor, a classifier and a domain discriminator; A model local optimization module, used for optimizing the semi-supervised classification model based on the labeled data set and the unlabeled data set by adopting an adversarial domain adaptation strategy and an improved mixup strategy, so as to obtain a locally optimized semi-supervised classification model; the adversarial domain adaptation strategy is used for reducing the marginal distribution difference between the feature representations extracted by the feature extractor according to the labeled samples and the unlabeled samples; the improved mixup strategy is used for enabling the feature extractor to learn the domain invariant features of the continuous latent space between the feature distributions of the labeled data set and the unlabeled data set; An unlabeled sample pseudo prediction module is used to obtain a feature representation and a classification probability prediction result of any unlabeled sample in the unlabeled data set based on the locally optimized semi-supervised classification model; An unlabeled sample prediction result correction module is used to correct the classification probability prediction result of the unlabeled sample based on the category prototypes of the labeled data set and each category of the unlabeled data set to obtain the classification label of the unlabeled sample; A classifier partial optimization module, used for optimizing the locally optimized semi-supervised classification model based on the labeled data set and the unlabeled data set to obtain a globally optimized semi-supervised classification model; The classification label prediction module is used to input samples with unknown classification labels into the globally optimized semi-supervised classification model to obtain the classification probability prediction results corresponding to the samples, and determine the classification labels of the samples based on the classification probability prediction results of the samples.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the semi-supervised classification method for inconsistent feature distribution according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the semi-supervised classification method for inconsistent feature distribution described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the semi-supervised classification method for inconsistent feature distribution described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Data processing method and apparatus based on classification model, and electronic device and medium
WO2021139279A1
Training method for semi-supervised learning model, image processing method, and device
WO2022042002A1