Lightweight model training method, image processing method, lightweight model training device, image processing device, electronic device, storage medium, and computer program

The lightweight model training method addresses underfitting by using data augmentation and dynamic loss function adjustments, enhancing the accuracy and generalization of lightweight models.

JP7566969B2Active Publication Date: 2024-10-15BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2023070644
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2022-08-30
Filing Date
2023-04-24
Publication Date
2024-10-15
Estimated Expiration
2043-04-24

AI Technical Summary

Technical Problem

Knowledge distillation methods for lightweight models often lead to underfitting, reducing model accuracy and non-convergence, as they do not adequately consider the fitting state of the student model during training.

Method used

A lightweight model training method that involves data augmentation, determining expanded probabilities and target weights for each iteration, and dynamically adjusting the distillation and true value loss functions to improve model accuracy.

Benefits of technology

The method effectively avoids underfitting and enhances the training accuracy of lightweight models by improving the generalization ability and accuracy through dynamic adjustment of loss functions and data augmentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007566969000017
    Figure 0007566969000017
  • Figure 0007566969000018
    Figure 0007566969000018
  • Figure 0007566969000019
    Figure 0007566969000019
Patent Text Reader

Abstract

To provide a lightweight model training method, an image processing method, a lightweight model training apparatus, an image processing apparatus, an electronic device, a storage medium, and a computer program for improving training accuracy of a lightweight model.SOLUTION: A lightweight model training method includes: acquiring first and second augmentation probabilities and a target weight adopted in an e-th iteration being weight of a distillation term loss value; performing data augmentation on a data set based on the first and second augmentation probabilities respectively, to obtain first and second data sets; obtaining a first output value of a student model and a second output value of a teacher model based on the first data set; obtaining third and fourth output values based on the second data set; determining a distillation loss function; determining a truth-value loss function; and determining a target loss function; and training the student model based on the target loss function, and determining a first augmentation probability or a target weight to be adopted in an (e+1)-th iteration.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present disclosure relates to the field of computer technology, and in particular to fields such as machine learning, computer vision, and image processing. [Background technology]

[0002] Knowledge distillation is a common method of model compression, which refers to using a more accurate teacher model to guide the training process of a student model so that the student model can obtain similar accuracy metrics to the teacher model. Knowledge distillation itself has a regularization effect, and training an overfitted model using the knowledge distillation method can avoid overfitting to a certain extent. However, for some lightweight models, training using the knowledge distillation strategy may result in further underfitting, leading to reduced model accuracy and model non-convergence. Summary of the Invention [Problem to be solved by the invention]

[0003] The present disclosure provides a lightweight model training method, an image processing method, a lightweight model training apparatus, an image processing apparatus, an electronic device, a storage medium, and a computer program. [Means for solving the problem]

[0004] In a first aspect of the present disclosure, a lightweight model training method is provided, the method including: obtaining a first augmented probability, a second augmented probability, and a target weight, which is a weight of a distilled term loss value, to be used in an e-th iteration, where e is a positive integer less than or equal to E, which is a maximum iteration number, and E is a positive integer greater than 1; performing data augmentation on a dataset based on the first augmented probability and the second augmented probability, respectively, to obtain a first dataset and a second dataset; obtaining a first output value of a student model, which is a lightweight model, and a second output value of a teacher model based on the first dataset, and obtaining a third output value of the student model and a fourth output value of the teacher model based on the second dataset; determining a distilled loss function based on the first output value and the second output value, and determining a true value loss function based on the third output value and the fourth output value; determining a target loss function based on the distilled loss function and the true value loss function; training the student model based on the target loss function, and determining the first augmented probability or the target weight to be used in the e+1-th iteration if e is less than E.

[0005] In a second aspect of the present disclosure, there is provided an image processing method, the method including: receiving a target image of a target scene; inputting the target image to a student model; and obtaining a processing result for the target image output by the student model, where the student model is obtained using the lightweight model training method provided by the first aspect.

[0006] In a third aspect of the present disclosure, a lightweight model training apparatus is provided, the apparatus including: a first acquisition module for acquiring a first augmentation probability, a second augmentation probability, and a target weight, which is a weight of a distillation term loss value, used in an e-th iteration, where e is a positive integer equal to or smaller than E, which is a maximum number of iterations, and E is a positive integer greater than 1; a data augmentation module for performing data augmentation on a dataset based on the first augmentation probability and the second augmentation probability, respectively, to obtain a first dataset and a second dataset; and a data augmentation module for obtaining a first output value of a student model and a second output value of a teacher model, which are lightweight models, based on the first dataset, and The method includes: a prediction module for obtaining a third output value of the student model and a fourth output value of the teacher model based on two data sets; a first determination module for determining a distilled loss function based on the first output value and the second output value and for determining a true value loss function based on the third output value and the fourth output value; a second determination module for determining a target loss function based on the distilled loss function and the true value loss function; a training module for training the student model based on the target loss function; and a third determination module for determining a first extended probability or target weight to be used for the e+1th iteration when e is less than E.

