Search

CN-115456100-B - Training processing method and device, electronic equipment and readable storage medium

CN115456100BCN 115456100 BCN115456100 BCN 115456100BCN-115456100-B

Abstract

The application discloses a training processing method, a training processing device, an electronic device and a readable storage medium, wherein the method comprises the steps of obtaining sample data; the method comprises the steps of clustering the labeled sample data and the unlabeled sample data to obtain a plurality of clusters, obtaining residual sample data in the sample data, wherein the residual sample data are labeled sample data which are not clustered with the unlabeled sample data, inputting the residual sample data into a generated network model to obtain generated sample data output by the generated network model, clustering the generated sample data into one cluster of the clusters respectively, and training a semi-supervised model by using the sample data in the clusters. The application solves the problem of poor performance of the model obtained by training caused by insufficient number or unbalanced distribution of unlabeled samples in the prior art, and improves the data and quality of the sample data available in training, thereby improving the quality of the model obtained by training.

Inventors

  • WANG QI

Assignees

  • 杭州海康威视数字技术股份有限公司

Dates

Publication Date
20260512
Application Date
20220923

Claims (13)

  1. 1. A training processing method, comprising: acquiring sample data, wherein the data type of the sample data comprises one of image data and voice data, and the sample data comprises labeled sample data and unlabeled sample data; Clustering the labeled sample data and the unlabeled sample data to obtain a plurality of clusters; obtaining residual sample data in the sample data, wherein the residual sample data is labeled sample data which is not clustered with unlabeled sample data; Inputting the residual sample data into a generating network model to obtain generating sample data output by the generating network model, wherein the generating network model is obtained by training the sample data of the clusters, and the generating network model is used for generating virtual non-label sample data according to the label sample data; Clustering the generated sample data into one of the clusters, wherein each cluster of the clusters corresponds to a cluster tag; and training a semi-supervised model by using sample data in the clusters, wherein the sample data in each cluster uses a cluster label of the cluster as a label of the sample data in training.
  2. 2. The method of claim 1, wherein clustering the tagged sample data and untagged sample data into a plurality of clusters comprises: Extracting sample characteristics from the labeled sample data and the unlabeled sample data by using a characteristic extraction model, wherein the characteristic extraction model is obtained by training in advance by using training data of the same type as the sample data, and the characteristic extraction model is used for extracting characteristics from input data; and clustering according to sample characteristics corresponding to the labeled sample data and the unlabeled sample data.
  3. 3. The method of claim 2, wherein clustering the labeled sample data and the unlabeled sample data comprises: And performing self-supervision training according to the labeled sample data and the unlabeled sample data, wherein the self-supervision training is used for clustering the sample data, adjusting the feature extraction model according to the features of the sample data in the clustered sample data, and then clustering again and adjusting the feature extraction model until no new cluster is generated.
  4. 4. The method of claim 1 or 2, wherein clustering based on the tagged sample data and the untagged sample data comprises: selecting sample data as a cluster center from the sample data; Clustering is carried out according to the selected cluster centers to obtain a plurality of clusters, and a first distance from sample data in each cluster to the cluster center of the cluster to which the sample data belongs and a second distance from the sample data to the cluster centers of other clusters are calculated; and changing the sample data serving as the cluster center to perform clustering again, and calculating the first distance and the second distance until the value of the loss function is optimal, wherein the smaller the first distance is and the larger the second distance is, the better the value of the loss function is.
  5. 5. The method of claim 1, wherein training using sample data of the plurality of clusters to obtain the generated network model comprises: Training a generated countermeasure network model using sample data of the plurality of clusters, wherein the generated countermeasure network model comprises a first generator for generating unlabeled sample data from labeled sample data and a first discriminator for determining whether one unlabeled sample data is unlabeled sample data within the cluster or unlabeled sample data generated by the first generator; After determining that the generated countermeasure network model training is completed, the first generator in the generated countermeasure network model is used as the generated network model.
  6. 6. The method of claim 5, wherein the generated countermeasure network model further includes a second generator and a second arbiter, wherein the second generator is configured to generate tagged sample data from untagged sample data, and wherein the second arbiter is configured to determine whether one tagged sample data is tagged sample data within the cluster or tagged sample data generated by the second generator.
  7. 7. The method of claim 6, wherein determining that the generated countermeasure network model training is complete comprises: And calculating a value of a loss function of the generated countermeasure network model, and determining that the generated countermeasure network model is trained when the value of the loss function of the generated countermeasure network model is optimal, wherein the loss function of the generated countermeasure network model comprises a first loss obtained by comparing unlabeled sample data generated by the first generator with unlabeled sample data in the cluster, a second loss obtained by comparing labeled sample data with constructed unlabeled sample data, a third loss obtained by comparing unlabeled sample data generated by the second generator with constructed unlabeled sample data, a fourth loss obtained by comparing unlabeled sample data with constructed unlabeled sample data, and a fifth loss obtained by comparing labeled sample data in the same cluster with unlabeled sample data, wherein the value of the loss function is optimal when the first, second, third, fourth and fifth losses are smaller, the constructed unlabeled sample data is obtained by generating unlabeled sample data by passing label sample data through the first generator, and the unlabeled sample data is generated by passing label sample data through the first generator and the unlabeled sample generator is the unlabeled sample data is generated by passing label sample data through the first generator.
  8. 8. The method of any of claims 5 to 7, wherein training the challenge network using sample data of the plurality of clusters comprises: dividing sample data of each of the plurality of clusters into sample pairs, wherein each sample pair comprises labeled sample data and unlabeled samples; Training the generated challenge network model using the samples.
  9. 9. The method of claim 1, wherein training a semi-supervised model using sample data in the plurality of clusters comprises: Training a semi-supervised neural network model by using sample data in the clusters, wherein the value of a loss function of the neural network model is obtained according to the difference between a cluster label corresponding to the sample data and a label output by the neural network model.
  10. 10. The method as recited in claim 1, further comprising: acquiring labels corresponding to the labeled sample data in each cluster; and taking the average value of the labels with label sample data in the same cluster as the cluster label of the cluster.
  11. 11. The training processing device is characterized by comprising an acquisition module, a clustering module, a generation module and a processing module, wherein, The acquisition module is used for acquiring sample data, wherein the data type of the sample data comprises one of image data and voice data, and the sample data comprises labeled sample data and unlabeled sample data; The clustering module is used for clustering the labeled sample data and the unlabeled sample data to obtain a plurality of clusters; The acquisition module is further configured to acquire remaining sample data in the sample data, where the remaining sample data is labeled sample data that is not clustered with unlabeled sample data; The generating module is used for inputting the residual sample data into a generating network model to obtain generating sample data output by the generating network model, wherein the generating network model is obtained by training the sample data of the clusters, and the generating network model is used for generating virtual label-free sample data according to the label-free sample data; The clustering module is further configured to cluster the generated sample data into one of the clusters, where each cluster of the clusters corresponds to a cluster tag; The processing module is configured to perform training of a semi-supervised model by using sample data in the plurality of clusters, where the sample data in each cluster uses a cluster tag of the cluster as a tag of the sample data in training.
  12. 12. An electronic device comprising a memory and a processor, wherein the memory is configured to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method steps of any one of claims 1 to 10.
  13. 13. A readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the method steps of any of claims 1 to 10.

