A neural network model training method, device and computer readable storage medium

By diffusion processing of the annotation sample set and calculating the target loss function value of the sub-sample set, the problem of low recognition efficiency caused by manual annotation error and sample sparseness in neural network model training is solved, and more efficient sample detection and recognition is achieved.

CN112183729BActive Publication Date: 2024-11-19TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011063849.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-30
Publication Date
2024-11-19
Estimated Expiration
2040-09-30

AI Technical Summary

Technical Problem

In the prior art, the recognition efficiency is low due to manual labeling error and positive and negative sample sparseness of sample sets during training of neural network models, making it difficult to accurately identify samples.

Method used

By obtaining the annotated sample set, diffusion processing is performed to increase the number of positive samples, the target loss function value of the sub-sample set is calculated, and the neural network model is trained based on this value to improve the recognition efficiency.

Benefits of technology

It effectively reduces the impact of labeling error, improves the accuracy and recognition efficiency of sample detection, and enhances the convergence ability of neural network models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112183729B_ABST
    Figure CN112183729B_ABST
Patent Text Reader

Abstract

The present application discloses a neural network model training method, apparatus, equipment and medium, which include obtaining a labeled sample set; diffusing positive samples in the labeled sample set to obtain a diffused sample set; obtaining a predicted sample set; determining in the predicted sample set a first sub-sample set corresponding to each first positive sample, wherein the first sub-sample set includes the corresponding first positive sample; determining in the diffused sample set a second positive sample having the same sample position as the first positive sample, determining a second sub-sample set corresponding to each second positive sample, wherein the second sub-sample set includes the corresponding second positive sample; calculating a target loss function value of the neural network model based on positive and negative sample information of the first sub-sample set and the second sub-sample set having the same positive sample position; training the neural network model based on the target loss function value to obtain a trained neural network model, so that positive and negative sample detection and recognition efficiency of the target sample based on the trained neural network model is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of neural network technology, and more specifically, to a neural network model training method, device and computer-readable storage medium. Background Art

[0002] Currently, for a sample set containing positive and negative samples, positive samples are samples that meet preset requirements in the sample set, and negative samples are samples that do not meet preset requirements in the sample set. If positive samples are to be identified in the sample set, the sample set needs to be tested, such as by using a neural network model. However, in the process of testing the sample set, the applicant found that there are at least the following problems in the prior art:

[0003] On the one hand, the training sample set used in training the neural network model requires manual labeling of positive and negative samples. However, manual labeling has errors, which affects the recognition efficiency of the neural network model. On the other hand, due to the sparsity of positive and negative samples in the sample set itself, the samples are unbalanced, which affects the recognition efficiency of the neural network module.

[0004] In summary, how to improve the efficiency of sample detection is an urgent problem to be solved by those skilled in the art. Summary of the invention

[0005] The purpose of this application is to provide a neural network model training method, which can solve the technical problem of how to improve the efficiency of sample detection to a certain extent. This application also provides a neural network model training device, equipment and computer-readable storage medium.

[0006] In order to achieve the above objectives, in a first aspect, the present application discloses a neural network model training method, comprising:

[0007] Acquire a labeled sample set, wherein the labeled sample set includes a sample set obtained by labeling positive and negative samples in the initial sample set;

[0008] Diffusion is performed on the positive samples in the labeled sample set to obtain a diffusion sample set;

[0009] Obtain a predicted sample set obtained after the neural network model performs positive and negative sample prediction on the initial sample set;

[0010] In the prediction sample set, determining a first sub-sample set corresponding to each first positive sample, wherein the first sub-sample set contains the corresponding first positive sample;

[0011] In the diffusion sample set, samples having the same sample position as the first positive sample are determined as second positive samples, and second sub-sample sets corresponding to each second positive sample are determined, wherein the second sub-sample sets contain the corresponding second positive samples;

[0012] Calculate the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set respectively having the same positive sample position;

[0013] The neural network model is trained based on the target loss function value to obtain a trained neural network model.

[0014] Optionally, diffusing the positive samples in the labeled sample set to obtain the diffused sample set includes:

[0015] Get the truncation window value;

[0016] According to the truncation window value and the exponential decay rule, values ​​are assigned to samples around the positive sample in the labeled sample set to obtain the diffusion sample set.

[0017] Optionally, determining, in the prediction sample set, a first subsample set corresponding to each first positive sample includes:

[0018] Determine a first cutoff value corresponding to each of the first positive samples;

[0019] In the prediction sample set, for each first positive sample, slicing is performed with the sample position of the first positive sample as the center and the first truncation value corresponding to the first positive sample as the truncation radius to obtain the first sub-sample set corresponding to the first positive sample.

[0020] Optionally, determining the second subsample set corresponding to each second positive sample includes:

[0021] Determine a second cutoff value corresponding to each of the second positive samples;

[0022] For each second positive sample, taking the sum of the corresponding first truncation value and the second truncation value as the third truncation value, and taking the difference between the corresponding first truncation value and the second truncation value as the fourth truncation value; traversing values ​​from the fourth truncation value to the third truncation value to obtain a set of truncation values ​​corresponding to the second positive sample;

[0023] In the diffusion sample set, for each second positive sample, taking the sample position of the second positive sample as the center and taking each truncation value in the set of truncation values ​​corresponding to the second positive sample as the truncation radius for slicing, to obtain a set of second sub-sample sets corresponding to the second positive sample;

[0024] The first truncation value corresponding to the second positive sample includes: the first truncation value corresponding to the first positive sample whose sample position is the same as that of the second positive sample.

[0025] Optionally, the calculating the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set having the same positive sample position includes:

[0026] Based on the positive and negative sample information of the first sub-sample set and the second sub-sample set having the same positive sample position, the target loss function value of the neural network model is calculated by using the logloss loss function.

[0027] Optionally, the calculating the target loss function value of the neural network model by using a logloss loss function based on the positive and negative sample information of the first sub-sample set and the second sub-sample set having the same positive sample position includes:

[0028] Based on the positive and negative sample information of the first sub-sample set and the second sub-sample set having the same positive sample position, calculating the positive sample loss function value of the neural network model by using a logloss loss function;

[0029] Based on the positive and negative sample information outside the first sub-sample set and the second sub-sample set, calculating the negative sample loss function value of the neural network model by using a preset loss function;

[0030] The target loss function value is calculated based on the positive sample loss function value, the negative sample loss function value, and the weight of the negative sample loss function value.

[0031] Optionally, the positive sample loss function value of the neural network model is calculated by using a logloss loss function based on the positive and negative sample information of the first sub-sample set and the second sub-sample set having the same positive sample position, including:

[0032] For each of the first positive samples, a set of the second subsample sets whose positive sample positions are the same as the sample positions of the first positive samples is determined; each time a second subsample set is selected from the second subsample sets, and based on the positive and negative sample information of the first subsample set corresponding to the first positive sample and the selected second subsample set, a set of loss function values ​​of the neural network model at the first positive sample is calculated by using a logloss loss function; and the minimum value of the set of loss function values ​​is used as the loss function value of the neural network model at the first positive sample;

[0033] The average of the loss function values ​​of the neural network model at each of the first positive samples is used as the positive sample loss function value.

[0034] Optionally, before calculating the target loss function value based on the positive sample loss function value, the negative sample loss function value, and the weight of the negative sample loss function value, the method further includes:

[0035] The weight of the negative sample loss function value is determined based on the number of positive and negative samples in the diffusion sample set.

[0036] In a second aspect, the present application discloses a neural network model training device, comprising:

[0037] A labeled sample set acquisition module, used to acquire a labeled sample set, wherein the labeled sample set includes a sample set obtained by annotating positive and negative samples in an initial sample set;

[0038] A diffusion sample set acquisition module, used to diffuse the positive samples in the labeled sample set to obtain a diffusion sample set;

[0039] A prediction sample set acquisition module is used to acquire a prediction sample set obtained after the neural network model performs positive and negative sample prediction on the initial sample set;

[0040] A first sub-sample set determination module, configured to determine, in the prediction sample set, a first sub-sample set corresponding to each first positive sample, wherein the first sub-sample set contains the corresponding first positive sample;

[0041] A second sub-sample set determination module, configured to determine, in the diffuse sample set, samples having the same sample position as the first positive sample as second positive samples, and determine second sub-sample sets corresponding to each second positive sample, wherein the second sub-sample sets contain the corresponding second positive samples;

[0042] A loss function value calculation module, used for calculating the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set respectively having the same positive sample position;

[0043] The model training module is used to train the neural network model based on the target loss function value to obtain a trained neural network model.

[0044] In a third aspect, the present application discloses an electronic device, comprising:

[0045] Memory for storing computer programs;

[0046] A processor is used to implement the steps of any of the aforementioned neural network model training methods when executing the computer program.

[0047] In a fourth aspect, the present application discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the aforementioned neural network model training methods are implemented.

[0048] In the present application, after obtaining the labeled sample set, it is necessary to diffuse the positive samples in the labeled sample set to obtain a diffused sample set. On the one hand, the number of positive samples in the labeled sample set can be increased and the sample sparsity of the labeled sample set can be reduced. On the other hand, the true positive samples can be marked to avoid the misalignment of positive sample annotations caused by labeling errors, thereby providing an accurate sample set for the subsequent neural network model. Afterwards, a predicted sample set is obtained. In the predicted sample set, a first sub-sample set corresponding to each first positive sample is determined, and the first sub-sample set contains the corresponding first positive sample. In the diffused sample set, the sample with the same sample position as the first positive sample is determined as the second positive sample, and a second sub-sample set corresponding to each second positive sample is determined, and the second sub-sample set contains the corresponding second positive sample. Based on the positive The target loss function value of the neural network model is calculated based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same sample position, thereby realizing the calculation of the target loss function value in units of sub-sample sets. Compared with the existing method of calculating the target loss function value in units of single samples, the reference sample size when calculating the target loss function value can be increased, which is convenient for eliminating the large target loss function value caused by individual sample labeling errors and facilitating the convergence of the neural network model. Finally, the neural network model is trained based on the target loss function value to obtain a trained neural network model. In this way, positive and negative sample detection is performed on the target sample based on the trained neural network model. If the detection result is obtained, the training efficiency of the neural network model can be accelerated, thereby accelerating the recognition efficiency of the neural network model for the target sample. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0050] Figure 1 A schematic diagram of the system framework applicable to the neural network model training solution provided in this application;

[0051] Figure 2 A flowchart of a neural network model training method provided in this application;

[0052] Figure 3 A flow chart of a specific neural network model training method provided in this application;

[0053] Figure 4 A flowchart of a specific neural network model training method provided in this application;

[0054] Figure 5 A flowchart of a specific neural network model training method provided in this application;

[0055] Figure 6 It is the correspondence diagram between the labeled sample set and the predicted sample set;

[0056] Figure 7 It is the corresponding relationship diagram between the diffusion sample set and the prediction sample set;

[0057] Figure 8 A schematic diagram of the structure of a neural network model training device provided in this application;

[0058] Fig. 9 A structural diagram of an electronic device provided for this application. DETAILED DESCRIPTION

[0059] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. 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 creative work are within the scope of protection of this application.

[0060] Currently, for a sample set containing positive and negative samples, positive samples are samples that meet preset requirements in the sample set, and negative samples are samples that do not meet preset requirements in the sample set. If you want to identify positive samples in the sample set, you need to detect the sample set, such as detecting the sample set through a neural network model. However, in the process of detecting the sample set, on the one hand, the training sample set used when training the neural network model requires manual labeling of positive and negative samples. However, there are errors in manual labeling, which affects the recognition efficiency of the neural network model; on the other hand, due to the sparsity of positive and negative samples in the sample set itself, the samples are unbalanced, which affects the recognition efficiency of the neural network module; ultimately, the sample detection accuracy is low. In order to overcome the above technical problems, the present application provides a neural network model training method that can improve the accuracy of sample detection.

[0061] In the neural network model training scheme of this application, the system framework used can be specifically referred to in Figure 1 As shown, it may specifically include: a background server 01 and a number of user terminals 02 that establish communication connections with the background server 01 .

[0062] In the present application, the background server 01 is used to execute the steps of the neural network model training method, including obtaining a labeled sample set, the labeled sample set including a sample set obtained after labeling the positive and negative samples in the initial sample set; diffusing the positive samples in the labeled sample set to obtain a diffused sample set; obtaining a predicted sample set obtained after the neural network model predicts the positive and negative samples of the initial sample set; in the predicted sample set, determining the first sub-sample set corresponding to each first positive sample, the first sub-sample set containing the corresponding first positive samples; in the diffused sample set, determining the sample with the same sample position as the first positive sample as the second positive sample, determining the second sub-sample set corresponding to each second positive sample, the second sub-sample set containing the corresponding second positive samples; calculating the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position; training the neural network model based on the target loss function value to obtain a trained neural network model, and performing positive and negative sample detection on the target sample based on the trained neural network model to obtain a detection result.

[0063] Furthermore, the background server 01 may also be provided with an initial sample set database, a labeled sample set database, a diffusion sample set database, and a prediction sample set database. Among them, the initial sample set database is used to store various initial sample sets; the labeled sample set database is used to store the labeled sample sets obtained after the initial sample sets are labeled; the diffusion sample set database can be specifically used to store the diffusion sample sets obtained after the labeled sample sets are diffused; and the prediction sample set database can be used to store the prediction sample sets obtained after the neural network model predicts the positive and negative samples of the initial sample sets. In this way, the required sample sets can be obtained by simply reading data in the corresponding database.

