Sample generation method, device, electronic device and storage medium

By identifying and removing noise samples based on the loss value of the sample in the deep learning model training, the problem of noise samples affecting the model training effect in the prior art is solved, and the effect of improving the model accuracy and performance is achieved.

CN114118287BActive Publication Date: 2025-03-25BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111456664.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-30
Publication Date
2025-03-25
Estimated Expiration
2041-11-30

Smart Images

  • Figure CN114118287B_ABST
    Figure CN114118287B_ABST
Patent Text Reader

Abstract

The present disclosure provides a sample generation method, device, electronic device and storage medium, which relate to computer technology, artificial intelligence, and in particular to big data and deep learning. The specific implementation scheme is: for each sample in at least one sample set used to train a pre-trained model, determine the loss value corresponding to the sample in a single round of training the pre-trained model using the sample set corresponding to the sample, and obtain multiple loss values, wherein the pre-trained model includes a model obtained by training at least one sample set based on a first learning rate, and each sample set of at least one sample set includes multiple samples; and determine the noise sample based on the multiple loss values.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the fields of computer technology and artificial intelligence, and in particular to the fields of big data and deep learning. Specifically, it relates to a sample generation method, device, electronic device and storage medium. Background Art

[0002] Deep learning, also known as deep structured learning or hierarchical learning, is part of a broader family of machine learning methods based on artificial neural networks. Machine learning is the scientific study of algorithms and statistical models used by computer systems to efficiently perform specific tasks without explicit instructions, relying instead on patterns and reasoning. It is considered a subset of artificial intelligence. Machine learning algorithms build a mathematical model based on sample data, called "training data," in order to make predictions or decisions without being explicitly programmed to perform a task. Summary of the invention

[0003] The present disclosure provides a sample generation method, device, electronic device and storage medium.

[0004] According to one aspect of the present disclosure, a sample generation method is provided, comprising: for each sample in at least one sample set used to train a pre-trained model, determining a loss value corresponding to the sample in a single round of training the pre-trained model using a sample set corresponding to the sample, to obtain multiple loss values, wherein the pre-trained model includes a model trained according to the at least one sample set based on a first learning rate, and each sample set of the at least one sample set includes multiple samples; and determining a noise sample based on the multiple loss values.

[0005] According to another aspect of the present disclosure, a method for training a target processing model is provided, comprising: inputting an optimized sample set into the target processing model to obtain a first prediction result; training the target processing model based on the first prediction result; wherein the optimized sample set is generated using the above-mentioned sample generation method.

[0006] According to another aspect of the present disclosure, a target processing method is provided, comprising: inputting target object data into a target processing model to obtain a second prediction result; wherein the target processing model is trained using the above-mentioned target processing model training method.

[0007] According to one aspect of the present disclosure, a sample generation device is provided, comprising: a first determination module, for determining, for each sample in at least one sample set used to train a pre-trained model, a loss value corresponding to the sample in a single round of training the pre-trained model using a sample set corresponding to the sample, to obtain multiple loss values, wherein the pre-trained model comprises a model trained according to the at least one sample set based on a first learning rate, and each sample set of the at least one sample set comprises multiple samples; and a second determination module, for determining a noise sample according to the multiple loss values.

[0008] According to another aspect of the present disclosure, a training device for a target processing model is provided, comprising: a first acquisition module, used to input an optimized sample set into the target processing model to obtain a first prediction result; a training module, used to train the target processing model according to the first prediction result; wherein the optimized sample set is generated using the above-mentioned sample generation device.

[0009] According to another aspect of the present disclosure, a target processing device is provided, comprising: a second acquisition module, used to input target object data into a target processing model to obtain a second prediction result; wherein the target processing model is trained using the training device of the above-mentioned target processing model.

[0010] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the sample generation method or the training method of the target processing model or the target processing method as described above.

[0011] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the sample generation method or the target processing model training method or the target processing method as described above.

[0012] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the sample generation method or the target processing model training method or the target processing method as described above.

[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0015] Figure 1 An exemplary system architecture to which a sample generation method and apparatus or a training method and apparatus for a target processing model or a target processing method and apparatus according to an embodiment of the present disclosure can be applied is schematically shown;

[0016] Figure 2 The flowchart of the sample generation method according to the embodiment of the present disclosure is schematically shown;

[0017] Figure 3 The schematic diagram shows the change trend of the second learning rate determined based on formulas (1) to (2) according to an embodiment of the present disclosure;

