Model training method and device

Through separate training and sequential optimization driven by the task module loss function of the multi-task model, the problem of low training efficiency of the multi-task model is solved, and more efficient model optimization and prediction effects are achieved.

CN118865010APending Publication Date: 2024-10-29STATE GRID INFORMATION & TELECOMM BRANCH +3
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410717323.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

During the training process of the multi-task model, due to the different difficulty levels of the task modules, the optimization direction deviates, thereby reducing the optimization efficiency of the multi-task model.

Method used

By training each task module separately according to the loss function of each task module, determining the training sequence, locking the module parameters during the training process, and using cross-entropy or mean square error loss function for training to ensure the effective optimization of the task module .

Benefits of technology

It improves the training optimization efficiency of multi-task models, balances the importance between task modules, and improves the generalization performance and prediction effect of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118865010A_ABST
    Figure CN118865010A_ABST
Patent Text Reader

Abstract

The invention discloses a model training method and device, and relates to the technical field of electric power operation and maintenance, the method is used for electronic equipment, and the method comprises the steps: inputting a first training sample into a multi-task model, the multi-task model comprises at least two task modules, and the task types corresponding to the task modules are different; processing the first training sample based on a first task module in the multi-task model to obtain a first processing result; when the first processing result is not matched with the sample label of the first training sample, training the first task module based on a loss function corresponding to the first task module to obtain a trained multi-task model; wherein the first task module is one of the at least two task modules.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of power operation and maintenance, and in particular to a model training method and device. Background Art

[0002] In related technologies, learning of multi-task models usually adopts a general model training paradigm, which aims to discover the relationship between tasks and use the knowledge of other tasks to improve the effect of the target task.

[0003] Specifically, in the training process of a multi-task model, multiple related task modules are usually trained simultaneously, and they help each other through gradient back propagation to improve the generalization performance of the multi-task model. For example, according to the different loss values ​​corresponding to different task modules, a loss function is determined to train the entire multi-task model.

[0004] However, since the difficulty of the task types corresponding to each task module in the multi-task model is different, if a fixed training method is used to train the multi-task model, it is impossible to effectively balance the importance of different task modules, resulting in deviations in the optimization direction during the multi-task model training process, which in turn leads to low optimization efficiency of the multi-task model. Summary of the invention

[0005] The present application provides a model training method and device for improving the optimization efficiency of multi-task models.

[0006] In order to achieve the above objectives, this application adopts the following technical solutions:

[0007] In a first aspect, a model training method is provided, which is applied to an electronic device, the method comprising: inputting a first training sample into a multi-task model, the multi-task model comprising at least two task modules, each task module corresponding to a different task type; based on the first task module in the multi-task model, processing the first training sample to obtain a first processing result; when the first processing result does not match the sample label of the first training sample, training the first task module based on the loss function corresponding to the first task module to obtain a trained multi-task model; wherein the first task module is one of the at least two task modules.

[0008] Based on the above model training method, the electronic device can perform separate training on each task module according to the loss function corresponding to each task module in the multi-task model, thereby improving the training optimization efficiency of the multi-task model.

[0009] In one possible implementation, the training order of at least two task modules is determined based on the module parameters of each task module, and the module parameters include at least one of the following: a parameter used to indicate the complexity of the task module, and type information of the task type corresponding to the task module; in accordance with the training order, all or part of the task modules of at least two task modules are trained.

[0010] In a possible implementation, according to the training order, after each task module in the multi-task model is trained, the module parameters of the task module are locked.

[0011] In one possible implementation, the first training sample is a first image; the first task module is used to identify the image degradation type of the image; based on the first task module, the image feature information of the first image is processed to obtain the first image degradation type of the first image, and when the first image degradation type does not match the image degradation type indicated by the sample label of the first image, the first task module is trained based on the cross entropy training loss function corresponding to the first task module.

[0012] In one possible implementation, the first training sample is a first image; the first task module is used to calculate an image quality score of the image; based on the first task module, the image feature information of the first image is processed to obtain a first image quality score of the first image; when the first image quality score does not match the image quality score indicated by the sample label of the first image, the first task module is trained based on the mean square error training loss function corresponding to the first task module.

