Classification method, classification model training method, device, equipment and storage medium

By combining the generator model and the discriminator model, and using the product and weighted sum of their prediction results to determine the target category, it solves the problem that a single model is difficult to handle multiple labels in the classification of massive labeled text, and improves the classification speed and accuracy.

CN111753091BActive Publication Date: 2024-09-03BEIJING XIAOMI PINECONE ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010622932.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-30
Publication Date
2024-09-03
Estimated Expiration
2040-06-30

AI Technical Summary

Technical Problem

In text classification with massive labels, it is difficult for a single classification model to obtain ideal classification results when processing tens of thousands of labels, resulting in poor classification results.

Method used

Using a joint method based on the generator model and the discriminator model, the first prediction result of the data to be classified is obtained through the generator model and the second prediction result is obtained by the discriminator model, and the classification is determined based on the product and weighted sum of these two results. The target category of categorical data.

Benefits of technology

The classification speed and accuracy are improved, the efficiency of the generator model and the accuracy of the discriminator model are fully utilized, the calculation amount of the training model is reduced, and the comprehensiveness and accuracy of the classification results are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111753091B
    Figure CN111753091B
Patent Text Reader

Abstract

The present disclosure relates to a classification method, a training method, an apparatus, a device and a storage medium for a classification model. The classification method is applied to an electronic device, and includes: obtaining a first prediction result output by a generator model based on data to be classified; inputting the data to be classified into a discriminator model to obtain a second prediction result; and determining a target category of the data to be classified based on the first prediction result and the second prediction result. Since the first prediction result and the second prediction result are obtained based on the generator model and the discriminator model, respectively, the respective characteristics of the generator model and the discriminator model can be fully utilized. For example, when the performance of the generator model is high and the accuracy of the discriminator model is high, the speed of classifying the data to be classified can be improved, and the accuracy of the obtained classification results can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of mathematical models, and in particular to a classification method, a training method, an apparatus, a device and a storage medium for a classification model. Background Art

[0002] Massive labeled text classification, as an important branch of text classification, is to select multiple relevant tags from a very large tag set to label a given text. This task has many practical applications, such as product classification, video themes, news annotations, search recommendations, etc. At present, massive labeled text classification algorithms are mainly divided into four categories: one-vs-all methods, tree-based methods, vector representation-based methods, and deep learning methods.

[0003] However, in the related art, classification data is classified based on a single classification model. During the classification process, if the number of labels is too large (for example, tens of thousands of labels), a relatively ideal classification result cannot be obtained through a single classification model. Summary of the invention

[0004] The present invention provides a classification method, a classification model training method, an apparatus, a device and a storage medium.

[0005] According to a first aspect of an embodiment of the present disclosure, there is provided a classification method, which is applied to an electronic device, and includes:

[0006] Based on the data to be classified, obtaining a first prediction result output by the generator model;

[0007] Inputting the data to be classified into a discriminator model to obtain a second prediction result;

[0008] Based on the first prediction result and the second prediction result, a target category of the data to be classified is determined.

[0009] Optionally, the first prediction result includes K first prediction probabilities of the data to be classified on K categories; the second prediction result includes K second prediction probabilities of the data to be classified on the K categories;

[0010] The determining the target category of the data to be classified based on the first prediction result and the second prediction result includes:

[0011] Obtaining K target prediction probabilities based on the product of the K first prediction probabilities and the K second prediction probabilities;

[0012] Sort the K target prediction probabilities in descending order;

[0013] The category labels of a preset number of categories corresponding to the first preset number of the target prediction probabilities after sorting are determined as the target labels of the data to be classified.

[0014] Optionally, the method further includes:

[0015] Performing word segmentation processing on the data to be classified, and inputting the words obtained by word segmentation of the data to be classified into the generator model;

[0016] Based on the generator model, word embedding processing is performed on the words contained in the data to be classified to obtain word vectors of each word in the data to be classified.

[0017] Optionally, obtaining a first prediction result output by the generator model based on the data to be classified includes:

[0018] Using the generator model, based on the word vector of each word in the data to be classified, obtain K first prediction probabilities of the data to be classified on K categories;

[0019] The step of inputting the data to be classified into a discriminator model to obtain the second prediction result comprises:

[0020] The discriminator model is used to obtain K second prediction probabilities of the data to be classified on the K categories based on the word vectors of the words in the data to be classified.

[0021] Optionally, the type of the data to be classified includes at least one of the following: an image data type, a text data type, and an audio data type.

[0022] Optionally, the generator model includes an Albert model, and the discriminator model includes a Bert model.

[0023] According to a second aspect of an embodiment of the present disclosure, a classification model training method is provided, for training the discriminator model according to any one of the first aspects above, the method comprising:

[0024] Input the labeled sample data in the training set into the generator model to obtain N category probabilities of the N first prediction labels corresponding to the sample data; wherein each sample data corresponds to at least one of the first prediction labels;

[0025] Sorting the N category probabilities in descending order, and determining the first L category probabilities from the sorted category probabilities;

[0026] Determine the L first prediction labels corresponding to the first L class probabilities as L candidate labels constituting a candidate label set; wherein L and N are positive integers, and L is less than N;

[0027] The discriminator model is trained based on the sample data and the candidate label set.

[0028] Optionally, the method further includes:

[0029] Determine an average number of labels for a single sample data based on the total number of the first prediction labels and the number of the sample data;

[0030] The L is obtained based on the product of the average number of labels and the first set hyperparameter.

[0031] Optionally, the method further includes:

[0032] Determine a first loss of the generator model on the training set according to a difference between a true label of the sample data and a first predicted label output by the generator model;

[0033] Determine a second loss of the discriminator model on the candidate label set based on the candidate label and a second predicted label output by the discriminator model;

[0034] Using the second set hyperparameter, weighting the first loss and the second loss and summing them to obtain a training loss;

[0035] Based on the training loss, model parameters of the generator model and the discriminator model are updated.

[0036] According to a third aspect of an embodiment of the present disclosure, there is provided a classification device, applied to an electronic device, comprising:

[0037] A first acquisition module is configured to obtain a first prediction result output by the generator model based on the data to be classified;

[0038] A second acquisition module is configured to input the data to be classified into a discriminator model to obtain a second prediction result;

[0039] A classification module is configured to determine a target category of the data to be classified based on the first prediction result and the second prediction result.

[0040] Optionally, the first prediction result includes K first prediction probabilities of the data to be classified on K categories; the second prediction result includes K second prediction probabilities of the data to be classified on the K categories; and the classification module is further configured as:

[0041] Obtaining K target prediction probabilities based on the product of the K first prediction probabilities and the K second prediction probabilities;

[0042] Sort the K target prediction probabilities in descending order;

[0043] The category labels of a preset number of categories corresponding to the first preset number of the target prediction probabilities after sorting are determined as the target labels of the data to be classified.

[0044] Optionally, the device further comprises:

[0045] A word segmentation module, configured to perform word segmentation processing on the data to be classified, and input the words obtained by segmenting the data to be classified into the generator model;

[0046] The vector conversion module is configured to perform word embedding processing on the words contained in the data to be classified based on the generator model to obtain word vectors of each word in the data to be classified.

[0047] Optionally, the first acquisition module is further configured to:

[0048] Using the generator model, based on the word vector of each word in the data to be classified, obtain K first prediction probabilities of the data to be classified on K categories;

[0049] The second acquisition module is further configured to:

[0050] The discriminator model is used to obtain K second prediction probabilities of the data to be classified on the K categories based on the word vectors of the words in the data to be classified.

[0051] Optionally, the type of the data to be classified includes at least one of the following: an image data type, a text data type, and an audio data type.

[0052] Optionally, the generator model includes an Albert model, and the discriminator model includes a Bert model.

[0053] According to a fourth aspect of an embodiment of the present disclosure, a classification model training device is provided, which is used for the discriminator model described in any one of the third aspects above, and the device includes:

[0054] A third acquisition module is configured to input the labeled sample data in the training set into the generator model to obtain N category probabilities of the N first prediction labels corresponding to the sample data; wherein each sample data corresponds to at least one of the first prediction labels;

[0055] A first determination module is configured to sort the N category probabilities in descending order, and determine the first L category probabilities from the sorted category probabilities;

[0056] A second determination module is configured to determine the L first prediction labels corresponding to the first L category probabilities as L candidate labels constituting a candidate label set; wherein L and N are positive integers, and L is less than N;

[0057] A training module is configured to train the discriminator model based on the sample data and the candidate label set.

[0058] Optionally, the device further comprises:

[0059] A third determination module is configured to determine an average number of labels for a single sample data based on the total number of the first prediction labels and the number of the sample data;

[0060] The first calculation module is configured to obtain the L based on the product of the average number of labels and a first set hyperparameter.

[0061] Optionally, the device further comprises:

[0062] a fourth determination module, configured to determine a first loss of the generator model on the training set according to a difference between a true label of the sample data and a first predicted label output by the generator model;

[0063] a fifth determination module, configured to determine a second loss of the discriminator model on the candidate label set based on the candidate label and a second predicted label output by the discriminator model;

[0064] A second calculation module is configured to use a second set hyperparameter to weight the first loss and the second loss and then sum them to obtain a training loss;

[0065] An updating module is configured to update model parameters of the generator model and the discriminator model based on the training loss.

[0066] According to a fifth aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0067] processor;

[0068] a memory configured to store processor-executable instructions;

[0069] Wherein, the processor is configured to: implement any classification method in the above-mentioned first aspect or any step in the classification model training in the above-mentioned second aspect when executed.

[0070] According to the sixth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform any classification method in the above-mentioned first aspect or any steps in the classification model training in the above-mentioned second aspect.

[0071] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0072] It can be seen from the above embodiments that the present disclosure obtains the first prediction result output by the generator model based on the data to be classified, inputs the classified data into the discriminator model to obtain the second prediction result, and determines the target category of the data to be classified based on the obtained first prediction result and the second prediction result. Since the first prediction result and the second prediction result are obtained based on the generator model and the discriminator model, respectively, the respective characteristics of the generator model and the discriminator model can be fully utilized. For example, when the performance of the generator model is high, such as fast running speed, and the accuracy of the discriminator model is high, the speed of classifying the data to be classified can be improved, and the accuracy of the obtained classification results can be improved.

[0073] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0075] Figure 1 The figure is a flowchart of a classification method according to an exemplary embodiment.

[0076] Figure 2 It is a flowchart of a classification model training method according to an exemplary embodiment.

[0077] Figure 3 It is a flowchart of another classification model training method according to an exemplary embodiment.

[0078] Figure 4 This is a schematic diagram of the process of pre-training the generator model.

[0079] Figure 5 This is a flowchart for training the discriminator model.

[0080] Figure 6 is a block diagram of a classification device according to an exemplary embodiment.

[0081] Figure 7The figure is a block diagram of a training device for a classification model according to an exemplary embodiment.

[0082] Figure 8 It is a block diagram of an electronic device according to an exemplary embodiment.

[0083] Fig. 9 is a block diagram of another electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0084] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0085] The present disclosure provides a classification method. Figure 1 is a flow chart of a classification method according to an exemplary embodiment. Figure 1 As shown, the method is applied to electronic equipment and mainly includes the following steps:

[0086] In step 101, a first prediction result output by a generator model is obtained based on the data to be classified;

[0087] In step 102, the data to be classified is input into a discriminator model to obtain a second prediction result;

[0088] In step 103, a target category of the data to be classified is determined based on the first prediction result and the second prediction result.

[0089] Here, the electronic device includes a mobile terminal and a fixed terminal, wherein the mobile terminal includes: a mobile phone, a tablet computer, a laptop computer, etc.; the fixed terminal includes: a personal computer. In other optional embodiments, the information processing method can also be run on a network side device, wherein the network side device includes: a server, a processing center, etc.

[0090] The generator model and the discriminator model in the embodiments of the present disclosure can be used to implement a predetermined function, which includes but is not limited to at least one of the following:

[0091] Object segmentation to segment the object and background in the input image;

[0092] Classification of objects in the input image;

[0093] Object tracking based on incoming images;

[0094] Diagnostic assistance based on medical images;

[0095] Functions such as speech recognition and / or speech correction based on input speech.

[0096] The above is only an example of the predetermined functions implemented by the generator model and the discriminator model, and the specific implementation is not limited to the above examples.

[0097] In some embodiments, the generator model includes an Albert model, and the discriminator model includes a Bert model. For example, the generator model includes a model with low prediction accuracy but fast data processing speed, such as the Albert model, the tiny model, and fast text classification models such as support vector machines. The discriminator model includes a pre-trained model with high prediction accuracy but slow data processing speed. For example, neural network models such as the Bert model, the Enhanced Representation from Knowledge Integration (Ernie model), and the Xlnet model.

[0098] In the implementation process, the Albert model can be used as the basic model, and the Albert model can be trained based on the labeled sample data in the training set to obtain the generator model. For example, the loss function can be used to determine the first loss of the Albert model on the training set based on the real label of the sample data and the first predicted label output by the Albert model, and the model parameters of the Albert model can be updated based on the first loss until the value change of the first loss within the set time is less than the set change threshold, then the training of the Albert model is stopped to obtain the generator model.

[0099] For another example, the Bert model can be used as a basic model, and the Bert model can be trained based on the labeled sample data in the training set to obtain a discriminator model. For example, a loss function can be used to determine the second loss of the Bert model on the training set based on the true label of the sample data and the second predicted label output by the Bert model, and the model parameters of the Bert model can be updated based on the second loss until the value change of the second loss within a set time length is less than a set change threshold, then stop training the Bert model to obtain a discriminator model. In other optional embodiments, the generator model and the discriminator model can also be trained in other ways, which are not specifically limited here.

[0100] After obtaining the first prediction result and the second prediction result, the target category of the data to be classified can be determined based on the first prediction result and the second prediction result. For example, the first prediction result and the second prediction result can be multiplied, and the target category of the data to be classified can be determined based on the calculation result. For another example, the first prediction result and the second prediction result can be weighted based on a preset weight value and then summed, and the target category of the data to be classified can be determined based on the calculated sum.

[0101] In the disclosed embodiment, the first prediction result output by the generator model is obtained based on the data to be classified, the data to be classified is input into the discriminator model to obtain the second prediction result, and the target category of the data to be classified is determined based on the obtained first prediction result and the second prediction result. Since the first prediction result and the second prediction result are obtained based on the generator model and the discriminator model, respectively, the respective characteristics of the generator model and the discriminator model can be fully utilized. For example, when the performance of the generator model is high and the accuracy of the discriminator model is high, the speed of classifying the data to be classified can be improved, and the accuracy of the obtained classification results can be improved.

[0102] In some embodiments, the first prediction result includes K first prediction probabilities of the data to be classified on K categories; the second prediction result includes K second prediction probabilities of the data to be classified on the K categories; and determining the target category of the data to be classified based on the first prediction result and the second prediction result includes:

[0103] Obtaining K target prediction probabilities based on the product of the K first prediction probabilities and the K second prediction probabilities;

[0104] Sort the K target prediction probabilities in descending order;

[0105] The category labels of a preset number of categories corresponding to the first preset number of the target prediction probabilities after sorting are determined as the target labels of the data to be classified.

[0106] In the embodiment of the present disclosure, K first prediction probabilities of the data to be classified on K categories can be obtained based on the generator model, and K second prediction probabilities of the data to be classified on K categories can be obtained based on the discriminator model. Here, the types of the first prediction probability and the second prediction probability may include: non-normalized probability and normalized probability, wherein the non-normalized probability is a probability value that has not been normalized by a normalization function (for example, softmax function, sigmoid, etc.), and the normalized probability refers to a probability value that has been normalized by a normalization function. Since the non-normalized probability contains a higher amount of information than the normalized probability, in the embodiment of the present disclosure, the non-normalized probability can be output based on the generator model, and in other optional embodiments, the normalized probability can also be output based on the generator model.

[0107] After obtaining K first prediction probabilities and K second prediction probabilities of the data to be classified on K categories, the K first prediction probabilities and the K second prediction probabilities can be multiplied to obtain K target prediction probabilities. Since the first prediction result and the second prediction result are obtained based on the generator model and the discriminator model respectively, the respective characteristics of the generator model and the discriminator model can be fully utilized to obtain the target prediction probability.

[0108] In the implementation process, in order to reduce the amount of data to be processed and improve the accuracy of the classification results, the K target prediction probabilities can be sorted in a set order, and a preset number of target prediction probabilities can be determined from the sorted target prediction probabilities. For example, the K target prediction probabilities can be sorted in order from large to small.

[0109] When the K target prediction probabilities are sorted in order from large to small, the first preset number of target prediction probabilities can be determined from the sorted target prediction probabilities, and the class labels of the preset number of categories corresponding to the first preset number of target prediction probabilities are determined as the target labels of the data to be classified. When the K target prediction probabilities are sorted in order from small to large, the last preset number of target prediction probabilities can be determined from the sorted target prediction probabilities, and the class labels of the preset number of categories corresponding to the last preset number of target prediction probabilities are determined as the target labels of the data to be classified.

[0110] For example, if the first predicted probability of the data to be classified in the first class is 0.2, and the second predicted probability is 0.2, then the target predicted probability of the data to be classified in the first class is the product of 0.2 and 0.2, that is, 0.04. If the first predicted probability of the data to be classified in the second class is 0.07, and the second predicted probability is 0.5, then the target predicted probability of the data to be classified in the second class is the product of 0.07 and 0.5, that is, 0.035. If the first predicted probability of the data to be classified in the third class is 0.5, and the second predicted probability is 0.9, then the target predicted probability of the data to be classified in the third class is the product of 0.5 and 0.9, that is, 0.45.......If the first predicted probability of the data to be classified in the Kth class is 0.5, and the second predicted probability is 0.7, then the target predicted probability of the data to be classified in the Kth class is the product of 0.5 and 0.7, that is, 0.35.

[0111] In this way, the target prediction probability of the data to be classified in each category can be determined, wherein the larger the target prediction probability, the greater the possibility that the data to be classified belongs to the category, and the smaller the target prediction probability, the smaller the possibility that the data to be classified belongs to the category. For example, if the target prediction probability of the data to be classified in the first category is 0.04, and the target prediction probability of the data to be classified in the second category is 0.035, it can be determined that the probability that the data to be classified belongs to the first category is higher than the probability that it belongs to the second category. For another example, if the category label of the first category is economy and the category label of the second category is entertainment, it can be determined that the category label of the data to be classified is economy.

[0112] Since each data to be classified may have multiple category labels, in the implementation process, the K target prediction probabilities can be sorted, and the category labels of the preset number of categories corresponding to the target prediction probabilities with larger values ​​determined based on the sorting results are used as the target labels of the data to be classified, which ensures the accuracy of the classification results and the comprehensiveness of the classification results. Moreover, since when the target prediction probability is less than the set probability threshold, the possibility that the data to be classified belongs to this category is very small, in the embodiment of the present disclosure, the target prediction probability with a higher value can be selected and the target prediction probability with a lower value can be discarded, which can reduce the amount of data on the basis of ensuring the accuracy of the output category probability, thereby reducing the amount of calculation of the training model.

