Model training methods, devices, computer equipment, and storage media

By calculating the loss value of candidate labels with high probability but no labeling in the multi-label classification model as positive sample data, the loss of negative samples is automatically corrected, which solves the problems of insufficient model accuracy and low training efficiency caused by incomplete dataset labeling, and achieves more efficient model training and recognition.

CN114612728BActive Publication Date: 2025-12-02GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210307724.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-25
Publication Date
2025-12-02
Estimated Expiration
2042-03-25

AI Technical Summary

Technical Problem

Multi-label classification models suffer from insufficient accuracy during training due to incomplete dataset labeling, and existing pseudo-labeling methods may lead to overfitting and low training efficiency.

Method used

By acquiring the training sample set, calculating the probability of candidate labels corresponding to each sample data, identifying unlabeled but high-probability candidate labels for target sample data as positive sample data, automatically calculating the loss value, iteratively training the model, and correcting the loss of negative samples.

Benefits of technology

It improves the accuracy and efficiency of model training, reduces training overhead, avoids errors caused by incomplete labeling, and enhances recognition capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114612728B_ABST
    Figure CN114612728B_ABST
Patent Text Reader

Abstract

This application discloses a model training method, apparatus, computer device, and storage medium. The method includes: acquiring a training sample set, which includes multiple sample data; inputting each sample data in the training sample set into an initial recognition model to obtain the label probability of each candidate label corresponding to each sample data; using target sample data in the training sample set as positive sample data for target candidate labels, and determining a total loss value based on the label probability of each candidate label corresponding to each sample data in the training sample set and the label labeled for each sample data, wherein the target sample data is not labeled with a target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than a preset probability; and iteratively training the initial recognition model according to the total loss value to obtain a trained recognition model. This method can improve the efficiency and accuracy of model training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and more specifically, to a model training method, apparatus, computer device, and storage medium. Background Technology

[0002] With the rapid development of technology, multi-label classification has attracted great research interest and has been deployed in many applications, intelligently solving many problems in daily life. Multi-label classification first requires identifying the categories to be classified, then manually labeling the dataset with the categories present in the sample data, and finally using the labeled dataset to train the model. However, obtaining a complete multi-label dataset is extremely costly because when the number of categories is too large, the dataset labeling is often incomplete, leading to insufficient accuracy of the trained model. Summary of the Invention

[0003] This application proposes a model training method, apparatus, computer equipment, and storage medium that can automatically correct the loss caused by negative samples during model training, thereby improving the efficiency and accuracy of model training.

[0004] In a first aspect, embodiments of this application provide a model training method, the method comprising: acquiring a training sample set, the training sample set including multiple sample data, the training sample set including label probabilities of multiple sample data labels; inputting each sample data in the training sample set into an initial recognition model to obtain the label probability of each candidate label corresponding to each sample data; using target sample data in the training sample set as positive sample data for target candidate labels, and determining a total loss value based on the label probability of each candidate label corresponding to each sample data in the training sample set and the label labeled on each sample data, wherein the target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than a preset probability; and iteratively training the initial recognition model according to the total loss value to obtain a trained recognition model.

[0005] Secondly, embodiments of this application provide a model training apparatus, comprising: a sample acquisition module, a model input module, a loss determination module, and an iterative training module. The sample acquisition module acquires a training sample set, which includes multiple sample data sets. The model input module inputs each sample data set from the training sample set into an initial recognition model to obtain the label probability of each candidate label corresponding to each sample data set. The multiple sample data sets include at least one negative sample data set corresponding to a candidate label. The loss determination module uses target sample data from the training sample set as positive sample data set corresponding to target candidate labels, and determines a total loss value based on the label probability of each candidate label corresponding to each sample data set and the label corresponding to each sample data set. The target sample data set is not labeled with the target candidate label, and the label probability of the target sample data set corresponding to the target candidate label is greater than a preset probability. The iterative training module iteratively trains the initial recognition model according to the total loss value to obtain a trained recognition model.

[0006] Thirdly, embodiments of this application provide a computer device, including: one or more processors; a memory; and one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more application programs are configured to perform the model training method provided in the first aspect above.

[0007] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code, which can be called by a processor to execute the model training method provided in the first aspect above.

[0008] The solution provided in this application obtains a training sample set, inputs each sample data in the training sample set into an initial recognition model, and obtains the label probability of each candidate label corresponding to each sample data. Then, the target sample data in the training sample set is used as the positive sample data of the target candidate label. Based on the label probability of each candidate label corresponding to each sample data in the training sample set and the label labeled for each sample data, a total loss value is determined. The target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than a preset probability. Then, the initial recognition model is iteratively trained according to the total loss value to obtain the trained recognition model. Thus, in the model training process, for incompletely labeled negative sample data, the loss can be automatically calculated as positive samples, realizing automatic correction of the loss caused by negative samples, thereby improving the efficiency and accuracy of model training. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 A flowchart of a model training method according to an embodiment of this application is shown.

[0011] Figure 2 A schematic diagram illustrating the principle of the model training method provided in the embodiments of this application is shown.

[0012] Figure 3 A flowchart of a model training method according to another embodiment of this application is shown.

[0013] Figure 4 A flowchart of a model training method according to yet another embodiment of this application is shown.

[0014] Figure 5 A block diagram of a model training apparatus according to an embodiment of this application is shown.

[0015] Figure 6 This is a block diagram of a computer device for performing a model training method according to an embodiment of this application.

[0016] Figure 7 This is a storage unit in this application embodiment for storing or carrying program code that implements the model training method according to this application embodiment. Detailed Implementation

[0017] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.

[0018] In nature, images often contain different objects, scenes, relationships, etc. Compared to single-label classification, where an image has only one category, multi-label classification identifies all necessary categories of objects, scenes, etc., within an image, making it more suitable for the distribution of images in nature and people's usage habits. Multi-label image classification first requires determining the categories to be classified, then manually labeling the dataset with the categories present in the images, and finally using the labeled dataset to train the model. Obtaining a complete multi-label dataset is extremely costly because when the number of categories is too large, the labeling of the dataset is often incomplete due to biases and oversights during manual labeling.

