Method, device, equipment and medium for model training based on multiple sample sets

By adjusting the proportion of general and specific sample sets for multiple rounds of training, the problem of insufficient accuracy of neural network classification models under a small sample set is solved, and high-precision recognition in specific scenarios is achieved.

CN114528993BActive Publication Date: 2025-08-22PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210252233.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-15
Publication Date
2025-08-22
Estimated Expiration
2042-03-15

AI Technical Summary

Technical Problem

In specific scenarios, it is difficult for the existing technology to use a small set of samples to train high-precision neural network classification models. As the awareness of privacy protection increases, it is difficult to collect face data, and existing transfer learning is difficult to obtain accurate models.

Method used

By obtaining a general sample set and a specific sample set, adjusting the sample proportions for multiple rounds of training, including general training, specific scenario training and convergence training, gradually improving the recognition accuracy of the neural network.

Benefits of technology

In the case of small sample sets, by adjusting the sample data type proportion multiple times, the recognition accuracy of the target neural network classification model is enhanced, and the problem of insufficient recognition accuracy in specific scenarios is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114528993B_ABST
    Figure CN114528993B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention provide a method, apparatus, device, and medium for model training based on multiple sample sets, relating to the field of computer technology. The method includes: combining general data in a general sample set and specific data in a specific sample set according to a preset first sample ratio and a second sample ratio, respectively, to obtain a first training sample set and a second training sample set; performing multiple rounds of general training on a first neural network based on the first training sample set to obtain a second neural network; adjusting the relative proportions of general data and specific data in the first training sample set in at least one round of general training; performing at least one round of scenario-specific training on the second neural network based on the specific sample set to obtain a third neural network; and performing at least one round of convergence training on the third neural network based on the second training sample set and the specific sample set, respectively, to obtain a target neural network classification model. The apparatus, device, and storage medium applying the above method can improve the accuracy of the neural network classification model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, apparatus, device and medium for model training based on multiple sample sets. Background Art

[0002] As artificial intelligence algorithms become increasingly widespread in various production systems, the demand for AI precision is also increasing. Among them, neural network training, as the most representative algorithm in the concept of artificial intelligence, is widely used in neural network classification models related to face recognition and sorting. Taking face recognition as an example, as facial datasets continue to grow, model accuracy is also continuously improving. However, sufficiently generalized face recognition models are difficult to achieve, and therefore, accuracy in specific scenarios is often insufficient. Furthermore, with the increasing awareness of privacy protection, the collection of facial data is becoming increasingly difficult, and existing transfer learning methods (fintune) struggle to produce relatively accurate models. Furthermore, using a small sample set for training makes it difficult to ensure high accuracy in specific scenarios. Therefore, how to train neural network classification models using a small sample set to achieve high accuracy is an urgent problem. Summary of the Invention

[0003] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.

[0004] Embodiments of the present invention provide a method, apparatus, device, and medium for model training based on multiple sample sets, which can improve the accuracy of a neural network classification model when the sample sets are small.

[0005] In a first aspect, an embodiment of the present invention provides a method for model training based on multiple sample sets, comprising:

[0006] Obtain general sample sets and specific sample sets;

[0007] Combining the general data in the general sample set and the specific data in the specific sample set according to a preset first sample ratio to obtain a first training sample set;

[0008] Obtaining a first neural network, performing multiple rounds of general training on the first neural network based on a first training sample set until a first training termination condition is satisfied, thereby obtaining a second neural network; wherein, in at least one round of the general training, adjusting the relative proportions of the general data and the specific data in the first training sample set;

[0009] Performing at least one round of specific scenario training on the second neural network based on the specific sample set until a second training end condition is met, thereby obtaining a third neural network;

[0010] Combining the general data in the general sample set and the specific data in the specific sample set according to a preset second sample ratio to obtain a second training sample set;

[0011] performing at least one round of convergence training on the third neural network based on the second training sample set until a third training end condition is met, thereby obtaining a fourth neural network;

[0012] The fourth neural network is subjected to at least one round of convergence training based on the specific sample set until a convergence condition is met, thereby obtaining a target neural network classification model.

[0013] According to some embodiments of the present invention, the model training method provides a method of performing multiple rounds of general training on the first neural network based on the first training sample set until a first training termination condition is satisfied, thereby obtaining a second neural network; wherein, in at least one round of the general training, adjusting the relative proportions of the general data and the specific data in the first training sample set includes:

[0014] Performing the current round of general training on the first neural network based on the first training sample set;

[0015] At the end of the current round of the general training, obtaining convergence data of the first neural network;

[0016] matching the convergence data of the first neural network with preset convergence data;

[0017] When the convergence data of the first neural network matches the preset convergence data, determining that the current round of the general training meets the first training end condition, and using the current first neural network as the second neural network;

