Neural network model adjustment method, device, equipment and storage medium

By updating and correcting parameters in the neural network model, combining sample data and application data output results, the performance problems of deep learning models in different scenarios are solved, and the generalization ability and training efficiency of the model are improved.

CN112434552BActive Publication Date: 2024-12-06GUANGZHOU SHIYUAN ELECTRONICS CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202011092190.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-13
Publication Date
2024-12-06
Estimated Expiration
2040-10-13

AI Technical Summary

Technical Problem

In the prior art, deep learning models cannot guarantee performance when applied in different scenarios, especially in scenarios not covered by open source data sets, the accuracy of deep learning models is not high.

Method used

By inputting the target number of sample data into the neural network model, updating the model parameters, and using the application data to correct the model parameters, combining the sample data and the output results of the application data, the model is optimized to adapt to different scenarios.

Benefits of technology

It effectively avoids forgetting and overfitting problems, improves the generalization ability of neural network models, ensures the high performance of the model in different scenarios, and improves training efficiency and speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112434552B_ABST
    Figure CN112434552B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a neural network model adjustment method, device, equipment and storage medium, which relates to the field of neural network technology, and includes: inputting a target number of sample data into the neural network model, and updating the model parameters of the neural network model according to the first output result of the neural network model, the model parameters before updating are the first parameters, and the model parameters after updating are the second parameters; inputting a target number of application data into the updated neural network model, and correcting the model parameters of the neural network model according to the second output result and the second parameter of the updated neural network model, the model parameters before correction are the first parameters, and the model parameters after correction are the third parameters. The above method can solve the technical problem in the prior art that the performance of the deep learning model cannot be guaranteed when the deep learning model is applied in different scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of neural network technology, and in particular to a neural network model adjustment method, device, equipment and storage medium. Background Art

[0002] As an important field in machine learning, deep learning has been widely used in people's work and life. For example, in the field of face recognition, face recognition technology based on deep learning has been widely used in scenarios such as terminal face unlocking, face check-in, and face payment. Generally, in order to implement face recognition technology based on deep learning, it is necessary to build a deep learning model and train the deep learning model with a large amount of training data so that the trained deep learning model can perform face recognition.

[0003] In the process of implementing the present invention, the inventors found that the prior art has the following defects: when training a deep learning model, since the collection and annotation of training data requires high costs, the prior art uses open source data sets as training data sets, which makes the trained deep learning model unable to be applied to scenarios not covered by the open source data sets. For example, in face recognition technology, the open source data set MS1M is usually used as a training data set, but the proportion of some face images in MS1M is small. Therefore, when the trained deep learning model is applied to certain face recognition scenarios, the accuracy of the deep learning model is not high.

[0004] In summary, when deep learning models are applied in different scenarios (especially scenarios not covered by open source datasets), how to ensure the performance of deep learning models has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The embodiments of the present application provide a neural network model adjustment method, apparatus, device and storage medium to solve the technical problem in the prior art that the performance of the deep learning model cannot be guaranteed when the deep learning model is applied in different scenarios.

[0006] In a first aspect, an embodiment of the present application provides a neural network model adjustment method, comprising:

[0007] Inputting a target number of sample data into a neural network model, and updating a model parameter of the neural network model according to a first output result of the neural network model, wherein the model parameter before updating is a first parameter and the model parameter after updating is a second parameter;

[0008] Input a target amount of application data into an updated neural network model, and correct the model parameters of the neural network model according to the second output result of the updated neural network model and the second parameter, wherein the model parameters before correction are the first parameters and the model parameters after correction are the third parameters.

[0009] Furthermore, the neural network model includes a backbone network model and a head network model, the backbone network model is used to extract the feature vector of the neural network model input data; the head network model is used to obtain the output result of the neural network model according to the feature vector.

[0010] Furthermore, the backbone network model includes a first backbone network model, and the head network model includes a first head network model and a second head network model.

[0011] When the target number of sample data is input into the first backbone network model, the first backbone network model is used to output a first feature vector, and when the target number of application data is input into the first backbone network model, the first backbone network model is used to output a second feature vector;

[0012] The first head network model is used to obtain the first output result according to the first feature vector;

[0013] The second head network model is used to obtain the second output result according to the second feature vector.

[0014] Further, the first parameter includes a first initial parameter of the first backbone network model and a second initial parameter of the first head network model, and the second parameter includes a first false update parameter of the first backbone network model and a first true update parameter of the first head network model;

[0015] The step of inputting the target number of sample data into the neural network model and updating the model parameters of the neural network model according to the first output result of the neural network model comprises:

[0016] Inputting a target number of sample data into the neural network model to obtain a corresponding first output result;

[0017] Calculate a first loss function of the neural network model according to the first output result;

[0018] Determine a first gradient of the first initial parameter and a second gradient of the second initial parameter according to the first loss function;

[0019] The first initial parameter is updated to the first false update parameter according to the first gradient and the first learning rate, and the second initial parameter is updated to the first true update parameter according to the second gradient and the first learning rate.

[0020] Further, the first parameters also include third initial parameters of the second head network model, and the third parameters include second true update parameters of the first backbone network model and third true update parameters of the second head network model;

[0021] The step of inputting the target amount of application data into the updated neural network model and correcting the model parameters of the neural network model according to the second output result of the updated neural network model and the second parameter comprises:

[0022] Inputting the target amount of application data into the updated neural network model to obtain a corresponding second output result;

[0023] Calculate a second loss function of the updated neural network model according to the second output result;

[0024] Determine a third gradient of the first pseudo update parameter and a fourth gradient of the third initial parameter according to the second loss function;

[0025] The first initial parameter is corrected to the second true update parameter according to the first gradient, the third gradient and the second learning rate, and the third initial parameter is corrected to the third true update parameter according to the fourth gradient and the second learning rate.

[0026] Furthermore, the backbone network model includes a second backbone network model, and the head network model includes a third head network model.

[0027] Further, the first parameters include a fourth initial parameter of the second backbone network model and a fifth initial parameter of the third head network model, and the second parameters include a second false update parameter of the second backbone network model and a third false update parameter of the third head network model;

[0028] The step of inputting the target number of sample data into the neural network model and updating the model parameters of the neural network model according to the first output result of the neural network model comprises:

[0029] Inputting a target number of sample data into the neural network model to obtain a corresponding first output result;

[0030] Calculating a third loss function of the neural network model according to the first output result;

[0031] Determining a fifth gradient of the fourth initial parameter and a sixth gradient of the fifth initial parameter according to the third loss function;

[0032] The fourth initial parameter is updated to the second false update parameter according to the fifth gradient and the third learning rate, and the fifth initial parameter is updated to the third false update parameter according to the sixth gradient and the third learning rate.

[0033] Further, the third parameter includes a fourth true update parameter of the second backbone network model and a fifth true update parameter of the third head network model;

[0034] The step of inputting the target amount of application data into the updated neural network model and correcting the model parameters of the neural network model according to the second output result of the updated neural network model and the second parameter comprises:

[0035] Inputting the target amount of application data into the updated neural network model to obtain a corresponding second output result;

[0036] Calculating a fourth loss function of the updated neural network model according to the second output result;

[0037] Determining a seventh gradient of the second false update parameter and an eighth gradient of the third false update parameter according to the fourth loss function;

[0038] The fourth initial parameter is corrected to the fourth true update parameter according to the fifth gradient, the seventh gradient and the fourth learning rate, and the fifth initial parameter is corrected to the fifth true update parameter according to the sixth gradient, the eighth gradient and the fourth learning rate.

[0039] Furthermore, there are k groups of sample data, each group of sample data contains a target number of sample data, k>1,

[0040] The step of inputting the target number of sample data into the neural network model and updating the model parameters of the neural network model according to the first output result of the neural network model comprises:

[0041] Performing k-iterative updates on the model parameters of the neural network model according to the k groups of sample data, wherein the model parameters before the k-iterative updates are the first parameters, and after the k-iterative updates, the model parameters are the first intermediate parameters;

[0042] Updating the model parameters of the neural network model from the first parameters to the second parameters according to the first intermediate parameters and the fifth learning rate;

[0043] Among them, an iterative update process is:

[0044] Inputting a set of sample data into the neural network model to obtain a first output result;

[0045] Constructing a fifth loss function of the neural network model according to the first output result;

[0046] Determine a ninth gradient of the model parameters before this iterative update according to the fifth loss function;

[0047] The model parameters are updated according to the ninth gradient and the fifth learning rate.

[0048] Furthermore, there are k groups of application data, each group of application data contains a target number of application data.

[0049] The step of inputting the target amount of application data into the updated neural network model and correcting the model parameters of the neural network model according to the second output result of the updated neural network model and the second parameter comprises:

[0050] Performing k-iterative corrections on the model parameters of the updated neural network model according to the k groups of application data, wherein the model parameters before the k-iterative corrections are the second parameters, and the model parameters after the k-iterative updates are the second intermediate parameters;

[0051] Correcting the model parameters of the neural network model from the first parameters to third parameters according to the second intermediate parameters, the sixth learning rate and the second parameters;

[0052] Among them, an iterative correction process is:

[0053] Inputting a set of application data into the updated neural network model to obtain a second output result;

[0054] Constructing a sixth loss function of the updated neural network model according to the second output result;

[0055] Determine the tenth gradient of the model parameter before this iterative correction according to the sixth loss function;

[0056] The model parameters are modified according to the tenth gradient and the sixth learning rate.

[0057] Further, the neural network model includes a backbone network model;

[0058] The step of inputting the target number of sample data into the neural network model and updating the model parameters of the neural network model according to the first output result of the neural network model comprises:

[0059] Inputting a target number of sample data into the backbone network model to obtain a first output result output by the backbone network model, wherein the first output result is a third eigenvector;

[0060] Construct a seventh loss function of the backbone network model according to the first output result;

[0061] Determining an eleventh gradient of the first parameter according to the seventh loss function;

[0062] Updating the model parameter from the first parameter to a second parameter according to the eleventh gradient and the seventh learning rate;

[0063] The step of inputting the target amount of application data into the updated neural network model and correcting the model parameters of the neural network model according to the second output result of the updated neural network model and the second parameter comprises:

[0064] Inputting a target amount of application data into the updated backbone network model to obtain a second output result output by the backbone network model, wherein the second output result is a fourth eigenvector;

[0065] Constructing an eighth loss function of the updated backbone network model according to the second output result;

[0066] Determine a twelfth gradient of the second parameter according to the eighth loss function;

[0067] The model parameters are updated from the first parameters to third parameters according to the twelfth gradient, the eleventh gradient and the eighth learning rate.

[0068] Further, the target number of sample data is input into the neural network model through a first data loader;

[0069] The target amount of application data is input into the updated neural network model through a second data loader.

[0070] In a second aspect, the embodiment of the present application further provides a neural network model adjustment device, comprising:

[0071] An updating module, used for inputting a target number of sample data into a neural network model, and updating a model parameter of the neural network model according to a first output result of the neural network model, wherein the model parameter before the updating is a first parameter and the model parameter after the updating is a second parameter;

[0072] A correction module is used to input the target amount of application data into the updated neural network model, and to correct the model parameters of the neural network model according to the second output result of the updated neural network model and the second parameter, wherein the model parameter before correction is the first parameter and the model parameter after correction is the third parameter.

[0073] In a third aspect, the embodiment of the present application further provides a neural network model adjustment device, including:

[0074] one or more processors;

[0075] A memory for storing one or more programs;

[0076] When the one or more programs are executed by the one or more processors, the one or more processors implement the neural network model adjustment method as described in the first aspect.

[0077] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the neural network model adjustment method as described in the first aspect.

[0078] The above-mentioned neural network model adjustment method, device, equipment and storage medium, by updating the model parameters of the neural network model from the first parameter to the second parameter according to the first output result of the neural network model processing the sample data, and then, according to the second output result of the neural network model processing the application data and the second parameter, the model parameters of the neural network model are corrected from the first parameter to the third parameter, wherein the technical solution in which the application data and the set quantity are both the target quantity, can solve the technical problem in the prior art that the performance of the deep learning model cannot be guaranteed when the deep learning model is applied to different scenarios. The sample scenario corresponding to the sample data and the application scenario corresponding to the application data are used as related tasks when training the neural network model, breaking the limitation of constructing a large number of related tasks during meta-learning. Furthermore, the model parameters are first updated using the sample data, and then the model parameters are corrected based on the application data. When correcting the model parameters, not only the second output result of the application data is considered, but also the first output result of the sample data is combined. This optimization method makes the neural network model suitable for both sample scenarios and application scenarios, effectively avoiding the technical problems of forgetting and overfitting in traditional fine-tuning, and making the generalization ability of the neural network model better. Generally speaking, the amount of sample data is much larger than the amount of application data. Therefore, when training a neural network model based on the same amount of sample data and application data, only part of the sample data is used to train the neural network model, that is, only the application data is upsampled. This can avoid the problem of data imbalance and ensure that the performance of the original data domain (sample data) is maintained as much as possible during neural network model training, and more attention is paid to performance improvement of the new data domain (application data), thereby ensuring the training efficiency and speed of the neural network model. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] Figure 1 A flowchart of a neural network model adjustment method provided in one embodiment of the present application;

[0080] Figure 2 A schematic diagram of the structure of a neural network model adjustment device provided in one embodiment of the present application;

[0081] Figure 3 A schematic diagram of the structure of a neural network model adjustment device provided in accordance with an embodiment of the present application. DETAILED DESCRIPTION

[0082] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only the parts related to the present application, rather than all structures, are shown in the accompanying drawings.

[0083] It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation or object from another entity or operation or object, and do not necessarily require or imply any such actual relationship or order between these entities or operations or objects. For example, the "first" and "second" of the first output result and the second output result are used to distinguish two different output results.

[0084] In the prior art, when a deep learning model is applied to different scenarios, in order to ensure the performance of the deep learning model, the deep learning model can be fine-tuned using the training data in the current application scenario. For example, scenario A corresponds to an open source data set. After the deep learning model is trained based on the open source data set, if the deep learning model is used in a specific scenario B, the deep learning model can be fine-tuned using the training data collected in scenario B to make the deep learning model suitable for scenario B. However, when fine-tuning is performed using the above scheme, problems such as forgetting and overfitting will occur. Among them, forgetting means that after fine-tuning, the performance of the deep learning model in scenario A deteriorates (such as low recognition accuracy). Overfitting means that after fine-tuning, the deep learning model only has good performance in scenario B, and the deep learning model cannot be generalized. That is, after fine-tuning, although the deep learning model adapts to scenario B, it can no longer be applied to scenario A. In order to ensure the performance of the deep learning model, the open source data set in scenario A and the training data collected in scenario B can also be used to train the deep learning model together, that is, traverse all the data several times to achieve training of the deep learning model. Although the above-mentioned joint training can solve the problems of forgetting and overfitting, since the amount of data in the open source dataset is much larger than the amount of training data collected in scenario B, the joint training will introduce data imbalance and increase the difficulty of training the deep learning model.

[0085] Therefore, a neural network model adjustment method is provided in an embodiment of the present application, so that the trained neural network model is applicable to both scene A and scene B, and the problems of forgetting, overfitting and high training difficulty can be avoided.

[0086] Specifically, the neural network model adjustment method provided in the embodiment of the present application can be executed by a neural network model adjustment device, which can be implemented by software and / or hardware, and the neural network model adjustment device can be composed of two or more physical entities, or can be composed of one physical entity. For example, the neural network model adjustment device can be a computer, a mobile phone, a tablet computer, or an interactive smart tablet, etc., which is an intelligent device with data computing and analysis capabilities.

[0087] The neural network model adjustment method provided in the embodiment of the present application applies meta-learning to the training process of the neural network model. Among them, meta-learning refers to learning a large number of related tasks, so that the meta-learning model can quickly adapt to new tasks (equivalent to new scenarios) based on a small amount of data in the application. That is, meta-learning can use previous knowledge and experience to guide the learning of new tasks, and has the ability to learn to learn. The key to meta-learning is to construct a large number of related tasks. However, in practical applications, such as face recognition technology, it is difficult to construct a large number of related tasks (the reason is that the amount of training data used for face recognition is large, and the actual application scenarios of face recognition are limited). Therefore, when using meta-learning, this embodiment breaks the limitation of constructing a large number of related tasks, and only takes scenes A and B as two related tasks to obtain neural network models suitable for scenes A and B. The specific technical means used are as follows:

[0088] in, Figure 1 A flowchart of a neural network model adjustment method provided in an embodiment of the present application, refer to Figure 1 , the neural network model adjustment method specifically includes:

[0089] Step 110: input the target number of sample data into the neural network model, and update the model parameters of the neural network model according to the first output result of the neural network model, the model parameters before updating are the first parameters, and the model parameters after updating are the second parameters.

[0090] Among them, the neural network model refers to a deep learning model constructed using a neural network. The type of neural network and the neural network structure used in the neural network model can be set according to actual conditions, and the embodiment does not limit this. Further, the model parameters of the neural network model include weights, and may also optionally include bias items and other contents. It can be understood that when the neural network model is not trained, the initial model parameters are used. The initial model parameters can be artificially set parameters. As the training process occurs, the model parameters are changed to improve the accuracy of the neural network model, thereby improving the performance of the neural network model.

[0091] In the embodiment, sample data refers to data selected in an open source data set, that is, sample data is data suitable for scene A constructed based on samples in the open source data set. For ease of description, scene A is recorded as a sample scene in the embodiment. It can be understood that the open source data set contains a large number of sample data of the same type. For example, when the neural network model is used for face recognition, the corresponding open source data set contains a large number of face images. Typically, a target number of sample data is selected in the open source data set, where the target number is equal to the number of data input into a batch of the neural network model and is much smaller than the number of sample data contained in the open source data set. At this time, the target number of sample data can also be understood as batch sample data. In the embodiment, the number of data input into a batch of the neural network model is recorded as m, that is, the target number is m, m≥2, and its specific value can be set according to actual conditions. Optionally, when selecting a target number of sample data in an open source data set, m sample data can be randomly selected in the open source data set, or m sample data can be selected in the open source data set in the order of arrangement of the sample data, or m sample data can be selected in the open source data set in other ways.

[0092] Specifically, the target number of sample data is input into the neural network model. At this time, the task of the neural network model is to learn the target number of sample data, and then update the model parameters of the neural network model according to the output result of the neural network model to achieve the purpose of training the neural network model. In the embodiment, the result output when the neural network model processes the sample data is recorded as the first output result. It can be understood that when the function of the neural network model is different, the meaning of the first output result is different. For example, the function of the neural network model is face recognition (face classification), then the first output result is the logits value of the category prediction, wherein the logits value can be understood as the unnormalized probability that the corresponding sample data belongs to the corresponding category, and the multi-classification cross entropy loss of the sample data can be calculated by the logits value, wherein the multi-classification cross entropy loss can also be understood as cross entropy, which is the loss function of the neural network model when processing multi-classification tasks. For another example, the function of the neural network model is face recognition, then the first output result is the feature vector of the sample data. It can be understood that the first output result is a set, which contains the output result of the neural network model after processing each sample data input this time.

[0093] Further, the model parameters are updated according to the first output result so that the performance of the updated neural network model is better than that of the neural network model before the update. Wherein, when the model parameters are updated, the stochastic gradient descent (SGD) algorithm is adopted, that is, the loss function of the neural network model is constructed according to the first output result, and the type of loss function can be set according to the actual situation. After calculating the loss function, the partial derivatives of the model parameters are calculated according to the loss function to obtain the gradient of the model parameters, and then the model parameters are updated according to the gradient. It can be understood that when the gap between the first output result and the true result corresponding to the input sample data is large, the gradient of the model parameters is large, and the amplitude of the model parameter update is large, so that the first output result output by the updated neural network model is closer to the true result. In the embodiment, the model parameters before this update are recorded as the first parameters, and the updated model parameters are recorded as the second parameters. Optionally, when updating the model parameters, a learning rate is added, where the learning rate can also be understood as a learning rate, which is used to control the training speed of the neural network model. A learning rate that is too small will lead to slow learning of the neural network model and a large number of training times when the loss function converges. A learning rate that is too large will cause the learning process of the neural network model to oscillate. Therefore, in the embodiment, a suitable learning rate can be selected based on the actual situation of the neural network model, and the learning rate can be adjusted based on the actual situation.

[0094] It should be noted that the above-mentioned stochastic gradient descent algorithm is only an optional method. In practical applications, the Adaptive Moment Estimation (Adam) algorithm, the Rectified Adam (RAdam) algorithm, etc. can also be used to update the model parameters.

[0095] Optionally, in a training process, one set of sample data or multiple sets of sample data may be input, wherein each set of sample data contains a target number of sample data. When a set of sample data is input, the model parameters are directly updated according to the corresponding first output result, that is, the first parameter is updated to the second parameter. When multiple sets of sample data are input, the model parameters can be iteratively updated based on the multiple sets of sample data, and one set of sample data corresponds to one iterative update. At this time, each iterative update process can update the current model parameters to an intermediate parameter, and after the iterative update is completed, the second parameter is obtained according to the final intermediate parameter and the first parameter before the iterative update, and the model parameter is updated to the second parameter. Among them, the process of one iterative update is to input a set of sample data into the neural network model, obtain the corresponding first output result, and then iteratively update the model parameters according to the first output result, wherein the update method is the same as the model parameter update method mentioned above (SGD, etc.). After this iterative update, the model parameter becomes an intermediate parameter, and then, a set of sample data is input again to perform iterative update again, and at this time, the model parameter changes from one intermediate parameter to another intermediate parameter. After completing the iterative update in the above manner, the difference between the first parameter and the final intermediate parameter is determined, and the difference can reflect the extent of the modification of the model parameter by the iterative update. Then, based on the difference, the learning rate is introduced to update the first parameter to obtain the second parameter. That is, the model parameter of the neural network model is modified to the second parameter.

[0096] It should be noted that the process of training a neural network model using a target number of sample data can also be understood as inner layer optimization of the neural network model. Through inner layer optimization, the neural network model can be adapted to the sample scenarios corresponding to the sample data.

[0097] Step 120: input the target amount of application data into the updated neural network model, and correct the model parameters of the neural network model according to the second output result and the second parameter of the updated neural network model, the model parameters before correction are the first parameters, and the model parameters after correction are the third parameters.

[0098] In the embodiment, when training a neural network model, a training process refers to the process of modifying (one update and one correction) the model parameters of the neural network model through a target number of sample data and a target number of application data. Among them, application data refers to data collected based on another scenario (scenario B), and scenario B can also be understood as a specific application scenario. For example, the application scenario is specifically to perform face recognition on a certain community, and the corresponding application data is to collect face pictures of users in the community. Afterwards, a target number of application data is selected from all the collected application data. Among them, the embodiment of the selection method of application data is not limited. Since the target number is the number of data input into a batch of the neural network model, the target number of application data can also be understood as batch application data. Generally speaking, the number of sample data contained in the open source data set is much larger than the number of collected application data.

[0099] Specifically, the current neural network model is an updated neural network model, and the model parameters of the updated neural network model are the second parameters. After the target amount of application data is input into the updated neural network model, the model parameters of the neural network model are updated according to the corresponding output results to achieve the purpose of training the neural network model. In the embodiment, the result output when the neural network model processes the application data is recorded as the second output result. It can be understood that the learning method and the meaning of the second output result are the same as the learning method and the meaning of the first output result, and they are not repeated here.

[0100] Afterwards, the model parameters of the neural network model (before updating) are corrected according to the second output result, which can also be understood as updating the model parameters. Wherein, when correcting the model parameters, the second parameter obtained according to the sample data is considered, and the learning rate is introduced so that the trained neural network model adapts to the sample scenario corresponding to the sample data and the application scenario corresponding to the application data. Typically, when correcting the model parameters, the same algorithm as the above steps is used. In the embodiment, the random gradient descent algorithm is used as an example for description. At this time, the process of modifying the model parameters is specifically as follows: the loss function is calculated according to the second output result, and the type of the loss function is the same as the type of the loss function in the above steps. After that, the gradient of the second parameter is calculated according to the loss parameter, and then, the first parameter is corrected in combination with the gradient of the first parameter calculated in the above steps and the learning rate. In the embodiment, the corrected model parameter is recorded as the third parameter. Wherein, a hyperparameter with a numerical range between 0 and 1 is introduced, and the result of the hyperparameter and 1 minus the hyperparameter is used as the weight of the two gradients respectively, so as to perform weighted summation on the two weights, and then, the first parameter is corrected to the third parameter in combination with the result of the weighted summation and the learning rate. Optionally, the learning rate introduced when processing application data and the learning rate introduced when processing sample data can be the same or different, and the embodiment does not limit this. It can be understood that for a neural network model, there are only two related tasks during the training process, namely, the task of learning application data in an application scenario and the task of learning sample data in a sample scenario.

[0101] Exemplarily, the number of groups of sample data is equal to the number of groups of application data, that is, when only one group of sample data is input into a training process in the aforementioned steps, a group of application data is also input into this step; when multiple groups of sample data are input into a training process in the aforementioned steps, multiple groups of application data are also input into this step, and the neural network model processes multiple groups of application data in the same way as it processes multiple groups of sample data.

[0102] In practical applications, the neural network model may include multiple sub-models, and there are situations where the sub-model for processing sample data and the sub-model for processing application data are not completely the same. In this case, for different sub-models, the model parameters can be updated only once. For example, the neural network model includes a first sub-model, a second sub-model and a third sub-model, wherein the first sub-model is used to output the feature vectors of the sample data and the application data, the second sub-model is used to output the logits value corresponding to the sample data, and the third sub-model is used to output the logits value corresponding to the application data. Then, after the target number of sample data is input into the neural network model, the model parameters of the first sub-model and the second sub-model can be updated. After the target number of application data is input into the neural network model, the model parameters of the first sub-model and the third sub-model can be corrected. At this time, the processing method of the first sub-model is the same as the above processing method, that is, the model parameter is first updated from the first parameter to the second parameter, and then the model parameter is corrected from the first parameter to the third parameter in combination with the second parameter. For the second sub-model, its updated second parameter can be directly used as the corrected third parameter. The third sub-model is processed in the same way as the second sub-model, and the updated model parameter is directly used as the third parameter.

[0103] It should be noted that the process of training a neural network model using a target number of application data can also be understood as outer layer optimization of the neural network model. Through outer layer optimization, the neural network model can be adapted to the application scenarios corresponding to the application data.

[0104] After the model parameters are corrected to the third parameters, it can be considered that a training process is over. After that, a training process is started again, that is, return to execute step 110. At this time, the third parameter obtained by the above training process can be used as the first parameter of this training process. Repeat the above training for the neural network model (that is, the inner layer optimization and the outer layer optimization are iteratively performed) until the loss function of the neural network model converges or reaches the termination condition (such as reaching a preset number of training times or each application data is traversed N (N≥1) times). Optionally, after the training is completed, the target number of sample data and the target number of application data can be constructed again to test the trained neural network model. If the output result of the neural network model is stable and the accuracy reaches the expected level, it means that the neural network model has been well optimized. On the premise that the performance of the sample scenario remains basically unchanged, it also has good performance in the application scenario and can be put into use. Otherwise, the neural network model can continue to be trained until the neural network model passes the test. Generally speaking, when the training of the neural network model is completed according to the technical solution provided above, all application data have been traversed (input into the neural network model) at least once, and only part of the sample data is used to train the neural network model.

[0105] Optionally, in the above process, when a target number of sample data is input into the neural network model, the target number of sample data is input into the neural network model through a first data loader. When a target number of application data is input into the updated neural network model, the target number of application data is input into the updated neural network model through a second data loader. Among them, the data loader can be understood as a program that loads data into the neural network model. The performance of the data loader affects the performance of the neural network model. If the data loader cannot accurately load the data into the neural network model, then the neural network model cannot learn the correct data, and thus the accuracy of the neural network model cannot be guaranteed. In an embodiment, the sample data and the application data are loaded using different data loaders. At this time, the data loader used to load the sample data is recorded as the first data loader, and the data loader used to load the application data is recorded as the second data loader. The accuracy of data loading is guaranteed by two data loaders.

[0106] In the above, the model parameters of the neural network model are updated from the first parameter to the second parameter according to the first output result of the neural network model processing the sample data, and then the model parameters of the neural network model are corrected from the first parameter to the third parameter according to the second output result of the neural network model processing the application data and the second parameter, wherein the technical solution in which the application data and the set quantity are both the target quantity can solve the technical problem in the prior art that the performance of the deep learning model cannot be guaranteed when the deep learning model is applied in different scenarios. The sample scenario corresponding to the sample data and the application scenario corresponding to the application data are used as related tasks when training the neural network model, breaking the limitation of constructing a large number of related tasks during meta-learning. Furthermore, the model parameters are first updated using the sample data, and then the model parameters are corrected based on the application data. When the model parameters are finally corrected, not only the second output result of the application data is considered, but also the first output result of the sample data is combined. This optimization method makes the neural network model suitable for both sample scenarios and application scenarios, effectively avoiding the technical problems of forgetting and overfitting in traditional fine-tuning, and making the generalization ability of the neural network model better. Generally speaking, the amount of sample data is much larger than the amount of application data. Therefore, when training a neural network model based on the same amount of sample data and application data, only part of the sample data is used to train the neural network model, that is, only the application data is upsampled. This can avoid the problem of data imbalance and ensure that the performance of the original data domain (sample data) is maintained as much as possible during neural network model training, and more attention is paid to performance improvement of the new data domain (application data), thereby ensuring the training efficiency and speed of the neural network model.

[0107] On the basis of the above embodiments, when the structure adopted by the neural network model is different, the rules for adjusting the model parameters according to the output results (such as the loss function type, update rules, etc.) are different.

[0108] In one embodiment, the neural network model includes a backbone network model and a head network model. The backbone network model is used to extract feature vectors of input data of the neural network model; the head network model is used to obtain output results of the neural network model based on the feature vectors.

[0109] Exemplarily, a neural network model is used for multi-classification face recognition as an example for description. At this time, the neural network model includes a backbone network model and a head network model. Among them, the backbone network model refers to a model composed of a backbone network (Backbone), and the backbone network model is used to extract the features of the data input into the neural network model and output a feature vector. In face recognition, the backbone network model is used to extract the features of the face image and output a feature vector. The type of the backbone network model is not limited in the embodiment. For example, the backbone network model can be a residual network, a face recognition network (MobileFaceNet) running on a mobile terminal, etc. When the sample data or application data is input into the neural network model, it is specifically input into the backbone network model, and the backbone network model extracts the features of each data to output a feature vector. In the embodiment, the number of backbone network models is one, and the sample scene and the application scene share the backbone network model, wherein the meaning of sharing is that the sample data and the application data are both input into the backbone network model, so that the backbone network model learns the data in the two scenes, and then the backbone network model is adapted to the two scenes at the same time.

[0110] The head network model refers to a model composed of a head network (Head), and the type of the head network model is not limited in the embodiment. The head network model is used to input the feature vector output by the backbone network model, and obtain the output result according to the feature vector. In the embodiment, the output result of the head network model is the logits value of face recognition. Optionally, the two scenes can share the head network model, that is, the number of head network models is one, which is used to learn the feature vectors of the two scenes to adapt to the two scenes at the same time. In this case, during one training process, the model parameters of the backbone network model and the head network model need to be adjusted twice according to the first output result and the second output result. Optionally, each scene corresponds to a head network model. At this time, each head network model only learns the feature vector of one scene to adapt to its corresponding scene. In this case, during one training process, the model parameters of the backbone network model are adjusted twice according to the first output result and the second output result, while the model parameters of the head network model are only adjusted once according to the output result of the corresponding scene.

[0111] As can be seen from the above, when the number of head network models is different, the number of adjustments of the model parameters is different, and the different adjustment times will result in different adjustment methods. At this time, according to the different number of head network models, the embodiment includes the following schemes:

[0112] Solution 1: The backbone network model includes a first backbone network model, and the head network model includes a first head network model and a second head network model. When a target number of sample data is input into the first backbone network model, the first backbone network model is used to output a first feature vector. When a target number of application data is input into the first backbone network model, the first backbone network model is used to output a second feature vector. The first head network model is used to obtain a first output result based on the first feature vector. The second head network model is used to obtain a second output result based on the second feature vector.