[0019] Therefore, training multi-label classification with incomplete datasets is common practice in this field, and such "dirty" datasets severely impact the recognition accuracy of multi-label classification models. Related techniques typically use pseudolabels to correct labels and improve the accuracy of the trained model. In this method, a model is first trained using a dataset with missing labels, then this trained model is used to add the missing labels to the remaining dataset, and the model's predictions are checked to see if they exceed a set threshold. Finally, the model is trained again using the relabeled dataset. However, using an incompletely labeled dataset (i.e., noisy data) to train a later-stage model for pseudolabeling greatly increases the likelihood of the model overfitting the noisy data, resulting in generally low pseudolabel accuracy. Furthermore, the training process requires training the labeled model first, then the new model, necessitating multiple training iterations, which impacts training efficiency and incurs additional training overhead.

[0020] To address the aforementioned problems, the inventors have proposed a model training method, apparatus, computer device, and storage medium as provided in the embodiments of this application. These methods enable automatic calculation of loss based on positive samples for incompletely labeled negative sample data during model training, thereby automatically correcting the loss caused by negative samples and improving the efficiency and accuracy of model training. The specific training method for the recognition model will be described in detail in subsequent embodiments.

[0021] The model training method provided in the embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0022] Please see Figure 1 , Figure 1 A flowchart illustrating a model training method according to an embodiment of this application is shown. In a specific embodiment, the model training method is applied to, for example... Figure 5 The model training device 400 and the computer device 100 configured with the model training device 400 are shown. Figure 6 The following will use a computer device as an example to illustrate the specific process of this embodiment. Of course, it is understood that the computer device used in this embodiment can be a server, smartphone, tablet computer, smartwatch, e-reader, PC, laptop computer, etc., and is not limited thereto. The following will focus on... Figure 1 The process shown will be explained in detail. The model training method may specifically include the following steps:

[0023] Step S110: Obtain a training sample set, which includes multiple sample data, including negative sample data corresponding to at least one candidate label.

[0024] The training sample set can contain image, audio, or other types of data. Optionally, when the demand recognition model identifies multiple candidate labels (i.e., categories to be identified) in an image, such as whether there are candidate labels like people, trees, sky, pigs, and sheep, the sample data can be sample images, which can come from datasets like COCO Dataest or IMAGECLEF. Optionally, when the demand audio data contains different categories of sounds, such as whether there are multiple candidate labels like human voices, car sounds, airplane sounds, and broadcast sounds, the sample data can be audio data, which can be obtained from a server or collected from different user terminals; the specific acquisition method is not limited.

[0025] In this embodiment, the training sample set may include negative sample data corresponding to at least one candidate label. Optionally, the training sample set includes multiple positive first sample data and multiple negative second sample data, wherein the first positive sample data is labeled with all candidate labels that exist, and the second negative sample data is not labeled with candidate labels that do not exist, or is not labeled with at least one candidate label among the candidate labels that exist. It is understood that in recognition scenarios that require identifying multiple candidate labels, the cost of obtaining a complete multi-label dataset is extremely high, because when there are too many types of labels, the labeling of the dataset is often incomplete due to biases and omissions during manual labeling. Therefore, the training sample set may include fully labeled first sample data. In addition, some sample data may not contain candidate labels, or may contain candidate labels but have not been labeled, i.e., second sample data.

[0026] In the training sample set, for any candidate label, if the sample data is not labeled with that candidate label, then the sample data is considered negative sample data for that candidate label; if the sample data is labeled with that candidate label, then the sample data is considered positive sample data for that candidate label. It is understandable that negative sample data may be sample data from the second sample data set that does not inherently contain candidate labels, or it may be sample data that was missed due to bias or oversight during manual labeling. Missedly labeled sample data can also be considered false negative sample data.

[0027] In some implementations, the sample data may include both positive and negative sample data containing each candidate label, to ensure that the subsequently trained recognition model can accurately identify whether each candidate label exists in the input data. Specifically, for the same sample data, there may be multiple candidate labels, thus it may be labeled with multiple candidate labels, or there may be only one candidate label, thus it may be labeled with only one candidate label.

[0028] In this embodiment, the number of candidate labels is not limited. For example, in a scenario where multiple candidate labels exist in the demand recognition image, the multiple candidate labels can include candidate labels that exist in the image recognized by the demand recognition model. The number of candidate labels can be set according to actual needs. For example, if there are five categories—cat, dog, pig, sheep, and cow—in the demand recognition image, then the multiple candidate labels include cat, dog, pig, sheep, and cow.

[0029] In some implementations, the sample data can also be preprocessed. Optionally, when the sample data consists of sample images, the sample images can be scaled up or down. The images used for model training can be the same size, for example, all images can be adjusted to 224*224. Setting the size to 224*224, instead of other sizes, is a choice made after balancing model size, running speed, and performance. Generally, a larger scale results in better classification performance, but correspondingly, the model size and running speed will increase. The specific scale can be selected according to actual needs.

[0030] In addition, normalizing the pixel values ​​of the sample images to [0,1] can eliminate the influence of the absolute size of the pixel values ​​on classification performance. For example, some images are clearer and have larger pixel values, while some images are blurrier and have smaller pixel values. Normalization will reduce the influence of the size of the pixel values ​​of the image itself on the recognition performance, enabling the model to learn more layered texture structure and other feature information of the image itself. It can also speed up the training and convergence of the model.

[0031] Optionally, when the sample images are audio sample data, the audio sample data can be converted into a unified data type to meet the model's input requirements. For example, if the model requires the input of the audio sample data as a spectrogram, the audio sample data can be converted into its corresponding spectrogram. Of course, the specific preprocessing method can be selected according to the specific sample data type, which will not be described in detail here.

[0032] Step S120: Input each sample data in the training sample set into the initial recognition model to obtain the label probability of each candidate label corresponding to each sample data.

[0033] In this embodiment of the application, after obtaining the training sample set, each sample data can be input into the initial recognition model to obtain the label probability of each candidate label corresponding to each sample data output by the initial recognition model. The label probability of each candidate label is used to characterize the possibility that the candidate label exists in the sample data. For example, if the candidate label is sky and the sample data is an image, then the label probability of sky is used to characterize the possibility that sky exists in the image.