[0113] In some embodiments, the method further comprises:

[0114] Performing word segmentation processing on the data to be classified, and inputting the words obtained by word segmentation of the data to be classified into the generator model;

[0115] Based on the generator model, word embedding processing is performed on the words contained in the data to be classified to obtain word vectors of each word in the data to be classified.

[0116] Here, the data to be classified can be segmented based on a set segmentation algorithm to obtain the data to be classified based on word representation. The set segmentation algorithm includes at least one of the following: a segmentation algorithm based on string matching and a segmentation algorithm based on understanding.

[0117] Here, the word segmentation algorithm based on string matching refers to matching the string to be segmented with the words in the set machine dictionary according to the set strategy, finding the word corresponding to the substring of the string in the dictionary, and then obtaining the word segmentation result. For example, the data to be classified contains "The weather is really good today", if the set machine dictionary contains the words "today", "weather" and "really good", then the result of the word segmentation of the data to be classified is "The weather is really good today".

[0118] The understanding-based word segmentation algorithm simulates human understanding of sentences through computers to achieve the effect of word segmentation, that is, syntactic and semantic analysis is performed while word segmentation is performed, and ambiguity is resolved using syntactic and semantic information. For example, a word segmentation algorithm based on understanding is obtained by model training based on a large amount of collected data, and then the data to be segmented and classified is input into the word segmentation algorithm based on understanding to obtain and output the word segmentation result.

[0119] After performing word segmentation processing on the data to be classified based on the set word segmentation algorithm, at least one word contained in the data to be classified can be obtained. At this time, word embedding processing can be performed on the words contained in the data to be classified based on the generator model to obtain word vectors of each word in the data to be classified.

[0120] In some embodiments, the words contained in the data to be classified can also be processed based on the vector conversion model to obtain the word vectors of each word in the data to be classified. Here, the vector conversion model includes at least one of the following: a fast text classification (FastText) model, a model for generating word vectors (Word2vec, Word to Vector), and a continuous bag of words (CBOW, Continuous Bag-Of-Words) model. In the disclosed embodiment, by segmenting the data to be classified and obtaining the word vectors of each word, when the data to be classified is text, the data to be classified can be converted into numbers, so that the convenience of data processing can be improved.

[0121] In some embodiments, obtaining a first prediction result output by the generator model based on the data to be classified includes:

[0122] Using the generator model, based on the word vector of each word in the data to be classified, obtain K first prediction probabilities of the data to be classified on K categories;

[0123] The step of inputting the data to be classified into a discriminator model to obtain the second prediction result comprises:

[0124] The discriminator model is used to obtain K second prediction probabilities of the data to be classified on the K categories based on the word vectors of the words in the data to be classified.

[0125] Since each data to be classified may contain multiple words, after the data to be classified is segmented, the first prediction probability of each word in each category can be obtained based on the generator model, and the second prediction probability of the category of each word can be obtained based on the discriminator model. By refining the classification process to words, the classification results can be made more accurate.

[0126] In some embodiments, the generator model can also be used to obtain K first prediction probabilities of the data to be classified on K categories based on the word vectors of each character in the data to be classified; the discriminator model can be used to obtain K second prediction probabilities of the data to be classified on K categories based on the word vectors of each character in the data to be classified. By segmenting the data to be classified and obtaining the word vectors of each word, and then obtaining the corresponding prediction label, when the data to be classified is text, the data to be classified can be converted into numbers, which can improve the convenience of data processing.

[0127] The present disclosure provides a method for training a classification model. Figure 2 is a flow chart of a method for training a classification model according to an exemplary embodiment, the method is used to train the discriminator model described in any of the above embodiments, such as Figure 2 As shown, the method mainly includes the following steps:

[0128] In step 201, the labeled sample data in the training set is input into the generator model to obtain N category probabilities of N first prediction labels corresponding to the sample data; wherein each sample data corresponds to at least one of the first prediction labels;

[0129] In step 202, the N category probabilities are sorted in descending order, and the first L category probabilities are determined from the sorted category probabilities;

[0130] In step 203, the L first prediction labels corresponding to the first L class probabilities are determined as L candidate labels constituting a candidate label set; wherein L and N are positive integers, and L is less than N;

[0131] In step 204, the discriminator model is trained based on the sample data and the candidate label set.

[0132] In some embodiments, the training method of the classification model can be applied to electronic devices, where the electronic devices include mobile terminals and fixed terminals, where the mobile terminals include: mobile phones, tablet computers, laptop computers, etc.; the fixed terminals include: personal computers. In other optional embodiments, the information processing method can also be run on network side devices, where the network side devices include: servers, processing centers, etc.

[0133] In some embodiments, the generator model includes an Albert model, and the discriminator model includes a Bert model. For example, the generator model includes a model with low prediction accuracy but fast data processing speed, such as the Albert model, the tiny model, and fast text classification models such as support vector machines. The discriminator model includes a pre-trained model with high prediction accuracy but slow data processing speed. For example, neural network models such as the Bert model, the Ernie model, and the Xlnet model.

[0134] In some embodiments, the method further includes: performing pre-training of the generator model for a set number of cycles based on the sample data in the training set, for example, performing 5 or 10 rounds of pre-training on the generator model. In the implementation process, the labeled sample data in the training set can be input into the pre-trained generator model to obtain N category probabilities of the N first prediction labels corresponding to the sample data. Since the generator model has been pre-trained, the pre-trained generator model can be initially converged, so that the accuracy of the obtained N category probabilities of the N first prediction labels is relatively high.

[0135] After the generator model outputs N class probabilities of N first prediction labels, the N class probabilities can be sorted in a set order, for example, in order from large to small, or in order from small to large. When the N class probabilities are sorted in order from large to small, the first L class probabilities can be determined from the sorted class probabilities, and the L first prediction labels corresponding to the first L class probabilities are determined as the L candidate labels constituting the candidate label set, and the discriminator model is trained based on the sample data and the candidate label set.

[0136] In some embodiments, when N class probabilities are sorted in order from small to large, the last L class probabilities can be determined from the sorted class probabilities, and the L first prediction labels corresponding to the last L class probabilities are determined as the L candidate labels constituting the candidate label set. Since the L candidate labels are labels corresponding to higher class probabilities, and the larger the class probability, the greater the possibility that the sample data belongs to the category, and the smaller the class probability, the smaller the possibility that the sample data belongs to the category. In the disclosed embodiment, the label corresponding to the larger class probability among the N class probabilities can be determined as a candidate label, so that the range that the discriminator model needs to judge can be reduced from N to L, and the amount of data that the discriminator model needs to process can be reduced.