[0113] In this solution, there is one backbone network model, which is recorded as the first backbone network model, and two head network models, which are recorded as the first head network model and the second head network model. It can be understood that the first backbone network model is connected to the first head network model and the second head network model at the same time. The first head network model corresponds to the sample scenario, and the second head network model corresponds to the application scenario.

[0114] Specifically, the target number of sample data is input into the first backbone network model so that the first backbone network model outputs the corresponding feature vector. In the embodiment, the feature vector corresponding to the target number of sample data is recorded as the first feature vector. After that, the first feature vector is input into the first head network model, and the first head network model outputs the corresponding first processing result according to the first feature vector. It can be understood that the first feature vector is a set, which contains the feature vector of each sample data input. The target number of application data is input into the first backbone network model so that the first backbone network model outputs the corresponding feature vector. In the embodiment, the feature vector corresponding to the target number of application data is recorded as the second feature vector. It can be understood that the second feature vector is a set, which contains the feature vector of each application data input. After that, the second feature vector is input into the second head network model so that the second head network model outputs the corresponding second output result according to the second feature vector. Optionally, the first backbone network model can determine whether the currently input data is sample data or application data through the data loader used when inputting data, and then input the obtained feature vector into the corresponding head network model. Optionally, the sample data and the application data use different labels so that the first backbone network model can distinguish the input data and then input the obtained feature vector into the corresponding head network model.

[0115] Typically, when updating the model parameters of the neural network model according to the first output result, the first parameters include the first initial parameters of the first backbone network model and the second initial parameters of the first head network model, and the second parameters include the first false update parameters of the first backbone network model and the first true update parameters of the first head network model. Accordingly, inputting the target number of sample data into the neural network model, and updating the model parameters of the neural network model according to the first output result of the neural network model includes: inputting the target number of sample data into the neural network model to obtain the corresponding first output result; calculating the first loss function of the neural network model according to the first output result; determining the first gradient of the first initial parameter and the second gradient of the second initial parameter according to the first loss function; updating the first initial parameter to the first false update parameter according to the first gradient and the first learning rate, and updating the second initial parameter to the first true update parameter according to the second gradient and the first learning rate.

[0116] Specifically, since the neural network model includes a first backbone network model and a first head network model, before updating the model parameters, the first parameters should include the model parameters of the first backbone network model and the model parameters of the first head network model, wherein the model parameters of the first backbone network model are recorded as the first initial parameters, expressed as θ, and the model parameters of the first head network model are recorded as the second initial parameters, expressed as For example, m sample data are selected from the open source dataset and recorded as {x1, x2, ..., x m}, then, the m sample data are batch loaded into the first backbone network model through the first data loader, where the function of the first backbone network model is recorded as f θ (·), the first eigenvector output by the first backbone network model is {f θ (x1),f θ (x2), ..., f θ (x m )}, then the first eigenvector {f θ (x1),f θ (x2), ..., f θ (x m )} is input to the first head network model, where the function of the first head network model is recorded as The first output result of the first head network model

[0117] Further, after obtaining the first output result, a loss function of the neural network model is constructed according to the first output result. In the embodiment, the loss function is recorded as the first loss function. The type of the first loss function can be set according to the actual situation. For example, the first loss function is a softmax loss function, an ArcFace loss function, a CosFace loss function, an AirFace loss function, etc. In the embodiment, the first loss function is taken as an example of a softmax loss function, wherein the softmax loss function is essentially a cross entropy. The first loss function is represented by L in1 indicates that, and

[0118] After obtaining the first loss function, the model parameters (first initial parameters and second initial parameters) of the first backbone network model and the first head network model can be updated according to the first loss function. When updating, the SGD algorithm is used, that is, the gradients of the first initial parameters and the second initial parameters are calculated according to the first loss function by taking partial derivatives, so as to determine the update amplitude of the first initial parameters and the second initial parameters according to the gradients. The gradient corresponding to the first initial parameter θ is recorded as the first gradient, and the first gradient can be expressed as The second initial parameter The corresponding gradient is recorded as the second gradient, which can be expressed as

[0119] Afterwards, the first initial parameters are updated according to the first gradient. Since the first backbone network model also needs to extract the features of the application data during a training process, and the update of the first initial parameters this time is only for the sample data, this update process can be considered as a fake update, where the fake update can also be understood as an intermediate update rather than a final update. Afterwards, the model parameters obtained by this fake update are recorded as the first fake update parameters, that is, the first backbone network model is updated from the first initial parameters to the first fake update parameters. Since the neural network model is trained using the idea of ​​meta-learning, the learning rate is introduced when updating the model parameters. In the embodiment, the learning rate used when processing sample data in this scheme is recorded as the first learning rate. Afterwards, the model parameter update is implemented based on the first learning rate and the first gradient, and the specific process can be formally expressed as: Among them, α1 represents the first learning rate and θ1 represents the first false update parameter.

[0120] Similarly, the second initial parameters are updated according to the second gradient. Since the first head network model only processes sample data during a training process, this update process can be considered a real update, where the real update can also be understood as the final update. Afterwards, the model parameters obtained after this real update are recorded as the first real update parameters, that is, the first head network model is updated from the second initial parameters to the first real update parameters. And when updating, the first learning rate is introduced, that is, the model parameter update is implemented based on the first learning rate and the first gradient. The specific process can be formally expressed as: in, Indicates the first true update parameter.

[0121] After the first initial parameter and the second initial parameter are updated, an updated neural network model is obtained. At this time, the updated neural network model includes the updated first backbone network model, the updated first head network model and the unupdated second head network model. Afterwards, the target amount of application data is input into the updated neural network model to modify the model parameters to the third parameter. At this time, it is set that the first parameter also includes the third initial parameter of the second head network model, and the third parameter includes the second true update parameter of the first backbone network model and the third true update parameter of the second head network model. Correspondingly, the target amount of application data is input into the updated neural network model, and the model parameters of the neural network model are corrected according to the second output result and the second parameter of the updated neural network model, including: inputting the target amount of application data into the updated neural network model to obtain the corresponding second output result; calculating the second loss function of the updated neural network model according to the second output result; determining the third gradient of the first false update parameter and the fourth gradient of the third initial parameter according to the second loss function; correcting the first initial parameter to the second true update parameter according to the first gradient, the third gradient and the second learning rate, and correcting the third initial parameter to the third true update parameter according to the fourth gradient and the second learning rate.