[0034] In some implementations, an initial recognition model can be pre-built. This initial recognition model may include a feature extraction module and a classification module. The feature extraction module extracts features from the input data and then feeds them into the classification module. The classification module then outputs the label probability corresponding to each candidate label based on the input features.

[0035] In one possible implementation, the feature extraction module can be a pre-trained neural network. For example, the neural network can be a Visual Graphics Generator (VGG) model, a Deep Residual Network (ResNet) model, MobileNetV2, or other models used for feature extraction. Optionally, the neural network can be a convolutional neural network (e.g., VGG19) pre-trained in ImageNet. Since pre-trained convolutional neural networks in ImageNet already have strong feature extraction capabilities, retraining is unnecessary; the features can be extracted based on the pre-trained convolutional neural network in ImageNet. Optionally, the neural network can also be MobileNetV2, which can effectively save storage space in electronic devices and improve their operating efficiency.

[0036] In one possible implementation, the classification module can be a Softmax logical regression model, or a Support Vector Machine (SVM), etc., and the specific classification module is not limited.

[0037] Alternatively, assume there are k candidate labels in total, x∈R k The output of the model is the i-th element x. i Predict the probability of the i-th candidate label. Normalize each x using the Sigmoid function. i Obtain the label probability p i That is, the probability that the i-th label exists in the data input to the model, p i The larger the value, the greater the probability that the i-th label exists in the input data; conversely, the smaller the value, the less likely that the i-th label exists in the input data.

[0038] Step S130: Take the target sample data in the training sample set as the positive sample data of the target candidate label, and determine the total loss value based on the label probability of each candidate label corresponding to each sample data in the training sample set and the label labeled by each sample data, wherein the target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than the preset probability.

[0039] After obtaining the output of the initial recognition model, the total loss value of the initial recognition model can be determined based on the output of the initial recognition model and the labels of each sample data, so that the initial recognition model can be updated according to the total loss value. In this embodiment of the application, when determining the total loss value, since there are unlabeled sample data in the training sample set, that is, the sample data itself has candidate labels, but the candidate labels are not labeled, this influence needs to be considered when obtaining the total loss value.

[0040] In the scenario of recognizing k candidate labels, let y i Let ∈{0,1} be the supervision for the i-th candidate label (i.e., the label of the sample data). If the sample data is labeled with that label, then y i =1, otherwise y i If the sum is 0, then the loss value can be calculated using this formula:

[0041]

[0042] in, and Let represent the positive sample loss value and the negative sample loss value of the i-th candidate label, respectively.

[0043] In this formula, for the i-th candidate label, if a sample data point is labeled with that candidate label, then y i =1, when substituted into the formula, the loss generated by this sample data for this candidate label is: That is, the loss is calculated according to the method for calculating the positive sample loss value of the candidate label; if a sample data is not labeled with the candidate label, then y i =0, when substituted into the formula, the loss generated by this sample data for this candidate label is: That is, the loss is calculated in the same way as the negative sample loss value of the candidate label.

[0044] When the computer device obtains the total loss value, it can determine whether the label probability of each candidate label corresponding to each sample data is greater than the preset probability for each unlabeled candidate label in each sample data. If the label probability of any unlabeled candidate label is greater than the preset probability, it indicates that the sample data has been missed, i.e., false negative sample data. In the actual loss calculation, the loss should be calculated according to the positive sample data of the target candidate label, thereby avoiding the calculation of the loss value based on the negative sample data due to missed labeling, and thus avoiding the model updating parameters with the wrong loss value, which would affect the accuracy of the model. For the label probabilities output by other initial recognition models, the loss is calculated according to the usual loss calculation method, that is, the loss calculation is consistent with the labeled label. The preset probability can be 0.5, 0.6, 0.7, 0.7, etc., and the specific value is not limited; the target candidate label is any candidate label.

[0045] Understandably, the problem of identifying multiple candidate labels can usually be viewed as a parallel multivariate binary classification problem, that is, predicting the probability of each candidate label existing in the data, i.e., whether it exists or not. This means that in multi-label learning, negative samples far outnumber positive samples, resulting in a severe imbalance between positive and negative samples, and the problem of missing labels (i.e., positive samples lacking labeled information) further exacerbates this imbalance. In this case, if the model can still give a prediction for a positive sample (i.e., predicting a candidate label probability greater than the preset probability), then the reliability of this prediction should be very high, and therefore it is very likely a sample with missing labels (i.e., fake negative sample data). Of course, as training continues, the model overfits to incomplete training data and will lose this discriminative ability. Therefore, this early discriminative ability of the model can be used to calculate the loss. In other words, for a given sample data, if the target sample data is not labeled with a target candidate label, but the model outputs a label probability greater than a preset probability for that target candidate label, it indicates that the target candidate label is missing. Therefore, the loss is calculated based on the positive sample data with the target candidate label (i.e., the target sample data is considered to have a target candidate label, and the loss value is calculated based on that label), thus ensuring the accuracy of the obtained loss value. This can also be understood as correcting the label of the target sample data so that the model calculates the loss value based on the correct label during training. Therefore, combining the above formula, if the target candidate label is the i-th label, then the loss value of the target sample data corresponding to that target candidate label is:

[0046] Step S140: Based on the total loss value, iteratively train the initial recognition model to obtain the trained recognition model.

[0047] In this embodiment of the application, after obtaining the total loss value, the initial recognition model can be iteratively trained based on the total loss value to obtain the final recognition model.

[0048] In some implementations, the model parameters of the initial recognition model can be adjusted based on the calculated total loss value; return to step S120, and repeat steps S120 to S140 until the training termination condition is met, and the trained recognition model is obtained.