[0137] In some embodiments, after obtaining L candidate labels, the sample data in the training set and the L candidate labels in the label candidate set can be input into the discriminator model. After the sample data is input into the discriminator model, the context of the sample data can be encoded based on the encoding layer of the discriminator model to obtain the word vector of each word in the sample data. And based on the attention mechanism layer of the discriminator model, the relationship between each word and each candidate label is obtained, where the relationship between each word and each candidate label includes: the degree of difference between each word and each candidate label.

[0138] Here, the label vector of each candidate label can be obtained based on the discriminator model, that is, the vector representation of each candidate label can be obtained. In the case where the candidate label is composed of multiple words, the word vector of each word can be obtained, and the label vector of the candidate label can be obtained based on the average value of the word vectors of all words.

[0139] After obtaining the label vector of the candidate label, the label vector can be input into the fully connected layer of the discriminator model, and the probability value of each category and the second predicted label corresponding to the probability value of each category can be obtained based on the activation function of the set type. In the embodiment of the present disclosure, the label corresponding to the larger category probability among the N category probabilities output by the generator model can be determined as the candidate label, so that the range that the discriminator model needs to judge can be reduced from N to L, which can reduce the amount of data that the discriminator model needs to process.

[0140] In some embodiments, the method further comprises:

[0141] Determine an average number of labels for a single sample data based on the total number of the first prediction labels and the number of the sample data;

[0142] The L is obtained based on the product of the average number of labels and the first set hyperparameter.

[0143] Here, assuming that m is the average number of labels for a single sample data, the class probabilities output by the generator model can be sorted in descending order. The first predicted labels corresponding to the top k*m class probabilities after sorting are determined as candidate labels, and the candidate labels are used as the input to the discriminator model. Here, the first set hyperparameter is k, where k is an optional hyperparameter. For example, k can take 4 or 5, and k*m << N, and k*m = L. Here, by setting the hyperparameter and selecting a set number of candidate labels with relatively large probability values from the first predicted labels according to requirements, the flexibility of model training can be improved on the basis of improving training accuracy.

[0144] In some embodiments, the method further includes:

[0145] Determine the first loss of the generator model on the training set according to the difference between the true label of the sample data and the first predicted label output by the generator model;

[0146] Based on the candidate labels and the second predicted labels output by the discriminator model, determine the second loss of the discriminator model on the candidate label set;

[0147] Use a second set hyperparameter to sum the weighted first loss and the second loss to obtain a training loss;

[0148] Based on the training loss, update the model parameters of the generator model and the discriminator model.

[0149] In the embodiments of the present disclosure, the first loss and the second loss can be obtained based on a preset type of loss function. The preset type of loss function includes Binary Cross-Entropy loss and Categorical Cross-Entropy loss function. In the embodiments of the present disclosure, by adjusting the model parameters of the generator model and the discriminator model through the first loss and the second loss, on the one hand, it can realize the simultaneous training of the generator model and the discriminator model, improving the training speed of the model; on the second hand, by determining the first loss and the second loss through the preset type of loss function, the performance of the generator model and the discriminator model can be improved; on the other hand, by setting an adjustable second set hyperparameter, the proportion of the first loss and the second loss in the training loss can be adjusted according to needs, increasing the flexibility of model training.

[0150] In other alternative embodiments, the method further includes:

[0151] When the numerical change of the training loss within the set time is less than the set change threshold, the training of the generator model and the discriminator model is stopped. In other optional embodiments, the accuracy of the generator model and the discriminator model can also be verified based on the set verification set. When the accuracy reaches the set accuracy, the training of the generator model and the discriminator model is stopped to obtain the trained generator model and the discriminator model.

[0152] Figure 3 is a flow chart of another classification model training method according to an exemplary embodiment, the method is used to train the discriminator model described in any of the above embodiments, such as Figure 3 As shown, the method mainly includes the following steps:

[0153] In step 301, each candidate label after preliminary screening and the category probability of each candidate label are obtained based on the generator model.

[0154] Here, all sample data (e.g., input text) in the training set can be segmented based on a segmenter, where the segmenter includes a set segmentation algorithm, such as a segmentation algorithm based on string matching, a segmentation algorithm based on understanding, etc. After segmentation, a token ID corresponding to each word can be obtained, and the token ID is used to uniquely identify the corresponding word.

[0155] In some embodiments, before formally training the generator model and the discriminator model, the pre-training stage of the generator model can be entered to train the generator model G first. Figure 4 This is a schematic diagram of the process of pre-training the generator model, such as Figure 4 As shown, taking the generator model as the Albert model as an example, the input text (sample data in the training set) x1, x2, ..., xn can be input into the Albert model, and each word is embedded in the word, and then decoded and outputted through the fully connected layer. The Sigmoid function is used as the activation function of the last layer to obtain the category probability of each first prediction label after the initial screening, and then the output label (first prediction label) y1, y2, ..., yN can be obtained. Here, a set number of pre-training cycles can be performed until the generator model converges initially. Assuming that there are N first prediction labels in total, the output is an N-dimensional vector, which is an N-dimensional binary classification task.

[0156] In the embodiments of the present disclosure, by pre-training the generator model, it is possible to ensure that when training the discriminator model, the output of the generator model is not too poor, thereby accelerating the training of the entire network. In some embodiments, after obtaining the preliminarily screened candidate labels and the class probabilities of the candidate labels based on the generator model, the entire network model, including the generator model and the discriminator model, can be further trained.

[0157] In step 302, sample the class probabilities output by the generator model to obtain a candidate label set.

[0158] Here, the class probabilities output by the generator model can be sampled. Assuming that m is the average number of labels for a single sample, in the embodiments of the present disclosure, the class probabilities output by the generator model can be sorted in descending order, and the first predicted labels corresponding to the top k*m class probabilities after sorting are determined as candidate labels, and the candidate labels are used as the input of the discriminator model. Here, the first set hyperparameter is k, where k is an optional hyperparameter. For example, k can take 4 or 5, and k*m << N, and k*m = L.

[0159] In step 303, based on the sample data in the training set and the candidate label set, train the discriminator model.

[0160] Here, assuming that there are a total of L labels in the candidate set, then the output is an L-dimensional vector, which is an L-dimensional binary classification task. The input of the discriminator model is the sample data in the training set and the candidate label set C, as Figure 5 shown, Figure 5 is a schematic flowchart for training the discriminator model.

