Sample screening method, device, storage medium and computer equipment

By calculating the loss parameters and penalty scores of training samples, dividing the sample types and constructing the target sample set, the problem of uneven distribution of training samples is solved and the generalization ability and robustness of the machine learning model are improved.

CN115204271BActive Publication Date: 2025-09-09ZKTECO CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210720054.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-23
Publication Date
2025-09-09
Estimated Expiration
2042-06-23

AI Technical Summary

Technical Problem

During the training process, existing machine learning models have difficulty in obtaining diverse scenario data, resulting in an uneven distribution of training samples, low model generalization ability, and limited complexity of application scenarios.

Method used

By calculating the training loss parameters and penalty scores of the training samples, the generalization ability contribution of each training sample is determined, the samples are divided into simple samples, normal samples and difficult samples, and the target sample set is constructed to participate in model training, thereby optimizing the sample diversity and characteristic degree.

Benefits of technology

It improves the generalization ability and robustness of the training model, reduces the impact of simple data on the generalization ability of the model, and ensures that the generalization ability of the training model does not weaken with the increase of training rounds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115204271B_ABST
    Figure CN115204271B_ABST
Patent Text Reader

Abstract

The present application provides a sample screening method, device, storage medium and computer equipment. The method includes: before executing the (n+1)th round of model training, calculating the training loss parameter and penalty score of each training sample in the (n‑m)th round to the nth round of training; wherein the training loss parameter is used to characterize the average training loss degree of the training sample in the (n‑m)th round to the nth round of training, and the penalty score is used to characterize the proportion of the number of times the training sample is correctly classified by the training model in the (n‑m)th round to the nth round of training; n>m, and n and m are both positive integers; each training sample is determined as a simple sample, a normal sample or a difficult sample according to its contribution to the generalization ability of the model; and a target sample set is constructed according to each normal sample and each difficult sample. The present application can optimize the diversity and characteristic degree of the samples put into training, thereby improving the generalization ability of the training model obtained by training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine learning technology, and in particular to a sample screening method, apparatus, storage medium, and computer equipment. Background Art

[0002] Machine learning is widely used in scenarios such as image and video classification and detection. By training a large number of training samples, the features in the training samples are learned and a training model is obtained. The training model can then be used to classify or detect target data.

[0003] However, in most cases, it is difficult to ensure balanced collection of more diverse scene data when obtaining training samples. There may be a large amount of simple data containing less information, and data diversity cannot be guaranteed. As a result, when training the model, it tends to learn data features with a more concentrated sample distribution, resulting in low generalization ability of the trained model and limited complexity of the application scenario. Summary of the Invention

[0004] The embodiments of the present application provide a sample screening method, apparatus, storage medium, and computer equipment, which can optimize the diversity and characteristic degree of samples put into training, thereby improving the generalization ability of the training model obtained by training.

[0005] In a first aspect, the present application provides a sample screening method, the method comprising:

[0006] Before performing the (n+1)th round of model training, calculate the training loss parameter and penalty score of each training sample in the process of training from the (nm)th round to the nth round; wherein the training loss parameter is used to represent the average training loss degree of the training sample in the process of training from the (nm)th round to the nth round, and the penalty score is used to represent the proportion of the training sample correctly classified by the trained model in the process of training from the (nm)th round to the nth round; n>m, and n and m are both positive integers;

[0007] Each training sample is classified as a simple sample, a normal sample, or a difficult sample according to its contribution to the generalization ability of the model; wherein the contribution of the training sample to the generalization ability of the model is determined based on the training loss parameter and penalty score of each training sample; the contribution of difficult samples is higher than that of normal samples, and the contribution of normal samples is higher than that of simple samples;

[0008] A target sample set is constructed based on the normal samples and the difficult samples; the target sample set is used to participate in the (n+1)th round of model training.

[0009] In one embodiment, the training loss parameter of the training sample is positively correlated with the average training loss degree;

[0010] The penalty score of the training sample is negatively correlated with the proportion of correct classification times of the trained model.

[0011] In one embodiment, the calculating of the training loss parameter and penalty score of each training sample during the (nm)th round to the nth round of training includes:

[0012] Calculate the loss gradient norm of each training sample in each round from the nmth round to the nth round of training; the loss gradient norm is used to represent the Euclidean distance between the probability output value of the training sample in each round of training and the expected output value of the training sample;

[0013] Calculate the average value of the loss gradient two norm of the training sample from the (nm)th round to the nth round of training as the training loss parameter;

[0014] Obtaining a first score according to the product of a preset correct classification score and the number of times the training sample is correctly classified by the training model during the (nm)th round to the nth round of training;