Description

Training processing method and device, electronic equipment and readable storage medium Technical Field The present application relates to the field of machine learning, and in particular, to a training processing method, apparatus, electronic device, and readable storage medium. Background In machine learning, the quality of training data plays an intuitively important role. Machine learning may include supervised training and semi-supervised training, wherein the supervised training uses only labeled training data (also referred to as labeled sample data), and a machine learning model may be trained using the labeled sample data. However, in practical application, the labeling cost of the labeled sample data is relatively high, so that in practical application, there are unlabeled sample data besides the labeled sample data, and in order to use the unlabeled sample data in training, semi-supervised training is introduced, and in the semi-supervised training, the unlabeled sample data can be labeled by using the labeled sample data, so that the sample data is amplified. In the semi-supervised training process, if the number of unlabeled samples is insufficient or the distribution is unbalanced, poor performance of a model obtained through training can be caused. No corresponding solution has been proposed in the prior art for this problem. Disclosure of Invention The embodiment of the application provides a training processing method, a training processing device, electronic equipment and a readable storage medium, which at least solve the problem of poor performance of a model obtained by training caused by insufficient number or unbalanced distribution of unlabeled samples in the prior art. According to one aspect of the application, a training processing method is provided, which comprises the steps of obtaining sample data, clustering the sample data with labels and the sample data without labels to obtain a plurality of clusters, obtaining residual sample data in the sample data, wherein the residual sample data are labeled sample data which are not clustered with the sample data without labels, inputting the residual sample data into a generating network model to obtain generating sample data output by the generating network model, wherein the generating network model is obtained by training the sample data of the plurality of clusters, the generating network model is used for generating virtual sample data without labels according to the sample data with labels, clustering the generating sample data into one cluster of the plurality of clusters respectively, wherein each cluster corresponds to one label, and training a semi-supervised model by using the sample data in each cluster, wherein the sample data in each cluster is used as the label of the sample data in training. Further, clustering the labeled sample data and the unlabeled sample data to obtain a plurality of clusters comprises extracting sample features from the labeled sample data and the unlabeled sample data by using a feature extraction model, wherein the feature extraction model is obtained by training in advance by using training data of the same type as the sample data, and is used for extracting features from input data, and clustering according to the sample features corresponding to the labeled sample data and the unlabeled sample data. Further, clustering the labeled sample data and the unlabeled sample data includes performing self-supervision training according to the labeled sample data and the unlabeled sample data, wherein the self-supervision training is used for clustering sample data, adjusting the feature extraction model according to features of sample data in clusters after clustering, and then clustering and adjusting the feature extraction model again until no new clusters are generated. Further, clustering according to the labeled sample data and the unlabeled sample data comprises the steps of selecting sample data serving as a cluster center from the sample data, clustering according to the selected cluster centers to obtain a plurality of clusters, calculating first distances from the sample data in each cluster to the cluster centers of the clusters to which the sample data belong and second distances from the cluster centers of other clusters, changing the sample data serving as the cluster centers, and re-clustering, and calculating the first distances and the second distances until the value of a loss function is optimal, wherein the smaller the first distances and the larger the second distances are, the better the value of the loss function is. Further, training the sample data of the clusters to obtain the generated network model comprises training a generated countermeasure network model by using the sample data of the clusters, wherein the multi-countermeasure network model comprises a first generator and a first discriminator, the first generator is used for generating unlabeled sample data according