A network model optimization method, device, equipment and medium

CN115410066BActive Publication Date: 2026-11-03BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110593834.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-28
Publication Date
2026-11-03
Estimated Expiration
2041-05-28

AI Technical Summary

Technical Problem

Existing technologies suffer significant performance loss when quantizing floating-point models into integer models, resulting in reduced performance of integer models in actual deployments and failing to reflect the high performance of floating-point models.

Method used

By obtaining a floating-point network model, quantizing it, determining the performance evaluation value, updating the current parameters based on the performance evaluation value, and iterating and optimizing until the convergence condition is met, the best-performing integer network model is output.

Benefits of technology

This ensures that the quantized model maintains high performance while reducing memory usage, making it suitable for deployment on mobile or low-power devices and compensating for the performance loss problem in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115410066B_ABST
    Figure CN115410066B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure relate to a network model optimization method, device, equipment and medium, wherein the method comprises: obtaining a first network model; wherein the first network model is obtained based on current parameters; quantizing the first network model to obtain a quantized second network model; determining a performance evaluation value of the second network model, and updating the current parameters according to the performance evaluation value; repeating the above steps to update the current parameters in a loop until a convergence condition is reached, and outputting the updated second network model. The present disclosure can effectively ensure that the final output integer type second network model has the best performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, and in particular to a method, apparatus, device and medium for optimizing a network model. Background Technology

[0002] When using machine learning to perform tasks such as image classification, image detection, and keypoint detection, a neural network model needs to be built first. The neural network models typically use 32-bit or 64-bit single-precision floating-point numbers, which requires enormous memory resources when the network model is large. To obtain a more efficient model and enable its deployment and use on mobile or low-power devices, the traditional approach is to first obtain the best-performing floating-point model through iterative optimization, then quantize this best floating-point model. The quantized integer model is then used for inference and storage in low-bit form, and finally deployed and used on mobile or low-power devices.

[0003] Currently, the precision of floating-point models is used to evaluate the performance of quantized integer models. However, in practical applications, it has been found that the best-performing floating-point model does not necessarily correspond to the best-performing integer model. Model quantization introduces varying degrees of performance loss into floating-point models, resulting in reduced performance of quantized integer models in actual deployments, failing to reflect the high performance of floating-point models. Summary of the Invention

[0004] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a method, apparatus, device, and medium for optimizing network models.

[0005] This disclosure provides a method for optimizing a network model, including:

[0006] Obtain a first network model; wherein the first network model is obtained based on the current parameters; quantize the first network model to obtain a quantized second network model; determine the performance evaluation value of the second network model, and update the current parameters according to the performance evaluation value;

[0007] Repeat the above steps to update the current parameters in a loop until the convergence condition is met, then output the updated second network model.

[0008] Optionally, the first network model is a floating-point network model; the second network model is an integer network model.

[0009] Optionally, the first network model is a student deep neural network output by a knowledge distillation algorithm; the current parameter is a distillation hyperparameter.

[0010] Optionally, the method further includes: guiding the training of the student deep neural network according to the knowledge distillation algorithm using the distillation hyperparameters and the pre-trained teacher network model, outputting the trained student deep neural network, and using the trained student deep neural network as the first network model.

[0011] Optionally, quantizing the first network model to obtain a quantized second network model includes...

[0012] The first network model is stored as a first network model in a preset format, and the first network model in the preset format is input into the quantization module for quantization operation to obtain an integer-type second network model.

[0013] Optionally, determining the performance evaluation value of the second network model includes:

[0014] The second network model is run multiple times according to a preset validation set, and a performance evaluation value is determined based on the results of the multiple runs of the second network model. The performance evaluation value is used to characterize the accuracy of the second network model.

[0015] Optionally, updating the current parameters based on the performance evaluation value includes: performing backpropagation based on the performance evaluation value and the hyperparameter search algorithm to update and obtain new current hyperparameters.

[0016] Optionally, the convergence condition includes any one of the following:

[0017] The loop execution count reaches the preset maximum number of loops; or the loop execution time reaches the preset maximum execution time; or the number of parameters of the first network model sampled based on the hyperparameter search algorithm reaches the preset maximum number of samples; or the performance evaluation value of the second network model reaches the preset performance evaluation threshold.

[0018] Optionally, when the step of obtaining the first network model is performed for the first time, the current parameter is a random number determined within the hyperparameter search range based on the hyperparameter search algorithm.

[0019] Optionally, the method further includes: if the convergence condition is met, deploying the updated second network model.

[0020] This disclosure also provides a network model optimization apparatus, comprising:

[0021] The acquisition module is used to acquire a first network model; wherein the first network model is obtained based on the current parameters;

[0022] The quantization module is used to quantize the first network model to obtain the quantized second network model;

[0023] An update module is used to determine the performance evaluation value of the second network model and update the current parameters based on the performance evaluation value;

[0024] The judgment module is used to determine whether the convergence condition has been met; if the convergence condition has not been met, the updated current parameters are input to the acquisition module, and the steps executed by the acquisition module, the quantization module, and the update module are repeated; if the convergence condition has been met, the corresponding updated second network model is input to the output module.

[0025] The output module is used to output the updated second network model.

[0026] This disclosure also provides an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement an optimization method for a network model as provided in this disclosure.

[0027] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a computing device, enables the computing device to implement the above-described network model optimization method.

[0028] The technical solution provided in this disclosure has the following advantages compared with the prior art:

[0029] This disclosure provides a method, apparatus, device, and medium for optimizing a network model. The method includes: obtaining a first network model based on current parameters; quantizing the first network model to obtain a quantized second network model; determining the performance evaluation value of the second network model and updating the current parameters according to the performance evaluation value; repeating the above steps to iteratively update the current parameters until a convergence condition is met, and outputting the updated second network model. Compared with the traditional method of iteratively optimizing a floating-point model first and then quantizing the model to obtain an integer model, the optimization method of the network model provided in this embodiment incorporates model quantization into the iterative optimization process, fully considering the performance evaluation value of the quantized second network model and compensating for the performance loss caused by model quantization. In this iterative process, the performance evaluation value of the quantized second network model is used to update the current parameters, so that the updated current parameters are directly related to the performance of the quantized second network model, thereby effectively ensuring that the final output second network model has optimal performance. Furthermore, the output second network model is a quantized model, which maintains high performance and effectively reduces the occupation of memory resources, which is beneficial for deployment and use on mobile devices or low-power devices. Attached Figure Description

[0030] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0031] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0032] Figure 1 This is a schematic diagram illustrating a model optimization method provided in an embodiment of the present disclosure;

[0033] Figure 2 A flowchart illustrating a method for optimizing a network model provided in an embodiment of this disclosure;

[0034] Figure 3 This is a schematic diagram illustrating another model optimization method provided in an embodiment of this disclosure;

[0035] Figure 4 A schematic diagram of the structure of a network model optimization device provided in an embodiment of this disclosure;

[0036] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0037] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0038] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.

[0039] In traditional model optimization methods, model training and model quantization are performed in stages; for example, referring to... Figure 1 The diagram illustrates the iterative optimization process of an initial network model input by a user using a knowledge distillation algorithm. The hyperparameters used in the knowledge distillation algorithm are obtained based on the performance updates of floating-point models. During the hyperparameter search, the floating-point models corresponding to each set of hyperparameters are compared and evaluated, and one or more models with the best performance are selected. When the iterative optimization stops, the best-performing floating-point model is obtained, and then the floating-point model is quantized, followed by deployment of the quantized integer model. Currently, known methods in academia and industry use the precision of the floating-point model to evaluate model performance. This evaluation method is disconnected from actual deployment, leading to a decrease in the performance of the quantized integer model during actual deployment, failing to reflect the high performance of the floating-point model, and resulting in a mismatch between the performance rankings of floating-point and integer models. The reason for the decreased performance of the integer model is that the model quantization stage was not considered during the iterative optimization process, such as the performance loss caused by model quantization and an overemphasis on the performance of the floating-point model while neglecting the performance of the quantized integer model.