[0013] In a possible implementation, the trained multi-task model is trained based on a model training loss function, wherein the model training loss function is determined based on a loss function corresponding to each task module in the multi-task model.

[0014] In a second aspect, a model training device is provided, which is applied to an electronic device, and can also be a functional module in the electronic device for implementing the method described in the first aspect or any possible design of the first aspect. The model training device can implement the functions performed by the electronic device in the above aspects or possible designs, and the functions can be implemented by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. For example, the model training device includes a processing unit, a training unit, and a determination unit.

[0015] The processing unit is used to input the first training sample into a multi-task model, wherein the multi-task model includes at least two task modules, and each task module corresponds to a different task type;

[0016] The processing unit is further used to process the first training sample based on the first task module in the multi-task model to obtain a first processing result;

[0017] The training unit is used to train the first task module based on the loss function corresponding to the first task module to obtain a trained multi-task model when the first processing result processed by the processing unit does not match the sample label of the first training sample, wherein the first task module is one of the at least two task modules.

[0018] Among them, the specific implementation method of the model training device can refer to the behavior function of the electronic device in the model training method provided by the first aspect or any possible design of the first aspect, and will not be repeated here. Therefore, the provided model training device can achieve the same beneficial effects as the first aspect or any possible design of the first aspect.

[0019] In one possible implementation, the determination unit is used for the processing unit to process the first training sample based on the first task module in the multi-task model, and before obtaining the first processing result, determine the training order of at least two task modules based on the module parameters of each task module, and the module parameters include at least one of the following: parameters indicating the complexity of the task module, type information of the task type corresponding to the task module; the training unit is also used to train all or part of the at least two task modules according to the training order determined by the determination unit.

[0020] In a possible implementation, the training unit is specifically used to lock the module parameters of a task module in the multi-task model after training the task module in the multi-task model according to the training sequence.

[0021] In one possible implementation, the first training sample is a first image; the first task module is used to identify the image degradation type of the image; the training unit is specifically used to process the image feature information of the first image based on the first task module to obtain the first image degradation type of the first image, and when the first image degradation type does not match the image degradation type indicated by the sample label of the first image, the first task module is trained based on the cross entropy training loss function corresponding to the first task module.

[0022] In one possible implementation, the first training sample is a first image; the first task module is used to calculate the image quality score of the image; the training unit is specifically used to process the image feature information of the first image based on the first task module to obtain a first image quality score of the first image, and when the first image quality score does not match the image quality score indicated by the sample label of the first image, the first task module is trained based on the mean square error training loss function corresponding to the first task module.

[0023] In one possible implementation, the training unit is further used to train the first task module based on the loss function corresponding to the first task module to obtain the trained multi-task model, and is further used to train the trained multi-task model based on the model training loss function; wherein the model training loss function is determined based on the loss function corresponding to each task module in the multi-task model.

[0024] In a third aspect, a model training device is provided, which can be an electronic device or a chip or system on chip in the electronic device. The model training device can implement the functions performed by the electronic device in the above aspects or possible designs, and the functions can be implemented by hardware, such as: in a possible design, the model training device may include: a processor and a communication interface, and the processor can be used to support the model training device to implement the functions involved in the above first aspect or any possible design of the first aspect, for example: the processor inputs a first training sample into a multi-task model, the multi-task model includes at least two task modules, and each task module corresponds to a different task type; based on the first task module in the multi-task model, the first training sample is processed to obtain a first processing result; when the first processing result does not match the sample label of the first training sample, the first task module is trained based on the loss function corresponding to the first task module to obtain a trained multi-task model; wherein the first task module is one of the at least two task modules.

[0025] In another possible design, the model training device may further include a memory for storing computer-executable instructions and data necessary for the model training device. When the model training device is running, the processor executes the computer-executable instructions stored in the memory so that the model training device performs the model training method described in the first aspect or any possible design of the first aspect.

