A knowledge distillation method for image recognition with automatic selection of student model structure

By setting multiple paths in the student model and automatically selecting them based on feature map similarities, the problem of low image recognition accuracy caused by the fixed structure of the student model is solved, and a more flexible model structure and more efficient inference speed are achieved.

CN115035341BActive Publication Date: 2024-09-06HARBIN INST OF TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210679569.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-15
Publication Date
2024-09-06
Estimated Expiration
2042-06-15

AI Technical Summary

Technical Problem

The structure of the student model in the existing image recognition knowledge distillation method is fixed and complex, resulting in a large number of model parameters after distillation and slow inference speed, which in turn affects the accuracy of image recognition.

Method used

By setting up a sub-model space of multiple optional paths in the student model, automatic selection is made based on the similarity of the image feature maps output by the teacher model and the student model, gradually approaching the most appropriate student model structure, reducing unimportant paths, and improving model flexibility. performance and precision.

Benefits of technology

It is possible to reduce the number of model parameters and increase the inference speed while ensuring accuracy, improve image recognition accuracy, and reduce the pressure of iterative training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115035341B
    Figure CN115035341B
Patent Text Reader

Abstract

A method for image recognition knowledge distillation that automatically selects a student model structure relates to the field of knowledge distillation. The invention aims to solve the problem that the student model structure in the existing image recognition knowledge distillation method is fixed and complex, and has poor flexibility, resulting in low image recognition accuracy. The invention comprises: inputting a picture data set to be predicted into a classification network to obtain picture categories; the classification network is obtained by: training a deep convolutional neural network using a picture training set to obtain a trained deep convolutional neural network; establishing a sub-model space containing multiple optional paths: in each stage of the deep convolutional neural network, a "path" with different depths, convolution channel forms, and convolution channel numbers is preset; and automatically selecting the sub-model space according to the trained convolutional neural network and the global objective function and the staged objective function to obtain a classification network. The invention is used for the compression of deep learning models.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge distillation, and in particular to an image recognition knowledge distillation method that automatically selects a student model structure. Background Art

[0002] With the development of science and technology, deep convolutional neural networks have achieved success in technical fields such as image classification, target detection, and semantic segmentation. However, these deep convolutional neural network models have a large number of parameters and are large in size. Therefore, there will be a high delay when using convolutional neural networks for image classification. Therefore, the knowledge distillation method came into being. Knowledge distillation is a deep learning model compression technology derived from transfer learning. Its basic idea is to use a powerful, fully trained complex "teacher model" to extract relevant knowledge in its training process, and pass this information-rich relevant knowledge to a simpler "student model" to effectively improve the accuracy of the student model. From the perspective of the teacher model, a simple model with a prediction accuracy close to the original complex model can be obtained through knowledge distillation, achieving the purpose of model compression. Knowledge distillation has become a research focus in this field because it is easy to train and can achieve better recognition results.

[0003] With the continuous development of knowledge distillation technology, scholars have continuously proposed new improvement schemes from various perspectives to enhance the effect of knowledge distillation in image recognition. The first one was "softtarget" proposed by Hindon. The input information of the last layer of softmax of the teacher model is used as softtarget and combined with the output category label "hardtarget" of the teacher model as the training target of the student model. Later, scholars began to focus on the content of knowledge transfer, including: intermediate layer features, that is, shallow features focus on texture details, deep features focus on abstract semantics; task-related knowledge such as classification probability distribution, instance semantics involved in target detection, position regression information, etc.; representation-related knowledge emphasizes the transfer of feature representation capabilities. This method is relatively general but has nothing to do with the task; some scholars focus on the representation form of knowledge transfer, such as attentionmap, solution process (FSP: Flow of the Solution Procedure), etc., and some people start from the perspective of teachers and use the integrated model composed of multiple models as the teacher model. However, most of these methods consider the content of the knowledge distillation learning process such as knowledge extraction location and representation form, but do not consider the problem of student model structure. Therefore, the current sub-model structure is a simplified version of the teacher model, that is, a structured convolutional neural network is used. However, this structured convolutional neural network has fixed hyperparameters such as the convolution kernel size, number of convolution kernels, and number of layers for each layer, and the number of convolutions and convolution kernel sizes are the same between different layers. Therefore, in the existing image recognition knowledge distillation process, the student model structure is relatively fixed and complex, with poor flexibility. As a result, the student model obtained after image recognition knowledge distillation cannot have fewer model parameters and faster inference speed while ensuring accuracy, which in turn leads to the problem of low image recognition accuracy. Summary of the invention