[0018] When the convergence data of the first neural network does not match the preset convergence data, determining whether the sample adjustment condition is met based on the general scenario loss value of the first neural network; wherein the general scenario loss value is calculated based on the output data of the first neural network in the current round and the expected output data;

[0019] When a sample adjustment condition is met, adjusting the relative proportions of the general data and the specific data in the first training sample set, and performing the next round of the general training based on the adjusted first training sample set;

[0020] When the sample adjustment condition is not met, the next round of general training is performed based on the first training sample set of the current round.

[0021] According to the model training method provided by some embodiments of the present invention, determining whether a sample adjustment condition is met based on a general scenario loss value includes:

[0022] Obtaining the sample size of the specific sample set and the degree of difference between the specific sample set and the general sample set;

[0023] When the sample size of the specific sample set is less than a preset quantity threshold and the degree of difference is less than a preset difference threshold, and when the general scenario loss value meets the preset loss threshold, it is determined that the sample adjustment condition is met.

[0024] According to some embodiments of the present invention, the model training method provided herein, wherein determining whether a sample adjustment condition is met based on a general scenario loss value further includes:

[0025] When it is determined that any one of the preset prerequisites is met, determining whether the change trend of the loss value of the general scenario is a downward trend, wherein the preset prerequisite includes any one of the following: the sample size of the specific sample set is greater than or equal to a preset quantity threshold; or the difference degree is greater than or equal to a preset difference threshold;

[0026] When the change trend of the loss value of the general scenario is a downward trend, it is determined that the sample adjustment condition is met.

[0027] According to some embodiments of the present invention, the model training method provided by the embodiment of the present invention, obtaining convergence data of the first neural network at the end of the current round of the general training, includes:

[0028] At the end of the general training of the current round, calculating the decrease corresponding to the general scenario loss value of the current round;

[0029] Using the decrease amplitude as convergence data of the first neural network;

[0030] The sample ratio of the general sample set to the specific sample set is used as preset convergence data.

[0031] According to some embodiments of the present invention, the model training method provides performing at least one round of specific scenario training on the second neural network based on the specific sample set until a second training end condition is met to obtain a third neural network, including:

[0032] Inputting the specific sample set into the second neural network to perform a first round of specific scenario training;

[0033] Determining whether a specific scenario loss value of the specific scenario training shows an upward trend;

[0034] When the specific scenario loss value of the specific scenario training shows an upward trend, the specific sample set is input into the second neural network multiple times for multiple training until a second training end condition is met, where the second training end condition is that the specific scenario loss value is less than or equal to the general scenario loss value at the end of the general training;

[0035] When the loss value of the specific scenario shows a non-increasing trend, adjusting the specific number of training rounds of the specific scenario training according to the sample ratio of the general sample set to the specific sample set and the general number of training rounds of the general training; and training the specific scenario training for the specific number of training rounds using the specific sample set;

[0036] The trained second neural network is used as the third neural network.

[0037] According to some embodiments of the present invention, the model training method provides performing at least one round of convergence training on the third neural network based on the second training sample set until a third training end condition is satisfied to obtain a fourth neural network, including:

[0038] The second training sample set is input into the neural network classification model and convergence training is repeated multiple times until a third training end condition is met to obtain the fourth neural network, wherein the third training end condition is that the convergence loss value of the convergence training shows a downward trend.

[0039] In a second aspect, an embodiment of the present invention further provides an apparatus for model training based on multiple sample sets, comprising: an acquisition module for acquiring a general sample set and a specific sample set;

[0040] A first training sample set processing module, configured to combine the general data in the general sample set and the specific data in the specific sample set according to a preset first sample ratio to obtain a first training sample set;

[0041] a general training module, configured to obtain a first neural network, perform multiple rounds of general training on the first neural network based on a first training sample set until a first training termination condition is satisfied, thereby obtaining a second neural network; wherein, in at least one round of the general training, the relative proportions of the general data and the specific data in the first training sample set are adjusted;

[0042] a specific scenario training module, configured to perform at least one round of specific scenario training on the second neural network based on the specific sample set until a second training end condition is met, thereby obtaining a third neural network;

[0043] A second training sample set processing module, configured to combine the general data in the general sample set and the specific data in the specific sample set according to a preset second sample ratio to obtain a second training sample set;

[0044] a first convergence training module, configured to perform at least one round of convergence training on the third neural network based on the second training sample set until a third training end condition is met, thereby obtaining a fourth neural network;

[0045] The second convergence training module is used to perform at least one round of convergence training on the fourth neural network based on the specific sample set until the convergence condition is met to obtain a target neural network classification model.