[0007] In a fourth aspect of the present disclosure, there is provided an image processing apparatus, comprising: a receiving module for receiving a target image in a target scene; and a processing module for inputting the target image to a student model and obtaining a processing result for the target image output by the student model, where the student model is obtained using the lightweight model training method provided by the first aspect.

[0008] In a fifth aspect of the present disclosure, there is provided an electronic device comprising at least one processor and a memory in communication with the at least one processor, the memory storing instructions executable by the at least one processor which, when executed by the at least one processor, cause the at least one processor to perform a method provided by the first and / or second aspect above.

[0009] In a sixth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the method provided in the first and / or second aspect above.

[0010] In a seventh aspect of the present disclosure, there is provided a computer program which, when executed by a processor, implements the method provided according to the first and / or second aspect above.

[0011] According to the technical solution of this embodiment, the training accuracy of the lightweight model can be improved.

[0012] It should be understood that the contents described herein are not intended to describe key or important features of the embodiments of the present disclosure, nor are they used to limit the scope of the present disclosure, other features of the present disclosure are encouraged to be described throughout the following specification. [Brief description of the drawings]

[0013] In the accompanying drawings, unless otherwise specified, the same reference numerals in several drawings indicate the same or similar parts or elements. The drawings are not necessarily drawn to scale. It should be understood that the drawings illustrate only some embodiments disclosed by the present application and should not be considered as limiting the scope of the present application. [Figure 1] FIG. 1 is a schematic diagram illustrating a flow of a lightweight model training method according to an embodiment of the present disclosure. [Diagram 2] FIG. 1 is a schematic diagram illustrating a flow of training a lightweight model based on knowledge distillation according to an embodiment of the present disclosure. [Diagram 3] FIG. 2 is a schematic diagram illustrating a flow of an image processing method according to an embodiment of the present disclosure. [Figure 4] FIG. 1 is a schematic diagram showing a configuration of a lightweight model training device according to an embodiment of the present disclosure. [Diagram 5] FIG. 1 is a schematic diagram illustrating a configuration of an image processing device according to an embodiment of the present disclosure. [Figure 6] FIG. 1 is a schematic diagram illustrating a training scene for a lightweight model according to an embodiment of the present disclosure. [Figure 7] FIG. 1 is a schematic diagram illustrating an image processing scene according to an embodiment of the present disclosure. [Figure 8] FIG. 1 is a block diagram of an electronic device for implementing a lightweight model training method or an image processing method according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0014] In the following, exemplary embodiments of the present disclosure will be described in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure for ease of understanding, but these should be considered as merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, in the following description, well-known functions and configurations are omitted for clarity and simplicity.

[0015] In the embodiments of the present disclosure, terms such as "first", "second", etc. are not used to indicate a particular order or context, but are used to distinguish between similar objects. Furthermore, terms such as "comprise", "have", and other similar terms are used in a non-exclusive sense. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units specified, and may include other steps or units that are not specified or are inherent to the process, method, product, or device.

[0016] Among the related technologies, knowledge distillation methods mainly include model output-based distillation, i.e., using the output of a teacher model to directly supervise the output of a student model; intermediate layer feature-based distillation, i.e., using the intermediate feature map of a teacher model to monitor the output of the intermediate feature map of a student model; and relationship-based distillation, i.e., taking into account metrics such as the similarity of the teacher model to different samples and the differences of the student model, and guiding the training of the student model based on this.

[0017] For the above knowledge distillation method, the design and selection of the distillation loss function and feature selection process are often carried out, but there is little research on the fitting state of the student model.

[0018] In the knowledge distillation process, the loss function includes a loss function for the distillation task (which can be called the knowledge distillation loss function) and a true value loss function (which can be called the true value loss function), where the knowledge distillation loss function can increase the generalization performance of the model and exert the effect of regularization, while the true value loss function can make the model converge quickly.

[0019] Deep learning tasks generally involve a large amount of data augmentation to improve the generalization performance of the model, but in the training process, it is generally necessary to ensure that the operation and probability of data augmentation do not change, which is likely to bring inconsistency to the model training process. In addition, in the early training stage, the goal of model training is to converge faster, and in the later training stage, the goal of model training is to generalize better, so if data augmentation is kept unchanged, the goals of the two training stages cannot be met simultaneously.

[0020] Current knowledge distillation algorithms do not consider the fitting state of the student model, and when a teacher model is used to supervise the output of the student model, it is easy for an underfitting state to occur in the knowledge distillation process of a small model, thereby reducing the accuracy of the model.