[0004] The purpose of the present invention is to solve the problem that the student model structure used in the existing image recognition knowledge distillation method is fixed and complex, and has poor flexibility, resulting in the student model obtained after knowledge distillation being unable to reduce the number of model parameters and increase the inference speed while ensuring accuracy, which in turn leads to the problem of low image recognition accuracy. A method for image recognition knowledge distillation that automatically selects a student model structure is proposed.

[0005] A method for image recognition knowledge distillation that automatically selects the student model structure. The specific process is:

[0006] Obtain a picture data set to be predicted, and input the picture data set to be predicted into a target classification network to obtain the category of the picture data to be predicted;

[0007] The target classification network is obtained by:

[0008] Step 1: Obtain a prediction image training set, use the prediction image training data set to train a deep convolutional neural network model, and obtain a trained deep convolutional neural network model as a teacher model;

[0009] Step 2: Create a sub-model space containing multiple optional paths for the student model:

[0010] In each stage of the deep convolutional neural network, some "paths" with different depths, convolution channel forms, and numbers of convolution channels are preset;

[0011] Step 3: Automatically select the student model established in step 2 according to the teacher model obtained in step 1 and the set global objective function and phased objective function, and obtain the trained student model as the target classification network.

[0012] The beneficial effects of the present invention are:

[0013] The image recognition knowledge distillation method proposed in the present invention sets multiple paths in different stages of the student model, and selects the paths according to the similarity between the image feature map output by the student model and the image feature map output by the teacher model, so that the network structure of the sub-model is more flexible, and the output image feature map of each part is closer to the teacher model, thereby improving the accuracy of image recognition; at the same time, it can avoid hyperparameter determination, while ensuring the accuracy of the model, making the model parameter amount smaller and the reasoning speed faster, and the present invention continuously deletes unimportant path structures in the optional path set during the training process, gradually approaches the most suitable student model structure, reduces the pressure of iterative training, and improves the speed of image recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is a schematic diagram of different information transmission channel paths in the same stage;

[0015] Figure 2 Technical flowchart of the knowledge distillation method for automatically selecting the student model structure. DETAILED DESCRIPTION

[0016] Specific implementation method 1: This implementation method is a method for automatically selecting a student model structure for image recognition knowledge distillation. The specific process is as follows:

[0017] Obtain a picture data set to be predicted, and input the picture data set to be predicted into a target classification network to obtain the category of the picture data to be predicted;

[0018] The target classification network is obtained by:

[0019] Step 1: Get the prediction image training set, use the prediction image training data set to train the deep convolutional neural network model, and obtain the trained deep convolutional neural network model as the teacher model; (such as resnet56, VGG, etc.)

[0020] Step 2: For the student model, a sub-model space with multiple optional paths is established at each model stage, that is, the preset student model:

[0021] In each stage of the deep convolutional neural network, some "paths" with different depths, convolution channel forms, and convolution channel numbers are preset to choose from;

[0022] The preset different paths satisfy the output consistency constraint, that is, the dimension of the feature map output by each path in each stage is the same, such as Figure 1 As shown;

[0023] The sub-model space includes: models that may be constituted by all paths in each stage of the deep neural network;

[0024] Step 3: Automatically select the student model based on the teacher model obtained in step 1 and the set global objective function and phased objective function, and obtain the selected student model as the target classification network, such as Figure 2 As shown:

[0025] Step 31: Iteratively train the student model, obtain the feature map output by each path in each stage in the sub-model space during each round of iterative training, and calculate the similarity between the feature map output by each path in each stage and the feature map output by the teacher model (trained deep convolutional neural network);

[0026] The similarity between the feature map output by each path in each stage and the feature map output by the trained deep convolutional neural network is determined by the staged objective function:

[0027] L s =||W ss -W ts || 2 +λD s

[0028] Among them, L s The smaller the two feature maps are, the greater the similarity is. s is the objective function at the current stage, W ss is the feature map output by the student model at the current stage, W ts is the characteristic graph output by the teacher at the current stage, D s is the parameter amount of the selected path, and λ is the relationship parameter used to balance the parameter amount in the loss function and the L2-norm;

[0029] In this step, based on the similarity of the image feature maps output by the teacher model and the student model, the path output closest to the teacher model is selected as the feature map of the output image at the current stage, so that the image recognition result output by the student model is closer to the image recognition result of the teacher model, thereby improving the image recognition accuracy of the student model.

[0030] Step 32: Train the path corresponding to the maximum similarity value in each stage output in step 31, and record the number of selected paths. After multiple rounds of iterative updates, delete the path with the least number of selected paths in turn according to the number of selected paths. The network composed of the last path in each stage is the final student model.

[0031] During the training process, after every 20 rounds of iterative updates, unimportant paths are deleted one by one according to the number of selected paths in the order of stage 1, stage 2, stage 3, etc.