[0015] Obtaining a second score according to the product of a preset misclassification score and the number of times the training sample is misclassified by the training model during the (nm)th round to the nth round of training;

[0016] The penalty score of the training sample is obtained by subtracting the difference between the first score and the second score from the preset initial penalty score.

[0017] In one embodiment, determining each training sample as a simple sample, a normal sample, or a difficult sample according to its contribution to the generalization ability of the model includes:

[0018] If the training loss parameter of a training sample is greater than or equal to a preset loss threshold, the training sample is determined to be a difficult sample;

[0019] If the training loss parameter of the training sample is less than the loss threshold, and the penalty score is greater than or equal to the preset penalty score threshold, the training sample is determined to be a normal sample;

[0020] If the training loss parameter of the training sample is less than the loss threshold and the penalty score is less than the penalty score threshold, the training sample is determined to be a simple sample.

[0021] In one embodiment, constructing a target sample set based on each normal sample and each difficult sample includes:

[0022] Identify redundant samples in each normal sample;

[0023] If there are redundant samples in each normal sample, some samples are randomly selected from each redundant sample and added to the target sample set;

[0024] Adding the remaining samples except the redundant samples in each normal sample to the target sample set;

[0025] Each difficult sample is added to the target sample set.

[0026] In one embodiment, identifying redundant samples in normal samples includes:

[0027] Calculate the difference parameter based on the training loss parameter and penalty score of any two normal samples;

[0028] If the difference parameter of two normal samples is less than a preset difference threshold, the two normal samples are determined to be redundant samples.

[0029] In one embodiment, the calculating the difference parameter based on the training loss parameter and penalty score of any two normal samples includes:

[0030] The sum of the two norms of the difference between the training loss parameters of the two normal samples and the two norms of the difference between the penalty scores is calculated as the difference parameter.

[0031] In a second aspect, the present application provides a sample screening device, comprising:

[0032] a calculation module, configured to calculate, before executing the (n+1)th round of model training, a training loss parameter and a penalty score for each training sample in the process of training from the (nm)th round to the nth round; wherein the training loss parameter is used to represent the average training loss degree of the training sample in the process of training from the (nm)th round to the nth round, and the penalty score is used to represent the proportion of the number of times the training sample is correctly classified by the trained model in the process of training from the (nm)th round to the nth round; n>m, and n and m are both positive integers;

[0033] A sample classification module is configured to classify each training sample as a simple sample, a normal sample, or a difficult sample based on its contribution to the generalization ability of the model; wherein the contribution of the training sample to the generalization ability of the model is determined based on the training loss parameter and penalty score of each training sample; the contribution of difficult samples is higher than that of normal samples, and the contribution of normal samples is higher than that of simple samples;

[0034] The target sample set construction module is used to construct a target sample set based on each normal sample and each difficult sample; the target sample set is used to participate in the (n+1)th round of model training.

[0035] In a third aspect, the present application provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the sample screening method described in any of the above embodiments.

[0036] In a fourth aspect, the present application provides a computer device, comprising: one or more processors, and a memory;

[0037] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the sample screening method described in any of the above embodiments are performed.

[0038] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0039] The sample screening method, apparatus, storage medium and computer equipment provided in the present application calculate the training loss parameter and penalty score of each training sample in the (nm)th round to the nth round of training before the (n+1)th round of model training, wherein the training loss parameter is used to characterize the average training loss degree of the training sample in the (nm)th round to the nth round of training, and the penalty score is used to characterize the proportion of the number of times the training sample is correctly classified by the trained model in the (nm)th round to the nth round of training; the contribution of each training sample to the generalization ability of the model is determined by calculating the training loss parameter and penalty score of each training sample, and each training sample is divided into simple and simple samples according to the size of the contribution. Single samples, normal samples or difficult samples, according to the normal samples with higher contribution to the generalization ability of the model and the difficult samples with higher contribution to the generalization ability of the model, constitute the target sample set to participate in the (n+1)th round of model training, so that the training samples put into training can be more diverse and have higher characteristics, reducing the impact of simple data with less information on the generalization ability of the model, thereby making the training model obtained by training with the target sample set have higher generalization ability and stronger robustness, and as the number of training rounds increases, the samples will be continuously re-screened, so that the samples put into training will not be concentrated on fixed samples, ensuring that the generalization ability of the training model will not weaken with the increase of training rounds. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in 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 only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0041] Figure 1A schematic diagram of a sample screening method according to an embodiment;

[0042] Figure 2 1 is a flowchart of the steps of calculating the training loss parameters and penalty scores of each training sample in the training process from the nmth round to the nth round in one embodiment;

[0043] Figure 3 1 is a flowchart illustrating steps for determining each training sample as a simple sample, a normal sample, or a difficult sample according to its contribution to the generalization ability of the model in one embodiment;

