Label determination method and device of training image, equipment and storage medium

The target label of the training image is determined by the clustering feature matrix to assist in the problem of poor training sample labels in existing technologies, improving the accuracy of neural networks and reducing the workload of manual calibration.

CN119380145AActive Publication Date: 2025-01-28JINAN BOGUAN INTELLIGENT TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411965112.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-01-28
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

The labels of training samples determined by label smoothing techniques or data cleaning techniques in the prior art are not effective when training network models.

Method used

By obtaining multiple training images and its original category labels in advance, determine multiple target cluster parameters of the preset cluster algorithm, and make a concentration of training images based on these parameters to obtain the feature matrix. Then use the similarity between the characteristic matrix and the cluster characteristic matrix of the neural network to determine the target category label of the training image.

Benefits of technology

降低了神经网络对标签的依赖性,提高了最终训练的神经网络的精度,并减少了人工对标签标定的工作量。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119380145A_ABST
    Figure CN119380145A_ABST
Patent Text Reader

Abstract

The invention provides a label determination method and device for training images, equipment and a storage medium, and is applied to the technical field of computers, and the method comprises the steps: obtaining a plurality of training images and a plurality of target clustering parameters of a preset clustering algorithm; clustering the plurality of training images according to the total category number of the original category labels and each target clustering parameter, and determining a plurality of first feature matrixes of the plurality of training images; the number of the plurality of first feature matrixes is the same as the total category number; inputting each training image into a first neural network model for classification processing, and determining a second feature matrix corresponding to each training image; and for each training image, obtaining a target first feature matrix corresponding to the original category label of the training image from the plurality of first feature matrixes, and determining a target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix. By adopting the technical scheme of the invention, the precision of the finally trained neural network can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for determining labels of training images. Background Art

[0002] With the rapid development of artificial intelligence technology, expectations for artificial intelligence-related algorithm indicators are getting higher and higher, which requires the ability to train artificial intelligence-related network models with higher precision and accuracy.

[0003] In the related art, during the training of the network model, for example, different training samples (such as different training images) can be collected in advance, and then these training samples can be labeled separately, and then the network model can be trained with the labeled training samples. However, during the labeling process, there may be calibration errors due to the difficulty of data label calibration or other reasons, such as image blur making it difficult to determine the category, calibration errors caused by the calibrator himself, etc. These may cause the final obtained labels to be inaccurate. There are currently some methods to improve the accuracy of calibrated labels, such as label smoothing technology, data cleaning technology, etc.

[0004] However, the labels of training samples determined by the above techniques still do not work well when training network models. Summary of the invention

[0005] The present invention provides a method, device, equipment and storage medium for determining labels of training images, which are used to solve the defect in the prior art that the label effect of training samples determined by label smoothing technology or data cleaning technology is still poor. The method first determines multiple target clustering parameters of a preset clustering algorithm through training images and their original category labels, and determines the target category label of each training image based on the similarity between a feature matrix obtained after clustering multiple training images according to the target clustering parameters and a feature matrix output by a neural network. In this way, the target label of the training image is determined with the assistance of the clustered feature matrix, which can reduce the dependence of the neural network on the label, improve the accuracy of the finally trained neural network, and reduce the workload of manual label calibration.

[0006] The present invention provides a method for determining a label of a training image, comprising: Acquire a plurality of pre-labeled training images and obtain a plurality of target clustering parameters corresponding to a preset clustering algorithm; each training image includes its own corresponding original category label, and the plurality of target clustering parameters are pre-determined based on the plurality of training images and the original category label of each training image; Clustering multiple training images according to the total number of categories corresponding to the original category labels and each target clustering parameter, and determining multiple first feature matrices corresponding to the multiple training images; the number of the multiple first feature matrices is the same as the total number of categories, and each first feature matrix corresponds to the features of the training image under a category label; Input each training image into the first neural network model for classification processing, and determine the second feature matrix corresponding to each training image; For each training image, a target first feature matrix corresponding to the original category label of the training image is obtained from multiple first feature matrices, and the target category label corresponding to the training image is determined based on the similarity between the second feature matrix and the target first feature matrix; the target category label is used to train the first neural network model.

[0007] According to a method for determining a label of a training image provided by the present invention, the target category label of the training image is represented by a label vector, and the label vector includes the probabilities corresponding to various category labels in the total category. The method for determining the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix includes: Calculating a first similarity between the second feature matrix and the target first feature matrix; If the first similarity is within the first threshold range, the probability corresponding to the original category label of the training image in the label vector is set to 1 and the probability corresponding to other category labels is set to 0, so as to obtain the target category label corresponding to the training image; the other category labels are category labels other than the original category labels of the training image in the total categories; If the first similarity exceeds the first threshold range, the second similarity between the second feature matrix and other first feature matrices in the plurality of first feature matrices is calculated, and the target category label corresponding to the training image is determined according to the second similarity and the second threshold range; the other first feature matrices are the remaining first feature matrices in the plurality of first feature matrices except the target first feature matrix; The similarity corresponding to the first threshold range is greater than the similarity corresponding to the second threshold range.

[0008] According to a method for determining a label of a training image provided by the present invention, before determining the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix, the method further includes: Obtaining the maximum value and the minimum value in the second feature matrix, and obtaining the maximum value and the minimum value in the target first feature matrix; According to the maximum value and the minimum value in the second characteristic matrix and the maximum value and the minimum value in the target first characteristic matrix, the second characteristic matrix is ​​subjected to characteristic stretching processing to determine the second characteristic matrix after characteristic stretching; the second characteristic matrix after the stretching has the same characteristic value range as that of the target first characteristic matrix; Accordingly, the above-mentioned determining the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix includes: According to the similarity between the second feature matrix after feature stretching and the target first feature matrix, the target category label corresponding to the training image is determined.

[0009] According to a method for determining a label of a training image provided by the present invention, the target category label corresponding to the training image is determined according to the similarity between the second feature matrix after feature stretching and the target first feature matrix, including: According to the second feature matrix after feature stretching, the mean and standard deviation corresponding to the second feature matrix after feature stretching are calculated; Obtaining the preset maximum and minimum digits, and removing outliers from the second feature matrix after feature stretching according to the maximum and minimum digits, the mean, and the standard deviation, to determine the second feature matrix after the outliers are removed; According to the similarity between the second feature matrix after outliers are removed and the target first feature matrix, the target category label corresponding to the training image is determined.

[0010] According to a method for determining labels of training images provided by the present invention, the above-mentioned obtaining of multiple target clustering parameters corresponding to a preset clustering algorithm includes: Divide multiple training images into multiple training image sets according to their original category labels; each training image set includes training images under one category label; Distance calculation processing is performed on the training images in each type of training image set to determine multiple target clustering parameters corresponding to the preset clustering algorithm.