[0049] The process involves inputting each sample data from the training sample set into the initial recognition model to obtain the label probability of each candidate label corresponding to each sample data. Then, based on the label probability of each candidate label corresponding to each sample data and the label of each sample data, the total loss value is determined. After adjusting the model parameters of the initial recognition model according to the calculated total loss value, one epoch is completed. Then, the process returns to step S120 to complete the next epoch, and so on, to complete multiple epochs. Here, epoch refers to the number of times the entire dataset is trained using all samples in the training set. In simple terms, the value of epoch is the number of times the entire dataset is processed; one epoch is equivalent to training once using all samples in the training set.

[0050] Understandably, because the loss of missing negative samples is corrected in each epoch when calculating the loss value, i.e., the loss is calculated based on the positive samples with the target candidate labels, the accuracy of model updates can be ensured when adjusting the model parameters of the initial recognition model based on the obtained total loss value. In the next epoch, the sample data is input into the initial recognition model with updated model parameters (i.e., the updated model parameters are passed to the next epoch), and the process of determining the total loss value based on the output of the initial recognition model and the labels of the sample data is repeated, and the model parameters are adjusted based on the total loss value. This allows the model parameters of the initial recognition model to be continuously updated. Furthermore, because the loss of missing negative samples is corrected in each epoch, the accuracy of updating the model parameters in each epoch is ensured, ultimately resulting in an accurate trained recognition model.

[0051] In one possible implementation, the initial recognition model can be iteratively trained using the Adam optimizer based on the total loss value until the loss value of the initial recognition model's output converges. The model at this point is then saved, resulting in the trained recognition model. The Adam optimizer combines the advantages of both AdaGra (Adaptive Gradient) and RMSProp optimization algorithms, comprehensively considering the first moment estimation (mean of the gradient) and the second moment estimation (uncentered variance of the gradient) to calculate the update step size.

[0052] In some implementations, the training termination condition for iterative training may include: the number of iterations reaches the target number; or the total loss value of the output result of the initial recognition model meets the set condition.

[0053] In one specific implementation, the convergence condition is to minimize the total loss value. An initial learning rate of 1e-3 is used, which decays cosinely with the number of steps. The batch size is 8. After training for 16 epochs, convergence is considered complete. Here, batch size can be understood as a batch processing parameter, and its limit is the total number of samples in the training set.

[0054] In another specific implementation, satisfying the set condition for the total loss value may include: the total loss value is less than a set threshold. Of course, the specific set condition is not limited.

[0055] In some implementations, if the recognition model is executed by an electronic device when it is applied, the trained recognition model can be stored locally on the electronic device; of course, the trained recognition model can also be stored on a server that is connected to the electronic device. Storing the recognition model on the server can reduce the storage space occupied by the electronic device and improve the operating efficiency of the electronic device.

[0056] In some implementations, the recognition model can also periodically or irregularly acquire new sample data to train and update the model. For example, when input data is misidentified, it can be used as sample data, labeled, and then trained again using the above training methods, thereby improving the recognition model's discriminative power and accuracy.

[0057] In some implementations, since the recognition model is used to identify multiple candidate labels in the data, when the labels identified by the user's recognition model change, new candidate labels can be added or a candidate label can be deleted; and the recognition model can be retrained based on the changed candidate labels.

[0058] It is worth noting that the recognition model can be trained in advance based on the acquired training sample set. Subsequently, whenever it is necessary to identify whether there are candidate labels in the data to be identified, the trained recognition model can be used for identification without having to train the recognition model every time.

[0059] Next, we will proceed through... Figure 2 The training method of the recognition model involved in the embodiments of this application is introduced.

[0060] During the training of the initial recognition model, after inputting sample data into the initial recognition model, the label probability of each candidate label corresponding to the sample data can be obtained. Then, based on the label probability and the label of the sample data, if the target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than the preset probability, it is regarded as the positive sample data of the target candidate label, and its corresponding loss value is corrected to determine the total loss value. Then, the model parameters of the initial recognition model are updated according to the total loss value. This process is repeated until the training termination condition is met, and the training of the initial recognition model is completed, resulting in the trained recognition model.

[0061] The model training method provided in this application embodiment can automatically calculate the loss for incompletely labeled negative sample data as positive samples in each training epoch, thereby automatically correcting the loss caused by negative samples and improving model accuracy. In addition, since the loss caused by negative sample data is corrected in each training epoch, it is equivalent to correcting the labeling of the sample data. Therefore, there is no need to train the model multiple times, reducing training overhead and improving the efficiency of model training.

[0062] Please see Figure 3 , Figure 3 A flowchart illustrating a model training method provided in another embodiment of this application is shown. This model training method is applied to the aforementioned electronic device, and will be discussed below. Figure 3 The process shown will be explained in detail. The model training method may specifically include the following steps:

[0063] Step S210: Obtain a training sample set, which includes multiple sample data, including negative sample data corresponding to at least one candidate label.

[0064] Step S220: Input each sample data in the training sample set into the initial recognition model to obtain the label probability of each candidate label corresponding to each sample data.

[0065] In the embodiments of this application, steps S210 and S220 can be referred to the content of the foregoing embodiments, and will not be repeated here.

[0066] Step S230: Based on the labels labeled for each sample data, determine the positive sample data and negative sample data for each candidate label.

[0067] In this embodiment of the application, the computer device can determine the positive and negative sample data for each candidate label based on the labels annotated with each sample data. Specifically, in the sample data of the training sample set, for any candidate label, if the sample data is not labeled with that candidate label, then the sample data is negative sample data for that candidate label; if the sample data is labeled with that candidate label, then the sample data is positive sample data for that candidate label.

[0068] Step S240: For each candidate label, based on each positive sample data of each candidate label and the label probability of the candidate label corresponding to each positive sample data, determine the positive sample loss value corresponding to each candidate label.

[0069] In this embodiment of the application, after the computer device determines the positive sample data for each candidate label, it can calculate the positive sample loss value corresponding to each candidate label. Specifically, for any positive sample data, the positive sample loss value corresponding to each candidate label can be determined based on each positive sample data of each candidate label and the label probability of the candidate label corresponding to each positive sample data.

[0070] In some implementations, the computer device can, for each candidate label, obtain a loss value based on the label probability corresponding to the candidate label in the positive sample data of the candidate label, and in accordance with the method for determining the positive sample loss value, and use it as the positive sample loss value corresponding to the candidate label in the positive sample data.