[0021] The present disclosure is made to at least partially address one or more of the above problems and other potential problems, and proposes a lightweight model training scheme that can effectively avoid the underfitting phenomenon that occurs when training a lightweight model using a knowledge distillation strategy, improve the training accuracy of the lightweight model, and improve the accuracy of knowledge distillation of the lightweight model.

[0022] An embodiment of the present disclosure provides a lightweight model training method, and FIG. 1 is a schematic diagram showing a flow of the lightweight model training method applicable to a lightweight model training device according to an embodiment of the present disclosure. The lightweight model training device may be disposed in an electronic device, including but not limited to a fixed device and / or a mobile device. For example, the fixed device includes but is not limited to a server, and the server may be a cloud server or a normal server. For example, the mobile device includes but is not limited to one or more terminals of a mobile phone, a tablet. In some possible implementations, the lightweight model training method may be realized by a processor calling a computer-readable instruction stored in a memory. As shown in FIG. 1, the lightweight model training method includes the following steps.

[0023] In S101, the first extension probability, the second extension probability, and the target weights, which are weights of the distillation term loss value, to be used in the e-th iteration are obtained, where e is a positive integer less than or equal to E, which is the maximum number of iterations, and E is a positive integer greater than 1.

[0024] In S102, data augmentation is performed on the data sets based on the first and second augmentation probabilities, respectively, to obtain a first data set and a second data set.

[0025] In S103, a first output value of the student model and a second output value of the teacher model are obtained based on the first data set, and a third output value of the student model and a fourth output value of the teacher model are obtained based on the second data set, where the student model is a lightweight model.

[0026] In S104, a distillation loss function is determined based on the first output value and the second output value, and a true value loss function is determined based on the third output value and the fourth output value.

[0027] In S105, a target loss function is determined based on the distilled loss function and the true value loss function.

[0028] At S106, a student model is trained based on the target loss function, and if e is less than E, a first extended probability or target weight to be used for the e+1th iteration is determined.

[0029] In the embodiment of the present disclosure, the student model is used to perform image processing. The present disclosure does not limit the function of the student model according to its own scene and application. For example, the student model is used for image classification. Also, for example, the student model is used for image recognition. As another example, the student model is used for target detection. The above is only an exemplary description, and does not limit all possible function types of the student model, which will not be listed here.

[0030] In the embodiment of the present disclosure, the teacher model is a model that has already been trained. Note that the present disclosure does not limit the size of the teacher model, and the teacher model may be a large-scale model or a small-scale model.

[0031] In the embodiment of the present disclosure, the value of E may be set according to requirements such as speed requirements and accuracy requirements.

[0032] In an embodiment of the present disclosure, the second expansion probability is a different value from the first expansion probability. Typically, the value of the second expansion probability is greater than the value of the first expansion probability.

[0033] In an embodiment of the present disclosure, the total loss function includes a distillation term loss and a true value term loss, where the weight of the distillation term loss is α, and the weight of the true value term loss is 1-α.

[0034] In an embodiment of the present disclosure, before the e-th iteration starts, the dataset input to the e-th iteration may be a set based on the first and second datasets generated in the e-1-th iteration, a partial set based on the first and second datasets generated in the e-1-th iteration, or the original dataset. The above is merely an exemplary description and is not intended to limit and will not be enumerated here for all possible types of data included in the dataset input to the e-th iteration.

[0035] In an embodiment of the present disclosure, data augmentation is used to increase the amount of data in a dataset (also called a training set), which can increase the diversity of the dataset and reduce overfitting to improve the generalization ability of the model.

[0036] In the embodiments of the present disclosure, how to determine the distilled loss function, the true loss function, and the target loss function will be described in detail in the subsequent embodiments, and will not be described further here.

[0037] In the embodiment of the present disclosure, the network structure of the student model may include Convolutional Neural Networks (CNN), transformer. The above is merely an exemplary description, and does not limit all possible types of networks included in the student model, which will not be listed here.

[0038] The technical solution described in the embodiment of the present disclosure obtains a first extension probability, a second extension probability, and a target weight to be used in the e-th iteration, and performs data augmentation on the dataset based on the first extension probability and the second extension probability, respectively, to obtain a first dataset and a second dataset, obtain a first output value of a student model and a second output value of a teacher model, which are lightweight models, based on the first dataset, obtain a third output value of the student model and a fourth output value of the teacher model based on the second dataset, determine a distilled loss function based on the first output value and the second output value, determine a true value loss function based on the third output value and the fourth output value, determine a target loss function based on the distilled loss function and the true value loss function, train the student model based on the target loss function, and determine the first extension probability or the target weight to be used in the e+1-th iteration when e is less than E. In this way, the data augmentation can increase the diversity of the dataset, reduce overfitting, and improve the generalization ability of the lightweight model. At the same time, when e is less than E, determining the first expansion probability or target weight to be used in the e+1th iteration can dynamically adjust the first expansion probability or target weight during the entire training process, effectively avoiding the underfitting phenomenon that occurs when training a lightweight model using a knowledge distillation strategy, and thereby improving the training accuracy of the model.

