A deep learning model pruning method
By optimizing the loss function based on the classification probability vector and the mean of neuron output, the importance of neurons is determined and a probability threshold is set. This solves the dependency problem of zero-shot model pruning, realizes the identification of key neurons without real samples and reference models, and improves the reliability and applicability of the method.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TIANJIN UNIV
- Filing Date
- 2024-12-30
- Publication Date
- 2026-08-04
AI Technical Summary
Existing zero-shot model pruning methods are mainly based on model weight coefficients, which cannot analyze the degree of influence of neurons on specific categories, resulting in the inability to perform model pruning properly in the absence of real samples and reference models.
By creating an initial random image and normalizing it, multiple rounds of optimization are performed using the classification probability vector, the mean of neuron output, and the loss function to determine the importance of the neuron to the target category, and a probability threshold is set to determine whether to prune the neuron.
It achieves zero-shot model pruning without the need for real images or other model guidance, improving the reliability and applicability of the method and making it suitable for various model structures.
Smart Images

Figure CN119903889B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of lightweight deep learning, and in particular to a deep learning model pruning method that does not require real samples. Background Technology
[0002] In practical applications of deep learning, there are numerous scenarios where models need to be deployed on hardware with limited computing and storage resources. In such cases, lightweight models are required to complete tasks with fewer parameters and faster speeds. Model pruning is a crucial approach to lightweighting models, its core idea being to select neurons with high information content and remove those with low information content. Current model pruning algorithms are highly dependent on the dataset, often requiring real samples for model validation or the use of knowledge from other high-performance models as guidance to identify key neurons. However, if the training dataset is unavailable or there is no reference model, proper model pruning is impossible. Zero-shot model pruning methods are needed to address this; however, current zero-shot methods primarily rely on model weight coefficients and cannot analyze the degree of influence of neurons on specific categories. Summary of the Invention
[0003] The purpose of this invention is to fill the gap in zero-sample, category-based model pruning methods by proposing a deep learning model pruning method. The technical solution is as follows:
[0004] A deep learning model pruning method:
[0005] (1) Prepare an image classification model M to be pruned;
[0006] (2) Create an initial random image, normalize it to obtain the initial deep dream; input the initial deep dream into the model M to obtain the output mean O and classification probability vector P of each neuron;
[0007] (3) The loss function L is set using the classification probability vector P, the mean output of the target neuron, and the mean output of other neurons in the convolutional layer to which the target neuron belongs. Then, the deep dream is optimized in multiple rounds using the loss function, and finally denormalized to obtain the final deep dream. The obtained deep dream is then re-inputted into the model M to obtain the predicted probability p of the target category. y ;
[0008] (4) Based on the predicted probability p of the target category y With a preset probability threshold p T Determine whether a neuron is significant to the target category, and thus decide whether to prune that neuron.
[0009] The beneficial effects of this invention are:
[0010] (1) This invention is a zero-sample model pruning method that can identify key neurons without the participation of real images or the guidance of other models.
[0011] (2) This invention can be applied to a variety of models and does not depend on the model structure.
[0012] (3) This method has been tested and verified through a large number of experiments, which has effectively improved the reliability of the method. Attached Figure Description
[0013] Figure 1 This is an overall structural diagram of the present invention; Detailed Implementation
[0014] To make the technical solution of the present invention clearer, the present invention will be further described below with reference to the accompanying drawings. The present invention is implemented in specific steps:
[0015] (1) Prepare an image classification model M to be pruned;
[0016] (2) Create an initial random image that follows a uniform distribution. Then, based on the mean μ (μ=[0.485,0.456,0.406]) and standard deviation σ (σ=[0.229,0.224,0.225]) of the ImageNet dataset, Normalized to x, as the initial depth dream;
[0017]
[0018] (3) Input the initial deep dream x into the model M to obtain the classification probability vector P and the mean output vector O of all neurons in the convolutional layer where the neuron to be evaluated is located.
[0019] (4) The loss function L is set using the classification probability vector P, the mean output of the target neuron, and the mean output of other neurons in the convolutional layer to which the target neuron belongs:
[0020]
[0021] Where β represents the weighting coefficient, N c p represents the number of categories. j Let represent the probability that a deep dream is identified as class j, y represent the target class, m represent the convolutional layer where the target neuron is located, and N represent the probability that the deep dream is identified as class j. m This represents the total number of neurons in the m-th layer. Let represent the mean output value of the i-th neuron in the m-th layer, and z represent the z-th position of the target neuron in the m-th layer. Then, the image x is optimized multiple times using a loss function:
[0022]
[0023] Where α represents the learning rate, usually set to 0.2, x i This represents the image optimized up to round i. This process is repeated until a preset number of rounds is reached, typically 20 rounds. Finally, the optimized image is denormalized to obtain the trained deep learning image x. final ;
[0024] x final =σ*x+μ
[0025] (5) Re-input the obtained deep dream into model M to obtain the predicted probability p of the target category. y ;
[0026] (6) Preset a probability threshold p T , usually p T Set to 0.95, based on the predicted probability p of the target category. y With probability threshold p T Determine whether a neuron is significant for class y, and then decide whether to prune that neuron.
[0027]
[0028] When p y Greater than the threshold p T If the neuron is a key neuron for class y, it should be retained; otherwise, it can be pruned.
Claims
1. A deep learning model pruning method, characterized in that, The steps for assessing differences in model information include: (1) Prepare an image classification model to be pruned. ; (2) Create initial random images that follow a uniform distribution and normalize them according to the mean and variance of the ImageNet dataset for use in training deep dreams; (3) inputting the initial deep dream into the model , obtaining the mean of the output activation map of each neuron of each layer in the model and the classification probability vector output by the model classifier ; (4) Using classification probability vectors The loss function is jointly set by the mean output of the neuron to be evaluated and the mean output of other neurons in the convolutional layer to which the neuron belongs. Then, the loss function is used to optimize the deep dream in multiple rounds, and finally, the mean and variance of the ImageNet dataset are denormalized to obtain the final deep dream. (5) re-input the obtained deep dream into the model to obtain the prediction probability of the target category ; (6) the predicted probability according to the target category with a preset probability threshold whether the neuron is important to the target category, so as to determine whether to prune the neuron The method for obtaining deep dreams in step (4) is as follows: Utilizing a classification probability vector , target neuron output mean, output mean of other neurons of a convolution layer to which the neuron belongs, collectively set a loss function : ; in, Represents the weighting coefficient. Represents the number of categories. The representative of deep dreams was identified as the first The probability of a class Represents the target category. This represents the convolutional layer containing the target neuron. Representing the The total number of neurons in the layer, Representing the Layer The average output value of each neuron The target neuron is located in the first... The first layer Then, the loss function is used to process the image. Perform multiple rounds of optimization: ; in Represents the learning rate. Representative optimized to the number The process is repeated for each round of images until the preset number of rounds is reached. Finally, the optimized images are normalized to obtain the trained deep dream. The method for determining whether a neuron is a key neuron in step (6) is as follows: According to the prediction probability of the depth dream completed training belonging to the target category With a preset probability threshold Judge whether the neuron is important to the first Category, so as to judge whether to prune the neuron: ; When greater than the threshold value , it means that the neuron is a key neuron of the first class classification, and needs to be retained, otherwise it is pruned.