[0064] It is understandable that different neural network models have different prediction results for positive and negative samples of the initial sample set, that is, the sample distribution of the predicted sample set will be affected by the neural network model. Therefore, after the target sample is detected through the scheme of the present application, the corresponding initial sample set, labeled sample set and diffuse sample set can be retained, and the predicted sample set can be cleared. In this way, when the background server 01 receives a sample detection request from the user end 02 for a certain neural network model, it can first search for the required initial sample set from the above-mentioned initial sample set database, and send the initial sample set to the neural network model for prediction to obtain the corresponding predicted sample set. After that, the required diffuse sample set can be read directly from the diffuse sample set without having to perform the diffusion process of the labeled sample set again, which helps to save a lot of time.

[0065] Of course, the application can also set the above prediction sample set database in a third-party business server, and the above business server can specifically collect the prediction sample set data uploaded by the business end. In this way, when the background server 01 needs to use the prediction sample set, it can obtain the corresponding prediction sample set by initiating a corresponding prediction sample set call request to the above business server.

[0066] In the present application, the backend server 01 can respond to sample detection requests from one or more user terminals 02. It can be understood that the sample detection requests initiated by different user terminals 02 in the present application can be sample detection requests initiated by different neural network models for the same target sample. When the backend server 01 receives a specific sample detection request initiated by the user terminal 02, it can first determine the target sample and the corresponding neural network model corresponding to the specific sample detection request, and then use the corresponding diffusion sample set and initial sample set to complete the detection of the target sample.

[0067] Figure 2 A flowchart of a neural network model training method provided in an embodiment of the present application. Figure 2 As shown, the neural network model training method includes:

[0068] Step S11: obtaining a labeled sample set, where the labeled sample set includes a sample set obtained by labeling positive and negative samples in the initial sample set.

[0069] In this embodiment, the initial sample set refers to the sample set originally collected. The samples in the initial sample set are not divided into positive and negative samples. Therefore, after obtaining the initial sample set, the samples in the initial sample set need to be labeled according to the preset requirements to obtain the labeled sample set. In this process, samples that meet the preset requirements can be labeled as positive samples, and samples that do not meet the preset requirements can be labeled as negative samples.

[0070] It can be understood that the preset requirements need to match the initial sample set. Assuming that the initial sample set is a piece of audio, the preset requirements can be the starting point of the music event in the audio, such as the starting point of pronunciation, the starting point of percussion instruments, etc. In this case, the sample detection is the onset (starting point) detection of the audio and video; and when the initial sample set is an image, the preset requirements can be a specific object in the image, and the sample detection is the detection of the specific object in the image, etc.

[0071] Step S12: diffuse the positive samples in the labeled sample set to obtain a diffused sample set.

[0072] In this embodiment, due to the limitation of the labeling method of the initial sample set and the sparsity of positive and negative samples in the initial sample set, if the labeled sample set is directly used to train the neural network model, on the one hand, when the true positive samples are labeled as negative samples in the labeled sample set, and the neural network model recognizes the true positive samples in the initial sample set, if the loss function value is calculated at this time, a larger loss function value will be obtained, which will cause the neural network model to incur a larger loss at the true positive sample. Similarly, the neural network model will also incur a larger loss at the false positive sample, which will ultimately mislead the convergence direction of the neural network model, reduce the training efficiency of the neural network model, and then reduce the recognition efficiency of the neural network model; on the other hand, when the positive and negative samples in the labeled sample set are relatively sparse, for example, the positive samples are relatively sparse, at this time, even if the neural network model predicts all samples as negative samples, it will calculate a smaller loss function value, thereby misleading the convergence direction of the neural network model, and ultimately resulting in a low recognition efficiency of the neural network model.

[0073] Therefore, in order to improve the recognition efficiency of the neural network model, after obtaining the labeled sample set, it is necessary to diffuse the positive samples in the labeled sample set to obtain the diffused sample set. Because the positive samples in the labeled sample set are diffused, the proportion of positive samples in the diffused sample set can be increased, so that the neural network model converges in the direction of improving the prediction success rate of positive samples; in addition, the true positive samples that were originally labeled as negative samples due to labeling errors can be marked as positive samples again, or the probability of true positive samples being labeled as positive samples can be increased, reducing the loss of the neural network model at the true positive samples, accelerating the convergence efficiency of the neural network model, and thus improving the sample detection efficiency.

[0074] Step S13: Obtain a predicted sample set obtained after the neural network model performs positive and negative sample prediction on the initial sample set.

[0075] In this embodiment, because it is necessary to know the recognition status of the sample set by the neural network model and then train the neural network model according to the recognition status of the sample set by the neural network model, it is necessary to obtain the predicted sample set obtained after the neural network model predicts positive and negative samples of the initial sample set, and to know the recognition status of the sample set by the neural network model based on the prediction results of the positive and negative samples in the predicted sample set.

[0076] Step S14: in the prediction sample set, determining the first sub-sample set corresponding to each first positive sample, wherein the first sub-sample set contains the corresponding first positive sample.

[0077] In this embodiment, if the predicted sample set is directly compared with each sample in the diffusion sample set on a single sample basis and the loss function value of the neural network model is calculated, if the positive sample predicted by the neural network model is accurate and the sample in the diffusion sample set is inaccurate, the neural network model will still obtain a larger loss function value, affecting the convergence efficiency of the neural network model. In order to avoid this situation, it is necessary to determine the first sub-sample set corresponding to each first positive sample in the predicted sample set, and the first sub-sample set contains the corresponding first positive sample, so that the loss function value can be calculated in units of the sub-sample set later. In this way, the number of variables when calculating the loss function value can be increased, and the impact of a single failed prediction sample on the final loss function value can be balanced.

[0078] Step S15: in the diffusion sample set, samples having the same sample position as the first positive sample are determined as second positive samples, and second sub-sample sets corresponding to the second positive samples are determined, wherein the second sub-sample sets contain the corresponding second positive samples.

[0079] In this embodiment, because the loss function value needs to be calculated in units of sub-sample sets, and the sample positions of the positive samples in the diffusion sample set used as the basis for calculating the loss function value need to be the same as the sample positions of the positive samples in the prediction sample set, it is necessary to determine the samples with the same sample positions as the first positive samples in the diffusion sample set as the second positive samples, determine the second sub-sample sets corresponding to each second positive sample, and the second sub-sample sets contain the corresponding second positive samples.

[0080] It should be noted that the number of samples contained in the first sub-sample set and the second sub-sample set can be determined according to actual needs, and this application does not make any specific limitation here.