[0011] According to a method for determining labels of training images provided by the present invention, the above-mentioned multiple target clustering parameters include a target neighborhood radius and a target minimum sample number, and the above-mentioned distance calculation processing is performed on the training images in each type of training image set to determine multiple target clustering parameters corresponding to a preset clustering algorithm, including: For each category label, a training image set corresponding to the category label is input into the second neural network model, a distance between every two training images is calculated in the second neural network model, a plurality of first distances corresponding to the training image set are obtained, and a target neighborhood radius under the category label corresponding to the training image set is determined according to the plurality of first distances; For each category label, the training images in the training image set corresponding to the category label are input into the third neural network model in different batches for distance calculation, and the model evaluation indicators corresponding to different batches are determined. According to the model evaluation indicators of different batches, the target batch is determined in different batches, and the number of training images corresponding to the target batch is used as the target minimum number of samples under the category label corresponding to the training image set.

[0012] According to a method for determining labels of training images provided by the present invention, the above-mentioned multiple target clustering parameters include a target distance measurement threshold, and the above-mentioned distance calculation processing is performed on the training images in each type of training image set to determine multiple target clustering parameters corresponding to the preset clustering algorithm, including: For each category label, calculate the distance between each training image in the training image set corresponding to the category label and its original category label to obtain multiple second distances; Eliminate second distances with relatively large differences among the plurality of second distances, and select a plurality of candidate second distances with the most digits ranked top among the eliminated second distances; An average value corresponding to multiple candidate second distances is calculated, a target second distance is determined from the multiple candidate second distances according to the average value, and the target second distance is determined as a target distance measurement threshold under a category label corresponding to the training image set.

[0013] The present invention also provides a device for determining a label of a training image, comprising the following modules: An acquisition module is used to acquire a plurality of pre-labeled training images and to acquire a plurality of target clustering parameters corresponding to a preset clustering algorithm; each training image includes its own corresponding original category label, and the plurality of target clustering parameters are pre-determined based on the plurality of training images and the original category label of each training image; A clustering module, used to cluster multiple training images according to the total number of categories corresponding to the original category labels and each target clustering parameter, and determine multiple first feature matrices corresponding to the multiple training images; the number of the multiple first feature matrices is the same as the total number of categories, and each first feature matrix corresponds to the features of the training image under a category label; A model processing module, used for inputting each training image into the first neural network model for classification processing, and determining a second feature matrix corresponding to each training image; The target label determination module is used to obtain, for each training image, a target first feature matrix corresponding to the original category label of the training image from multiple first feature matrices, and determine the target category label corresponding to the training image based on the similarity between the second feature matrix and the target first feature matrix; the target category label is used to train the first neural network model.

[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any of the above-described methods for determining labels of training images is implemented.

[0015] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for determining labels of training images.

[0016] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for determining labels of training images.

[0017] The label determination method, device, equipment and storage medium of the training image provided by the present invention obtains multiple training images with original category labels pre-labeled and obtains multiple target clustering parameters corresponding to the multiple training images and their original category labels in a preset clustering algorithm, then clusters the multiple training images according to the total number of categories corresponding to the original category labels and each target clustering parameter, determines multiple first feature matrices corresponding to the multiple training images with the same total number of categories, and inputs each training image into a first neural network model for classification processing, determines the second feature matrix and predicted category corresponding to each training image, and then obtains the target first feature matrix corresponding to the original category label of the training image from the multiple first feature matrices for each training image, and determines the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix; wherein each first feature matrix corresponds to the features of the training image under a category label. In this method, since the feature matrix output by the neural network model can be assisted by the clustered feature matrix to determine the target label of the training image, the dependence of the neural network model on its own original label during the training process can be reduced, the accuracy of the neural network model finally trained can be improved, and the workload of manual label calibration can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 This is one of the flow charts of the method for determining labels of training images provided in an embodiment of the present invention.

[0020] Figure 2This is the second flowchart of the method for determining labels of training images provided in an embodiment of the present invention.

[0021] Figure 3 This is the third flow chart of the method for determining labels of training images provided in an embodiment of the present invention.

[0022] Figure 4 It is a structural schematic diagram of a device for determining labels of training images provided in an embodiment of the present invention.

[0023] Figure 5 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] There are some existing methods to improve the accuracy of calibrated labels, such as label smoothing technology, data cleaning technology, etc., but the labels of training samples determined by them are still not effective when training network models. Based on this, the embodiments of the present invention provide a method, device, equipment and storage medium for determining labels of training images, which can solve this problem.

[0026] Combine the following Figure 1-Figure 3 A method for determining labels of training images according to an embodiment of the present invention is described.

[0027] It should be noted that the execution subject of the embodiment of the present invention may be a method for determining a label of a training image, or an electronic device, or other devices or equipment, which are not specifically limited here. The following embodiments are described by taking an electronic device as an execution subject as an example, and the electronic device may be a terminal or a server.

[0028] Figure 1 FIG. 1 is a flow chart of a method for determining a label of a training image provided by an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps: Step 102, obtaining a plurality of pre-labeled training images and a plurality of target clustering parameters corresponding to a preset clustering algorithm; each training image includes its own corresponding original category label, and the plurality of target clustering parameters are pre-determined based on the plurality of training images and the original category label of each training image.

[0029] Before training the first neural network model, multiple different types of training images may be collected in advance, and then a category label may be set for each training image. The label set here may be recorded as an original category label, and the original category label may be an artificially calibrated category label. The different category labels here may include, for example, people, cars, animals, plants, etc.

[0030] At the same time, a preset clustering algorithm can be obtained, and then the clustering parameters corresponding to the preset clustering algorithm can be determined. For example, for a density clustering algorithm, the corresponding clustering parameters may include parameters such as neighborhood radius, minimum number of samples, and distance measurement threshold.

[0031] After obtaining multiple training images and setting the original category label for each training image, the target value corresponding to the clustering parameter of the preset clustering algorithm can be determined through each training image and its own original category label, and then each clustering parameter and its target value can be recorded as the target clustering parameter, so that multiple target clustering parameters can be obtained.

[0032] It can be understood that the multiple target clustering parameters finally determined here are for the multiple training images, so the multiple target clustering parameters determined are more targeted at clustering the multiple training images themselves during clustering.

[0033] Step 104, clustering the multiple training images according to the total number of categories corresponding to the original category labels and the target clustering parameters, and determining multiple first feature matrices corresponding to the multiple training images; the number of the multiple first feature matrices is the same as the total number of categories, and each first feature matrix corresponds to the features of the training image under a category label.

[0034] After obtaining each training image with an original category label, the total number of category labels, i.e., the total number of categories, can also be obtained by counting the set original category labels. For example, if there are 100 training images, of which 30 training images have original category labels of people, 30 training images have original category labels of cars, and 40 training images have original category labels of animals, then the total number of categories is three, i.e., the three category labels of people, cars, and animals are included in the plurality of training images.

[0035] Then, after obtaining the multiple target clustering parameters of the preset clustering algorithm, assuming that the multiple target clustering parameters are multiple target clustering parameters determined for each category label, that is, each category label has multiple target clustering parameters, then all training images can be re-clustered according to the multiple target clustering parameters of each category label to obtain multiple clustering results with the same number of total categories, such as obtaining three clustering results, corresponding to the clustering of training images of people, cars, and animals. Each clustering result includes training images under the corresponding category label, and then feature extraction can be performed on the training images under each category label to obtain the feature matrix corresponding to all training images under the category label, which are all recorded as the first feature matrix. For example, here we can obtain the first feature matrix corresponding to the category of people, the first feature matrix corresponding to the category of cars, and the first feature matrix corresponding to the category of animals.