[0040] To address at least one of the aforementioned problems, this disclosure provides a method, apparatus, device, and medium for optimizing network models. This technology can be used in practical applications such as model training, model quantization, and model deployment. For ease of understanding, the embodiments of this invention are described in detail below.

[0041] Figure 2 This is a schematic flowchart illustrating a network model optimization method according to an embodiment of the present disclosure. This method can be executed by a network model optimization device, which can be implemented in software and / or hardware, and is generally integrated into an electronic device. Figure 2 As shown, the method includes repeatedly executing the following steps S202-S208, cyclically updating the current parameters until the convergence condition is met:

[0042] Step S202: Obtain the first network model; wherein, the first network model is obtained based on the current parameters. The current parameters are hyperparameters, which are parameters set before the first network model begins its learning process. They define higher-level concepts about the first network model, such as its depth, loss weights, weight ratios, and learning rate, etc. The selection of hyperparameters has a significant impact on the final performance of the first network model. When step S202 is executed for the first time, the current parameters can be random numbers determined within the parameter search range based on a hyperparameter search algorithm; or, they can be user-configured parameter values.

[0043] In this embodiment, the first network model is a common machine learning model such as CNN (Convolutional Neural Networks), R-CNN (Region-CNN), or Segnet. In some implementations, the first network model can be obtained by optimizing and training a preset initial network model using the current parameters; the first network model is a floating-point network model.

[0044] Step S204: Quantize the first network model to obtain the quantized second network model.

[0045] In this embodiment, a module with model quantization function can be used to quantize the first network model. This module with model quantization function can be, for example, a module including the TensorRT tool. In this embodiment, the high-bit floating-point first network model is input into the quantization module, and the quantization module converts the first network model into a low-bit int8 model to output the second network model, which is an integer network model.

[0046] Step S206: Determine the performance evaluation value of the second network model and update the current parameters based on the performance evaluation value.

[0047] This embodiment can run the second network model in a preset task, such as a scene image classification task, image segmentation task, image detection task, etc.; the performance evaluation value of the second network model is determined based on the running results, and the accuracy of the second network model is characterized by the performance evaluation value.

[0048] During model training, the current parameters need to be continuously adjusted to find an optimal set of current parameters so that the quantized second network model has the best performance and effect. In order to find an optimal set of current parameters, a hyperparameter search algorithm can be used and the current parameters can be updated according to the performance evaluation value; after the new current parameters are obtained, the following step S208 is executed.

[0049] Step S208: Determine whether the convergence condition has been met; the convergence condition can be a condition set based on factors such as the maximum number of loops, the maximum execution time, or the number of parameter samples.

[0050] If the convergence condition is met, it indicates that the second network model obtained based on the updated current parameters can achieve satisfactory performance and meet actual production needs. In this case, the second network model corresponding to the convergence condition is determined as the final optimized network model, and step S210 can be executed. Conversely, if the convergence condition is not met, steps S202 to S208 are re-executed.

[0051] Step S210: Output the updated second network model.

[0052] The network model optimization method provided in this embodiment includes: firstly, quantizing a first network model into a second network model, and then updating the current parameters based on the performance evaluation value of the second network model; repeating the above steps to iteratively update the current parameters until the convergence condition is met, and then outputting the updated second network model. Compared with the traditional method of iteratively optimizing a floating-point model first and then quantizing the model to obtain an integer model, the network model optimization method provided in this embodiment incorporates model quantization into the iterative optimization process of the model, fully considering the performance evaluation value of the quantized second network model, and compensating for the performance loss caused by model quantization; in this iterative process, the current parameters are updated using the performance evaluation value of the quantized second network model, so that the updated current parameters are directly related to the performance of the quantized second network model, thereby effectively ensuring that the final output second network model has the best performance.