[0039] In some embodiments, the lightweight model training method may further include the following steps.

[0040] In S107, the maximum extension probability is obtained, and a second extension probability is determined based on the maximum extension probability, the maximum number of iterations, and the first extension probability.

[0041] In an embodiment of the present disclosure, the first expansion probability is p i , the maximum expansion probability is p aug ,When the maximum number of iterations is E, the second expansion probability is,

number

[0042] Here, the maximum expansion probability may be set or adjusted according to requirements such as speed requirements, accuracy requirements, or generalization ability requirements.

[0043] In an embodiment of the present disclosure, S107 is executed before S101.

[0044] The present disclosure does not limit the manner of obtaining the maximum extension probability, for example, by receiving the training-related parameters through a user interface, or by receiving the training-related parameters transmitted from a terminal, the training-related parameters including the maximum extension probability. The above is merely an exemplary description, and is not intended to limit all possible sources of the maximum extension probability, which will not be listed here.

[0045] The set value of the maximum expansion probability may be different for each student model.

[0046] In this way, the determined second extension probability can be associated with both the first extension probability and the maximum number of iterations, and also with the maximum extension probability, which can improve the generalizability and accuracy of the second dataset, and the determined third output value output by the student model and the fourth output value output by the teacher model can be made more accurate, which helps to improve the accuracy of the selection of the target loss function, and thus helps to improve the training accuracy of the lightweight model.

[0047] In some embodiments, determining the first extension probability to be used for the e+1th iteration includes determining the first extension probability to be used for the e+1th iteration based on the maximum extension probability, the maximum number of iterations, and the first extension probability for the eth iteration.

[0048] In the embodiment of the present disclosure, the first extended probability to be used in the e+1th iteration is

number

[0049] In this way, the determined first extension probability can be associated with both the previous first extension probability and the maximum number of iterations, as well as the maximum extension probability, which can improve the generalizability and accuracy of the first dataset, and the determined first output value output by the student model and the second output value output by the teacher model can be made more accurate, which helps to improve the accuracy of the selection of the target loss function, and ultimately helps to improve the training accuracy of the lightweight model.

[0050] In some embodiments, the lightweight model training method may further include, at S108, obtaining a maximum target weight.

[0051] In an embodiment of the present disclosure, S108 is executed before S101. S108 may be executed before S107, S108 may be executed after S107, or S108 may be executed simultaneously with S107.

[0052] The present disclosure is not limited to the method of obtaining the maximum target weight, for example, receiving the training-related parameters through a user interface, or receiving the training-related parameters transmitted from a terminal, where the training-related parameters include the maximum target weight. The above is merely an exemplary description, and is not intended to limit all possible ways of obtaining the maximum target weight, which will not be listed here.

[0053] The maximum target weight setting may be different for each student model.

[0054] In some embodiments, determining the target weight to be used for the e+1th iteration includes determining the target weight to be used for the e+1th iteration based on a maximum target weight, a maximum number of iterations, and the eth target weight.

[0055] In the embodiment of the present disclosure, the maximum target weight to be used in the e+1th iteration is

number

[0056] In this way, the determined target weights can be related to both the previous target weights and the maximum iteration number, as well as to the maximum target weight, which helps to improve the accuracy of the target loss function selection and thus the training accuracy of the lightweight model.

[0057] In an embodiment of the present disclosure, determining a target loss function based on the distilled loss function and the true value loss function determines the distilled loss function as the target loss function if the target weight is greater than or equal to the maximum target weight or if the distilled loss function is greater than or equal to the true value loss function, while otherwise determining the true value loss function as the target loss function.

number

number

[0058] In this way, during the training process, an appropriate target loss function can be selected according to the training situation, which is helpful in improving the training accuracy of the lightweight model.

[0059] In an embodiment of the present disclosure, determining the distilled loss function based on the first output value and the second output value includes determining the distilled loss function based on the following equation:

number

[0060] In this way, the distilled loss function can be determined quickly and can be associated with the target weights and the maximum number of iterations, which helps to improve the accuracy of the distilled loss function and thus the training accuracy of the lightweight model.

[0061] In an embodiment of the present disclosure, determining a true value loss function based on a third output value and a fourth output value includes determining the truth value loss function based on the following formula.

Number

[0062] Thereby, the true value loss function can be determined quickly, the true value loss function can be associated with the target weight and the maximum number of iterations, which helps to improve the accuracy of the true value loss function, and ultimately helps to improve the training accuracy of the lightweight model.