[0046] In a third aspect, an embodiment of the present invention further provides at least one processor, and a memory communicatively connected to the at least one processor; wherein the memory stores instructions, and the instructions are executed by the at least one processor so that when the at least one processor executes the instructions, the method for model training based on multiple sample sets as described in any one of the first aspects is implemented.

[0047] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the method for model training based on multiple sample sets described in any one of the aspects.

[0048] The above-mentioned embodiments of the present invention include at least the following beneficial effects: by combining general sample sets and specific sample sets in different ways to obtain corresponding training sets, and based on different training sets, respectively performing general training of the first neural network, specific training of the second neural network, and convergence training of the third neural network and the fourth neural network, it is possible to enhance the recognition accuracy of the target neural network classification model by repeatedly adjusting the sample data type ratio when the specific sample set is small, thereby solving the problem of improving the accuracy of the neural network classification model when the sample set is small.

[0049] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purposes and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation to the technical solution of the present invention.

[0051] Figure 1 1 is a flow chart of a model training method according to an embodiment of the present invention;

[0052] Figure 2 Schematic diagram of the evolution of a neural network in the model training method according to an embodiment of the present invention;

[0053] Figure 3 3 is a flow chart of step S300 of the method for model training according to an embodiment of the present invention;

[0054] Figure 4 4 is a flow chart of step S400 of the method for model training according to an embodiment of the present invention;

[0055] Figure 5 1 is a module structure diagram of a device for model training according to an embodiment of the present invention;

[0056] Figure 6 is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention pertains. The terms used herein are for the purpose of describing embodiments of the present invention only and are not intended to limit the present invention.

[0059] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.

[0060] As artificial intelligence algorithms are increasingly used in various production systems, the requirements for AI precision are also increasing. Among them, neural network training, as the most representative algorithm in the concept of artificial intelligence, is widely used in neural network classification models related to face recognition, sorting, and other fields. Taking face recognition as an example, as the number of facial datasets continues to increase, model accuracy is also continuously improving. However, sufficiently generalized face recognition models are difficult to achieve, and therefore, accuracy in specific scenarios often exhibits insufficient recognition accuracy. At the same time, with the widespread awareness of privacy protection, the collection of facial data is becoming increasingly difficult, and existing transfer learning (fintune) methods struggle to obtain relatively accurate models. Using a small number of sample sets for training, high accuracy in specific scenarios is difficult to guarantee. Therefore, how to use a small number of sample sets to train a neural network classification model to obtain a highly accurate neural network classification model is an urgent problem to be solved. Based on this, the methods, devices, equipment, and media for model training based on multiple sample sets proposed in the embodiments of the present invention can improve the accuracy of neural network classification models when the sample sets are small.

[0061] In the first aspect, the embodiment of the present invention proposes a method for model training based on multiple sample sets, such as Figure 1 and Figure 2 As shown, the method includes:

[0062] Step S100: Acquire a general sample set and a specific sample set.

[0063] It should be noted that a specific sample set represents a collection of sample data for a specific scenario, while a general sample set represents a collection of sample data covering a variety of scenarios. The general data in a general sample set is mostly obtained from public channels, and a general sample set can also contain sample data for corresponding scenarios in a specific sample set. General and specific sample sets can include facial data or food samples awaiting classification.

[0064] Step S200: Combine the general data in the general sample set and the specific data in the specific sample set according to a preset first sample ratio to obtain a first training sample set.

[0065] It should be noted that the first sample ratio represents the relative proportion of general data to specific data. A preferred initial value of the first sample ratio is 100% of the general data relative to the specific data, meaning that the first training sample set initially consists entirely of general data. In other embodiments, the first sample ratio may also be set to A% of the general data relative to the specific data, where A is a user-preset value, and the general data ratio is initially relatively high, such as 80%.

[0066] For example, a portion of the general data (e.g., 60%) in the general sample set is used as the first training sample set. For another example, a portion of the general data in the general sample set and a portion of the specific data in the specific sample set are used to obtain the first training sample set. For another example, all the general data in the general sample set is removed as the first training sample set.

[0067] Step S300: Obtain a first neural network, perform multiple rounds of general training on the first neural network based on a first training sample set until a first training end condition is met, and obtain a second neural network; wherein, in at least one round of general training, adjust the relative proportions of general data and specific data in the first training sample set.

[0068] It should be noted that at least one round of training is performed for each relative proportion of the first training sample set. When there are multiple rounds of relative proportion adjustment, each round of adjustment will increase the relative proportion of the specific data. For example, in the first relative proportion adjustment, the proportion of general data is 70% and the proportion of specific data is 30%. In the next relative proportion adjustment, the proportion of general data is adjusted to 60% and the proportion of specific data is adjusted to 30%. By gradually increasing the proportion of specific data, the classification accuracy of the first neural network is improved.

