Model training method and electronic equipment

By using label ensemble and data mixing technology during the training of deep learning models, the problem of deep learning models' declining recognition performance in severe noise scenarios is solved, and better recognition performance and robustness are achieved.

CN119493989APending Publication Date: 2025-02-21HUAWEI TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311056572.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-18
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

The recognition performance of existing deep learning models has dropped sharply in severe background noise scenarios, even causing the system to fail to work properly.

Method used

A training method is adopted to train the classifier model by obtaining multiple raw data samples and their corresponding tags, mixing the training sample data, and using the tag set to cooperate as the label of the training sample data. Specific steps include uniform sampling to obtain mixed weights, generating training sample data, and using binary cross entropy as a loss function.

Benefits of technology

Through label collection and data mixing, a better classifier model is built in the context of severe noise, which improves the recognition performance of the recognition model in the noise scenario and enhances the robustness of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119493989A_ABST
    Figure CN119493989A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a training method and electronic equipment. The method is applied to the electronic equipment and comprises the steps that n original data samples and n original labels corresponding to the n original data samples are obtained, and n is an integer larger than or equal to 2; mixing the n original data samples to generate training sample data; generating a label set, wherein the label set comprises at least two original labels in the n original labels; taking the label set as a label corresponding to the training sample data; and training a classifier model by using the training sample data and the labels corresponding to the training sample data. According to the method provided by the embodiment of the invention, the training sample data is generated through data mixing, and the tag set is adopted as the tag corresponding to the training sample data, so that a classifier model with a better classification effect can be constructed under a severe noise background, and the recognition experience of a recognition model is promoted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of deep learning technology, and in particular to a training method and electronic device. Background Art

[0002] With the iteration and update of deep learning technology, the application performance in the fields of image and voice has continued to break through and achieved extraordinary practical results. However, there are still many difficult problems that need to be solved, one of which is the problem of severe background noise interference.

[0003] Currently, under noise-free or light-noise conditions, excellent application results can be achieved for recognition tasks in image, speech or other fields. However, in scenarios with severe background noise (for example, recognizing a speech keyword in a noise environment with 10 times the energy of the keyword speech; recognizing a specified image from a mixed set of images, etc.), the performance will drop sharply and may even cause the system to fail to work properly.

[0004] Therefore, a new model training method is needed to improve the recognition performance of the recognition model in severe noise scenarios. Summary of the invention

[0005] In order to solve the problem of how to improve the recognition performance of a recognition model in severe noise scenarios, the present application provides a training method and an electronic device, and the present application also provides a computer-readable storage medium.

[0006] The present application embodiment adopts the following technical solutions:

[0007] In a first aspect, the present application provides a training method, the method comprising:

[0008] Obtain n original data samples and n original labels corresponding to the n original data samples, where n is an integer greater than or equal to 2;

[0009] Mixing the n original data samples to generate training sample data;

[0010] Generate a label set, wherein the label set includes at least two original labels among the n original labels;

[0011] Using the label set as labels corresponding to the training sample data;

[0012] The classifier model is trained using the training sample data and labels corresponding to the training sample data.

[0013] According to the method of one embodiment of the present application, label aggregation is proposed to solve the contradiction that the relationship between mixed data and labels is one-to-many in theory, but is restricted to a one-to-one relationship during the training representation process, so that the theoretical facts are fully matched with the training process, reducing data fluctuations caused by contradictions in theoretical assumptions.

[0014] According to the method of one embodiment of the present application, training sample data is generated by data mixing and a label set is used as the label corresponding to the training sample data. This can help build a classifier model with better classification effect under severe noise background (for example, identifying the voice keyword in a noise environment with 10 times the energy of the keyword voice; identifying a specified picture from a mixed picture, etc.), so as to help improve the recognition experience of recognition models (for example, voice keyword recognition, speech recognition, speaker recognition, image recognition, text recognition).

[0015] In an implementation manner of the first aspect, the tag set includes all original tags among the n original tags.

[0016] In an implementation of the first aspect, mixing the n original data samples to generate training sample data includes:

[0017] Performing n independent uniform sampling on the n original data samples to obtain n sampling results;

[0018] The n sampling results are respectively used as mixing weights of the n original data samples.

[0019] According to the method of the embodiment of the present application, by uniformly sampling and obtaining the mixing weights of each original data sample, the randomness of data mixing in real life can be simulated, so that the training sample data is more in line with the real scene. Taking audio data as an example, the weighted mixed data generation method based on uniform sampling weights can simulate the random mixing state of sound data in real life, and take into account the superposition of speech signals and the perceptual behavior of the human ear auditory system.