[0053] To facilitate understanding of this solution, a method is provided here as follows: Figure 3 The illustrated embodiment. Refer to... Figure 3 First, the initial network model input by the user is obtained. Based on the current parameters and a preset training method, the initial network model is optimized and trained to obtain a floating-point first network model. The training method can be knowledge distillation, pruning, or low-rank decomposition, etc. In this embodiment, when training the initial network model using the preset training method, the current parameters are hyperparameters that match the training method; for example, using... Figure 3 Taking the knowledge distillation algorithm shown as an example, the current parameters include, but are not limited to, the following distillation hyperparameters: the selection parameters of the distillation loss function, the values ​​of the distillation loss weights, and the network layers for distillation between the teacher network model and the student network model.

[0054] Then, the first network model is quantized to obtain an integer-type second network model. Based on the performance of the second network model, the current parameters are updated, and the updated parameters are used for the next round of iterative optimization. This iterative optimization process is repeated multiple times until the convergence condition is met, at which point the best-performing integer-type second network model is obtained. Next, this obtained second network model can be used as the target network model, and the target network model is deployed.

[0055] In the embodiment employing the knowledge distillation algorithm, the first network model is a student deep neural network output by the knowledge distillation algorithm; the current parameters are the distillation hyperparameters mentioned above. In this case, the first network model can be obtained as follows:

[0056] Based on the knowledge distillation algorithm using distillation hyperparameters and the pre-trained teacher network model, the training of the student deep neural network is guided, the trained student deep neural network is output, and the trained student deep neural network is used as the first network model.

[0057] The knowledge distillation algorithm employs transfer learning, using the output of a pre-trained teacher network model (complex model) as a supervisory signal to train a student deep neural network (simple model). This allows the simple student deep neural network to possess the same or similar data processing capabilities as the complex teacher network model. In this embodiment, the first network model obtained through the knowledge distillation algorithm significantly improves its performance.

[0058] For the first network model, model quantization can be performed using TensorRT or as described in this embodiment: the first network model is stored as a first network model in a preset format, and then input into the quantization model for quantization to obtain an integer-type second network model. Specifically, the quantization module can be the quantization model OpenVINO.

[0059] In practice, the first network model is stored as a preset pb format first network model, and OpenVINO is used to quantize the pb format first network model. Specifically, OpenVINO maps each layer in the pb format first network model to a preset threshold, and calculates the scaling factor of each layer based on the preset threshold and the values ​​in the weights of each layer. Based on the scaling factor of each layer, the pb format first network model is quantized to obtain an integer-type second network model.

[0060] Next, the second network model can be run multiple times based on the preset validation set. The performance evaluation value is determined based on the results of the multiple runs of the second network model. The performance evaluation value is used to characterize the accuracy of the second network model.

[0061] This embodiment can provide several common application scenarios for running a second network model.

[0062] In image classification scenarios, the validation set is a collection of images with classification labels, such as tiger, person, teacup, and car. The images in this validation set are input into a second network model, which predicts the classification results. The predicted classification results are then compared to the pre-labeled classification labels of the images. Based on the comparison results, the performance evaluation value of the second network model is determined. For example, if the validation set contains one thousand images, and the classification results of eight hundred images match the classification labels, then the classification accuracy of the second network model is 80%. This accuracy is used to represent the performance evaluation value of the second network model, characterizing its classification precision.

[0063] In image detection scenarios, the validation set of images contains pre-defined coordinates and classification labels for each object. These images are then input into a second network model, which detects the locations and categories of objects within the images. The detection results are compared with the pre-defined coordinates and classification labels of the images, and the performance evaluation value of the second network model is determined based on this comparison. This performance evaluation value characterizes the detection accuracy of the second network model.

[0064] The above are just examples of application scenarios and are not limited to these. For example, they can also be used for image segmentation, facial landmark detection, etc., which will not be listed here.