[0071] The positive sample loss value can be determined based on the cross-entropy loss function, the focus loss function, or the automatic loss function.

[0072] Among them, the Binary Cross Entropy (BCE) loss function is a commonly used multi-label loss function, and its definition is:

[0073]

[0074] in, For positive sample loss values, Let be the loss value for negative samples, and p be the label probability. For ease of description... Both p and p omit the subscript i (the i-th candidate label).

[0075] In determining the positive sample loss value using the cross-entropy loss function, for each candidate label, based on the label probability of the positive sample data corresponding to the candidate label, and obtaining the loss value according to the method for determining the positive sample loss value, this loss value is used as the positive sample loss value for the positive sample data corresponding to the candidate label. Therefore, for each sample data point and each candidate label, based on the label probability of the sample data corresponding to each candidate label, and through... Calculate the positive sample loss value for each candidate label corresponding to the sample data.

[0076] The Focal loss function is an improvement on the cross-entropy loss function, used to address the imbalance between positive and negative samples, and incorporates a hard sample mining mechanism. Its formula is:

[0077]

[0078] in, For positive sample loss values, Let be the loss value for negative samples, and p be the label probability. For ease of description... Both p and p omit the subscript i (the i-th candidate label); the parameter γ is the power of the modulation coefficient, when γ > 0, the weight of hard samples is larger, playing a role in hard sample mining; the parameter α + and α - Used to balance the numerical relationship between positive sample loss and negative sample loss.

[0079] In determining the positive sample loss value using the Focal loss function, for each candidate label, based on the label probability of the positive sample data corresponding to the candidate label, and obtaining the loss value according to the method for determining the positive sample loss value, this loss value is used as the positive sample loss value for the positive sample data corresponding to the candidate label. Therefore, for each sample data point and each candidate label, based on the label probability of that sample data corresponding to each candidate label, and through... Calculate the positive sample loss value for each candidate label corresponding to the sample data.

[0080] The Automatic Seg-Loss (ASL) loss function is an improvement on the Focal loss function. It can mitigate the effects of positive and negative sample imbalance, and is defined as follows:

[0081]

[0082] in, For positive sample loss values, Let be the loss value for negative samples, and p be the label probability. For ease of description... Both p and p omit the subscript i (the i-th candidate label); where γ+ γ - These are the parameters for positive and negative samples, respectively. Let m be a probability threshold, and p... m Represented as max(pm,0); γ + γ - This reduces the weight of simple negative samples. In addition, by setting m, the loss caused by negative samples with very low prediction probabilities is discarded.

[0083] In the method of determining the positive sample loss value using the ASL loss function, for each candidate label, based on the label probability of the positive sample data corresponding to the candidate label, and obtaining the loss value according to the method for determining the positive sample loss value, this loss value is used as the positive sample loss value for the positive sample data corresponding to the candidate label. Therefore, for each sample data point and each candidate label, based on the label probability of the sample data corresponding to each candidate label, and through... Calculate the positive sample loss value for each candidate label corresponding to the sample data.

[0084] Of course, the specific method for determining the loss value of positive samples is not limited to using the above loss function; other loss functions can also be used.

[0085] Step S250: For each candidate label, based on each negative sample data of each candidate label and the label probability of the candidate label corresponding to each negative sample data, determine the negative sample loss value corresponding to each candidate label, wherein the negative sample loss value of the target sample data corresponding to the target candidate label is obtained in the same way as the positive sample loss value.

[0086] Wherein, the target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than a preset probability.

[0087] In this embodiment of the application, the computer device can also determine the negative sample loss value corresponding to each candidate label based on each negative sample data of each candidate label and the label probability of the candidate label corresponding to each negative sample data. However, since some sample data may be missing labels, there may be a situation where the target sample data does not have a labeled target candidate label, but the label probability of the target sample data corresponding to the target candidate label is greater than the preset probability. In this case, it is necessary to make the calculation of the negative sample loss value of the target candidate label corresponding to the target sample data follow the calculation method of the positive sample loss value, so as to correct the loss value and make the resulting loss value calculated according to the correctly labeled label.

[0088] In some implementations, step S250 may include:

[0089] For each candidate label, if the label probability corresponding to the negative sample data of the candidate label is less than or equal to a preset probability, then a loss value is obtained based on the label probability of the candidate label corresponding to the negative sample data and according to the method for determining the negative sample loss value, and this loss value is used as the negative sample loss value of the candidate label corresponding to the negative sample data; if the label probability corresponding to the negative sample data of the candidate label is greater than the preset probability, then a loss value is obtained based on the label probability of the candidate label corresponding to the negative sample data and according to the method for determining the positive sample loss value, and this loss value is used as the negative sample loss value of the candidate label corresponding to the negative sample data.

[0090] In other words, when calculating the negative sample loss corresponding to each negative sample data, since some sample data may have missed labels, if the label probability corresponding to the negative sample data of the candidate label is greater than the preset probability, then the loss value is obtained according to the method for determining the positive sample loss value, and is used as the negative sample loss value for that negative sample data corresponding to the candidate label. Conversely, if the model identifies a negative sample data with a probability less than or equal to the preset probability, it means that the negative sample data itself does not have the candidate label, and therefore the loss value is obtained according to the method for determining the negative sample loss value, and is used as the negative sample loss value for that negative sample data corresponding to the candidate label.

[0091] Specifically, the method for determining the loss value of positive samples can be referred to in step S240; the method for determining the loss value of negative samples can be the calculation method of the cross-entropy loss function, the focus loss function, or the automatic loss function. For example, for each sample data, for each candidate label, based on the label probability of each candidate label corresponding to that sample data, and through... Calculate the positive sample loss value for each candidate label corresponding to the sample data.

[0092] Step S260: Determine the total loss value based on the positive sample loss value corresponding to each candidate label and the negative sample loss value corresponding to each candidate label.

[0093] In this embodiment of the application, after determining the positive sample loss value and the negative sample loss value corresponding to each candidate label for each sample data, the loss value generated for each sample data can be determined, and the sum of the loss values ​​generated by each sample data can be obtained to obtain the total loss value.