[0026] In a fourth aspect, a model training device is provided, which may be a model training device or a chip or system on chip in the model training device. The model training device may implement the functions performed by the model training device in the above aspects or possible designs, and the functions may be implemented by hardware, such as: in one possible design, the model training device may include: a processor and a communication interface, and the processor may be used to support the model training device to implement the functions involved in the above first aspect or any possible design of the first aspect, for example: the processor inputs a first training sample into a multi-task model, the multi-task model includes at least two task modules, and each task module corresponds to a different task type; based on the first task module in the multi-task model, the first training sample is processed to obtain a first processing result; when the first processing result does not match the sample label of the first training sample, the first task module is trained based on the loss function corresponding to the first task module to obtain a trained multi-task model; wherein the first task module is one of the at least two task modules.

[0027] In another possible design, the model training device may further include a memory for storing computer-executable instructions and data necessary for the model training device. When the model training device is running, the processor executes the computer-executable instructions stored in the memory so that the model training device performs the model training method described in the first aspect or any possible design of the first aspect.

[0028] In a fifth aspect, a computer-readable storage medium is provided, which may be a readable non-volatile storage medium, and which stores computer instructions or programs. When the computer-readable storage medium is run on a computer, the computer can execute the model training method described in the first aspect or any possible design of the first aspect.

[0029] In a sixth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the model training method described in the first aspect or any possible design of the above aspects.

[0030] In a seventh aspect, a model training device is provided, which may be a model training device or a chip or system on chip in the model training device, and the model training device includes one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the model training device performs the model training method described in the first aspect or any possible design of the first aspect.

[0031] In an eighth aspect, a chip system is provided, the chip system including a processor and a communication interface, the chip system can be used to implement the functions performed by the model training device in the first aspect or any possible design of the first aspect, for example, the processor is used to train the model through the communication interface. In one possible design, the chip system also includes a memory, the memory is used to store program instructions and / or data. The chip system can be composed of a chip, or it can include a chip and other discrete devices, without limitation.

[0032] Among them, the technical effects brought about by any design method from the second aspect to the eighth aspect can refer to the technical effects brought about by the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A flowchart of a model training method provided in an embodiment of the present application;

[0034] Figure 2 A flowchart of another model training method provided in an embodiment of the present application;

[0035] Figure 3 A flowchart of another model training method provided in an embodiment of the present application;

[0036] Figure 4 A flowchart of another model training method provided in an embodiment of the present application;

[0037] Figure 5 A flowchart of another model training method provided in an embodiment of the present application;

[0038] Figure 6 A structural diagram of a model training method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.

[0041] It should also be understood that the term “comprising” indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or components.

[0042] For power grid, industrial video is the core element supporting smart inspection of power grid, covering various links such as transmission and distribution. Its monitoring devices cover a wide area and the monitoring environment is complex, which brings challenges to high-quality image acquisition. When the camera hardware fails or is affected by environmental factors such as light and climate, the image quality will deteriorate, which brings great difficulties to subsequent risk identification and increases the burden of front-line monitoring and operation personnel. In recent years, deep learning technology has been widely used in image quality assessment tasks. By training deep neural networks, intelligent recognition of image quality can be achieved, and good results have been achieved. However, the existing mainstream image quality assessment model mainly optimizes the model for quality scoring, and cannot determine the type of image quality degradation; because the importance of different degradation types is different, it is related to the decisions made by operation and maintenance personnel, so the quality assessment model needs to output the image degradation type and image quality score through two different task modules respectively.

[0043] In related technologies, learning of multi-task models usually adopts a general model training paradigm, which aims to discover the relationship between tasks and use the knowledge of other tasks to improve the effect of the target task.

[0044] Specifically, in the training process of a multi-task model, multiple related task modules are usually trained simultaneously, and they help each other through gradient back propagation to improve the generalization performance of the multi-task model. For example, according to the different loss values ​​corresponding to different task modules, a loss function is determined to train the entire multi-task model.

[0045] However, since the difficulty of the task types corresponding to each task module in the multi-task model is different, if a fixed training method is used to train the multi-task model, it is impossible to effectively balance the importance of different task modules, resulting in deviations in the optimization direction during the multi-task model training process, which in turn leads to low optimization efficiency of the multi-task model.