[0018] Figure 4 The schematic diagram shows the change trend of the sample set Loss value obtained by training the pre-training model with the second learning rate determined based on formulas (1) to (2) according to an embodiment of the present disclosure;

[0019] Figure 5 The overall flow chart of the sample generation method according to the embodiment of the present disclosure is schematically shown;

[0020] Figure 6 A flowchart of a method for training a target processing model according to an embodiment of the present disclosure is schematically shown;

[0021] Figure 7 A flowchart of a method for training a target processing model according to an embodiment of the present disclosure is schematically shown;

[0022] Figure 8 A block diagram of a sample generating device according to an embodiment of the present disclosure is schematically shown;

[0023] Fig. 9 A block diagram schematically shows a training device for a target processing model according to an embodiment of the present disclosure;

[0024] Fig.10 A block diagram schematically shows a target processing device according to an embodiment of the present disclosure; and

[0025] Fig.11 A schematic block diagram of an example electronic device that can be used to implement embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0026] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0027] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply with the provisions of relevant laws and regulations, take necessary confidentiality measures, and do not violate public order and good morals.

[0028] Deep learning architectures, such as deep neural networks, deep belief networks, recurrent neural networks, and convolutional neural networks, have been applied to fields including computer vision, speech recognition, natural language processing, audio recognition, social network filtering, machine translation, bioinformatics, drug design, medical image analysis, material inspection, and board game programs. To ensure the accuracy of the output results in each field, corresponding model training is essential.

[0029] In the training of various models, as the training scale increases, the noise of training samples also increases. A small amount of noise in training samples can improve the robustness of the model, but in fact, there are many noise samples labeled manually or by machine, and some may exceed 5%, which will have a great impact on the training of the model and face the situation that the accuracy cannot be improved. Therefore, how to remove the noise samples in the training set has become one of the research hotspots.

[0030] There is a method for identifying noise samples, including: dividing a data set into two parts, data set one as a training set, data set two as a validation set, training a model on the training set. Using the model to score the validation set, a certain threshold is preset, and data below the threshold is regarded as a noise sample. Then, using data set one as a validation set and data set two as a training set, the same operation is performed.

[0031] The inventors found in the process of implementing the disclosed concept that the model training capability is not strong on half of the data, and it is easy to underfit, resulting in poor scoring effect. In practice, it is often difficult to find noise samples using the above method, and the denoising effect is not good.

[0032] The present disclosure provides a sample generation method, device, electronic device and storage medium, the method comprising: for each sample in at least one sample set used to train a pre-trained model, determining the loss value corresponding to the sample in a single round of training the pre-trained model using the sample set corresponding to the sample, and obtaining multiple loss values. The pre-trained model includes a model obtained by training at least one sample set based on a first learning rate, and each sample set of the at least one sample set includes multiple samples. According to the multiple loss values, a noise sample is determined.

[0033] Figure 1 An exemplary system architecture to which a sample generation method and apparatus or a training method and apparatus for a target processing model or a target processing method and apparatus according to an embodiment of the present disclosure can be applied is schematically shown.

[0034] It should be noted that Figure 1 What is shown is only an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios. For example, in another embodiment, an exemplary system architecture to which the sample generation method and apparatus or the training method and apparatus of the target processing model or the target processing method and apparatus can be applied may include a terminal device, but the terminal device may implement the sample generation method and apparatus or the training method and apparatus of the target processing model or the target processing method and apparatus provided in the embodiments of the present disclosure without interacting with the server.

[0035] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.

[0036] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients and / or social platform software, etc. (only as examples).

[0037] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0038] The server 105 may be a server that provides various services, such as a background management server that provides support for the content browsed by users using terminal devices 101, 102, and 103 (for example only). The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server for a distributed system, or a server combined with a blockchain.

[0039] It should be noted that the sample generation method or the target processing model training method or the target processing method provided in the embodiments of the present disclosure can generally be executed by the terminal device 101, 102, or 103. Accordingly, the sample generation device or the target processing model training device or the target processing device provided in the embodiments of the present disclosure can also be set in the terminal device 101, 102, or 103.

[0040] Alternatively, the sample generation method or the training method or the target processing method of the target processing model provided in the embodiment of the present disclosure may also be generally executed by the server 105. Accordingly, the sample generation device or the training method or the target processing device of the target processing model provided in the embodiment of the present disclosure may generally be arranged in the server 105. The sample generation method or the training method or the target processing method of the target processing model provided in the embodiment of the present disclosure may also be executed by a server or a server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the sample generation device or the training device or the target processing model provided in the embodiment of the present disclosure may also be arranged in a server or a server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105.