[0036] It can be seen that the number of first feature matrices here is the same as the number of clustering results and the total number of categories.

[0037] Step 106: Input each training image into the first neural network model for classification processing to determine the second feature matrix corresponding to each training image.

[0038] In this step, after obtaining multiple training images and setting the original category labels, each training image can also be input into the first neural network model for classification processing, and the predicted category corresponding to each training image can be output. At the same time, the feature matrix corresponding to each training image can be output through the convolution layer before the softmax classification layer of the first neural network model, and the feature matrix output by each training image can be recorded as the second feature matrix. That is to say, the second feature matrix of each training image here can represent the predicted category of the training image.

[0039] The first neural network model here can be an initial untrained neural network model, or a neural network model that has started training but has not been trained. In short, the first neural network model can be an untrained neural network model. The specific architecture of the first neural network model is not specifically limited here, for example, it can be CNN (Convolutional Neural Networks), RNN (Recurrent Neural Network), etc.

[0040] In addition, the main function of the first neural network model here is to classify the input image, that is, the first neural network model can also be a classification model. Of course, the first neural network model can also perform other image processing on the input image, such as image detection processing, etc., which is not specifically limited here.

[0041] It should be noted that, regarding the execution order of the above-mentioned step 104 and step 106, the two can be executed simultaneously, or they can be executed one after another in sequence, such as executing step 104 first and then step 106, or executing step 106 first and then step 104. The above-mentioned step numbering sequence is only an example.

[0042] Step 108, for each training image, obtain a target first feature matrix corresponding to the original category label of the training image from multiple first feature matrices, and determine the target category label corresponding to the training image based on the similarity between the second feature matrix and the target first feature matrix; the target category label is used to train the first neural network model.

[0043] Among them, the predicted category of each training image may be the same as its original category label, or it may be different from its original category label. When the predicted category is different from the original category label, it may be that the parameters of the network model are not adjusted properly, or the original category label manually calibrated is wrong. If the original category label manually calibrated is wrong, then when the first neural network model is subsequently trained, the wrong original category label is used for training, which will affect the accuracy of the first neural network model finally trained. Therefore, in this step, similarity calculation is used to determine the final category label for model training, thereby improving the accuracy of the trained model.

[0044] Specifically, after re-clustering multiple training images by using multiple target clustering parameters of the preset clustering algorithm to obtain the first feature matrix of each category label, and after obtaining the second feature matrix of a training image output by the first neural network model, the first feature matrix corresponding to the original category label of the training image can be selected from the multiple first feature matrices, and recorded as the target first feature matrix. After that, the similarity between the target first feature matrix and the second feature matrix of the training image output by the first neural network model can be calculated, and then the calculated similarity can be used to determine whether the original category label of the training image needs to be corrected. For example, if the target first feature matrix and the second feature matrix of a training image are relatively similar, it means that the original category label of the training image is correctly calibrated and does not need to be corrected, and the original category label of the training image can be used as its final target category label; for another example, if the target first feature matrix and the second feature matrix of a training image are not very similar, it means that the calibration of the original category label of the training image may be wrong, and the original category label needs to be corrected to obtain a more accurate target category label.

[0045] After determining the target category label of each training image, the target category label of each training image can be used as a calibrated label and directly input into the loss function for loss calculation, or the target category label and the predicted category can be input into the loss function together for loss calculation; then the first neural network model is trained by the calculated loss to finally obtain a trained first neural network model.

[0046] From the above description, it can be seen that when training the first neural network model, the similarity between the features of the clustered image and the features output by the network model can be used to determine whether the original category labels are accurately calibrated, and a more accurate target category label can be determined to input into the loss function to train the network model. This can reduce the dependence of the network model on the original category labels during training, and can effectively avoid the problem that the original category labels of the data set (i.e., training images) themselves are incorrect due to image blur, unclear classification standards, etc., which affects the accuracy of model training. This can effectively improve the accuracy of the final trained model, and there is no need to manually calibrate the original category labels repeatedly, thereby reducing the workload of manual label calibration.

[0047] In this embodiment, by obtaining multiple training images with pre-labeled original category labels and obtaining multiple target clustering parameters corresponding to the multiple training images and their original category labels in a preset clustering algorithm, multiple training images are clustered according to the total number of categories corresponding to the original category labels and each target clustering parameter, multiple first feature matrices corresponding to the multiple training images with the same number of categories as the total number are determined, and each training image is input into the first neural network model for classification processing, and the second feature matrix and predicted category corresponding to each training image are determined, and then for each training image, the target first feature matrix corresponding to the original category label of the training image is obtained from the multiple first feature matrices, and the target category label corresponding to the training image is determined according to the similarity between the second feature matrix and the target first feature matrix; wherein each first feature matrix corresponds to the features of the training image under a category label. In this method, since the feature matrix output by the neural network model can be assisted by the clustered feature matrix to determine the target label of the training image, the dependence of the neural network model on its own original label during the training process can be reduced, the accuracy of the neural network model finally trained can be improved, and the workload of manual label calibration can be reduced.

[0048] The following embodiment describes the process of determining the target category label corresponding to the training image through similarity.

[0049] In some embodiments, the step 108 of “determining the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix” may include the following steps: Calculating a first similarity between the second feature matrix and the target first feature matrix; If the first similarity is within the first threshold range, the probability corresponding to the original category label of the training image in the label vector is set to 1 and the probability corresponding to other category labels is set to 0, so as to obtain the target category label corresponding to the training image; the other category labels are category labels other than the original category labels of the training image in the total categories; If the first similarity exceeds the first threshold range, the second similarity between the second feature matrix and other first feature matrices in the multiple first feature matrices is calculated, and the target category label corresponding to the training image is determined based on the second similarity and the second threshold range; the above-mentioned other first feature matrices are the remaining first feature matrices in the multiple first feature matrices except the target first feature matrix; wherein the similarity corresponding to the first threshold range is greater than the similarity corresponding to the second threshold range.

[0050] Among them, this embodiment proposes to use a label vector to represent the target category label of the training image, and the label vector includes the probabilities corresponding to various category labels in the total category. Assuming that the total categories are: 1, 2, 3, ..., N, the label vector of the target category label of a training image can be expressed as [prob1, prob2, prob3, ..., probN], which can include the probability prob corresponding to each category label, for example, prob1 refers to the probability corresponding to category label 1, and probN refers to the probability corresponding to category label N. The range of prob is 0~1. By default, the probability of a certain category label in the label vector corresponding to the category label is 1, and the other probabilities are all 0, and the sum of the probabilities corresponding to all category labels of each original category label is 1, that is, prob1+prob2+prob3+...+probN=1. For example, assuming that the original category label of a training image is category label 1 and its calibration is correct, the label vector corresponding to the target category label of the training image is [1, 0, 0, ..., 0], that is, the probability of category label 1 corresponding to the training image is 1, and the probabilities of other category labels are all 0.

