Multi-task model migration training method and device, computer device and storage medium

By acquiring and utilizing the parameter gradient information of multi-task training samples for parameter adjustment, the performance loss problem of pre-trained models when the amount of downstream task data is small is solved, and higher detection accuracy and adjustment accuracy are achieved.

CN114781490BActive Publication Date: 2026-03-17BEIJING SENSETIME TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-24
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

When transferring pre-trained models to downstream tasks, especially when the amount of data in the downstream tasks is small, it is difficult to extract matching information from them, resulting in performance loss. Furthermore, the reliance on upstream training data affects the accuracy of the adjustment.

Method used

By acquiring training samples from multiple pre-defined tasks, the parameter gradient information of the initial network model is determined, and the parameters are adjusted based on this information. The parameters are adjusted by combining the gradient and adjustment information, avoiding dependence on upstream training samples and improving the adjustment accuracy.

Benefits of technology

It effectively improves the accuracy of parameter adjustment, reduces performance loss, overcomes the problem of insufficient adjustment caused by a small number of training samples, and achieves higher detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114781490B_ABST
    Figure CN114781490B_ABST
Patent Text Reader

Abstract

The present disclosure provides a multi-task model migration training method and device, computer equipment and a storage medium, the method comprising: obtaining an initial network model trained by using training samples of a plurality of preset tasks; wherein the plurality of preset tasks include a target task; inputting a plurality of target training samples corresponding to the target task into the initial network model, processing each target training sample through the initial network model, and determining parameter gradient information corresponding to each target training sample of the initial network model; determining parameter adjustment information corresponding to the initial network model based on the parameter gradient information corresponding to each target training sample; and adjusting initial parameters in the initial network model based on the parameter gradient information and the parameter adjustment information to obtain target parameters and a target network model including the target parameters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer vision technology, and more specifically, to a multi-task model transfer training method, apparatus, computer device, and storage medium. Background Technology

[0002] The standard procedure in computer vision technology is to pre-train a model using a large amount of training data from various tasks, and then transfer it to specific downstream tasks. When transferring the pre-trained model to downstream tasks, linear probing or fine-tuning is often used to further adjust and train the model. However, when the amount of data in the downstream tasks is small, these methods can lead to a significant performance loss in the adjusted target model. This is because the pre-trained model contains a large amount of information from different task types, while the downstream task only needs a portion of that information. When the amount of data in the downstream task is small, it is difficult to extract or adjust the pre-trained model to obtain information that matches the downstream task, resulting in a significant performance loss in the adjusted target model. Furthermore, because the adjustment process utilizes training data from upstream tasks of the same type, it creates a dependency on the upstream training data. Summary of the Invention

[0003] This disclosure provides at least one multi-task model transfer training method, apparatus, computer device, and storage medium.

[0004] In a first aspect, embodiments of this disclosure provide a multi-task model transfer training method, including:

[0005] Obtain an initial network model trained using training samples from multiple preset tasks; wherein, the multiple preset tasks include a target task;

[0006] Multiple target training samples corresponding to the target task are input into the initial network model. The initial network model processes each target training sample to determine the parameter gradient information of the initial network model corresponding to each target training sample.

[0007] Based on the parameter gradient information corresponding to each target training sample, the parameter adjustment information corresponding to the initial network model is determined; wherein, the parameter adjustment information is information used to adjust the parameter gradient information;

[0008] Based on the parameter gradient information and the parameter adjustment information, the initial parameters in the initial network model are adjusted to obtain the target parameters, and a target network model including the target parameters.

[0009] In this regard, parameter gradient information can characterize the pattern of parameter changes. By utilizing the parameter gradient information corresponding to each target training sample, parameter adjustment information can be determined relatively accurately. This parameter adjustment information is used to adjust the gradient of parameter changes. Subsequently, by combining the parameter gradient information and the parameter adjustment information, the initial parameters are adjusted together, which can effectively improve the accuracy of parameter adjustment, avoid performance loss during task migration, and overcome the shortcomings of insufficient parameter adjustment accuracy caused by the small number of training samples in existing technologies. In addition, using this technical solution for parameter adjustment can avoid using training samples from upstream tasks of the same type for parameter adjustment, thus overcoming the problem of dependence on the aforementioned training samples.

[0010] In one optional implementation, the parameter gradient information includes parameter gradient sub-information corresponding to each of the multiple initial parameters in the initial network model;

[0011] The step of determining the parameter adjustment information corresponding to the initial network model based on the parameter gradient information corresponding to each target training sample includes:

[0012] For each initial parameter in the initial network model, based on the parameter gradient sub-information corresponding to each target training sample, the target parameter gradient sub-information corresponding to the initial parameter is determined;

[0013] Based on the target parameter gradient sub-information corresponding to each of the multiple initial parameters, the parameter adjustment information corresponding to the initial network model is determined.

[0014] In this implementation, by comprehensively processing the parameter gradient sub-information of each target training sample, the target parameter gradient sub-information that characterizes the parameter change law of the corresponding initial parameter can be determined more accurately. Then, by using the target parameter gradient sub-information, the parameter adjustment information that adjusts the parameter change gradient can be determined more accurately.