[0065] Based on the performance evaluation value of the obtained second network model, this embodiment provides a method for updating the current parameters, including: performing backpropagation according to the performance evaluation value and the hyperparameter search algorithm to update and obtain new current parameters.

[0066] During model training, parameters need to be continuously optimized and updated to select an optimal set of parameters for the network model to be trained, thereby improving the performance and effectiveness of the trained network model. In this embodiment, optimizing and updating the current parameters not only affects the performance of the first network model, but more importantly, the current parameters are directly related to the performance of the second network model. By optimizing and updating the current parameters, better parameter selection can be provided for the second network model, thereby ensuring that the second network model has the best performance and effectiveness. To find an optimal set of current parameters, hyperparameter search algorithms such as grid search, random search, and Bayesian optimization can be used to update the current parameters. After obtaining the updated current parameters, the first network model is retrained using the new current parameters.

[0067] The hyperparameter search algorithm is used to select the current parameters, eliminating reliance on human experience and avoiding the adverse effects of human experience on parameter accuracy. In this embodiment, during the continuous search for new current parameters based on the hyperparameter search algorithm, the performance evaluation value of the integer-type second network model is fully considered. This makes the parameter selection directly related to the performance of the quantized second network model, strengthening the correlation between the updated current parameters and the integer-type second network model, while weakening or even eliminating the correlation between the updated current parameters and the floating-point-type first network model. Based on this, it can be ensured that the integer-type second network model obtained using the updated current parameters has optimal performance.

[0068] The selection of current parameters has a significant impact on the performance of the final output second network model. Therefore, this embodiment can continuously search and update the current parameters, and repeatedly execute the optimization operations shown in steps S204-S208 above based on the updated current parameters until a convergence condition is met. This convergence condition can include any one of the following:

[0069] When the number of iterations of the loop reaches the preset maximum number of iterations, the convergence condition is determined; for example, the maximum number of iterations is 10,000.

[0070] Alternatively, convergence can be determined when the loop execution time reaches a preset maximum execution time. In one specific implementation, the execution time of the hyperparameter search can be used as the loop execution time, with a maximum execution time of 24 hours.

[0071] Alternatively, when the number of parameters of the first network model sampled based on the hyperparameter search algorithm reaches the preset maximum number of samples, the convergence condition is determined to be met; such that the number of samples is 9999 sets of hyperparameter samples based on the hyperparameter search algorithm.

[0072] Alternatively, the convergence condition can be determined when the performance evaluation value of the second network model reaches a preset performance evaluation threshold. Specifically, taking classification accuracy as an example, when the performance evaluation value of the second network model reaches 99.99% classification accuracy, it indicates that the second network model can meet the actual application requirements, and in order to save optimization costs, the convergence condition can be determined.

[0073] The loop stops when any of the above convergence conditions are met, and the updated second network model at the time of loop termination is designated as the optimized target network model corresponding to the first network model. Compared to the floating-point model, the target network model is a quantized integer model, which significantly improves running speed while maintaining a high level of accuracy. Furthermore, it can be understood that when the loop stops at the time of convergence, the new current parameters at that time can be stored as target parameters. Optimizing and updating the target parameters allows the final output target network model to achieve optimal performance, indicating that the target parameters have high practical value and can be used as empirical data in the training process of other models.

[0074] After that, as Figure 3 As shown, the target network model is deployed. Specifically, the target network model is deployed on a preset system; assuming the preset system is a server, the target network model can be deployed on the server's GPU (Graphics Processing Unit); or, if the preset system is a mobile device such as a phone or tablet, the target network model can be deployed in a specific engine of the mobile device and finally embedded into the corresponding mobile app.

[0075] In this embodiment, the target network model is a quantized model output after multiple iterations of optimization. It maintains high performance while effectively reducing the consumption of memory resources, which is beneficial for deployment and use on mobile devices or low-power devices.