[0051] Based on the above description, for each training image, after obtaining the similarity between the second feature matrix of the training image and the target first feature matrix corresponding to its original category label, the similarity can represent the feature similarity between the training image and a group of training images corresponding to its original category label. The larger the similarity value, the more similar the training image is to the group of training images corresponding to its original category label.

[0052] Based on this, multiple threshold ranges for similarity can be pre-set here, for example, a first threshold range and a second threshold range can be set, and the similarity corresponding to the first threshold range is greater than the similarity corresponding to the second threshold range, for example, the first threshold range is [0.8, 1], and the second threshold range is [0.5, 0.8).

[0053] Then for each training image, we can first calculate the similarity between the second feature matrix of the training image and the first feature matrix of the target, which is recorded as the first similarity. Then we can determine whether the first similarity falls within the first threshold range. If the first similarity of the training image falls within the first threshold range, it means that the training image and a group of training images corresponding to its original category label are relatively similar. It also means that the original category label corresponding to the training image is correctly calibrated. At this time, in the label vector corresponding to the target category label of the training image, the probability corresponding to the original category label can be set to 1 and the probabilities corresponding to other category labels can be set to 0. The label vector finally obtained can be used as the target category label corresponding to the training image.

[0054] If the first similarity of the training image does not fall within the first threshold range, that is, exceeds the first threshold range, then it means that the training image and a group of training images corresponding to its original category label may not be very similar. At this time, the remaining first feature matrices except the target feature matrix can be obtained from multiple first feature matrices, recorded as other first feature matrices, and then the similarity between the training image and other first feature matrices is calculated, all recorded as second similarities. Then it can be determined whether each second similarity of the training image falls within the second threshold range. If a second similarity falls within the second threshold range, it means that the real category label of the training image may be its original category label, or it may be the category label corresponding to the second similarity that falls within the second threshold range. At this time, in order to facilitate the training model, the probability corresponding to the original category label of the training image can be set to 1-r in the label vector, the probability of the category label corresponding to the second similarity that falls within the second threshold range is set to r, and the probabilities of the other remaining category labels are all set to 0. The label vector finally obtained can be used as the target category label corresponding to the training image. Among them, the size of r can be set according to the actual situation, such as 0.3, 0.4, etc.

[0055] Furthermore, if the first similarity of the training image does not fall within the first threshold range, and all the second similarities of the training image do not fall within the second threshold range, that is, the first similarity of the training image exceeds the first threshold range and all the second similarities exceed the second threshold range, then it is determined that the original category label of the training image is wrong. At this time, in order to avoid the training image affecting the model training accuracy during training, the training image and its original category label can be eliminated and not participate in the subsequent first neural network model training; or the original category label of the training image can be manually reviewed and calibrated for the second time, and the calibrated label can repeat the above steps to calculate the similarity and perform similarity matching to determine the target category label. In this way, only the labels of some training images need to be reviewed for the second time, which can greatly reduce the workload of manual calibration.

[0056] In this embodiment, when the similarity between the features predicted by the training image and the features of a group of training images corresponding to its original category labels falls into different similarity threshold ranges, the probability / weight of its original category label is readjusted, thereby further weakening the dependence of the model training on the original category label, and further improving the accuracy of the final trained model.

[0057] Furthermore, in another embodiment, the process of determining the target category label of the training image and training the first neural network model when the target category label is not represented by a label vector is described.

[0058] After obtaining the similarity between the second feature matrix of a training image and the target first feature matrix, the similarity can also be compared with a preset similarity threshold. If the similarity is greater than the preset similarity threshold, it means that the original category label of the training image is correctly calibrated, that is, the target category label of the training image is its original category label. Subsequently, the first neural network model can be trained jointly by the predicted category and target category label of the training image.

[0059] If the above similarity is not greater than the preset similarity threshold, it means that the original category label of the training image is incorrectly calibrated. At this time, the training image and its original category label can be directly eliminated and not participate in the subsequent training of the first neural network model; or the original category label of the training image can be manually reviewed and calibrated for the second time, and the calibrated label can be repeated to execute the above steps to calculate the similarity and determine the target category label, and then participate in the training of the first neural network model.

[0060] In addition, the size of the preset similarity threshold can be set according to actual conditions, for example, it can be 0.8, 0.85, etc.

[0061] In this embodiment, by comparing the calculated similarity with the similarity threshold, and determining whether the training image participates in the model training based on the comparison result, the process is relatively simple and intuitive, and thus the efficiency of model training can be improved; at the same time, the training images whose calculated similarity is less than the similarity threshold and their original category labels can be removed from the model training, thereby improving the accuracy of the trained model.

[0062] When actually calculating the similarity between the features predicted by a training image and the features of a group of training images corresponding to its original category label, there may be a situation where the size of the features output by the model is inconsistent with the features obtained by clustering, which ultimately affects the accuracy of model training. Based on this, this embodiment proposes a technical solution for stretching the features output by the model before calculating the similarity. The following embodiment illustrates this process.

[0063] Figure 2 FIG. 2 is a flow chart of a method for determining a label of a training image provided by an embodiment of the present invention. Figure 2 As shown, before the above step 108 of "determining the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix", the above method may further include the following steps: Step 202: Obtain the maximum value and the minimum value in the second feature matrix, and obtain the maximum value and the minimum value in the target first feature matrix.

[0064] In this step, for each training image, after obtaining the second feature matrix output by the first neural network model of the training image, assuming that the second feature matrix output by the first neural network model is of size B, C, H, W, B is the batch size, C is the number of channels, H is the model output feature height, and W is the model output feature width, then the second feature matrix may include multiple eigenvalues, and then the largest eigenvalue (recorded as the maximum value) and the smallest eigenvalue (recorded as the minimum value) can be found from the multiple eigenvalues ​​of the second feature matrix.

[0065] Step 204, performing feature stretching processing on the second feature matrix according to the maximum value and the minimum value in the second feature matrix and the maximum value and the minimum value in the target first feature matrix, and determining a second feature matrix after feature stretching; the second feature matrix after stretching has the same eigenvalue range as that of the target first feature matrix.

[0066] In this step, a new network layer (referred to as a feature conversion layer) may be added to the first neural network model to perform feature stretching processing on the feature matrix.

[0067] After obtaining the target first feature matrix corresponding to the original category label, the target first feature matrix also includes multiple eigenvalues, and then the maximum and minimum values ​​in the target first feature matrix can be obtained. Then, the second feature matrix can be stretched by using the maximum and minimum values ​​in the second feature matrix and the maximum and minimum values ​​in the target first feature matrix, and the feature conversion layer in the first neural network model to obtain the second feature matrix after feature stretching. For example, the following formula can be used for feature stretching: .

[0068] Where X' represents the second feature moment after feature stretching; X represents the second feature matrix output by the first neural network model; X max and X min Respectively represent the maximum and minimum values ​​in the second feature matrix output by the first neural network model; new max and new min They represent the maximum and minimum values ​​in the target first feature matrix respectively; argmin represents the minimum value; argmax represents the maximum value; C represents the target first feature matrix (i.e., the core feature array obtained during clustering), C i Represents the i-th eigenvalue in the first characteristic matrix of the target, ranging from 1 to n, where n is greater than 1.