[0161] Taking the discriminator model as the Bert model as an example, during the training of the Bert model, the context of the sample data can be encoded based on the encoding layer of the Bert model as the base model, and the vector representation of each word after encoding the context can be obtained. Based on the attention mechanism layer (Label-Attention layer) of the discriminator model, the relationship between each word (token0_i) and each candidate label (c_j) is obtained. Here, the relationship between each word and each candidate label includes: the degree of difference between each word and each candidate label. The calculation formula for the relationship between each word and each candidate label is as follows:

[0162]

[0163] In formula (1), α ij represents the relationship between each word and each candidate label; h i represents the word vector of the i-th word; w jRepresents the label vector of the jth candidate label; L represents the number of candidate labels; i represents the index of the word vector, j represents the index of the label vector, and both i and j are positive integers.

[0164] Here, the label vector of each candidate label (c_j) can be obtained based on the discriminator model, that is, the vector representation of each candidate label can be obtained. In the case where the candidate label is composed of multiple words, the word vector of each word can be obtained, and the label vector of the candidate label can be obtained based on the average value of the word vectors of all words.

[0165] In some embodiments, the Attention layer can be used to encode each word of the sample data and the label vector of the candidate label to obtain the label vector of the code encoding context. The formula is as follows:

[0166]

[0167] In formula (2), m j The label vector representing the code encoding context; α ij Indicates the relationship between each word and each candidate label; h i Represents the word vector of the i-th word; N represents the number of candidate tags, and N is a positive integer.

[0168] In some embodiments, after obtaining the label vector of the code encoding context, all label vectors can be multiplied by a set number (e.g., 2) of shared weights, and the product value can be forward propagated through the fully connected layer to obtain the category probability of each category. Here, the middle layer f of the fully connected layer can use the Relu activation function, and the output layer can use the Sigmoid activation function. Here, the final output is N binary classifications, and the formula is as follows:

[0169]

[0170] In formula (3), Represents the output category probability; m j The label vector representing the code encoding context; w1 represents the first shared weight; w2 represents the second shared weight.

[0171] In step 304, the training loss is calculated, and the model parameters of the generator model and the discriminator model are adjusted based on the training loss.

[0172] Here, the first loss (loss1) of the generator model on the training set can be determined based on the difference between the true label of the sample data and the first predicted label output by the generator model. The second loss (loss2) of the discriminator model on the candidate label set can be determined based on the candidate label and the second predicted label output by the discriminator model. The first loss and the second loss are weighted and summed using the second set hyperparameter (α) to obtain the training loss (Loss). The calculation formula for the training loss is as follows:

[0173] Loss = loss1 + α * loss2 (4);

[0174] In formula (4), Loss represents the training loss; loss1 represents the first loss; loss2 represents the second loss; and α represents the second set hyperparameter.

[0175] In some embodiments, since the value of loss1 is greater than loss2, in order to reduce the gap between loss1 and loss2 and improve the accuracy of model training, α can be greater than or equal to a set threshold, where the set threshold can be 20. The first loss loss1 of the generator model can be the binary cross entropy on all categories N, and the second loss loss2 of the discriminator model can be the binary cross entropy on the candidate label set C, and the final Loss is obtained by adding them according to the set ratio.

[0176] In some embodiments, according to the set number of training epochs and batch size, steps 301 to 304 are looped until the generator model and the discriminator model converge or the number of training epochs is reached, and the trained generator model and discriminator model are obtained; when predicting the generator model and the discriminator model, the product of the scores of the generator model and the discriminator model on the candidate label set (non-candidate labels are no longer considered) can be calculated, and a set number of labels with the highest ranking are selected as the final output result.

[0177] In the embodiments of the present disclosure, firstly, by simultaneously training two models, the training time and memory overhead are reduced; the label corresponding to the larger category probability in the category probability can be determined as the candidate label, so that the range that the discriminator model needs to judge can be narrowed from the full label set to the candidate label set; by combining the sample data in the training set and the candidate label set, the discriminator model is trained.

[0178] The way of outputting classification results improves the accuracy of the final classification results as a whole.

[0179] Secondly, Albert is used as the generator model to obtain the candidate label set. The acquisition of the candidate label set does not depend on other algorithms, but on the input text itself. Albert's small size and good performance make it easier for Bert, as the discriminator model, to learn the correct sorting; the discriminator model uses a self-attention encoding layer to obtain the internal relationship encoding between labels, which helps to improve the accuracy of the model; the final output label selects the top-ranked scores by considering the results of the discriminator model, which is beneficial to improve the accuracy of the final output result.

[0180] Figure 6 is a block diagram of a classification device according to an exemplary embodiment, such as Figure 6 As shown, the classification device 600 is applied to electronic equipment and mainly includes:

[0181] A first acquisition module 601 is configured to obtain a first prediction result output by a generator model based on the data to be classified;

[0182] A second acquisition module 602 is configured to input the data to be classified into a discriminator model to obtain a second prediction result;

[0183] The classification module 603 is configured to determine a target category of the data to be classified based on the first prediction result and the second prediction result.

[0184] In some embodiments, the first prediction result includes K first prediction probabilities of the data to be classified on K categories; the second prediction result includes K second prediction probabilities of the data to be classified on the K categories; the classification module 603 is further configured as:

[0185] Obtaining K target prediction probabilities based on the product of the K first prediction probabilities and the K second prediction probabilities;

[0186] Sort the K target prediction probabilities in descending order;

[0187] The category labels of a preset number of categories corresponding to the first preset number of the target prediction probabilities after sorting are determined as the target labels of the data to be classified.

[0188] In some embodiments, the apparatus 600 further includes:

[0189] A word segmentation module, configured to perform word segmentation processing on the data to be classified, and input the words obtained by segmenting the data to be classified into the generator model;

[0190] The vector conversion module is configured to perform word embedding processing on the words contained in the data to be classified based on the generator model to obtain word vectors of each word in the data to be classified.

[0191] In some embodiments, the first acquisition module 601 is further configured to:

[0192] Using the generator model, based on the word vector of each word in the data to be classified, obtain K first prediction probabilities of the data to be classified on K categories;

[0193] The second acquisition module is further configured to:

[0194] The discriminator model is used to obtain K second prediction probabilities of the data to be classified on the K categories based on the word vectors of the words in the data to be classified.

[0195] In some embodiments, the type of the data to be classified includes at least one of the following: an image data type, a text data type, and an audio data type.