[0122] Specifically, the first parameter should also include the model parameters of the second head network model before being updated. In the embodiment, the model parameters before being updated are recorded as the third initial parameters, expressed as ψ. Exemplarily, since the number of sample data and application data input into the neural network model is the same, in this solution, m application data are selected from all application data collected from the application scenario and recorded as {x'1, x'2, ..., x' m}, then, the second data loader is used to batch load the m application data into the updated first backbone network model. Since the model parameter of the updated first backbone network model is the first false update parameter θ1, the function of the updated first backbone network model is recorded as At this time, the second eigenvector output by the first backbone network model is Then, the second eigenvector Input to the second head network model, where the function of the second head network model is recorded as h ψ (·), the second output result output by the second head network model

[0123] Specifically, the second loss function is of the same type as the first loss function. In the embodiment, the second loss function is also a softmax loss function. out1 express, After obtaining the second loss function, the model parameters (first initial parameters and third initial parameters) of the first backbone network model and the second head network model can be corrected according to the second loss function. When correcting, the SGD algorithm is used. Since the updated first backbone network model and the second head network model are used in this scheme, when calculating the gradient, the gradients of the first false update parameter and the third initial parameter are calculated respectively according to the second loss function, where the gradient corresponding to the first false update parameter θ1 is recorded as the third gradient, and the third gradient can be expressed as The gradient corresponding to the third initial parameter ψ is recorded as the fourth gradient, which can be expressed as

[0124] Afterwards, the model parameters of the first backbone network model and the second head network model are corrected, wherein the correction process can also be understood as a model parameter update process. Specifically, when the model parameters of the first backbone network model are corrected, the first initial parameters are corrected, and the final model parameters are obtained, i.e., the model parameters at the end of this training process. Therefore, this correction process can also be understood as a true update (real update), and the corrected model parameters are recorded as the second true update parameters. Typically, since the first backbone network model has undergone a false update, it is necessary to consider the first gradient in the false update process during this true update, so that the corrected neural network model can maintain the performance of the sample scene as much as possible to avoid the problem of forgetting. During the real update, the learning rate is also introduced. In this solution, the learning rate introduced when processing the application data is recorded as the second learning rate, wherein the second learning rate and the first learning rate can be the same or different. At this time, the specific process of modifying the first initial parameter to the second true update parameter can be formally expressed as: Among them, β1 represents the second learning rate, It can be understood as a fusion gradient, λ1 represents a hyperparameter, which can be set according to actual conditions. The importance of the two gradients can be balanced through the hyperparameter. It can be understood that when λ1 is large, the first backbone network model pays more attention to application data, and when λ1 is small, the first backbone network model pays more attention to sample data. The θ used on the left side of the arrow represents the second true update parameter, and the θ used on the right side of the arrow represents the first initial parameter. From the above formal representation, it can be seen that by adding the first gradient, the problem of forgetting is avoided, and by adding the second gradient, the first backbone network model is suitable for application scenarios, that is, it has better performance in application scenarios. It should be noted that since the second gradient is the gradient obtained according to the first false update parameter, rather than the gradient obtained according to the first initial parameter, it is essentially based on the idea of ​​learning to learn in meta-learning. It is hoped that the first backbone network model will have better performance in application scenarios on the basis of being suitable for sample scenarios. It can also be understood that the second gradient is fine-tuned with reference to the updated first backbone network model, which can avoid the overfitting problem faced by direct fine-tuning in the prior art.

[0125] Similarly, the third initial parameter is updated according to the fourth gradient. Since the second head network model only processes application data during a training process, this update process can be considered as a real update. Afterwards, the model parameters obtained after this real update are recorded as the third real update parameters, that is, the second head network model is updated from the third initial parameter to the third real update parameter. And when updating, the second learning rate is introduced, and the specific process can be formally expressed as: Among them, the ψ used on the left side of the arrow represents the third true update parameter, and the ψ used on the right side of the arrow represents the third initial parameter.

[0126] It can be understood that since the first head network model has only been truly updated once, the first true update parameters obtained through the update can be directly used as the final model parameters of the first head network model in this training process. At this time, the third parameters should include the first true update parameters in addition to the second true update parameters and the third true update parameters.

[0127] Optionally, after the current training is completed, the third parameter is used as the first parameter and training is performed again until the loss function (the first loss function and the second loss function) converges or reaches a set number of training times or is manually interrupted. The convergence of the loss function means that the loss value of the loss function is within a certain range when the training is completed for a set number of consecutive times.

[0128] Solution 2: The backbone network model includes a second backbone network model, and the head network model includes a third head network model.

[0129] In this solution, the number of backbone network models is one, and is recorded as the second backbone network model. The number of head network models is also one, and is recorded as the third head network model. It can be understood that the second backbone network model is connected to the third head network model. The target number of sample data is input into the second backbone network model, so that the corresponding feature vector is output by the second backbone network model. In the embodiment, the feature vector corresponding to the target number of sample data is recorded as the fifth feature vector, and then the fifth feature vector is input into the third head network model, and the third head network model outputs the corresponding first processing result according to the fifth feature vector. Similarly, the target number of application data is input into the second backbone network model, so that the corresponding feature vector is output by the second backbone network model. In this solution, the feature vector corresponding to the target number of application data is recorded as the sixth feature vector, and then the sixth feature vector is input into the third head network model, so that the third head network model outputs the corresponding second output result according to the sixth feature vector. Optionally, the second backbone network model can determine whether the currently input data is sample data or application data through the data loader used when inputting data. Optionally, the sample data and the application data use different labels so that the second backbone network model can distinguish the input data and then input the obtained feature vector into the corresponding head network model.

[0130] Typically, when updating the model parameters of the neural network model according to the first output result, the first parameter includes the fourth initial parameter of the second backbone network model and the fifth initial parameter of the third head network model, and the second parameter includes the second false update parameter of the second backbone network model and the third false update parameter of the third head network model. Accordingly, inputting the target number of sample data into the neural network model, and updating the model parameters of the neural network model according to the first output result of the neural network model includes: inputting the target number of sample data into the neural network model to obtain the corresponding first output result; calculating the third loss function of the neural network model according to the first output result; determining the fifth gradient of the fourth initial parameter and the sixth gradient of the fifth initial parameter according to the third loss function; updating the fourth initial parameter to the second false update parameter according to the fifth gradient and the third learning rate, and updating the fifth initial parameter to the third false update parameter according to the sixth gradient and the third learning rate.

[0131] Specifically, since the neural network model includes the second backbone network model and the third head network model, the first parameter before updating should include the model parameters of the second backbone network model and the model parameters of the third head network model. In this solution, the model parameters of the second backbone network model before updating are recorded as the fourth initial parameters, expressed as θ2, and the model parameters of the third head network model are recorded as the fifth initial parameters, expressed as For example, m sample data are selected from the open source dataset and recorded as {x1, x2, ..., xm}, then, the first data loader is used to batch-input the m sample data into the second backbone network model, where the function of the second backbone network model is recorded as The fifth eigenvector output by the second backbone network model is recorded as Then, the fifth eigenvector Input to the third head network model, where the function of the third head network model is recorded as The first output result of the third head network model

[0132] Further, after obtaining the first output result, a loss function of the neural network model is constructed according to the first output result. In the embodiment, the loss function is recorded as the third loss function. The type of the third loss function can be set according to the actual situation. In this solution, the third loss function is taken as a softmax loss function. At this time, the third loss function is L in2 express,

[0133] After obtaining the third loss function, the model parameters (fourth initial parameters and fifth initial parameters) of the second backbone network model and the third head network model can be updated according to the third loss function. When updating, the SGD algorithm is used, that is, the gradients of the fourth initial parameters and the fifth initial parameters are calculated according to the third loss function by taking partial derivatives, so as to determine the update amplitude of the fourth initial parameters and the fifth initial parameters according to the gradients. The gradient corresponding to the fourth initial parameter θ2 is recorded as the fifth gradient, and the fifth gradient can be expressed as Fifth initial parameter The corresponding gradient is recorded as the sixth gradient, and the sixth gradient can be expressed as

[0134] Afterwards, the fourth initial parameters are updated according to the fifth gradient. Since the second backbone network model also needs to extract the features of the application data during a training process, and the update of the fourth initial parameters this time is only for the sample data, this update process can be considered a fake update. Afterwards, the model parameters obtained after this fake update are recorded as the second fake update parameters, that is, the second backbone network model is updated from the first initial parameters to the second fake update parameters. Since the neural network model is trained using the idea of ​​meta-learning, the learning rate is introduced when updating the model parameters. In this scheme, the learning rate used when processing sample data is recorded as the third learning rate. Afterwards, the model parameter update is implemented based on the third learning rate and the fifth gradient, and the specific process can be formally expressed as: Among them, α2 represents the third learning rate and θ3 represents the second false update parameter.

[0135] Similarly, the fifth initial parameter is updated according to the sixth gradient. Since the third head network model also needs to process application data during a training process, and the update of the fifth initial parameter is only for sample data, this update process can be considered as a fake update. Afterwards, the model parameters obtained after this fake update are recorded as the third fake update parameters, that is, the third head network model is updated from the fifth initial parameter to the third fake update parameter. And when updating, the third learning rate is introduced, that is, the model parameter update is realized based on the third learning rate and the sixth gradient. The specific process can be formally expressed as: Among them, α2 represents the third learning rate, Indicates the third fake update parameter.

[0136] After updating the fourth initial parameter and the fifth initial parameter, an updated neural network model is obtained. At this time, the updated neural network model includes the updated second backbone network model and the updated third head network model. Afterwards, the target number of sample data is input into the updated neural network model to obtain the third parameter. At this time, it is set that the third parameter includes the fourth true update parameter of the second backbone network model and the fifth true update parameter of the third head network model. Correspondingly, the target number of application data is input into the updated neural network model, and the model parameters of the neural network model are corrected according to the second output result and the second parameter of the updated neural network model, including: inputting the target number of application data into the updated neural network model to obtain the corresponding second output result; calculating the fourth loss function of the updated neural network model according to the second output result; determining the seventh gradient of the second false update parameter and the eighth gradient of the third false update parameter according to the fourth loss function; correcting the fourth initial parameter to the fourth true update parameter according to the fifth gradient, the seventh gradient and the fourth learning rate; correcting the fifth initial parameter to the fifth true update parameter according to the sixth gradient, the eighth gradient and the fourth learning rate.

[0137] For example, since the number of sample data and application data input into the neural network model is the same, in this solution, m application data are selected from all application data collected from the application scenario and recorded as {x'1, x'2, ..., x' m}, then, the second data loader is used to batch-input the m application data into the updated second backbone network model. Since the model parameter of the updated second backbone network model is the second false update parameter θ3, the function of the updated second backbone network model is recorded as At this time, the sixth eigenvector output by the first backbone network model is Then, the sixth eigenvector Input to the updated third head network model, wherein the model parameters of the updated third head network model are the third false update parameters Therefore, the function of the updated third head network model is recorded as The second output result of the third head network model

[0138] Specifically, the loss function of the neural network model is constructed according to the second output result, which is recorded as the fourth loss function in this solution. The fourth loss function is of the same type as the third loss function. In this solution, the fourth loss function is also a softmax loss function. The fourth loss function is represented by L out2 express, After obtaining the fourth loss function, the first parameters (fourth initial parameters and fifth initial parameters) of the second backbone network model and the third head network model can be corrected according to the fourth loss function. When correcting, the SGD algorithm is used. Since the updated second backbone network model and the updated third head network model are used in this step, when calculating the gradient, the gradients of the second false update parameter and the third false update parameter are calculated respectively according to the fourth loss function, where the gradient corresponding to the second false update parameter θ3 is recorded as the seventh gradient, and the seventh gradient can be expressed as Third fake update parameter The corresponding gradient is recorded as the eighth gradient, and the eighth gradient can be expressed as

[0139] Afterwards, the first parameter is corrected, wherein the correction process can also be understood as a model parameter update process. When the fourth initial parameter of the second backbone network model is corrected, the final model parameter is obtained, that is, the sample data and application data have been trained once. Therefore, this correction process can also be understood as a true update (realupdate), and the corrected model parameter is recorded as the fourth true update parameter. Typically, since the second backbone network model has undergone a false update, it is necessary to consider the fifth gradient in the false update process during this true update so that the final second backbone network model is suitable for both sample scenarios and application scenarios. During the real update, the learning rate is also introduced. In this solution, the learning rate used when processing application data is recorded as the fourth learning rate. The fourth learning rate and the third learning rate can be the same or different. At this time, the specific process of modifying the fourth initial parameter to the fourth true update parameter can be formally expressed as: Among them, β2 represents the fourth learning rate, It can be understood as a fusion gradient, λ2 represents a hyperparameter, which can be set according to actual conditions. λ2 has the same function as λ1, which will not be described in detail here. θ2 used on the left side of the arrow represents the fourth true update parameter, and θ2 used on the right side of the arrow represents the fourth initial parameter. It can be understood that the problems solved and the beneficial effects achieved when the second backbone network model is truly updated are the same as those solved and the beneficial effects achieved when the first backbone network model is truly updated, which will not be described in detail here.

[0140] Similarly, the fifth initial parameter is corrected according to the eighth gradient, wherein the correction process can also be understood as a process of updating the model parameters. When the fifth initial parameter of the third head network model is modified, the final model parameters are obtained, that is, the sample data and application data have been trained once. Therefore, this correction process can also be understood as a true update (real update), and the corrected model parameters are recorded as the fifth real update parameters. Typically, since the third head network model has undergone a false update, the sixth gradient in the false update process needs to be considered during this true update, so that the final third head network model is suitable for both sample scenarios and application scenarios. During the real update, the fourth learning rate is also introduced. At this time, the specific process of modifying the fifth initial parameter to the fifth real update parameter can be formally expressed as: in, It can be understood as a fusion gradient. λ2 represents a hyperparameter, which can be set according to actual conditions. Indicates the fifth true update parameter, used on the right side of the arrow It is understandable that the problems solved and the beneficial effects achieved when the third head network model is truly updated are the same as those solved and the beneficial effects achieved when the second backbone network model is truly updated, and will not be elaborated here.

[0141] It should be noted that after the completion of this training, the third parameter is used as the first parameter and training is performed again until the loss function (the third loss function and the fourth loss function) converges or reaches the set number of training times or is manually interrupted.

[0142] It can be understood that the target number of sample data can be considered as a group of data. Similarly, the target number of application data can be considered as a group of data. During the training process of Scheme 1 and Scheme 2, a group of sample data and feature data are input. In practical applications, multiple groups of data can also be used. That is, in one training process, multiple groups of data are used, and the fused gradients corresponding to each group of data are averaged, so that the averaged fused gradient is used as the gradient used for true update.

[0143] Solution 3: The backbone network model includes a second backbone network model, and the head network model includes a third head network model.

[0144] The neural network model used in this scheme is the same as the neural network model used in Scheme 2, with only different means used in training. In Scheme 2, only one batch was used for false updating and true updating of the first parameter, while in Scheme 3, k iterations were used for false updating and true updating of the first parameter, k>1, that is, k batches were used. At this time, in order to achieve k iterations, in this scheme, it is set that there are k groups of sample data, each group of sample data has a target number of sample data, and there are k groups of application data, each group of application data has a target number of application data.

[0145] Specifically, there are k groups of sample data, each group of sample data contains a target number of sample data, k>1; accordingly, the target number of sample data is input into the neural network model, and the model parameters of the neural network model are updated according to the first output result of the neural network model, including: performing k iterations of updating the model parameters of the neural network model according to the k groups of sample data, the model parameters before the k iterations are the first parameters, and the model parameters after the k iterations are the first intermediate parameters; updating the model parameters of the neural network model from the first parameters to the second parameters according to the first intermediate parameters and the fifth learning rate. Among them, one iteration update process is: input a group of sample data into the neural network model to obtain the first output result; construct the fifth loss function of the neural network model according to the first output result; determine the ninth gradient of the model parameters before this iteration update according to the fifth loss function; and update the model parameters according to the ninth gradient and the fifth learning rate.

[0146] Specifically, k groups of sample data are used to perform k iteration updates on the model parameters of the neural network model, and the model parameters before the k iteration updates are the first parameters. After the k iteration updates, the model parameters are updated. In this solution, the model parameters after the k iteration updates are recorded as the first intermediate parameters. It can be understood that the first intermediate parameters include the intermediate parameters of the second backbone network model and the intermediate parameters of the third head network model. Typically, the first iteration update is described as an example. At this time, the first parameter includes the model parameter θ4 of the second backbone network model and the model parameter θ5 of the third head network model. Specifically, m sample data are selected from the open source dataset and recorded as {x1, x2, ..., x m}, and input it into the second backbone network model, where the function of the second backbone network model is recorded as The feature vector output by the second backbone network model is recorded as Then, the feature vector Input to the third head network model, where the function of the third head network model is recorded as Correspondingly, the first output result of the third head network model is Afterwards, a loss function of the neural network model is constructed according to the first output result. In this scheme, the constructed loss function is recorded as the fifth loss function, wherein the type of the fifth loss function can be set according to the actual situation. In this scheme, the fifth loss function is taken as a softmax loss function as an example. At this time, the fifth loss function is represented by L0. After obtaining the fifth loss function, the first parameter (θ4 and ), in this scheme, the gradient corresponding to the first parameter is recorded as the ninth gradient. At this time, the ninth gradient corresponding to θ4 is expressed as The corresponding ninth gradient is expressed as Afterwards, according to θ4 is updated, and the learning rate is introduced during the update. In this scheme, the learning rate used when processing sample data is recorded as the fifth learning rate. At this time, the specific process of updating θ4 can be formally expressed as: Among them, α3 represents the fifth learning rate, Represents the model parameters after this iteration update. Similarly, according to right The specific process of updating can be formalized as follows: in, represents the updated model parameters. In this way, an iterative update is completed. After that, m more sample data are selected from the open source dataset and recorded as {x1, x2, …, x m}, it can be understood that the sample data of the two groups can be completely different or partially different. After that, the m sample data are input into the second backbone network model, wherein the model parameters of the second backbone network model are The function is recorded as The feature vector output by the second backbone network model is recorded as Then, the feature vector Input to the third head network model, wherein the model parameters of the third head network model are Function Correspondingly, the first output result of the third head network model is Afterwards, the fifth loss function is constructed according to the first output result. In this iterative update process, the fifth loss function is represented by L1. After obtaining the fifth loss function, calculate according to the fifth loss function The ninth gradient is as well as The ninth gradient is Afterwards, according to right Update, and introduce the fifth learning rate during the update. At this time, The specific process of updating can be formalized as follows: in, Represents the updated model parameters. Similarly, according to right The specific process of updating can be formalized as follows: in, Represents the updated model parameters. After that, the iterative update continues until k iterative updates are performed. At this time, for the second backbone network model, the specific process of k iterative updates can be formally expressed as: in, represents the model parameters after k iterations, represents the model parameters after k-1 iterations, L k-1 represents the fifth loss function calculated at the kth iteration update. Similarly, for the third head network model, the specific process of k-th iteration update can be formalized as: in, represents the model parameters after k iterations, represents the model parameters after k-1 iterations. At this time, and is the first intermediate parameter obtained after k iterations of updating.

[0147] Afterwards, the first parameter of the neural network model is updated according to the first intermediate parameter to obtain the second parameter, and the fifth learning rate is also introduced during the update. Specifically, the formal expression of the update of the model parameter θ4 of the second backbone network model is: Model parameters for the third head network model The formal representation of the update is θ5 and The above formal representation shows that when the first parameter is updated to the second parameter, the model parameter change amount (i.e. and ) as the gradient to update the model parameters. It can be understood that the above process is only for sample data, so this update process can be considered a fake update. After that, it is necessary to perform a real update through application data.

[0148] Based on this, it is assumed that there are k groups of application data, and each group of application data contains a target number of application data. Accordingly, the target number of application data is input into the updated neural network model, and the model parameters of the neural network model are corrected according to the second output result and the second parameter of the updated neural network model, including: performing k iterative corrections on the model parameters of the updated neural network model according to the k groups of target number of application data, the model parameters before the k iterative corrections are the second parameters, and the model parameters after the k iterative updates are the second intermediate parameters; the model parameters of the neural network model are corrected from the first parameters to the third parameters according to the second intermediate parameters, the sixth learning rate and the second parameter. Among them, an iterative correction process is: inputting the current group of application data into the updated neural network model to obtain the second output result; constructing the sixth loss function of the neural network model according to the second output result; determining the tenth gradient of the model parameters before this iterative correction according to the sixth loss function; and correcting the model parameters of the updated neural network model according to the tenth gradient and the sixth learning rate.

[0149] Specifically, k groups of application data are used to perform k iterative corrections on the model parameters of the updated neural network model, wherein k iterative corrections can also be understood as k iterative updates. The model parameters before k iterative corrections are the second parameters, and the model parameters are updated after k iterative corrections. In this scheme, the model parameters after k iterative corrections are recorded as second intermediate parameters. It can be understood that the second intermediate parameters include the intermediate parameters of the second backbone network model and the intermediate parameters of the third head network model. It should be noted that the specific means for one iterative correction are the same as the specific means for one iterative update, except that the learning rate introduced during one iterative correction is recorded as the sixth learning rate, and the sixth learning rate and the fifth learning rate can be the same or different. At this time, for the updated second backbone network model, the specific process of k iterative corrections can be formally expressed as: Among them, β3 represents the sixth learning rate, the calculated loss function is recorded as the sixth loss function during iterative correction, the calculated gradient is recorded as the tenth gradient, θ5 is the second parameter of the updated second backbone network model, represents the tenth gradient corresponding to θ5, L'0 represents the sixth loss function calculated during the first iterative correction, represents the model parameters of the second backbone network model after the first iteration correction, express The corresponding tenth gradient, L'1 represents the sixth loss function calculated during the second iteration correction, represents the model parameters of the second backbone network model after the second iteration correction, represents the model parameters of the second backbone network model after the k-1th iteration correction, express The corresponding tenth gradient, L'k-1 represents the sixth loss function calculated at the kth iteration modification, represents the model parameters of the second backbone network model after modification in the kth iteration. Similarly, for the updated third head network model, the specific process of k-th iteration modification can be formalized as: in, is the second parameter of the third head network model, express The corresponding tenth gradient is represents the model parameters of the third head network model after the first iteration correction, express The corresponding tenth gradient is represents the model parameters of the third head network model after the second iteration correction, represents the model parameters of the third head network model after the k-1th iteration correction, express The corresponding tenth gradient is represents the model parameters of the third head network model after modification at the kth iteration. At this time, the second intermediate parameters include and

[0150] Afterwards, the first parameter of the neural network model is modified according to the second intermediate parameter to obtain the third parameter, and the sixth learning rate is also introduced during the modification. The second parameter is also considered during the modification so that the modified neural network model is adapted to the sample scenario and the application scenario. Typically, during the modification, the parameter change of the second parameter is determined by the second intermediate parameter, and the parameter variable of the second parameter is used as the gradient of the second parameter. Similarly, the parameter change when the first parameter is updated to the second parameter is determined and used as the gradient of the first parameter. Afterwards, the first parameter is modified to the third parameter according to the two gradients and the third learning rate. At this time, for the second backbone network model, the modification of its model parameters is formally expressed as Among them, θ4 used on the left side of the arrow represents the third parameter after modification, and θ4 used on the right side of the arrow represents the first parameter before modification. From the above formal representation, it can be seen that by adding θ4-θ5, the problem of forgetting is avoided. So that the second backbone network model is suitable for the application scenario, that is, it has better performance in the application scenario. It is based on the gradient obtained based on the false update, not the gradient obtained based on the first parameter. Therefore, it is essentially based on the idea of ​​learning to learn in meta-learning. It is hoped that the second backbone network model will have better performance in the application scenario based on its applicability to the sample scenario. It can also be understood as The updated first backbone network model is used as a reference for fine-tuning, which can avoid the overfitting problem faced by direct fine-tuning in the prior art. Similarly, for the third head network model, the correction of its model parameters is formally expressed as The arrow on the left is used Indicates the modified third parameter, the one on the right of the arrow is used It represents the first parameter before modification. The specific problems it solves and the beneficial effects it achieves are the same as those solved and the beneficial effects achieved by the second backbone network model during the true update, and will not be elaborated here.

[0151] It should be noted that after the completion of this training, the third parameter is used as the first parameter and training is performed again until the loss function (the fifth loss function and the sixth loss function) converges or reaches the set number of training times.

[0152] It should be noted that the neural network model structure in this solution is consistent with the neural network model structure in Solution 2. In practical applications, the neural network model structure can also be the neural network model structure in Solution 1. At this time, the processing method of the first backbone network model is the same as that of the second backbone network model, and the processing methods of the first head network model and the second head network model can refer to the pseudo-update process of the third head network model.

[0153] In another embodiment, the neural network model includes a backbone network model. Accordingly, inputting the target number of sample data into the neural network model, and updating the model parameters of the neural network model according to the first output result of the neural network model includes: inputting the target number of sample data into the backbone network model to obtain the first output result output by the backbone network model, the first output result being the third eigenvector; constructing the seventh loss function of the backbone network model according to the first output result; determining the eleventh gradient of the first parameter according to the seventh loss function; updating the model parameter from the first parameter to the second parameter according to the eleventh gradient and the seventh learning rate. Inputting the target number of application data into the updated neural network model, and correcting the model parameters of the neural network model according to the second output result and the second parameter of the updated neural network model includes: inputting the target number of application data into the updated backbone network model to obtain the second output result output by the backbone network model, the second output result being the fourth eigenvector; constructing the eighth loss function of the backbone network model according to the second output result; determining the twelfth gradient of the second parameter according to the eighth loss function; updating the model parameter from the first parameter to the third parameter according to the twelfth gradient, the eleventh gradient and the eighth learning rate.

[0154] Exemplarily, the neural network model is used for single-classification face recognition as an example for description. At this time, since the logits value does not need to be calculated, the neural network model can only include a backbone network model, which is used to extract the features of the data input into the neural network model and output a feature vector, wherein the type of the backbone network model is not limited in the embodiment, for example, the backbone network model can be a residual network, a face recognition network (MobileFaceNet) running on a mobile terminal, etc. In the embodiment, the number of backbone network models is one, and the sample scenario and the application scenario share the backbone network model. Specifically, a target number of sample data is selected from the open source data set, and then the target number of sample data is input into the backbone network model so that the backbone network model outputs a first output result, wherein the first output result is a feature vector output by the backbone neural network, and in the embodiment, the feature vector is recorded as the third feature vector. Afterwards, the loss function of the backbone network model is constructed according to the third feature vector, and in the embodiment, the loss function is recorded as the seventh loss function, wherein the type of the seventh loss function can be set according to the actual situation, such as the seventh loss function is a contrast loss function, a triplet loss loss function, etc. Afterwards, the gradient of the first parameter is determined according to the seventh loss function by using the method of finding partial derivatives. In the embodiment, the gradient is recorded as the eleventh gradient, wherein the calculation method of the eleventh gradient is the same as the calculation method of each gradient in the above embodiment, and no further description is given here. Afterwards, the first parameter is updated according to the eleventh gradient, and the seventh learning rate is referenced during the update. It can be understood that the current update is a false update, and the specific update method is the same as the false update method used in Scheme 1 and Scheme 2 in the above embodiment, or other false update methods can also be used. Afterwards, a set number of application data for the target application data is selected from all the application data currently collected, and input into the updated backbone network model to obtain the corresponding second output result, wherein the second output result is a feature vector output by the backbone neural network. In the embodiment, the feature vector is recorded as the fourth feature vector. Afterwards, the loss function of the backbone network model is constructed according to the second output result. In the embodiment, the loss function is recorded as the eighth loss function, and the eighth loss function is of the same type as the seventh loss function. Afterwards, the gradient of the second parameter is determined according to the eighth loss function by taking partial derivatives. In the embodiment, the gradient is recorded as the twelfth gradient, wherein the calculation method of the twelfth gradient is the same as the calculation method of the eleventh gradient. Afterwards, the first parameter is corrected according to the twelfth gradient and the second parameter, and the eighth learning rate is referenced during the correction. The eighth learning rate and the seventh learning rate can be the same or synchronized. It can be understood that the current correction process is a true update process, and the specific correction method is the same as the true update method used in the second embodiment of the above embodiment, or other true update methods can also be used.

[0155] After this training is completed, the third parameter is used as the first parameter and training is performed again until the loss function (the seventh loss function and the eighth loss function) converges or reaches the set number of training times.

[0156] It can be understood that in actual applications, k groups of sample data can be used for k iterative updates and k groups of application data can be used for k iterative modifications. The specific process can refer to Scheme 3, except for the relevant description of the third head network model in Scheme 3.

[0157] It should be noted that when the first parameter is updated to the third parameter, the eleventh gradient is introduced, so that the neural network model can maintain the performance in the sample scenario as much as possible and avoid the problem of forgetting. At the same time, since the twelfth gradient is the gradient obtained based on the second parameter based on the false update, rather than the gradient obtained based on the first parameter, it is essentially based on the idea of ​​learning to learn in meta-learning. It is hoped that the backbone network model will have better performance in the application scenario on the basis of being suitable for the sample scenario, which can avoid the overfitting problem faced by direct fine-tuning in the prior art.

[0158] Figure 2 A schematic diagram of a neural network model adjustment device provided in an embodiment of the present application, referring to Figure 2 The neural network model adjustment device includes: an updating module 201 and a correcting module 202.

[0159] Among them, the updating module 201 is used to input the target number of sample data into the neural network model, and update the model parameters of the neural network model according to the first output result of the neural network model, the model parameters before the update are the first parameters, and the model parameters after the update are the second parameters; the correction module 202 is used to input the target number of application data into the updated neural network model, and correct the model parameters of the neural network model according to the second output result of the updated neural network model and the second parameter, the model parameters before the correction are the first parameters, and the model parameters after the correction are the third parameters.

[0160] Based on the above embodiment, the neural network model includes a backbone network model and a head network model, wherein the backbone network model is used to extract the feature vector of the neural network model input data; and the head network model is used to obtain the output result of the neural network model according to the feature vector.

[0161] Based on the above embodiment, the backbone network model includes a first backbone network model, the head network model includes a first head network model and a second head network model, when the target number of sample data is input into the first backbone network model, the first backbone network model is used to output a first feature vector, when the target number of application data is input into the first backbone network model, the first backbone network model is used to output a second feature vector; the first head network model is used to obtain the first output result based on the first feature vector; the second head network model is used to obtain the second output result based on the second feature vector.

[0162] On the basis of the above embodiment, the first parameter includes the first initial parameter of the first backbone network model and the second initial parameter of the first head network model, and the second parameter includes the first false update parameter of the first backbone network model and the first true update parameter of the first head network model. The update module 201 includes: a first input unit, used to input the target number of sample data into the neural network model to obtain the corresponding first output result; a first loss calculation unit, used to calculate the first loss function of the neural network model according to the first output result; a first gradient calculation unit, used to determine the first gradient of the first initial parameter and the second gradient of the second initial parameter according to the first loss function; a first parameter updating unit, used to update the first initial parameter to the first false update parameter according to the first gradient and the first learning rate, and update the second initial parameter to the first true update parameter according to the second gradient and the first learning rate.

[0163] On the basis of the above embodiment, the first parameter also includes the third initial parameter of the second head network model, and the third parameter includes the second true update parameter of the first backbone network model and the third true update parameter of the second head network model. Correspondingly, the correction module 202 includes: a second input unit, used to input the target amount of application data into the updated neural network model to obtain the corresponding second output result; a second loss calculation unit, used to calculate the second loss function of the updated neural network model according to the second output result; a second gradient calculation unit, used to determine the third gradient of the first false update parameter and the fourth gradient of the third initial parameter according to the second loss function; a first parameter correction unit, used to correct the first initial parameter to the second true update parameter according to the first gradient, the third gradient and the second learning rate, and correct the third initial parameter to the third true update parameter according to the fourth gradient and the second learning rate.

[0164] On the basis of the above embodiment, the backbone network model includes a second backbone network model, and the head network model includes a third head network model.

[0165] On the basis of the above embodiment, the first parameter includes the fourth initial parameter of the second backbone network model and the fifth initial parameter of the third head network model, and the second parameter includes the second pseudo-update parameter of the second backbone network model and the third pseudo-update parameter of the third head network model. The update module 201 includes: a third input unit, used to input the target number of sample data into the neural network model to obtain the corresponding first output result; a third loss calculation unit, used to calculate the third loss function of the neural network model according to the first output result; a third gradient calculation unit, used to determine the fifth gradient of the fourth initial parameter and the sixth gradient of the fifth initial parameter according to the third loss function; a second parameter updating unit, used to update the fourth initial parameter to the second pseudo-update parameter according to the fifth gradient and the third learning rate, and update the fifth initial parameter to the third pseudo-update parameter according to the sixth gradient and the third learning rate.

[0166] On the basis of the above embodiment, the third parameter includes the fourth true update parameter of the second backbone network model and the fifth true update parameter of the third head network model. The correction module 202 includes: a fourth input unit, used to input the target amount of application data into the updated neural network model to obtain the corresponding second output result; a fourth loss calculation unit, used to calculate the fourth loss function of the updated neural network model according to the second output result; a fourth gradient calculation unit, used to determine the seventh gradient of the second false update parameter and the eighth gradient of the third false update parameter according to the fourth loss function; a second parameter correction unit, used to correct the fourth initial parameter to the fourth true update parameter according to the fifth gradient, the seventh gradient and the fourth learning rate; correct the fifth initial parameter to the fifth true update parameter according to the sixth gradient, the eighth gradient and the fourth learning rate.

[0167] On the basis of the above embodiment, the sample data has a total of k groups, each group of sample data contains a target number of sample data, k>1, and the update module 201 includes: an iterative update unit, which is used to perform k iterative updates on the model parameters of the neural network model according to the k groups of sample data, the model parameters before the k iterative updates are the first parameters, and the model parameters after the k iterative updates are the first intermediate parameters; a third parameter update unit, which is used to update the model parameters of the neural network model from the first parameters to the second parameters according to the first intermediate parameters and the fifth learning rate. Among them, an iterative update process is: inputting the current group of sample data into the neural network model to obtain the first output result; constructing the fifth loss function of the neural network model according to the first output result; determining the ninth gradient of the model parameters before this iterative update according to the fifth loss function; and updating the model parameters according to the ninth gradient and the fifth learning rate.

[0168] On the basis of the above embodiment, there are k groups of application data, each group of application data contains a target number of application data, and the correction module 202 includes: an iterative correction unit, which is used to perform k iterative corrections on the model parameters of the updated neural network model according to the k groups of application data, the model parameters before the k iterative corrections are the second parameters, and the model parameters after the k iterative updates are the second intermediate parameters; a third parameter correction unit, which is used to correct the model parameters of the neural network model from the first parameters to the third parameters according to the second intermediate parameters, the sixth learning rate and the second parameters. Among them, one iterative correction process is: input the current group of application data into the updated neural network model to obtain the second output result; construct the sixth loss function of the updated neural network model according to the second output result; determine the tenth gradient of the model parameters before this iterative correction according to the sixth loss function; and correct the model parameters according to the tenth gradient and the sixth learning rate.

[0169] On the basis of the above embodiment, the neural network model includes a backbone network model. The update module 201 includes: a fifth input unit, used to input the target number of sample data into the backbone network model to obtain a first output result output by the backbone network model, wherein the first output result is a third eigenvector; a fifth loss calculation unit, used to construct a seventh loss function of the backbone network model according to the first output result; a fifth gradient calculation unit, used to determine the eleventh gradient of the first parameter according to the seventh loss function; and a fourth parameter update unit, used to update the model parameter from the first parameter to the second parameter according to the eleventh gradient and the seventh learning rate. The correction module 202 includes: a sixth input unit, used to input the target amount of application data into the updated backbone network model to obtain a second output result of the backbone network model, wherein the second output result is a fourth eigenvector; a sixth loss calculation unit, used to construct an eighth loss function of the updated backbone network model according to the second output result; a sixth gradient calculation unit, used to determine the twelfth gradient of the second parameter according to the eighth loss function; and a fourth parameter correction unit, used to update the model parameter from the first parameter to the third parameter according to the twelfth gradient, the eleventh gradient and the eighth learning rate.

[0170] Based on the above embodiment, a target amount of sample data is input into the neural network model through a first data loader; a target amount of application data is input into the updated neural network model through a second data loader.

[0171] The neural network model adjustment device provided above can be used to execute the neural network model adjustment method provided in any of the above embodiments, and has corresponding functions and beneficial effects.

[0172] It is worth noting that in the embodiment of the above-mentioned neural network model adjustment device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0173] Figure 3 A schematic diagram of a neural network model adjustment device provided in one embodiment of the present application. Figure 3 As shown, the neural network model adjustment device includes a processor 30, a memory 31, an input device 32 and an output device 33; the number of processors 30 in the neural network model adjustment device can be one or more. Figure 3 A processor 30 is taken as an example. The processor 30, the memory 31, the input device 32 and the output device 33 in the neural network model adjustment device can be connected via a bus or other means. Figure 3 The example of connecting through bus is taken in the following.

[0174] The memory 31, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the neural network model adjustment method in the embodiment of the present invention (for example, the update module 201 and the correction module 202 in the neural network model adjustment device). The processor 30 executes various functional applications and data processing of the neural network model adjustment device by running the software programs, instructions and modules stored in the memory 31, that is, realizes the above-mentioned neural network model adjustment method.

[0175] The memory 31 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the neural network model adjustment device, etc. In addition, the memory 31 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 31 may further include a memory remotely arranged relative to the processor 30, and these remote memories may be connected to the neural network model adjustment device 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.

[0176] The input device 32 can be used to receive input digital or character information and generate key signal input related to user settings and function control of the neural network model adjustment device. The output device 33 can include display devices such as display screens.

[0177] The above-mentioned neural network model adjustment device includes a neural network model adjustment device, which can be used to execute any neural network model adjustment method and has corresponding functions and beneficial effects.

[0178] In addition, an embodiment of the present invention also provides a storage medium containing computer executable instructions, which, when executed by a computer processor, are used to perform relevant operations in the neural network model adjustment method provided in any embodiment of the present application, and have corresponding functions and beneficial effects.

[0179] Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products.

[0180] Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0181] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0182] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0183] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0184] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A neural network model adjustment method, It is characterized in that include: Inputting a target number of sample data into a neural network model, and updating a model parameter of the neural network model according to a first output result of the neural network model, wherein the model parameter before updating is a first parameter and the model parameter after updating is a second parameter; Input a target amount of application data into an updated neural network model, and correct the model parameters of the neural network model according to a second output result of the updated neural network model and the second parameter, wherein the model parameter before correction is the first parameter and the model parameter after correction is the third parameter, the corrected model parameter is the first parameter before the neural network model is updated, the third parameter is obtained by correcting the first parameter according to the gradient of the second parameter, the gradient of the first parameter and the learning rate, and the gradient of the second parameter is determined by a loss function calculated according to the second output result.