[0069] After feature stretching of the second feature matrix output by the first neural network model, the eigenvalue range of the second feature matrix can be adjusted to be consistent with the eigenvalue range of the target first feature matrix. For example, the eigenvalue range of the second feature matrix is ​​0~100, and the eigenvalue range of the target first feature matrix is ​​10~20. Here, after feature stretching, the eigenvalue range of the second feature matrix can also be adjusted to 10~20, so as to facilitate the subsequent calculation of the similarity between the two.

[0070] After the feature stretching, correspondingly, the step 108 above determines the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix, including: Step 206 , determining the target category label corresponding to the training image according to the similarity between the second feature matrix after feature stretching and the target first feature matrix.

[0071] That is to say, after obtaining the second feature matrix after feature stretching, this step can directly calculate the similarity between the second feature matrix after feature stretching and the target first feature matrix, and then determine the target category label corresponding to the training image based on the similarity; or, after obtaining the second feature matrix after feature stretching, the second feature matrix after feature stretching can also be converted to low-dimensional features, such as converting the second feature matrix after feature stretching from B, C, H, W to low-dimensional features B, C*H*W, and then calculating the similarity between the low-dimensional features and the target first feature matrix, and then determining the target category label corresponding to the training image based on the similarity.

[0072] Furthermore, when calculating the similarity, in order to avoid the influence of outliers and other abnormal values ​​on the similarity, the second feature matrix that is feature stretched and converted into low-dimensional features can be processed to remove centrifugal points. As an optional embodiment, the mean and standard deviation corresponding to the second feature matrix after feature stretching can be calculated based on the second feature matrix after feature stretching; the preset maximum and minimum digits are obtained, and based on the maximum and minimum digits, the mean and standard deviation, the second feature matrix after feature stretching is removed for outliers to determine the second feature matrix after the outliers are removed; based on the similarity between the second feature matrix after the outliers are removed and the target first feature matrix, the target category label corresponding to the training image is determined.

[0073] Among them, after obtaining the second feature matrix of feature stretching and conversion into low-dimensional features, the mean of multiple eigenvalues ​​can be calculated, and the standard deviation can be calculated based on the calculated mean. At the same time, the preset minimum digit Q1 and maximum digit Q2 can be obtained (the size of Q1 and Q2 can be set according to actual conditions), and then the upper and lower boundaries of the outliers can be calculated by the following formula: .

[0074] Among them, Lower Bound represents the lower boundary, Upper Bound represents the upper boundary, α is an empirical value, such as 1.5, x represents the eigenvalue in the second feature matrix after feature stretching and conversion to low-dimensional features, and μ represents the mean. Represents standard deviation.

[0075] The eigenvalue range [Lower Bound, Upper Bound] can be obtained through the upper and lower boundaries of the eigenvalues ​​calculated above. For the eigenvalues ​​in the second feature matrix that are stretched and converted into low-dimensional features, if they exceed the eigenvalue range [Lower Bound, Upper Bound], they are removed, otherwise they are retained. This operation can obtain the second feature matrix after outliers such as outliers are removed. After that, the similarity between the second feature matrix after outliers are removed and the target first feature matrix can be calculated, and the target category label of the training image can be determined based on the calculated similarity.

[0076] The similarity can be calculated using the following formula: .

[0077] Among them, r is the calculated similarity; x i ' represents the i-th eigenvalue in the second feature matrix after outliers are removed, ranging from 1 to n, where n is greater than 1; represents the mean of the eigenvalues ​​in the second feature matrix after outliers are removed; Ci represents the i-th eigenvalue in the target first feature matrix; Represents the mean of the eigenvalues ​​in the target first eigenmatrix.

[0078] In this embodiment, the second feature matrix is ​​feature stretched by using the maximum and minimum values ​​in the second feature matrix and the target first feature matrix, so that the eigenvalues ​​are stretched to the same eigenvalue range as the target first feature matrix, that is, within a fixed space, so that it is easy to calculate the similarity between the second feature matrix and the target first feature matrix, improve the accuracy of the calculated similarity, and then improve the accuracy of the target category label of the subsequent training image. In addition, by removing outliers and other abnormal values ​​from the second feature matrix after feature stretching, the accuracy of the calculated similarity can be further improved, and the accuracy of the target category label of the subsequent training image can be further improved.

[0079] The above embodiment describes how to calculate similarity and determine the target category label of the training image by using multiple target clustering parameters of the preset clustering algorithm. The following embodiment describes the determination process of multiple target clustering parameters of the preset clustering algorithm.

[0080] Figure 3 FIG. 3 is a flow chart of a method for determining a label of a training image provided by an embodiment of the present invention. Figure 3 As shown, the above step 102 of "obtaining multiple target clustering parameters corresponding to the preset clustering algorithm" may include the following steps: Step 302: divide the multiple training images into multiple training image sets according to their original category labels; each training image set includes training images under one category label.

[0081] After initially obtaining multiple training images and the original category label corresponding to each training image, the training images with the same category label can be grouped together according to the original category label of each training image, so that the training image sets corresponding to the multiple category labels can be obtained. The multiple category labels here are the same as the total number of categories corresponding to the original category labels. For example, if the total number of categories is 3, then 3 training image sets can be obtained after classification, and each image set corresponds to a training image under a category label.

[0082] Step 304 , performing distance calculation processing on the training images in each type of training image set, and determining a plurality of target clustering parameters corresponding to a preset clustering algorithm.

[0083] In this step, after determining the preset clustering algorithm, the clustering parameters corresponding to the preset clustering algorithm can be obtained, and then the distance calculation can be performed through the training image set of multi-category labels of the above classification to determine the target values ​​of the multiple clustering parameters of the preset clustering algorithm, that is, to determine multiple target clustering parameters. For example, if the preset clustering algorithm is a density clustering algorithm, the corresponding clustering parameters may include parameters such as neighborhood radius eps, minimum sample number min_sample, and distance metric threshold metric. Among them, the neighborhood radius can determine whether the points within the radius are regarded as core points, the minimum sample number represents the minimum number of samples required to become a core point, and the distance metric threshold represents the metric threshold for calculating the distance between sample points.

[0084] In order to better illustrate how to obtain multiple target clustering parameters of a preset clustering algorithm through distance calculation, the following takes the preset clustering algorithm as an example, which is a density clustering algorithm. Optionally, the multiple target clustering parameters corresponding to the density clustering algorithm may include a target neighborhood radius, a target minimum number of samples, and a target distance measurement threshold. The calculation process of these three target clustering parameters is described below.

[0085] Optionally, the above-mentioned multiple target clustering parameters include a target neighborhood radius, and the process of calculating the target neighborhood radius may include: For each category label, the training image set corresponding to the category label is input into the second neural network model, the distance between every two training images is calculated in the second neural network model, a plurality of first distances corresponding to the training image set are obtained, and based on the plurality of first distances, the target neighborhood radius under the category label corresponding to the training image set is determined.