[0020] In an implementation of the first aspect, mixing the n original data samples to generate training sample data includes:

[0021] Divide n original data samples into multiple groups, each group contains one or more original data samples, and different groups contain different original data samples;

[0022] Mixing weights are assigned to the n original data samples respectively, wherein the original data samples in the same group use the same mixing weight, and the original data samples in different groups use different mixing weights.

[0023] In an implementation of the first aspect, mixing the n original data samples to generate training sample data includes:

[0024] The n original data samples are respectively assigned mixing weights by random assignment.

[0025] In an implementation of the first aspect, the method further includes:

[0026] Obtain m original data samples and m original labels corresponding to the m original data samples respectively;

[0027] Generate z groups of data based on m original data samples, where z is an integer greater than or equal to 2, where:

[0028] The z groups of data at least include a first data group, and the first data group includes the n original data samples;

[0029] In the z groups of data: the number of original data samples contained in each data group is n; or the number of original data samples contained in different data groups is different; or there are at least two data groups, and the number of original data samples contained in the two data groups is the same;

[0030] In the z data groups: original data samples contained in different data groups are completely different; or, there are at least two data groups, and the two data groups contain the same original sample data.

[0031] In an implementation manner of the first aspect, a classifier model is trained using the training sample data and labels corresponding to the training sample data, wherein binary cross entropy is used as a loss function.

[0032] According to the method of an embodiment of the present application, binary cross entropy is used instead of cross entropy as the loss function. Since the binary cross entropy function has no requirements on the probability and of the output label, it directly represents the probability of each output label, and the interpretability is more complete, which can solve the problem that the recognition results need to be sorted. In addition, by using binary cross entropy instead of cross entropy as the loss function, there is no need to traverse all labels, and it is convenient to directly output the existing keywords and the corresponding probabilities, and it is convenient to help identify the post-processing module to execute the response instruction by specifying the threshold. Compared with the traditional cross entropy function, the post-processing response time is short and the configurability is strong.

[0033] In an implementation of the first aspect, training a classifier model using the training sample data and labels corresponding to the training sample data includes:

[0034] Extracting feature data of the training sample data;

[0035] Inputting the feature data into a classifier model to generate a prediction value;

[0036] Calling the binary cross entropy as a loss function, and generating a loss value according to the predicted value and the label corresponding to the training sample data;

[0037] Calling an optimization algorithm to process the loss value to obtain an optimization result;

[0038] According to the optimization results, the classifier model parameters are updated to generate new model parameters;

[0039] The classifier model is adjusted according to the new model parameters.

[0040] In a second aspect, the present application provides an electronic device, comprising a memory for storing computer program instructions and a processor for executing computer program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method steps described in the first aspect.

[0041] In a third aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 The figure shows the characteristics of the training sample data;

[0043] Figure 2 The figure shows the characteristics of the training sample data;

[0044] Figure 3 The figure shows the characteristics of the training sample data;

[0045] Figure 4 The figure is a schematic diagram of a classifier model training scenario according to an embodiment of the present application;

[0046] Figure 5 The figure is a schematic diagram of the classifier model training process according to an embodiment of the present application;

[0047] Figure 6 FIG. 4 is a probability distribution diagram of uniform sampling according to an embodiment;

[0048] Figure 7 Shown is a flow chart of obtaining training sample data according to an embodiment of the present application;

[0049] Figure 8 The figure shows the characteristics of the training sample data;

[0050] Fig. 9Shown is a flow chart of classifier model training according to an embodiment of the present application;

[0051] Fig.10 Shown is a schematic diagram of a cross entropy function according to an embodiment of the present application;

[0052] Fig.11 Shown is a schematic diagram of a binary cross entropy function according to an embodiment of the present application;

[0053] Fig.12 Schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

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

[0055] The terms used in the implementation section of this application are only used to explain the specific embodiments of this application and are not intended to limit this application.

[0056] In the process of training the recognition model, sample data without noise is usually used as training data, and each training data has a unique corresponding label. The model is trained under the supervised learning principle and is directly used as the recognition model.

[0057] Figure 1 The figure shows a characteristic diagram of training sample data.