[0094] For each sample data point, the corresponding loss value can be calculated using this formula:

[0095]

[0096] and These represent the loss values ​​for positive and negative samples, respectively, where k is the number of candidate labels, and y... i Let ∈{0,1} be the supervision for the i-th candidate label (i.e., the label of the sample data). If the sample data is labeled with that label, then y i =1, otherwise y i =0.

[0097] The following section will use the defined Self-Paced Loss Correction (SPLC) loss function to illustrate the process of determining the loss value in the embodiments of this application.

[0098] To determine the corresponding loss value for each sample data, the following formula can be used:

[0099]

[0100] The SPLC loss function is expressed as:

[0101]

[0102] For ease of description, the subscript i is omitted from the SPLC loss function. That is That is p is the label probability of the i-th candidate label. i ,

[0103] Π(p≤τ) is used to binarize p, that is, when p≤τ, Π(p≤τ) takes the value of 1, and conversely, when p>τ, Π(p≤τ) takes the value of 0, where τ is the preset probability mentioned above.

[0104] loss + (p) and loss - (p) is determined by the cross-entropy loss function, focus loss function, or automatic loss function mentioned above.

[0105] For example, when using the cross-entropy loss function, then the loss... + (p) is loss - (p) is Understandably, for any sample data, if the i-th candidate label is provided, then y i =1, at this time, the loss for the i-th candidate label of this sample data is: -log(p). If you want the loss value to be smaller, the value of p should be larger; if there is no i-th candidate label, then y i=0, at this point, the loss for the i-th candidate label of this sample data is: -log(1-p). To minimize the loss, the value of P should be smaller. If the sample data is fully labeled, i.e., there are no missing labels, then according to... This ensures the accuracy of the calculated loss value; that is, for negative sample data, the probability output by the model should be as small as possible, and for positive sample data, the probability output by the model should be as large as possible. However, if there are negative sample data with missing labels, the model will output a probability greater than the preset probability. Through the constraint of the SPLC function, when calculating the negative sample loss value corresponding to the negative sample data, the calculated loss value is -log(p). Thus, it is equivalent to wanting the loss value to be as small as possible, so that the value of p is larger, making the calculated loss value consistent with the true situation of the negative sample data, thereby ensuring accuracy.

[0106] Step S270: Based on the total loss value, iteratively train the initial recognition model to obtain the trained recognition model.

[0107] In this embodiment, step S270 can be referred to the content of the foregoing embodiments, and will not be repeated here.

[0108] The model training method provided in this application embodiment can realize that in each training epoch, for incompletely labeled negative sample data, the loss value generated by the negative sample data (i.e., the negative sample loss value) is calculated according to the method for determining the loss value of positive samples, so that the calculated loss value conforms to the true situation of the negative sample data, thereby ensuring accuracy.

[0109] Please see Figure 4 , Figure 4 A schematic flowchart of a model training method according to another embodiment of this application is shown. This model training method is applied to the aforementioned computer device, and will be discussed below. Figure 4 The process shown will be explained in detail. The model training method may specifically include the following steps:

[0110] Step S310: Obtain a training sample set, which includes multiple sample data, including negative sample data corresponding to at least one candidate label.

[0111] Step S320: Input each sample data in the training sample set into the initial recognition model to obtain the label probability of each candidate label corresponding to each sample data.

[0112] In the embodiments of this application, steps S310 and S320 can be referred to the content of the foregoing embodiments, and will not be repeated here.

[0113] Step S330: Obtain target sample data from the training sample set, wherein the target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than a preset probability.

[0114] In this embodiment, since some sample data may be missing labels, there may be target sample data that is not labeled with target candidate labels, but the label probability of the target candidate label corresponding to the target sample data is greater than the preset probability. Therefore, the computer device can, for each sample data, determine whether the label probability of each unlabeled candidate label is greater than the preset probability based on the label probability of each candidate label corresponding to it. If the label probability of any unlabeled candidate label is greater than the preset probability, the sample data can be used as the target sample data. If the label probability of each unlabeled candidate label is less than or equal to the preset probability, it means that the sample data is correctly labeled and no processing is required.

[0115] Step S340: Correct the target sample data to positive sample data of the target candidate label to obtain the updated training sample set.

[0116] In this embodiment of the application, after the target sample data is determined, since the target sample data is missing target candidate labels, it is not labeled with target candidate labels. However, the label probability of the target candidate labels identified by the model is greater than the preset probability. Therefore, the computer device corrects the target sample data to positive sample data of target candidate labels to obtain an updated training sample set.

[0117] Specifically, the computer device can add the target candidate labels to the target sample data in the training sample set to obtain an updated training sample set. Thus, during model training, candidate labels with a probability greater than a preset probability, identified by the model, are added to sample data lacking labels, achieving automatic correction of the sample data.

[0118] Step S350: Based on the label probability of each candidate label corresponding to each sample data in the training sample set, and the label corresponding to each sample data in the updated training sample set, determine the positive sample loss value and the negative sample loss value corresponding to each candidate label.

[0119] Step S360: Determine the total loss value based on the positive sample loss value corresponding to each candidate label and the negative sample loss value corresponding to each candidate label.

[0120] In this embodiment of the application, after the computer device updates the target sample data to positive sample data of the target candidate labels, the missing labels are added. Therefore, by determining the total loss value in accordance with the traditional method of determining the loss value, the accuracy of the calculated loss value can be guaranteed, thereby ensuring the accuracy of the model update.

[0121] The computer device can determine the positive sample loss value and the negative sample loss value corresponding to each candidate label based on the label probability of each candidate label corresponding to each sample data and the label of each sample data in the updated training sample set; then, based on the positive sample loss value and the negative sample loss value corresponding to each candidate label, the total loss value is determined.

[0122] In some implementations, the computer device may follow the formulas in the foregoing embodiments. Calculate the loss value for each sample data point; then sum the loss values ​​generated by each sample data point to obtain the total loss value. and It can be determined based on the cross-entropy loss function, the focus loss function, or the automatic loss function.