2. The neural network model adjustment method according to claim 1, It is characterized in that The neural network model includes a backbone network model and a head network model. The backbone network model is used to extract the feature vector of the neural network model input data; the head network model is used to obtain the output result of the neural network model according to the feature vector.

3. The neural network model adjustment method according to claim 2, It is characterized in that The backbone network model includes a first backbone network model, and the head network model includes a first head network model and a second head network model. When the target number of sample data is input into the first backbone network model, the first backbone network model is used to output a first feature vector, and when the target number of application data is input into the first backbone network model, the first backbone network model is used to output a second feature vector; The first head network model is used to obtain the first output result according to the first feature vector; The second head network model is used to obtain the second output result according to the second feature vector.

4. The neural network model adjustment method according to claim 3, It is characterized in that The first parameters include first initial parameters of the first backbone network model and second initial parameters of the first head network model, and the second parameters include first false update parameters of the first backbone network model and first true update parameters of the first head network model; The step of inputting the target number of sample data into the neural network model and updating the model parameters of the neural network model according to the first output result of the neural network model comprises: Inputting a target number of sample data into the neural network model to obtain a corresponding first output result; Calculate a first loss function of the neural network model according to the first output result; Determine a first gradient of the first initial parameter and a second gradient of the second initial parameter according to the first loss function; The first initial parameter is updated to the first false update parameter according to the first gradient and the first learning rate, and the second initial parameter is updated to the first true update parameter according to the second gradient and the first learning rate.