[0063] FIG. 2 is a schematic diagram showing the flow of training of a lightweight model based on knowledge distillation. As shown in FIG. 2, the flow includes the following.

[0064] In S201, a student model (Fs) and a teacher model (Ft) are defined, the maximum number of iterations E is defined, and the initial number of iterations e = 1 is defined.

[0065] Here, the teacher model is a pre-trained model.

Number

Number

Number

[0066] In S209, perform model backpropagation and gradient update on the student model based on the target loss function.

[0067] In S210, determine whether e < E is satisfied. If YES, set e = e + 1 and return to step S202. Otherwise, execute S211.

[0068] In S211, save the model and end the iteration.

[0069] In this way, in the process of lightweight model training based on knowledge distillation, we propose to dynamically adjust model parameters related to regularization, such as the weight of the distillation loss function and the probability of data augmentation, in the training process, taking into account the impact of the data augmentation probability and the distillation loss function weight on the training process, and finally improve the accuracy of lightweight model knowledge distillation.

[0070] The above process flow can be integrated with any knowledge distillation algorithm and applied to different vision tasks, including but not limited to image processing such as image recognition, image classification, target detection, and image segmentation.

[0071] It should be understood that the flowchart shown in FIG. 2 is merely schematic and not limiting, and a person skilled in the art can make various obvious modifications and / or substitutions based on the example of FIG. 2, and the resulting technical solutions still fall within the disclosure scope of the embodiments of the present disclosure.

[0072] Based on the student model trained by the above-mentioned lightweight model training method, an embodiment of the present disclosure discloses an image processing method that is applied to electronic devices, including but not limited to computers, mobile phones, tablets, etc., and the present disclosure is not limited to the type of electronic device. As shown in Figure 3, the image processing method includes the following steps:

[0073] In S301, an image to be processed in a target scene is received.

[0074] In S302, the processing target image is input to the student model, and the processing result for the processing target image output by the student model is obtained.

[0075] Here, the student model is obtained using the lightweight model training method shown in FIG.

[0076] In this way, the accuracy of image processing can be improved by performing image processing using a trained student model.

[0077] In some embodiments, receiving the image to be processed in the target scene includes at least one of: acquiring the image to be processed in an image classification scene; acquiring the image to be processed in an image recognition scene; and acquiring the image to be processed in a target detection scene.

[0078] Target scenes include, but are not limited to, those listed above, and it should be understood that any scene relevant to image processing can be a target scene and will not be listed here.

[0079] In this manner, the trained student model can be used to process images in different target scenes, thus improving the image processing capabilities of the student model.

[0080] In an embodiment of the present disclosure, a lightweight model training apparatus is provided, and as shown in FIG. 4 , the apparatus includes a first acquisition module 401 for acquiring a first augmentation probability, a second augmentation probability, and a target weight, which is a weight of a distillation term loss value, used in an e-th iteration, where e is a positive integer less than or equal to E, which is a maximum number of iterations, and E is a positive integer greater than 1; a data augmentation module 402 for performing data augmentation on a dataset based on the first augmentation probability and the second augmentation probability, respectively, to obtain a first dataset and a second dataset; and a data augmentation module 403 for obtaining a first output value of a student model and a second output value of a teacher model, which are lightweight models, based on the first dataset. a prediction module 403 for obtaining a third output value of the student model and a fourth output value of the teacher model based on the second dataset; a first determination module 404 for determining a distilled loss function based on the first output values ​​and the second output values ​​and for determining a true value loss function based on the third output values ​​and the fourth output values; a second determination module 405 for determining a target loss function based on the distilled loss function and the true value loss function; a training module 406 for training the student model based on the target loss function; and a third determination module 407 for determining a first extended probability or target weight to be used for the (e+1)th iteration if e is less than E.

[0081] In some embodiments, the lightweight training device may further include a second acquisition module 408 (not shown in FIG. 4) for acquiring a maximum extension probability, and a fourth determination module 409 (not shown in FIG. 4) for determining a second extension probability based on the maximum extension probability, the maximum number of repetitions, and the first extension probability.

[0082] In some embodiments, the third determination module 407 includes a first determination subunit for determining a first extension probability to be used for the e+1th iteration based on the maximum extension probability, the maximum number of iterations, and the eth first extension probability.

[0083] In some embodiments, the lightweight training device may further include a third obtaining module 410 (not shown in FIG. 4) for obtaining a maximum target weight, where the third determination module 407 includes a second determining subunit for determining a target weight to be used for the e+1th iteration based on the maximum target weight, the maximum number of iterations, and the eth target weight.

[0084] In some embodiments, the second determination module 405 includes a third determination subunit for determining the distilled loss function as the target loss function if the target weight is greater than or equal to the maximum target weight or if the distilled loss function is greater than or equal to the true loss function, while otherwise determining the true loss function as the target loss function.