[0069] It should be noted that in the general training process, after each round of training, the first neural network will calculate a loss value. The change trend of the loss value can be used to determine whether to adjust the relative proportion. If the loss value decreases, the relative proportion is adjusted until the first training end condition is met, or after the loss value drops to a preset value, the relative proportion is adjusted by a certain proportion for multiple consecutive rounds until the first training end condition is met.

[0070] It should be noted that, during the general training process, general data and specific data other than step S100 may be obtained, thereby expanding the number of samples in the first training sample set during the training process.

[0071] Step S400: Perform at least one round of specific scenario training on the second neural network based on the specific sample set until a second training end condition is met, thereby obtaining a third neural network.

[0072] It should be noted that the second training end condition can be a specific number of rounds, and the second training end condition can also be that after the loss value shows an increase, the loss value of the current round is less than or equal to the initial loss value of the second neural network. The number of rounds of specific scenario training can be changed dynamically. For example, during training, if the loss value (loss) of the second neural network does not increase in the current round of specific scenario training, it means that the second neural network already contains sufficient specified scenario information. In this case, the number of rounds of specific scenario training n2 can be adjusted to n2 = n1 × (Ca / Cs), where n1 is the number of rounds of general training, Ca represents the number of samples in the specific sample set in step S100, and Cs represents the number of samples in the general sample set in step S100.

[0073] Step S500: Combine the general data in the general sample set and the specific data in the specific sample set according to a preset second sample ratio to obtain a second training sample set.

[0074] It should be noted that the second sample ratio is a fixed ratio. During the training of the third neural network, the relative proportions of general data and specific data in the second training sample set remain unchanged.

[0075] It should be noted that, in some embodiments, preferably, the second sample ratio is set to Ca / Cs.

[0076] Step S600: Perform at least one round of convergence training on the third neural network based on the second training sample set until a third training end condition is met, thereby obtaining a fourth neural network.

[0077] It should be noted that, in some embodiments, the general data and specific data can be expanded during the training process, but the relative proportions of the expanded general data and specific data remain unchanged (i.e., the ratio of specific data to general data in the expanded second training sample set is still Ca / Cs), thereby improving the recognition accuracy of the third neural network model.

[0078] It should be noted that the third training end condition can be a preset number of training rounds or a loss value less than or equal to a preset value. The number of training rounds will dynamically increase or decrease during the training process according to the change in the loss value of the corresponding training model.

[0079] Step S700: Perform at least one round of convergence training on the fourth neural network based on the specific sample set until the convergence condition is met, thereby obtaining a target neural network classification model.

[0080] Therefore, by combining general sample sets and specific sample sets in different ways to obtain corresponding training sets, and based on different training sets, general training of the first neural network, specific training of the second neural network, convergence training of the third neural network and the fourth neural network are respectively performed, so that when the specific sample sets are small, the recognition accuracy of the target neural network classification model can be enhanced by repeatedly adjusting the sample data type ratio, thereby solving the problem of improving the accuracy of the neural network classification model when the sample sets are small.

[0081] For example, refer to Figure 2 As shown, after obtaining the general sample set and the specific sample set, the target neural network classification model is obtained by adjusting the relative proportions of different types of sample data used for training the sample set and performing training respectively.

[0082] It is understandable that referring to Figure 3 As shown, step S300, based on the first training sample set, multiple rounds of general training are performed on the first neural network until the first training end condition is met, thereby obtaining a second neural network; wherein, in at least one round of general training, the relative proportions of general data and specific data in the first training sample set are adjusted, including:

[0083] Step S310: Perform a current round of general training on the first neural network based on the first training sample set.

[0084] Step S320: When the current round of general training ends, obtain convergence data of the first neural network.

[0085] It should be noted that the convergence state of the first neural network represented by the convergence data is calculated based on the loss value of the first neural network. For example, in the initial state, the general scenario loss value is set to loss0. When one round of general training is completed, the general scenario loss value of that round is set to loss0. n The corresponding decrease is 1-loss n / loss0 is defined as convergence data.

[0086] Step S330: Match the convergence data of the first neural network with the preset convergence data.

[0087] Step S340: When the convergence data of the first neural network matches the preset convergence data, it is determined that the current round of general training meets the first training end condition, and the current first neural network is used as the second neural network.

[0088] For example, the general scenario loss value loss n The corresponding decrease is 1-loss n If / loss0 matches the preset value (such as Ca / Cs), the general training ends.

[0089] Step S350: When the convergence data of the first neural network does not match the preset convergence data, determine whether the sample adjustment condition is met based on the general scenario loss value of the first neural network; wherein the general scenario loss value is calculated based on the output data of the first neural network in the current round and the expected output data.