[0058] like Figure 1 As shown, 101, 102, 103 and 104 represent four different original sample data used for model input (x: input). 111, 112, 113 and 114 are the original labels (y: label) corresponding to the original sample data. The original sample data is used as the training sample data, and the original label corresponding to the original sample data is used as the label corresponding to the training sample data.

[0059] Each training sample data corresponds to a label, and the characteristics of the training sample data are consistent with the label (the training sample data is noise-free).

[0060] Since the training data uses noise-free training sample data, the model cannot learn the distribution of noise data and is therefore completely immune to noise. In the prediction and recognition stage, when the input data has slight noise, the performance will drop significantly, and it will not be able to cope with the problem of input data with severe noise.

[0061] A feasible solution to the problem that the recognition model is not resistant to noise due to the lack of noise in the training data is to use data augmentation (DA). Data augmentation (DA) technology is an effective method to solve the problem of data mismatch caused by the fact that the real application environment is full of unpredictable noise and the training data cannot cover these noise scenarios. The characteristic of data augmentation technology is that it randomly mixes noise data in the input data samples and maintains the correspondence between the original training data samples and the labels, so as to increase the learning path of the model to noise.

[0062] Figure 2 The figure shows a characteristic diagram of training sample data.

[0063] like Figure 2 As shown, 201, 202, 203, and 204 refer to four original sample data without noise (x: input), and the labels corresponding to 201, 202, 203, and 204 are 231, 232, 233, and 234 (y: label), respectively.

[0064] 211, 212, 213, and 214 respectively represent four random noise data.

[0065] Mix 201, 202, 203, 204 with 211, 212, 213, 214 in pairs to generate 4 noisy training sample data 221, 222, 223, 224. 221, 222, 223, 224 correspond to labels 231, 232, 233, 234 respectively.

[0066] Using the noisy training sample data 221, 222, 223, and 224 to train the recognition model can enhance the recognition model's ability to resist noise.

[0067] The data augmentation method introduces noise disturbance into the training sample data, allowing the model to learn the noise distribution outside the original training data. Therefore, it has a certain robustness to ordinary noise interference and can guarantee system performance in non-extremely severe noise environments. However, when dealing with extremely severe noise (for example, noise with 10 times the energy of the original data or the same type of aliasing interference), the performance will still be greatly reduced.

[0068] Another feasible solution to the problem that the recognition model is not resistant to noise due to the lack of noise in the training sample data is to use a mixed (mixup) training method. This method has a significant performance improvement in the recognition of the same type of data superposition. Its principle is to generate a new training sample data by linear interpolation of any two original sample data, and at the same time, to combine the original labels corresponding to the original sample data through linear interpolation with the same parameters to generate a new label corresponding to the new training sample data. The linear interpolation parameters conform to the Beta distribution, as shown in the following formula 1:

[0069] x′=λx i +(1-λ)x j λ~Beta(0.2,0.2)

[0070] y′=λy i +(1-λ)y j . (Formula 1)

[0071] Figure 3 The figure shows a characteristic diagram of training sample data.

[0072] like Figure 3 As shown, 301, 302, 303, and 304 respectively refer to four original sample data without noise (x: input). The labels corresponding to 301, 302, 303, and 304 are 311, 312, 313, and 314 (y: label), respectively.

[0073] Generate a new training sample data 321 (mixed x) by linear interpolation of 301 and 302, and generate a label 331 (mixed y) corresponding to the training sample data 321 by combining the labels 311 and 312 corresponding to 301 and 302 respectively through linear interpolation with the same parameters; generate a new training sample data 322 (mixed x) by linear interpolation of 302 and 303, and generate a label 332 (mixed y) corresponding to the training sample data 322 by combining the labels 312 and 313 corresponding to 302 and 303 respectively through linear interpolation with the same parameters; generate a new training sample data 323 (mixed x) by linear interpolation of 303 and 304, and generate a label 333 (mixed y) corresponding to the training sample data 323 by combining the labels 313 and 314 corresponding to 303 and 304 respectively through linear interpolation with the same parameters.

[0074] The above method directly uses the original sample data to generate new training sample data through linear interpolation, so that the new training sample data naturally has the characteristics of superposition of the same type of data. Therefore, the model can also learn the characteristics of superposition of the same type, so it can deal with the situation of superposition of the same type of data well. However, since the training sample data is generated by linear interpolation, the generalization of the training sample data is limited, so it is not able to resist the interference of different types of data (such as noise). In addition, only two original sample data are allowed to be linearly superimposed, which cannot cope with the situation of superposition of multiple (greater than 2) data of the same type. Moreover, the labels corresponding to the training sample data are also obtained by linear interpolation. Whether such labels exist in theory is questionable, resulting in the incomplete theoretical basis of this technology.