[0044] Figure 4 1 is a flowchart of steps for constructing a target sample set based on normal samples and difficult samples in one embodiment;

[0045] Figure 5 is a structural block diagram of a sample screening device in one embodiment;

[0046] Figure 6 FIG1 is an internal structure diagram of a computer device that is a server in one embodiment;

[0047] Figure 7 FIG. 1 is an internal structure diagram of a computer device serving as a terminal in one embodiment. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0049] The sample screening method provided in the embodiments of this application can be applied to servers or various terminal devices such as personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart car devices. Portable wearable devices can include smart watches, smart bracelets, head-mounted devices, etc. The embodiments of this application do not impose any restrictions on the specific type of terminal device. The server can be implemented as a standalone server or a server cluster consisting of multiple servers.

[0050] like Figure 1 As shown, an embodiment of the present application provides a sample screening method, which is applied to screening training samples for training during a machine learning model training process. The method includes steps S101 to S103, wherein:

[0051] Step S101, before executing the (n+1)th round of model training, calculate the training loss parameters and penalty scores of each training sample in the (nm)th round to the nth round of training.

[0052] The training loss parameter is used to characterize the average training loss of the training samples from the (nm)th round to the nth round of training, that is, the average training loss of the first m rounds; the penalty score is used to characterize the proportion of the training samples correctly classified by the trained model from the (nm)th round to the nth round of training; n>m, and both n and m are positive integers.

[0053] In one embodiment, the training loss parameter of the training sample is positively correlated with the average training loss level; the penalty score of the training sample is negatively correlated with the proportion of correct classification times of the trained model.

[0054] In step S102 , each training sample is determined as a simple sample, a normal sample, or a difficult sample according to its contribution to the generalization ability of the model.

[0055] The contribution of a training sample to the model's generalization ability is determined by the training loss parameter and penalty score for each training sample. The difficulty of a training sample can be reflected by its average training loss over the first m rounds of training and the proportion of correctly classified samples by the trained model. The more difficult a training sample is, the greater its contribution to the model's generalization ability. That is, difficult samples contribute more than normal samples, and normal samples contribute more than simple samples.

[0056] Step S103: construct a target sample set based on each normal sample and each difficult sample.

[0057] Among them, the target sample set is used to participate in the (n+1)th round of model training.

[0058] It can be understood that the training samples in the target sample set come from normal samples and difficult samples. In some embodiments, the target sample set may include all normal samples and all difficult samples; in some embodiments, the target sample set may include some normal samples and all difficult samples; in some embodiments, the target sample set may include all normal samples and some difficult samples; in some embodiments, the target sample set may include some normal samples and some difficult samples.

[0059] The sample screening method provided by the present application calculates the training loss parameter and penalty score of each training sample in the (nm)th round to the nth round of training before the (n+1)th round of model training, wherein the training loss parameter is used to characterize the average training loss degree of the training sample in the (nm)th round to the nth round of training, and the penalty score is used to characterize the proportion of the number of times the training sample is correctly classified by the trained model in the (nm)th round to the nth round of training; the contribution of each training sample to the generalization ability of the model is determined by the calculated training loss parameter and penalty score of each training sample, and each training sample is divided into simple samples, normal samples and normal samples according to the size of the contribution. The target sample set is composed of normal samples with a higher contribution to the generalization ability of the model and difficult samples with a higher contribution to the generalization ability of the model, and is used to participate in the (n+1)th round of model training, so that the training samples put into training can be more diverse and have higher characteristics, reducing the impact of simple data with less information on the generalization ability of the model, thereby making the training model obtained by training with the target sample set have higher generalization ability and stronger robustness, and as the number of training rounds increases, the samples will be continuously re-screened, so that the samples put into training will not be concentrated on fixed samples, ensuring that the generalization ability of the training model will not weaken with the increase of training rounds.

[0060] In one embodiment, when the number of training rounds is less than m, the steps of the sample screening method provided in this embodiment are not performed on the training samples. Other screening processes may be performed, or the entire training sample may be used. In some embodiments, the sample screening only selects samples for the (n+1)th round of model training. Unselected training samples remain in the training sample set and may be selected for training in subsequent rounds.

[0061] like Figure 2 As shown, in one embodiment, the calculation of the training loss parameter and penalty score of each training sample in the (nm)th round to the nth round of training includes steps S201 to S205, wherein:

[0062] Step S201, calculating the loss gradient binorm of each training sample in each round of training from the nmth round to the nth round.

[0063] Among them, the loss gradient norm is used to represent the Euclidean distance between the probability output value of the training sample in each round of training and the expected output value of the training sample.