[0015] In one optional implementation, determining the target parameter gradient sub-information corresponding to the initial parameters based on the parameter gradient sub-information corresponding to each target training sample includes:

[0016] The gradient sub-information of the parameters corresponding to the initial parameters for each target training sample is accumulated to obtain the target parameter gradient sub-information in the initial parameters.

[0017] In this embodiment, the gradient sub-information of the parameters corresponding to a certain initial parameter for each target training sample is accumulated, and the resulting target parameter gradient sub-information can more accurately characterize the change pattern of the initial parameter.

[0018] In one optional implementation, the parameter adjustment information includes parameter adjustment sub-information corresponding to each initial parameter;

[0019] The step of determining the parameter adjustment information corresponding to the initial network model based on the target parameter gradient sub-information corresponding to each of the multiple initial parameters includes:

[0020] For each initial parameter, perform at least one iteration of the following process until a preset condition is met, and then stop the iteration to obtain the parameter adjustment sub-information corresponding to the initial parameter:

[0021] Based on the target parameter gradient sub-information corresponding to the initial parameter and the parameter adjustment sub-information corresponding to the initial parameter determined in the previous iteration, the initial parameter is adjusted to obtain the adjusted value of the initial parameter corresponding to the current iteration;

[0022] Based on the adjusted value and at least a portion of the target training samples, the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration is adjusted to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0023] In this implementation, by using the target parameter gradient sub-information that characterizes the change law of a certain initial parameter, and the parameter adjustment sub-information that the initial parameter was determined in the previous iteration, the predicted value of the initial parameter in the current iteration, i.e. the aforementioned adjustment value, can be determined more accurately. Then, by using the adjustment value and the target training sample, the parameter adjustment sub-information determined in the previous iteration can be adjusted more accurately.

[0024] In one optional implementation, adjusting the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration based on the adjustment value and at least a portion of the target training samples to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration includes:

[0025] Based on the adjustment value and at least a portion of the target training samples, generate the first loss information corresponding to the current iteration;

[0026] Based on the first loss information, the parameter adjustment sub-information is determined to correspond to the gradient information of the current iteration;

[0027] Based on the gradient information, the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration is adjusted to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0028] In this embodiment, by using the predicted value of the initial parameter in the current iteration and the target training sample, the prediction loss of the corresponding network model, i.e., the first loss information mentioned above, can be determined relatively accurately. The first loss information can characterize the change law of the parameter adjustment sub-information, so the first loss information can be used to accurately determine the gradient information mentioned above. Then, by using the determined gradient information, the parameter adjustment sub-information determined in the previous iteration is adjusted, and the parameter adjustment sub-information in the current iteration can be determined relatively accurately.

[0029] In one optional implementation, adjusting the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration based on the gradient information to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration includes:

[0030] Obtain the adjustment weight information corresponding to the gradient information;

[0031] Based on the adjusted weight information and the gradient information, the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration is adjusted to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0032] In this embodiment, by combining gradient information that characterizes the change pattern of parameter adjustment sub-information and adjustment weight information that characterizes the degree of effect of gradient information in the adjustment process of parameter adjustment sub-information, the parameter adjustment sub-information is adjusted, which can effectively improve the adjustment accuracy of parameter adjustment sub-information.

[0033] In one optional implementation, adjusting the initial parameters in the initial network model based on the parameter gradient information and the parameter adjustment information to obtain target parameters, and obtaining a target network model including the target parameters, includes:

[0034] Based on the parameter gradient information and the parameter adjustment information, the target adjustment information is determined;

[0035] Based on the target adjustment information and initial parameters, the target parameters are determined;

[0036] Based on the target parameters, the target network model is determined.

[0037] In this implementation, by combining parameter gradient information and parameter adjustment information, the adjustment amount of the initial parameters, i.e. the aforementioned target adjustment information, can be determined more accurately. Then, by using this target adjustment information to adjust the initial parameters, the adjustment accuracy can be improved, and more accurate target parameters can be obtained. At the same time, a target network model with higher detection accuracy can also be obtained.

[0038] In one optional implementation, the step of inputting multiple target training samples corresponding to the target task into an initial network model, and processing each target training sample through the initial network model to determine the parameter gradient information of the initial network model corresponding to each target training sample, includes:

[0039] For each target training sample, the target training sample is forward propagated in the initial network model to obtain the second loss information corresponding to the initial network model;

[0040] The target training sample is backpropagated in the initial network model to determine the parameter gradient information of the initial network model corresponding to the target training sample based on the second loss information.

[0041] In this embodiment, backpropagation can accurately determine the parameter gradient information that characterizes the variation law of the parameter.

[0042] Secondly, embodiments of this disclosure also provide a multi-task model transfer training apparatus, comprising:

[0043] An acquisition module is used to acquire an initial network model trained using training samples from multiple preset tasks; wherein, the multiple preset tasks include a target task.