[0085] In some embodiments, the first determination module 404 comprises a fourth determination subunit for determining a distillation loss function according to the following formula:

number

[0086] In some embodiments, the first determining module 404 comprises a fifth determining subunit for determining a true loss function according to the following formula:

number

[0087] The functions of each processing module in the lightweight model training apparatus according to the embodiments of the present disclosure should be understood by those skilled in the art with reference to the relevant description of the lightweight model training method described above, and it should be understood by those skilled in the art that each processing module in the lightweight model training apparatus according to the embodiments of the present disclosure may be implemented by an analog circuit that realizes the functions described in the embodiments of the present disclosure, or may be implemented by software that performs the functions described in the embodiments of the present disclosure running on an electronic device.

[0088] A lightweight model training device according to an embodiment of the present disclosure can improve the training accuracy of a lightweight model.

[0089] In an embodiment of the present disclosure, an image processing apparatus applicable to an electronic device is provided, and as shown in FIG. 5 , the apparatus includes: a receiving module 501 for receiving a target image to be processed in a target scene; and a processing module 502 for inputting the target image to a student model and obtaining a processing result for the target image output by the student model, where the student model is obtained using a lightweight model training method.

[0090] In some embodiments, the receiving module 501 receiving the image to be processed in the target scene includes at least one of: acquiring the image to be processed in an image classification scene, acquiring the image to be processed in an image recognition scene, and acquiring the image to be processed in a target detection scene.

[0091] The functions of each processing module in the image processing device according to the embodiment of the present disclosure will be understood by those skilled in the art with reference to the relevant description of the image processing method described above, and each processing module in the image processing device according to the embodiment of the present disclosure may be implemented by an analog circuit that realizes the functions described in the embodiment of the present disclosure, or may be implemented by software that executes the functions described in the embodiment of the present disclosure running on an electronic device.

[0092] The image processing device according to the embodiment of the present disclosure can improve the accuracy of image processing.

[0093] The embodiment of the present disclosure also provides a schematic diagram showing a training scene of a lightweight model, and an electronic device such as a cloud server determines a teacher model and a student model to be trained for each training task based on the training tasks sent from the terminals, as shown in Fig. 6. Here, the training tasks sent from different terminals may be training tasks for different usage scenes. The electronic device trains a student model, comprising the following steps: obtaining a first augmented probability, a second augmented probability, and a target weight, which is a weight of a distilled term loss value, to be used in an e-th iteration, where e is a positive integer less than or equal to E, which is a maximum iteration number, and E is a positive integer greater than 1; performing data augmentation on a dataset based on the first augmented probability and the second augmented probability, respectively, to obtain a first dataset and a second dataset; obtaining a first output value of a student model, which is a lightweight model, and a second output value of a teacher model based on the first dataset, and obtaining a third output value of the student model and a fourth output value of the teacher model based on the second dataset; determining a distilled loss function based on the first output value and the second output value, and determining a true value loss function based on the third output value and the fourth output value; determining a target loss function based on the distilled loss function and the true value loss function; training the student model based on the target loss function, and determining the first augmented probability or the target weight to be used in the e+1-th iteration if e is less than E. The electronic device returns the trained student model to each terminal.

[0094] In addition, the embodiments of the present disclosure also provide a schematic diagram showing an image processing scene, and as shown in FIG. 7, an electronic device such as a cloud server receives the processing target images and the specified target scene sent from each terminal, inputs each processing target image into a student model corresponding to the target scene, and obtains an image processing result output by the corresponding student model.

[0095] In the present disclosure, there is no limit to the number of terminals and electronic devices, and in practice, multiple terminals and multiple electronic devices can be included.

[0096] It should be understood that the scene diagrams shown in Figures 6 and 7 are merely illustrative and not limiting, and a person skilled in the art can make various obvious modifications and / or substitutions based on the examples of Figures 6 and 7, and the resulting technical solutions still fall within the disclosure scope of the embodiments of the present disclosure.

[0097] The acquisition, storage, and use of users' personal information related to the technical solutions disclosed herein shall comply with the provisions of relevant laws and regulations and shall not violate public order or morals.

[0098] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0099] 8 is a block diagram of an electronic device 800 for implementing an embodiment of the present disclosure. The electronic device refers to any type of digital computer, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device also refers to any type of mobile device, such as personal digital assistants, cellular phones, intelligent phones, wearable devices, and other similar computing devices. The components, their connections, and functions described in this disclosure are merely exemplary and are not intended to limit the implementation of what is described and specified in this disclosure.