[0041] For example, when it is necessary to generate samples, the terminal devices 101, 102, and 103 can obtain at least one sample set for training a pre-trained model, and then send the obtained at least one sample set to the server 105, and the server 105 determines the loss value corresponding to the sample in a single round of training the pre-trained model using the sample set corresponding to the sample for each sample in the at least one sample set for training the pre-trained model, and obtains multiple loss values. The pre-trained model includes a model trained based on at least one sample set based on a first learning rate, and each sample set of the at least one sample set includes multiple samples. According to the multiple loss values, noise samples are determined. Alternatively, a server or server cluster that can communicate with the terminal devices 101, 102, 103 and / or the server 105 analyzes at least one sample set for training the pre-trained model, and determines the noise samples.

[0042] For example, when it is necessary to train the target processing model, the terminal devices 101, 102, and 103 may obtain an optimized sample set determined according to the aforementioned noise sample, and then send the obtained optimized sample set to the server 105, which inputs the optimized sample set into the target processing model to obtain a first prediction result. The target processing model is trained according to the first prediction result. Alternatively, a server or server cluster that can communicate with the terminal devices 101, 102, 103 and / or the server 105 analyzes the optimized sample set and implements the training of the target processing model.

[0043] For example, when the target needs to be processed, the terminal devices 101, 102, 103 can obtain the target object data, and then send the obtained target object data to the server 105, and the server 105 inputs the target object data into the target processing model to obtain the second prediction result. Alternatively, a server or server cluster that can communicate with the terminal devices 101, 102, 103 and / or the server 105 analyzes the target object data and implements the target processing.

[0044] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0045] Figure 2 The flowchart of the sample generation method according to the embodiment of the present disclosure is schematically shown.

[0046] like Figure 2 As shown, the method includes operations S210 to S220.

[0047] In operation S210, for each sample in at least one sample set used to train a pre-trained model, a loss value corresponding to the sample in a single round of training the pre-trained model using the sample set corresponding to the sample is determined to obtain multiple loss values, wherein the pre-trained model includes a model trained according to at least one sample set based on a first learning rate, and each sample set of the at least one sample set includes multiple samples.

[0048] In operation S220, a noise sample is determined according to the plurality of loss values.

[0049] According to an embodiment of the present disclosure, the model training process is from underfitting to overfitting. In the early stage of training, the model converges faster because the learning rate is relatively large and simple samples are learned first. In the later stage of training, the model tends to learn difficult samples, and noise samples, as part of the difficult samples, can be trained in the later stage. Because the model has a strong learning ability and in the later stage of model training, difficult samples are fitted, resulting in noise samples being learned as well, causing the model performance to deteriorate. In view of this, noise samples can be screened out based on the later training process of the model. The early training process of the model can be completed through pre-training.

[0050] For example, in the early stage of training, all data sets used to train the model can be used as training sets, and validation sets can be omitted. A larger batch_size = 256 can be used for each training round to determine a sample set. Batch_size can represent the number of samples input to the model in each training round during the training process. The larger the batch_size, the more samples there are. In this case, the impact of noise samples on the results can be relatively small. The first learning rate can use a fixed larger learning rate, such as 0.01. In this embodiment, the model can be trained based on the fixed larger learning rate of 0.01 and at least one sample set of batch_size = 256 until the accuracy of the sample output by the model remains basically unchanged, and the training process is stopped to obtain the above-mentioned pre-trained model. The obtained pre-trained model does not need to fit the training set too much, and the learning process of the noise sample is retained, so that the noise sample can be learned more efficiently in the later stage of training, which is convenient for screening out the noise sample.

[0051] According to an embodiment of the present disclosure, a single sample set in at least one sample set used for training to obtain a pre-trained model may be the same as a single sample set in at least one sample set used for training the pre-trained model until convergence. A single sample set in at least one sample set used for training the pre-trained model until convergence may also be a sample set having a smaller number of samples than a single sample set in at least one sample set used for training to obtain a pre-trained model.

[0052] For example, in the later stage of training, based on the pre-trained model obtained in the early stage of training and the training set used, a relatively small batch_size = 64 can be used to determine a sample set and train the pre-trained model until the pre-trained model converges. Using a smaller batch_size makes it easier to fit the sample, so that the noise sample can be learned more efficiently and the noise sample can be easily screened out.