[0044] The gradient processing module is used to input multiple target training samples corresponding to the target task into the initial network model, and process each target training sample through the initial network model to determine the parameter gradient information of the initial network model corresponding to each target training sample.

[0045] The parameter adjustment module is used to determine the parameter adjustment information corresponding to the initial network model based on the parameter gradient information corresponding to each target training sample.

[0046] The parameter update module is used to adjust the initial parameters in the initial network model based on the parameter gradient information and the parameter adjustment information to obtain the target parameters and the target network model including the target parameters.

[0047] In one optional implementation, the parameter gradient information includes parameter gradient sub-information corresponding to each of the multiple initial parameters in the initial network model;

[0048] The parameter adjustment module, when determining the parameter adjustment information corresponding to the initial network model based on the parameter gradient information corresponding to each target training sample, is used for:

[0049] For each initial parameter in the initial network model, based on the parameter gradient sub-information corresponding to each target training sample, the target parameter gradient sub-information corresponding to the initial parameter is determined;

[0050] Based on the target parameter gradient sub-information corresponding to each of the multiple initial parameters, the parameter adjustment information corresponding to the initial network model is determined.

[0051] In an optional implementation, the parameter adjustment module, when determining the target parameter gradient sub-information corresponding to the initial parameters based on the parameter gradient sub-information corresponding to each target training sample, is configured to:

[0052] The gradient sub-information of the parameters corresponding to the initial parameters for each target training sample is accumulated to obtain the target parameter gradient sub-information in the initial parameters.

[0053] In one optional implementation, the parameter adjustment information includes parameter adjustment sub-information corresponding to each initial parameter;

[0054] The parameter adjustment module, when determining the parameter adjustment information corresponding to the initial network model based on the target parameter gradient sub-information corresponding to each of the multiple initial parameters, is used for:

[0055] For each initial parameter, perform at least one iteration of the following process until a preset condition is met, and then stop the iteration to obtain the parameter adjustment sub-information corresponding to the initial parameter:

[0056] Based on the target parameter gradient sub-information corresponding to the initial parameter and the parameter adjustment sub-information corresponding to the initial parameter determined in the previous iteration, the initial parameter is adjusted to obtain the adjusted value of the initial parameter corresponding to the current iteration;

[0057] Based on the adjusted value and at least a portion of the target training samples, the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration is adjusted to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0058] In an optional implementation, when the parameter adjustment module adjusts the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration based on the adjustment value and at least a portion of the target training samples to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration, it is used to:

[0059] Based on the adjustment value and at least a portion of the target training samples, generate the first loss information corresponding to the current iteration;

[0060] Based on the first loss information, the parameter adjustment sub-information is determined to correspond to the gradient information of the current iteration;

[0061] Based on the gradient information, the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration is adjusted to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0062] In an optional implementation, when the parameter adjustment module adjusts the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration based on the gradient information to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration, it is used to:

[0063] Obtain the adjustment weight information corresponding to the gradient information;

[0064] Based on the adjusted weight information and the gradient information, the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration is adjusted to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0065] In an optional implementation, the parameter update module, when adjusting the initial parameters in the initial network model based on the parameter gradient information and the parameter adjustment information to obtain target parameters and a target network model including the target parameters, is configured to:

[0066] Based on the parameter gradient information and the parameter adjustment information, the target adjustment information is determined;

[0067] Based on the target adjustment information and initial parameters, the target parameters are determined;

[0068] Based on the target parameters, the target network model is determined.

[0069] In an optional implementation, the gradient processing module, when inputting multiple target training samples corresponding to the target task into the initial network model, and processing each target training sample through the initial network model to determine the parameter gradient information of the initial network model corresponding to each target training sample, is used to:

[0070] For each target training sample, the target training sample is forward propagated in the initial network model to obtain the second loss information corresponding to the initial network model;

[0071] The target training sample is backpropagated in the initial network model to determine the parameter gradient information of the initial network model corresponding to the target training sample based on the second loss information.

[0072] Thirdly, embodiments of this disclosure also provide a computer device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the steps of the first aspect above, or any possible implementation of the first aspect, are performed.

[0073] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the first aspect or any possible implementation of the first aspect.

[0074] For a description of the effects of the aforementioned multi-task model transfer training device, computer equipment, and storage medium, please refer to the description of the multi-task model transfer training method above, which will not be repeated here.

[0075] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0076] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.

[0077] Figure 1 A flowchart of a multi-task model transfer training method provided in an embodiment of this disclosure is shown;

[0078] Figure 2 A flowchart is shown, illustrating a specific method for determining parameter adjustment information corresponding to the initial network model provided by an embodiment of this disclosure.

[0079] Figure 3 A flowchart is shown, illustrating a specific method for determining parameter adjustment information corresponding to the initial network model provided by an embodiment of this disclosure.

[0080] Figure 4 A flowchart illustrating a specific method for obtaining parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration, provided by an embodiment of this disclosure;

[0081] Figure 5 A schematic diagram of a multi-task model transfer training apparatus provided in an embodiment of this disclosure is shown;