[0075] In view of the above problems, an embodiment of the present application provides a training method. In the method according to an embodiment of the present application, in terms of training data generation, a linear interpolation scheme is not adopted to solve the problem of insufficient generalization of the generated training data samples; then, linear interpolation is not adopted to generate labels corresponding to new training data samples to solve the theoretical assumption problem of "new labels exist in real situations".

[0076] Figure 4 Shown is a schematic diagram of a classifier model training scenario according to an embodiment of the present application.

[0077] like Figure 4 As shown, the training data 400 includes training sample data 401 and labels 402 corresponding to the training sample data 401. The training sample data 401 represents a digital sample of a real scene, which can be directly sampled from the corresponding scene or generated by technical means. The label 402 is the classification result of the classifier based on the training sample data 401 under an ideal state.

[0078] In the process of training the classifier, the training sample data 401 is input to the feature extraction module 402. The feature extraction module 402 converts the training sample data 401 into feature data, which can compress the data volume and also more accurately characterize the main characteristics of the training sample data 401.

[0079] The feature data and label 402 are input to the model training module 403. The model training module 403 is used to adjust the model parameters of the classifier under specific training criteria, so that the classifier conforms to the feature distribution of the training data as much as possible, so that the recognition result of the classifier tends to the label 402, thereby training and obtaining the classifier 404. The classifier 404 is a mathematical model obtained by training, which can classify samples.

[0080] Figure 5 The figure is a schematic diagram of the classifier model training process according to an embodiment of the present application.

[0081] In one embodiment, the classifier training process includes the following steps: Figure 5 The following steps are shown.

[0082] S500, obtaining training data 401.

[0083] Specifically, S500 includes two steps: (S501) obtaining training sample data; and (S502) obtaining labels corresponding to the training sample data.

[0084] In S501 , in one embodiment, multiple original data samples are mixed into one training sample data.

[0085] For example, n original data samples (x1, x2, ..., xn) are mixed to generate new training data samples, where the n original data samples are not limited to the same type of data, and n is an integer greater than or equal to 2.

[0086] According to the method of the embodiment of the present application, multiple original data samples are mixed into one training sample data, so that the data characteristics are richer.

[0087] Furthermore, in one embodiment, for m original data samples (m is an integer greater than n), n original data samples are randomly selected therefrom to generate a training sample data.

[0088] For example, z (z is an integer greater than or equal to 2) groups of data are generated based on m original data samples, and all original data samples contained in each group of data are mixed to generate z training sample data. The z groups of data at least include a first data group, and the first data group includes n original data samples.

[0089] Furthermore, in another embodiment, the number of original data samples included in different data groups may be the same or different. That is, among the z groups of data, the number of original data samples included in different data groups is different; or, among the z groups of data, there are at least two data groups that include different numbers of original data samples.

[0090] Furthermore, in another embodiment, the original data samples contained in different data groups may be completely different, or different groups may contain the same original sample data. That is, in the z groups of data: the original data samples contained in different data groups are completely different; or there are at least two data groups, and the two data groups contain the same original sample data.

[0091] Specifically, in one embodiment, in the process of mixing n original data samples, the n original data samples use the same mixing weight. For example, for n audio data samples, when mixing n audio data samples, the energy of each audio data sample is the same.

[0092] In another embodiment, in the process of mixing n original data samples, the n original data samples are divided into multiple groups, each group contains one or more original data samples. The original data samples in the same group use the same mixing weight, and the original data samples in different groups use different mixing weights.

[0093] In another embodiment, in the process of mixing n original data samples, a random assignment method is used to assign mixing weights to the n original data samples respectively.

[0094] Figure 6 FIG. 4 is a probability distribution diagram of uniform sampling according to an embodiment.

[0095] Considering that in real life, the probability of any data sample appearing is random, for example, the probability of any sound (human voice, noise, music, etc.) appearing is random, and the probability of any picture / text appearing is also random, which can be regarded as uniform distribution. The probability distribution diagram of uniform sampling is as follows Figure 6 As shown. Therefore, data mixing in the real world should be carried out in a completely independent and random state. Therefore, the uniform sampling weight method can simulate the mixing of the same type of data, the mixing of valid data and noise data, and the mixing of other arbitrary data.

