CN112766493A - Training method and device for multitask neural network, electronic equipment and storage medium - Google Patents

Training method and device for multitask neural network, electronic equipment and storage medium Download PDF

Info

Publication number
CN112766493A
CN112766493A CN202110069465.2A CN202110069465A CN112766493A CN 112766493 A CN112766493 A CN 112766493A CN 202110069465 A CN202110069465 A CN 202110069465A CN 112766493 A CN112766493 A CN 112766493A
Authority
CN
China
Prior art keywords
task
target
gradient
parameter
neural network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110069465.2A
Other languages
Chinese (zh)
Other versions
CN112766493B (en
Inventor
游山
宋玉茹
楼赞
王飞
钱晨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Sensetime Technology Development Co Ltd
Original Assignee
Beijing Sensetime Technology Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sensetime Technology Development Co Ltd filed Critical Beijing Sensetime Technology Development Co Ltd
Priority to CN202110069465.2A priority Critical patent/CN112766493B/en
Publication of CN112766493A publication Critical patent/CN112766493A/en
Application granted granted Critical
Publication of CN112766493B publication Critical patent/CN112766493B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/483Multiproc
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Image Analysis (AREA)

Abstract

The present disclosure provides a training method, an apparatus, an electronic device and a storage medium for a multitask neural network, wherein the method comprises: acquiring a training sample, and processing the training sample through a multi-task neural network to obtain a prediction result of each task; determining a loss function of each task according to the prediction result of each task, and constructing a multi-objective gradient optimization model based on the gradient of the loss function and a preset variable to be optimized; solving the multi-target gradient optimization model to obtain a weight value of each task and a parameter value of a direction correction parameter of the gradient descending direction of the target task; and determining a sharing parameter of the multitask neural network based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task. According to the embodiment of the disclosure, the learning of the target task and the auxiliary task can be promoted by setting the preference for learning the target task and the auxiliary task, and the learning effect of the target task in the multitask neural network is improved.

Description

Training method and device for multitask neural network, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to a method and an apparatus for training a multitask neural network, an electronic device, and a storage medium.
Background
At present, the multi-task learning is a novel and practical problem in the field of deep learning, and aims to learn a plurality of related tasks simultaneously, so that the overall precision is promoted through interaction among the tasks, the learning efficiency of a network is improved, and the reasoning time is shortened. Existing frameworks include soft and hard parameter sharing. Under hard parameter (e.g., task sharing parameters) sharing, multiple tasks share the network fabric agent and collectively train the parameters of the part. Hard parameter sharing is more generalized than soft parameter (e.g., private parameters and models per task) sharing.
In existing multi-task learning, often some tasks are of interest to the trainer (i.e., target tasks), while the rest of the tasks (i.e., privileged tasks) are used to assist in training only some of the tasks of interest to the trainer. However, in general, in the conventional multi-task learning, which is a deep learning algorithm, a target task and an auxiliary task are usually trained together, but the importance of the target task and the importance of the auxiliary task are the same in the training process, so that the importance of the target task cannot be highlighted or the help provided by a privileged task for the target task cannot be utilized in the conventional training method, and the effect of the target task is poor.
Disclosure of Invention
The embodiment of the disclosure at least provides a training method and device for a multitask neural network, electronic equipment and a storage medium.
In a first aspect, an embodiment of the present disclosure provides a method for training a multitask neural network, including: acquiring a training sample, and processing the training sample through a multi-task neural network to obtain a prediction result of each task; wherein the multitasking comprises: a target task and an auxiliary task; determining a loss function of each task according to the prediction result of each task, and constructing a multi-objective gradient optimization model based on the gradient of the loss function and a preset variable to be optimized; solving the multi-target gradient optimization model to obtain an optimization result of the variable to be optimized; the optimization result comprises: the weight value of each task and the parameter value of the gradient descending direction correction parameter of the target task; the direction correction parameter is used for representing the training priority degree of the target task; and determining the sharing parameters of the multitask neural network based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task.
In the embodiment of the disclosure, the learning bias of each task can be determined according to the weight value by determining the weight value of each task, wherein the learning bias can be used for describing the training speed of the target task and the auxiliary task. Therefore, a preferred learning of the target task and the auxiliary task can be achieved by determining the weight value of each task. Meanwhile, in the embodiment of the disclosure, by determining the parameter value of the direction correction parameter in the gradient descending direction of the target task, the target task can be trained preferentially under the condition that the target task and the auxiliary task do not conflict with each other in the training process, so that the target task and the auxiliary task can be learned preferentially. The learning of the target task can be promoted by setting the preference for learning the target task and the auxiliary task, and the learning effect of the target task in the multi-task neural network is improved.
In an optional implementation manner, the solving the multi-objective gradient optimization model to obtain the optimization result of the variable to be optimized includes: performing multi-target solution on the target function based on the target constraint condition to obtain a pareto solution; and determining the weight value of each task and the parameter value of the direction correction parameter of the descending direction of the gradient of the target task according to the pareto solution.
In the embodiment of the disclosure, a multi-target solution is performed on an objective function through a target constraint condition to obtain a pareto solution, and then a mode of determining a weight value of each task and a parameter value of a direction correction parameter of a gradient of a target task in a descending direction is determined according to the pareto solution, so that a multi-task learning problem can be converted into a multi-target optimization problem, and the weight value of each task and the parameter value of the direction correction parameter of the gradient of the target task in the descending direction are rapidly determined.
In an alternative embodiment, the multi-objective gradient optimization model includes: an objective function and an objective constraint, the objective function comprising: a first function and a second function, wherein the first function is used for representing the weighted sum of the gradient and the weight value of each task, and the second function is used for representing the correction direction of the gradient descending direction of the target task relative to the auxiliary task; the target constraint condition comprises the following constraint parameters: the weight parameter of each task and the direction correction parameter of the gradient descending direction of the target task.
In the embodiment of the disclosure, by setting the objective function as the first function and the second function and setting the objective constraint condition by the constraint parameter, when the objective function is solved by using the objective constraint condition, a weighted value of each task can be dynamically solved, so that a multi-task is preferably learned, and further, when the auxiliary task and the objective task conflict, the learning of the objective task is promoted by the weighted value. Meanwhile, the direction correction parameters are restricted by constructing the target restriction condition, and the learning of the target task is favored under the condition that the auxiliary task and the target task are not in conflict.
In an alternative embodiment, the target constraint includes: a weight parameter α of the auxiliary taskjSatisfies the following conditions: alpha is more than or equal to 0jC1 is less than or equal to C; the direction correction parameter betaijSatisfies the following conditions: beta is not less than 0ijC2 is less than or equal to
Figure BDA0002905500090000031
Wherein alpha isjWeight parameter, β, representing the jth auxiliary taskijA direction correction parameter L representing a direction of a gradient of the ith target task with respect to the jth auxiliary taskpA set of task indices representing auxiliary tasks, C1 a Preset privilege parameter, C2 a training priority for a target taskA priority parameter, wherein C ∈ (0, 1), and the preset privilege parameter is used for representing the training priorities of the target task and the auxiliary task.
In the embodiment of the present disclosure, by setting the target constraint condition, values of weight parameters of the target task and the auxiliary task may be controlled, so that a gradient descending direction of the target task is controlled according to the values of the weight parameters. Meanwhile, the gradient descending direction of the target task can be corrected under the condition that the auxiliary task and the target task are not in conflict, so that the training process of the multi-task neural network is more inclined to learn the target task.
In an optional implementation manner, the solving the multi-objective gradient optimization model to obtain the optimization result of the variable to be optimized includes: decomposing the objective function into a plurality of sub-functions based on the constraint expression mode of the variable to be optimized in the objective constraint condition; and solving the variables to be optimized in each subfunction through a coordinate descent algorithm to obtain the weight value of each task and the parameter value of the direction correction parameter of the gradient descent direction of the target task.
In an alternative embodiment, the plurality of sub-functions includes: the device comprises a first sub-function and a second sub-function, wherein the first sub-function is a function determined based on a weight parameter of each task and a target semi-positive definite matrix, the second sub-function is a function determined based on the direction correction parameter and the target semi-positive definite matrix, and the target semi-positive definite matrix is a semi-positive definite matrix determined according to a target function.
When solving the optimization problem with constraints, the expression form of the variable to be optimized under the constraint condition will affect the solving mode of the corresponding subfunction, therefore, in the embodiment of the disclosure, the variable to be optimized is divided into two optimized modes according to the mode whether the variable to be optimized in the constraint parameters has equality constraints, so that the solving rate of the multi-objective gradient optimization model can be increased, and a more accurate solving result can be obtained.
In an optional embodiment, the determining a shared parameter of the multitask neural network based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task includes: determining a corrected gradient descending direction of the target task based on the weight value of each task and the parameters of the direction correction parameters of the gradient descending direction of the target task; updating a sharing parameter of the multitask neural network based on the initial sharing parameter of the multitask and the modified gradient descent direction.
In the embodiment of the disclosure, the shared parameters of the plurality of tasks are corrected by the weight value of each task and the parameter value of the direction correction parameter in the gradient descending direction of the target task, so that the target task and the auxiliary task are preferably learned by determining the weight value of each task, and the target task and the auxiliary task are preferably trained under the condition that the target task and the auxiliary task do not conflict in the training process, thereby further preferably learning the target task and the auxiliary task.
In an optional embodiment, the method further comprises: acquiring an image to be processed; and classifying the images to be processed by adopting the trained multi-task neural network to obtain an image processing result of the images, wherein the image processing result comprises the image processing result of each task.
In an alternative embodiment, the processing object of each task in the multitask neural network is to-be-processed image data input into the multitask neural network.
In the embodiment of the disclosure, the image can be processed through the multi-task neural network after training, and for the target task concerned by the trainer, the processing precision and the processing efficiency of the target task can be improved, so that a more accurate image processing result is obtained.
In a second aspect, an embodiment of the present disclosure further provides a training apparatus for a multitask neural network, including: the device comprises an acquisition unit, a prediction unit and a prediction unit, wherein the acquisition unit is used for acquiring a training sample and processing the training sample through a multi-task neural network to obtain a prediction result of each task; wherein the multitasking comprises: a target task and an auxiliary task; a first determining unit, configured to determine a loss function of each task according to the prediction result of each task; the construction unit is used for constructing a multi-objective gradient optimization model based on the gradient of the loss function and a preset variable to be optimized; the solving unit is used for solving the multi-target gradient optimization model to obtain an optimization result of the variable to be optimized; the optimization result comprises: the weight value of each task and the parameter value of the gradient descending direction correction parameter of the target task; the direction correction parameter is used for representing the training priority degree of the target task; and the second determination unit is used for determining the sharing parameters of the multitask neural network based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task.
In a third aspect, an embodiment of the present disclosure further provides an electronic device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect described above, or any possible implementation of the first aspect.
In a fourth aspect, this disclosed embodiment also provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps in the first aspect or any one of the possible implementation manners of the first aspect.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.
FIG. 1 is a flow chart illustrating a method for training a multitask neural network provided by an embodiment of the present disclosure;
FIG. 2 illustrates a slack descent diagram for a target task and an auxiliary task provided by an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating a modification of a gradient descent direction provided by an embodiment of the disclosure;
FIG. 4 is a schematic diagram illustrating a training apparatus for a multitasking neural network provided by an embodiment of the present disclosure;
fig. 5 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure, presented in the figures, is not intended to limit the scope of the claimed disclosure, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making creative efforts, shall fall within the protection scope of the disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The term "and/or" herein merely describes an associative relationship, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
It has been found that in the existing multi-task learning, some tasks are often concerned by the trainer (i.e. target tasks), and the rest tasks (i.e. privileged tasks) are only used for assisting the trainer in training the concerned part of the tasks. However, in general, in the conventional multi-task learning, which is a deep learning algorithm, a target task and an auxiliary task are usually trained together, but the importance of the target task and the importance of the auxiliary task are the same in the training process, so that the importance of the target task cannot be highlighted or the help provided by a privileged task for the target task cannot be utilized in the conventional training method, and the effect of the target task is poor.
Based on the research, the present disclosure provides a training method of a multitask neural network, in the training method, after a training sample is obtained, the training sample is processed through the multitask neural network to obtain a prediction result of each task, then a loss function of each task is determined according to the prediction result of each task, and a multi-objective gradient optimization model is further constructed according to the gradient of the loss function and a preset variable to be optimized; then, the multi-target gradient optimization model can be solved to obtain the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task. After the weight value of each task is obtained, the learning bias of each task can be determined according to the weight value, wherein the learning bias can be used for describing the training speed of the target task and the auxiliary task. Therefore, a preferred learning of the target task and the auxiliary task can be achieved by determining the weight value of each task. Meanwhile, in the embodiment of the disclosure, by determining the parameter value of the direction correction parameter in the gradient descending direction of the target task, the target task can be trained preferentially under the condition that the target task and the auxiliary task do not conflict with each other in the training process, so that the target task and the auxiliary task can be learned preferentially. The learning of the target task can be promoted by setting the preference for learning the target task and the auxiliary task, and the learning effect of the target task in the multi-task neural network is improved.
To facilitate understanding of the present embodiment, first, a training method for a multitask neural network disclosed in the embodiments of the present disclosure is described in detail, where an execution subject of the training method for a multitask neural network provided in the embodiments of the present disclosure is generally an electronic device with certain computing power, and the electronic device includes, for example: a terminal device, which may be a User Equipment (UE), a mobile device, a User terminal, a cellular phone, a cordless phone, a Personal Digital Assistant (PDA), a handheld device, a computing device, a vehicle mounted device, a wearable device, or a server or other processing device. In some possible implementations, the training method of the multitasking neural network may be implemented by a processor calling computer readable instructions stored in a memory.
Referring to fig. 1, a flowchart of a training method of a multitask neural network provided in an embodiment of the present disclosure is shown, where the method includes steps S101 to S107, where:
s101: acquiring a training sample, and processing the training sample through a multi-task neural network to obtain a prediction result of each task; wherein the multitasking comprises: a target task and an auxiliary task.
In the embodiment of the present disclosure, the processing object of each task in the multitask neural network is to-be-processed image data input into the multitask neural network. The target task refers to a main task concerned by the trainer, and the auxiliary task may be a task that is concerned by the trainer to a lesser degree than the target task, or the auxiliary task may be understood as a task that assists the target task in training during the training of the target task. The target task may be one, and the auxiliary tasks may be multiple.
The training samples are processed through the multi-task neural network, a plurality of prediction results can be obtained, and each task corresponds to one prediction result. For example, the multiple tasks of the multitask neural network include face detection and face recognition, and at this time, after a training sample is processed by the multitask neural network, a face detection result and a face recognition result may be obtained, where the face detection result is used to represent whether the training sample includes a face, and the face recognition result is used to represent object information to which the face included in the training sample belongs.
S103: determining a loss function of each task according to the prediction result of each task; and constructing a multi-objective gradient optimization model based on the gradient of the loss function and a preset variable to be optimized.
In the embodiment of the disclosure, the multi-objective gradient optimization model is a multi-objective gradient optimization problem, which can be understood as a multi-objective gradient descent problem with preference. The preference is the training priority of the target task and the auxiliary task, and the training priority can understand the convergence speed of the loss function of the target task and the auxiliary task. The faster the convergence rate, the higher the training priority of the corresponding task, which may be understood as being more preferable to learning the task.
The method can realize the preferential learning of a plurality of tasks by the preferential multi-target gradient descent problem. For example, the target task is a task concerned by a trainer, and the target task can be preferably learned through the multi-objective gradient optimization model. The learning of the target task with preference means that the value of the loss function of the target task is preferentially close to the extreme point by controlling the gradient descending direction of the loss function of the target task.
S105: solving the multi-target gradient optimization model to obtain an optimization result of the variable to be optimized; the optimization result comprises: the weight value of each task and the parameter value of the gradient descending direction correction parameter of the target task; the direction correction parameter is used for representing the training priority degree of the target task.
In the embodiment of the present disclosure, an optimization result of a variable to be optimized may be obtained by solving the multi-objective gradient optimization model, where the optimization result includes: the weight value of each task in the multitask neural network and the parameter value of the direction correction parameter of the gradient descending direction of the target task.
In the embodiment of the present disclosure, the weight value of each task may be used to indicate the training priority of the target task and/or the auxiliary task, where the higher the weight value is, the higher the training priority of the task corresponding to the weight value is represented. In the process of learning the task, the task is trained preferentially, so that the value of the loss function of the task is controlled to be preferentially close to the extreme point (or the convergence speed of the loss function of the task is controlled to be increased).
Therefore, in the embodiment of the present disclosure, the training priority of the target task may be set by controlling the weight value of each task, for example, the target task may be trained by controlling the priority by the weight value.
In the embodiment of the present disclosure, in addition to obtaining the weight value, a parameter value of a direction correction parameter of a gradient descent direction of the target task may be obtained through solving, and then the gradient descent direction of the target task is corrected by using the parameter value of the direction correction parameter, so as to control a preference degree (i.e., a training priority degree) to the target task in a task training process.
In the multi-task training process, if training conflict does not occur between the target task and the auxiliary task, the gradient descending direction of the target task can be corrected through the direction correction parameters, so that the convergence speed of the loss function of the target task is increased, and the target task is preferably learned.
It should be noted that, in the embodiment of the present disclosure, the training conflict between the target task and the auxiliary task may be understood as: the loss function values for both the target task and the auxiliary task fall along the gradient descent direction. Conversely, the occurrence of a training conflict between the target task and the auxiliary task may be understood as: the loss function value of only one of the target task and the auxiliary task decreases in the gradient decreasing direction.
In the embodiment of the disclosure, by determining the weight value of each task, the learning of the target task can be promoted when the target task and the auxiliary task conflict; meanwhile, by determining the parameter value of the direction correction parameter, the learning of the target task can be favored when the training conflict does not occur between the target task and the auxiliary task.
S107: and determining the sharing parameters of the multitask neural network based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task.
In the embodiment of the disclosure, after the weight value of each task and the parameter value of the direction correction parameter are determined, the sharing parameter of the multitask neural network can be determined, so that the training of the multitask neural network is realized.
In the embodiment of the disclosure, after the training samples are obtained, the training samples are processed through a multi-task neural network to obtain a prediction result of each task, then a loss function of each task is determined according to the prediction result of each task, and a multi-objective gradient optimization model is further constructed according to the gradient of the loss function and a preset variable to be optimized; then, the multi-target gradient optimization model can be solved to obtain the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task. After the weight value of each task is obtained, the learning bias of each task can be determined according to the weight value, wherein the learning bias can be used for describing the training speed of the target task and the auxiliary task. Therefore, a preferred learning of the target task and the auxiliary task can be achieved by determining the weight value of each task. Meanwhile, in the embodiment of the disclosure, by determining the parameter value of the direction correction parameter in the gradient descending direction of the target task, the target task can be trained preferentially under the condition that the target task and the auxiliary task do not conflict with each other in the training process, so that the target task and the auxiliary task can be learned preferentially. The learning of the target task can be promoted by setting the preference for learning the target task and the auxiliary task, and the learning effect of the target task in the multi-task neural network is improved.
In embodiments of the present disclosure, multitasking in a multitasking neural network includes image processing tasks, including, for example, image-based recognition tasks and detection tasks, or image classification tasks that include multiple dimensions. For image data to be processed in an image processing task, many matrix operations are involved in the image data, and most of the matrix operations are complex, so that a plurality of image processing tasks need to consume a lot of computing resources when being processed respectively. By adopting the method provided by the embodiment of the disclosure, the gradient descent speed can be increased, so that the training efficiency of the multitask neural network is effectively improved, the consumed computing resources are reduced, and the computing efficiency of the terminal equipment is improved. And the multi-task neural network obtained by training has good performance in various image processing tasks.
In an embodiment of the present disclosure, the multi-objective gradient optimization model includes: an objective function and an objective constraint, the objective function comprising: a first function and a second function, wherein the first function is used for representing the weighted sum of the gradient and the weight value of each task, and the second function is used for representing the correction direction of the gradient descending direction of the target task relative to the auxiliary task; the target constraint condition comprises the following constraint parameters: the weight parameter of each task and the direction correction parameter of the gradient descending direction of the target task.
In the disclosed embodiment, the objective function in the multi-objective gradient optimization model can be expressed as the following formula:
Figure BDA0002905500090000121
wherein the first function is represented as
Figure BDA0002905500090000122
Second letterNumber is expressed as
Figure BDA0002905500090000123
In the above formula, α represents a vector representation of a weight parameter, in which a weight value of each task is contained; β represents a vector representation of the direction correction parameter, and the vector contains the direction correction parameter of the gradient descent direction of each target task with respect to each auxiliary task. M represents indexes of a plurality of tasks, and M belongs to M; alpha is alphamRepresents the weight of the mth task, theta represents the sharing parameter of a plurality of tasks, andm(theta) represents the penalty function for the mth task,
Figure BDA0002905500090000125
represents the loss function lmA gradient of (θ); beta is aijA direction correction parameter, L, representing the gradient descent direction of the ith target task relative to the jth auxiliary tasktSet of indices, L, representing target taskspSet of indices representing auxiliary tasks,/i(θ) represents the penalty function for the ith target task, lj(theta) represents the loss function for the jth auxiliary task,
Figure BDA0002905500090000126
represents the loss function li(iii) a gradient of (theta) in the direction of the axis,
Figure BDA0002905500090000127
represents the loss function ljA gradient of (θ).
In the embodiment of the present disclosure, the target constraint condition of the multi-target gradient optimization model is a constraint condition constructed based on the weight parameter of each task and the direction correction parameter of the gradient descending direction of the target task. By adopting the method of solving the objective function by adopting the objective constraint condition, the dynamic solution of the weighted value of each task can be realized, so that the multi-task learning is realized preferentially, and the learning of the objective task is promoted by the weighted value when the auxiliary task and the objective task conflict. Meanwhile, the direction correction parameters are restricted by constructing the target restriction condition, and the learning of the target task is favored under the condition that the auxiliary task and the target task are not in conflict.
In an alternative embodiment, the target constraint condition includes: weight parameter alpha of auxiliary taskjSatisfies the following conditions: alpha is more than or equal to 0jC1 is less than or equal to C; the direction correction parameter betaijSatisfies the following conditions: beta is not less than 0ijC2 is less than or equal to
Figure BDA0002905500090000124
Wherein alpha isjWeight parameter, β, representing the jth auxiliary taskijA direction correction parameter L representing a direction of a gradient of the ith target task with respect to the jth auxiliary taskpA set of task indices representing auxiliary tasks, C1 a preset privilege parameter, C2 a training priority parameter of the target task, wherein C e (0, 1), the preset privilege parameter is used to characterize the training priority of the target task and the auxiliary tasks. In the embodiment of the present disclosure, the preset privilege parameter is used for controlling the gradient descending direction of the target task by controlling the value of the weight parameter.
In general, the above target constraint can be expressed as the following formula:
Figure BDA0002905500090000131
in the embodiment of the present disclosure, C1 indicates a preset privilege parameter, the value of C1 is a preset value, and the weight value of each task can be controlled by controlling the value of C1, which is described below with reference to fig. 2. Fig. 2 is a schematic diagram showing the slack descent of the target task and the auxiliary task. As can be seen from FIG. 2, assume that α1Is a weight value of the target task, alpha2Is the weight value of the auxiliary task. When the value of C1 is small (e.g., C1 ═ 0.2), the weight value α of the target task is set to be smaller1Weight value alpha greater than auxiliary task2. At this time, it can be shown that there can be a preference for the target task when learning the target task and the auxiliary taskThe task is preferentially learned. When the value of C1 is large (e.g., C1 ═ 1), the weight value α of the auxiliary task is set to be larger2Weight value alpha greater than target task1. At this time, it can be shown that there is a preference to learn the privileged task preferentially when learning the target task and the supplementary task. Therefore, in the embodiment of the present disclosure, by presetting the preset privilege parameter, the values of the weight parameters of the target task and the auxiliary task may be controlled, so as to control the gradient descending direction of the target task according to the values of the weight parameters.
In the embodiment of the present disclosure, as can be seen from the above description, in the case that the auxiliary task and the target task do not conflict with each other, the gradient descending direction of the target task may also be corrected, so that the training process of the multitask neural network is more biased to learn the target task. Fig. 3 is a schematic diagram illustrating a correction in the gradient descending direction. Let us assume, α1Is a weight value of the target task, alpha2Is the weight value of the auxiliary task.
Figure BDA0002905500090000132
Is the gradient descent direction of the target task,
Figure BDA0002905500090000133
the direction of gradient descent of the assist task is the direction of gradient descent of the assist task, and the direction of gradient descent of the target task can be corrected when the loss functions of both the assist task and the target task descend along the corresponding direction of gradient descent. When the gradient descending direction of the target task is corrected, the gradient descending direction of the target task can be increased
Figure BDA0002905500090000141
To make the correction. The gradient descending direction of the target task can be further pushed to the target task by correcting the gradient descending direction of the target task, so that the loss function of the target task is preferentially close to the extreme point. For example, as shown in FIG. 3, the data may be represented by a formula
Figure BDA0002905500090000142
And correcting the gradient descending direction of the target task. As can be seen from fig. 3, after correcting the gradient descent direction of the target task,
Figure BDA0002905500090000143
and
Figure BDA0002905500090000144
the vector sum of (2) is close to the target task, so that the gradient descending direction of the target task is increased, and at the moment, the gradient descending direction is pushed to the target task. Wherein, beta12And the direction correction parameters are used for representing the training priority degree of the target task. In the embodiment of the present disclosure, the value of the direction correction parameter may be controlled by C2, so that the learning preference of the target task and the auxiliary task is controlled by C2.
It should be understood that the physical meanings of the training priorities and the training preferences are not the same. The training priority refers to a priority order of the target task and the auxiliary task in the training process, for example, the training priority of the target task is higher than that of the auxiliary task, so that the target task is preferentially trained in the training process of the target task and the auxiliary task. The training priority level is a training priority level of a task with a high training priority level relative to a task with a low training priority level when the training priority level is determined. For example, as shown in FIG. 2, if the weight value of the target task is α1Weight value alpha greater than auxiliary task2Then it indicates that the training priority of the target task is higher than the training priority of the auxiliary task. As shown in figure 3 of the drawings,
Figure BDA0002905500090000145
and
Figure BDA0002905500090000146
the vector sum of (2) can represent the training priority of the target task relative to the auxiliary task in the case that the training priority of the target task is higher than the training priority of the auxiliary task, and as can be seen from fig. 3, the larger the vector sum, the larger the target taskThe greater the training priority relative to the auxiliary task, the smaller the vector sum, the less the training priority of the target task relative to the auxiliary task.
After describing the specific structure of the multi-objective gradient optimization model, the construction process of the multi-objective gradient optimization model and the solving process of the multi-objective gradient optimization model will be described in the following embodiments.
The first step is the construction process of the multi-objective gradient optimization model.
In embodiments of the present disclosure, a multi-task learning problem is transformed into a multi-objective optimization problem. Assuming that the number of multitask is M, the index of the task is set to L, and the sharing parameter of the multitask neural network is represented as theta. As shown in FIG. 3, in the disclosed embodiment, the objective of the multi-objective optimization problem is to determine the objective after task modification
Figure BDA0002905500090000153
And
Figure BDA0002905500090000154
and d.
Based on this, after the target task is corrected can be determined by the following minimization problem
Figure BDA0002905500090000155
And
Figure BDA0002905500090000156
d:
the formula I is as follows:
Figure BDA0002905500090000151
where v represents the variable to be optimized.
Next, the dual problem of equation one above can be determined, depicted as equation two:
Figure BDA0002905500090000152
αma weight value representing the mth task,
Figure BDA0002905500090000157
representing the gradient of the loss function for the mth task. For the second formula, a Pareto optimal solution of the second formula can be determined, so that the weight value of each task is determined according to the Pareto optimal solution.
In the embodiment of the disclosure, in order to implement the learning with a preference on the target task, the auxiliary task may be applied to the learning process of the target task. Aiming at the inequality constraint in the formula one, the following inequality constraint can be modified:
Figure BDA0002905500090000158
wherein the content of the first and second substances,
Figure BDA0002905500090000159
a gradient of a loss function representing the target task,
Figure BDA00029055000900001510
representing the gradient of the loss function of the auxiliary task. The gradient descending direction of the auxiliary task can be smaller than v through the inequality constraint, and the inequality constraint is as follows:
Figure BDA00029055000900001511
and
Figure BDA00029055000900001512
and respectively used for restraining the convergence speed of the gradient decline of the target task and the convergence speed of the gradient decline of the auxiliary task. Wherein, when the auxiliary task and the target task conflict, the inequality constraint can be modified
Figure BDA00029055000900001513
The convergence speed of the gradient decline of the auxiliary task is controlled, so that the convergence speed of the gradient decline of the auxiliary task is reduced. At this time, the relaxation variable ξ may be setiIn order to reduce the convergence speed of the gradient descent of the auxiliary task, where ξi>0. Thus, the inequality can be reduced to aboutBundle of
Figure BDA00029055000900001514
The modification is as follows:
Figure BDA00029055000900001515
for the dual problem described in equation two, the following constraints are also included:
Figure BDA0002905500090000164
where C1 is a preset privilege parameter. The weight value of each task can be controlled by C1.
In the embodiment of the present disclosure, when there is no conflict between the target task and the auxiliary task, in order to increase the convergence rate of the gradient descent of the target task, the gradient descent direction of the target task may also be modified, and at this time, the following constraint conditions may be set:
Figure BDA0002905500090000165
to properly relax this constraint, a learnable relaxation variable η is also introducedij>0. At this time, the constraint condition:
Figure BDA0002905500090000166
can be modified into the following steps:
Figure BDA0002905500090000167
as can be seen from the above description, in the embodiment of the present disclosure, the multi-objective gradient optimization model may be composed of two parts: a slack descent part of the auxiliary task and a gradient direction modification part of the target task. Based on the two parts, the multi-objective gradient optimization model can be described as a structure described by the following formula three:
Figure BDA0002905500090000161
in the multi-objective gradient optimization model described above,
Figure BDA0002905500090000162
for adjusting the amount of privilege that an auxiliary task can gain, i.e. the extent to which the auxiliary task can be ignored during the training process,
Figure BDA0002905500090000163
the degree of learning the target task with priority is shown when the loss functions of the auxiliary task and the target task both decline along the gradient direction, so as to accelerate the convergence rate of the gradient decline of the target task.
Aiming at the third formula, the dual problem of the problem is formalized into a fourth formula by using a Lagrange multiplier:
Figure BDA0002905500090000171
as can be seen from the above description, in the embodiment of the present disclosure, learning of the target task and the auxiliary task with preference can be achieved by determining the weight value of each task. Meanwhile, in the embodiment of the disclosure, by determining the parameter value of the direction correction parameter in the gradient descending direction of the target task, the target task can be trained preferentially under the condition that the target task and the auxiliary task do not conflict with each other in the training process, so that the target task and the auxiliary task can be learned preferentially. The learning of the target task can be promoted by setting the preference for learning the target task and the auxiliary task, and the learning effect of the target task in the multi-task neural network is improved.
And secondly, solving the multi-objective gradient optimization model.
In the embodiment of the present disclosure, after the multi-objective gradient optimization model is constructed in the manner described above, the multi-objective gradient optimization model may be solved.
In an optional implementation manner of the embodiment of the present disclosure, step S105, solving the multi-objective gradient optimization model to obtain an optimization result of the variable to be optimized, includes:
performing multi-target solution on the target function based on the target constraint condition to obtain a pareto solution; and determining the weight value of each task and the parameter value of the direction correction parameter of the descending direction of the gradient of the target task according to the pareto solution.
In the embodiment of the disclosure, a multi-objective solving method may be adopted to solve the objective function, so as to obtain the pareto solution. Wherein paretolysin comprises: the weight value α of each task and the parameter value β of the direction correction parameter in the falling direction of the gradient of the target task.
The problem of finding a pareto solution can be converted into a constrained quadratic optimization problem by lagrange multipliers. In the embodiment of the disclosure, a hybrid block optimization algorithm is designed through an expression mode of constraint parameters in a target constraint condition. In the hybrid block optimization algorithm, the optimization variables are divided into two blocks to be optimized respectively according to whether the optimization variables in the constraint parameters have equality constraints or not.
In an optional embodiment, solving the multi-objective gradient optimization model to obtain an optimization result of the variable to be optimized includes:
(1) decomposing the objective function into a plurality of sub-functions based on the constraint expression mode of the variable to be optimized in the objective constraint condition;
(2) and solving the variables to be optimized in each subfunction through a coordinate descent algorithm to obtain the weight value of each task and the parameter value of the direction correction parameter of the gradient descent direction of the target task.
In the embodiment of the disclosure, the constraint condition about the variable to be optimized can be determined in the target constraint condition, and then whether equality constraint is included is determined according to the constraint condition of the variable to be optimized, so that the algorithm divides the variable to be optimized into two blocks to be optimized respectively according to whether equality constraint exists in the variable to be optimized in the constraint parameter. Wherein, the variable to be optimized can be understood as the variable to be solved by the multi-objective gradient optimization model.
According to the content described by the formula four, the weight parameter of each task in the variable to be optimized contains equality constraint, and the direction correction parameter in the variable to be optimized does not contain equality constraint, so that the weight parameter and the direction correction parameter can be divided into two parts to be optimized respectively. At this time, the formula four may be split into a plurality of subfunctions, and then each subfunction is solved by a coordinate descent algorithm to obtain a weight value of each task and a parameter value of a direction correction parameter of a gradient descent direction of the target task.
When solving the optimization problem with constraints, the expression form of the constraints affects the solving mode of the corresponding subfunction, so that in the embodiment of the disclosure, the algorithm divides the variable to be optimized into two optimized modes according to whether the variable to be optimized in the constraint parameters has equality constraints, so that the solving rate of the multi-objective gradient optimization model can be increased, and a more accurate solving result can be obtained.
In an embodiment of the present disclosure, the plurality of sub-functions includes: the device comprises a first sub-function and a second sub-function, wherein the first sub-function is a function determined based on a weight parameter of each task and a target semi-positive definite matrix, the second sub-function is a function determined based on the direction correction parameter and the target semi-positive definite matrix, and the target semi-positive definite matrix is a semi-positive definite matrix determined according to a target function. .
In the disclosed embodiment, the first sub-function may be expressed as:
Figure BDA0002905500090000191
in the disclosed embodiment, the second sub-function may be expressed as:
Figure BDA0002905500090000192
in the embodiment of the present disclosure, Q is expressed as a target semi-positive determination matrix, and the determination process of Q may be expressed as:
for the above equation three, it is assumed that,
Figure BDA0002905500090000193
and is
Figure BDA0002905500090000194
In this case, the formula three can be rewritten as:
Figure BDA0002905500090000195
to the above
Figure BDA0002905500090000196
It can be understood that: a first matrix composed of alpha and beta, multiplied by a second matrix, and further multiplied by a first matrix composed of alpha and beta, that is, a formula
Figure BDA0002905500090000197
Can be converted into: and multiplying the first matrix by the second matrix by the first matrix, wherein the second matrix is the target semi-positive definite matrix Q.
In the embodiment of the present disclosure, after the multi-objective gradient optimization model is solved in the manner described above, and the weight value of each task and the parameter value of the direction correction parameter of the gradient descent direction of the target task are obtained, the shared parameter of the multi-task neural network may be determined based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descent direction of the target task.
In an alternative embodiment, in step S107, determining a shared parameter of the multitask neural network based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task, includes:
(1) and determining the corrected gradient descending direction of the target task based on the weight value of each task and the parameter of the direction correction parameter of the gradient descending direction of the target task.
In the embodiment of the present disclosure, the modified gradient descent direction of the target task may be calculated by a formula:
Figure BDA0002905500090000203
. Wherein the content of the first and second substances,
Figure BDA0002905500090000205
and is and
Figure BDA0002905500090000204
(2) and updating the shared parameters of the multitask neural network based on the initial shared parameters of the tasks and the corrected gradient descent direction.
After determining the modified gradient descent direction of the target task, the shared parameters of the multitask neural network may be updated according to a formula:
Figure BDA0002905500090000206
in the embodiment of the present disclosure, besides the shared parameter needs to be updated, the private parameter of each task may also be updated, and for each task, the gradient of each task may be calculated by a formula:
Figure BDA0002905500090000201
thereafter, the private parameters for each task may be updated according to the formula:
Figure BDA0002905500090000202
in the embodiment of the disclosure, in the process of training the multitask neural network, if there are a plurality of training samples, the training samples may be firstly batch-processed to obtain a plurality of groups of training samples, and then the multitask neural network is trained by adopting a batch mini-batch processing mode.
Therefore, in the embodiment of the present disclosure, for each batch, if it is determined that the loss function value of each task converges to the preset threshold, or the number of times of adjusting the network parameter of the multitask neural network reaches the preset number, the current batch is ended, and the next batch of training samples is updated, so as to enter the next batch process.
In the embodiment of the present disclosure, after the multitask neural network is trained and obtained according to the above-described manner, the image to be processed may be obtained; then, classifying the images to be processed by adopting the trained multitask neural network to obtain an image processing result of the images, wherein the image processing result comprises the image processing result of each task.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same inventive concept, the embodiment of the present disclosure further provides a training apparatus for a multi-task neural network corresponding to the training method for the multi-task neural network, and as the principle of the apparatus in the embodiment of the present disclosure for solving the problem is similar to the training method for the multi-task neural network described above in the embodiment of the present disclosure, the implementation of the apparatus may refer to the implementation of the method, and repeated details are not repeated.
Referring to fig. 4, a schematic diagram of a training apparatus for a multitask neural network provided in an embodiment of the present disclosure is shown, where the apparatus includes: an acquisition unit 41, a first determination unit 42, a construction unit 43, a solving unit 44, and a second determination unit 45; wherein the content of the first and second substances,
the acquiring unit 41 is configured to acquire a training sample, and process the training sample through a multi-task neural network to obtain a prediction result of each task; the multitasking comprises the following steps: a target task and an auxiliary task;
a first determining unit 42, configured to determine a loss function of each task according to the prediction result of each task;
a constructing unit 43, configured to construct a multi-objective gradient optimization model based on the gradient of the loss function and a preset variable to be optimized;
the solving unit 44 is configured to solve the multi-target gradient optimization model to obtain an optimization result of the variable to be optimized; the optimization result comprises: the weight value of each task and the parameter value of the gradient descending direction correction parameter of the target task; the direction correction parameter is used for representing the training priority degree of the target task;
a second determining unit 45, configured to determine a shared parameter of the multitask neural network based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task.
In the embodiment of the disclosure, the learning bias of each task can be determined according to the weight value by determining the weight value of each task, wherein the learning bias can be used for describing the training speed of the target task and the auxiliary task. Therefore, a preferred learning of the target task and the auxiliary task can be achieved by determining the weight value of each task. Meanwhile, in the embodiment of the disclosure, by determining the parameter value of the direction correction parameter in the gradient descending direction of the target task, the target task can be trained preferentially under the condition that the target task and the auxiliary task do not conflict with each other in the training process, so that the target task and the auxiliary task can be learned preferentially. The learning of the target task can be promoted by setting the preference for learning the target task and the auxiliary task, and the learning effect of the target task in the multi-task neural network is improved.
In a possible embodiment, the solving unit 44 is configured to: performing multi-target solution on the target function based on a target constraint condition to obtain a pareto solution; and determining the weight value of each task and the parameter value of the direction correction parameter of the descending direction of the gradient of the target task according to the pareto solution.
In one possible embodiment, the multi-objective gradient optimization model includes: an objective function and an objective constraint, the objective function comprising: a first function and a second function, wherein the first function is used for representing the weighted sum of the gradient and the weight value of each task, and the second function is used for representing the correction direction of the gradient descending direction of the target task relative to the auxiliary task; the target constraint condition comprises the following constraint parameters: the weight parameter of each task and the direction correction parameter of the gradient descending direction of the target task.
In one possible embodiment, the target constraints include: a weight parameter α of the auxiliary taskjSatisfies the following conditions: alpha is more than or equal to 0jC1 is less than or equal to C; the direction correction parameter betaijSatisfies the following conditions: beta is not less than 0ijC2 is less than or equal to
Figure BDA0002905500090000221
Wherein alpha isjWeight parameter, β, representing the jth auxiliary taskijA direction correction parameter L representing a direction of a gradient of the ith target task with respect to the jth auxiliary taskpA set of task indices representing auxiliary tasks, C1 a preset privilege parameter, C2 a training priority parameter of the target task, wherein C e (0, 1), the preset privilege parameter is used to characterize the training priority of the target task and the auxiliary tasks.
In a possible embodiment, the solving unit 44 is further configured to: decomposing the objective function into a plurality of sub-functions based on the constraint expression mode of the variable to be optimized in the objective constraint condition; and solving the variables to be optimized in each subfunction through a coordinate descent algorithm to obtain the weight value of each task and the parameter value of the direction correction parameter of the gradient descent direction of the target task.
In one possible implementation, the plurality of sub-functions includes: the device comprises a first sub-function and a second sub-function, wherein the first sub-function is a function determined based on a weight parameter of each task and a target semi-positive definite matrix, the second sub-function is a function determined based on the direction correction parameter and the target semi-positive definite matrix, and the target semi-positive definite matrix is a semi-positive definite matrix determined according to a target function. .
In a possible implementation, the second determining unit 45 is further configured to: determining a corrected gradient descending direction of the target task based on the weight value of each task and the parameters of the direction correction parameters of the gradient descending direction of the target task; updating a sharing parameter of the multitasking neural network based on the initial sharing parameter of the plurality of tasks and the modified gradient descent direction.
In one possible embodiment, the apparatus is further configured to: acquiring an image to be processed; and classifying the images to be processed by adopting the trained multi-task neural network to obtain an image processing result of the images, wherein the image processing result comprises the image processing result of each task.
In an alternative embodiment, the processing object of each task in the multitask neural network is to-be-processed image data input into the multitask neural network.
Corresponding to the training method of the multitask neural network in fig. 1, an embodiment of the present disclosure further provides an electronic device 500, and as shown in fig. 5, a schematic structural diagram of the electronic device 500 provided in the embodiment of the present disclosure includes:
a processor 51, a memory 52, and a bus 53; the storage 52 is used for storing execution instructions and comprises a memory 521 and an external storage 522; the memory 521 is also referred to as an internal memory, and is configured to temporarily store operation data in the processor 51 and data exchanged with an external memory 522 such as a hard disk, the processor 51 exchanges data with the external memory 522 through the memory 521, and when the electronic device 500 operates, the processor 51 communicates with the memory 52 through the bus 53, so that the processor 51 executes the following instructions:
acquiring a training sample, and processing the training sample through a multi-task neural network to obtain a prediction result of each task; wherein the multitasking comprises: a target task and an auxiliary task; determining a loss function of each task according to the prediction result of each task, and constructing a multi-objective gradient optimization model based on the gradient of the loss function and a preset variable to be optimized; solving the multi-target gradient optimization model to obtain an optimization result of the variable to be optimized; the optimization result comprises: the weight value of each task and the parameter value of the gradient descending direction correction parameter of the target task; the direction correction parameter is used for representing the training priority degree of the target task; and determining the sharing parameters of the multitask neural network based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task.
The embodiments of the present disclosure also provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, performs the steps of the training method for a multitask neural network described in the above method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute the steps of the training method described in the foregoing method embodiments, which may be referred to specifically for the foregoing method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used for illustrating the technical solutions of the present disclosure and not for limiting the same, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (12)

1. A method for training a multitask neural network, comprising:
acquiring a training sample, and processing the training sample through a multi-task neural network to obtain a prediction result of each task; wherein the multitasking comprises: a target task and an auxiliary task;
determining a loss function of each task according to the prediction result of each task, and constructing a multi-objective gradient optimization model based on the gradient of the loss function and a preset variable to be optimized;
solving the multi-target gradient optimization model to obtain an optimization result of the variable to be optimized; the optimization result comprises: the weight value of each task and the parameter value of the gradient descending direction correction parameter of the target task; the direction correction parameter is used for representing the training priority degree of the target task;
and determining the sharing parameters of the multitask neural network based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task.
2. The method according to claim 1, wherein solving the multi-objective gradient optimization model to obtain the optimization result of the variable to be optimized comprises:
performing multi-target solution on the target function based on the target constraint condition to obtain a pareto solution;
and determining the weight value of each task and the parameter value of the direction correction parameter of the descending direction of the gradient of the target task according to the pareto solution.
3. The method of claim 1 or 2, wherein the multi-objective gradient optimization model comprises: an objective function and an objective constraint condition;
the objective function includes: a first function and a second function, wherein the first function is used for representing the weighted sum of the gradient and the weight value of each task, and the second function is used for representing the correction direction of the gradient descending direction of the target task relative to the auxiliary task;
the target constraint condition comprises the following constraint parameters: the weight parameter of each task and the direction correction parameter of the gradient descending direction of the target task.
4. The method of claim 3, wherein the target constraints comprise:
a weight parameter α of the auxiliary taskjSatisfies the following conditions: alpha is more than or equal to 0jC1 is less than or equal to C; the direction correction parameter betaijSatisfies the following conditions: beta is not less than 0ijC2 is less than or equal to
Figure FDA0002905500080000021
Wherein alpha isjWeight parameter, β, representing the jth auxiliary taskijA direction correction parameter L representing a direction of a gradient of the ith target task with respect to the jth auxiliary taskpA set of task indices representing auxiliary tasks, C1 a preset privilege parameter, C2 a training priority parameter of the target task, wherein C e (0, 1), the preset privilege parameter is used to characterize the training priority of the target task and the auxiliary tasks.
5. The method according to claim 3, wherein solving the multi-objective gradient optimization model to obtain the optimization result of the variable to be optimized comprises:
decomposing the objective function into a plurality of sub-functions based on the constraint expression mode of the variable to be optimized in the objective constraint condition;
and solving the variable to be optimized in each subfunction through a coordinate descent algorithm to obtain a weight value of each task and a parameter value of a direction correction parameter of the gradient descent direction of the target task.
6. The method of claim 5, wherein the plurality of sub-functions comprises: the device comprises a first sub-function and a second sub-function, wherein the first sub-function is a function determined based on a weight parameter of each task and a target semi-positive definite matrix, the second sub-function is a function determined based on the direction correction parameter and the target semi-positive definite matrix, and the target semi-positive definite matrix is a semi-positive definite matrix determined according to a target function.
7. The method according to any one of claims 1 to 6, wherein determining the shared parameter of the multitask neural network based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task comprises:
determining a corrected gradient descending direction of the target task based on the weight value of each task and the parameters of the direction correction parameters of the gradient descending direction of the target task;
updating a sharing parameter of the multitask neural network based on the initial sharing parameter of the multitask and the modified gradient descent direction.
8. The method according to any one of claims 1 to 7, further comprising:
acquiring an image to be processed;
and classifying the images to be processed by adopting the trained multi-task neural network to obtain an image processing result of the images, wherein the image processing result comprises the image processing result of each task.
9. The method according to any one of claims 1 to 8, wherein the processing object of each task in the multitask neural network is image data to be processed input into the multitask neural network.
10. An apparatus for training a multitask neural network, comprising:
the device comprises an acquisition unit, a prediction unit and a prediction unit, wherein the acquisition unit is used for acquiring a training sample and processing the training sample through a multi-task neural network to obtain a prediction result of each task; wherein the multitasking comprises: a target task and an auxiliary task;
a first determining unit, configured to determine a loss function of each task according to the prediction result of each task;
the construction unit is used for constructing a multi-objective gradient optimization model based on the gradient of the loss function and a preset variable to be optimized;
the solving unit is used for solving the multi-target gradient optimization model to obtain an optimization result of the variable to be optimized; the optimization result comprises: the weight value of each task and the parameter value of the gradient descending direction correction parameter of the target task; the direction correction parameter is used for representing the training priority degree of the target task;
and the second determination unit is used for determining the sharing parameters of the multitask neural network based on the weight value of each task and the parameter value of the direction correction parameter of the gradient descending direction of the target task.
11. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when the electronic device is operating, the machine-readable instructions when executed by the processor performing the steps of the method of training a multitasking neural network according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, performs the steps of the method for training a multitask neural network according to any one of claims 1 to 9.
CN202110069465.2A 2021-01-19 2021-01-19 Training method and device for multitask neural network, electronic equipment and storage medium Active CN112766493B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110069465.2A CN112766493B (en) 2021-01-19 2021-01-19 Training method and device for multitask neural network, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110069465.2A CN112766493B (en) 2021-01-19 2021-01-19 Training method and device for multitask neural network, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112766493A true CN112766493A (en) 2021-05-07
CN112766493B CN112766493B (en) 2023-04-07

Family

ID=75703208

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110069465.2A Active CN112766493B (en) 2021-01-19 2021-01-19 Training method and device for multitask neural network, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112766493B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113506270A (en) * 2021-07-13 2021-10-15 北京建筑大学 Method, system and storage medium for processing inferior vena cava image
CN114860405A (en) * 2022-05-17 2022-08-05 北京百度网讯科技有限公司 Parameter updating method and device of multitask model and storage medium
CN115796025A (en) * 2021-11-24 2023-03-14 大陆汽车科技有限公司 System and method for deep multi-task learning for embedded machine vision applications

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070005313A1 (en) * 2005-04-28 2007-01-04 Vladimir Sevastyanov Gradient-based methods for multi-objective optimization
CN109117953A (en) * 2018-09-11 2019-01-01 北京迈格威科技有限公司 Network parameter training method and system, server, client and storage medium
WO2019169816A1 (en) * 2018-03-09 2019-09-12 中山大学 Deep neural network for fine recognition of vehicle attributes, and training method thereof
CN110892418A (en) * 2017-05-19 2020-03-17 渊慧科技有限公司 Multitasking neural network system
CN112183750A (en) * 2020-11-05 2021-01-05 平安科技(深圳)有限公司 Neural network model training method and device, computer equipment and storage medium
CN112232407A (en) * 2020-10-15 2021-01-15 杭州迪英加科技有限公司 Neural network model training method and device for pathological image sample
WO2021007812A1 (en) * 2019-07-17 2021-01-21 深圳大学 Deep neural network hyperparameter optimization method, electronic device and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070005313A1 (en) * 2005-04-28 2007-01-04 Vladimir Sevastyanov Gradient-based methods for multi-objective optimization
CN110892418A (en) * 2017-05-19 2020-03-17 渊慧科技有限公司 Multitasking neural network system
WO2019169816A1 (en) * 2018-03-09 2019-09-12 中山大学 Deep neural network for fine recognition of vehicle attributes, and training method thereof
CN109117953A (en) * 2018-09-11 2019-01-01 北京迈格威科技有限公司 Network parameter training method and system, server, client and storage medium
WO2021007812A1 (en) * 2019-07-17 2021-01-21 深圳大学 Deep neural network hyperparameter optimization method, electronic device and storage medium
CN112232407A (en) * 2020-10-15 2021-01-15 杭州迪英加科技有限公司 Neural network model training method and device for pathological image sample
CN112183750A (en) * 2020-11-05 2021-01-05 平安科技(深圳)有限公司 Neural network model training method and device, computer equipment and storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
OZAN SENER等: "Multi-Task Learning as Multi-Objective Optimization" *
ZHAO CHEN等: "GradNorm: Gradient Normalization for Adaptive Loss Balancing in Deep Multitask Networks" *
丁我爱: "梯度⼿术-多任务学习优化⽅法[NeurIPS 2020]" *
刘建军等: "基于模型的多目标优化问题方法研究" *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113506270A (en) * 2021-07-13 2021-10-15 北京建筑大学 Method, system and storage medium for processing inferior vena cava image
CN115796025A (en) * 2021-11-24 2023-03-14 大陆汽车科技有限公司 System and method for deep multi-task learning for embedded machine vision applications
CN114860405A (en) * 2022-05-17 2022-08-05 北京百度网讯科技有限公司 Parameter updating method and device of multitask model and storage medium
CN114860405B (en) * 2022-05-17 2023-01-31 北京百度网讯科技有限公司 Parameter updating method and device of multitask model and storage medium

Also Published As

Publication number Publication date
CN112766493B (en) 2023-04-07

Similar Documents

Publication Publication Date Title
CN112766493B (en) Training method and device for multitask neural network, electronic equipment and storage medium
Zeilinger et al. Real-time suboptimal model predictive control using a combination of explicit MPC and online optimization
Reif et al. Efficient feature size reduction via predictive forward selection
CN111738488A (en) Task scheduling method and device
WO2022028323A1 (en) Classification model training method, hyper-parameter searching method, and device
Muhuri et al. On arrival scheduling of real-time precedence constrained tasks on multi-processor systems using genetic algorithm
CN116257363B (en) Resource scheduling method, device, equipment and storage medium
CN109144719A (en) Cooperation discharging method based on markov decision process in mobile cloud computing system
Li et al. Satisfying optimization method based on goal programming for fuzzy multiple objective optimization problem
CN114675975B (en) Job scheduling method, device and equipment based on reinforcement learning
CN109325530A (en) Compression method based on the depth convolutional neural networks on a small quantity without label data
Abbasi Yadkori et al. Near minimax optimal players for the finite-time 3-expert prediction problem
CN116362348A (en) Parameter optimization method and device
CN117011118A (en) Model parameter updating method, device, computer equipment and storage medium
Torkamani et al. Learning compact neural networks using ordinary differential equations as activation functions
CN113705929B (en) Spring festival holiday load prediction method based on load characteristic curve and typical characteristic value fusion
CN111343259B (en) Binary code-based cloud task scheduling method, server and storage medium
DE112022000723T5 (en) BRANCHING PROCESS FOR A CIRCUIT OF A NEURONAL PROCESSOR
CN113157453A (en) Task complexity-based high-energy-efficiency target detection task dynamic scheduling method
de Freitas Cunha et al. On the impact of MDP design for reinforcement learning agents in resource management
Li et al. Global Opposition Learning and Diversity ENhancement based Differential Evolution with exponential crossover for numerical optimization
CN117435516B (en) Test case priority ordering method and system
Cunha et al. On the impact of MDP design for Reinforcement Learning agents in Resource Management
CN117311991B (en) Model training method, task allocation method, device, equipment, medium and system
CN117436627A (en) Task allocation method, device, terminal equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant