Model training method, device, electronic device and storage medium
Through feature extraction and data clipping technology, unlabeled data is used to train the model, which solves the problems of high data labeling cost and low training timeliness, and improves the model's recognition accuracy and training efficiency.
Patent Information
- Application Number
- CN202011027593.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-25
- Publication Date
- 2024-09-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In existing model training methods, the high cost of data annotation results in low training efficiency, and unlabeled data cannot be effectively used to improve model accuracy.
By performing feature extraction training on the labeled data set, a feature extraction model is obtained, which is used to extract features from the unlabeled data set. The pre-trained model is optimized and trained by cutting the unlabeled data set, and finally the target training is obtained by training the target data set. model, avoiding the data annotation process.
While reducing the cost of data annotation, it improves the recognition accuracy of the model in specific data sets, saves time in sorting and selecting unlabeled data, and improves training efficiency.
Smart Images

Figure CN112016633B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and specifically to deep learning technology in the field of artificial intelligence technology. Background Art
[0002] Machine Learning (ML) is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning algorithms are a type of algorithm that automatically analyzes data to obtain patterns and uses the patterns to predict unknown data. Typically, deep learning is one of the fields in machine learning. The process of deep learning can be roughly summarized as the process of determining the model-training the model-using the model. Among them, the process of training the model plays a decisive role in the accuracy of the model. Summary of the invention
[0003] The embodiments of the present application provide a model training method, device, electronic device and storage medium to improve the training efficiency and recognition accuracy of the model in a specific data set.
[0004] In a first aspect, an embodiment of the present application provides a model training method, comprising:
[0005] Performing feature extraction training on a target data set to obtain a feature extraction model; the data in the target data set is label data;
[0006] Extracting features from the unlabeled data set using the feature extraction model to obtain unlabeled data features;
[0007] Training a pre-trained model according to the unlabeled data features;
[0008] Performing data trimming on each unlabeled data in the unlabeled data set to obtain a trimmed unlabeled data set;
[0009] Optimizing and training the pre-trained model according to the cropped unlabeled data set to obtain a target pre-trained model;
[0010] The target pre-training model is trained according to the target data set to obtain a target training model.
[0011] In a second aspect, an embodiment of the present application provides a model training device, comprising:
[0012] A feature extraction model acquisition module is used to perform feature extraction training on a target data set to obtain a feature extraction model; the data in the target data set is label data;
[0013] An unlabeled data feature acquisition module is used to extract features from the unlabeled data set through the feature extraction model to obtain unlabeled data features;
[0014] A pre-trained model training module, used for training a pre-trained model according to the unlabeled data features;
[0015] A data clipping module, used for performing data clipping on each unlabeled data in the unlabeled data set to obtain a clipped unlabeled data set;
[0016] A target pre-trained model acquisition module is used to optimize the pre-trained model according to the cropped unlabeled data set to obtain a target pre-trained model;
[0017] The target training model acquisition module is used to train the target pre-training model according to the target data set to obtain a target training model.
[0018] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0019] at least one processor; and
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the model training method provided by the embodiment of the first aspect.
[0022] In a fourth aspect, an embodiment of the present application further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the model training method provided in the embodiment of the first aspect.
[0023] The embodiment of the present application obtains a feature extraction model by performing feature extraction training on a target data set including labeled data, and extracts features from an unlabeled data set through the feature extraction model to obtain unlabeled data features, and then trains a pre-trained model based on the unlabeled data features. After obtaining the pre-trained model, data cropping is performed on each unlabeled data in the unlabeled data set, and the pre-trained model is optimized and trained based on the obtained cropped unlabeled data set to obtain a target pre-trained model. Finally, the target pre-trained model is trained based on the target data set to obtain a target training model, which solves the problem of low training efficiency caused by high data annotation costs in existing model training methods, and can improve the recognition accuracy of the model while improving training efficiency.
[0024] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.
[0026] Figure 1 is a flow chart of a model training method provided in an embodiment of the present application;
[0027] Figure 2 is a flow chart of a model training method provided in an embodiment of the present application;
[0028] Figure 3 is a structural diagram of a model training device provided in an embodiment of the present application;
[0029] Figure 4 It is a schematic diagram of the structure of an electronic device used to implement the model training method of an embodiment of the present application. DETAILED DESCRIPTION
[0030] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0031] In the deep learning technology in the field of machine learning, the accuracy of the model has a significant impact on the application effect of the model. At present, the sample data for model training includes two types: labeled data and unlabeled data. The accuracy of the model can be greatly improved by increasing the amount of labeled data. However, this method will result in a relatively high cost of data annotation and cannot make good use of a large amount of unlabeled data.
[0032] There are two general methods for using unlabeled data to improve the accuracy of models. One is the unsupervised learning method, which is to learn the features of a large amount of sample data through a similar contrast loss function. The learned model generally has good data features and can be used for transfer learning on a specific data set. The second is the semi-supervised learning method, which is to train the model with unlabeled data and labeled data together, gradually mining the features of unlabeled data through the features of supervised learning, and then expanding the features learned by the model.
[0033] Among the above methods of using unlabeled data to improve model accuracy, the unsupervised learning method requires an extremely large amount of data when learning unlabeled data, which can even reach the billion level. The huge amount of data causes serious bottlenecks in training, and the training time is seriously increased. It is difficult to converge within a certain period of time, and the training time efficiency is low. The semi-supervised learning method has stricter requirements on training sample data, requiring that the unlabeled data should belong to the label range of the target data set as much as possible. Among them, the target data set is also the data set that the model needs to automatically identify and process during the process. However, in actual training, it is difficult to ensure that most of the unlabeled data belongs to the label range of the labeled data. Before formal training, it often takes a certain amount of time to organize and select the unlabeled data, which indirectly reduces the training time efficiency.
[0034] In one example, Figure 1 is a flow chart of a model training method provided by an embodiment of the present application. This embodiment can be applied to the case of quickly training a model to improve the model recognition accuracy. The method can be executed by a model training device, which can be implemented by software and / or hardware and can generally be integrated in an electronic device. The electronic device can be a computer device, etc. Accordingly, Figure 1 As shown, the method includes the following operations:
[0035] S110, performing feature extraction training on a target data set to obtain a feature extraction model; the data in the target data set is label data.
[0036] The target data set is the data set that the model needs to automatically identify and process in the process. The data in the target data set can be label data, and the type of label data can be any type, such as image data, audio data, or character data, etc. The embodiment of the present application does not limit the specific data type of the label data. The feature extraction model can be a model obtained by performing feature extraction training on the target data set, which is mainly used to repeatedly extract data features from the target data set.
[0037] In an embodiment of the present application, before training a target training model for identifying a target data set, feature extraction training can be first performed on the target data set to obtain a feature extraction model. Optionally, the feature extraction model can be any type of CNN (Convolutional Neural Networks), and the loss function of the feature extraction model can adopt arcmargin loss or triplet loss, etc. As long as the feature extraction of the target data set can be performed, the embodiment of the present application does not limit the specific model type of the feature extraction model and the corresponding loss function type.
[0038] S120 , extracting features from the unlabeled data set using the feature extraction model to obtain unlabeled data features.
[0039] Among them, the unlabeled data set can be a data set composed of unlabeled data of the same label data type as the target data set. Exemplarily, when the data type of the label data is image data, the unlabeled data in the unlabeled data set is also image data. When the data type of the label data is character data, the unlabeled data in the unlabeled data set is also character data. However, it should be noted that the label type of the unlabeled data does not need to belong to the label range of the target data set, and the unlabeled data does not require a huge amount of data to support it. There are many ways to obtain an unlabeled data set, such as downloading relevant data from the Internet or collecting data by other means, and the embodiments of the present application do not limit this.
[0040] Correspondingly, after obtaining the feature extraction model, the feature extraction model can be used to extract features from each unlabeled data in the unlabeled data set to obtain the unlabeled data features. Since the embodiment of the present application does not require the label type of the unlabeled data to belong to the label range of the target data set, there is no need to organize and select the unlabeled data set, which avoids the screening time of the training data and can effectively improve the training efficiency.
[0041] S130: training a pre-trained model according to the unlabeled data features.
[0042] The pre-trained model can be understood as an intermediate training model before the target pre-trained model, or as a preliminary training model corresponding to the target pre-trained model. The pre-trained model has the same weight values as the pre-trained model.
[0043] After the unlabeled data features of the unlabeled data set are extracted using the feature extraction model, the unlabeled data features can be used for feature training to obtain a pre-trained model. The pre-trained model has an initial recognition function, but the recognition accuracy needs to be further improved. That is, the embodiment of the present application can use unlabeled data as sample data for model training, thereby effectively reducing the data annotation cost.
[0044] S140: Perform data trimming on each unlabeled data in the unlabeled data set to obtain a trimmed unlabeled data set.
[0045] The cropped unlabeled data set may be a data set formed by cropping the unlabeled data.
[0046] S150. Optimize and train the pre-trained model according to the cropped unlabeled data set to obtain a target pre-trained model.
[0047] Among them, the target pre-training model can be a pre-training model that is finally successfully trained, and its recognition accuracy is higher than that of the pre-training model, which can be used to train the label data to obtain the final target training model.
[0048] It is understandable that although the pre-trained model has preliminary recognition functions, the recognition accuracy still does not meet the requirements. In order to further improve the recognition accuracy of the pre-trained model, after obtaining the pre-trained model, the unlabeled data in the unlabeled data set can be cropped to obtain a cropped unlabeled data set. Optionally, when performing data cropping, the region of interest of the unlabeled data can be cropped, and the so-called region of interest is the region that best reflects the data characteristics. That is, each cropped unlabeled data in the cropped unlabeled data set can reflect the most core data features, and its data feature purity is higher. For example, each unlabeled image data can be cropped to include a region including a target object (such as a person, an animal, or a vehicle, etc.), and the cropped image data can include feature information such as the position or size of the target object. Accordingly, after obtaining the cropped unlabeled data set, the cropped unlabeled data set can be further used to optimize the pre-trained model, thereby obtaining a target pre-trained model with higher recognition accuracy.
[0049] S160: Train the target pre-training model according to the target data set to obtain a target training model.
[0050] Accordingly, after obtaining the target pre-training model, the target pre-training model can be subjected to a final learning and training process according to the target data set to obtain a target training model. The target training model can effectively identify each label data in the target data set with higher recognition accuracy.
[0051] It can be seen that the model training method provided in the embodiment of the present application does not require a data labeling process, and can greatly improve the accuracy of the model in a specific data set while effectively reducing the cost of data labeling. In addition, the model training method provided in the embodiment of the present application does not require a large amount of unlabeled data support, which can greatly save the amount of data of the unlabeled data, thereby making the model iteration faster. At the same time, the unlabeled data only needs to keep the data type the same as the type of the labeled data, and there is no need to limit the label type of the unlabeled data to belong to the label range of the target data set, which can greatly save the time of sorting and selecting the unlabeled data.
[0052] The embodiment of the present application obtains a feature extraction model by performing feature extraction training on a target data set including labeled data, and extracts features from an unlabeled data set through the feature extraction model to obtain unlabeled data features, and then trains a pre-trained model based on the unlabeled data features. After obtaining the pre-trained model, data cropping is performed on each unlabeled data in the unlabeled data set, and the pre-trained model is optimized and trained based on the obtained cropped unlabeled data set to obtain a target pre-trained model. Finally, the target pre-trained model is trained based on the target data set to obtain a target training model, which solves the problem of low training efficiency caused by high data annotation costs in existing model training methods, and can improve the recognition accuracy of the model while improving training efficiency.
[0053] In one example, Figure 2 It is a flow chart of a model training method provided in an embodiment of the present application. Based on the technical solutions of the above embodiments, the embodiment of the present application has been optimized and improved, and a variety of specific implementation methods are provided, including feature extraction training for the target data set, pre-training model training according to the features of the unlabeled data, data clipping for each unlabeled data in the unlabeled data set, and training the target pre-training model according to the target data set.
[0054] like Figure 2 A model training method shown includes:
[0055] S210, performing metric learning on the target data set through a preset feature extraction model to obtain a feature extraction model.
[0056] The preset feature extraction model may be an untrained original model retaining the original weights, such as an original CNN model, etc. Optionally, the loss function of the preset feature extraction model may adopt an arcmargin loss function.
[0057] In an embodiment of the present application, when the target data set is trained for feature extraction, the target data set can be metrically learned through a preset feature extraction model. The so-called metric learning is also similarity learning. The preset feature extraction model uses the arcmargin loss function to not only effectively train the feature extraction model, but also to give the confidence of the corresponding clustering category for the unlabeled data of each clustering category extracted when the unlabeled data features of the unlabeled data set are subsequently extracted.
[0058] In an optional embodiment of the present application, the label data in the target data set is label image data, and the target training model is used to perform image recognition on the label image.
[0059] The labeled image data refers to the image data with labels.
[0060] In the embodiment of the present application, the target training model can be trained on the target data set composed of the labeled image data to implement the image recognition technology using the target training model. Optionally, the target training model can be widely used in various computer vision tasks, such as animal and plant classification, dish recognition, and landmark recognition, etc. The embodiment of the present application does not limit the image recognition application field of the target training model.
[0061] S220: extract features from the unlabeled data set using the feature extraction model to obtain unlabeled data features.
[0062] S230: training a pre-trained model according to the unlabeled data features.
[0063] Accordingly, S230 may specifically include the following operations:
[0064] S231. Clustering the unlabeled data features using the feature extraction model.
[0065] Optionally, the pre-trained model can be trained by clustering the unlabeled data. Optionally, the unlabeled data can be clustered by a feature extraction model. The feature extraction model can extract a corresponding feature vector for each unlabeled data, and calculate a corresponding confidence for each cluster category obtained.
[0066] S232: Classify each unlabeled data in the unlabeled data set according to the clustering result of the unlabeled data features.
[0067] The difference between the number of cluster categories included in the clustering result and the number of categories of label data in the target data set meets the feature clustering condition.
[0068] The clustering category is a plurality of data categories obtained by clustering the unlabeled data features. The feature clustering condition can be set according to actual needs, such as being much greater than a certain set threshold, etc. The embodiment of the present application does not limit the specific condition content of the feature clustering condition.
[0069] Correspondingly, after the unlabeled data features are clustered by the feature extraction model to obtain multiple categories, each unlabeled data can be automatically labeled by the obtained clustering category. It should be noted that the method of automatically labeling each unlabeled data by clustering category here does not belong to the data labeling method by label, but belongs to a data classification method. That is, each unlabeled data is respectively attributed to its corresponding clustering category set. The clustering processing method can be any clustering method in the field of machine learning. In order to better utilize the unlabeled data features of unlabeled data, the difference between the number of clustering categories included in the clustering results and the number of categories of labeled data in the target data set can be limited to meet the feature clustering conditions. For example, the number of clustering categories included in the clustering results can be limited to be much larger than the number of categories of labeled data in the target data set. Exemplarily, assuming that the number of categories of labeled data in the target data set is 200, the number of clustering categories can be 10,000.
[0070] S233: updating the unlabeled data set according to the classification processing result of the unlabeled data set to obtain an updated unlabeled data set, and using the updated unlabeled data set to train the pre-trained model.
[0071] The updated unlabeled data set may be an unlabeled data set including clustering categories.
[0072] Correspondingly, after each unlabeled data is respectively attributed to its corresponding cluster category set, each cluster category set including a certain number of unlabeled data can be composed into an updated unlabeled data set. It can be understood that the unlabeled data included in the updated unlabeled data set has not actually changed in essence, but a complete set is divided into multiple sub-sets, each set belongs to a cluster category and includes a certain number of unlabeled data. That is, the data features of each data in the updated unlabeled data set are more concentrated, and the training effect of the pre-trained model is more ideal.
[0073] The above technical solution, after clustering the unlabeled data set, classifies each unlabeled data in the unlabeled data set according to the processing result to form a new unlabeled data set, thereby using the new unlabeled data set with more concentrated unlabeled data features to train the pre-trained model, which can improve the training efficiency and recognition accuracy of the pre-trained model.
[0074] In an optional embodiment of the present application, the training of the pre-trained model according to the classification processing result of the unlabeled data set may include: determining the current classification processing result of the updated unlabeled data set; ranking the reliability of each current clustering category according to the confidence of each current clustering category in the current classification processing result; obtaining a previously set proportion of unlabeled data as the target classification result according to the reliability ranking result, and training the pre-trained model according to the target classification result; returning to perform the operation of feature extraction training on the target data set until the reliability ranking result remains unchanged. Among them, the current clustering processing result may be the clustering processing result of the current updated unlabeled data set.
[0075] Among them, the current classification processing result may be the classification processing result of the current updated unlabeled data set. The current clustering category may be the clustering category included in the updated unlabeled data set. The current reliability sorting may be a sorting method from large to small according to the confidence value. The reliability sorting result may be the sorting result of each unlabeled data obtained by the reliability sorting method. The set ratio may be set according to actual needs, such as 50% or 80%, etc. The embodiment of the present application does not limit the specific value of the set ratio. The target classification result may be a classification result whose reliability meets the requirements.
[0076] In order to further improve the training efficiency and the recognition accuracy of the pre-trained model, after obtaining the updated unlabeled data set, the reliability of each current clustering category can be sorted according to the confidence of each current clustering category in the current classification processing result of the updated unlabeled data set, that is, the current clustering categories are sorted in descending order according to the confidence values of each current clustering category. The higher the order of the clustering category, the greater the confidence value corresponding to the clustering category, indicating that its reliability is better. At this time, the unlabeled data of the pre-set proportion in the reliability sorting result can be obtained as the target classification result, and the pre-trained model can be trained according to the obtained target classification result. The confidence value of the target classification result is large, the reliability is ideal, and the training effect is also more ideal. After the training of the current updated unlabeled data set is completed, the operation of performing feature extraction training on the target data set can be returned, that is, the training is iterated repeatedly until the reliability sorting result remains unchanged, that is, until most of the unlabeled data in the unlabeled data set participate in the feature extraction process of the unlabeled data features. The so-called iterative training means that in each subsequent iterative training process, the feature extraction model obtained in the previous training can be used to perform feature extraction training on the target data set, and the new feature extraction model can be used to extract features from the previous updated unlabeled data set, and the new pre-trained model can be used to train the updated unlabeled data set. In this iterative training method, the features of the updated unlabeled data set become stronger and more refined. Therefore, the number of clustering categories obtained by clustering the updated unlabeled data set each time is greater than the number of clustering categories in the previous time, and more refined features of the unlabeled data can be distinguished. It can be seen that the final pre-training model can be obtained more quickly and efficiently through iterative training.
[0077] S240: Perform data trimming on each unlabeled data in the unlabeled data set to obtain a trimmed unlabeled data set.
[0078] Accordingly, S240 may specifically include the following operations:
[0079] S241. Predicting predicted heat areas matched by each unlabeled data in the unlabeled data set according to the pre-trained model.
[0080] Among them, the predicted heat area can be a feature concentration area of unlabeled data.
[0081] Although the pre-trained model obtained by training each original unlabeled data in the unlabeled data set has certain recognition functions, the recognition accuracy is not ideal. In order to further improve the recognition accuracy of the pre-trained model, the obtained pre-trained model can be used to predict the predicted heat area matched by each unlabeled data in the unlabeled data set.
[0082] S242, performing data cropping on the region of interest for each of the unlabeled data according to each of the predicted heat regions.
[0083] Correspondingly, after obtaining the predicted heat area matched by each unlabeled data, the predicted heat area matched by each unlabeled data can be used to perform data cropping on each unlabeled data to retain the feature concentration area of each unlabeled data.
[0084] In the above scheme, since the pre-trained model has a certain recognition accuracy, and by using the pre-trained model to predict the predicted heat area matching each unlabeled data, it is only a simple determination of the feature concentration area without the need to specifically identify the data features. Therefore, the accuracy of data cropping is relatively high, and the corresponding cropped unlabeled data set can reflect the most core data features, and its data feature purity is higher.
[0085] S250: Optimize and train the pre-trained model according to the cropped unlabeled data set to obtain a target pre-trained model.
[0086] S260: Train the target pre-training model according to the target data set to obtain a target training model.
[0087] Accordingly, S260 may specifically include the following operations:
[0088] S261. Determine a target learning rate for the target pre-training model.
[0089] The target learning rate may be a learning rate with a smaller value, such as 0.1 or 0.01, etc. The embodiment of the present application does not limit the specific value of the target learning rate.
[0090] Since the target pre-trained model already has a high recognition accuracy, it does not need over-learning. Therefore, optionally, when training the target pre-trained model according to the target data set, a target learning rate with a smaller value can be determined for the target pre-trained model to prevent the target pre-trained model from over-learning and causing weight changes.
[0091] S262: Perform parameter fixing processing on the network parameters of the preset network layer of the target pre-trained model.
[0092] S263: training the target pre-trained model after parameter fixing according to the target data set.
[0093] The preset network layers may be a previously set number of network layers of the target pre-trained model.
[0094] In order to keep the target pre-training model to quickly and effectively extract the basic features of the label data in the target data set, the network parameters of the preset network layer of the target pre-training model can be fixed. For example, assuming that the target pre-training model has a total of 100 layers of network layers, the first 20 or 30 layers of network layers can be fixed. After the parameter fixing process, the target pre-training model after the parameter fixing process can be used to perform the final learning and training process on the original target data set to obtain a target training model with higher recognition accuracy. The parameter fixing processing method can ensure that the basic features of the label data are not disrupted, thereby further improving the training efficiency and recognition accuracy of the target training model.
[0095] Normally, in order to effectively improve the recognition accuracy of the model, it is often necessary to replace a relatively small model with a relatively large model, or to expand the amount of data used for model training. However, the relatively large model has a slow prediction speed and is difficult to use for industrial deployment. The expansion of the amount of data requires a lot of data labeling work, which is time-consuming and labor-intensive. The model training method provided in the embodiment of the present application can improve the recognition accuracy of the model in the target data set without labeling the data. Compared with the existing unsupervised learning method, it can also greatly save the amount of unlabeled data, thereby making the model training iteration faster. Compared with the existing semi-supervised learning method, there is no need to pay attention to whether the label type of the unlabeled data belongs to the label range of the target data set, which can greatly save the time of data sorting and selection.
[0096] In one example, Figure 3 This is a structural diagram of a model training device provided in an embodiment of the present application. The embodiment of the present application can be applied to the situation of quickly training a model to improve the model recognition accuracy. The device is implemented by software and / or hardware and is specifically configured in an electronic device. The electronic device can be a computer device, etc.
[0097] like Figure 3 The model training device 300 shown includes: a feature extraction model acquisition module 310, an unlabeled data feature acquisition module 320, a pre-trained model training module 330, a data clipping module 340, a target pre-trained model acquisition module 350 and a target training model acquisition module 360.
[0098] The feature extraction model acquisition module 310 is used to perform feature extraction training on the target data set to obtain a feature extraction model; the data in the target data set is label data;
[0099] The unlabeled data feature acquisition module 320 is used to extract features from the unlabeled data set through the feature extraction model to obtain unlabeled data features;
[0100] A pre-trained model training module 330, used for training a pre-trained model according to the unlabeled data features;
[0101] A data clipping module 340 is used to clip each unlabeled data in the unlabeled data set to obtain a clipped unlabeled data set;
[0102] A target pre-trained model acquisition module 350 is used to optimize the pre-trained model according to the cropped unlabeled data set to obtain a target pre-trained model;
[0103] The target training model acquisition module 360 is used to train the target pre-training model according to the target data set to obtain a target training model.
[0104] The embodiment of the present application obtains a feature extraction model by performing feature extraction training on a target data set including labeled data, and extracts features from an unlabeled data set through the feature extraction model to obtain unlabeled data features, and then trains a pre-trained model based on the unlabeled data features. After obtaining the pre-trained model, data cropping is performed on each unlabeled data in the unlabeled data set, and the pre-trained model is optimized and trained based on the obtained cropped unlabeled data set to obtain a target pre-trained model. Finally, the target pre-trained model is trained based on the target data set to obtain a target training model, which solves the problem of low training efficiency caused by high data annotation costs in existing model training methods, and can improve the recognition accuracy of the model while improving training efficiency.
[0105] Optionally, the feature extraction model acquisition module 310 is specifically used to: perform metric learning on the target data set through a preset feature extraction model; wherein the loss function of the preset feature extraction model adopts an arcmargin loss function.
[0106] Optionally, the pre-trained model training module 330 is specifically used to: cluster the unlabeled data features through the feature extraction model; classify the individual unlabeled data in the unlabeled data set according to the clustering results of the unlabeled data features; wherein the difference between the number of clustering categories included in the clustering results and the number of categories of labeled data in the target data set satisfies the feature clustering condition; update the unlabeled data set according to the classification processing results of the unlabeled data set to obtain an updated unlabeled data set, and use the updated unlabeled data set to train the pre-trained model.
[0107] Optionally, the pre-trained model training module 330 is specifically used to: determine the current classification processing result of the updated unlabeled data set; rank the reliability of each current clustering category according to the confidence of each current clustering category in the current classification processing result; obtain a previously set proportion of unlabeled data as the target classification result according to the reliability ranking result, and train the pre-trained model according to the target classification result; return to perform the operation of feature extraction training on the target data set until the reliability ranking result remains unchanged.
[0108] Optionally, the data clipping module 340 is specifically used to: predict the predicted heat area matching each unlabeled data in the unlabeled data set according to the pre-trained model; and perform data clipping on the area of interest of each unlabeled data according to each predicted heat area.
[0109] Optionally, the target training model acquisition module 360 is specifically used to: determine a target learning rate for the target pre-training model; perform parameter fixing processing on network parameters of a preset network layer of the target pre-training model; and train the target pre-training model after parameter fixing processing according to the target data set.
[0110] Optionally, the label data in the target data set is label image data, and the target training model is used to perform image recognition on the label images.
[0111] The above-mentioned model training device can execute the model training method provided in any embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the model training method provided in any embodiment of the present application.
[0112] Since the model training device introduced above is a device that can execute the model training method in the embodiment of the present application, based on the model training method introduced in the embodiment of the present application, the technical personnel in the field can understand the specific implementation of the model training device of the present embodiment and its various variations, so how the model training device implements the model training method in the embodiment of the present application is not introduced in detail here. As long as the technical personnel in the field implement the device used in the model training method in the embodiment of the present application, it belongs to the scope of protection of this application.
[0113] In one example, the present application also provides an electronic device and a readable storage medium.
[0114] Figure 4 This is a schematic diagram of the structure of an electronic device used to implement the model training method of the embodiment of the present application. Figure 4, is a block diagram of an electronic device according to a model training method according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0115] like Figure 4 As shown, the electronic device includes: one or more processors 401, a memory 402, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to an interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 401 is taken as an example.
[0116] The memory 402 is a non-transitory computer-readable storage medium provided in the present application. The memory stores instructions executable by at least one processor to enable the at least one processor to perform the model training method provided in the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the model training method provided in the present application.
[0117] The memory 402 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the model training method in the embodiment of the present application (for example, the attached Figure 3 The processor 401 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 402, that is, the model training method in the above method embodiment is implemented.
[0118] The memory 402 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of an electronic device that implements the model training method, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 402 may optionally include a memory remotely disposed relative to the processor 401, and these remote memories may be connected to the electronic device that implements the model training method via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0119] The electronic device implementing the model training method may further include: an input device 403 and an output device 404. The processor 401, the memory 402, the input device 403 and the output device 404 may be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.
[0120] The input device 403 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device implementing the model training method, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 404 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.
[0121] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0122] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0123] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0124] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0125] A computer system may include a client and a server. The client may be a smartphone, a laptop, a desktop computer, a tablet computer, a smart speaker, etc., but is not limited thereto. The server may be an independent physical server, or a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud computing, cloud services, cloud databases, and cloud storage. The client and server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs that run on the corresponding computers and have a client-server relationship with each other.
[0126] The embodiment of the present application obtains a feature extraction model by performing feature extraction training on a target data set including labeled data, and extracts features from an unlabeled data set through the feature extraction model to obtain unlabeled data features, and then trains a pre-trained model based on the unlabeled data features. After obtaining the pre-trained model, data cropping is performed on each unlabeled data in the unlabeled data set, and the pre-trained model is optimized and trained based on the obtained cropped unlabeled data set to obtain a target pre-trained model. Finally, the target pre-trained model is trained based on the target data set to obtain a target training model, which solves the problem of low training efficiency caused by high data annotation costs in existing model training methods, and can improve the recognition accuracy of the model while improving training efficiency.
[0127] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0128] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A model training method, include: Perform feature extraction training on the target data set to obtain a feature extraction model; The data in the target data set is label data; Extracting features from the unlabeled data set using the feature extraction model to obtain unlabeled data features; Training a pre-trained model according to the unlabeled data features; Performing data trimming on each unlabeled data in the unlabeled data set to obtain a trimmed unlabeled data set; Optimizing and training the pre-trained model according to the cropped unlabeled data set to obtain a target pre-trained model; The target pre-training model is trained according to the target data set to obtain a target training model; wherein the label data in the target data set is label image data, and the target training model is used to perform image recognition on the label image; The training process of the pre-trained model includes: Determine and update the current classification processing result of the unlabeled data set; wherein the updated unlabeled data set is the unlabeled data set including cluster categories, and the cluster categories are multiple data categories obtained by clustering the unlabeled data features; sorting the reliability of each current clustering category according to the confidence of each current clustering category in the current classification processing result; According to the reliability ranking result, a pre-set proportion of unlabeled data is obtained as a target classification result, and the pre-trained model is trained according to the target classification result; Return to perform feature extraction training on the target data set until the reliability ranking result remains unchanged.
2. The method according to claim 1, in, The feature extraction training of the target data set includes: Performing metric learning on the target data set by using a preset feature extraction model; Among them, the loss function of the preset feature extraction model adopts the arcmargin loss function.
3. The method according to claim 1, in, The step of training the pre-trained model according to the unlabeled data features includes: Performing clustering processing on the unlabeled data features by using the feature extraction model; Classify each unlabeled data in the unlabeled data set according to the clustering result of the unlabeled data feature; wherein the difference between the number of clustering categories included in the clustering result and the number of categories of the labeled data in the target data set satisfies the feature clustering condition; The unlabeled data set is updated according to the classification processing result of the unlabeled data set to obtain an updated unlabeled data set, and the pre-trained model is trained using the updated unlabeled data set.
4. The method according to claim 1, in, The step of performing data trimming on each unlabeled data in the unlabeled data set includes: Predicting, according to the pre-trained model, a predicted heat area matched by each of the unlabeled data in the unlabeled data set; Data is cropped for the region of interest of each of the unlabeled data according to each of the predicted heat regions.
5. The method according to claim 1, in, The training of the target pre-trained model according to the target data set includes: Determining a target learning rate for the target pre-trained model; Performing parameter fixing processing on the network parameters of the preset network layer of the target pre-trained model; The target pre-trained model after parameter fixing is trained according to the target data set.
6. A model training device, include: A feature extraction model acquisition module is used to perform feature extraction training on the target data set to obtain a feature extraction model; The data in the target data set is label data; An unlabeled data feature acquisition module is used to extract features from the unlabeled data set through the feature extraction model to obtain unlabeled data features; A pre-trained model training module, used for training a pre-trained model according to the unlabeled data features; A data clipping module, used for performing data clipping on each unlabeled data in the unlabeled data set to obtain a clipped unlabeled data set; A target pre-trained model acquisition module is used to optimize the pre-trained model according to the cropped unlabeled data set to obtain a target pre-trained model; A target training model acquisition module is used to train the target pre-training model according to the target data set to obtain a target training model; Wherein, the label data in the target data set is label image data, and the target training model is used to perform image recognition on the label image; The training process of the pre-trained model includes: Determine and update the current classification processing result of the unlabeled data set; wherein the updated unlabeled data set is the unlabeled data set including cluster categories, and the cluster categories are multiple data categories obtained by clustering the unlabeled data features; sorting the reliability of each current clustering category according to the confidence of each current clustering category in the current classification processing result; According to the reliability ranking result, a pre-set proportion of unlabeled data is obtained as a target classification result, and the pre-trained model is trained according to the target classification result; Return to perform feature extraction training on the target data set until the reliability ranking result remains unchanged.
7. The device according to claim 6, in, The feature extraction model acquisition module is specifically used for: Performing metric learning on the target data set by using a preset feature extraction model; Among them, the loss function of the preset feature extraction model adopts the arcmargin loss function.
8. The device according to claim 6, in, The pre-trained model training module is specifically used for: Performing clustering processing on the unlabeled data features by using the feature extraction model; Classify each unlabeled data in the unlabeled data set according to the clustering result of the unlabeled data feature; wherein the difference between the number of clustering categories included in the clustering result and the number of categories of the labeled data in the target data set satisfies the feature clustering condition; The unlabeled data set is updated according to the classification processing result of the unlabeled data set to obtain an updated unlabeled data set, and the pre-trained model is trained using the updated unlabeled data set.
9. The device according to claim 6, in, The data clipping module is specifically used for: Predicting, according to the pre-trained model, a predicted heat area matched by each of the unlabeled data in the unlabeled data set; Data is cropped for the region of interest of each of the unlabeled data according to each of the predicted heat regions.
10. The device according to claim 6, in, The target training model acquisition module is specifically used for: Determining a target learning rate for the target pre-trained model; Performing parameter fixing processing on the network parameters of the preset network layer of the target pre-trained model; The target pre-trained model after parameter fixing is trained according to the target data set.
11. An electronic device, include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the model training method described in any one of claims 1-5.
12. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the model training method described in any one of claims 1-5.