[0096] Therefore, in one embodiment, in the process of mixing n original data samples, a uniform sampling weight method is used to assign weights to the n original data samples respectively.

[0097] Specifically, Figure 7 Shown is a flowchart of obtaining training sample data according to an embodiment of the present application.

[0098] In one implementation of S501, the following is performed: Figure 7 The following steps are shown.

[0099] S700, obtaining n original data samples (x1, x2, ..., xn).

[0100] S701, according to the number n of original data samples to be mixed, perform n independent uniform samplings to obtain n sampling results (obtain parameters (w1, w2, ..., wn) respectively), and the n sampling results correspond to the mixing weights of the original data samples (x1, x2, ..., xn) respectively.

[0101] S702, generating training sample data x' by weighted superposition according to the original data samples (x1, x2, ..., xn) and the corresponding mixing weights (w1, w2, ..., wn).

[0102] Specifically, the mixed data generation formula is shown in the following formula (2):

[0103] w1~Uniform(0.1,0.9)

[0104] w2~Uniform(0.1,0.9)

[0105] w3~Uniform(0.1,0.9)

[0106] …

[0107] w n ~Uniform(0.1,0.9)

[0108] x′=w1x1+w2x2+w3x3+…+w n x n . (Formula 2)

[0109] According to the method of the embodiment of the present application, by uniformly sampling and obtaining the mixing weights of each original data sample, the randomness of data mixing in real life can be simulated, so that the training sample data is more in line with the real scene. Taking audio data as an example, the weighted mixed data generation method based on uniform sampling weights can simulate the random mixing state of sound data in real life, and take into account the superposition of speech signals and the perceptual behavior of the human ear auditory system.

[0110] Further, in S501, in the process of mixing multiple original data samples, the technician can define the meaning corresponding to the mixing weight according to the data type and / or sample requirements of the original data samples, and the embodiment of the present application does not impose specific restrictions on this. For example, when mixing audio data, different mixing weights correspond to different energies (or volumes); for another example, when mixing image data, different mixing weights correspond to different brightness.

[0111] In S502, in one embodiment, the training sample data and the label are in a one-to-one relationship. The label corresponding to the training sample data may be the label of any one of the multiple original data samples used to mix and generate the training sample data; the label corresponding to the training sample data may also be the label generated by mixing the labels of any multiple original data samples used to mix and generate the training sample data; the label corresponding to the training sample data may also be the label generated by mixing the labels of multiple original data samples used to mix and generate the training sample data.