[0196] In some embodiments, the generator model includes an Albert model, and the discriminator model includes a Bert model.

[0197] Figure 7 is a block diagram of a training device for a classification model according to an exemplary embodiment, such as Figure 7 As shown, the classification model training device 700 is used to train the discriminator model described in any of the above embodiments, and the device includes:

[0198] The third acquisition module 701 is configured to input the labeled sample data in the training set into the generator model to obtain N category probabilities of N first prediction labels corresponding to the sample data; wherein each sample data corresponds to at least one of the first prediction labels;

[0199] A first determining module 702 is configured to sort the N category probabilities in descending order, and determine the first L category probabilities from the sorted category probabilities;

[0200] The second determination module 703 is configured to determine the L first prediction labels corresponding to the first L class probabilities as L candidate labels constituting a candidate label set; wherein L and N are positive integers, and L is less than N;

[0201] The training module 704 is configured to train the discriminator model based on the sample data and the candidate label set.

[0202] In some embodiments, the apparatus 700 further includes:

[0203] A third determination module is configured to determine an average number of labels for a single sample data based on the total number of the first prediction labels and the number of the sample data;

[0204] The first calculation module is configured to obtain the L based on the product of the average number of labels and a first set hyperparameter.

[0205] In some embodiments, the apparatus 700 further includes:

[0206] a fourth determination module, configured to determine a first loss of the generator model on the training set according to a difference between a true label of the sample data and a first predicted label output by the generator model;

[0207] a fifth determination module, configured to determine a second loss of the discriminator model on the candidate label set based on the candidate label and a second predicted label output by the discriminator model;

[0208] A second calculation module is configured to use a second set hyperparameter to weight the first loss and the second loss and then sum them to obtain a training loss;

[0209] An updating module is configured to update model parameters of the generator model and the discriminator model based on the training loss.

[0210] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0211] Figure 8 1 is a block diagram of an electronic device 1200 according to an exemplary embodiment. For example, the electronic device 1200 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0212] Reference Figure 8 , the electronic device 1200 may include one or more of the following components: a processing component 1202 , a memory 1204 , a power component 1206 , a multimedia component 1208 , an audio component 1210 , an input / output (I / O) interface 1212 , a sensor component 1214 , and a communication component 1216 .

[0213] The processing component 1202 generally controls the overall operation of the electronic device 1200, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1202 may include one or more processors 1220 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 1202 may include one or more modules to facilitate the interaction between the processing component 1202 and other components. For example, the processing component 1202 may include a multimedia module to facilitate the interaction between the multimedia component 1208 and the processing component 1202.

[0214] The memory 1204 is configured to store various types of data to support operations on the device 1200. Examples of such data include instructions for any application or method operating on the electronic device 1200, contact data, phone book data, messages, pictures, videos, etc. The memory 1204 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0215] The power component 1206 provides power to the various components of the electronic device 1200. The power component 1206 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 1200.

[0216] The multimedia component 1208 includes a screen that provides an output interface between the electronic device 1200 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1208 includes a front camera and / or a rear camera. When the device 1200 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0217] The audio component 1210 is configured to output and / or input audio signals. For example, the audio component 1210 includes a microphone (MIC), and when the electronic device 1200 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 1204 or sent via the communication component 1216. In some embodiments, the audio component 1210 also includes a speaker for outputting audio signals.

[0218] I / O interface 1212 provides an interface between processing component 1202 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0219] The sensor assembly 1214 includes one or more sensors for providing various aspects of status assessment for the electronic device 1200. For example, the sensor assembly 1214 can detect the open / closed state of the device 1200, the relative positioning of components, such as the display and keypad of the electronic device 1200, and the sensor assembly 1214 can also detect the position change of the electronic device 1200 or a component of the electronic device 1200, the presence or absence of user contact with the electronic device 1200, the orientation or acceleration / deceleration of the electronic device 1200, and the temperature change of the electronic device 1200. The sensor assembly 1214 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1214 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1214 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0220] The communication component 1216 is configured to facilitate wired or wireless communication between the electronic device 1200 and other devices. The electronic device 1200 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1216 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1216 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0221] In an exemplary embodiment, the electronic device 1200 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0222] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1204 including instructions, and the instructions can be executed by a processor 1220 of the electronic device 1200 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0223] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform a classification method, the method comprising:

[0224] Based on the data to be classified, obtaining a first prediction result output by the generator model;

[0225] Inputting the data to be classified into a discriminator model to obtain a second prediction result;

[0226] Based on the first prediction result and the second prediction result, a target category of the data to be classified is determined.

[0227] Or enable the electronic device to execute a classification model training method, the method comprising:

[0228] Input the labeled sample data in the training set into the generator model to obtain N category probabilities of the N first prediction labels corresponding to the sample data; wherein each sample data corresponds to at least one of the first prediction labels;

[0229] Sorting the N category probabilities in descending order, and determining the first L category probabilities from the sorted category probabilities;

[0230] Determine the L first prediction labels corresponding to the first L class probabilities as L candidate labels constituting a candidate label set; wherein L and N are positive integers, and L is less than N;

[0231] The discriminator model is trained based on the sample data and the candidate label set.

[0232] Fig. 91 is a block diagram of another electronic device 1300 according to an exemplary embodiment. For example, the electronic device 1300 may be provided as a server. Fig. 9 The electronic device 1300 includes a processing component 1322, which further includes one or more processors, and a memory resource represented by a memory 1332 for storing instructions executable by the processing component 1322, such as an application. The application stored in the memory 1332 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1322 is configured to execute instructions to perform the above classification method, which includes:

[0233] Based on the data to be classified, obtaining a first prediction result output by the generator model;

[0234] Inputting the data to be classified into a discriminator model to obtain a second prediction result;

[0235] Based on the first prediction result and the second prediction result, a target category of the data to be classified is determined.

[0236] Or executing the training method of the above classification model, the method comprising:

[0237] Input the labeled sample data in the training set into the generator model to obtain N category probabilities of the N first prediction labels corresponding to the sample data; wherein each sample data corresponds to at least one of the first prediction labels;

[0238] Sorting the N category probabilities in descending order, and determining the first L category probabilities from the sorted category probabilities;

[0239] Determine the L first prediction labels corresponding to the first L class probabilities as L candidate labels constituting a candidate label set; wherein L and N are positive integers, and L is less than N;

[0240] The discriminator model is trained based on the sample data and the candidate label set.