[0090] Step S360: When the sample adjustment condition is met, the relative proportions of general data and specific data in the first training sample set are adjusted, and the next round of general training is performed based on the adjusted first training sample set.

[0091] Step S370: When the sample adjustment condition is not met, perform the next round of general training based on the first training sample set of the current round.

[0092] It is understandable that in step S350, whether the sample adjustment condition is met is determined based on the general scenario loss value of the first neural network, including: obtaining the sample size of the specific sample set, and the degree of difference between the specific sample set and the general sample set; when the sample size of the specific sample set is less than the preset quantity threshold and the degree of difference is less than the preset difference threshold, when the general scenario loss value meets the preset loss threshold, it is determined that the sample adjustment condition is met.

[0093] It should be noted that, assuming the loss value of the target neural network classification model is set to loss d , then the loss threshold loss m =loss d ±Δloss, that is, loss d In loss d -Δloss and loss d A range of +Δloss indicates that the preset loss threshold has been met. At this point, the sample adjustment conditions are met, and the relative proportions are adjusted. Δloss is a set smaller value. This approach can further improve the recognition accuracy of the target neural network classification model when the number of samples of specific data is small.

[0094] It should be noted that adjusting the relative proportion means increasing the relative proportion of specific data.

[0095] It is understandable that, in step S350, judging whether the sample adjustment condition is met according to the general scenario loss value of the first neural network further includes:

[0096] When it is determined that any one of the preset prerequisites is met, it is determined whether the change trend of the loss value of the general scenario is a downward trend, wherein the preset prerequisite includes any one of the following: the sample size of the specific sample set is greater than or equal to the preset quantity threshold; or the difference degree is greater than or equal to the preset difference threshold;

[0097] When the change trend of the loss value of the general scenario shows a downward trend, it is determined that the sample adjustment conditions are met.

[0098] It should be noted that when the sample size of a specific sample set is greater than or equal to a preset number, specific data can be introduced when the trend of change is decreasing. It should be noted that the preset value is a large value. When the degree of difference is large, specific data can also be introduced directly for training when the trend of change is decreasing, thereby reducing the number of training times and improving recognition accuracy in specific scenarios.

[0099] It is understandable that step S320, at the end of the current round of general training, obtains the convergence data of the first neural network, including: at the end of the current round of general training, calculating the decrease corresponding to the general scenario loss value of the current round; using the decrease as the convergence data of the first neural network; and using the sample ratio of the general sample set to the specific sample set as the preset convergence data.

[0100] It should be noted that the general sample set and the specific sample set in this step correspond to the general sample set and the specific sample set in step S100 respectively. For example, in the initial state, the general scene loss value is set to loss0. When one round of general training is completed, the corresponding general scene loss value is set to loss0. n The corresponding decrease is 1-loss n / loss0 is used as convergence data, when convergence data 1-loss n If / loss0 is equal to or less than the sample ratio (Ca / Cs) of the general sample set and the specific sample set, the general training is terminated. At this time, the preset quantity threshold and the preset difference threshold are set according to the sample ratio.

[0101] It is understandable that referring to Figure 4 As shown, step S400, performing at least one round of specific scenario training on the second neural network based on the specific sample set until the second training end condition is met, to obtain a third neural network, includes:

[0102] Step S410: Input the specific sample set into the second neural network to perform a first round of specific scenario training.

[0103] Step S420: Determine whether the specific scenario loss value of the specific scenario training is on an upward trend.

[0104] Step S430: When the specific scenario loss value of the specific scenario training shows an upward trend, the specific sample set is input into the second neural network multiple times for multiple training until the second training end condition is met. The second training end condition is that the specific scenario loss value is less than or equal to the general scenario loss value at the end of the general training.

[0105] It should be noted that the upward trend is relative to the loss value of the general scenario at the end of the general scenario.

[0106] Step S440: When the loss value of the specific scene shows a non-increasing trend, the specific training rounds of the specific scene training are adjusted according to the sample ratio of the general sample set to the specific sample set and the general training rounds of the general training; and the specific scene training is trained for a specific number of training rounds using the specific sample set.

[0107] It should be noted that when the loss value of a specific scene, that is, loss, does not increase, it means that the second neural network already contains sufficient information about the specified scene.

[0108] Exemplarily, the number of training rounds can be set to n2=n1×(Ca / Cs), where n1 is the number of general training rounds, Ca represents the number of samples in the specific sample set in step S100; and Cs represents the number of samples in the general sample set in step S100.

[0109] Step S450: Use the trained second neural network as the third neural network.

[0110] It is understandable that step S600, performing at least one round of convergence training on the third neural network based on the second training sample set until the third training end condition is met to obtain the fourth neural network, includes: inputting the second training sample set into the neural network classification model and repeatedly performing multiple rounds of convergence training until the third training end condition is met to obtain the fourth neural network, wherein the third training end condition is that the convergence loss value of the convergence training shows a downward trend.

[0111] It should be noted that when the convergence loss value shows a downward trend, it means that there is still room for training the third neural network model. At this time, a specific sample set can be used for final convergence, thereby improving the recognition accuracy of the target neural network classification model.

[0112] It should be noted that for step S700, when the loss value converges to the preset threshold value (convergence condition) after multiple rounds of training, the training can be stopped; wherein, multiple rounds of training can refer to steps S410 to S450 for training, and the neural network that meets the second training end condition is used as the target neural network classification model.

[0113] It is understandable that, before step S300 and / or step S400, the method further includes:

[0114] Get general incremental data as well as specific incremental data.

[0115] Correspondingly, in step S300 , the relative proportions of the general data and the specific data in the first training sample set are adjusted based on the original general sample set, the specific sample set, the general incremental data, and the specific incremental data.

[0116] Correspondingly, step S400 performs scenario-specific training based on the original specific sample set and specific incremental data.

[0117] It should be noted that general incremental data and specific incremental data are used to increase the variability of samples used for model training, thereby improving the recognition accuracy of the target neural network classification model. Incremental data and specific incremental data can add different amounts of sample data at different stages depending on the actual situation. For example, during step S300, A general incremental data are added, and during step S400, B general data are added.

[0118] It should be noted that, when other conditions are the same, when training a neural network, generally the more iterations the higher the model accuracy, but more iterations will also make the model more fit to the data set, and the performance in application scenarios outside the data set is not good enough. Therefore, based on the method of the above embodiment of the present invention, using data sets of different scenarios in different batches during training can make the model equivalent to obtaining different data sets for multiple training, and fitting multiple data sets at the same time, thereby reducing the probability of a small number of sample types being overwhelmed during mixed data set training, thereby reducing the probability of the model being insufficient in accuracy in a specific scenario, or simply performing augmented training on a specific scene data set and causing the model to overfit. Therefore, the model can be trained as quickly as possible when the amount of data in the specified scenario is relatively small, and different types of sample data sets can be distributed in different batches to obtain the effects of pre-training and fintune, and maintain the generalization of the pre-training of the target neural classification model, so that the target neural classification model has high accuracy in the specified scenario.

[0119] The method of the present invention can be used in a wide variety of general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.

[0120] Second, as Figure 5 As shown, an embodiment of the present invention further provides a device for model training based on multiple sample sets, comprising:

[0121] An acquisition module 100 is used to acquire a general sample set and a specific sample set;

[0122] A first training sample set processing module 200 is configured to combine the general data in the general sample set and the specific data in the specific sample set according to a preset first sample ratio to obtain a first training sample set;

[0123] A general training module 300 is configured to obtain a first neural network, perform multiple rounds of general training on the first neural network based on a first training sample set, and obtain a second neural network until a first training termination condition is satisfied; wherein, in at least one round of general training, the relative proportions of general data and specific data in the first training sample set are adjusted;

[0124] A specific scenario training module 400 is configured to perform at least one round of specific scenario training on the second neural network based on the specific sample set until a second training end condition is met, thereby obtaining a third neural network;

[0125] The second training sample set processing module 500 is used to combine the general data in the general sample set and the specific data in the specific sample set according to a preset second sample ratio to obtain a second training sample set;

[0126] A first convergence training module 600 is configured to perform at least one round of convergence training on the third neural network based on the second training sample set until a third training end condition is met, thereby obtaining a fourth neural network;

[0127] The second convergence training module 700 is used to perform at least one round of convergence training on the fourth neural network based on the specific sample set until the convergence condition is met to obtain the target neural network classification model.

[0128] It should be noted that in some embodiments, the device also includes a sample set processing module 800, which is used to expand the general sample set and the specific sample set, so that the sample data used in the general training module, the specific scenario training module, the first convergence training module and the second convergence training module are diversified, thereby further improving the recognition accuracy of the target neural network classification model.

[0129] In a third aspect, an embodiment of the present invention further provides an electronic device, including:

[0130] at least one processor, and

[0131] a memory communicatively connected to at least one processor; wherein,

[0132] The memory stores instructions, and the instructions are executed by at least one processor so that when the at least one processor executes the instructions, a management method for model training based on multiple sample sets as described in the above embodiment of the present invention is implemented.

[0133] The following combination Figure 6 The hardware structure of the computer device is described in detail. The computer device includes: a processor 910, a memory 920, an input / output interface 930, a communication interface 940 and a bus 950.