[0082] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of this disclosure is shown. Detailed Implementation

[0083] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0084] Research has found that when transferring pre-trained models to downstream tasks, linear probing or fine-tuning is often used to further adjust and train the pre-trained model. However, when the amount of data in the downstream task is small, these methods lead to a significant performance loss in the adjusted target model. This is because the pre-trained model contains a large amount of information from different task types, while the downstream task only needs a portion of that information. When the amount of data in the downstream task is small, it is difficult to extract or adjust information from the pre-trained model to match the downstream task, resulting in a significant performance loss in the adjusted target model. Furthermore, because the adjustment process utilizes training data from upstream tasks of the same type, it creates a dependency on upstream training data.

[0085] Based on the above research, this disclosure provides a multi-task model transfer training method, apparatus, computer device, and storage medium. The disclosure first obtains an initial network model trained using training samples from multiple preset tasks; wherein the multiple preset tasks include a target task; then, multiple target training samples corresponding to the target task are input into the initial network model, and the initial network model processes each target training sample to determine the parameter gradient information of the initial network model corresponding to each target training sample; then, based on the parameter gradient information corresponding to each target training sample, parameter adjustment information corresponding to the initial network model is determined; finally, based on the parameter gradient information and the parameter adjustment information, the initial parameters in the initial network model are adjusted to obtain target parameters, and a target network model including the target parameters. Among these, parameter gradient information can characterize the pattern of parameter changes. By utilizing the parameter gradient information corresponding to each target training sample, parameter adjustment information can be determined relatively accurately. This parameter adjustment information is used to adjust the gradient of parameter changes. Subsequently, by combining the parameter gradient information and the parameter adjustment information, the initial parameters are adjusted together, which can effectively improve the accuracy of parameter adjustment, avoid performance loss during task migration, and overcome the shortcomings of insufficient parameter adjustment accuracy caused by the small number of training samples in existing technologies. In addition, using this technical solution for parameter adjustment can avoid using training samples from upstream tasks of the same type for parameter adjustment, thus overcoming the problem of dependence on the aforementioned training samples.

[0086] The shortcomings of the above solutions are the result of the inventor's practical experience and careful research. Therefore, the discovery process of the above problems and the solutions proposed in this disclosure below should be considered as the inventor's contribution to this disclosure.

[0087] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0088] To facilitate understanding of this embodiment, a detailed description of the multi-task model transfer training method disclosed in this disclosure is provided first. The execution entity of the multi-task model transfer training method provided in this disclosure is generally a computer device with certain computing capabilities. This computer device may include, for example, a terminal device, a server, or other processing devices. The terminal device may be a user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. In some possible implementations, this multi-task model transfer training method can be implemented by the processor calling computer-readable instructions stored in memory.

[0089] The following describes a multi-task model transfer training method provided in this disclosure, taking the terminal device as the execution subject as an example.

[0090] See Figure 1 The diagram shows a flowchart of a multi-task model transfer training method provided in an embodiment of this disclosure. The method includes steps S101 to S104, wherein:

[0091] S101: Obtain an initial network model trained using training samples from multiple preset tasks; wherein, the multiple preset tasks include a target task;

[0092] S102: Input multiple target training samples corresponding to the target task into the initial network model, process each target training sample through the initial network model, and determine the parameter gradient information of the initial network model corresponding to each target training sample respectively;

[0093] S103: Based on the parameter gradient information corresponding to each target training sample, determine the parameter adjustment information corresponding to the initial network model;

[0094] Wherein, the parameter adjustment information is information used to adjust the parameter gradient information;

[0095] S104: Based on the parameter gradient information and the parameter adjustment information, the initial parameters in the initial network model are adjusted to obtain the target parameters and the target network model including the target parameters.

[0096] The following provides a detailed explanation of S101 to S104.

[0097] For S101, in this step, multiple preset tasks can include different types of tasks, and the training samples can be images. Here, we take image recognition as an example. The preset tasks can be image classification, authenticity recognition, object recognition, etc. The target objects can include people, animals, buildings, etc., and the target task can be image classification.

[0098] The initial network model is trained using training samples from multiple pre-defined tasks, such as training samples for image classification, real / fake identification, and object recognition.

[0099] The initial network model described above has a certain detection accuracy for each preset task, but the detection accuracy is relatively low for a single preset task.

[0100] For S102, the parameter gradient information of the initial network model corresponding to each target training sample can be determined using the following steps:

[0101] For each target training sample, the target training sample is forward-propagated in the initial network model to obtain the second loss information corresponding to the initial network model; the target training sample is then backward-propagated in the initial network model to determine the parameter gradient information of the initial network model corresponding to the target training sample based on the second loss information. This parameter gradient information includes the parameter gradient sub-information of each of the multiple initial parameters in the initial network model corresponding to the target training sample. Backpropagation allows for the accurate determination of parameter gradient information characterizing the parameter variation patterns.