[0053] According to the embodiments of the present disclosure, after each round of training of the pre-trained model using each sample set, the loss value corresponding to each sample in the sample set in the round can be obtained. The noise sample can be determined according to the size of the loss value, or according to the loss value combined with a predefined screening formula, which is not limited here.

[0054] Through the above-mentioned embodiments of the present disclosure, noise samples can be determined according to the loss value of each sample used to train the model, which is conducive to improving the accuracy of the determined noise samples and can effectively improve the performance of the model.

[0055] In conjunction with specific embodiments, Figure 2 The method shown is further explained.

[0056] According to an embodiment of the present disclosure, training a pre-trained model using a sample set corresponding to a sample may include: based on a second learning rate, performing multiple rounds of training on the pre-trained model using the sample set, wherein the value of the second learning rate periodically decreases with an increase in training rounds, and the maximum value of the second learning rate is less than the value of the first learning rate.

[0057] According to an embodiment of the present disclosure, the second learning rate can be determined by custom settings. For example, a preset number of gradually decreasing values ​​can be customized, each value can be a learning rate corresponding to a training round, and the preset number can be a change cycle, which can indicate that the preset number of gradually decreasing values ​​are polled once every preset number of training rounds. The second learning rate can also be determined by calculation through a predefined formula, for example.

[0058] For example, the second learning rate can be calculated and determined by the following formulas (1) to (2).

[0059]

[0060] r(t)=(1-s(t))×r1+s(t)×r2 Formula (2)

[0061] Wherein, t represents the training round, r(t) represents the learning rate used in the tth training round, r1 represents the preset maximum learning rate, for example, 0.01, r2 represents the preset minimum learning rate, for example, 0.001, and c represents the variation period of the second learning rate, for example, 10.

[0062] Figure 3 The diagram schematically shows a variation trend of the second learning rate determined based on formulas (1) to (2) according to an embodiment of the present disclosure.

[0063] like Figure 3 As shown, the horizontal axis can represent the training rounds, and the vertical axis can represent the value corresponding to the second learning rate in each training round. The horizontal axis 1c can determine the first change cycle, and each change cycle c can include multiple training rounds. The value of the learning rate in each change cycle is between the maximum value r1 and the minimum value r2.

[0064] Figure 4 The diagram schematically shows the change trend of the Loss value of the sample set obtained by training the pre-training model with the second learning rate determined based on formulas (1) to (2) according to an embodiment of the present disclosure.

[0065] like Figure 4 As shown, the horizontal axis can represent the training rounds, and the vertical axis can represent the loss value corresponding to each sample set in each training round. Line1, Line2, and Line3 can represent sample sets including 0% to 20% noise samples, 20% to 40% noise samples, and 40% to 60% noise samples, respectively. Line4 can represent a simple sample set, that is, a sample set that does not include noise samples.

[0066] according to Figure 4 It can be determined that in each change cycle, the Loss value of the simple sample set decreases rapidly, while the Loss value of the sample set containing noise samples decreases slowly and has a larger value.

[0067] Through the above-mentioned embodiments of the present disclosure, based on the fact that noise samples are difficult to fit and the Loss value of noise samples converges more slowly than the Loss value of simple samples, a periodically changing learning rate is used to train the pre-trained model, and it is easy to distinguish simple samples from noise samples according to the relative size of the Loss value, which is conducive to improving the accuracy of the determined noise samples and can effectively improve the performance of the model. In addition, the process of determining noise samples implemented by this method uses a relatively simple training process, and can easily determine noise samples from a sample set by only changing the learning rate and changing the period.

[0068] According to an embodiment of the present disclosure, determining the noise sample according to the multiple loss values ​​may include: determining a first preset number of target loss values ​​with larger values ​​according to the magnitudes of the multiple loss values, and determining the samples corresponding to the target loss values ​​as noise samples.

[0069] According to an embodiment of the present disclosure, a plurality of loss values ​​may be sorted first. Then, a first preset number of target loss values ​​with larger values ​​may be determined according to the sorting result, so that a noise sample may be determined accordingly. A corresponding first preset threshold value may also be set for a plurality of loss values ​​first. Then, a loss value greater than or equal to the first preset threshold value among the plurality of loss values ​​is determined as a target loss value, and a noise sample may be determined accordingly.