[0064] Specifically, assume that the training sample set is x i represents the i-th training sample, represents the expected output value (i.e. label) of the i-th sample, N is the total number of training samples, let f net (ω,xi ) means that the training sample x i After inputting the training model net, the output is obtained when the weight is ω. For the training sample set, SGD (stochastic gradient descent) with random initialization is used for training. The loss gradient norm of the training sample is calculated according to the following formula:

[0065] ||p(ω t ,x i )-y i ||2

[0066] In which, let p(ω,x i )=δ(f net (ω,x i )) represents the probability output value of the neural network, where δ is the softmax activation function. Let Represents the weight parameters updated during the stochastic gradient descent process, where M represents the preset mini_batch (all training samples will be divided into several batches during training, each batch contains a part of the training samples, and the number of training samples contained in a batch is mini_batch). The mini_batch in a round of training has , respectively expressed as The weight parameter update process is as follows:

[0067]

[0068] in The process of derivation can be expressed as:

[0069]

[0070] Among them, λ is a value between 0 and 1, which is used to control the update amplitude of the weight parameter during the stochastic gradient descent process; Represents the cross entropy loss between the probability output vector and the expected output vector of the i-th training sample.

[0071] Step S202: Calculate the average value of the second norm of the loss gradient of the training sample from the nmth round to the nth round of training as the training loss parameter.

[0072] Specifically, the training loss parameter L of the training sample can be calculated according to the following formula: t :

[0073]

[0074] The larger the training loss parameter, the greater the gap between the probability output value of the training sample in the first m rounds of training and the expected output value of the training sample, which means that the training model has greater difficulty in training the sample; the smaller the training loss parameter, the smaller the gap between the probability output value of the training sample in the first m rounds of training and the expected output value of the training sample, which means that the training model has less difficulty in training the sample.

[0075] Step S203 , obtaining a first score according to the product of a preset correct classification score and the number of times the training sample is correctly classified by the training model during the (nm)th round to the nth round of training.

[0076] Step S204, obtaining a second score according to the product of a preset misclassification score and the number of times the training sample is misclassified by the training model during the (nm)th round to the nth round of training;

[0077] Step S205 : obtaining a penalty score for the training sample by subtracting the difference between the first score and the second score from the preset initial penalty score.

[0078] For example, define the initial penalty score as ζ, if the training sample x i During a round of training, if the trained model correctly classifies the sample, the initial penalty score ζ is reduced by α. i During a round of training, if the trained model misclassifies an error, the initial penalty score ζ increases by β. The penalty score ψ for the first m rounds is calculated as follows:

[0079] ψ=ξ-α*R+β*(mR)

[0080] Where R is the number of times the training samples are correctly classified during the first m rounds of training.

[0081] like Figure 3 As shown, in one embodiment, the step of determining each training sample as a simple sample, a normal sample, or a difficult sample according to its contribution to the generalization ability of the model includes steps S301 to S305, wherein:

[0082] Step S301: determine whether the training loss parameter of the training sample is greater than or equal to a preset loss threshold.

[0083] Step S302: If the training loss parameter of the training sample is greater than or equal to a preset loss threshold, the training sample is determined to be a difficult sample.

[0084] Step S303: If the training loss parameter of the training sample is less than the loss threshold, it is determined whether the penalty score of the training sample is greater than or equal to a preset penalty score threshold.

[0085] Step S304: If the training loss parameter of the training sample is less than the loss threshold, and the penalty score is greater than or equal to the preset penalty score threshold, the training sample is determined to be a normal sample.

[0086] Step S305: If the training loss parameter of the training sample is less than the loss threshold and the penalty score is less than the penalty score threshold, the training sample is determined to be a simple sample.

[0087] When the training loss parameter is greater than or equal to the loss threshold, it indicates that the probability output value of the training sample output by the training model is significantly different from the expected output value. Such samples contribute more to the generalization ability of the model and are classified as difficult samples. When the training loss parameter is less than the loss threshold and the penalty score is greater than or equal to the penalty score threshold, it indicates that the probability output value of the training sample output by the training model is slightly different from the expected output value, but is more misclassified. The training model has not learned any discriminative features. Therefore, such samples are helpful in improving the generalization ability of the model and are classified as normal samples. When the training loss parameter is less than the loss threshold and the penalty score is less than the penalty score threshold, it indicates that the probability output value of the training sample output by the training model is slightly different from the expected output value. The training model can quickly and correctly classify such samples, and their contribution to the generalization ability of the model is low, so they are classified as simple samples.

[0088] like Figure 4 As shown, in one embodiment, the step of constructing a target sample set based on each normal sample and each difficult sample includes steps S401 to S404, wherein:

[0089] Step S401: Identify redundant samples in normal samples.