[0123] Step S370: Based on the total loss value, iteratively train the initial recognition model to obtain the trained recognition model.

[0124] In this embodiment, step S370 can be referred to the content of the foregoing embodiments, and will not be repeated here.

[0125] In some implementations, during model training, for any sample data, if the probability of the unlabeled target candidate label corresponding to the target sample data is greater than a preset probability, it is updated to positive sample data with the target candidate label. In other words, the training sample set is continuously updated. Therefore, after the model training is completed, its training sample set is also likely to be fully labeled. Thus, the computer device can also upload the training sample set to the server for use by other devices when training the recognition model.

[0126] The model training method provided in this application embodiment can identify incompletely labeled negative sample data in each training epoch during model training, and update the labels of these incompletely labeled negative sample data to ensure accurate labels. This ensures accurate calculation of loss values ​​and improves the accuracy of the trained model.

[0127] Please see Figure 5The diagram illustrates a structural block diagram of a model training apparatus 400 provided in an embodiment of this application. The model training apparatus 400 utilizes the aforementioned computer equipment and includes: a sample acquisition module 410, a model input module 420, a loss determination module 430, and an iterative training module 440. The sample acquisition module 410 is used to acquire a training sample set, which includes multiple sample data, including negative sample data corresponding to at least one candidate label. The model input module 420 is used to input each sample data in the training sample set into the initial recognition model to obtain the label probability of each candidate label corresponding to each sample data. The loss determination module 430 is used to take the target sample data in the training sample set as the positive sample data of the target candidate label, and determine the total loss value based on the label probability of each candidate label corresponding to each sample data in the training sample set and the label labeled on each sample data. The target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than a preset probability. The iterative training module 440 is used to iteratively train the initial recognition model according to the total loss value to obtain the trained recognition model.

[0128] In some implementations, the loss determination module 430 may be used to: determine the positive and negative sample data for each candidate label based on the labels annotated for each sample data; for each candidate label, determine the positive sample loss value corresponding to each candidate label based on each positive sample data for each candidate label and the label probability of the candidate label corresponding to each positive sample data; for each candidate label, determine the negative sample loss value corresponding to each candidate label based on each negative sample data for each candidate label and the label probability of the candidate label corresponding to each negative sample data, wherein the negative sample loss value of the target sample data corresponding to the target candidate label is obtained in the same way as the positive sample loss value; and determine the total loss value based on the positive sample loss value and the negative sample loss value corresponding to each candidate label.

[0129] As one possible implementation, the loss determination module 430, for each candidate label, determines the negative sample loss value corresponding to each candidate label based on each negative sample data of each candidate label and the label probability of the candidate label corresponding to each negative sample data. This may include: for each candidate label, if the label probability corresponding to the negative sample data of the candidate label is less than or equal to a preset probability, then based on the label probability of the candidate label corresponding to the negative sample data, and according to the method for determining negative sample loss values, obtain a loss value as the negative sample loss value corresponding to the candidate label; if the label probability corresponding to the negative sample data of the candidate label is greater than the preset probability, then based on the label probability of the candidate label corresponding to the negative sample data, and according to the method for determining positive sample loss values, obtain a loss value as the negative sample loss value corresponding to the candidate label.

[0130] As one possible implementation, the loss determination module 430 determines the positive sample loss value corresponding to each candidate label based on each positive sample data of each candidate label and the label probability of the candidate label corresponding to each positive sample data. This includes: for each candidate label, obtaining the loss value based on the label probability of the candidate label corresponding to the positive sample data, and using it as the positive sample loss value corresponding to the candidate label.

[0131] In some implementations, the loss determination module 430 may be used to: acquire target sample data in the training sample set, wherein the target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than a preset probability; correct the target sample data to positive sample data of the target candidate label to obtain an updated training sample set; determine the positive sample loss value corresponding to each candidate label and the negative sample loss value corresponding to each candidate label based on the label probability of each candidate label corresponding to each sample data in the training sample set and the label corresponding to each sample data in the updated training sample set; and determine the total loss value based on the positive sample loss value corresponding to each candidate label and the negative sample loss value corresponding to each candidate label.

[0132] As one possible implementation, the loss determination module 430 corrects the target sample data to positive sample data of the target candidate label to obtain an updated training sample set, which may include: adding the label of the target candidate label to the target sample data in the training sample set to obtain an updated training sample set.

[0133] In some implementations, the positive sample loss value and the negative sample loss value are determined based on the cross-entropy loss function, the focus loss function, or the automatic loss function.

[0134] In some implementations, the iterative training module 440 may be specifically used to: adjust the model parameters of the initial recognition model according to the total loss value; return to the step of inputting each sample data in the training sample set into the initial recognition model to obtain the label probability of each candidate label corresponding to each sample data, until the training termination condition is met, and obtain the trained recognition model.

[0135] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0136] In the several embodiments provided in this application, the coupling between modules can be electrical, mechanical, or other forms of coupling.

[0137] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0138] In summary, the solution provided in this application obtains a training sample set, inputs each sample data in the training sample set into an initial recognition model to obtain the label probability of each candidate label corresponding to each sample data. Then, the target sample data in the training sample set is used as the positive sample data of the target candidate label. Based on the label probability of each candidate label corresponding to each sample data in the training sample set and the label labeled for each sample data, a total loss value is determined. The target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than a preset probability. The initial recognition model is then iteratively trained based on the total loss value to obtain the trained recognition model. Therefore, during model training, for incompletely labeled negative sample data, the loss can be automatically calculated as positive samples, automatically correcting the loss caused by negative samples, thereby improving the efficiency and accuracy of model training.

[0139] Please refer to Figure 6This document illustrates a structural block diagram of an electronic device according to an embodiment of this application. The electronic device 100 can be a server, smartphone, tablet computer, smartwatch, e-reader, PC, laptop computer, or other electronic device capable of running applications. The electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more applications, wherein the one or more applications can be stored in the memory 120 and configured to be executed by the one or more processors 110, and the one or more applications are configured to perform the methods described in the foregoing method embodiments.