[0100] 8, the device 800 includes a computing unit 801 that can perform various appropriate operations and processes based on computer program instructions stored in a read-only memory (ROM) 802 or loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 can further store various programs and data required for the operation of the device 800. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0101] The components of the device 800 are connected to an I / O interface 805, which includes an input unit 806 such as a keyboard and a mouse, an output unit 807 such as various displays and speakers, a storage unit 808 such as a magnetic disk or an optical disk, and a communication unit 809 such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices via a computer network such as the Internet and / or various carrier networks.

[0102] The computing unit 801 may be various general-purpose and / or special-purpose processing components having processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various special-purpose Artificial Intelligence (AI) computing chips, computing units for executing various machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs each of the methods and processes described above, such as the lightweight model training method and / or the image processing method. For example, in some embodiments, the lightweight model training method and / or the image processing method can be realized as a computer software program tangibly included in a machine-readable medium such as the storage unit 808. In some embodiments, some or all of the computer programs can be loaded and / or installed into the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, it may perform one or more steps of the lightweight model training method and / or the image processing method described above. Additionally, in other embodiments, the computing unit 801 may be configured to perform the lightweight model training method and / or the image processing method in any other suitable manner (e.g., firmware).

[0103] Various embodiments of the systems or techniques described herein may be implemented as digital electronic circuitry systems, integrated circuit systems, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), Systems on Chips (SOCs), Complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. Each of these embodiments may include implementation by one or more computer programs executed and / or interpreted by a programmable system including at least one programmable processor, which may be a special purpose or general purpose programmable processor capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.

[0104] The program codes for carrying out the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general purpose computer, a special purpose computer or other programming data processing apparatus, so that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams can be carried out. The program codes can be entirely executed on the machine, partially executed on the machine, or partly executed on the machine and partly executed on a remote machine as a separate software package, or entirely executed on a remote machine or server.

[0105] In the context of the present disclosure, a machine-readable medium may be a tangible medium that contains or stores a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Further examples of machine-readable storage media include one or more wired electrical connections, portable computer disk cartridges, hard disks, random access memories, read-only memories, erasable programmable read-only memories (EPROMs), flash memories, optical fibers, portable compact disk read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any combination of the foregoing.

[0106] To provide for interaction with a user, the systems and techniques described herein can be implemented on a computer that can include a display device (e.g., a Cathode Ray Tube (CRT) or Liquid Crystal Display (LCD) monitor) for displaying information to a user, and a keyboard and a pointing device (e.g., a mouse or trackball, etc.) for the user to provide input to the computer. Other types of devices can also be used to provide for interaction with a user, for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, haptic feedback, etc.) and input from the user can be received in any form (e.g., acoustic input, voice input, tactile input, etc.).

[0107] The systems and techniques described herein may be implemented in a computing system that includes a background component (e.g., as a data server), or a middleware component (e.g., an application server), or a front-end component (e.g., a user computer having a graphical user interface or a network browser through which a user can interact with embodiments of the systems and techniques described herein), or any combination of such background, middleware, or front-end components. The components of the system may be connected to each other via any form or medium of digital data communication (e.g., a communications network). Examples of communications networks include a Local Area Network (LAN), a Wide Area Network (WAN), and the Internet.

[0108] The computer system may include a client and a server. Typically, the client and the server are remote from each other and generally interact with each other via a communication network. The client-server relationship is created by a computer program that operates on a corresponding computer. The server may be a cloud server, a server of a distributed system, a server incorporating a blockchain, etc. It should be understood that steps can be newly sorted, added, or deleted using the flows of the various aspects shown above. For example, each step described in the present disclosure may be performed in parallel, sequentially, or in a different order. As long as the technical solutions disclosed in the present disclosure can achieve the desired results, the present disclosure is not limited thereto.

[0109] The above specific examples do not constitute limitations on the scope of protection of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions are possible depending on design matters and other factors. Any modifications, equivalent replacements, improvements, etc. within the spirit and principles of the present disclosure should be included in the scope of protection of the present disclosure.

Claims

1. A lightweight model training device, comprising: a first acquisition module, a data augmentation module, a prediction module, a first determination module, a second determination module, a training module, and a third determination module, the device being executed by a computer, The first acquisition module acquires a target weight, which is a weight of a first expansion probability, a second expansion probability, and a distillation term loss value used in an e-th iteration, where e is a positive integer equal to or smaller than E, which is a maximum number of iterations, and E is a positive integer greater than 1; the data augmentation module performing data augmentation on a data set based on the first augmentation probability and the second augmentation probability, respectively, to obtain a first data set and a second data set; the prediction module obtaining a first output value of a student model, which is a lightweight model, and a second output value of a teacher model, based on the first data set, and obtaining a third output value of the student model and a fourth output value of the teacher model, based on the second data set; the first determination module determines a distilled loss function based on the first output value and the second output value, and determines a true value loss function based on the third output value and the fourth output value; A second determination module determines a target loss function based on the distilled loss function and the true value loss function; the training module trains the student model based on the target loss function; and the third determination module determines a first extended probability or target weight to be used for the e+1th iteration if the e is less than the E. Lightweight model training method.