[0090] Among them, redundant samples refer to training samples that are highly similar to themselves in each normal sample. For example, if training sample A and training sample B are highly similar in each normal sample, then training sample A and training sample B are redundant samples to each other.

[0091] Step S402: If there are redundant samples in each normal sample, some samples are randomly selected from each redundant sample and added to the target sample set.

[0092] If all training samples with high similarity are put into training, the training model's learning of the same features will be strengthened, causing the training model to learn data features with a relatively concentrated distribution, which is not conducive to the diversity of learning features of the training model and reduces the diversity and generalization ability of the training model. Therefore, some redundant samples can be randomly selected for training to improve the diversity and generalization ability of the training model.

[0093] Step S403: adding the remaining samples in each normal sample except the redundant samples to the target sample set.

[0094] For normal samples other than redundant samples, since the training model has not learned discriminative features, these samples are helpful in improving the generalization ability of the model and can be added to the target sample set for training. In one embodiment, if there are no redundant samples among the normal samples, all normal samples are added to the target sample set.

[0095] Step S404: adding each difficult sample to the target sample set.

[0096] The probability output value of the difficult sample output by the training model is quite different from the expected output value, which is helpful to improve the generalization ability of the model. Therefore, all difficult samples are added to the target sample set for training.

[0097] It should be noted that step S404 can also be executed first, that is, each difficult sample is first added to the target sample set, and then the normal samples are screened; if no redundant samples are identified, S403 can be executed directly after executing step S401. There is no restriction on the execution order of the steps in this embodiment.

[0098] In one embodiment, identifying redundant samples in normal samples includes:

[0099] Calculate the difference parameter based on the training loss parameter and penalty score of any two normal samples;

[0100] If the difference parameter of two normal samples is less than a preset difference threshold, both normal samples are determined to be redundant samples.

[0101] The difference threshold is used to determine whether the similarity between two normal samples reaches the threshold required to be identified as redundant samples. If the difference parameter between the two normal samples is greater than or equal to the difference threshold, the difference between the two normal samples is large and should not be identified as redundant samples. If the difference parameter between the two normal samples is less than the difference threshold, the difference between the two normal samples is small and should be identified as redundant samples.

[0102] In one embodiment, the calculating the difference parameter based on the training loss parameter and penalty score of any two normal samples includes:

[0103] The sum of the two norms of the difference in the training loss parameters of the two normal samples and the two norms of the difference in the penalty scores is calculated as the difference parameter.

[0104] Specifically, the difference parameter Q can be calculated according to the following formula:

[0105] Q=||L t (x i )-L t (x j)||2+||ψ(x i )-ψ(x j )||2

[0106] Among them, x j is the jth training sample.

[0107] In one embodiment, redundant samples in normal samples are identified, and similarity between two normal samples is calculated to determine whether they are redundant samples.

[0108] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0109] The sample screening device provided in an embodiment of the present application is described below. The sample screening device described below and the sample screening method described above can be referenced to each other.

[0110] like Figure 5 As shown, the embodiment of the present application provides a sample screening device 500, comprising:

[0111] A calculation module 501 is configured to calculate, before executing the (n+1)th round of model training, a training loss parameter and a penalty score for each training sample in the training process from the (nm)th round to the nth round; wherein the training loss parameter is used to represent the average training loss degree of the training sample in the training process from the (nm)th round to the nth round, and the penalty score is used to represent the proportion of the training sample correctly classified by the trained model in the training process from the (nm)th round to the nth round; n>m, and both n and m are positive integers;

[0112] The sample classification module 502 is configured to classify each training sample as a simple sample, a normal sample, or a difficult sample based on its contribution to the generalization ability of the model. The contribution of the training sample to the generalization ability of the model is determined based on the training loss parameter and penalty score of each training sample. The contribution of difficult samples is higher than that of normal samples, and the contribution of normal samples is higher than that of simple samples.

[0113] The target sample set construction module 503 is used to construct a target sample set based on each normal sample and each difficult sample; the target sample set is used to participate in the (n+1)th round of model training.

[0114] In one embodiment, the computing module includes:

[0115] The first calculation unit is used to calculate the loss gradient norm of each training sample in each round from the nmth round to the nth round of training; the loss gradient norm is used to represent the Euclidean distance between the probability output value of the training sample in each round of training and the expected output value of the training sample;

[0116] The second calculation unit is used to calculate the average value of the loss gradient two norm of the training sample in the training process from the nmth round to the nth round as the training loss parameter;

[0117] A first score calculation unit is used to obtain a first score according to the product of a preset correct classification score and the number of times the training sample is correctly classified by the training model during the (nm)th round to the nth round of training;

[0118] A second score calculation unit is used to obtain a second score according to the product of a preset misclassification score and the number of times the training sample is misclassified by the training model during the (nm)th round to the nth round of training;

[0119] The penalty score calculation unit is used to obtain the penalty score of the training sample by subtracting the difference between the first score and the second score from the preset initial penalty score.

[0120] In one embodiment, the sample classification module includes:

[0121] A first judgment unit is used to judge whether the training loss parameter of the training sample is greater than or equal to a preset loss threshold;

[0122] A difficult sample classification unit, configured to determine a training sample as a difficult sample when a training loss parameter of the training sample is greater than or equal to a preset loss threshold;

[0123] A second judgment unit is used to judge whether the penalty score of the training sample is greater than or equal to a preset penalty score threshold when the training loss parameter of the training sample is less than the loss threshold;

[0124] A normal sample classification unit is configured to determine that a training sample is a normal sample when a training loss parameter of the training sample is less than a loss threshold and a penalty score is greater than or equal to a preset penalty score threshold;

[0125] The simple sample classification unit is used to determine that a training sample is a simple sample when a training loss parameter of the training sample is less than a loss threshold and a penalty score is less than a penalty score threshold.

[0126] In one embodiment, the target sample set construction module includes:

[0127] A redundant sample identification unit, used to identify redundant samples in each normal sample;

[0128] A random screening unit, configured to randomly select some samples from each redundant sample and add them to the target sample set when there are redundant samples in each normal sample;

[0129] a normal sample extraction unit, configured to add the remaining samples except the redundant samples from each normal sample to the target sample set;

[0130] The difficult sample extraction unit is used to add each difficult sample to the target sample set.

[0131] In one embodiment, the redundant sample identification unit is used to calculate a difference parameter based on the training loss parameter and penalty score of any two normal samples; when the difference parameter of the two normal samples is less than a preset difference threshold, both normal samples are determined to be redundant samples.

[0132] In one of the real-time processes, the redundant sample identification unit is used to calculate the sum of the binary norm of the difference in training loss parameters and the binary norm of the difference in penalty scores of two normal samples as a difference parameter. When the difference parameter of the two normal samples is less than a preset difference threshold, both normal samples are determined to be redundant samples.

[0133] The division of the various modules in the above-mentioned sample screening device is for illustrative purposes only. In other embodiments, the sample screening device can be divided into different modules as needed to complete all or part of the functions of the above-mentioned sample screening device. The various modules in the above-mentioned sample screening device can be implemented in whole or in part through software, hardware, or a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of the above-mentioned modules.

[0134] In one embodiment, the present application further provides a storage medium having computer-readable instructions stored therein. When the computer-readable instructions are executed by one or more processors, the following steps are implemented:

[0135] Before executing the (n+1)th round of model training, calculate the training loss parameters and penalty scores of each training sample during the (nm)th round to the nth round of training;

[0136] Each training sample is classified as a simple sample, a normal sample, or a difficult sample according to its contribution to the generalization ability of the model;

[0137] A target sample set is constructed based on each normal sample and each difficult sample; the target sample set is used to participate in the (n+1)th round of model training.

[0138] In one embodiment, the computer readable instructions, when executed by a processor, further implement the following steps:

[0139] Calculate the loss gradient norm of each training sample in each round from the (nm)th round to the nth round of training;

[0140] Calculate the average value of the loss gradient 2 norm of the training sample from the (nm)th round to the nth round of training as the training loss parameter;

[0141] A first score is obtained according to the product of a preset correct classification score and the number of times the training sample is correctly classified by the training model during the (nm)th round to the nth round of training;

[0142] A second score is obtained by multiplying a preset misclassification score and the number of times the training sample is misclassified by the training model during the (nm)th round to the nth round of training;

[0143] The penalty score of the training sample is obtained by subtracting the difference between the first score and the second score from the preset initial penalty score.

[0144] In one embodiment, the computer readable instructions, when executed by a processor, further implement the following steps:

[0145] If the training loss parameter of a training sample is greater than or equal to a preset loss threshold, the training sample is determined to be a difficult sample;

[0146] If the training loss parameter of the training sample is less than the loss threshold, and the penalty score is greater than or equal to the preset penalty score threshold, the training sample is determined to be a normal sample;

[0147] If the training loss parameter of a training sample is less than the loss threshold and the penalty score is less than the penalty score threshold, the training sample is determined to be a simple sample.

[0148] In one embodiment, the computer readable instructions, when executed by a processor, further implement the following steps:

[0149] Identify redundant samples in each normal sample;

[0150] If there are redundant samples in each normal sample, some samples are randomly selected from each redundant sample and added to the target sample set;

[0151] Add the remaining samples except redundant samples in each normal sample to the target sample set;

[0152] Add each difficult sample to the target sample set.