[0070] Through the above-mentioned embodiments of the present disclosure, noise samples can be determined from multiple samples according to the size of the loss values ​​corresponding to each of the multiple samples in a single training round. This method can be helpful in improving the accuracy of the determined noise samples, thereby effectively improving the performance of the model.

[0071] According to an embodiment of the present disclosure, determining a noise sample according to multiple loss values ​​may further include: determining the sum of the loss values ​​of all samples corresponding to a single round. For each sample in a single round, determining the ratio of the loss value of the sample to the sum of the loss values ​​to obtain multiple ratios. According to the magnitudes of the multiple ratios, determining a second preset number of target ratios with larger values. Determining the sample corresponding to the target ratio as a noise sample.

[0072] According to an embodiment of the present disclosure, the Loss value of each sample in each training round can be recorded, and through normalization processing, the ratio of the loss value of each sample in each round to the sum of the loss values ​​of all samples can be calculated. A plurality of ratios can be sorted first. Then, a second preset number of target ratios with larger values ​​can be determined based on the sorting result, so that noise samples can be determined accordingly. A corresponding second preset threshold can also be set for a plurality of ratios first. Then, a ratio greater than or equal to the second preset threshold among the plurality of ratios is determined as the target ratio, and a noise sample can be determined accordingly.

[0073] Through the above-mentioned embodiments of the present disclosure, noise samples can be determined from the multiple samples according to the ratio of the Loss values ​​of the multiple samples to the sum of the Loss values ​​of all samples in a single training round. This method can be helpful in improving the accuracy of the determined noise samples, thereby effectively improving the performance of the model.

[0074] According to an embodiment of the present disclosure, according to multiple loss values, determining a noise sample may also include: for each sample in a sample set used to train a pre-trained model and each training round of training the pre-trained model using the sample set, determining the loss value corresponding to the sample in the training round. For each sample, determining the sum of the loss values ​​corresponding to the sample in all training rounds to obtain the sum of multiple loss values. According to the size of the sum of the multiple loss values, determining the sum of a third preset number of target loss values ​​with larger values. Determine the sample corresponding to the sum of the target loss values ​​as a noise sample.

[0075] According to an embodiment of the present disclosure, the Loss value of each sample in each training round can be recorded. By counting the Loss values ​​of each sample in all training rounds in the later stage of training and summing them up, the sum of the above-mentioned loss values ​​can be obtained. Based on this, the sums of multiple loss values ​​can be sorted first. Then, the sum of the target loss values ​​with larger values ​​of a third preset number can be determined according to the sorting result, so that the noise sample can be determined accordingly. It is also possible to first set a corresponding third preset threshold for the sum of multiple loss values. Then, the sum of the loss values ​​in the sum of multiple loss values ​​that is greater than or equal to the third preset threshold can be determined as the sum of the target loss values, and the noise sample can be determined accordingly.

[0076] It should be noted that the values ​​of the first preset number, the second preset number and the third preset number may be the same or different, and their values ​​may be expressed in the form of percentages, for example, top_k%, where k may be 5, indicating that the top 5% loss values, ratios or sum of loss values ​​with larger values ​​are taken from the sorting results to determine the noise sample.

[0077] Through the above-mentioned embodiments of the present disclosure, the noise sample can be determined according to the sum of the Loss values ​​of each sample in all rounds. This method can be helpful in improving the accuracy of the determined noise sample, thereby effectively improving the performance of the model.

[0078] According to an embodiment of the present disclosure, the sample generation method may further include: when it is determined that there are noise samples in the sample set, filtering the noise samples from the sample set to obtain an optimized sample set.

[0079] According to an embodiment of the present disclosure, after obtaining the noise samples according to the above method, the noise samples can be taken out of the training set as a validation set, and the training set without the noise samples can be used as a training set again for model training.

[0080] According to an embodiment of the present disclosure, the model training process may adopt a large batch_size=256, a learning rate=0.01, a training round=30, and a learning rate reduction of 10 times every 10 rounds, and may not be limited thereto.

[0081] Through the above-mentioned embodiments of the present disclosure, a simple and effective method for removing noise samples in a training set is provided, which can effectively improve the performance of the model.

[0082] According to an embodiment of the present disclosure, the sample generation method may further include: when it is determined that a noise sample exists in the sample set, updating the label of the noise sample to obtain an optimized sample set.

[0083] According to an embodiment of the present disclosure, after obtaining a noise sample according to the above method, the sample labels in the training set can be updated. For example, the initial labels of some samples in the training set are non-noise sample related labels, but the sample is determined to be a noise sample according to the above method, and the label of the sample can be updated to a noise sample related label. The training set after the label is updated can be retrained for the model.