[0112] For example, in one embodiment, the training sample data is the audio corresponding to "Hello, Xiaoyi", and the label is "ni2 hao3xiao3 yi4"; if the training sample data is the aliased audio corresponding to "Hello, Xiaoyi" and "The weather is really nice today", the label can be "ni2 hao3 xiao3 yi4" or "jin1 tian1 tian1 qi4 zhen1 hao3", and the label can also be the vector superposition corresponding to "ni2hao3 xiao3 yi4" and "jin1 tian1 tian1 qi4 zhen1 hao3" (refer to Equation (1).

[0113] In S501, in another embodiment, the relationship between the training sample data and the label is one-to-many. Specifically, the label corresponding to the training sample data is a label set containing multiple labels (label set). This label set contains all the original labels corresponding to all the original data samples used to mix and generate the training sample data; or, this label set contains, among all the original data samples used to mix and generate the training sample data, multiple original labels corresponding to multiple original data samples.

[0114] Specifically, in one embodiment, the label set is generated based on the logical OR operation, and the labels corresponding to n original data samples are all represented by n-hot encoding (a string of binary digits with a length of 0, 1 if it exists, and 0 if it does not exist).

[0115] Figure 8 The figure shows a schematic diagram of the characteristics of the training sample data.

[0116] As Figure 8 shown, 801 to 80n respectively refer to n original data samples (x: input), and the labels corresponding to 801 to 80n are 811 to 81n (y: label); 80n to 80(2n - 1) respectively refer to n original data samples (x: input), and the labels corresponding to 80n to 80(2n - 1) are 81n to 81(2n - 1) (y: label); 80(2n - 1) to 80(3n - 1) respectively refer to n original data samples (x: input), and the labels corresponding to 80(2n - 1) to 80(3n - 1) are 81(2n - 1) to 81(3n - 1) (y: label).

[0117] Mix 801 to 80n to generate a training sample data 821 (mixed x), and the labels corresponding to the training sample data 821 are the label set (811, 812, ..., 81n); mix 80n to 80(2n-1) to generate a training sample data 822 (mixed x), and the labels corresponding to the training sample data 822 are the label set (80n, 80(n+1), ..., 80(2n-1)); mix 80(2n-1) to 80(3n-1) to generate a training sample data 823 (mixed x), and the labels corresponding to the training sample data 823 are the label set (80(2n-1), 80(2n), ..., 80(3n-1)).

[0118] According to the method of one embodiment of the present application, label aggregation is proposed to solve the contradiction that the relationship between mixed data and labels is one-to-many in theory, but is restricted to a one-to-one relationship during the training representation process, so that the theoretical facts are fully matched with the training process, reducing data fluctuations caused by contradictions in theoretical assumptions.

[0119] According to the method of one embodiment of the present application, training sample data is generated by data mixing and a label set is used as the label corresponding to the training sample data. This can help build a classifier model with better classification effect under severe noise background (for example, identifying the voice keyword in a noise environment with 10 times the energy of the keyword voice; identifying a specified picture from a mixed picture, etc.), so as to help improve the recognition experience of recognition models (for example, voice keyword recognition, speech recognition, speaker recognition, image recognition, text recognition).

[0120] After S500, the classifier model can be trained based on the training data 401 to obtain a model with good anti-interference ability to severe noise (for example, noise with 10 times the energy of the original data or the same type of aliasing interference) in a certain application field (speech, image, text, etc.).

[0121] Specifically, the classifier model training process includes:

[0122] S510, extracting feature data of the training sample data. (Refer to feature extraction module 402)

[0123] Specifically, in S510, the training sample data generated by the hybrid algorithm in S501 is input into the feature extraction module 402, so that the features required for model training can be extracted.

[0124] The embodiment of the present application does not limit the specific implementation process of S510, and those skilled in the art can use any solution to implement S510.

[0125] For example, in one embodiment, for audio data, audio features of a 40-dimensional Fbank vector of each frame are extracted in S510.

[0126] For another example, in one embodiment, pixel features are extracted in S510 for image data.

[0127] For another example, in one embodiment, for text data, word vector features are extracted in S510.

[0128] S520: Train a classifier model according to the feature data of the training sample data and the labels (label sets) corresponding to the training sample data.

[0129] (Refer to model training module 403)

[0130] Specifically, Fig. 9 Shown is a flow chart of classifier model training according to an embodiment of the present application.

[0131] In one embodiment, the implementation of S520 includes the following steps: Fig. 9 The following process is shown.

[0132] The feature data of the training sample data acquired in S510 is input into the classifier model 901 .

[0133] The model architecture of the classifier model 901 is related to the actual application. The model architectures corresponding to different fields may be different, and there may also be some model differences between different tasks in the same field.

[0134] The embodiment of the present application does not impose any specific limitation on the model architecture of the classifier model 901. Those skilled in the art may configure the model architecture of the classifier model 901 according to actual needs.

[0135] The classifier model 901 generates a prediction value 902 according to the feature data of the input training sample data. The prediction value 902 is a value calculated by the classifier model 901 according to the input data (the feature data of the training sample data) during the iteration process. The prediction value 902 is an objective result obtained by the feature data of the training sample data and the model architecture of the classifier model 901.

[0136] The loss function 903 is called to generate a loss value 904 according to the predicted value 902 and the label (label set) corresponding to the training sample data.

[0137] The loss function 903 is the key to guiding the direction of model training.

[0138] In one embodiment, the loss function 903 is a cross entropy function.

[0139] Fig.10FIG. 9 is a schematic diagram of a cross entropy function according to an embodiment of the present application. In one embodiment, the calculation logic of the loss function 903 is as follows: Fig.10 As shown. 1001 is the input of the loss function 903, 1002 is the loss function (fθ(.)) based on cross entropy (CrossEntropy based, CE based). 1003 is the output of the loss function.

[0140] In another embodiment, the loss function 903 is a binary cross entropy.

[0141] Binary Cross Entropy is a loss function in deep learning, which is used to measure the difference between the predicted value and the true value in a binary classification problem.

[0142] Fig.11 FIG. 9 is a schematic diagram of a binary cross entropy function according to an embodiment of the present application. In one embodiment, the calculation logic of the loss function 903 is as follows: Fig.11 As shown. 1101 is the input of the loss function 903, 1102 is the loss function (fθ(.)) based on binary cross entropy (Binary Cross Entropy based, BCE based). 1103 is the output of the loss function.

[0143] In adopting Fig.10 In the implementation of the cross entropy function shown, all labels need to be traversed. Referring to 1003, the output needs to traverse all labels (including left, right, down, ..., others).

[0144] compared to Fig.10 The cross entropy function shown, Fig.11 The binary cross entropy shown can directly output the probability of each label existing without traversing all labels. Referring to 1103, only the labels (including left, right, down) need to be output.

[0145] Furthermore, since the cross entropy function needs to traverse all labels and give the normalized probability of each label, the sum of the probabilities of all labels is 1, which makes the physical meaning of each output probability vague and requires sorting the recognition results. Referring to 1003, the width of the solid rectangle representing the label represents 1, the value corresponding to the dotted position in the solid rectangle corresponds to the normalized probability, and the sum of the values ​​corresponding to all dotted positions is 1.

[0146] The binary cross entropy function has no requirements on the probability and of the output label, and directly represents the probability of each output label. It is more interpretable and can solve the problem that the recognition results need to be sorted. Referring to 1103, the dotted position in the solid rectangle represents the probability of the corresponding label.

[0147] According to the method of one embodiment of the present application, binary cross entropy is used instead of cross entropy as the loss function. There is no need to traverse all labels, and the existing keywords and corresponding probabilities can be directly output conveniently. It can also help identify the post-processing module to execute the response instruction conveniently through the specified threshold. Compared with the traditional cross entropy function, the post-processing response time is short and the configurability is strong.

[0148] The loss value 904 is processed by an optimization algorithm 905. Specifically, in one embodiment, the optimization algorithm 905 is implemented based on the idea of ​​gradient descent.

[0149] According to the optimization result of the optimization algorithm 905, the classifier model parameters are updated to generate new model parameters 906 (model parameters 906 are the values ​​of this round of iterations obtained by the optimization algorithm 905). Based on the model parameters 906, the classifier model 901 is adjusted to complete a round of model training iterations.

[0150] Repeat multiple rounds Fig. 9 The iterative training process shown is used to complete the classifier model training.

[0151] In the description of the embodiments of the present application, for the convenience of description, the device is described by dividing it into various modules according to its functions. The division of each module is merely a division of logical functions. When implementing the embodiments of the present application, the functions of each module can be implemented in the same or one or more software and / or hardware.

[0152] Specifically, the device proposed in the embodiment of the present application can be fully or partially integrated into a physical entity during actual implementation, or it can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. For example, the detection module can be a separately established processing element, or it can be integrated in a chip of an electronic device. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. In the implementation process, each step of the above method or each of the above modules can be completed by an integrated logic circuit of hardware in a processor element or instructions in the form of software.

[0153] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital signal processors (DSP), or one or more field programmable gate arrays (FPGA), etc. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0154] An embodiment of the present application further provides an electronic device.