[0081] Step S16: Calculate the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position.

[0082] Step S17: Train the neural network model based on the target loss function value to obtain a trained neural network model, and perform positive and negative sample detection on the target sample based on the trained neural network model to obtain a detection result.

[0083] In this embodiment, after determining the first sub-sample set and the second sub-sample set, the target loss function value of the neural network model can be calculated based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position; and the neural network model is trained based on the target loss function value to obtain a trained neural network model, and positive and negative sample detection is performed on the target samples based on the trained neural network model to obtain detection results.

[0084] In the present application, after obtaining the labeled sample set, it is necessary to diffuse the positive samples in the labeled sample set to obtain a diffused sample set. On the one hand, the number of positive samples in the labeled sample set can be increased and the sample sparsity of the labeled sample set can be reduced. On the other hand, the true positive samples can be marked to avoid the misalignment of positive sample annotations caused by labeling errors, thereby providing an accurate sample set for the subsequent neural network model. Afterwards, a predicted sample set is obtained. In the predicted sample set, a first sub-sample set corresponding to each first positive sample is determined, and the first sub-sample set contains the corresponding first positive sample. In the diffused sample set, the sample with the same sample position as the first positive sample is determined as the second positive sample, and a second sub-sample set corresponding to each second positive sample is determined, and the second sub-sample set contains the corresponding second positive sample. Based on the positive The target loss function value of the neural network model is calculated based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same sample position, thereby realizing the calculation of the target loss function value in units of sub-sample sets. Compared with the existing method of calculating the target loss function value in units of single samples, the reference sample size when calculating the target loss function value can be increased, which is convenient for eliminating the large target loss function value caused by individual sample labeling errors and facilitating the convergence of the neural network model. Finally, the neural network model is trained based on the target loss function value to obtain a trained neural network model, and positive and negative sample detection is performed on the target sample based on the trained neural network model. If the detection result is obtained, the training efficiency of the neural network model can be accelerated, thereby accelerating the recognition efficiency of the neural network model for the target sample.

[0085] Figure 3 A flowchart of a specific neural network model training method provided in the embodiment of the present application. Figure 3 As shown, the neural network model training method includes:

[0086] Step S21: obtaining a labeled sample set, where the labeled sample set includes a sample set obtained by labeling positive and negative samples in the initial sample set.

[0087] Step S22: Obtain the truncation window value; assign values ​​to samples around the positive sample in the labeled sample set according to the truncation window value and the exponential decay rule to obtain a diffusion sample set.

[0088] In this embodiment, in the process of diffusing the positive samples in the labeled sample set, if the negative samples are directly changed to positive samples, although the proportion of positive samples can be increased, the sample labeling error in the diffused sample set will be increased, affecting the detection accuracy of the neural network model for the samples. In order to increase the proportion of positive samples while ensuring the detection accuracy of the neural network model, a truncation window value can be obtained; according to the truncation window value and the attenuation rule of exponential decay, the samples around the positive samples in the labeled sample set are assigned values ​​to obtain a diffuse sample set.

[0089] For ease of understanding, assume that the positive samples in the labeled sample set are labeled as 1 and the negative samples are labeled as 0, assume that the labeling information of seven consecutive samples in the labeled sample set is [0, 0, 0, 1, 0, 0, 0], and assume that the truncation window value is 2, then the labeling information of the seven consecutive samples in the diffusion sample set can be [0, 0.25, 0.5, 1, 0.5, 0.25, 0]. It can be found that the probability that the samples in the diffusion sample set are positive samples will increase, but the negative samples will not be actually labeled as positive samples, that is, the diffusion of positive samples is realized, and the detection accuracy of the neural network model can be guaranteed. It can be seen that in this embodiment, through the truncation window value and the exponential decay rule, the positive samples in the labeled sample set can be diffused, and the detection accuracy of the neural network model can be guaranteed.

[0090] Step S23: Obtain a predicted sample set obtained after the neural network model performs positive and negative sample prediction on the initial sample set.

[0091] Step S24: in the prediction sample set, determining the first sub-sample set corresponding to each first positive sample, wherein the first sub-sample set contains the corresponding first positive sample.

[0092] Step S25: in the diffusion sample set, samples having the same sample position as the first positive sample are determined as second positive samples, and second sub-sample sets corresponding to the second positive samples are determined, wherein the second sub-sample sets contain the corresponding second positive samples.

[0093] Step S26: Calculate the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position.

[0094] Step S27: Train the neural network model based on the target loss function value to obtain a trained neural network model, and perform positive and negative sample detection on the target sample based on the trained neural network model to obtain a detection result.

[0095] Figure 4 A flowchart of a specific neural network model training method provided in the embodiment of the present application. Figure 4 As shown, the neural network model training method includes:

[0096] Step S301: Obtain a labeled sample set, where the labeled sample set includes a sample set obtained by labeling positive and negative samples in an initial sample set.

[0097] Step S302: diffuse the positive samples in the labeled sample set to obtain a diffused sample set.

[0098] Step S303: Obtain a predicted sample set obtained after the neural network model performs positive and negative sample prediction on the initial sample set.

[0099] Step S304: Determine a first cutoff value corresponding to each first positive sample.

[0100] Step S305: In the prediction sample set, for each first positive sample, slice the sample with the sample position of the first positive sample as the center and the first truncation value corresponding to the first positive sample as the truncation radius to obtain a first sub-sample set corresponding to the first positive sample.

[0101] In this embodiment, if there is a labeling error in the labeled sample set, the distance between the incorrectly labeled sample and the true sample will not be too far. For example, due to labeling delay, the incorrectly labeled sample will be after the true sample. Therefore, in order to include the true samples in the diffusion sample set into the calculation variables of the loss function value as much as possible, the positive sample and the samples around the positive sample can be used as the corresponding sub-sample sets, that is, in the prediction sample set, in the process of determining the first sub-sample set corresponding to each first positive sample, the first truncation value corresponding to each first positive sample can be determined; in the prediction sample set, for each first positive sample, the sample position of the first positive sample is taken as the center and the first truncation value corresponding to the first positive sample is used as the truncation radius for slicing to obtain the first sub-sample set corresponding to the first positive sample.

[0102] It should be noted that in practical applications, in order to improve the efficiency of obtaining the first sub-sample set, the first sub-sample set can be determined by means of a formula. For example, the formula for determining the first sub-sample set can be as follows:

[0103] δ=y p [idx-k,idx+k];

[0104] Where, δ represents the first subsample set; y p represents the predicted sample set; idx represents the sample position of the first positive sample; k represents the corresponding first cutoff value; [] represents a slice.

[0105] Step S306: In the diffusion sample set, a sample having the same sample position as the first positive sample is determined as a second positive sample.