[0046] In view of this, an embodiment of the present application provides a model training method for improving the optimization efficiency of a multi-task model. The method includes: inputting a first training sample into a multi-task model, the multi-task model includes at least two task modules, and each task module corresponds to a different task type; based on the first task module in the multi-task model, the first training sample is processed to obtain a first processing result; when the first processing result does not match the sample label of the first training sample, the first task module is trained based on the loss function corresponding to the first task module to obtain a trained multi-task model; wherein the first task module is one of the at least two task modules.

[0047] Based on the above scheme, the electronic device can perform separate training on each task module according to the loss function corresponding to each task module in the multi-task model, thereby improving the training optimization efficiency of the multi-task model.

[0048] The method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0049] The present application embodiment provides a model training method. Figure 1 As shown, the method may include S101 to S103:

[0050] S101: The electronic device inputs a first training sample into a multi-task model.

[0051] In a possible implementation, the multi-task model includes at least two task modules.

[0052] A possible implementation is Figure 2 As shown, the multi-task model may include a feature extraction module, an image degradation recognition module, and an image quality scoring module, namely, the task modules, wherein each task module may be composed of a multi-layer neural perception layer (Multilayer Perceptron, MLP).

[0053] In one example, the feature extraction module may include the multi-layer feature extraction layer, which is used to extract image feature information in the image.

[0054] In one example, the above-mentioned task module may include different convolutional layers, L2 norm layers, or softmax layers.

[0055] In a possible implementation, each of the above task modules corresponds to a different task type.

[0056] In a possible implementation, the above task type is related to each task content.

[0057] In an example, the task type may be an image type, a translation type, a generation type, or the like.

[0058] In one example, the at least two task modules mentioned above may be an image degradation type recognition module and an image quality scoring module; or may be an image text recognition module and a text-to-image conversion module, etc., which is not limited in this application.

[0059] S102: The electronic device processes a first training sample based on a first task module in the multi-task model to obtain a first processing result.

[0060] In a possible implementation, the first task module is one of at least two task modules.

[0061] In a possible implementation, the first training sample is related to a task type corresponding to a task module in the multi-task model.

[0062] In a possible implementation, the first training sample may be selected by a user or randomly acquired by the electronic device.

[0063] In an example, the first training sample may be an image, text, audio, etc.

[0064] In one possible implementation, when the task module is an image degradation type identification module and the first training sample is an image, the above-mentioned first processing result can be a result value of the image degradation type of the image, for example, the result belonging to a certain image degradation type is 0 or 1, or it can be a probability value of the image degradation type of the image, for example, the probability of belonging to a certain image degradation type is 90%.

[0065] In another possible implementation, when the task module is an image quality scoring module and the first training sample is an image, the first processing result may be a scoring value of the image.

[0066] S103: When the first processing result does not match the sample label of the first training sample, the electronic device trains the first task module based on the loss function corresponding to the first task module to obtain a trained multi-task model.

[0067] In a possible implementation, the sample label of the first training sample is used to characterize sample information of the training sample.

[0068] In one example, when the first training sample is an image, the sample label may be an image degradation type of the image or a quality score value of the image.

[0069] In some embodiments, when the first training sample is a first image and the first task module is used to identify the image degradation type of the image, S102 may be implemented by the following S102a, and S103 may be implemented by the following S103a:

[0070] S102a: The electronic device processes image feature information of the first image based on the first task module to obtain a first image degradation type of the first image.

[0071] In a possible implementation, the electronic device extracts features from the first training sample, that is, the first image, through a feature extraction module in the multi-task model to obtain image feature information of the first image. This process can be formalized as formula (1):

[0072]

[0073] Where F(x) represents the function corresponding to the feature extraction module, x represents the first input image, is the extracted image feature information.

[0074] In a possible implementation, the electronic device may predict the image quality degradation type of the extracted image feature information of the first image through a first task module, i.e., the task module for identifying the image degradation type of the image, to obtain the image degradation type of the final first image, i.e., the first image degradation type. The process may be formalized as formula (2):

[0075]