[0086] Among them, after the above classification, training image sets with multiple category labels can be obtained. The following is an example of a training image set with a category label. For this category label, a neural network model based on an arbitrary distance-related loss function can be pre-created, denoted as the second neural network model, and the second neural network model can be pre-trained.

[0087] Then, each training image in the training image set corresponding to the category label can be input into the second neural network model, and the distance between the two training images can be calculated in the second neural network model to obtain multiple first distances and output; or when there are too many training images in the training image set corresponding to the category label, the training images can also be input into the second neural network model in batches for pairwise distance calculation, and then the multiple distances calculated for each batch can be averaged to obtain the mean distance corresponding to each batch, so that multiple mean distances can be obtained for multiple batches, all recorded as first distances. Then, the inflection point can be found among the multiple first distance values, and the first distance corresponding to the inflection point can be used as the target neighborhood radius corresponding to the category label. The inflection point here can be the first distance where the data in the multiple first distances mutates, or it can also be the largest first distance among the multiple first distances. For example, if the multiple first distances are 0.1, 0.13, 0.10, 0.2, 0.15, and 0.11, then the inflection point is 0.2, that is, the target neighborhood radius corresponding to the category label can be 0.2.

[0088] Through the above distance calculation method, the similarity between the training data under the same category label can be reflected, so as to quickly determine the corresponding neighborhood radius.

[0089] It should be noted that each category label can obtain a corresponding target neighborhood radius. For other category labels, their corresponding target neighborhood radius can also be calculated in the above manner.

[0090] Optionally, the above-mentioned multiple target clustering parameters include a target minimum sample number, and the process of calculating the target minimum sample number may include: For each category label, the training images in the training image set corresponding to the category label are input into the third neural network model in different batches for distance calculation, and the model evaluation indicators corresponding to different batches are determined. According to the model evaluation indicators of different batches, the target batch is determined in different batches, and the number of training images corresponding to the target batch is used as the target minimum number of samples under the category label corresponding to the training image set.

[0091] Among them, for a certain category label, another neural network model based on an arbitrary distance-related loss function can be created in advance, recorded as a third neural network model, and the third neural network model can be pre-trained.

[0092] Then, the training images in the training image set corresponding to the category label can be input into the third neural network model in different batches for distance calculation to obtain the distances corresponding to the training images in different batches, and then the model evaluation index corresponding to the training images in the corresponding batch is calculated after a certain number of iterations through each different batch of training images. The model evaluation index here is not limited to loss function, distance measurement function, accuracy and other indicators. It can be understood that the model evaluation index of different batches of training images is represented by the same index, which can facilitate comparison with each other. The above-mentioned different batches of training images refer to the different numbers of training images input into the third neural network model in each batch, for example, from 1 to N, where N is the total number of training images in the training image set corresponding to the category label, and N is greater than 1.

[0093] Afterwards, the model evaluation indicators of different batches of training images can be compared, and a batch with the best model evaluation indicator (i.e., the best convergence) can be selected as the target batch, and the number of input training images corresponding to the target batch can be used as the target minimum number of samples corresponding to the category label.

[0094] It should be noted that each category label can obtain a corresponding target minimum number of samples. For other category labels, their corresponding target minimum number of samples can also be calculated in the above manner.

[0095] Optionally, the above-mentioned multiple target clustering parameters include a target distance measurement threshold, and the process of calculating the target distance measurement threshold may include the following steps: For each category label, calculate the distance between each training image in the training image set corresponding to the category label and its original category label to obtain multiple second distances; Eliminate second distances with relatively large differences among the plurality of second distances, and select a plurality of candidate second distances with the most digits ranked top among the eliminated second distances; An average value corresponding to multiple candidate second distances is calculated, a target second distance is determined from the multiple candidate second distances according to the average value, and the target second distance is determined as a target distance measurement threshold under a category label corresponding to the training image set.

[0096] Among them, for a certain category label, the distance between the data of each training image in the training image set corresponding to the category label and the data corresponding to its original category label can be calculated to obtain the distance calculated for each training image, which is recorded as the second distance. The calculation formula of the second distance is as follows: .

[0097] Among them, l represents the training image data itself, p represents the data corresponding to the original category label, S represents the covariance matrix, T represents the transpose, and d(l,p) represents the second distance of each training image.

[0098] After obtaining multiple second distances, the multiple second distances can be sorted in ascending order, and one or more second distances ranked at the top in the sorting result (such as the first two second distances in the sorting result) and one or more distances ranked at the bottom (such as the last two second distances in the sorting result) are eliminated, that is, the second distances with large differences among the multiple second distances are eliminated. Then, multiple (such as three or other numbers) second distances ranked at the top in the majority digit can be selected from the remaining multiple second distances, and all are recorded as candidate second distances. Here, the majority digit selection refers to selecting several second distances with a large number of occurrences from multiple second distances.

[0099] Then, the mean of the multiple candidate second distances can be calculated to obtain the average value, and a candidate second distance closest to the average value is selected from the multiple candidate second distances as the target distance measurement threshold corresponding to the final category label.

[0100] It should be noted that each category label can obtain a corresponding target distance measurement threshold, and for other category labels, their corresponding target distance measurement thresholds can also be calculated in the above manner.

[0101] In addition, after obtaining the above three target clustering parameters, a preset clustering algorithm may be used to cluster the multiple training images to obtain multiple first feature matrices.

[0102] Furthermore, although the above is an explanation of the process of calculating the target clustering parameters for the density clustering algorithm, for clustering parameters of other clustering algorithms, a suitable method may be selected in this manner to calculate and determine the target clustering parameters.

[0103] In this embodiment, after a plurality of training images are classified according to their original category labels, distance calculation is performed on the training image sets under each category label to determine the target clustering parameters corresponding to each category label before clustering. Compared with the prior art in which clustering is performed by determining clustering parameters based on empirical values ​​or random values, the present application determines clustering parameters based on the training images and the original category label information, which can improve the reliability of subsequent clustering results, and further improve the reliability of the target category labels of the training images that are finally determined. In addition, each clustering parameter in the preset clustering algorithm can be calculated according to different methods, which can improve the accuracy of the determined target clustering parameters, further improve the reliability of subsequent clustering results and the reliability of the target category labels of the training images that are finally determined.

[0104] The following is a description of a label determination device for a training image provided by the present invention. The label determination device for a training image described below and the label determination method for a training image described above can correspond to each other.

[0105] Figure 4 is a schematic diagram of the structure of the apparatus for determining the label of a training image provided by an embodiment of the present invention, see Figure 4 As shown, the device may include: The acquisition module 410 is used to acquire a plurality of pre-labeled training images and to acquire a plurality of target clustering parameters corresponding to a preset clustering algorithm; each training image includes its own corresponding original category label, and the plurality of target clustering parameters are pre-determined based on the plurality of training images and the original category label of each training image; A clustering module 420 is used to cluster the multiple training images according to the total number of categories corresponding to the original category labels and each target clustering parameter, and determine multiple first feature matrices corresponding to the multiple training images; the number of the multiple first feature matrices is the same as the total number of categories, and each first feature matrix corresponds to the features of the training image under a category label; The model processing module 430 is used to input each training image into the first neural network model for classification processing, and determine the second feature matrix corresponding to each training image; The target label determination module 440 is used to obtain, for each training image, a target first feature matrix corresponding to the original category label of the training image from multiple first feature matrices, and determine the target category label corresponding to the training image based on the similarity between the second feature matrix and the target first feature matrix; the target category label is used to train the first neural network model.