[0102] The initial network model includes multiple parameters, primarily weights. After backpropagation of each target training sample through the initial network model, the gradient of each target training sample corresponding to each initial weight can be obtained. The gradients corresponding to each initial weight are the aforementioned parameter gradient sub-information. The aforementioned target training samples are the training samples corresponding to the target task. They can be the training samples used to train the initial network model or other training samples corresponding to the target task; this disclosure does not limit their use.

[0103] The aforementioned second loss information includes the loss function of the target training sample in the initial network model.

[0104] Regarding S103, in this step, based on the parameter gradient information corresponding to each target training sample, the parameter adjustment information corresponding to the initial network model is determined. Specifically, see... Figure 2 As shown, it includes:

[0105] S201: For each initial parameter in the initial network model, based on the parameter gradient sub-information corresponding to each target training sample, determine the target parameter gradient sub-information of the initial parameter.

[0106] Here, the gradient sub-information of the parameters corresponding to each target training sample and the initial parameter (i.e., the initial weights mentioned above) can be accumulated to obtain the target parameter gradient sub-information corresponding to the initial parameter. By accumulating the gradient sub-information of the parameters corresponding to each target training sample and a certain initial parameter, the obtained target parameter gradient sub-information can accurately represent the variation law of the initial parameter.

[0107] The method of accumulation is not unique. For example, the parameter gradient sub-information corresponding to the initial parameters for each target training sample can be calculated by averaging.

[0108] S202: Based on the target parameter gradient sub-information corresponding to each of the multiple initial parameters, determine the parameter adjustment information corresponding to the initial network model.

[0109] By comprehensively processing the parameter gradient sub-information of each target training sample, the target parameter gradient sub-information that represents the parameter change law of the corresponding initial parameter can be determined more accurately. Then, using the target parameter gradient sub-information, the parameter adjustment information that adjusts the parameter change gradient can be determined more accurately.

[0110] The parameter adjustment information in S202 includes the parameter adjustment sub-information for each initial parameter, i.e., the initial weights mentioned above. See also... Figure 3 As shown, specifically, this disclosure provides a method for determining parameter adjustment information corresponding to the initial network model, including:

[0111] For each initial parameter, perform at least one iteration of the following process until a preset condition is met, and then stop the iteration to obtain the parameter adjustment sub-information corresponding to the initial parameter:

[0112] S301: Based on the target parameter gradient sub-information corresponding to the initial parameter and the parameter adjustment sub-information corresponding to the initial parameter determined in the previous iteration, the initial parameter is adjusted to obtain the adjusted value of the initial parameter corresponding to the current iteration;

[0113] S302: Based on the adjustment value and at least a portion of the target training samples, adjust the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0114] In S301, let w be the initial weights of the pre-trained model, i.e., the initial parameters; alpha is the parameter adjustment sub-information corresponding to the initial parameters; grad task The gradient sub-information is the target parameter gradient. The adjustment value is obtained by subtracting the product of the initial parameter adjustment sub-information and the target parameter gradient sub-information from the initial parameter. For example, the adjustment value w' is calculated according to the following formula:

[0115] w′=w-alpha*grad task

[0116] By using the gradient sub-information of the target parameter that characterizes the change pattern of a certain initial parameter, and the parameter adjustment sub-information determined in the previous iteration, the predicted value of the initial parameter in the current iteration, i.e., the aforementioned adjustment value, can be determined relatively accurately. Then, using the adjustment value and the target training samples, the parameter adjustment sub-information determined in the previous iteration can be adjusted relatively accurately.

[0117] In summary, the parameter gradient information includes the parameter gradient sub-information corresponding to each of the multiple initial parameters in the initial network model; the parameter adjustment information includes the parameter adjustment sub-information corresponding to each initial parameter.

[0118] The step of determining the parameter adjustment information corresponding to the initial network model based on the parameter gradient information corresponding to each target training sample includes:

[0119] For each initial parameter in the initial network model, based on the parameter gradient sub-information corresponding to each target training sample, the target parameter gradient sub-information corresponding to the initial parameter is determined; for each initial parameter, at least one iteration is performed until a preset condition is met to stop the iteration, thereby obtaining the parameter adjustment sub-information corresponding to the initial parameter:

[0120] Based on the target parameter gradient sub-information corresponding to the initial parameter and the parameter adjustment sub-information corresponding to the initial parameter determined in the previous iteration, the initial parameter is adjusted to obtain the adjusted value of the initial parameter corresponding to the current iteration; based on the adjusted value and at least a portion of the target training samples, the parameter adjustment sub-information corresponding to the initial parameter determined in the previous iteration is adjusted to obtain the parameter adjustment sub-information corresponding to the initial parameter determined in the current iteration.

[0121] See Figure 4 As shown, after obtaining the above adjustment value, the following steps can be used to adjust the parameter adjustment sub-information corresponding to the initial parameter determined in the previous iteration based on the adjustment value and at least a portion of the target training samples, to obtain the parameter adjustment sub-information corresponding to the initial parameter determined in the current iteration:

[0122] S401: Based on the adjustment value and at least a portion of the target training samples, generate the first loss information corresponding to the current iteration.