[0076] Where C(x) represents the function corresponding to the task module for identifying the image degradation type of the image, is the predicted quality degradation type.

[0077] In an example, the above-mentioned image degradation type may include at least one of the following: mosaic, blur, and false contour.

[0078] S103b: When the first image degradation type does not match the image degradation type indicated by the sample label of the first image, the electronic device trains the first task module based on the cross entropy training loss function corresponding to the first task module.

[0079] In a possible implementation, the first image degradation type does not match the image degradation type indicated by the sample label of the first image, and the first image degradation type may be mosaic, while the image degradation type indicated by the sample label is false contour. Alternatively, the first image degradation type is blur, while the image degradation type indicated by the sample label is mosaic.

[0080] In a possible implementation, the electronic device adjusts the module parameters of the task module for identifying the image degradation type and / or the feature extraction module by using a multi-category cross entropy loss function, that is, the loss function corresponding to the above-mentioned task module. The specific loss function can be expressed as formula (3):

[0081]

[0082] Where K represents the number of image degradation types. represents the predicted probability that the first input image belongs to the i-th class, y i ∈{0,1} indicates that the first input image belongs to the type value indicated in the sample label of the i-th class.

[0083] In a possible implementation, the first image feature information can be converted into probability values ​​of various types through a fully connected layer and a Softmax layer in the task module, and combined with the sample label of the image to obtain the classification cross entropy loss of the task module. Then, the electronic device trains the task module based on the classification cross entropy loss of the task module.

[0084] In some other embodiments, when the first training sample is a first image and the first task module is used to calculate the image quality score of the image, S102 may be implemented by the following S102a, and S103 may be implemented by the following S103a:

[0085] S102a: The electronic device processes image feature information of the first image based on the first task module to obtain a first image quality score of the first image.

[0086] In a possible implementation, the electronic device calculates the image quality score of the input first image through a feature advance module and a task module for calculating the image quality score of the image. The process can be formalized as formula (4):

[0087]

[0088] Where R(x) represents the function corresponding to the task module for calculating the image quality score of the image. The network can use but is not limited to multiple MLP layers. The image quality score of the first image predicted by the task module.

[0089] S103b: When the first image quality score does not match the image quality score indicated by the sample label of the first image, the electronic device trains the first task module based on a mean square error training loss function corresponding to the first task module.

[0090] In a possible implementation, the mismatch between the first image quality score and the image quality score indicated by the sample label of the first image may be that the first image quality score is different from the image quality score indicated by the sample label, or the difference between the first image quality score and the image quality score indicated by the sample label is greater than a predetermined threshold.

[0091] In one example, the predetermined threshold may be a user-defined setting or may be customized by the electronic device.

[0092] In a possible implementation, the electronic device adjusts the module parameters of the task module for calculating the image quality score of the image and / or the feature extraction module through a mean square error loss function, that is, the loss function corresponding to the above-mentioned task module. The specific loss function can be expressed as formula (5):

[0093]

[0094] Where N represents the number of input images. represents the image quality score of the predicted input image, i.e., the first image, s i represents the image quality score indicated by the sample label of the input i-th image, that is, the first image.

[0095] Based on the above technical solution, the first training sample is input into the multi-task model, and the multi-task model includes at least two task modules, and each task module corresponds to a different task type; based on the first task module in the multi-task model, the first training sample is processed to obtain a first processing result; when the first processing result does not match the sample label of the first training sample, the first task module is trained based on the loss function corresponding to the first task module to obtain a trained multi-task model; wherein the first task module is one of the at least two task modules. In this solution, the electronic device can perform separate training on each task module according to the loss function corresponding to each task module in the multi-task model in a targeted manner, thereby improving the training optimization efficiency of the multi-task model.

[0096] In one possible way, since the multi-task model contains multiple task types, the optimization goal of the classification task is the discretization of the feature space, while the feature space of the regression task is continuous, the optimization difficulty of the two is lower than that of the classification task. Therefore, similar to the process of human learning new things, if the training of the multi-task model is from easy to difficult, the optimization efficiency will be higher. Therefore, in an embodiment of the present application, taking into account the difficulty of each task module in the multi-task model, each task module can be arranged in the training order, so as to more efficiently complete the training optimization of the multi-task model.