[0134] The processor 910 may be implemented as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is configured to execute relevant programs to implement the technical solutions provided by the embodiments of the present invention.

[0135] The memory 920 can be implemented in the form of ROM (Read Only Memory), static storage device, dynamic storage device or RAM (Random Access Memory). The memory 920 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 920, and the processor 910 calls and executes the model training method of the embodiment of the present invention or the management method of model training based on multiple sample sets of the embodiment of the present invention;

[0136] Input / output interface 930, used to implement information input and output;

[0137] Communication interface 940, used to implement communication interaction between the device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.); and bus 950, which transmits information between various components of the device (such as processor 910, memory 920, input / output interface 930 and communication interface 940);

[0138] The processor 910 , the memory 920 , the input / output interface 930 , and the communication interface 940 are connected to each other in communication within the device via a bus 950 .

[0139] In a fourth aspect, an embodiment of the present invention further provides a storage medium, which is a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions, which are used to enable a computer to execute the method of model training based on multiple sample sets of an embodiment of the present invention.

[0140] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0141] It can be understood that an embodiment of the present invention further provides a computer-readable storage medium storing computer-executable instructions, and the computer-executable instructions are used to execute the above-mentioned management method for model training based on multiple sample sets.

[0142] For example, the computer executes Figure 1 Steps S100 to S700 shown in FIG. 100; for example, the computer executes the following steps: Figure 1 Steps S100 to S700 shown in FIG. Figure 4 As shown, steps S410 to S450. For example, the computer executes Figure 1 Steps S100 to S700 shown in FIG. Figure 3 Steps S310 to S370 are shown.

[0143] Those skilled in the art will appreciate that all or some of the steps and systems in the method disclosed above can be implemented as software, firmware, hardware, and appropriate combinations thereof. Some physical components or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, and the computer-readable medium can include computer storage media (or non-transitory media) and communication media (or temporary media). As known to those skilled in the art, the term computer storage media is included in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data) and is volatile and non-volatile, removable, and non-removable. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory, or other memory technology, CD-ROM, digital versatile disks (DVD), or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage, or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, as is well known to those skilled in the art, communication media typically embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0144] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.

[0145] The embodiments described in the embodiments of the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.

[0146] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.

[0147] The terms "first," "second," "third," "fourth," and the like (if any) in the description of the present invention and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in orders other than those illustrated or described herein. In addition, the terms "including" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products, or apparatus.

[0148] It should be understood that in the present invention, "at least one (item)" refers to one or more, and "plurality" refers to two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can represent: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0149] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above implementation. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A face recognition method, characterized in that: include: Obtaining a general sample set and a specific sample set; wherein the general sample set and the specific sample set are face data sets, the specific sample set represents a set of sample data for a specific scene, the general sample set represents a set of sample data including multiple scenes, and the general sample set contains sample data for the corresponding scene in the specific sample set; Combining the general data in the general sample set and the specific data in the specific sample set according to a preset first sample ratio to obtain a first training sample set; Obtaining a first neural network, performing multiple rounds of general training on the first neural network based on a first training sample set until a first training termination condition is satisfied, thereby obtaining a second neural network; wherein, in at least one round of the general training, adjusting the relative proportions of the general data and the specific data in the first training sample set; Performing at least one round of specific scenario training on the second neural network based on the specific sample set until a second training end condition is met, thereby obtaining a third neural network; Combining the general data in the general sample set and the specific data in the specific sample set according to a preset second sample ratio to obtain a second training sample set; performing at least one round of convergence training on the third neural network based on the second training sample set until a third training end condition is met, thereby obtaining a fourth neural network; Performing at least one round of convergence training on the fourth neural network based on the specific sample set until a convergence condition is met, thereby obtaining a target neural network classification model; wherein the target neural network classification model is a face recognition model; Face recognition is performed using the face recognition model.

2. The face recognition method according to claim 1, characterized in that The first neural network is subjected to multiple rounds of general training based on the first training sample set until a first training termination condition is satisfied, thereby obtaining a second neural network; wherein, in at least one round of the general training, the relative proportions of the general data and the specific data in the first training sample set are adjusted, including: Performing the current round of general training on the first neural network based on the first training sample set; At the end of the current round of the general training, obtaining convergence data of the first neural network; matching the convergence data of the first neural network with preset convergence data; When the convergence data of the first neural network matches the preset convergence data, determining that the current round of the general training meets the first training end condition, and using the current first neural network as the second neural network; When the convergence data of the first neural network does not match the preset convergence data, determining whether the sample adjustment condition is met based on the general scenario loss value of the first neural network; wherein the general scenario loss value is calculated based on the output data of the first neural network in the current round and the expected output data; When a sample adjustment condition is met, adjusting the relative proportions of the general data and the specific data in the first training sample set, and performing the next round of the general training based on the adjusted first training sample set; When the sample adjustment condition is not met, the next round of general training is performed based on the first training sample set of the current round.