5. The neural network model adjustment method according to claim 4, It is characterized in that The first parameters also include third initial parameters of the second head network model, and the third parameters include second true update parameters of the first backbone network model and third true update parameters of the second head network model; The step of inputting the target amount of application data into the updated neural network model and correcting the model parameters of the neural network model according to the second output result of the updated neural network model and the second parameter comprises: Inputting the target amount of application data into the updated neural network model to obtain a corresponding second output result; Calculate a second loss function of the updated neural network model according to the second output result; Determine a third gradient of the first pseudo update parameter and a fourth gradient of the third initial parameter according to the second loss function; The first initial parameter is corrected to the second true update parameter according to the first gradient, the third gradient and the second learning rate, and the third initial parameter is corrected to the third true update parameter according to the fourth gradient and the second learning rate.

6. The neural network model adjustment method according to claim 2, It is characterized in that The backbone network model includes a second backbone network model, and the head network model includes a third head network model.

7. The neural network model adjustment method according to claim 6, It is characterized in that The first parameters include a fourth initial parameter of the second backbone network model and a fifth initial parameter of the third head network model, and the second parameters include a second false update parameter of the second backbone network model and a third false update parameter of the third head network model; The step of inputting the target number of sample data into the neural network model and updating the model parameters of the neural network model according to the first output result of the neural network model comprises: Inputting a target number of sample data into the neural network model to obtain a corresponding first output result; Calculating a third loss function of the neural network model according to the first output result; Determining a fifth gradient of the fourth initial parameter and a sixth gradient of the fifth initial parameter according to the third loss function; The fourth initial parameter is updated to the second false update parameter according to the fifth gradient and the third learning rate, and the fifth initial parameter is updated to the third false update parameter according to the sixth gradient and the third learning rate.