[0084] Through the above-mentioned embodiments of the present disclosure, a simple and effective method for updating sample labels in a training set is provided, which can effectively improve the performance of the model.

[0085] According to an embodiment of the present disclosure, the above-mentioned sample may include at least one of an image sample, an audio sample, and a text sample, and may not be limited thereto.

[0086] Through the above-mentioned embodiments of the present disclosure, the above-mentioned sample generation method can be applied to various fields such as image, audio, text, video, and other fine-grained classifications, reflecting the wide application of the method.

[0087] Figure 5 The overall flow chart of the sample generation method according to the embodiment of the present disclosure is schematically shown.

[0088] like Figure 5 As shown, the method includes operations S510 to S570.

[0089] In operation S510, for each sample in a sample set used to train a pre-trained model and each training round in which the pre-trained model is trained using the sample set, a loss value corresponding to the sample in the training round is determined.

[0090] In operation S520, a first preset number of target samples with larger loss values ​​are determined according to the size of the loss value corresponding to each sample.

[0091] In operation S530, a second preset number of target samples with larger ratios are determined according to the ratio of the loss value corresponding to each sample to the sum of the loss values ​​corresponding to all samples in the training round corresponding to the sample.

[0092] In operation S540, a third preset number of target samples having a larger sum of loss values ​​is determined according to the sum of loss values ​​corresponding to each sample in all training rounds.

[0093] In operation S550, the target sample is determined as a noise sample.

[0094] In operation S560, the noise samples are filtered out from the sample set to obtain an optimized sample set.

[0095] In operation S570, labels of noise samples in the sample set are updated according to the determined noise samples to obtain an optimized sample set.

[0096] Through the above embodiments of the present disclosure, a better sample generation method is provided, which can clean the training set and improve the accuracy of the model. It can be applied to various fields such as adaptive classification and fine-grained classification, reflecting the wide application of this method.

[0097] Figure 6 A flowchart of a method for training a target processing model according to an embodiment of the present disclosure is schematically shown.

[0098] like Figure 6 As shown, the method includes operations S610 to S620.

[0099] In operation S610, the optimized sample set is input into a target processing model to obtain a first prediction result.

[0100] In operation S620, a target processing model is trained according to the first prediction result.

[0101] According to an embodiment of the present disclosure, the optimized sample set is generated using the above-mentioned sample generation method.

[0102] Through the above embodiments of the present disclosure, the above optimized samples can be used in the training of respective models, which can effectively improve the performance of the model.

[0103] Figure 7 A flowchart of a method for training a target processing model according to an embodiment of the present disclosure is schematically shown.

[0104] like Figure 7 As shown, the method includes operation S710.

[0105] In operation S710, target object data is input into a target processing model to obtain a second prediction result.

[0106] According to an embodiment of the present disclosure, the target processing model is trained using the above-mentioned target processing model training method.

[0107] Through the above-mentioned embodiments of the present disclosure, the model trained based on the above-mentioned optimized samples can be used in respective model applications, which can effectively improve the accuracy of the model output results.

[0108] Figure 8 The block diagram of a sample generating device according to an embodiment of the present disclosure is schematically shown.

[0109] like Figure 8 As shown, the sample generating device 800 includes a first determining module 810 and a second determining module 820 .

[0110] The first determination module 810 is used to determine, for each sample in at least one sample set used to train a pre-trained model, a loss value corresponding to the sample in a single round of training the pre-trained model using the sample set corresponding to the sample, and obtain multiple loss values. The pre-trained model includes a model trained according to at least one sample set based on a first learning rate, and each sample set of the at least one sample set includes multiple samples.

[0111] The second determination module 820 is used to determine a noise sample according to a plurality of loss values.

[0112] According to an embodiment of the present disclosure, the first determination module includes a training unit.

[0113] The training unit is used to perform multiple rounds of training on the pre-trained model using a sample set based on a second learning rate, wherein the value of the second learning rate decreases periodically as the number of training rounds increases, and the maximum value of the second learning rate is less than the value of the first learning rate.

[0114] According to an embodiment of the present disclosure, the second determining module includes a first determining unit and a second determining unit.

[0115] The first determining unit is used to determine a first preset number of target loss values ​​with larger values ​​according to the magnitudes of the plurality of loss values.