[0097] In some embodiments, in combination Figure 1 ,like Figure 3 As shown, before the above S102, the method provided in the embodiment of the present application may further include S201 and S202:

[0098] S201. The electronic device determines a training order of at least two task modules based on a module parameter of each task module.

[0099] In a possible implementation, the module parameters include at least one of the following: a parameter for indicating the complexity of the task module, and type information of the task type corresponding to the task module.

[0100] In an example, the parameter of the complexity of the task module may be at least one of the following: a task parameter of the task module, an input data parameter, and an output data parameter.

[0101] In an example, the type information of the task type corresponding to the above-mentioned task module may be at least one of the following: a classification task type and a regression task type.

[0102] S202: The electronic device trains all or part of the task modules in at least two task modules according to a training sequence.

[0103] In a possible implementation, when the electronic device trains the task modules according to the training sequence, if a task module in the training sequence does not need to be trained, the task module is skipped and the training continues with the next task module.

[0104] In some embodiments, in combination Figure 3 ,like Figure 4 As shown, the above S202 can be implemented by the following S202a:

[0105] S202a: The electronic device locks the module parameters of a task module after training a task module in the multi-task model according to the training sequence.

[0106] In a possible implementation, after the electronic device is trained as a task module, the module parameters of the task module will be fixed, the module parameters of the task module will no longer be adjusted, and the task module will no longer be used to process feature information.

[0107] based on Figure 3 and Figure 4 The technical solution fully considers the difficulty of different tasks in the process of multi-task model training, and trains single-task modules from easy to difficult in the early stage, thereby reducing the difficulty of model training and effectively improving model optimization efficiency and prediction effect.

[0108] In some embodiments, in combination Figure 1 ,like Figure 5 As shown, after the above S103, the method provided in the embodiment of the present application may further include S301:

[0109] S301. The electronic device trains the trained multi-task model based on the model training loss function.

[0110] In one possible implementation, the above-mentioned model training loss function is determined based on the loss function corresponding to each task module in the multi-task model.

[0111] In a possible implementation, the above-mentioned model training loss function is a loss function obtained by adding weighted loss functions corresponding to each module.

[0112] In a possible implementation, the multi-category cross entropy loss function and the mean square error loss function adjust the parameters of each task module in the feature extraction module and the multi-task model. The overall loss function calculation method is shown in formula (6):

[0113] L=α*L class +(1-α)*L reg (6)

[0114] Among them, L class is the classification loss, i.e., the loss of the classification task module, for example, the loss of the task module for identifying the image degradation type of an image, L reg is the regression loss, that is, the loss of the regression task module, for example, the loss of the task module used to calculate the image quality score of the image, and α is the weight for balancing the two losses.

[0115] based on Figure 5 A technical solution is used to reduce the difficulty of model training and effectively improve the model optimization efficiency and prediction effect by conducting single-task network training from easy to difficult in the early stage and jointly training multiple task modules in the multi-task model in the later stage during the multi-task model training process.

[0116] The various solutions in the above embodiments of the present application can be combined without contradiction.

[0117] The embodiment of the present application can divide the model training device into functional modules or functional units according to the above method example. For example, each functional module or functional unit can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules or functional units. Among them, the division of modules or units in the embodiment of the present application is schematic, which is only a logical function division, and there may be other division methods in actual implementation.

[0118] In the case of dividing each functional module into corresponding functional modules, Figure 6 A schematic structural diagram of a model training device 700 is shown. The model training device 700 may be an electronic device or a chip applied to an electronic device. The model training device 700 may be used to execute the functions of the electronic device involved in the above-mentioned embodiments. Figure 6 The model training device 700 shown may include a processing unit 701 , a training unit 702 , and a determination unit 703 .

[0119] The processing unit 701 is used to input the first training sample into a multi-task model, where the multi-task model includes at least two task modules, and each task module corresponds to a different task type;