[0153] In one embodiment, the computer readable instructions, when executed by a processor, further implement the following steps:

[0154] Calculate the difference parameter based on the training loss parameter and penalty score of any two normal samples;

[0155] If the difference parameter of two normal samples is less than a preset difference threshold, both normal samples are determined to be redundant samples.

[0156] In one embodiment, the computer readable instructions, when executed by a processor, further implement the following steps:

[0157] The sum of the two norms of the difference in the training loss parameters of the two normal samples and the two norms of the difference in the penalty scores is calculated as the difference parameter.

[0158] In one embodiment, the present application further provides a computer device having computer-readable instructions stored therein. When the computer-readable instructions are executed by one or more processors, the one or more processors are caused to perform the following steps:

[0159] Before executing the (n+1)th round of model training, calculate the training loss parameters and penalty scores of each training sample during the (nm)th round to the nth round of training;

[0160] Each training sample is classified as a simple sample, a normal sample, or a difficult sample according to its contribution to the generalization ability of the model;

[0161] A target sample set is constructed based on each normal sample and each difficult sample; the target sample set is used to participate in the (n+1)th round of model training.

[0162] In one embodiment, when the processor executes the computer readable instructions, it further performs the following steps:

[0163] Calculate the loss gradient norm of each training sample in each round from the (nm)th round to the nth round of training;

[0164] Calculate the average value of the loss gradient 2 norm of the training sample from the (nm)th round to the nth round of training as the training loss parameter;

[0165] A first score is obtained according to the product of a preset correct classification score and the number of times the training sample is correctly classified by the training model during the (nm)th round to the nth round of training;

[0166] A second score is obtained by multiplying a preset misclassification score and the number of times the training sample is misclassified by the training model during the (nm)th round to the nth round of training;

[0167] The penalty score of the training sample is obtained by subtracting the difference between the first score and the second score from the preset initial penalty score.

[0168] In one embodiment, when the processor executes the computer readable instructions, it further performs the following steps:

[0169] If the training loss parameter of a training sample is greater than or equal to a preset loss threshold, the training sample is determined to be a difficult sample;

[0170] If the training loss parameter of the training sample is less than the loss threshold, and the penalty score is greater than or equal to the preset penalty score threshold, the training sample is determined to be a normal sample;

[0171] If the training loss parameter of a training sample is less than the loss threshold and the penalty score is less than the penalty score threshold, the training sample is determined to be a simple sample.

[0172] In one embodiment, when the processor executes the computer readable instructions, it further performs the following steps:

[0173] Identify redundant samples in each normal sample;

[0174] If there are redundant samples in each normal sample, some samples are randomly selected from each redundant sample and added to the target sample set;

[0175] Add the remaining samples except redundant samples in each normal sample to the target sample set;

[0176] Add each difficult sample to the target sample set.

[0177] In one embodiment, when the processor executes the computer readable instructions, it further performs the following steps:

[0178] Calculate the difference parameter based on the training loss parameter and penalty score of any two normal samples;

[0179] If the difference parameter of two normal samples is less than a preset difference threshold, both normal samples are determined to be redundant samples.

[0180] In one embodiment, when the processor executes the computer readable instructions, it further performs the following steps:

[0181] The sum of the two norms of the difference in the training loss parameters of the two normal samples and the two norms of the difference in the penalty scores is calculated as the difference parameter.

[0182] Schematically, in one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a sample screening method is implemented.

[0183] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a sample screening method is implemented. The display screen of the computer device can be a liquid crystal display or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse.

[0184] Those skilled in the art will understand that Figure 6 and Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0185] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.

[0186] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0187] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features. Throughout the description of this application, "plurality" means at least two, for example, two, three, etc., unless otherwise specifically defined.

[0188] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referenced to each other.

[0189] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A sample screening method, characterized in that: Applied to the classification and detection of images and videos; the method includes: Before executing the (n+1)th round of model training, calculate the training loss parameter and penalty score of each training sample in the training process from the (nm)th round to the nth round; wherein the training loss parameter is used to represent the average training loss degree of the training sample in the training process from the (nm)th round to the nth round, and the penalty score is used to represent the proportion of the number of times the training sample is correctly classified by the trained model in the training process from the (nm)th round to the nth round; n>m, and n and m are both positive integers; the training loss parameter of the training sample is positively correlated with the size of the average training loss degree; and the penalty score of the training sample is negatively correlated with the proportion of the number of times the trained model is correctly classified; Each training sample is classified as a simple sample, a normal sample, or a difficult sample according to its contribution to the generalization ability of the model; wherein the contribution of the training sample to the generalization ability of the model is determined based on the training loss parameter and penalty score of each training sample; the contribution of difficult samples is higher than that of normal samples, and the contribution of normal samples is higher than that of simple samples; Construct a target sample set based on each normal sample and each difficult sample; the target sample set is used to participate in the (n+1)th round of model training; The calculation of the training loss parameters of each training sample during the training process from the nmth round to the nth round includes: Calculate the loss gradient norm of each training sample in each round from the nmth round to the nth round of training; the loss gradient norm is used to represent the Euclidean distance between the probability output value of the training sample in each round of training and the expected output value of the training sample; The average value of the second norm of the loss gradient of the training sample in the training process from the nmth round to the nth round is calculated as the training loss parameter.