[0140] Processor 110 may include one or more processing cores. Processor 110 connects to various parts within the electronic device 100 using various interfaces and lines, and performs various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets, or instruction sets stored in memory 120, and by calling data stored in memory 120. Optionally, processor 110 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 110 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 110 and may be implemented separately using a communication chip.

[0141] The memory 120 may include random access memory (RAM) or read-only memory (ROM). The memory 120 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the electronic device 100 during use (such as phonebook data, audio and video data, chat log data, etc.).

[0142] Please refer to Figure 7 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable medium 800 stores program code that can be called by a processor to execute the methods described in the above method embodiments.

[0143] The computer-readable storage medium 800 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 800 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 800 has storage space for program code 810 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 810 may be compressed, for example, in a suitable form.

[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A model training method, characterized in that, The method includes: Obtain a training sample set, which includes multiple sample data, including negative sample data corresponding to at least one candidate label, wherein the negative sample data corresponding to any candidate label is not labeled with that candidate label, and the sample data includes images or audio. Each sample data in the training sample set is input into the initial recognition model to obtain the label probability of each candidate label corresponding to each sample data; The target sample data in the training sample set is used as the positive sample data of the target candidate label. The total loss value is determined based on the label probability of each candidate label corresponding to each sample data in the training sample set and the label labeled by each sample data. The target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than a preset probability. Based on the total loss value, the initial recognition model is iteratively trained to obtain the trained recognition model.

2. The method according to claim 1, characterized in that, The step of using the target sample data in the training sample set as positive sample data for the target candidate labels, and determining the total loss value based on the label probability of each candidate label corresponding to each sample data in the training sample set and the label labeled for each sample data, includes: Based on the labels labeled for each sample data, determine the positive and negative sample data for each candidate label; For each candidate label, based on each positive sample data of each candidate label and the label probability of the candidate label corresponding to each positive sample data, determine the positive sample loss value corresponding to each candidate label; For each candidate label, based on each negative sample data of each candidate label and the label probability of the candidate label corresponding to each negative sample data, the negative sample loss value corresponding to each candidate label is determined, wherein the negative sample loss value of the target sample data corresponding to the target candidate label is obtained in the same way as the positive sample loss value is determined; The total loss value is determined based on the positive sample loss value corresponding to each candidate label and the negative sample loss value corresponding to each candidate label.

3. The method according to claim 2, characterized in that, The step of determining the negative sample loss value for each candidate label based on each negative sample data of each candidate label and the label probability of the candidate label corresponding to each negative sample data includes: For each candidate label, if the label probability corresponding to the negative sample data of the candidate label is less than or equal to a preset probability, then based on the label probability of the candidate label corresponding to the negative sample data, and according to the method for determining the negative sample loss value, the loss value is obtained as the negative sample loss value of the candidate label corresponding to the negative sample data. If the label probability corresponding to the negative sample data of the candidate label is greater than the preset probability, then based on the label probability of the candidate label corresponding to the negative sample data, and according to the method for determining the positive sample loss value, the loss value is obtained as the negative sample loss value of the candidate label corresponding to the negative sample data.

4. The method according to claim 2, characterized in that, The step of determining the positive sample loss value corresponding to each candidate label based on each positive sample data of each candidate label and the label probability of the candidate label corresponding to each positive sample data includes: For each candidate label, the label probability corresponding to the candidate label is obtained based on the positive sample data of the candidate label, and the loss value is obtained according to the method for determining the positive sample loss value, which is used as the positive sample loss value corresponding to the candidate label of the positive sample data.

5. The method according to claim 1, characterized in that, The step of using the target sample data in the training sample set as positive sample data for the target candidate labels, and determining the total loss value based on the label probability of each candidate label corresponding to each sample data in the training sample set and the label labeled for each sample data, includes: Obtain target sample data from the training sample set, wherein the target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than a preset probability; The target sample data is corrected to positive sample data of the target candidate label to obtain the updated training sample set; Based on the label probability of each candidate label corresponding to each sample data in the training sample set, and the label of each sample data in the updated training sample set, determine the positive sample loss value and the negative sample loss value corresponding to each candidate label. The total loss value is determined based on the positive sample loss value corresponding to each candidate label and the negative sample loss value corresponding to each candidate label.

6. The method according to claim 5, characterized in that, The step of correcting the target sample data to positive sample data of the target candidate label to obtain the updated training sample set includes: The target candidate label is added to the target sample data in the training sample set to obtain the updated training sample set.

7. The method according to any one of claims 2-6, characterized in that, The positive sample loss value and the negative sample loss value are determined based on the cross-entropy loss function, the focus loss function, or the automatic loss function.

8. The method according to claim 1, characterized in that, The step of iteratively training the initial recognition model based on the total loss value to obtain the trained recognition model includes: Based on the total loss value, adjust the model parameters of the initial recognition model; Return to the step of inputting each sample data in the training sample set into the initial recognition model to obtain the label probability of each candidate label corresponding to each sample data, until the training termination condition is met, and obtain the trained recognition model.

9. A model training device, characterized in that, The device includes: a sample acquisition module, a model input module, a loss determination module, and an iterative training module, wherein, The sample acquisition module is used to acquire a training sample set, which includes multiple sample data, including negative sample data corresponding to at least one candidate label. The negative sample data corresponding to any candidate label is not labeled with that candidate label. The sample data includes images or audio. The model input module is used to input each sample data in the training sample set into the initial recognition model to obtain the label probability of each candidate label corresponding to each sample data; The loss determination module is used to take the target sample data in the training sample set as positive sample data of the target candidate label, and determine the total loss value based on the label probability of each candidate label corresponding to each sample data in the training sample set and the label labeled by each sample data. The target sample data is not labeled with the target candidate label, and the label probability of the target sample data corresponding to the target candidate label is greater than a preset probability. The iterative training module is used to iteratively train the initial recognition model based on the total loss value to obtain the trained recognition model.

10. A computer device, characterized in that, include: One or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform the method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium contains program code that can be invoked by a processor to execute the method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Image recognition method and device, electronic equipment and storage medium

    CN111814810A