[0120] The processing unit 701 is further configured to process the first training sample based on the first task module in the multi-task model to obtain a first processing result;

[0121] The training unit 702 is used to train the first task module based on the loss function corresponding to the first task module when the first processing result processed by the processing unit 701 does not match the sample label of the first training sample, so as to obtain a trained multi-task model; wherein the first task module is one of the at least two task modules.

[0122] In one possible implementation, the determination unit 703 is used for the processing unit 701 to process the first training sample based on the first task module in the multi-task model, and before obtaining the first processing result, determine the training order of at least two task modules based on the module parameters of each task module, and the module parameters include at least one of the following: a parameter indicating the complexity of the task module, and type information of the task type corresponding to the task module; the training unit 702 is also used to train all or part of the at least two task modules according to the training order determined by the determination unit 703.

[0123] In a possible implementation, the training unit 702 is specifically configured to lock the module parameters of a task module in the multi-task model after training the task module in the multi-task model in accordance with the training sequence.

[0124] In one possible implementation, the first training sample is a first image; the first task module is used to identify the image degradation type of the image; the training unit 702 is specifically used to process the image feature information of the first image based on the first task module to obtain the first image degradation type of the first image, and when the first image degradation type does not match the image degradation type indicated by the sample label of the first image, the first task module is trained based on the cross entropy training loss function corresponding to the first task module.

[0125] In one possible implementation, the first training sample is a first image; the first task module is used to calculate the image quality score of the image; the training unit 702 is specifically used to process the image feature information of the first image based on the first task module to obtain a first image quality score of the first image, and when the first image quality score does not match the image quality score indicated by the sample label of the first image, the first task module is trained based on the mean square error training loss function corresponding to the first task module.

[0126] In one possible implementation, the training unit 702 is further used to train the first task module based on the loss function corresponding to the first task module to obtain the trained multi-task model, and is further used to train the trained multi-task model based on the model training loss function; wherein the model training loss function is determined based on the loss function corresponding to each task module in the multi-task model.

[0127] As another possible way to achieve this, Figure 6 The processing unit 701 and the training unit 702 in the embodiment can be replaced by a processor, which can integrate the functions of the processing unit 701 and the training unit 702.

[0128] The present application embodiment also provides a computer-readable storage medium. All or part of the processes in the above method embodiments can be completed by a computer program to instruct the relevant hardware, and the program can be stored in the above computer-readable storage medium. When the program is executed, it may include the processes of the above method embodiments. The computer-readable storage medium can be an internal storage unit of the model training device of any of the aforementioned embodiments, such as a hard disk or memory of the model training device. The above computer-readable storage medium can also be an external storage device of the above terminal device, such as a plug-in hard disk equipped on the above terminal device, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. Further, the above computer-readable storage medium can also include both the internal storage unit of the above model training device and an external storage device. The above computer-readable storage medium is used to store the above computer program and other programs and data required for the above model training device. The above computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.

[0129] It should be noted that the terms "first" and "second" in the specification, claims and drawings of the present application are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.

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

[0131] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0132] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0133] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0134] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0135] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks or optical disks.

[0136] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A model training method, It is characterized in that Applied to electronic equipment, the method comprises: Inputting the first training sample into a multi-task model, wherein the multi-task model includes at least two task modules, each task module corresponding to a different task type; Based on the first task module in the multi-task model, processing the first training sample to obtain a first processing result; In a case where the first processing result does not match the sample label of the first training sample, training the first task module based on the loss function corresponding to the first task module to obtain a trained multi-task model; The first task module is one of the at least two task modules.

2. The method according to claim 1, It is characterized in that Before the first task module in the multi-task model processes the first training sample to obtain a first processing result, the method further includes: Determining the training order of the at least two task modules based on the module parameters of each of the task modules, the module parameters comprising at least one of the following: a parameter indicating the complexity of the task module, type information of the task type corresponding to the task module; According to the training sequence, all or part of the at least two task modules are trained.

3. The method according to claim 2, It is characterized in that The step of training all or part of the at least two task modules in the training sequence includes: According to the training sequence, after each task module in the multi-task model is trained, the module parameters of the task module are locked.