[0106] In some embodiments, the target category label is represented by a label vector, which includes the probabilities corresponding to various category labels in the total category. The target label determination module 440 is specifically used to set the probability corresponding to the original category label of the training image in the label vector to 1 and the probability corresponding to other category labels to 0 if the similarity between the second feature matrix and the target first feature matrix is ​​within a first threshold range, so as to obtain the target category label corresponding to the training image; the other category labels are category labels other than the original category labels of the training image in the total category; if the similarity between the second feature matrix and the target first feature matrix is ​​within a second threshold range, the probability corresponding to the original category label of the training image in the label vector is set to the first probability and the probability corresponding to the predicted category corresponding to the training image is set to the second probability, so as to obtain the target category label corresponding to the training image; the sum of the first probability and the second probability is 1; wherein the similarity corresponding to the first threshold range is greater than the similarity corresponding to the second threshold range.

[0107] Optionally, before the target label determination module 440 determines the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix, the apparatus further includes: A feature stretching module is used to obtain the maximum value and the minimum value in the second feature matrix, and to obtain the maximum value and the minimum value in the target first feature matrix; according to the maximum value and the minimum value in the second feature matrix, and the maximum value and the minimum value in the target first feature matrix, the second feature matrix is ​​subjected to feature stretching processing to determine the second feature matrix after feature stretching; the second feature matrix after the stretching has the same feature value range as that of the target first feature matrix; Accordingly, the target label determination module 440 is specifically configured to determine the target category label corresponding to the training image according to the similarity between the second feature matrix after feature stretching and the target first feature matrix.

[0108] Optionally, the above-mentioned target label determination module 440 is specifically used to calculate the mean and standard deviation corresponding to the second feature matrix after feature stretching according to the second feature matrix after feature stretching; obtain the preset maximum number of digits and minimum number of digits, and according to the maximum number of digits, the minimum number of digits, the mean and the standard deviation, perform outlier removal on the second feature matrix after feature stretching to determine the second feature matrix after outlier removal; determine the target category label corresponding to the training image according to the similarity between the second feature matrix after outlier removal and the target first feature matrix.

[0109] In some embodiments, the acquisition module 410 includes: A classification unit, used for classifying a plurality of training images into a plurality of training image sets according to their respective original category labels; each training image set includes training images under a category label; The clustering parameter determination unit is used to perform distance calculation processing on the training images in each type of training image set respectively, and determine multiple target clustering parameters corresponding to the preset clustering algorithm.

[0110] Optionally, the above-mentioned multiple target clustering parameters include a target neighborhood radius and a target minimum sample number, and the above-mentioned clustering parameter determination unit is specifically used to input the training image set corresponding to the category label into the second neural network model for each category label, calculate the distance between every two training images in the second neural network model, obtain multiple first distances corresponding to the training image set, and determine the target neighborhood radius under the category label corresponding to the training image set according to the multiple first distances; For each category label, the training images in the training image set corresponding to the category label are input into the third neural network model in different batches for distance calculation, and the model evaluation indicators corresponding to different batches are determined. According to the model evaluation indicators of different batches, the target batch is determined in different batches, and the number of training images corresponding to the target batch is used as the target minimum number of samples under the category label corresponding to the training image set.

[0111] Optionally, the above-mentioned multiple target clustering parameters include a target distance measurement threshold, and the above-mentioned clustering parameter determination unit is specifically used to calculate, for each category label, the distance between each training image in the training image set corresponding to the category label and its own original category label to obtain multiple second distances; eliminate second distances with large differences among the multiple second distances, and select multiple candidate second distances with top most digit rankings from the eliminated second distances; calculate the average value corresponding to the multiple candidate second distances, determine the target second distance from the multiple candidate second distances according to the average value, and determine the target second distance as the target distance measurement threshold under the category label corresponding to the training image set.

[0112] It should be noted here that the above-mentioned device provided in the embodiment of the present invention can implement all the method steps implemented in the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as the method embodiment in this embodiment will not be described in detail here.

[0113] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention is shown in FIG. Figure 5As shown, the electronic device may include: a processor (processor) 510, a communication interface (Communications Interface) 520, a memory (memory) 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call the logic instructions in the memory 530 to execute the label determination method of the training image, which includes: obtaining multiple pre-labeled training images and obtaining multiple target clustering parameters corresponding to a preset clustering algorithm; each training image includes its own corresponding original category label, and the above-mentioned multiple target clustering parameters are pre-determined according to multiple training images and the original category label of each training image; clustering the multiple training images according to the total number of categories corresponding to the original category label and each target clustering parameter, and determining multiple first feature matrices corresponding to the multiple training images; the number of the above-mentioned multiple first feature matrices is the same as the total number of categories, and each first feature matrix corresponds to the characteristics of the training image under a category label; inputting each training image into the first neural network model for classification processing, and determining the second feature matrix corresponding to each training image; for each training image, obtaining the target first feature matrix corresponding to the original category label of the training image from the multiple first feature matrices, and determining the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix; the target category label is used to train the first neural network model.

[0114] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0115] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the label determination method of the training image provided by the above methods, the method including: obtaining multiple pre-labeled training images and obtaining multiple target clustering parameters corresponding to a preset clustering algorithm; each training image includes its own corresponding original category label, and the above multiple target clustering parameters are pre-determined according to multiple training images and the original category label of each training image; clustering the multiple training images according to the total number of categories corresponding to the original category label and each target clustering parameter, and determining multiple first feature matrices corresponding to the multiple training images; the number of the above multiple first feature matrices is the same as the total number of categories, and each first feature matrix corresponds to the features of the training image under a category label; inputting each training image into the first neural network model for classification processing, and determining the second feature matrix corresponding to each training image; for each training image, obtaining the target first feature matrix corresponding to the original category label of the training image from the multiple first feature matrices, and determining the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix; the target category label is used to train the first neural network model.

[0116] On the other hand, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the label determination method for training images provided by the above-mentioned methods, the method comprising: obtaining a plurality of pre-labeled training images and obtaining a plurality of target clustering parameters corresponding to a preset clustering algorithm; each training image includes its own corresponding original category label, and the plurality of target clustering parameters are pre-determined based on a plurality of training images and the original category label of each training image; clustering the plurality of training images according to the total number of categories corresponding to the original category label and the target clustering parameters, and determining a plurality of first feature matrices corresponding to the plurality of training images; the number of the plurality of first feature matrices is the same as the total number of categories, and each first feature matrix corresponds to the features of the training image under a category label; inputting each training image into the first neural network model for classification processing, and determining a second feature matrix corresponding to each training image; for each training image, obtaining a target first feature matrix corresponding to the original category label of the training image from the plurality of first feature matrices, and determining a target category label corresponding to the training image based on the similarity between the second feature matrix and the target first feature matrix; the target category label is used to train the first neural network model.