8. The neural network model adjustment method according to claim 7, It is characterized in that The third parameters include a fourth true update parameter of the second backbone network model and a fifth true update parameter of the third head network model; The step of inputting the target amount of application data into the updated neural network model and correcting the model parameters of the neural network model according to the second output result of the updated neural network model and the second parameter comprises: Inputting the target amount of application data into the updated neural network model to obtain a corresponding second output result; Calculating a fourth loss function of the updated neural network model according to the second output result; Determining a seventh gradient of the second false update parameter and an eighth gradient of the third false update parameter according to the fourth loss function; The fourth initial parameter is corrected to the fourth true update parameter according to the fifth gradient, the seventh gradient and the fourth learning rate, and the fifth initial parameter is corrected to the fifth true update parameter according to the sixth gradient, the eighth gradient and the fourth learning rate.

9. The neural network model adjustment method according to claim 3 or 6, It is characterized in that There are k groups of sample data in total, each group of sample data contains a target number of sample data, k>1; The step of inputting the target number of sample data into the neural network model and updating the model parameters of the neural network model according to the first output result of the neural network model comprises: Performing k-iterative updates on the model parameters of the neural network model according to the k groups of sample data, wherein the model parameters before the k-iterative updates are the first parameters, and after the k-iterative updates, the model parameters are the first intermediate parameters; Updating the model parameters of the neural network model from the first parameters to the second parameters according to the first intermediate parameters and the fifth learning rate; Among them, an iterative update process is: Inputting a set of sample data into the neural network model to obtain a first output result; Constructing a fifth loss function of the neural network model according to the first output result; Determine a ninth gradient of the model parameters before this iterative update according to the fifth loss function; The model parameters are updated according to the ninth gradient and the fifth learning rate.

10. The neural network model adjustment method according to claim 9, It is characterized in that There are k groups of application data in total, and each group of application data contains a target number of application data. The step of inputting the target amount of application data into the updated neural network model and correcting the model parameters of the neural network model according to the second output result of the updated neural network model and the second parameter comprises: Performing k-iterative corrections on the model parameters of the updated neural network model according to the k groups of application data, wherein the model parameters before the k-iterative corrections are the second parameters, and the model parameters after the k-iterative updates are the second intermediate parameters; Correcting the model parameters of the neural network model from the first parameters to third parameters according to the second intermediate parameters, the sixth learning rate and the second parameters; Among them, an iterative correction process is: Inputting a set of application data into the updated neural network model to obtain a second output result; Constructing a sixth loss function of the updated neural network model according to the second output result; Determine the tenth gradient of the model parameter before this iterative correction according to the sixth loss function; The model parameters are modified according to the tenth gradient and the sixth learning rate.

11. The neural network model adjustment method according to claim 1, It is characterized in that The neural network model includes a backbone network model; The step of inputting the target number of sample data into the neural network model and updating the model parameters of the neural network model according to the first output result of the neural network model comprises: Inputting a target number of sample data into the backbone network model to obtain a first output result output by the backbone network model, wherein the first output result is a third eigenvector; Construct a seventh loss function of the backbone network model according to the first output result; Determining an eleventh gradient of the first parameter according to the seventh loss function; Updating the model parameter from the first parameter to a second parameter according to the eleventh gradient and the seventh learning rate; The step of inputting the target amount of application data into the updated neural network model and correcting the model parameters of the neural network model according to the second output result of the updated neural network model and the second parameter comprises: Inputting a target amount of application data into the updated backbone network model to obtain a second output result output by the backbone network model, wherein the second output result is a fourth eigenvector; Constructing an eighth loss function of the updated backbone network model according to the second output result; Determine a twelfth gradient of the second parameter according to the eighth loss function; The model parameters are updated from the first parameters to third parameters according to the twelfth gradient, the eleventh gradient and the eighth learning rate.

12. The neural network model adjustment method according to claim 1, It is characterized in that The target number of sample data is input into the neural network model through a first data loader; The target amount of application data is input into the updated neural network model through a second data loader.

13. A neural network model adjustment device, It is characterized in that include: An updating module, used for inputting a target number of sample data into a neural network model, and updating a model parameter of the neural network model according to a first output result of the neural network model, wherein the model parameter before the updating is a first parameter and the model parameter after the updating is a second parameter; A correction module is used to input a target amount of application data into an updated neural network model, and to correct the model parameters of the neural network model according to a second output result of the updated neural network model and the second parameter, wherein the model parameter before correction is a first parameter and the model parameter after correction is a third parameter, the corrected model parameter is the first parameter before the neural network model is updated, the third parameter is obtained by correcting the first parameter according to the gradient of the second parameter, the gradient of the first parameter and the learning rate, and the gradient of the second parameter is determined by a loss function calculated according to the second output result.

14. A neural network model adjustment device, It is characterized in that include: One or more processors A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the neural network model adjustment method as described in any one of claims 1-12.

15. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the neural network model adjustment method as described in any one of claims 1-12 is implemented.

Citation Information

Patent Citations

  • Method and device for improving the prediction performance of a depth learning network, and a storage medium

    CN109376615A

  • Object recognition method and device

    CN110298262A

  • Machine learning method and related device

    CN111062495A

  • Construction method and device for genetic disease face recognition model

    CN111368672A

  • Object detector construction method and system and object detection method and system

    CN111460958A