3. The face recognition method according to claim 2, characterized in that The determining whether a sample adjustment condition is met according to the general scenario loss value of the first neural network includes: Obtaining the sample size of the specific sample set and the degree of difference between the specific sample set and the general sample set; When the sample size of the specific sample set is less than a preset quantity threshold and the degree of difference is less than a preset difference threshold, and when the general scenario loss value meets the preset loss threshold, it is determined that the sample adjustment condition is met.

4. The face recognition method according to claim 3, characterized in that: The determining whether the sample adjustment condition is met according to the universal scenario loss value of the first neural network further includes: When it is determined that any one of the preset prerequisites is met, determining whether the change trend of the loss value of the general scenario is a downward trend, wherein the preset prerequisite includes any one of the following: the sample size of the specific sample set is greater than or equal to a preset quantity threshold; or the difference degree is greater than or equal to a preset difference threshold; When the change trend of the loss value of the general scenario is a downward trend, it is determined that the sample adjustment condition is met.

5. The face recognition method according to claim 2, characterized in that: The step of obtaining convergence data of the first neural network at the end of the current round of general training includes: At the end of the general training of the current round, calculating the decrease corresponding to the general scenario loss value of the current round; Using the decrease amplitude as convergence data of the first neural network; The sample ratio of the general sample set to the specific sample set is used as preset convergence data.

6. The face recognition method according to claim 1, characterized in that: The performing at least one round of specific scenario training on the second neural network based on the specific sample set until a second training end condition is satisfied to obtain a third neural network includes: Inputting the specific sample set into the second neural network to perform a first round of specific scenario training; Determining whether a specific scenario loss value of the specific scenario training shows an upward trend; When the specific scenario loss value of the specific scenario training shows an upward trend, the specific sample set is input into the second neural network multiple times for multiple training until a second training end condition is met, where the second training end condition is that the specific scenario loss value is less than or equal to the general scenario loss value at the end of the general training; When the loss value of the specific scenario shows a non-increasing trend, adjusting the specific number of training rounds of the specific scenario training according to the sample ratio of the general sample set to the specific sample set and the general number of training rounds of the general training; and training the specific scenario training for the specific number of training rounds using the specific sample set; The trained second neural network is used as the third neural network.

7. The face recognition method according to claim 1, characterized in that: The step of performing at least one round of convergence training on the third neural network based on the second training sample set until a third training end condition is satisfied to obtain a fourth neural network comprises: The second training sample set is input into the neural network classification model and convergence training is repeated multiple times until a third training end condition is met to obtain the fourth neural network, wherein the third training end condition is that the convergence loss value of the convergence training shows a downward trend.

8. A face recognition device, characterized in that: include: An acquisition module, configured to acquire a general sample set and a specific sample set; wherein the general sample set and the specific sample set are face datasets, the specific sample set represents a collection of sample data for a specific scene, the general sample set represents a collection of sample data for multiple scenes, and the general sample set contains sample data for the corresponding scene in the specific sample set; A first training sample set processing module, configured to combine the general data in the general sample set and the specific data in the specific sample set according to a preset first sample ratio to obtain a first training sample set; a general training module, configured to obtain a first neural network, perform multiple rounds of general training on the first neural network based on a first training sample set until a first training termination condition is satisfied, thereby obtaining a second neural network; wherein, in at least one round of the general training, the relative proportions of the general data and the specific data in the first training sample set are adjusted; a specific scenario training module, configured to perform at least one round of specific scenario training on the second neural network based on the specific sample set until a second training end condition is met, thereby obtaining a third neural network; A second training sample set processing module, configured to combine the general data in the general sample set and the specific data in the specific sample set according to a preset second sample ratio to obtain a second training sample set; a first convergence training module, configured to perform at least one round of convergence training on the third neural network based on the second training sample set until a third training end condition is met, thereby obtaining a fourth neural network; a second convergence training module, configured to perform at least one round of convergence training on the fourth neural network based on the specific sample set until a convergence condition is satisfied, thereby obtaining a target neural network classification model; wherein the target neural network classification model is a face recognition model; Face recognition is performed using the face recognition model.

9. An electronic device, characterized in that: include: at least one processor, and a memory communicatively connected to at least one processor; wherein, The memory stores instructions, and the instructions are executed by at least one processor, so that when the at least one processor executes the instructions, the face recognition method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that Computer-executable instructions are stored, and the computer-executable instructions are used to execute at least the face recognition method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Neural network model training method and device, and computer device

    CN108898218A

  • Neural network training method and device

    CN113705769A