[0117] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0118] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for determining labels of training images, characterized in that: include: Acquire a plurality of pre-labeled training images and obtain a plurality of target clustering parameters corresponding to a preset clustering algorithm; Each of the training images includes its own corresponding original category label, and the plurality of target clustering parameters are determined in advance according to the plurality of training images and the original category label of each of the training images; Clustering the plurality of training images according to the total number of categories corresponding to the original category labels and the target clustering parameters, and determining a plurality of first feature matrices corresponding to the plurality of training images; the number of the plurality of first feature matrices is the same as the total number of categories, and each first feature matrix corresponds to a feature of a training image under a category label; Input each of the training images into the first neural network model for classification processing, and determine a second feature matrix corresponding to each of the training images; For each of the training images, a target first feature matrix corresponding to the original category label of the training image is obtained from the multiple first feature matrices, and a target category label corresponding to the training image is determined based on the similarity between the second feature matrix and the target first feature matrix; the target category label is used to train the first neural network model.

2. The method for determining labels of training images according to claim 1, characterized in that: The target category label of the training image is represented by a label vector, and the label vector includes the probabilities corresponding to various category labels in the total category. The determining the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix includes: Calculating a first similarity between the second feature matrix and the target first feature matrix; If the first similarity is within a first threshold range, the probability corresponding to the original category label of the training image in the label vector is set to 1 and the probability corresponding to other category labels is set to 0, so as to obtain the target category label corresponding to the training image; the other category label is the other category label in the total category except the original category label of the training image; If the first similarity exceeds the first threshold range, calculating the second similarity between the second feature matrix and other first feature matrices in the plurality of first feature matrices, and determining the target category label corresponding to the training image according to the second similarity and the second threshold range; the other first feature matrices are the remaining first feature matrices in the plurality of first feature matrices except the target first feature matrix; The similarity corresponding to the first threshold range is greater than the similarity corresponding to the second threshold range.

3. The method for determining labels of training images according to claim 1, characterized in that: Before determining the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix, the method further includes: Obtaining the maximum value and the minimum value in the second feature matrix, and obtaining the maximum value and the minimum value in the target first feature matrix; According to the maximum value and the minimum value in the second feature matrix and the maximum value and the minimum value in the target first feature matrix, the second feature matrix is ​​subjected to feature stretching processing to determine a second feature matrix after feature stretching; the second feature matrix after stretching has the same feature value range as that corresponding to the target first feature matrix; Accordingly, determining the target category label corresponding to the training image according to the similarity between the second feature matrix and the target first feature matrix includes: The target category label corresponding to the training image is determined according to the similarity between the second feature matrix after feature stretching and the target first feature matrix.

4. The method for determining labels of training images according to claim 3, characterized in that: The step of determining the target category label corresponding to the training image according to the similarity between the second feature matrix after feature stretching and the target first feature matrix includes: According to the second feature matrix after feature stretching, calculating the mean and standard deviation corresponding to the second feature matrix after feature stretching; Obtaining a preset maximum number of digits and a minimum number of digits, and removing outliers from the second feature matrix after feature stretching according to the maximum number of digits, the minimum number of digits, the mean, and the standard deviation, to determine the second feature matrix after the outliers are removed; The target category label corresponding to the training image is determined according to the similarity between the second feature matrix after the outliers are removed and the target first feature matrix.

5. The method for determining labels of training images according to any one of claims 1 to 4, characterized in that: The obtaining of a plurality of target clustering parameters corresponding to a preset clustering algorithm includes: Dividing the plurality of training images into multiple types of training image sets according to their respective original category labels; each type of training image set includes training images under one category label; Distance calculation processing is performed on each type of training images in the training image set to determine multiple target clustering parameters corresponding to the preset clustering algorithm.

6. The method for determining labels of training images according to claim 5, characterized in that: The multiple target clustering parameters include a target neighborhood radius and a target minimum sample number. The distance calculation process is performed on each type of training images in the training image set to determine the multiple target clustering parameters corresponding to the preset clustering algorithm, including: For each category label, a training image set corresponding to the category label is input into a second neural network model, a distance between every two training images is calculated in the second neural network model, a plurality of first distances corresponding to the training image set are obtained, and a target neighborhood radius under the category label corresponding to the training image set is determined according to the plurality of first distances; For each category label, the training images in the training image set corresponding to the category label are input into the third neural network model in different batches for distance calculation, and the model evaluation indicators corresponding to the different batches are determined. According to the model evaluation indicators of the different batches, the target batch is determined among the different batches, and the number of training images corresponding to the target batch is used as the target minimum number of samples under the category label corresponding to the training image set.

7. The method for determining labels of training images according to claim 5, characterized in that: The multiple target clustering parameters include a target distance measurement threshold, and the distance calculation process is performed on each type of training images in the training image set to determine the multiple target clustering parameters corresponding to the preset clustering algorithm, including: For each category label, calculate the distance between each training image in the training image set corresponding to the category label and its original category label to obtain multiple second distances; Eliminate second distances with relatively large differences among the plurality of second distances, and select a plurality of candidate second distances with the most-complex digits ranked top among the eliminated second distances; An average value corresponding to the multiple candidate second distances is calculated, a target second distance is determined from the multiple candidate second distances according to the average value, and the target second distance is determined as a target distance measurement threshold under the category label corresponding to the training image set.

8. A device for determining labels of training images, characterized in that: include: An acquisition module, used to acquire a plurality of pre-labeled training images and to acquire a plurality of target clustering parameters corresponding to a preset clustering algorithm; Each of the training images includes its own corresponding original category label, and the plurality of target clustering parameters are determined in advance according to the plurality of training images and the original category label of each of the training images; A clustering module, used for clustering the plurality of training images according to the total number of categories corresponding to the original category labels and each of the target clustering parameters, and determining a plurality of first feature matrices corresponding to the plurality of training images; the number of the plurality of first feature matrices is the same as the total number of categories, and each first feature matrix corresponds to a feature of a training image under a category label; A model processing module, used for inputting each of the training images into the first neural network model for classification processing, and determining a second feature matrix corresponding to each of the training images; A target label determination module is used to obtain, for each of the training images, a target first feature matrix corresponding to the original category label of the training image from the multiple first feature matrices, and determine the target category label corresponding to the training image based on the similarity between the second feature matrix and the target first feature matrix; the target category label is used to train the first neural network model.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the method for determining a label of a training image according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for determining a label of a training image according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Neural network-based automatic image annotation method, system, device and medium

    CN110490236A

  • Image classification and neural network training method and device, equipment and storage medium

    CN111259967A

  • Sample labeling method and device, computer equipment and storage medium

    CN112749723A

  • Model training method and device, storage medium and program product

    CN116266391A

  • Dual-angle marketing activity effect prediction method, medium and system

    CN117593044A