A Dynamic Clustering Channel Pruning Method Based on Reinforcement Learning
By employing a reinforcement learning-based dynamic clustering channel pruning method, which utilizes hypergraph convolution and PPO reinforcement learning to automatically identify redundant channels, the deployment problem of convolutional neural networks in resource-constrained environments is solved, achieving efficient model compression and optimization.
Patent Information
- Application Number
- CN202511650638.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-12
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2045-11-12
AI Technical Summary
The deployment of existing convolutional neural networks in resource-constrained environments is limited by the surge in the number of model parameters and computational cost. Traditional pruning methods lack adaptability and are difficult to avoid suboptimal compression results.
A dynamic clustering channel pruning method based on reinforcement learning is adopted. By dynamically modeling the high-order similarity of channels through hypergraph convolution, and combining PPO reinforcement learning for fine decision-making, the pruning rate is automatically determined and redundant channels are identified.
While reducing the computational cost and number of parameters in the model, the inference performance was optimized, improving the model's compression efficiency and generalization ability, and achieving more efficient network pruning.
Smart Images

Figure CN121119019B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of deep learning technology, and in particular relates to a dynamic clustering channel pruning method based on reinforcement learning. Background Technology
[0002] The emergence and development of Convolutional Neural Networks (CNNs) have significantly propelled progress in the field of artificial intelligence. The ever-increasing demands for model performance and continuous technological innovation have driven the increasing complexity of CNN structures, leading to a surge in the number of model parameters and floating-point operations (FLOPs). This significantly increases the model's storage overhead and exacerbates inference latency. Therefore, this severely restricts the practical deployment and engineering application of CNNs in resource-constrained environments (such as spaceborne platforms with strictly limited power consumption and insufficient memory bandwidth / capacity). Model lightweighting is one solution to bridge the gap between high-performance models and limited hardware resources. Key work includes low-rank decomposition, knowledge distillation, quantization, and network pruning. Among these, pruning, which can simply and effectively remove redundant weights and structures, has received wider attention.
[0003] Network pruning research mainly revolves around two core issues: quantifying the pruning rate and establishing generalizable pruning criteria. In early pruning work, researchers manually assigned different pruning rates to different layers or modules of the model based on prior knowledge. This intuitive paradigm lacks adaptability to the model's intrinsic properties. When the model architecture or target task changes, a tedious re-tuning process is required, and it is difficult to avoid generating sub-optimal compression results. Automated pruning has emerged to address this need. These methods aim to guide the model to autonomously optimize a hierarchical optimal sparsity distribution based on task data and its own architectural characteristics through an adaptive learning process, thereby improving compression efficiency and enhancing generalization ability. Among the many paths to automated exploration, Deep Reinforcement Learning (DRL) offers a highly attractive framework. This method models the process of determining the pruning rate as a sequential decision-making problem: the control decision network (Agent) interacts with the network environment and learns the optimal policy through continuous attempts, autonomously selecting appropriate pruning actions for each layer, thereby efficiently searching for solutions that balance model accuracy and compression rate in a huge policy space. Summary of the Invention
[0004] In view of this, the present invention aims to provide a dynamic clustering channel pruning method based on reinforcement learning. This method automatically determines the network pruning rate using reinforcement learning and also possesses the ability to identify redundant channels, thereby making more refined decisions based on channel content. Simultaneously, the present invention provides a dynamic clustering method based on hypergraph convolution. Hypergraph convolution dynamically models the high-order similarity of state vectors and provides a characterization of channel functional redundancy for predicting compression ratio, thus improving pruning efficiency.
[0005] To achieve the above objectives, the technical solution created by this invention is implemented as follows:
[0006] A dynamic clustering channel pruning method based on reinforcement learning includes:
[0007] S1: Pre-train the classical classification network using training images to obtain a pre-trained network model. The classical classification network is an image classification network model.
[0008] S2: Statistically analyze the multi-frequency response of each layer in the pre-trained network model in step S1 to construct a channel-level network state representation;
[0009] S3: Construct a hypergraph using the network state representation built in step S2 as vertices, and use hypergraph convolution to aggregate the information of the vertices in the hypergraph to obtain an updated hypergraph; based on the updated hypergraph, plan the pruning method of the pre-trained network model;
[0010] S4: Using reinforcement learning, the pre-trained network model is pruned according to the pruning method obtained in step S3, and the pruned network is trained again using the training images to obtain the final network model.
[0011] Furthermore, step S2 includes:
[0012] S21: The DCT method is used to obtain the spectral distribution of the output feature map of each layer of the pre-trained network model, and the spectral components containing low-frequency and high-frequency components are selected from the spectral distribution. The low-frequency and high-frequency components are then concatenated to obtain the frequency domain features.
[0013] S22: Divide the spectral components obtained in step S21 into equal-width intervals, and determine the frequency of each equal-width interval using the following formula:
[0014] ;
[0015] in, This represents the spectral component corresponding to the j-th channel in the output feature map of the i-th layer of the pre-trained network model. The frequency of the nth equal-width interval with a width of d;
[0016] S23: Based on the equal-width intervals divided in step S22, perform position encoding on the output feature map to obtain the position encoding index as follows:
[0017] ;
[0018] in, and represents the position encoding index in the output feature map of the i-th layer network, which is located in the 2n and 2n+1 equal-width intervals respectively, where N represents the total number of equal-width intervals;
[0019] S24: The network state representation of each layer of the network is obtained through the following formula.
[0020] ;
[0021] Among them, X i This represents the network state representation of the i-th layer network. PE represents the frequency domain characteristics of the i-th layer network. i This represents the position encoding index of the i-th layer of the network. c represents the number of channels in the output feature map of the i-th layer of the network. i The unit array.
[0022] Furthermore, in step S3, the process of obtaining the updated hypergraph includes:
[0023] The network state is represented as hypergraph vertices to construct a hypergraph, and a distance threshold is set;
[0024] For each hypergraph vertex, other hypergraph vertices whose Euclidean distance is less than the distance threshold are considered as neighbors of the current hypergraph vertex and connected by hyperedges;
[0025] The updated hypergraph is obtained by aggregating information using the following formula:
[0026] ;
[0027] Where Y represents the hyperedge features of the updated hypergraph, and W e D represents the weight of each hyperedge in the hypergraph before the update. e and D v Let represent the diagonal matrices of the vertices and hyperedges in the hypergraph before the update, respectively; Θ represent the learning parameters; and H represent the hypergraph adjacency matrix.
[0028] Furthermore, in step S3, the pruning method of the pre-trained network model includes removing nodes from the pre-trained network model that meet the predicted pruning rate according to the pruning order.
[0029] Furthermore, methods for obtaining the predicted pruning rate include:
[0030] The following attention operation is performed on the hypergraph nodes in the updated hypergraph to obtain a context vector with uniform dimensions:
[0031] ;
[0032] in, ω represents the context vector corresponding to the output feature map of the i-th layer of the network. j This represents the attention weight of the j-th channel. c represents the hypergraph node in the update hypergraph corresponding to the j-th channel in the output feature map of the i-th layer network. i This represents the number of channels in the output feature map of the i-th layer of the network;
[0033] The context vector is processed using a multilayer perceptron to output the predicted pruning rate.
[0034] Furthermore, the methods for obtaining the pruning order include:
[0035] Jaccard similarity is calculated for the hypergraph nodes in the updated hypergraph to obtain the global similarity score of the hypergraph nodes. The nodes are then sorted from largest to smallest according to their global similarity scores to obtain the pruning order.
[0036] Furthermore, the process of calculating Jaccard similarity for the hypergraph nodes in the updated hypergraph to obtain the global similarity score of the hypergraph nodes includes:
[0037] The Jaccard similarity between any two hypergraph nodes in the updated hypergraph is calculated using the following formula:
[0038] ;
[0039] Where J(a,b) represents the Jaccard similarity between hypergraph node a and hypergraph node b, and N e (a) and N e (b) represent the hyperedges involved in hypergraph node a and hypergraph node b, respectively;
[0040] The arithmetic mean of the Jaccard similarities between node a and other hypergraph nodes in the updated hypergraph is taken as the global similarity score of the hypergraph node.
[0041] Furthermore, in step S4, the PPO reinforcement learning method is used to prune the pre-trained network model. The process includes:
[0042] S41: Collect the state information of the pre-trained network at each reinforcement learning time step;
[0043] S42: Calculate the action value function of the control decision network in PPO reinforcement learning, which performs pruning actions under the current network state information;
[0044] S43: Then, the evaluation network predicts the state value of the control decision network after performing the pruning action through PPO reinforcement learning;
[0045] S44: Subtract the action value function from the state value function to obtain the advantage function that can be generated by performing the pruning action;
[0046] S45: Update the pruning action according to the dominance function until the preset number of updates is reached, and then complete the network pruning.
[0047] Furthermore, the pre-trained network state information in step S41 includes: the state of the pre-trained network at the current time step, the pruning action performed on the pre-trained network at the current time step, the probability of performing the pruning action on the pre-trained network at the current time step, and the reward function after performing the pruning action.
[0048] Furthermore, in step S45, the pruning action is updated based on the dominance function using the following formula:
[0049] ;
[0050] Where L represents the objective function of the update process, θ represents the learning parameters, and E t r represents the expected value at time step t. t ε represents the reward after performing the pruning action, ε represents the hyperparameter limiting the policy update magnitude, and clip represents the truncation function. This represents the dominance function.
[0051] Compared with the prior art, the present invention can achieve the following beneficial effects:
[0052] This invention presents a dynamic clustering channel pruning method based on reinforcement learning. It uses the statistical responses of channels across multiple spectra to represent network states, providing the necessary prior information for refined decision-making. Simultaneously, it provides a dynamic clustering method based on hypergraph convolution, leveraging the ability of hypergraph convolution to integrate complex information, extracting high-order information between channels, and modeling the high-order functional similarity of channels. This design effectively identifies redundant channels. Finally, combining the provided prior information for refined decision-making, reinforcement learning is used to enable interaction between the network model and the environment. By continuously learning the optimal policy, it autonomously selects appropriate pruning actions for each layer, thereby efficiently searching for solutions that balance model accuracy and compression ratio within a vast policy space. Multiple comparative experiments demonstrate that the proposed method outperforms existing state-of-the-art algorithms in reducing model computation and parameter count, and optimizing inference performance, validating its superiority. Attached Figure Description
[0053] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments and descriptions of the invention are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:
[0054] Figure 1 A flowchart illustrating the dynamic clustering channel pruning method based on reinforcement learning as described in an embodiment of the present invention;
[0055] Figure 2 A flowchart illustrating the dynamic clustering channel pruning method based on reinforcement learning as described in an embodiment of the present invention;
[0056] Figure 3 The comparison results are based on whether the pruning method provided in the embodiments of the present invention is performed in the ResNet-50 network.
[0057] Figure 4 The comparison results are based on whether the pruning method provided in the embodiments of the present invention is performed in the MobileNet-V2 network;
[0058] Figure 5 The comparison results are based on whether the pruning method provided in the embodiments of the present invention is performed in the VGG-16 network.
[0059] Figure 6 The results show the comparison of different pruning methods in the ResNet-50 network;
[0060] Figure 7 The results are a comparison of different pruning methods in the MobileNet-V2 network;
[0061] Figure 8 The results show a comparison of different pruning methods in a VGG-16 network.
[0062] Figure 9 The results show the inference acceleration and memory usage of different pruning methods on the Nvidia 3090 GPU in the ResNet-50 network. Detailed Implementation
[0063] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not constitute a limitation thereof.
[0064] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.
[0065] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on this invention. Furthermore, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, features defined with "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0066] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0067] The invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0068] like Figures 1 to 2 As shown in the embodiments of the present invention, the dynamic clustering channel pruning method based on reinforcement learning includes:
[0069] S1: Pre-train the classic classification network using training images to obtain a pre-trained network model. The classic classification network is an image classification network model.
[0070] In this embodiment of the invention, three classic image classification networks—ResNet-50, MobileNet-V2, and VGG-16—are pre-trained using training images. 80% of the images are selected as the training set, and 20% as the validation set. During pre-training, a stochastic gradient descent (SGD) optimizer is used to train the networks. The initial learning rates for ResNet-50, MobileNetV2, and VGG-16 are 0.1, 0.1, and 0.001, respectively. The learning rate is adjusted exponentially per epoch, with a weight decay of 0.0005, a momentum of 0.9, 120 epochs, and a batch size of 128. The pruned networks are then fine-tuned using the same configuration.
[0071] S2: Statistically analyze the multi-frequency response of each layer in the pre-trained network model in step S1 to construct a channel-level network state representation.
[0072] This invention employs a state representation paradigm carrying channel-level semantic information. This enhanced state representation aims to provide data-driven insights beyond macroscopic structures, delving deeper into what a layer is, analyzing which channels within that layer contain functionalities, and the relative importance of those channels. By revealing the functional roles of channels, this invention hopes to learn more complex, content-aware pruning rules. Specifically, in some embodiments, step S2 includes:
[0073] S21: The DCT (Discrete Cosine Transform) method is used to obtain the spectral distribution of the output feature map of each layer of the pre-trained network model. Then, spectral components containing low-frequency and high-frequency components are selected from the spectral distribution, and the low-frequency and high-frequency components are concatenated to obtain the frequency domain features.
[0074] In this invention, step S21 specifically includes:
[0075] The spectral coefficients of the output feature map are obtained using the DCT method:
[0076] ;
[0077] in, This represents the spectral coefficient with frequency indices (α, β) at pixel position (h, w) in the output feature map, where H and W represent the height and width of the output feature map, respectively. Based on the spectral coefficients... The spectral distribution is obtained using the following formula:
[0078] ;
[0079] Among them, S α,β s represents the spectral distribution with frequency indices (α,β). h,w This represents the feature response at pixel position (h,w) in the output feature map.
[0080] The goal of this invention is to characterize the function of channels from two complementary dimensions. Therefore, representative low-frequency and mid-frequency components are selected: the low-frequency component directly reflects the overall presence and salience of the visual pattern represented by the corresponding channel in the entire input image. In tasks such as scene classification, it can strongly activate a specific category or high-level semantic concept. The mid-frequency component measures the rate of change of the internal values of the feature in space, focusing on capturing the microscopic and local statistical characteristics of the input, and can be used to describe the texture features composed of repetitive arrangements. The extracted low-frequency and high-frequency components are concatenated to obtain the frequency domain features.
[0081] S22: Divide the spectral components obtained in step S21 into equal-width intervals, and determine the frequency of each equal-width interval using the following formula:
[0082] ;
[0083] in, This represents the spectral component corresponding to the j-th channel in the output feature map of the i-th layer of the pre-trained network model. The frequency of the nth equal-width interval with a width of d;
[0084] S23: Based on the equal-width intervals divided in step S22, perform position encoding on the output feature map to obtain the position encoding index as follows:
[0085] ;
[0086] in, and represents the position encoding index in the output feature map of the i-th layer network, which is located in the 2n and 2n+1 equal-width intervals respectively, where N represents the total number of equal-width intervals;
[0087] S24: The network state representation of each layer of the network is obtained through the following formula.
[0088] ;
[0089] Among them, X i This represents the network state representation of the i-th layer network. PE represents the frequency domain characteristics of the i-th layer network. i This represents the position encoding index of the i-th layer of the network. c represents the number of channels in the output feature map of the i-th layer of the network. i The unit array.
[0090] S3: Construct a hypergraph using the network state representation built in step S2 as vertices, and use hypergraph convolution to aggregate the information of the vertices in the hypergraph to obtain an updated hypergraph; based on the updated hypergraph, plan the pruning method of the pre-trained network model.
[0091] The goal of this invention is not only to limit the allocation of pruning rates but also to the ability to identify redundant channels. To this end, a dynamic clustering method is proposed. In step S2, a novel environmental state is obtained, which includes the low- and mid-frequency responses of channels across multiple samples, characterizing their functional differences. Therefore, it is hoped that clustering methods can be used to solve for the similarity of states, revealing the redundancy and complementarity relationships between channels. However, as the network depth increases, the data dimensionality of this channel-level representation method increases dramatically. Simultaneously, the performance of states varies significantly across different layers; mid-frequency information in shallow features is more active, while deep features are dominated by low-frequency information, posing a challenge to processing information from different layers. These two characteristics make clustering exceptionally difficult, and traditional methods based on pairwise relationships or simple distance metrics struggle to effectively model complex interactions between multiple parties. In contrast, hypergraph clustering directly connects multiple vertices through hyperedges, fully capturing high-order relationships. Considering the inherent complexity of state information, this invention conducts research on dynamic clustering of channel states based on hypergraph methods, optimizing the representation of similarity between channels.
[0092] Specifically, in some embodiments, the process of obtaining the updated hypergraph includes:
[0093] The network state is represented as a hypergraph constructed from hypergraph vertices, and a distance threshold is set. In this embodiment of the invention, the network state is represented as a hypergraph G=(V,E,W) constructed from hypergraph vertices. e ), where V represents the set of vertices, E represents the set of hyperedges, and W e This represents the weight of each hyperedge in the hypergraph. In this embodiment of the invention, the network state is represented as a hypergraph vertex, that is, the state of each channel in the output feature map of each layer of the network. Let V be the vertices of the hypergraph. Each vertex's feature is represented by its low- and mid-frequency responses. The modulus of the vertex set V is the number of channels in the output feature map of each layer of the network, i.e., |V| = c. j .
[0094] For each hypergraph vertex, other hypergraph vertices whose Euclidean distance is less than the distance threshold are considered as neighbors of the current hypergraph vertex and connected by hyperedges.
[0095] In this embodiment of the invention, a distance threshold ε is set for each vertex v Centered on a vertex, consider other vertices with a Euclidean distance less than a threshold as its neighbors, and connect them via hyperedge e. Connection. Each cluster is a hyperedge in the hypergraph, defined as: The hyperedges involved in each vertex are represented as follows: The hypergraph adjacency matrix H is a matrix composed of 0s and 1s.
[0096] To obtain higher-order correlations between channels, hypergraph convolution is used to aggregate intra-cluster relationships. Specifically, the updated hypergraph is obtained by aggregating information using the following formula:
[0097] ;
[0098] Where Y represents the hyperedge features of the updated hypergraph, and W e D represents the weight of each hyperedge in the hypergraph before the update. e and D v Let represent the diagonal matrices of the vertex and hyperedge degree in the hypergraph before the update, respectively, and Θ represent the learning parameters.
[0099] In some embodiments, the pruning method of the pre-trained network model includes removing nodes from the pre-trained network model that meet the predicted pruning rate, according to the pruning order, wherein:
[0100] Methods for obtaining the predicted pruning rate include:
[0101] Because the number of channels varies at each layer of the network, the processing requires handling variable-length state sequences. Therefore, this invention uses a simple learnable attention mechanism to reduce the dimensionality of variable-length sequences. Specifically, the following attention operation is performed on the hypergraph nodes in the updated hypergraph to obtain a context vector with uniform dimensionality:
[0102] ;
[0103] in, ω represents the context vector corresponding to the output feature map of the i-th layer of the network. j This represents the attention weight of the j-th channel. This represents the hypergraph node in the update hypergraph corresponding to the j-th channel in the output feature map of the i-th layer network;
[0104] The context vector is processed using a multilayer perceptron to output the predicted pruning rate.
[0105] The methods for obtaining the pruning order include:
[0106] Jaccard similarity is calculated for the hypergraph nodes in the updated hypergraph to obtain the global similarity score of the hypergraph nodes. The nodes are then sorted from largest to smallest according to their global similarity scores to obtain the pruning order.
[0107] Specifically, the process of calculating Jaccard similarity for hypergraph nodes in the updated hypergraph to obtain the global similarity score of the hypergraph nodes includes:
[0108] The Jaccard similarity between any two hypergraph nodes in the updated hypergraph is calculated using the following formula:
[0109] ;
[0110] Where J(a,b) represents the Jaccard similarity between hypergraph node a and hypergraph node b, and N e (a) and N e (b) represent the hyperedges involved in hypergraph node a and hypergraph node b, respectively;
[0111] The arithmetic mean of the Jaccard similarities between node a and other hypergraph nodes in the updated hypergraph is taken as the global similarity score of the hypergraph node, as shown in the following formula:
[0112] .
[0113] High-score vertices have highly overlapping functional representations, while low-score vertices are on the edge or belong to isolated clusters and have unique functions. High-score channels are pruned first according to the layer-by-layer pruning rate.
[0114] S4: Using reinforcement learning, the pre-trained network model is pruned according to the pruning method obtained in step S3, and the pruned network is trained again using the training images to obtain the final network model.
[0115] In some embodiments, the PPO reinforcement learning method is used to prune the pre-trained network model, and the process includes:
[0116] S41: Collect the pre-trained network state information at each reinforcement learning time step. The pre-trained network state information includes: the state of the pre-trained network at the current time step, the pruning action performed on the pre-trained network at the current time step, the probability of performing the pruning action on the pre-trained network at the current time step, and the reward function after performing the pruning action.
[0117] S42: Calculate the action value function of the control decision network in PPO reinforcement learning, which performs pruning actions under the current network state information.
[0118] In this embodiment of the invention, processing the entire network is considered as one cycle, and an action is output. To accelerate the policy search process, this embodiment extracts a portion of samples from the validation set for post-pruning model accuracy verification. Furthermore, the reward R in the PPO reinforcement learning process is used to measure the tendency of the new policy to select the same action relative to the old policy. Therefore, in this embodiment, when the network FLOPs at the predicted pruning rate are less than the target FLOPs, the reward R is set to -100, thereby encouraging the prediction results of pruning actions to tend towards a higher pruning rate.
[0119] S43: Then, the evaluation network predicts the state value of the control decision network after performing pruning actions through PPO reinforcement learning.
[0120] S44: Subtract the action value function from the state value to obtain the advantage function that can be generated by performing the pruning action.
[0121] S45: Update the pruning actions based on the dominance function until a preset number of updates is reached, then complete the network pruning. Specifically, update the pruning actions based on the dominance function using the following formula:
[0122] ;
[0123] Where L represents the objective function of the update process, θ represents the learning parameters, and E t r represents the expected value at time step t. t ε represents the reward after performing the pruning action, ε represents the hyperparameter limiting the policy update magnitude, and clip represents the truncation function. This represents the dominance function. In this embodiment of the invention, the number of updates is set to 20.
[0124] In this embodiment of the invention, step S4 further includes: fine-tuning the pruned network using the training set, with the specific parameter configuration being the same as in step S1. The fine-tuned network is then deployed on a specific inference platform, and the inference speed is measured to obtain the lightweight network inference results.
[0125] This invention analyzes the effectiveness of the pruning method provided by this invention from three perspectives: original comparison, comparison of the effects of various pruning methods, and processing performance analysis. Specifically, in the original comparison analysis, the NaSC-TG2 dataset was used to pre-train ResNet-50, MobileNet-V2, and VGG-16 network models, and pruning was performed on the three pre-trained network models. The number of channels of the network models without pruning and those processed by the pruning method provided by this invention were compared. Figures 3-5 As shown in the figure. It can be seen that the method provided by this invention can predict specific pruning strategies for different network topologies. In the comparison of the effects of various pruning methods, the embodiments of this invention also employ different existing pruning methods and compare them with the pruning method provided by this invention. Specifically, the embodiments of this invention use the NaSC-TG2 dataset and the NWPU-RESISC45 dataset to pre-train the ResNet-50 network model, the MobileNet-V2 network model, and the VGG-16 network model, respectively, obtaining a total of six network models. Seven existing methods and the pruning method provided by this invention are used to prune the six pre-trained network models, and the comparison results are shown in the figure. Figures 6-8 As shown, Baseline represents the original network model without pruning, and DCCP (Dynamic Clustering Channel Pruning) is the pruning method provided in this invention. From Figures 6-8It can be seen that the method provided by this invention can achieve good pruning results for all three classic classification networks. In the performance analysis, this embodiment of the invention applies the pruning method provided by this invention to a network model obtained by preprocessing ResNet-50 with the NaSC-TG2 dataset on an Nvidia 3090 GPU processor. The inference acceleration and memory usage results of the Nvidia 3090 GPU are as follows: Figure 9 As shown, this method brings a significant performance improvement to the actual inference of deep neural networks.
[0126] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this invention disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this invention can be achieved, and this is not limited herein.
[0127] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A dynamic clustering channel pruning method based on reinforcement learning, characterized in that, The method comprises the following steps: S1: pre-training a classical classification network by using training images to obtain a pre-trained network model, wherein the classical classification network is an image classification network model; S2: counting feature multi-frequency responses of each layer in the pre-trained network model to construct a network state representation at a channel level; S3: constructing a hypergraph with the network state representation constructed in step S2 as a vertex, performing information aggregation on the vertices in the hypergraph by using hypergraph convolution to obtain an updated hypergraph, and planning a pruning manner of the pre-trained network model based on the updated hypergraph; S4: performing network pruning on the pre-trained network model according to the pruning manner obtained in step S3 by using a reinforcement learning method, and re-training the network after pruning by using the training images to obtain a final network model.
2. The method of claim 1, wherein, Step S2 comprises: S21: obtaining a frequency spectrum distribution of an output feature map of each layer in the pre-trained network model by using a DCT method, and selecting spectral components containing low-frequency components and high-frequency components from the frequency spectrum distribution, and splicing the low-frequency components and the high-frequency components to obtain a frequency domain feature; S22: dividing the spectral components obtained in step S21 into equal-width intervals, and determining the frequency of each equal-width interval by the following formula: ; wherein, represents the spectral component corresponding to the jth channel in the output feature map of the ith layer network in the pre-trained network model the frequency in the nth equal-width interval with width d S23: performing position coding on the output feature map based on the equal-width intervals divided in step S22 to obtain a position coding index of the following formula: ; wherein, and denote the position encoding indices of the 2n and 2n+1 equally- wide intervals, respectively, in the i-th layer network output feature map, and N denotes the total number of the equally- wide intervals. S24: obtaining the network state representation of each layer by the following formula ; where X i represents the network state representation of the i-th layer network, represents the frequency domain feature of the i-th layer network, PE i represents the position encoding index of the i-th layer network, represents the identity matrix of size c i the number of channels of the output feature map of the i-th layer network.
3. The method of claim 1, wherein, In step S3, the process of obtaining the updated hypergraph comprises: constructing a hypergraph with the network state representation as a vertex, and setting a distance threshold; for each hypergraph vertex, regarding the hypergraph vertices with other Euclidean distances less than the distance threshold as neighbors of the current hypergraph vertex, and connecting them by hyperedges; performing information aggregation by the following formula to obtain the updated hypergraph: ; where Y represents the hyperedge features of the updated hypergraph, W e represents the weight of each hyperedge in the hypergraph before updating, D e and D v respectively represent the diagonal matrix of the vertex and hyperedge degree in the hypergraph before updating, Θ represents the learning parameter, and H represents the hypergraph adjacency matrix.
4. The method of claim 1, wherein, In step S3, the pruning manner of the pre-trained network model comprises pruning nodes in the pre-trained network model according to a pruning order and in a number corresponding to a predicted pruning rate.
5. The method of claim 4, wherein, The method for obtaining the predicted pruning rate comprises: performing attention operation on the hypergraph nodes in the updated hypergraph by the following formula to obtain a context vector with uniform dimensions: ; wherein, represents the context vector corresponding to the output feature map of the i-th layer network, ω j represents the attention weight of the j-th channel, represents the supergraph node in the updated supergraph corresponding to the j-th channel of the output feature map of the i-th layer network, c i represents the number of channels of the output feature map of the i-th layer network; processing the context vector by using a multilayer perceptron to output the predicted pruning rate.
6. The method of claim 4, wherein the method further comprises: The method for obtaining the pruning order comprises: performing Jaccard similarity calculation on the hypergraph nodes in the updated hypergraph to obtain global similarity scores of the hypergraph nodes, sorting all the global similarity scores of the hypergraph nodes from large to small to obtain the pruning order.
7. The dynamic clustering channel pruning method based on reinforcement learning according to claim 6, characterized in that, The process of performing Jaccard similarity calculation on the hypergraph nodes in the updated hypergraph to obtain global similarity scores of the hypergraph nodes comprises: calculating the Jaccard similarity of any two hypergraph nodes in the updated hypergraph by the following formula: ; where J(a, b) represents the Jaccard similarity between hypergraph node a and hypergraph node b, N e (a) and N e (b) represent the hyperedges involved by hypergraph node a and hypergraph node b, respectively. taking the arithmetic mean of the Jaccard similarities of the node a and other hypergraph nodes in the updated hypergraph as the global similarity score of the hypergraph node.
8. The method of claim 4, wherein the method is based on reinforcement learning. The process of performing network pruning on the pre-trained network model by using the PPO reinforcement learning method in step S4 comprises: S41: collecting pre-trained network state information at each reinforcement learning time step; S42: calculate the action value function of the control decision network in the current network state information in PPO reinforcement learning to execute the pruning action; S43: then predict the state value of the control decision network after executing the pruning action by the evaluation network in PPO reinforcement learning; S44: difference between the action value function and the state value to obtain the advantage function that can be generated by executing the pruning action; S45: update the pruning action according to the advantage function until the preset number of updates is reached, and complete the network pruning.
9. The dynamic clustering channel pruning method based on reinforcement learning according to claim 8, characterized in that, The pre-training network state information in step S41 includes: the state of the pre-training network at the current time step, the pruning action performed on the pre-training network at the current time step, the probability of performing the pruning action on the pre-training network at the current time step, and the reward function after executing the pruning action.
10. The method of claim 8, wherein, In step S45, the pruning action is updated according to the advantage function by the following formula: ; where L denotes the objective function of the update process, θ denotes the learning parameter, E t denotes the expected value at time step t, r t denotes the reward after performing the pruning action, ε denotes a hyperparameter that limits the magnitude of policy updates, and clip denotes a clipping function, denotes the advantage function.
Citation Information
Patent Citations
CNN (Convolutional Neural Network) pruning rate automatic search method and system based on reinforcement learning
CN115829022A
Group division method and system based on individual moving mode dynamic hypergraph clustering
CN119830056A