[0032] Step 3. Use the global objective function to train the final student model to obtain the target classification network:

[0033] The global objective function adopts the traditional soft target + hard target mode (soft target + hard target), as follows:

[0034]

[0035] Consider the gap between the network output and the true label of the data (left item) and the gap between the final output of the teacher and student networks (right item), where D(·,·) represents the cross entropy, and denote the logits output generated by the student model and the teacher model for the jth input (i.e., the input of the last softmax layer of the convolutional neural network), y j represents the true label of the jth input, α is a parameter that weighs the importance of “soft targets” and “hard targets”, T is the softening parameter of logits, j∈[1,m] is the label of the network input data, and m is the total number of input data.

[0036] The sub-model space is finally fine-tuned according to the global loss function and trained for 30 rounds to obtain the target classification network.

[0037] In this implementation, within one iteration, the same input in each stage will go through n paths, obtaining n different feature maps. sThe discrimination is used to select a path whose output feature map is closest to the output feature map of the teacher model at this stage for training. The selected number of the selected path will be +1 and recorded. The path selection in the remaining stages is carried out in this way. In each round of iteration, only the selected path has the opportunity to be trained, that is, in each round of iteration, only the network structure that outputs the feature map output by the nearest teacher model will be trained. During the training process, redundant paths will be gradually deleted according to the different selected numbers. Finally, only one path closest to the teacher model will be retained in each stage. Figure 2 The F() in represents the stage-by-stage objective function.

Claims

1. A knowledge distillation method for image recognition that automatically selects a student model structure, characterized in that The specific process of the method is: obtaining a picture data set to be predicted, inputting the picture data set to be predicted into a target classification network to obtain the category of the picture data to be predicted; Step 1: Obtain a prediction image training set, use the prediction image training data set to train a deep convolutional neural network model, and obtain a trained deep convolutional neural network model as a teacher model; Step 2: Create a sub-model space containing multiple optional paths for the student model: In each stage of the deep convolutional neural network, some "paths" with different depths, convolution channel forms, and numbers of convolution channels are preset, and all models that can be constructed by all paths are the sub-model space; Step 3: Automatically select the student model established in step 2 according to the teacher model obtained in step 1, the global objective function and the staged objective function, and obtain the selected student model as the target classification network, including the following steps: Step 31: Iteratively train the student model, obtain the feature map output by each path in each stage in the sub-model space during each round of iterative training, and calculate the similarity between the feature map output by each path in each stage and the feature map output by the trained deep convolutional neural network; The similarity between the feature map output by each path in each stage and the feature map output by the trained deep convolutional neural network is calculated and judged by the staged objective function: L s =||W ss -W ts || 2 +λD s Among them, L s The smaller the two feature maps are, the greater the similarity is. s is the objective function at the current stage, W ss is the feature map output by the student model at the current stage, W ts is the feature map output by the teacher model at the current stage, D s is the parameter amount of the selected path, and λ is the relationship parameter used to balance the parameter amount in the loss function and the L2-norm; Step 32: Train the path corresponding to the maximum similarity value in each stage output in step 31, and record the number of selected paths. After multiple rounds of iterative updates, delete the path with the least number of selected paths in turn according to the number of selected paths. The network composed of the last path in each stage is the final student model. Step 3: Use the global objective function to train the final student model to obtain the target classification network.

2. The image recognition knowledge distillation method for automatically selecting a student model structure according to claim 1, characterized in that: The deep convolutional neural network of step one includes: resnet56, VGG.

3. The image recognition knowledge distillation method for automatically selecting a student model structure according to claim 2, characterized in that: Each path in the sub-model space containing multiple optional paths in step 2 satisfies the output consistency principle.

4. The image recognition knowledge distillation method for automatically selecting a student model structure according to claim 3, characterized in that: The global objective function adopts a soft target + hard target mode.

5. The image recognition knowledge distillation method for automatically selecting a student model structure according to claim 4, characterized in that: The method of deleting the paths with the least number of selections in turn according to the number of selected paths after multiple rounds of iterative updates is specifically as follows: during the iterative training of the sub-model space, after each preset round of iterative updates, in the order of stages, the paths with the least number of selections are deleted one by one according to the number of selections of different paths.

Citation Information

Patent Citations

  • Image incremental learning method based on dynamic correction vector

    CN111199242A

  • Image classification method based on vector standardization and knowledge distillation

    CN112116030A

  • Method and apparatus for training image recognition model, and method and apparatus for recognizing image

    US20220129731A1

  • Real-time colonoscopy image segmentation method and device based on ensemble and knowledge distillation

    WO2022057078A1