[0106] Step S307: Determine the second cutoff value corresponding to each second positive sample.

[0107] Step S308: For each second positive sample, the sum of the corresponding first truncation value and the second truncation value is used as the third truncation value, and the difference between the corresponding first truncation value and the second truncation value is used as the fourth truncation value; traverse from the fourth truncation value to the third truncation value to obtain a set of truncation values ​​corresponding to the second positive sample.

[0108] Step S309: In the diffusion sample set, for each second positive sample, slice the sample with the sample position of the second positive sample as the center and each truncation value in a set of truncation values ​​corresponding to the second positive sample as the truncation radius to obtain a set of second sub-sample sets corresponding to the second positive sample; wherein the first truncation value corresponding to the second positive sample includes: the first truncation value corresponding to the first positive sample whose sample position is the same as the sample position of the second positive sample.

[0109] In this embodiment, correspondingly, in the process of determining the second sub-sample set corresponding to each second positive sample, the second truncation value corresponding to each second positive sample can be determined; for each second positive sample, the sum of the corresponding first truncation value and the second truncation value is used as the third truncation value, and the difference between the corresponding first truncation value and the second truncation value is used as the fourth truncation value; values ​​are traversed from the fourth truncation value to the third truncation value to obtain a set of truncation values ​​corresponding to the second positive sample; in the diffusion sample set, for each second positive sample, the sample position of the second positive sample is taken as the center, and each truncation value in a set of truncation values ​​corresponding to the second positive sample is used as the truncation radius for slicing to obtain a set of second sub-sample sets corresponding to the second positive sample; wherein, the first truncation value corresponding to the second positive sample includes: the first truncation value corresponding to the first positive sample whose sample position is the same as the sample position of the second positive sample.

[0110] It should be noted that in practical applications, in order to improve the efficiency of obtaining the second sub-sample set, the second sub-sample set can be determined by means of a formula. For example, the formula for determining the second sub-sample set can be as follows:

[0111] η=y t [idx-ki,idx+k+i];

[0112] Wherein, n represents the second sub-sample set; y t represents the diffusion sample set; idx represents the sample position of the second positive sample; k represents the first cutoff value; -m≤i≤m, and i is the traversal value, m represents the second cutoff value; [] represents slicing.

[0113] It can be seen that in the present application, the positive samples in the prediction sample set and the diffusion sample set and the samples around the positive samples are taken as sub-sample sets, so that the sub-sample sets have a greater probability of containing the true positive samples in the prediction sample set and the diffusion sample set, which can expand the amount of parameters when calculating the loss function value, and can include the positive and negative samples affected by the labeling error into the calculation process of the loss function value, thereby enhancing the ability of the loss function value to reflect the accuracy of the neural network model's prediction, thereby enhancing the convergence efficiency of the neural network model and increasing the recognition efficiency of the neural network model.

[0114] Step S310: Calculate the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position.

[0115] Step S311: Train the neural network model based on the target loss function value to obtain a trained neural network model, and perform positive and negative sample detection on the target sample based on the trained neural network model to obtain a detection result.

[0116] Figure 5 A flowchart of a specific neural network model training method provided in the embodiment of the present application. Figure 5 As shown, the neural network model training method includes:

[0117] Step S41: obtaining a labeled sample set, where the labeled sample set includes a sample set obtained by labeling positive and negative samples in the initial sample set.

[0118] Step S42: diffuse the positive samples in the labeled sample set to obtain a diffused sample set.

[0119] Step S43: Obtain a predicted sample set after the neural network model performs positive and negative sample prediction on the initial sample set.

[0120] Step S44: in the prediction sample set, determining the first sub-sample set corresponding to each first positive sample, wherein the first sub-sample set contains the corresponding first positive sample.

[0121] Step S45: in the diffusion sample set, samples having the same sample position as the first positive sample are determined as second positive samples, and second sub-sample sets corresponding to the second positive samples are determined, wherein the second sub-sample sets contain the corresponding second positive samples.

[0122] Step S46: Based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position, the positive sample loss function value of the neural network model is calculated by the logloss loss function.

[0123] In this embodiment, in the process of calculating the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position, in order to improve the calculation efficiency of the loss function value, the target loss function value of the neural network model can be calculated by using the logloss loss function based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position.

[0124] Furthermore, in order to comprehensively consider the prediction accuracy of the neural network model for the initial sample set, the prediction loss function value of the neural network model for the positive samples can be calculated, the prediction loss function value of the neural network model for the negative samples can be calculated, and the target loss function value of the neural network model can be determined by combining the prediction loss function value of the neural network model for the positive samples and the prediction loss function value for the negative samples.

[0125] It can be understood that, because there are multiple predicted positive samples in the prediction sample set, the neural network model can calculate a loss function value at each positive sample, and the average value can more accurately reflect the characteristics of the data, so the average value of the loss function value calculated by the neural network model at each positive sample can be used as the positive sample loss function value, that is, in the process of calculating the positive sample loss function value of the neural network model through the logloss (logarithmic loss) loss function based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position, it can be: for each first positive sample, determine a group of second sub-sample sets whose positive sample positions are the same as the sample positions of the first positive samples; each time a second sub-sample set is selected from the second sub-sample set, based on the positive and negative sample information of the first sub-sample set corresponding to the first positive sample and the selected second sub-sample set, calculate a group of loss function values ​​of the neural network model at the first positive sample through the logloss loss function; the minimum value in a group of loss function values ​​is used as the loss function value of the neural network model at the first positive sample; the average value of the loss function values ​​of the neural network model at each first positive sample is used as the positive sample loss function value.

[0126] It should be pointed out that in practical applications, in order to improve the calculation efficiency of the positive sample loss function value, the positive sample loss function value can be calculated with the help of a formula. For example, the calculation formula of the positive sample loss function value can be as follows:

[0127]

[0128]

[0129] Among them, Lp(y p ,y t ) represents the positive sample loss function value; P represents the number of positive samples in the prediction sample set; l idx (y p ,y t ) indicates l idx,k (y p ,y t ) in the minimum value; l idx,k (y p ,y t ) represents the loss function value of the neural network model at the sample position idx.

[0130] Step S47: Based on the positive and negative sample information outside the first sub-sample set and the second sub-sample set, the negative sample loss function value of the neural network model is calculated by a preset loss function.

[0131] In this embodiment, the type of the preset loss function used when calculating the negative sample loss function value can be determined according to actual needs. For example, the type of the preset loss function value can be a logloss function, an MSE (mean square error) loss function, etc.

[0132] Step S48: Calculate the target loss function value based on the positive sample loss function value, the negative sample loss function value, and the weight of the negative sample loss function value.