[0155] Fig.12 Schematic diagram of the structure of an electronic device according to an embodiment of the present application.

[0156] like Fig.12 As shown, the electronic device 900 includes a memory 902 for storing computer program instructions and a processor 901 for executing program instructions, wherein when the computer program instructions are executed by the processor 901, the electronic device 900 is triggered to execute the method steps described in the embodiments of the present application.

[0157] Specifically, in one embodiment of the present application, the above-mentioned one or more computer programs are stored in the above-mentioned memory 902, and the above-mentioned one or more computer programs include instructions. When the above-mentioned instructions are executed by the above-mentioned electronic device 900, the above-mentioned electronic device 900 executes the method steps described in the embodiment of the present application.

[0158] It is understandable that the structural description of the electronic device 900 in the embodiment of the present application does not constitute a specific limitation on the electronic device 900. In other embodiments of the present application, the electronic device 900 may include other components besides the processor 901 and the memory 902.

[0159] The processor 901 may be a device on a chip (SOC), and the processor 901 may include a central processing unit (CPU), and may further include other types of processors.

[0160] The processor involved in the processor 901 may include, for example, a CPU, a DSP, a microcontroller or a digital signal processor, and may also include a GPU, an embedded neural network processor (Neural-network Process Units, NPU) and an image signal processor (Image Signal Processing, ISP). The processor may also include necessary hardware accelerators or logic processing hardware circuits, such as ASICs, or one or more integrated circuits for controlling the execution of the program of the technical solution of the present application. In addition, the processor may have the function of operating one or more software programs, and the software programs may be stored in a storage medium.