[0123] Here, the first loss information may include the loss function corresponding to the current iteration. Specifically, at least a portion of the target training samples are input into a network model that uses the aforementioned adjusted values ​​as weights. After processing, the loss function is determined, as shown in the following formula:

[0124] Loss=loss_func(N(x;w′),gt)

[0125] In the formula, N is the network model that uses the above adjustment value as weight, loss_func is the loss function, x is the target training sample, and gt is the label of the target training sample.

[0126] S402: Based on the first loss information, determine the gradient information corresponding to the parameter adjustment sub-information in the current iteration.

[0127] Here, we can calculate the partial derivative of the first loss information with respect to the parameter adjustment information corresponding to the initial parameters, and obtain the gradient information of the parameter adjustment information corresponding to the current iteration. For example, we can use the following formula to determine the gradient information t of the parameter adjustment information corresponding to the current iteration:

[0128]

[0129] S403: Based on the gradient information, adjust the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0130] By using the predicted values ​​of the initial parameters in the current iteration and the target training samples, the predicted loss of the corresponding network model can be determined relatively accurately, i.e., the first loss information mentioned above. The first loss information can characterize the changing pattern of the parameter adjustment sub-information, so the first loss information can be used to accurately determine the gradient information mentioned above. Then, by using the determined gradient information, the parameter adjustment sub-information determined in the previous iteration is adjusted, and the parameter adjustment sub-information in the current iteration can be determined relatively accurately.

[0131] In S403, it is necessary to first obtain the adjustment weight information corresponding to the gradient information, which refers to the learning rate of the current iteration; then, based on the adjustment weight information and the gradient information, the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration is adjusted to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0132] For example, the product of the adjustment weight information and the gradient information is subtracted from the parameter adjustment sub-information, and the resulting value is used as the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0133] The parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration can be adjusted according to the following formula:

[0134]

[0135] Wherein, alpha' is the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration, and lr is the aforementioned adjustment weight information, i.e., the learning rate of the current iteration. The value of lr is a fixed value given by the user.

[0136] After multiple iterations, the optimal value of alpha is obtained when the change in the parameter adjustment sub-information is less than a preset value or the number of iterations is greater than a preset value. best alpha best This indicates the final value of the parameter adjustment sub-information.

[0137] By combining gradient information, which characterizes the variation pattern of parameter adjustment sub-information, and adjustment weight information, which characterizes the degree of influence of gradient information in the adjustment process of parameter adjustment sub-information, the adjustment accuracy of parameter adjustment sub-information can be effectively improved.

[0138] alpha best This indicates the final value of the parameter adjustment sub-information, thus determining the parameter adjustment information. Next, for S104, based on the parameter gradient information and the parameter adjustment information, the target adjustment information is determined, for example, by multiplying the parameter gradient information and the parameter adjustment information. Then, based on the target adjustment information and the initial parameters, the target parameters are determined, for example, by subtracting the target adjustment information from the initial parameters. The target parameters are the adjusted weights w″ corresponding to the target training sample, i.e., the final weights of the network model.

[0139] In this step, w″ can be determined using the following formula.

[0140] w″=w-alpha best *grad task

[0141] Based on the updated weight values, the target network model is obtained, which is the target network model for the target task.

[0142] By combining parameter gradient information and parameter adjustment information, the adjustment amount of the initial parameters can be determined more accurately, i.e., the aforementioned target adjustment information. Then, by using this target adjustment information to adjust the initial parameters, the adjustment accuracy can be improved, and more accurate target parameters can be obtained. At the same time, a target network model with higher detection accuracy can also be obtained.

[0143] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0144] Based on the same inventive concept, this disclosure also provides a multi-task model transfer training device corresponding to the multi-task model transfer training method. Since the principle of the device in this disclosure for solving the problem is similar to the multi-task model transfer training method described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0145] Reference Figure 5 The diagram shown is an architectural schematic of a multi-task model transfer training device provided in an embodiment of this disclosure. The device includes: an acquisition module 501, a gradient processing module 502, a parameter adjustment module 503, and a parameter update module 504; wherein,

[0146] The acquisition module 501 is used to acquire an initial network model trained using training samples from multiple preset tasks; wherein, the multiple preset tasks include a target task.

[0147] The gradient processing module 502 is used to input multiple target training samples corresponding to the target task into the initial network model, and process each target training sample through the initial network model to determine the parameter gradient information of the initial network model corresponding to each target training sample.

[0148] The parameter adjustment module 503 is used to determine the parameter adjustment information corresponding to the initial network model based on the parameter gradient information corresponding to each target training sample.

[0149] The parameter update module 504 is used to adjust the initial parameters in the initial network model based on the parameter gradient information and the parameter adjustment information to obtain the target parameters and the target network model including the target parameters.

[0150] In one optional implementation, the parameter gradient information includes parameter gradient sub-information corresponding to each of the multiple initial parameters in the initial network model; the parameter adjustment information includes parameter adjustment sub-information corresponding to each initial parameter.