[0133] In this embodiment, when calculating the target loss function value, the product value of the negative sample loss function value and the weight of the negative sample loss function value can be calculated first, and then the product value is added to the positive sample loss function value to obtain the target loss function value.

[0134] It is understandable that the weight of the negative sample loss function value can be used to balance the difference in the number of positive and negative samples, so the weight of the negative sample loss function value can be determined based on the number of positive and negative samples in the diffusion sample set. In specific application scenarios, the weight of the negative sample loss function value can be a fixed weight value, or a weight value corresponding to the initial sample set itself.

[0135] It should be pointed out that in practical applications, in order to improve the calculation efficiency of the target loss function value, the target loss function value can be calculated with the help of a formula. For example, the calculation formula of the target loss function value can be as follows:

[0136] L(y p ,y t )=Lp(y p ,y t )+αLq(y p ,y t );

[0137] Among them, L(y p ,y t ) represents the target loss function value; α represents the weight of the negative sample loss function value; Lq(y p ,y t ) represents the negative sample loss function value.

[0138] Step S49: Train the neural network model based on the target loss function value to obtain a trained neural network model, and perform positive and negative sample detection on the target sample based on the trained neural network model to obtain a detection result.

[0139] It can be seen that in this embodiment, the target loss function value that can reflect the overall prediction accuracy of the neural network model for the initial sample set can be determined by the positive sample loss function value, the negative sample loss function value and the weight of the negative sample loss function value of the neural network model. If the neural network model is then trained based on the target loss function value, the overall detection accuracy of the neural network model for samples can be further controlled while improving the sample detection efficiency.

[0140] In order to facilitate understanding of the neural network model training method provided by the present application, the neural network model training method provided by the present application is described by taking drum beat detection in music as an example. Drum beat detection is to output the precise time point sequence of the drum beats in a given audio. At this time, the type of the sample is audio. The process may include the following steps:

[0141] Obtain a labeled sample set, the labeled sample set including a sample set obtained by labeling positive and negative samples in an initial sample set, the type of the initial sample set is audio, and the positive sample is a time point at which a drum beat sounds in the initial sample set, and the negative sample is a time point at which a drum beat does not sound;

[0142] Get the truncation window value;

[0143] According to the truncation window value and the exponential decay rule, the samples around the positive samples in the labeled sample set are assigned values ​​to obtain the diffusion sample set;

[0144] Obtain a predicted sample set after the neural network model predicts positive and negative samples on the initial sample set;

[0145] In the prediction sample set, the first truncation value corresponding to each first positive sample is determined. For each first positive sample, a first sub-sample set corresponding to the first positive sample is obtained by slicing the sample with the sample position of the first positive sample as the center and the first truncation value corresponding to the first positive sample as the truncation radius; the first positive sample is also the time point when the drum beat is predicted by the neural network model in the prediction sample set;

[0146] In the diffusion sample set, the sample with the same sample position as the first positive sample is determined as the second positive sample, and the second cutoff value corresponding to each second positive sample is determined; the second positive sample is also the time point when the drum beat sounded in the diffusion sample set;

[0147] For each second positive sample, the sum of the corresponding first truncation value and the second truncation value is used as the third truncation value, and the difference between the corresponding first truncation value and the second truncation value is used as the fourth truncation value; traversing from the fourth truncation value to the third truncation value to obtain a set of truncation values ​​corresponding to the second positive sample;

[0148] In the diffusion sample set, for each second positive sample, a sample position of the second positive sample is taken as the center, and each truncation value in a set of truncation values ​​corresponding to the second positive sample is used as a truncation radius for slicing, to obtain a set of second sub-sample sets corresponding to the second positive sample; wherein the first truncation value corresponding to the second positive sample includes: the first truncation value corresponding to the first positive sample whose sample position is the same as the sample position of the second positive sample, and the second sub-sample set includes the corresponding second positive sample;

[0149] The target loss function value of the neural network model is calculated based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position by using the calculation formula of the target loss function value;

[0150] The neural network model is trained based on the target loss function value to obtain a trained neural network model, and positive and negative sample detection is performed on the target sample based on the trained neural network model to obtain a detection result;

[0151] The calculation formula of the target loss function value is:

[0152] L(y p ,y t )=Lp(y p ,y t )+αLq(y p ,y t );

[0153]

[0154] Among them, L(y p ,y t ) represents the target loss function value; α represents the weight of the negative sample loss function value; Lq(y p ,y t ) represents the negative sample loss function value; Lp(y p ,y t ) represents the positive sample loss function value; P represents the number of positive samples in the prediction sample set; l idx (y p ,y t ) indicates l idx,k (y p ,y t ) in the minimum value; l idx,k (y p ,y t ) represents the loss function value of the neural network model at the sample position idx.

[0155] In order to understand the effect of the neural network model training method provided in this application, it is assumed that the labeled sample set is as follows: Figure 6As shown, the black blocks in the figure represent the time points when drum beats sound, the white blocks in the figure represent the time points when non-drum beats sound, the curve in the figure represents the predicted values ​​of the samples in the predicted sample set as positive and negative samples, and the peak of the curve represents the time point when the drum beats sound. If the positive samples in the labeled sample set are sparse and there are labeling errors, because the peak of the curve is not aligned with the black block of the image, the actual loss function value of the neural network model at the peak is large, and at this time it should be determined that the neural network model prediction is correct, that is, the theoretical loss function value of the neural network model at the peak should be small, which will eventually make the convergence of the neural network model slower; after adopting the method of the present application, the diffusion sample set obtained can be as shown Figure 7 As shown in the figure, the black color in the figure represents the time point when the drum beats annotated in the annotated sample set sounded, and the gray color represents the time point when the drum beats obtained by diffusion sounded. At this time, even if there is an annotation error, the peak of the curve corresponds to the gray block instead of the white block. The actual loss function value of the neural network model calculated at the peak is higher than Figure 6 The corresponding actual loss function value is small and closer to the theoretical loss function value, which can better indicate the convergence direction of the neural network model, accelerate the convergence speed of the neural network model, and ultimately accelerate the sample recognition efficiency of the neural network model.

[0156] See also Figure 8 As shown, the embodiment of the present application also discloses a neural network model training device, including:

[0157] The labeled sample set acquisition module 11 is used to acquire a labeled sample set, where the labeled sample set includes a sample set obtained by annotating positive and negative samples in the initial sample set;

[0158] The diffusion sample set acquisition module 12 is used to diffuse the positive samples in the labeled sample set to obtain a diffusion sample set;

[0159] The prediction sample set acquisition module 13 is used to acquire the prediction sample set obtained after the neural network model performs positive and negative sample prediction on the initial sample set;