[0161] The processor 901 may include one or more processing units. For example, the processor may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent components or integrated into one or more processors. In some embodiments, the electronic device 900 may also include one or more processors 901. The controller may generate an operation control signal based on the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

[0162] In some embodiments, the processor 901 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM card interface, and / or a USB interface, etc. Among them, the USB interface is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface can be used to connect a charger to charge an electronic device, and can also be used to transmit data between an electronic device and a peripheral device.

[0163] The electronic device 900 may also include an external memory interface, which is used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 901 through the external memory interface to implement a data storage function. For example, files such as music and videos are stored in the external memory card.

[0164] The memory 902 may include a code storage area and a data storage area. The code storage area may store an operating system. The data storage area may store data created during the use of the electronic device 900, etc. In addition, the memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (UFS), etc.

[0165] The memory 902 may be a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or may be any computer-readable medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer.

[0166] The processor 901 and the memory 902 may be integrated into one processing device, or more commonly, they are independent components.

[0167] Furthermore, the devices, apparatuses, and modules described in the embodiments of the present application may be implemented by computer chips or entities, or by products having certain functions.

[0168] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.

[0169] In the several embodiments provided in the present application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.

[0170] Specifically, in one embodiment of the present application, a computer-readable storage medium is further provided, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the method provided in the embodiment of the present application.

[0171] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is run on a computer, the computer executes the method provided by the embodiment of the present application.

[0172] The embodiments described in this application are described with reference to the flowcharts and / or block diagrams of the methods, devices (apparatus), and computer program products according to the embodiments of the application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0173] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0174] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0175] It should also be noted that in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, c can be single or multiple.

[0176] In the embodiments of the present application, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, method, commodity or device including the element.

[0177] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0178] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0179] Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments of the present application can be implemented by a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0180] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, apparatuses and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0181] The above is only a specific implementation of the present application. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. The protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A training method, characterized in that: The method comprises: Obtain n original data samples and n original labels corresponding to the n original data samples, where n is an integer greater than or equal to 2; Mixing the n original data samples to generate training sample data; Generate a label set, wherein the label set includes at least two original labels among the n original labels; Using the label set as labels corresponding to the training sample data; The classifier model is trained using the training sample data and labels corresponding to the training sample data.

2. The method according to claim 1, characterized in that: The tag set includes all original tags among the n original tags.

3. The method according to claim 1 or 2, characterized in that: The mixing of the n original data samples to generate training sample data includes: Performing n independent uniform sampling on the n original data samples to obtain n sampling results; The n sampling results are respectively used as mixing weights of the n original data samples.

4. The method according to claim 1 or 2, characterized in that: The mixing of the n original data samples to generate training sample data includes: Divide n original data samples into multiple groups, each group contains one or more original data samples, and different groups contain different original data samples; Mixing weights are assigned to the n original data samples respectively, wherein the original data samples in the same group use the same mixing weight, and the original data samples in different groups use different mixing weights.

5. The method according to claim 1 or 2, characterized in that: The mixing of the n original data samples to generate training sample data includes: The n original data samples are respectively assigned mixing weights by random assignment.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Obtain m original data samples and m original labels corresponding to the m original data samples respectively; Generate z groups of data based on m original data samples, where z is an integer greater than or equal to 2, where: The z groups of data at least include a first data group, and the first data group includes the n original data samples; In the z groups of data: the number of original data samples contained in each data group is n; or the number of original data samples contained in different data groups is different; or there are at least two data groups, and the number of original data samples contained in the two data groups is the same; In the z data groups: original data samples contained in different data groups are completely different; or, there are at least two data groups, and the two data groups contain the same original sample data.

7. The method according to any one of claims 1 to 6, characterized in that: The classifier model is trained using the training sample data and labels corresponding to the training sample data, wherein binary cross entropy is used as a loss function.

8. The method according to claim 7, characterized in that Training a classifier model using the training sample data and labels corresponding to the training sample data includes: Extracting feature data of the training sample data; Inputting the feature data into a classifier model to generate a prediction value; Calling the binary cross entropy as a loss function, and generating a loss value according to the predicted value and the label corresponding to the training sample data; Calling an optimization algorithm to process the loss value to obtain an optimization result; According to the optimization results, the classifier model parameters are updated to generate new model parameters; The classifier model is adjusted according to the new model parameters.

9. An electronic device, characterized in that: The electronic device comprises a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method steps as claimed in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the method according to any one of claims 1 to 8.