2. The lightweight model training apparatus further includes a second acquisition module and a fourth determination module, The lightweight model training method includes: The second obtaining module obtains a maximum expansion probability; the fourth determination module further includes determining the second extension probability based on the maximum extension probability, the maximum number of iterations, and the first extension probability. The lightweight model training method according to claim 1 .

3. The third determination module determines a first extended probability to be used in the (e+1)th iteration, determining a first extension probability to be used for the (e+1)th iteration based on the maximum extension probability, the maximum number of iterations, and the first extension probability for the (e)th iteration. The lightweight model training method according to claim 2.

4. The lightweight model training apparatus further comprises a third acquisition module, The lightweight model training method includes: the third obtaining module obtaining a maximum target weight; The third determination module determining target weights to be used in the e+1 th iteration comprises: determining a target weight to be used for the e+1 th iteration based on the maximum target weight, the maximum number of iterations, and the target weight for the e th iteration. The lightweight model training method according to claim 1 .

5. The second determination module determines a target loss function based on the distilled loss function and the true value loss function, If the target weight is equal to or greater than a maximum target weight, or if the distilled loss function is equal to or greater than the true value loss function, determining the distilled loss function as the target loss function, whereas otherwise determining the true value loss function as the target loss function. The lightweight model training method according to claim 1 .

6. The first determination module determines a distillation loss function based on the first output value and the second output value, determining the distillation loss function according to the following formula: [0010]

7. The first determination module determines a true value loss function based on the third output value and the fourth output value, determining the true loss function according to the following formula: [0025]

8. A first acquisition module for acquiring a first expansion probability, a second expansion probability, and a target weight, which is a weight of a distillation term loss value, to be used in an e-th iteration, where e is a positive integer equal to or smaller than E, which is a maximum number of iterations, and E is a positive integer greater than 1; a data augmentation module for performing data augmentation on a dataset based on the first augmentation probability and the second augmentation probability, respectively, to obtain a first dataset and a second dataset; a prediction module for obtaining a first output value of a student model, which is a lightweight model, and a second output value of a teacher model based on the first data set, and for obtaining a third output value of the student model and a fourth output value of the teacher model based on the second data set; a first determination module for determining a distilled loss function based on the first output value and the second output value and for determining a true loss function based on the third output value and the fourth output value; a second determination module for determining a target loss function based on the distilled loss function and the true value loss function; a training module for training the student model based on the target loss function; and a third determination module for determining a first extended probability or target weight to be used for the (e+1)th iteration if the e is less than the E. Lightweight model training device.

9. The lightweight model training device is a second obtaining module for obtaining a maximum expansion probability; and a fourth determination module for determining the second extension probability based on the maximum extension probability, the maximum number of iterations, and the first extension probability.

9. The lightweight model training device according to claim 8.

10. The third determination module: a first determination subunit for determining a first extension probability to be used for the (e+1)th iteration based on a maximum extension probability, the maximum number of iterations, and the first extension probability for the eth iteration.

9. The lightweight model training device according to claim 8.

11. The lightweight model training device is a third obtaining module for obtaining a maximum target weight; The third determination module: a second determination subunit for determining a target weight to be used for the e+1th iteration based on the maximum target weight, the maximum number of iterations, and the target weight for the eth iteration.

9. The lightweight model training device according to claim 8.

12. The second determination module: and a third determination subunit for determining the distilled loss function as the target loss function if the target weight is equal to or greater than a maximum target weight or if the distilled loss function is equal to or greater than the true loss function, and otherwise determining the true loss function as the target loss function.

9. The lightweight model training device according to claim 8.

13. The first determination module: a fourth determining subunit for determining the distillation loss function according to the following formula: [0030] 9. The lightweight model training device according to claim 8.

14. The first determination module: a fifth determining subunit for determining the true loss function according to the following formula: [0045] 9. The lightweight model training device according to claim 8.

15. At least one processor; a memory in communication with the at least one processor; The memory stores instructions executable by the at least one processor, the instructions, when executed by the at least one processor, causing the at least one processor to perform a method according to any one of claims 1 to 7. Electronic devices.

16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method of any one of claims 1 to 7.

17. A computer program which, when executed by a processor, implements the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Semi-supervised SAR target identification method

    CN112990342A

  • Efficient fine-grained image classification model based on depth model framework

    CN113592023A

  • Image target detection method based on deep supervision self-distillation

    CN114863248A

  • Model generation device, model generation method, and recording medium

    WO2021044591A1

  • Systems and methods for assessing pet radiology images

    WO2022132967A1