[0076] In summary, compared to the traditional segmented approach of model training and quantization, the network model optimization method provided in the above-disclosed embodiments incorporates both model training and quantization into an iterative optimization process. For the user, the input is the initial network model, and the output is the target network model, which is the best-performing integer model after joint optimization through training and quantization. The joint optimization process between the input and output compensates for the performance loss of model quantization on the integer model, ensuring that the final integer target network model has optimal performance. This effectively improves the performance mismatch between floating-point and integer models in traditional methods. In the actual deployment of the quantized target network model, it demonstrates the high efficiency and low resource consumption of the target network model, bringing significant benefits to actual business operations.

[0077] Figure 4 This is a schematic diagram of a network model optimization device provided in an embodiment of the present disclosure. The device can be implemented by software and / or hardware, and is generally integrated into an electronic device. It can achieve model optimization by executing a network model optimization method. Figure 4 As shown, the device includes:

[0078] The acquisition module 402 is used to acquire the first network model; wherein the first network model is obtained based on the current parameters;

[0079] Quantization module 404 is used to quantize the first network model to obtain the quantized second network model;

[0080] Update module 406 is used to determine the performance evaluation value of the second network model and update the current parameters based on the performance evaluation value;

[0081] The judgment module 408 is used to determine whether the convergence condition has been met; if the convergence condition has not been met, the updated current parameters are input to the acquisition module, and the steps executed by the acquisition module, the quantization module, and the update module are repeated; if the convergence condition has been met, the corresponding updated second network model is input to the output module 410.

[0082] The output module 410 is used to output the updated second network model.

[0083] In some embodiments, the acquisition module 402 may be specifically used to: guide the training of the student deep neural network according to the knowledge distillation algorithm with distillation hyperparameters and the pre-trained teacher network model, output the trained student deep neural network, and use the trained student deep neural network as the first network model.

[0084] In some embodiments, the quantization module 404 is specifically used for:

[0085] The first network model is stored as a first network model in a preset format. The first network model in the preset format is then input into the quantization module for quantization to obtain a second network model of integer type.

[0086] In some embodiments, the update module 406 is specifically used to: run the second network model multiple times according to a preset validation set, and determine a performance evaluation value based on the results obtained from running the second network model multiple times, wherein the performance evaluation value is used to characterize the accuracy of the second network model.

[0087] In some embodiments, the update module 406 is specifically used to: perform backpropagation based on the performance evaluation value and the hyperparameter search algorithm to update and obtain new current hyperparameters.

[0088] In some embodiments, the optimization apparatus for the network model further includes a deployment module (not shown in the figure), which is used to: deploy the updated second network model if the convergence condition is met.

[0089] The network model optimization apparatus provided in this disclosure can execute the network model optimization method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0090] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Figure 5 As shown, the electronic device 500 includes one or more processors 501 and memory 502.

[0091] The processor 501 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 500 to perform desired functions.

[0092] The memory 502 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 501 may execute the program instructions to implement the network model optimization method of the embodiments of this disclosure described above and / or other desired functions. Various contents such as input signals, signal components, and noise components may also be stored in the computer-readable storage medium.

[0093] In one example, the electronic device 500 may also include an input device 503 and an output device 504, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).

[0094] In addition, the input device 503 may also include, for example, a keyboard, a mouse, etc.

[0095] The output device 504 can output various information to the outside, including determined distance information, direction information, etc. The output device 504 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.

[0096] Of course, for the sake of simplicity, Figure 5 Only some of the components of the electronic device 500 relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 500 may include any other suitable components depending on the specific application.

[0097] In addition to the methods and devices described above, embodiments of this disclosure may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the optimization method for the network model described in the embodiments of this disclosure.

[0098] The computer program product can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this disclosure. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0099] Furthermore, embodiments of this disclosure may also be computer-readable storage media storing a computer program that, when executed by a computing device, enables the computing device to implement the optimization method of the network model described above.

[0100] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0101] This disclosure also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the methods described in this disclosure.