4. The method according to claim 1, It is characterized in that The first training sample is a first image; the first task module is used to identify the image degradation type of the image; The first task module in the multi-task model is used to process the first training sample to obtain a first processing result, and when the first processing result does not match the sample label of the first training sample, the first task module is trained based on the loss function corresponding to the first task module, including: Based on the first task module, image feature information of the first image is processed to obtain a first image degradation type of the first image. When the first image degradation type does not match the image degradation type indicated by the sample label of the first image, the first task module is trained based on the cross entropy training loss function corresponding to the first task module.

5. The method according to claim 1, It is characterized in that The first training sample is a first image; the first task module is used to calculate the image quality score of the image; The first task module in the multi-task model is used to process the first training sample to obtain a first processing result, and when the first processing result does not match the sample label of the first training sample, the first task module is trained based on the loss function corresponding to the first task module, including: Based on the first task module, image feature information of the first image is processed to obtain a first image quality score of the first image. When the first image quality score does not match the image quality score indicated by a sample label of the first image, the first task module is trained based on a mean square error training loss function corresponding to the first task module.

6. The method according to claim 1, It is characterized in that After training the first task module based on the loss function corresponding to the first task module to obtain a trained multi-task model, the method further includes: Based on the model training loss function, training the trained multi-task model; The model training loss function is determined based on the loss function corresponding to each task module in the multi-task model.

7. A model training device, It is characterized in that Applied to electronic equipment, the device comprises: a processing unit and a training unit; The processing unit is used to input the first training sample into a multi-task model, wherein the multi-task model includes at least two task modules, and each task module corresponds to a different task type; The processing unit is further used to process the first training sample based on the first task module in the multi-task model to obtain a first processing result; The training unit is configured to train the first task module based on the loss function corresponding to the first task module to obtain a trained multi-task model when the first processing result processed by the processing unit does not match the sample label of the first training sample; The first task module is one of the at least two task modules.

8. The device according to claim 7, It is characterized in that The device further comprises: a determination unit; The determining unit is used for the processing unit to process the first training sample based on the first task module in the multi-task model, and before obtaining the first processing result, determine the training order of the at least two task modules based on the module parameters of each of the task modules, wherein the module parameters include at least one of the following: a parameter indicating the complexity of the task module, and type information of the task type corresponding to the task module; The training unit is further used to train all or part of the at least two task modules according to the training sequence determined by the determination unit.

9. The device according to claim 7, It is characterized in that The training unit is specifically used to lock the module parameters of a task module in the multi-task model after training the task module in the multi-task model according to the training sequence.

10. The device according to claim 7, It is characterized in that The first training sample is a first image; the first task module is used to identify the image degradation type of the image; The training unit is specifically used to process the image feature information of the first image based on the first task module to obtain a first image degradation type of the first image, and when the first image degradation type does not match the image degradation type indicated by the sample label of the first image, train the first task module based on the cross entropy training loss function corresponding to the first task module.

11. The device according to claim 7, It is characterized in that The first training sample is a first image; the first task module is used to calculate the image quality score of the image; The training unit is specifically used to process the image feature information of the first image based on the first task module to obtain a first image quality score of the first image, and when the first image quality score does not match the image quality score indicated by the sample label of the first image, train the first task module based on the mean square error training loss function corresponding to the first task module.

12. The device according to claim 7, It is characterized in that The training unit is also used to train the first task module based on the loss function corresponding to the first task module to obtain a trained multi-task model, and is also used to train the trained multi-task model based on the model training loss function; wherein the model training loss function is determined based on the loss function corresponding to each task module in the multi-task model.

13. A computer-readable storage medium, It is characterized in that The readable storage medium stores instructions, and when the instructions are executed, the model training method as described in any one of claims 1-6 is implemented.

14. A model training device, It is characterized in that include: A processor, a memory and a communication interface; wherein the communication interface is used for communication with the model training device; The memory is used to store one or more programs, which include computer-executable instructions. When the model training device is running, the processor executes the computer-executable instructions stored in the memory so that the model training device performs the method described in any one of claims 1-6.