[0151] The parameter adjustment module 503, when determining the parameter adjustment information corresponding to the initial network model based on the parameter gradient information corresponding to each target training sample, is used for:

[0152] For each initial parameter in the initial network model, based on the parameter gradient sub-information corresponding to each target training sample, the target parameter gradient sub-information corresponding to the initial parameter is determined;

[0153] For each initial parameter, perform at least one iteration of the following process until a preset condition is met, and then stop the iteration to obtain the parameter adjustment sub-information corresponding to the initial parameter:

[0154] Based on the target parameter gradient sub-information corresponding to the initial parameter and the parameter adjustment sub-information corresponding to the initial parameter determined in the previous iteration, the initial parameter is adjusted to obtain the adjusted value of the initial parameter corresponding to the current iteration;

[0155] Based on the adjusted value and at least a portion of the target training samples, the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration is adjusted to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0156] In an optional implementation, the parameter adjustment module 503, when determining the target parameter gradient sub-information corresponding to the initial parameters based on the parameter gradient sub-information corresponding to each target training sample, is configured to:

[0157] The gradient sub-information of the parameters corresponding to the initial parameters for each target training sample is accumulated to obtain the target parameter gradient sub-information in the initial parameters.

[0158] In an optional implementation, when the parameter adjustment module 503 adjusts the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration based on the adjustment value and at least a portion of the target training samples to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration, it is used to:

[0159] Based on the adjustment value and at least a portion of the target training samples, generate the first loss information corresponding to the current iteration;

[0160] Based on the first loss information, the parameter adjustment sub-information is determined to correspond to the gradient information of the current iteration;

[0161] Based on the gradient information, the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration is adjusted to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0162] In an optional implementation, the parameter adjustment module 503, when adjusting the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration based on the gradient information to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration, is used to:

[0163] Obtain the adjustment weight information corresponding to the gradient information;

[0164] Based on the adjusted weight information and the gradient information, the parameter adjustment sub-information corresponding to the initial parameters determined in the previous iteration is adjusted to obtain the parameter adjustment sub-information corresponding to the initial parameters determined in the current iteration.

[0165] In an optional implementation, the parameter update module 504, when adjusting the initial parameters in the initial network model based on the parameter gradient information and the parameter adjustment information to obtain target parameters and a target network model including the target parameters, is configured to:

[0166] Based on the parameter gradient information and the parameter adjustment information, the target adjustment information is determined;

[0167] Based on the target adjustment information and initial parameters, the target parameters are determined;

[0168] Based on the target parameters, the target network model is determined.

[0169] In an optional implementation, the gradient processing module 502, when inputting multiple target training samples corresponding to the target task into the initial network model, and processing each target training sample through the initial network model to determine the parameter gradient information of the initial network model corresponding to each target training sample, is used to:

[0170] For each target training sample, the target training sample is forward propagated in the initial network model to obtain the second loss information corresponding to the initial network model;

[0171] The target training sample is backpropagated in the initial network model to determine the parameter gradient information of the initial network model corresponding to the target training sample based on the second loss information.

[0172] This embodiment of the disclosure obtains an initial network model trained using training samples from multiple preset tasks, enabling the transfer process to be independent of upstream data and reducing the computational load, thereby minimizing unnecessary overhead. By adjusting the initial parameters in the initial network model based on the parameter gradient information and parameter adjustment information corresponding to each target training sample, the accuracy of the transfer can be improved, thus reducing performance loss during the transfer process.

[0173] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.

[0174] Based on the same technical concept, this disclosure also provides a computer device. (See also...) Figure 5 The diagram shows the structure of a computer device 600 provided in this embodiment of the present disclosure, including a processor 601, a memory 602, and a bus 603. The memory 602 stores execution instructions and includes main memory 6021 and external memory 6022. The main memory 6021, also called internal memory, is used to temporarily store computational data in the processor 601 and data exchanged with external memory 6022 such as a hard disk. The processor 601 exchanges data with the external memory 6022 through the main memory 6021. When the computer device 600 is running, the processor 601 and the memory 602 communicate through the bus 603, causing the processor 601 to execute the following instructions:

[0175] Obtain an initial network model trained using training samples from multiple preset tasks; wherein, the multiple preset tasks include a target task;

[0176] Multiple target training samples corresponding to the target task are input into the initial network model. The initial network model processes each target training sample to determine the parameter gradient information of the initial network model corresponding to each target training sample.

[0177] Based on the parameter gradient information corresponding to each target training sample, determine the parameter adjustment information corresponding to the initial network model;

[0178] Based on the parameter gradient information and the parameter adjustment information, the initial parameters in the initial network model are adjusted to obtain the target parameters, and a target network model including the target parameters.

[0179] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the multi-task model transfer training method described in the above-described method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0180] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of the multi-task model transfer training method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.

[0181] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0182] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0183] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0184] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0185] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0186] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A method for multi-task model transfer training, characterized in that, The method comprises: obtaining an initial network model trained by using a plurality of preset training samples; wherein the plurality of preset tasks include a target task; inputting a plurality of target training samples corresponding to the target task into the initial network model, processing each target training sample by using the initial network model, and determining parameter gradient information corresponding to each target training sample of the initial network model; determining parameter adjustment information corresponding to the initial network model based on the parameter gradient information corresponding to each target training sample; wherein the parameter adjustment information is information used for adjusting the parameter gradient information; adjusting initial parameters in the initial network model based on the parameter gradient information and the parameter adjustment information, obtaining target parameters, and obtaining a target network model comprising the target parameters; wherein the training samples include pictures, and the plurality of preset tasks include image recognition.

2. The method of claim 1, wherein, The parameter gradient information comprises parameter gradient sub-information corresponding to each initial parameter in the plurality of initial parameters in the initial network model; and the parameter adjustment information comprises parameter adjustment sub-information corresponding to each initial parameter. The method comprises: for each initial parameter in the plurality of initial parameters in the initial network model, determining target parameter gradient sub-information corresponding to the initial parameter based on the parameter gradient sub-information corresponding to the initial parameter and each target training sample; for each initial parameter, performing at least one iteration until a preset condition is met to stop iteration, and obtaining parameter adjustment sub-information corresponding to the initial parameter: adjusting the initial parameter based on the target parameter gradient sub-information corresponding to the initial parameter and the parameter adjustment sub-information corresponding to the initial parameter determined in the last iteration, to obtain an adjustment value corresponding to the initial parameter in the current iteration; adjusting the parameter adjustment sub-information corresponding to the initial parameter determined in the last iteration based on the adjustment value and at least part of the target training samples, to obtain the parameter adjustment sub-information corresponding to the initial parameter determined in the current iteration.

3. The method of claim 2, wherein, The method comprises: accumulating the parameter gradient sub-information corresponding to the initial parameter and each target training sample to obtain the target parameter gradient sub-information corresponding to the initial parameter.

4. The method of claim 2, wherein, The method comprises: generating first loss information corresponding to the current iteration based on the adjustment value and at least part of the target training samples; determining gradient information corresponding to the parameter adjustment sub-information in the current iteration based on the first loss information; and determining gradient information corresponding to the parameter adjustment sub-information in the current iteration based on the first loss information. Adjust the parameter adjustment sub-information corresponding to the initial parameter determined in the last iteration based on the gradient information, to obtain the parameter adjustment sub-information corresponding to the initial parameter determined in the current iteration.

5. The method of claim 4, wherein, The adjusting the parameter adjustment sub-information corresponding to the initial parameter determined in the last iteration based on the gradient information, to obtain the parameter adjustment sub-information corresponding to the initial parameter determined in the current iteration, comprises: Obtaining adjustment weight information corresponding to the gradient information; Adjusting the parameter adjustment sub-information corresponding to the initial parameter determined in the last iteration based on the adjustment weight information and the gradient information, to obtain the parameter adjustment sub-information corresponding to the initial parameter determined in the current iteration.

6. The method according to any one of claims 1 to 5, characterized in that, The adjusting the initial parameter in the initial network model based on the parameter gradient information and the parameter adjustment information, to obtain the target parameter and the target network model comprising the target parameter, comprises: Determining target adjustment information based on the parameter gradient information and the parameter adjustment information; Determining the target parameter based on the target adjustment information and the initial parameter; Determining the target network model based on the target parameter.

7. The method of claim 1, wherein, The processing each target training sample through the initial network model, to determine the parameter gradient information corresponding to each target training sample by the initial network model, comprises: For each target training sample, performing forward propagation of the target training sample in the initial network model, to obtain second loss information corresponding to the initial network model; Performing backward propagation of the target training sample in the initial network model, to determine the parameter gradient information corresponding to the target training sample by the initial network model based on the second loss information.

8. A multi-task model migration training apparatus, characterized by comprising: Comprise: An acquisition module is configured to acquire an initial network model trained by using training samples of a plurality of preset tasks; wherein the plurality of preset tasks comprise a target task; A gradient processing module is configured to input a plurality of target training samples corresponding to the target task into the initial network model, process each target training sample through the initial network model, and determine parameter gradient information corresponding to each target training sample by the initial network model; A parameter adjustment module is configured to determine parameter adjustment information corresponding to the initial network model based on the parameter gradient information corresponding to each target training sample; A parameter updating module is configured to adjust initial parameters in the initial network model based on the parameter gradient information and the parameter adjustment information, to obtain target parameters and a target network model comprising the target parameters; wherein the training samples comprise pictures, and the plurality of preset tasks comprise image recognition.

9. A computer device, comprising: Comprise: A processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the computer device runs, the processor and the memory communicate through the bus, the machine readable instructions are executed by the processor to execute the steps of the multi-task model migration training method in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program performs the steps of the multi-task model migration training method according to any one of claims 1 to 7 when the computer program is run by the processor.

Citation Information

Patent Citations

  • Infrared image target detection method based on deep transfer learning and extreme learning machine

    CN110427875A

  • Parameter updating method and device for multi-task model and electronic equipment

    CN112559007A