[0116] The second determining unit is used to determine the sample corresponding to the target loss value as a noise sample.

[0117] According to an embodiment of the present disclosure, the second determining module includes a third determining unit, a fourth determining unit, a fifth determining unit, and a sixth determining unit.

[0118] The third determining unit is used to determine the sum of loss values ​​of all samples corresponding to a single round.

[0119] The fourth determination unit is used to determine, for each sample in a single round, a ratio of the loss value of the sample to the sum of the loss values ​​to obtain multiple ratios.

[0120] The fifth determining unit is used to determine a second preset number of target ratios with larger values ​​according to the sizes of the multiple ratios.

[0121] The sixth determining unit is used to determine the sample corresponding to the target ratio as a noise sample.

[0122] According to an embodiment of the present disclosure, the second determining module includes a seventh determining unit, an eighth determining unit, a ninth determining unit, and a tenth determining unit.

[0123] The seventh determination unit is used to determine the loss value corresponding to the sample in the training round for each sample in the sample set used to train the pre-training model and each training round of training the pre-training model using the sample set.

[0124] The eighth determination unit is used to determine, for each sample, the sum of the loss values ​​corresponding to the sample in all training rounds, and obtain the sum of multiple loss values.

[0125] The ninth determining unit is used to determine the sum of a third preset number of target loss values ​​with larger values ​​according to the size of the sum of multiple loss values.

[0126] The tenth determining unit is used to determine the sample corresponding to the sum of the target loss values ​​as a noise sample.

[0127] According to an embodiment of the present disclosure, the sample generating device further includes a filtering module.

[0128] The filtering module is used to filter out the noise samples from the sample set when it is determined that there are noise samples in the sample set, so as to obtain an optimized sample set.

[0129] According to an embodiment of the present disclosure, the sample generating apparatus further includes an updating module.

[0130] The updating module is used to update the labels of the noise samples when it is determined that there are noise samples in the sample set, so as to obtain an optimized sample set.

[0131] According to an embodiment of the present disclosure, the sample includes at least one of an image sample, an audio sample, and a text sample.

[0132] Fig. 9 A block diagram of a training device for a target processing model according to an embodiment of the present disclosure is schematically shown.

[0133] like Fig. 9 As shown, the training device 900 of the target processing model includes a first acquisition module 910 and a training module 920.

[0134] The first acquisition module 910 is used to input the optimized sample set into the target processing model to obtain the first prediction result. The optimized sample set is generated by using the above-mentioned sample generation device.

[0135] The training module 920 is used to train the target processing model according to the first prediction result.

[0136] Fig.10 The block diagram schematically shows a target processing device according to an embodiment of the present disclosure.

[0137] like Fig.10 As shown, the target processing device 1000 includes a second obtaining module 1010 .

[0138] The second obtaining module 1010 is used to input the target object data into the target processing model to obtain the second prediction result. The target processing model is trained using the training device of the target processing model.

[0139] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0140] According to an embodiment of the present disclosure, an electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the sample generation method or the training method of the target processing model or the target processing method as described above.

[0141] According to an embodiment of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the sample generation method or the target processing model training method or the target processing method as described above.

[0142] According to an embodiment of the present disclosure, a computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the sample generation method or the training method of the target processing model or the target processing method as described above.

[0143] Fig.11 A schematic block diagram of an example electronic device 1100 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0144] like Fig.11As shown, the device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1102 or a computer program loaded from a storage unit 1108 into a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the device 1100 can also be stored. The computing unit 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.

[0145] A number of components in the device 1100 are connected to the I / O interface 1105, including: an input unit 1106, such as a keyboard, a mouse, etc.; an output unit 1107, such as various types of displays, speakers, etc.; a storage unit 1108, such as a disk, an optical disk, etc.; and a communication unit 1109, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1109 allows the device 1100 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0146] The computing unit 1101 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1101 performs the various methods and processes described above, such as a sample generation method or a training method or a target processing model for a target processing model. For example, in some embodiments, the sample generation method or the training method or the target processing method for a target processing model may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1108. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1100 via the ROM 1102 and / or the communication unit 1109. When the computer program is loaded into the RAM 1103 and executed by the computing unit 1101, one or more steps of the sample generation method or the training method or the target processing model for a target processing model described above may be executed. Alternatively, in other embodiments, the computing unit 1101 may be configured to execute a sample generation method or a training method of a target processing model or a target processing method in any other suitable manner (eg, by means of firmware).