2. The sample screening method according to claim 1, characterized in that: Calculate the penalty score of each training sample during the training process from the (nm)th round to the nth round, including: Obtaining a first score according to the product of a preset correct classification score and the number of times the training sample is correctly classified by the training model during the (nm)th round to the nth round of training; Obtaining a second score according to the product of a preset misclassification score and the number of times the training sample is misclassified by the training model during the (nm)th round to the nth round of training; The penalty score of the training sample is obtained by subtracting the difference between the first score and the second score from the preset initial penalty score.

3. The sample screening method according to claim 1 or 2, characterized in that: Determining each training sample as a simple sample, a normal sample, or a difficult sample according to its contribution to the generalization ability of the model includes: If the training loss parameter of a training sample is greater than or equal to a preset loss threshold, the training sample is determined to be a difficult sample; If the training loss parameter of the training sample is less than the loss threshold, and the penalty score is greater than or equal to the preset penalty score threshold, the training sample is determined to be a normal sample; If the training loss parameter of the training sample is less than the loss threshold and the penalty score is less than the penalty score threshold, the training sample is determined to be a simple sample.

4. The sample screening method according to claim 1, characterized in that: The target sample set is constructed based on each normal sample and each difficult sample, including: Identify redundant samples in each normal sample; If there are redundant samples in each normal sample, some samples are randomly selected from each redundant sample and added to the target sample set; Adding the remaining samples except the redundant samples in each normal sample to the target sample set; Each difficult sample is added to the target sample set.

5. The sample screening method according to claim 4, characterized in that: The identifying of redundant samples in normal samples includes: Calculate the difference parameter based on the training loss parameter and penalty score of any two normal samples; If the difference parameter of two normal samples is less than a preset difference threshold, the two normal samples are determined to be redundant samples.

6. The sample screening method according to claim 5, characterized in that: The calculation of the difference parameter based on the training loss parameter and penalty score of any two normal samples includes: The sum of the two norms of the difference between the training loss parameters of the two normal samples and the two norms of the difference between the penalty scores is calculated as the difference parameter.

7. A sample screening device, characterized in that: Applicable to the classification and detection of images and videos; the device includes: a calculation module for calculating, before executing the (n+1)th round of model training, a training loss parameter and a penalty score for each training sample in the process of training from the (nm)th round to the nth round; wherein the training loss parameter is used to represent the average training loss degree of the training sample in the process of training from the (nm)th round to the nth round, and the penalty score is used to represent the proportion of the number of times the training sample is correctly classified by the trained model in the process of training from the (nm)th round to the nth round; n>m, and n and m are both positive integers; the training loss parameter of the training sample is positively correlated with the average training loss degree; and the penalty score of the training sample is negatively correlated with the proportion of the number of times the training model is correctly classified; A sample classification module is configured to classify each training sample as a simple sample, a normal sample, or a difficult sample based on its contribution to the generalization ability of the model; wherein the contribution of the training sample to the generalization ability of the model is determined based on the training loss parameter and penalty score of each training sample; the contribution of difficult samples is higher than that of normal samples, and the contribution of normal samples is higher than that of simple samples; A target sample set construction module is used to construct a target sample set based on each normal sample and each difficult sample; the target sample set is used to participate in the (n+1)th round of model training; Wherein, the calculation module includes: The first calculation unit is used to calculate the loss gradient 2 norm of each training sample in each round of training from the nmth round to the nth round; the loss gradient 2 norm is used to represent the Euclidean distance between the probability output value of the training sample in each round of training and the expected output value of the training sample; The second calculation unit is used to calculate the average value of the second norm of the loss gradient of the training sample in the training process from the (nm)th round to the nth round as the training loss parameter.

8. A storage medium, characterized in that: The storage medium stores computer-readable instructions, which, when executed by one or more processors, enable the one or more processors to perform the steps of the sample screening method according to any one of claims 1 to 6.

9. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, which, when executed by the one or more processors, perform the steps of the sample screening method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • A method and application of face recognition model based on ParaSoftMax loss function

    CN109214360A

  • Negative sample screening model training method, data screening method and data matching method

    CN110309874A