[0102] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0103] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for optimizing a network model, characterized in that, include: Obtain the first network model; wherein the first network model is obtained based on the current parameters; The first network model is quantized to obtain the quantized second network model; The performance evaluation value of the second network model is determined, and the current parameters are updated based on the performance evaluation value; wherein, the second network model is run in a preset task, the task including: scene image classification task, image segmentation task, and image detection task; the performance evaluation value of the second network model is determined based on the running results, and the performance evaluation value characterizes the accuracy of the second network model; Repeat the above steps to update the current parameters in a loop until the convergence condition is met, and then output the updated second network model; wherein, the second network model is run in a preset application scenario, the application scenario including at least: image classification, image detection, image segmentation and facial landmark detection; The first network model includes a student deep neural network output by a knowledge distillation algorithm; the current parameters include distillation hyperparameters. The method further includes: The student deep neural network is trained using a knowledge distillation algorithm with the distillation hyperparameters and a pre-trained teacher network model. The trained student deep neural network is then output and used as the first network model.

2. The method according to claim 1, characterized in that, The first network model is a floating-point network model; the second network model is an integer network model.

3. The method according to claim 1, characterized in that, The step of quantizing the first network model to obtain a quantized second network model includes... The first network model is stored as a first network model in a preset format. The first network model in the preset format is then input into the quantization module for quantization to obtain a second network model of integer type.

4. The method according to claim 1, characterized in that, Determining the performance evaluation value of the second network model includes: The second network model is run multiple times according to a preset validation set, and a performance evaluation value is determined based on the results of the multiple runs of the second network model. The performance evaluation value is used to characterize the accuracy of the second network model.

5. The method according to claim 1, characterized in that, The step of updating the current parameters based on the performance evaluation value includes: Backpropagation is performed based on the performance evaluation value and the hyperparameter search algorithm to update and obtain the new current hyperparameters.

6. The method according to claim 5, characterized in that, The convergence condition includes any one of the following: The loop has been executed a maximum of the preset number of iterations. Alternatively, the execution time of the loop reaches the preset maximum execution time; Alternatively, the number of parameters of the first network model sampled based on the hyperparameter search algorithm reaches a preset maximum number of samples; Alternatively, the performance evaluation value of the second network model reaches a preset performance evaluation threshold.

7. The method according to claim 5, characterized in that, When the step of obtaining the first network model is executed for the first time, the current parameter is a random number determined within the hyperparameter search range based on the hyperparameter search algorithm.

8. The method according to claim 1, characterized in that, The method further includes: if the convergence condition is met, deploying the updated second network model.

9. An optimization device for a network model, characterized in that, include: The acquisition module is used to acquire a first network model; wherein the first network model is obtained based on the current parameters; The quantization module is used to quantize the first network model to obtain the quantized second network model; An update module is used to determine the performance evaluation value of the second network model and update the current parameters based on the performance evaluation value; wherein, the second network model is run in a preset task, the task including: scene image classification task, image segmentation task, and image detection task; the performance evaluation value of the second network model is determined based on the running results, and the performance evaluation value characterizes the accuracy of the second network model; The judgment module is used to determine whether the convergence condition has been met; if the convergence condition has not been met, the updated current parameters are input to the acquisition module, and the steps executed by the acquisition module, the quantization module, and the update module are repeated; if the convergence condition has been met, the corresponding updated second network model is input to the output module. The output module is used to output the updated second network model; wherein the second network model is run in a preset application scenario, the application scenario including at least: image classification, image detection, image segmentation and facial landmark detection; The first network model includes a student deep neural network output by a knowledge distillation algorithm; the current parameters include distillation hyperparameters. The acquisition module is also used for: The student deep neural network is trained using a knowledge distillation algorithm with the distillation hyperparameters and a pre-trained teacher network model. The trained student deep neural network is then output and used as the first network model.

10. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the optimization method of the network model according to any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a computer device, causes the computer device to implement the optimization method of the network model according to any one of claims 1-8.

Citation Information

Patent Citations

  • Hyper-parameter tuning method and device and model construction method and device

    CN110889450A

  • Quantization-aware neural architecture search

    US20200302271A1