[0147] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0148] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0149] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0150] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0151] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0152] A computer system may include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises through computer programs running on respective computers and having a client-server relationship to each other. The server may be a cloud server, a server in a distributed system, or a server combined with a blockchain.

[0153] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0154] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A sample generation method, comprising: For each sample in at least one sample set used to train a pre-trained model, determine a loss value corresponding to the sample in a single round of training the pre-trained model using a sample set corresponding to the sample, to obtain a plurality of loss values, wherein the pre-trained model includes a model trained according to the at least one sample set based on a first learning rate, and each sample set of the at least one sample set includes a plurality of samples; and Determining the noise sample according to the multiple loss values ​​includes: for each sample in the sample set used to train the pre-trained model and each training round of training the pre-trained model using the sample set, determining the loss value corresponding to the sample in the training round; for each sample, determining the sum of the loss values ​​corresponding to the sample in all the training rounds to obtain the sum of multiple loss values; determining the sum of a third preset number of target loss values ​​with larger values ​​according to the size of the sum of the multiple loss values; and determining the sample corresponding to the sum of the target loss values ​​as the noise sample; The step of training the pre-trained model using the sample set corresponding to the sample comprises: performing multiple rounds of training on the pre-trained model using the sample set based on a second learning rate, wherein the value of the second learning rate decreases periodically with an increase in the number of training rounds, and the maximum value of the second learning rate is less than the value of the first learning rate; The sample includes at least one of an image sample, an audio sample and a text sample.

2. The method according to claim 1, further comprising: When it is determined that the noise sample exists in the sample set, the noise sample is filtered out from the sample set to obtain an optimized sample set.

3. The method according to claim 1, further comprising: When it is determined that the noise sample exists in the sample set, the label of the noise sample is updated to obtain an optimized sample set.

4. A method for training a target processing model, comprising: Inputting the optimized sample set into the target processing model to obtain a first prediction result; Training the target processing model according to the first prediction result; The optimized sample set is generated using the method according to claim 2 or 3.

5. A target processing method, comprising: Inputting the target object data into the target processing model to obtain a second prediction result; Wherein, the target processing model is trained using the method according to claim 4.

6. A sample generation device, comprising: A first determination module is configured to determine, for each sample in at least one sample set used to train a pre-trained model, a loss value corresponding to the sample in a single round of training the pre-trained model using a sample set corresponding to the sample, to obtain a plurality of loss values, wherein the pre-trained model includes a model trained according to the at least one sample set based on a first learning rate, and each sample set of the at least one sample set includes a plurality of samples; and A second determination module is used to determine the noise sample according to the multiple loss values, including: for each sample in the sample set used to train the pre-trained model and each training round of training the pre-trained model using the sample set, determining the loss value corresponding to the sample in the training round; for each sample, determining the sum of the loss values ​​corresponding to the sample in all the training rounds to obtain the sum of multiple loss values; according to the size of the sum of the multiple loss values, determining the sum of a third preset number of target loss values ​​with larger values; and determining the sample corresponding to the sum of the target loss values ​​as the noise sample; Among them, the training of the pre-trained model using the sample set corresponding to the sample includes: based on a second learning rate, performing multiple rounds of training on the pre-trained model using the sample set, wherein the value of the second learning rate periodically decreases with the increase of training rounds, and the maximum value of the second learning rate is less than the value of the first learning rate.

7. The apparatus according to claim 6, further comprising: The filtering module is used to filter out the noise sample from the sample set when it is determined that the noise sample exists in the sample set, so as to obtain an optimized sample set.

8. The apparatus according to claim 6, further comprising: The updating module is used to update the label of the noise sample when it is determined that the noise sample exists in the sample set, so as to obtain an optimized sample set.

9. A training device for a target processing model, comprising: A first acquisition module, used for inputting the optimized sample set into the target processing model to obtain a first prediction result; A training module, used for training the target processing model according to the first prediction result; The optimized sample set is generated using the device according to claim 7 or 8.

10. A target processing device, comprising: A second acquisition module, used for inputting the target object data into the target processing model to obtain a second prediction result; Wherein, the target processing model is trained using the apparatus according to claim 9.

11. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 3 or claim 4 or claim 5.

12. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 3 or claim 4 or claim 5.

13. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 3 or claim 4 or claim 5.

Citation Information

Patent Citations

  • A method and apparatus for generating a model

    CN109376267A

  • Labeling method and device, server and storage medium

    CN111291618A