[0241] The electronic device 1300 may also include a power supply component 1326 configured to perform power management of the electronic device 1300, a wired or wireless network interface 1350 configured to connect the electronic device 1300 to a network, and an input / output (I / O) interface 1358. The electronic device 1300 may operate based on an operating system stored in the memory 1332, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.

[0242] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0243] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A classification method, characterized in that: Used in electronic equipment, including: Based on the data to be classified, obtaining a first prediction result output by the generator model; the first prediction result includes K first prediction probabilities of the data to be classified on K categories; Inputting the data to be classified into a discriminator model to obtain a second prediction result; the second prediction result includes K second prediction probabilities of the data to be classified on the K categories; Obtaining K target prediction probabilities based on the product of the K first prediction probabilities and the K second prediction probabilities; Sort the K target prediction probabilities in descending order; Determine the class labels of a preset number of classes corresponding to the first preset number of the target prediction probabilities after sorting as the target labels of the data to be classified; The type of the data to be classified includes at least one of the following: an image data type, a text data type, and an audio data type.

2. The method according to claim 1, characterized in that The method further comprises: Performing word segmentation processing on the data to be classified, and inputting the words obtained by word segmentation of the data to be classified into the generator model; Based on the generator model, word embedding processing is performed on the words contained in the data to be classified to obtain word vectors of each word in the data to be classified.

3. The method according to claim 2, characterized in that The step of obtaining a first prediction result output by the generator model based on the data to be classified includes: Using the generator model, based on the word vector of each word in the data to be classified, obtain K first prediction probabilities of the data to be classified on K categories; The step of inputting the data to be classified into a discriminator model to obtain a second prediction result includes: The discriminator model is used to obtain K second prediction probabilities of the data to be classified on the K categories based on the word vector of each word in the data to be classified.

4. The method according to any one of claims 1 to 3, characterized in that: The generator model includes an Albert model, and the discriminator model includes a Bert model.

5. A classification model training method, characterized in that: Used for training a discriminator model in the classification method according to any one of claims 1 to 4, the method comprising: Input the labeled sample data in the training set into the generator model to obtain N category probabilities of the N first prediction labels corresponding to the sample data; wherein each sample data corresponds to at least one of the first prediction labels; Sorting the N category probabilities in descending order, and determining the first L category probabilities from the sorted category probabilities; Determine the L first prediction labels corresponding to the first L class probabilities as L candidate labels constituting a candidate label set; wherein L and N are positive integers, and L is less than N; The discriminator model is trained based on the sample data and the candidate label set.

6. The method according to claim 5, characterized in that The method further comprises: Determine an average number of labels for a single sample data based on the total number of the first prediction labels and the number of the sample data; The L is obtained based on the product of the average number of labels and the first set hyperparameter.

7. The method according to claim 5, characterized in that The method further comprises: Determine a first loss of the generator model on the training set according to a difference between a true label of the sample data and a first predicted label output by the generator model; Determine a second loss of the discriminator model on the candidate label set based on the candidate label and a second predicted label output by the discriminator model; Using the second set hyperparameter, weighting the first loss and the second loss and summing them to obtain a training loss; Based on the training loss, model parameters of the generator model and the discriminator model are updated.

8. A classification device, characterized in that: Used in electronic equipment, including: A first acquisition module is configured to obtain a first prediction result output by the generator model based on the data to be classified; the first prediction result includes K first prediction probabilities of the data to be classified on K categories; A second acquisition module is configured to input the data to be classified into a discriminator model to obtain a second prediction result; the second prediction result includes K second prediction probabilities of the data to be classified on the K categories; A classification module is configured to obtain K target prediction probabilities based on the product of K first prediction probabilities and K second prediction probabilities; sort the K target prediction probabilities in descending order; and determine the category labels of a preset number of categories corresponding to the first preset number of the target prediction probabilities after sorting as the target labels of the data to be classified; The type of the data to be classified includes at least one of the following: an image data type, a text data type, and an audio data type.

9. The device according to claim 8, characterized in that The device also includes: A word segmentation module, configured to perform word segmentation processing on the data to be classified, and input the words obtained by segmenting the data to be classified into the generator model; The vector conversion module is configured to perform word embedding processing on the words contained in the data to be classified based on the generator model to obtain word vectors of each word in the data to be classified.

10. The device according to claim 9, characterized in that The first acquisition module is further configured to: Using the generator model, based on the word vector of each word in the data to be classified, obtain K first prediction probabilities of the data to be classified on K categories; The second acquisition module is further configured to: The discriminator model is used to obtain K second prediction probabilities of the data to be classified on the K categories based on the word vector of each word in the data to be classified.

11. The device according to any one of claims 8 to 10, characterized in that The generator model includes an Albert model, and the discriminator model includes a Bert model.

12. A classification model training device, characterized in that: Used for training a discriminator model in a classification device according to any one of claims 8 to 11, the device comprising: A third acquisition module is configured to input the labeled sample data in the training set into the generator model to obtain N category probabilities of the N first prediction labels corresponding to the sample data; wherein each sample data corresponds to at least one of the first prediction labels; A first determination module is configured to sort the N category probabilities in descending order, and determine the first L category probabilities from the sorted category probabilities; A second determination module is configured to determine the L first prediction labels corresponding to the first L category probabilities as L candidate labels constituting a candidate label set; wherein L and N are positive integers, and L is less than N; A training module is configured to train the discriminator model based on the sample data and the candidate label set.

13. The device according to claim 12, characterized in that The device also includes: A third determination module is configured to determine an average number of labels for a single sample data based on the total number of the first prediction labels and the number of the sample data; The first calculation module is configured to obtain the L based on the product of the average number of labels and a first set hyperparameter.

14. The device according to claim 12, characterized in that The device also includes: a fourth determination module, configured to determine a first loss of the generator model on the training set according to a difference between a true label of the sample data and a first predicted label output by the generator model; a fifth determination module, configured to determine a second loss of the discriminator model on the candidate label set based on the candidate label and a second predicted label output by the discriminator model; A second calculation module is configured to use a second set hyperparameter to weight the first loss and the second loss and then sum them to obtain a training loss; An updating module is configured to update model parameters of the generator model and the discriminator model based on the training loss.

15. An electronic device, characterized in that: include: processor; a memory configured to store processor-executable instructions; Wherein, the processor is configured to: implement any classification method in claims 1 to 4 or any classification model training steps in claims 5 to 7 when executed.

16. A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform any classification method in claims 1 to 4 or any steps in classification model training in claims 5 to 7.