[0160] A first sub-sample set determination module 14 is used to determine, in the prediction sample set, a first sub-sample set corresponding to each first positive sample, wherein the first sub-sample set contains the corresponding first positive sample;

[0161] A second sub-sample set determination module 15 is used to determine, in the diffusion sample set, samples having the same sample position as the first positive sample as second positive samples, and determine second sub-sample sets corresponding to each second positive sample, wherein the second sub-sample sets contain the corresponding second positive samples;

[0162] A loss function value calculation module 16, used to calculate the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position;

[0163] The model training module 17 is used to train the neural network model based on the target loss function value to obtain a trained neural network model, and perform positive and negative sample detection on the target sample based on the trained neural network model to obtain a detection result.

[0164] It can be seen that after obtaining the labeled sample set, the embodiment of the present application needs to diffuse the positive samples in the labeled sample set to obtain a diffused sample set. On the one hand, the number of positive samples in the labeled sample set can be increased and the sample sparsity of the labeled sample set can be reduced. On the other hand, the true positive samples can be marked to avoid the misalignment of positive sample annotations caused by labeling errors, thereby providing an accurate sample set for the subsequent neural network model. Afterwards, a predicted sample set is obtained, and in the predicted sample set, a first sub-sample set corresponding to each first positive sample is determined, and the first sub-sample set contains the corresponding first positive sample. In the diffused sample set, the sample with the same sample position as the first positive sample is determined as the second positive sample, and a second sub-sample set corresponding to each second positive sample is determined, and the second sub-sample set contains the corresponding second positive sample, and based on The target loss function value of the neural network model is calculated based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position, thereby realizing the calculation of the target loss function value in units of sub-sample sets. Compared with the existing method of calculating the target loss function value in units of single samples, the amount of reference samples when calculating the target loss function value can be increased, which is convenient for eliminating the large target loss function value caused by individual sample labeling errors and facilitating the convergence of the neural network model. Finally, the neural network model is trained based on the target loss function value to obtain a trained neural network model, and positive and negative sample detection is performed on the target sample based on the trained neural network model. If the detection result is obtained, the training efficiency of the neural network model can be accelerated, thereby accelerating the recognition efficiency of the neural network model for the target sample.

[0165] In some specific embodiments, the diffusion sample set acquisition module 12 specifically includes:

[0166] A truncation window value obtaining unit, used for obtaining a truncation window value;

[0167] The diffusion sample set acquisition unit is used to assign values ​​to samples around the positive sample in the labeled sample set according to the truncation window value and the exponential decay rule to obtain the diffusion sample set.

[0168] In some specific embodiments, the first sub-sample set determination module 14 specifically includes:

[0169] A first cutoff value determining unit, used to determine a first cutoff value corresponding to each first positive sample;

[0170] The first sub-sample set determining unit is used to slice each first positive sample in the prediction sample set with the sample position of the first positive sample as the center and the first truncation value corresponding to the first positive sample as the truncation radius to obtain a first sub-sample set corresponding to the first positive sample.

[0171] In some specific embodiments, the second sub-sample set determination module 15 specifically includes:

[0172] A second cutoff value determining unit, used to determine a second cutoff value corresponding to each second positive sample;

[0173] A set of truncation value acquisition units, for each second positive sample, using the sum of the corresponding first truncation value and the second truncation value as the third truncation value, using the difference between the corresponding first truncation value and the second truncation value as the fourth truncation value; traversing values ​​from the fourth truncation value to the third truncation value to obtain a set of truncation values ​​corresponding to the second positive sample;

[0174] A second sub-sample set determination unit is used to, for each second positive sample in the diffusion sample set, slice the sample with the sample position of the second positive sample as the center and each truncation value in a set of truncation values ​​corresponding to the second positive sample as the truncation radius to obtain a set of second sub-sample sets corresponding to the second positive sample;

[0175] The first truncation value corresponding to the second positive sample includes: the first truncation value corresponding to the first positive sample whose sample position is the same as the sample position of the second positive sample.

[0176] In some specific embodiments, the loss function value calculation module 16 specifically includes:

[0177] The loss function value calculation submodule is used to calculate the target loss function value of the neural network model through the logloss loss function based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position.

[0178] In some specific embodiments, the loss function value calculation submodule specifically includes:

[0179] A positive sample loss function value calculation unit, used to calculate the positive sample loss function value of the neural network model through a logloss loss function based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position;

[0180] A negative sample loss function value calculation unit, used to calculate the negative sample loss function value of the neural network model through a preset loss function based on the positive and negative sample information outside the first sub-sample set and the second sub-sample set;

[0181] The target loss function value calculation unit is used to calculate the target loss function value based on the positive sample loss function value, the negative sample loss function value, and the weight of the negative sample loss function value.

[0182] In some specific embodiments, the positive sample loss function value calculation unit is specifically used to:

[0183] For each first positive sample, a set of second subsample sets whose positive sample positions are the same as the sample positions of the first positive sample is determined; each time a second subsample set is selected from the second subsample sets, and based on the positive and negative sample information of the first subsample set corresponding to the first positive sample and the selected second subsample set, a set of loss function values ​​of the neural network model at the first positive sample is calculated by the logloss loss function; the minimum value in the set of loss function values ​​is used as the loss function value of the neural network model at the first positive sample;

[0184] The average of the loss function values ​​of the neural network model at each first positive sample is taken as the positive sample loss function value.

[0185] In some specific embodiments, the neural network model training device further includes:

[0186] The weight determination module is used for the target loss function value calculation unit to determine the weight of the negative sample loss function value based on the number of positive and negative samples in the diffusion sample set before calculating the target loss function value based on the positive sample loss function value, the negative sample loss function value, and the weight of the negative sample loss function value.

[0187] Furthermore, an embodiment of the present application also provides an electronic device. Fig. 9 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0188] Fig. 9 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the neural network model training method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be a server.

[0189] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0190] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222 and video data 223, etc. The storage method can be temporary storage or permanent storage.

[0191] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20 to realize the operation and processing of the massive video data 223 in the memory 22 by the processor 21, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the neural network model training method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. The data 223 can include various sample sets collected by the electronic device 20.

[0192] Furthermore, an embodiment of the present application also discloses a storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the steps of the neural network model training method disclosed in any of the aforementioned embodiments are implemented.

[0193] For the description of the relevant parts of the neural network model training device, electronic device, and computer-readable storage medium provided in the embodiments of the present application, please refer to the detailed description of the corresponding parts in the neural network model training method provided in the embodiments of the present application, which will not be repeated here. In addition, the parts of the above-mentioned technical solutions provided in the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive elaboration.

[0194] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0195] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those 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 will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A neural network model training method, It is characterized in that include: Acquire a labeled sample set, wherein the labeled sample set includes a sample set obtained by labeling positive and negative samples in an initial sample set; the initial sample set includes audio or image; Diffusion is performed on the positive samples in the labeled sample set to obtain a diffusion sample set; Obtain a predicted sample set obtained after the neural network model performs positive and negative sample prediction on the initial sample set; In the prediction sample set, a first subsample set corresponding to each first positive sample is determined, the first subsample set includes the corresponding first positive sample; and the first subsample set includes a subsample set obtained by slicing with the sample position of the first positive sample as the center and the truncation value corresponding to the first positive sample as the truncation radius; In the diffusion sample set, a sample having the same sample position as the first positive sample is determined as a second positive sample, and a second subsample set corresponding to each second positive sample is determined, wherein the second subsample set includes the corresponding second positive sample; and the second subsample set includes a subsample set obtained by slicing with the sample position of the second positive sample as the center and a set of truncation values ​​corresponding to the second positive sample as the truncation radius; Calculating the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set respectively having the same positive sample position, and based on the positive and negative sample information outside the first sub-sample set and the second sub-sample set; Training the neural network model based on the target loss function value to obtain a trained neural network model; The step of diffusing the positive samples in the labeled sample set to obtain the diffused sample set includes: Get the truncation window value; According to the truncation window value and the exponential decay rule, values ​​are assigned to samples around the positive sample in the labeled sample set to obtain the diffusion sample set.

2. The method according to claim 1, It is characterized in that Determining, in the prediction sample set, a first sub-sample set corresponding to each first positive sample includes: Determine a first cutoff value corresponding to each of the first positive samples; In the prediction sample set, for each first positive sample, slicing is performed with the sample position of the first positive sample as the center and the first truncation value corresponding to the first positive sample as the truncation radius to obtain the first sub-sample set corresponding to the first positive sample.

3. The method according to claim 2, It is characterized in that The determining of the second sub-sample set corresponding to each second positive sample includes: Determine a second cutoff value corresponding to each of the second positive samples; For each second positive sample, taking the sum of the corresponding first truncation value and the second truncation value as the third truncation value, and taking the difference between the corresponding first truncation value and the second truncation value as the fourth truncation value; traversing values ​​from the fourth truncation value to the third truncation value to obtain a set of truncation values ​​corresponding to the second positive sample; In the diffusion sample set, for each second positive sample, taking the sample position of the second positive sample as the center and taking each truncation value in the set of truncation values ​​corresponding to the second positive sample as the truncation radius for slicing, to obtain a set of second sub-sample sets corresponding to the second positive sample; The first truncation value corresponding to the second positive sample includes: the first truncation value corresponding to the first positive sample whose sample position is the same as that of the second positive sample.

4. The method according to claim 3, It is characterized in that The calculating the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set respectively having the same positive sample position and based on the positive and negative sample information outside the first sub-sample set and the second sub-sample set includes: Based on the positive and negative sample information of the first sub-sample set and the second sub-sample set with the same positive sample position, and based on the positive and negative sample information outside the first sub-sample set and the second sub-sample set, the target loss function value of the neural network model is calculated by the logloss loss function.

5. The method according to claim 4, It is characterized in that The method of calculating the target loss function value of the neural network model by using a logloss loss function based on the positive and negative sample information of the first sub-sample set and the second sub-sample set respectively having the same positive sample position and based on the positive and negative sample information outside the first sub-sample set and the second sub-sample set comprises: Based on the positive and negative sample information of the first sub-sample set and the second sub-sample set having the same positive sample position, calculating the positive sample loss function value of the neural network model by using a logloss loss function; Based on the positive and negative sample information outside the first sub-sample set and the second sub-sample set, calculating the negative sample loss function value of the neural network model by using a preset loss function; The target loss function value is calculated based on the positive sample loss function value, the negative sample loss function value, and the weight of the negative sample loss function value.

6. The method according to claim 5, It is characterized in that The positive sample loss function value of the neural network model is calculated by using a logloss loss function based on the positive and negative sample information of the first sub-sample set and the second sub-sample set having the same positive sample position, including: For each of the first positive samples, a set of the second subsample sets whose positive sample positions are the same as the sample positions of the first positive samples is determined; each time a second subsample set is selected from the second subsample sets, and based on the positive and negative sample information of the first subsample set corresponding to the first positive sample and the selected second subsample set, a set of loss function values ​​of the neural network model at the first positive sample is calculated by using a logloss loss function; and the minimum value of the set of loss function values ​​is used as the loss function value of the neural network model at the first positive sample; The average of the loss function values ​​of the neural network model at each of the first positive samples is used as the positive sample loss function value.

7. The method according to claim 5, It is characterized in that Before calculating the target loss function value based on the positive sample loss function value, the negative sample loss function value, and the weight of the negative sample loss function value, the method further includes: The weight of the negative sample loss function value is determined based on the number of positive and negative samples in the diffusion sample set.

8. A neural network model training device, It is characterized in that include: A labeled sample set acquisition module, used to acquire a labeled sample set, wherein the labeled sample set includes a sample set obtained by annotating positive and negative samples in an initial sample set; the initial sample set includes audio or images; A diffusion sample set acquisition module, used to diffuse the positive samples in the labeled sample set to obtain a diffusion sample set; A prediction sample set acquisition module is used to acquire a prediction sample set obtained after the neural network model performs positive and negative sample prediction on the initial sample set; A first sub-sample set determination module is used to determine, in the prediction sample set, a first sub-sample set corresponding to each first positive sample, wherein the first sub-sample set includes the corresponding first positive sample; and the first sub-sample set includes a sub-sample set obtained by slicing with the sample position of the first positive sample as the center and the truncation value corresponding to the first positive sample as the truncation radius; A second sub-sample set determination module is used to determine, in the diffuse sample set, samples at the same sample position as the first positive sample as second positive samples, and determine second sub-sample sets corresponding to each second positive sample, wherein the second sub-sample set contains the corresponding second positive sample; and the second sub-sample set includes a sub-sample set obtained by slicing with the sample position of the second positive sample as the center and a set of truncation values ​​corresponding to the second positive sample as the truncation radius; A loss function value calculation module, used to calculate the target loss function value of the neural network model based on the positive and negative sample information of the first sub-sample set and the second sub-sample set respectively having the same positive sample position, and based on the positive and negative sample information outside the first sub-sample set and the second sub-sample set; A model training module, used to train the neural network model based on the target loss function value to obtain a trained neural network model; Wherein, the diffusion sample set acquisition module includes: A truncation window value obtaining unit, used for obtaining a truncation window value; The diffusion sample set acquisition unit is used to assign values ​​to samples around the positive sample in the labeled sample set according to the truncation window value and the exponential decay rule to obtain the diffusion sample set.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the neural network model training method according to any one of claims 1 to 7 are implemented.