Method, device, processor and computer readable storage medium thereof for model compression based on correlation and entropy of feature maps

By calculating the correlation and two-dimensional entropy of feature maps, and combining the Gram matrix to evaluate the relationship between feature maps and perform weighted pruning, the problem of redundant parameters being difficult to remove in existing technologies is solved, and model compression and performance recovery are achieved, making it suitable for lightweight edge devices.

CN116843004BActive Publication Date: 2026-02-24SHANGHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310823678.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-06
Publication Date
2026-02-24
Estimated Expiration
2043-07-06

AI Technical Summary

Technical Problem

Existing technologies fail to effectively combine feature map correlation and 2D entropy to prune convolutional neural networks, making it difficult to remove redundant parameters and affecting model compression performance.

Method used

By calculating the correlation and two-dimensional entropy of feature maps, the relationship between feature maps is evaluated using the Gram matrix, and weighted fusion pruning is performed to restore network performance.

Benefits of technology

It effectively reduces the time cost and computing resources of convolutional neural networks, is suitable for lightweight edge devices, and maintains high accuracy and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116843004B_ABST
    Figure CN116843004B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of method for realizing model compression based on the correlation and entropy of feature map, comprising the following steps: obtaining image classification dataset, and pre-processing;Obtain the pre-training model of convolutional neural network disclosed on the network;Using the output feature map in the convolution layer in convolutional neural network architecture is obtained by using hook function HOOK, and is saved;The correlation of feature map is calculated;Feature map two-dimensional entropy is calculated;Weighted fusion pruning;Restore performance.The present application also relates to a kind of device for realizing model compression based on the correlation and entropy of feature map, processor and its computer readable storage medium.The method for realizing model compression based on the correlation and entropy of feature map, device, processor and its computer readable storage medium of the present application effectively reduce the time cost and computing resources of convolutional neural network, and are applied to lightweight edge device.The information richness in feature map reflects the importance of filter, and the amount of information in feature map is well represented by entropy in information theory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence, and more particularly to the field of model pruning systems. Specifically, it relates to a method, apparatus, processor, and computer-readable storage medium for model compression based on the correlation and entropy of feature maps. Background Technology

[0002] The development of convolutional neural networks (CNNs) has had a profound impact on many computer vision tasks. However, as the difficulty of computer vision tasks continues to increase, the size of the corresponding CNNs is also gradually increasing, and the computational power and memory consumption requirements for training and deploying these networks are becoming increasingly demanding. Therefore, these advanced CNNs cannot be directly deployed in embedded systems and mobile platforms, severely hindering their application and widespread adoption. To address this, many solutions have been proposed, including model pruning methods.

[0003] Model pruning is a method to achieve compact and lightweight networks by removing redundant network structures and parameters from pre-trained models. Filter pruning, in particular, removes redundant convolutional kernels from the original neural network, resulting in a neural network with a smaller parameter size. Simultaneously, filter pruning can effectively reduce the number of model parameters and computational cost while maintaining a certain level of accuracy, thus achieving compression and acceleration of convolutional neural networks. Furthermore, existing deep learning libraries support filter pruning without requiring dedicated hardware or software. Therefore, filter pruning has become the most popular structured pruning method, and many filter pruning methods have been proposed, achieving satisfactory experimental results.

[0004] Previous research has proposed numerous effective methods for compressing convolutional neural network models, but we have found that few studies combine two factors of feature maps: feature map relevance and two-dimensional entropy. On the one hand, the two-dimensional entropy of a feature map can serve as an effective indicator of its information richness. On the other hand, the relationships between feature maps (e.g., feature relevance) play a crucial role in preserving effective features; that is, if two feature maps have high similarity in feature relevance, one of them can be considered for removal. However, previous research has not considered both feature map relevance and two-dimensional entropy, which fails to effectively remove redundant parameters in convolutional neural network models. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method, apparatus, processor and computer-readable storage medium for model compression based on feature map correlation and entropy, which has good accuracy, low performance loss and wide applicability.

[0006] To achieve the above objectives, the present invention provides a method, apparatus, processor, and computer-readable storage medium for model compression based on the correlation and entropy of feature maps, as follows:

[0007] The main feature of this model compression method based on the correlation and entropy of feature maps is that the method includes the following steps:

[0008] (1) Obtain the image classification dataset and perform preprocessing;

[0009] (2) Obtain publicly available pre-trained convolutional neural network models online;

[0010] (3) Use the hook function to obtain and save the output feature maps of the convolutional layers in the convolutional neural network architecture;

[0011] (4) Calculate the correlation of the feature maps;

[0012] (5) Computational characteristics Figure 2 Dimensional entropy;

[0013] (6) Weighted fusion pruning;

[0014] (7) Recovery performance.

[0015] Preferably, step (4) specifically includes the following steps:

[0016] (4.1) Calculate the feature correlation between any two feature maps within the same convolutional layer using the Gram matrix;

[0017] (4.2) Calculate the cumulative inner product of a feature map with other feature maps.

[0018] Preferably, in step (4.1), calculating the feature correlation between any two feature maps within the same convolutional layer specifically involves:

[0019] The feature correlation between any two feature maps within the same convolutional layer can be calculated using the following formula:

[0020]

[0021] in, This represents the inner product of the i-th feature map and the j-th feature map. and N represents the activation values ​​of the i-th and j-th feature maps at position k in layer l, respectively. l This represents the number of output feature maps in the l-th layer.

[0022] Preferably, in step (4.2), calculating the cumulative inner product of a feature map with other feature maps specifically involves:

[0023] Calculate the cumulative inner product of a feature map with other feature maps using the following formula:

[0024]

[0025] in, N represents the cumulative inner product of the i-th feature map and other feature maps in the same layer. l This represents the number of output feature maps in the l-th layer. It is the inner product of the i-th feature map and the n-th feature map.

[0026] Preferably, step (5) specifically includes:

[0027] Let (g, a) represent the spatial feature formed by the pixel grayscale, where g and a represent the grayscale value of the pixel and the mean grayscale value of the neighborhood, respectively, and g and a take the same value range, both being [0, 255]. Calculate the probability definition of p(g, a) appearing in the feature map, and calculate the 2D entropy value of the i-th feature map in the l-th convolutional layer.

[0028] Preferably, the probability definition for calculating the occurrence of p(g, a) in the feature map in step (5) is as follows:

[0029] The probability of p(g, a) appearing in the feature map is defined using the following formula:

[0030]

[0031] Where p(g, a) is the number of times the feature binary (g, a) appears, and m h and m ω It is the dimension of the i-th feature map;

[0032] In step (5), the 2D entropy value of the i-th feature map in the l-th convolutional layer is calculated as follows:

[0033] The 2D entropy value of the i-th feature map in the l-th convolutional layer is calculated using the following formula:

[0034]

[0035] in, V represents the 2D entropy value of the i-th feature map in the l-th convolutional layer. ga It is the probability that p(g, a) appears in the feature map.

[0036] Preferably, step (6) specifically includes the following steps:

[0037] (6.1) Weight the correlation and two-dimensional entropy of the feature map;

[0038] (6.2) Sort the importance of each feature map in each layer, and prune the filters corresponding to the feature maps at the bottom of the ranking according to the set pruning rate.

[0039] Preferably, in step (6.1), the correlation and two-dimensional entropy of the feature map are weighted, specifically as follows:

[0040] The correlation and two-dimensional entropy of the feature map are weighted according to the following formula:

[0041]

[0042] in, η represents the importance score of the i-th feature map in the l-th convolutional layer, and η is the weight coefficient.

[0043] The main feature of this device for model compression based on the correlation and entropy of feature maps is that the device includes:

[0044] A processor is configured to execute computer-executable instructions;

[0045] The memory stores one or more computer-executable instructions, which, when executed by the processor, implement the steps of the above-described method for model compression based on feature map correlation and entropy.

[0046] The processor for model compression based on feature map correlation and entropy is characterized in that the processor is configured to execute computer-executable instructions, which, when executed by the processor, implement the various steps of the aforementioned method for model compression based on feature map correlation and entropy.

[0047] The computer-readable storage medium is characterized in that it stores a computer program that can be executed by a processor to implement the various steps of the above-described method for model compression based on feature map correlation and entropy.

[0048] The present invention employs a method, apparatus, processor, and computer-readable storage medium for model compression based on feature map correlation and entropy. Model compression, especially model pruning, can effectively reduce the time cost and computational resources of convolutional neural networks and is well-suited for lightweight edge devices. However, current pruning methods mostly focus on the inherent properties of the filters themselves to prune the network, paying less attention to the relationship between filters and feature maps. For feature maps, higher uniqueness is better, indicating lower correlation with other feature maps and better reflecting information not found in other feature maps. If such feature maps are pruned, it is difficult to recover their unique information during network fine-tuning. Furthermore, the Gram matrix in style transfer is suitable for evaluating the correlation between feature maps. Moreover, the information richness in a feature map reflects the importance of the filter, and entropy in information theory can well represent the amount of information in a feature map. Attached Figure Description

[0049] Figure 1 This is an overall structural diagram of the method for model compression based on the correlation and entropy of feature maps according to the present invention.

[0050] Figure 2 This is a flowchart of the method for model compression based on the correlation and entropy of feature maps according to the present invention. Detailed Implementation

[0051] To more clearly describe the technical content of the present invention, the following description is provided in conjunction with specific embodiments.

[0052] The method for model compression based on the correlation and entropy of feature maps according to the present invention includes the following steps:

[0053] (1) Obtain the image classification dataset and perform preprocessing;

[0054] (2) Obtain publicly available pre-trained convolutional neural network models online;

[0055] (3) Use the hook function to obtain and save the output feature maps of the convolutional layers in the convolutional neural network architecture;

[0056] (4) Calculate the correlation of the feature maps;

[0057] (5) Computational characteristics Figure 2 Dimensional entropy;

[0058] (6) Weighted fusion pruning;

[0059] (7) Recovery performance.

[0060] In a preferred embodiment of the present invention, step (4) specifically includes the following steps:

[0061] (4.1) Calculate the feature correlation between any two feature maps within the same convolutional layer using the Gram matrix;

[0062] (4.2) Calculate the cumulative inner product of a feature map with other feature maps.

[0063] In a preferred embodiment of the present invention, the step (4.1) of calculating the feature correlation between any two feature maps within the same convolutional layer specifically involves:

[0064] The feature correlation between any two feature maps within the same convolutional layer can be calculated using the following formula:

[0065]

[0066] in, This represents the inner product of the i-th feature map and the j-th feature map. and N represents the activation values ​​of the i-th and j-th feature maps at position k in layer l, respectively. l This represents the number of output feature maps in the l-th layer.

[0067] In a preferred embodiment of the present invention, the step (4.2) of calculating the cumulative inner product of a certain feature map with other feature maps specifically involves:

[0068] Calculate the cumulative inner product of a feature map with other feature maps using the following formula:

[0069]

[0070] in, N represents the cumulative inner product of the i-th feature map and other feature maps in the same layer. l This represents the number of output feature maps in the l-th layer. It is the inner product of the i-th feature map and the n-th feature map.

[0071] In a preferred embodiment of the present invention, step (5) specifically comprises:

[0072] Let (g, a) represent the spatial feature formed by the pixel grayscale, where g and a represent the grayscale value of the pixel and the mean grayscale value of the neighborhood, respectively, and g and a take the same value range, both being [0, 255]. Calculate the probability definition of p(g, a) appearing in the feature map, and calculate the 2D entropy value of the i-th feature map in the l-th convolutional layer.

[0073] In a preferred embodiment of the present invention, the probability definition of p(g, a) appearing in the feature map in step (5) is as follows:

[0074] The probability of p(g, a) appearing in the feature map is defined using the following formula:

[0075]

[0076] Where p(g, a) is the number of times the feature binary (g, a) appears, and m h and m ω It is the dimension of the i-th feature map;

[0077] In step (5), the 2D entropy value of the i-th feature map in the l-th convolutional layer is calculated as follows:

[0078] The 2D entropy value of the i-th feature map in the l-th convolutional layer is calculated using the following formula:

[0079]

[0080] in, V represents the 2D entropy value of the i-th feature map in the l-th convolutional layer. ga It is the probability that p(g, a) appears in the feature map.

[0081] In a preferred embodiment of the present invention, step (6) specifically includes the following steps:

[0082] (6.1) Weight the correlation and two-dimensional entropy of the feature map;

[0083] (6.2) Sort the importance of each feature map in each layer, and prune the filters corresponding to the feature maps at the bottom of the ranking according to the set pruning rate.

[0084] In a preferred embodiment of the present invention, step (6.1) involves weighting the correlation and two-dimensional entropy of the feature map, specifically as follows:

[0085] The correlation and two-dimensional entropy of the feature map are weighted according to the following formula:

[0086]

[0087] in, η represents the importance score of the i-th feature map in the l-th convolutional layer, and η is the weight coefficient.

[0088] The apparatus for model compression based on feature map correlation and entropy of the present invention, wherein the apparatus comprises:

[0089] A processor is configured to execute computer-executable instructions;

[0090] The memory stores one or more computer-executable instructions, which, when executed by the processor, implement the steps of the above-described method for model compression based on feature map correlation and entropy.

[0091] The processor of the present invention, which implements model compression based on the correlation and entropy of feature maps, is configured to execute computer-executable instructions, which, when executed by the processor, implement the various steps of the above-described method for implementing model compression based on the correlation and entropy of feature maps.

[0092] The computer-readable storage medium of the present invention stores a computer program thereon, which can be executed by a processor to implement the various steps of the above-described method for model compression based on feature map correlation and entropy.

[0093] This invention proposes a model compression method based on the correlation and entropy of feature maps, the method comprising the following steps:

[0094] (1) Obtain and preprocess the image classification dataset: publicly available labeled datasets (CIFAR-10, ImageNet) were used. Rotation, scaling, and other operations were performed on the datasets used in the experiment (which had been divided into training, validation, and test sets).

[0095] (2) Obtain publicly available pre-trained convolutional neural network models (such as VGGNet-16, ResNet-56, ResNet-110, etc.).

[0096] (3) Use the hook function HOOK to obtain the output feature map of the convolutional layer in the convolutional neural network architecture and save it.

[0097] (4) Calculate the correlation of the feature maps:

[0098] For feature maps, higher uniqueness is better, indicating lower correlation with other feature maps and a greater ability to reflect information not found in other feature maps. Pruning such feature maps makes it difficult to recover their unique information during network fine-tuning. Furthermore, the Gram matrix in style transfer is found to be suitable for evaluating the correlation between feature maps.

[0099] Therefore, a feature map correlation evaluation metric based on the Gram matrix is ​​proposed. The Gram matrix is ​​essentially the eccentric covariance matrix between features. It calculates the correlation between features in each channel. The Gram matrix is ​​used to describe feature map correlation, thereby guiding filter pruning. The Gram matrix can be represented as... The Gram matrix calculates the correlation between two features, and the diagonal elements of the Gram matrix reflect the number of times each feature appears in the image. Therefore, the feature correlation between any two feature maps within the same convolutional layer is defined as follows.

[0100]

[0101] in, This represents the inner product of the i-th feature map and the j-th feature map, which is used to calculate the correlation between the i-th feature map and the j-th feature map. and N represents the activation values ​​of the i-th and j-th feature maps at position k in layer l, respectively. l This represents the number of output feature maps in the l-th layer. The larger the value, the stronger the feature correlation between feature map i and feature map j. This also proves that the redundancy between these two feature maps is very high.

[0102] The above calculation establishes the feature correlation between any two different feature maps within the same convolutional layer. Next, to better measure the feature correlation of a given feature map, we will accumulate the feature correlation of that feature map as one of the metrics for evaluating the importance of the filter.

[0103] The expression is shown in equation (2).

[0104]

[0105] in This represents the cumulative inner product of the i-th feature map and other feature maps in the same layer, which is to calculate the correlation between the i-th feature map and other feature maps in the same layer.

[0106] (5) Features Figure 2 Entropy calculation:

[0107] Various features of an image are reflected in feature maps within a network structure. However, feature maps contain highly complex information, leading to increased computational costs for the network. Therefore, finding valuable information within this complex dataset becomes crucial. Entropy, described in information theory, is a measure of information and uncertainty, directly proportional to the amount of information. Therefore, two-dimensional entropy, which reflects the spatial distribution characteristics of information in feature maps, is used as an indicator for calculating the amount of information in feature maps.

[0108] Let (g, a) represent the spatial features that form a binary feature with the pixel gray level, where g and a represent the gray level value of the pixel and the average gray level of the neighborhood, respectively, and g and a take the same value range, both being [0, 255].

[0109] To more comprehensively represent the grayscale features of a pixel location in the feature map and the grayscale distribution of surrounding pixels, the probability of p(g, a) appearing in the feature map is defined by equation (3):

[0110]

[0111] Where p(g, a) is the number of occurrences of the feature binary (g, a), and m h and m ω It is the dimension of the i-th feature map. Then, the information content of a feature map can be calculated as follows.

[0112]

[0113] in V represents the 2D entropy value of the i-th feature map in the l-th convolutional layer. ga It is the probability that p(g, a) appears in the feature map.

[0114] The above method requires only a small number of samples to estimate the amount of effective information contained in each feature map and accurately estimate the importance of the corresponding filter, thereby saving a lot of inference overhead.

[0115] (6) Weighted fusion pruning:

[0116] The methods for calculating the relevance and two-dimensional entropy of feature maps are described separately, but these are only single metrics for evaluating feature maps and cannot comprehensively measure their attributes. Next, the relevance and two-dimensional entropy of feature maps are combined as evaluation metrics for feature map importance to guide filter pruning. Equation (5) is used to weight the relevance and two-dimensional entropy of feature maps.

[0117]

[0118] in Let represent the importance score of the i-th feature map in the l-th convolutional layer, and η be the weighting coefficient used to balance the influence of feature map relevance and information capacity on feature map importance. Then, the importance of each feature map in each layer is sorted, and the filters corresponding to the bottom-ranked feature maps are pruned according to a set pruning rate. The pruned network structure is obtained through these operations.

[0119] (7) Performance recovery: Fine-tune the pruned network to recover the lost performance.

[0120] In a specific embodiment of the present invention, the following is an example of a convolutional neural network pruning method based on the correlation and entropy of feature maps:

[0121] (1) Pre-trained convolutional neural network model and image classification dataset setup: The convolutional neural network model used in this embodiment is the VGGNet-16 architecture, using the CIFAR-10 dataset. This dataset has 10 categories and a total of 60,000 color images, of which 50,000 color images are used for training and 10,000 color images are used for testing. Data augmentation processes such as horizontal flipping and normalization were applied to the dataset in this embodiment.

[0122] (2) Pre-trained model parameter settings: Iterative training for 300 epochs, with a batch size of 128. The initial learning rate was set to 0.01 and divided by 10 at the 150th and 225th training epochs. The network loss function used the SGD optimizer, with a momentum term coefficient of 0.9 and a weight decay coefficient of 5e-3.

[0123] (3) Obtain the output feature map of VGGNet-16 architecture: Use the hook function to obtain the output feature map of a total of 13 convolutional layers in the VGGNet-16 architecture and save it.

[0124] The subsequent steps are as described above.

[0125] To demonstrate the technical effectiveness of this invention, image classification validation was performed on an image classification dataset, and relevant experimental data were recorded. Specifically, the Top-1 accuracy, FLOPs pruning rate (FPR), and parameter pruning rate (PPR) of the pruning model were recorded on the CIFAR-10 test dataset. Furthermore, the Top-5 accuracy was also added to the records on the ImageNet dataset. The Top-1 accuracy and Top-5 accuracy represent the accuracy of the first-ranked class matching the actual result and the accuracy of the top five classes containing the actual result, respectively. Under similar image classification accuracy conditions, higher FLOPs pruning rate and parameter pruning rate are better, indicating that the method prunes more FLOPs and parameters.

[0126] Table 1

[0127]

[0128] Pruning experiments were conducted on CIFAR-10 using the VGGNet-16 architecture. As shown in Table 1, the proposed method outperforms the current state-of-the-art pruning methods in all performance metrics. Specifically, the proposed method achieves an accuracy of 94.08%, a 0.33% improvement over the baseline, with a reduction of 43.8% in the number of FLOPs and 78.4% in the number of parameters. When the FPR and PPR reach 68.4% and 83.9% respectively, the proposed method achieves a Top-1 accuracy of 93.69% with a 0.06% loss in accuracy compared to the baseline. With a similar number of parameters, the proposed method improves Top-1 accuracy by 0.35% and speeds up the process by 14.9% compared to HRank. At similar accuracy, the proposed method achieves a higher FPR (68.4% vs. 58.1%) and PPR (83.9% vs. 81.6%) than CHIP. Furthermore, when the accuracy of this method is 93.08%, it overwhelmingly outperforms CHIP, FSIM-E, Feng et al., and HRank on all metrics.

[0129] Table 2

[0130]

[0131] (2) Table 2 shows the results of ResNet-50 on ILSVRC-2012. As can be seen from Table 2, compared to the standard ResNet-50, this method reduces FLOPs by 55.6% and model memory by 52.5%, while sacrificing 0.72% Top-1 accuracy and 0.29% Top-5 accuracy. With similar FLOP reduction, this method achieves higher accuracy than FPGM and SCOP. Compared to SFP, ThiNet, and GAL-0.5, this method performs well in all aspects. With similar Top-1 accuracy, this method achieves higher Top-5 accuracy (92.58% vs. 92.55%) and better FLOP pruning rate (55.6% vs. 44.9%) than Lu et al. This pruning method achieves 73.4% FPR and 68.6% PPR, while also achieving 73.59% Top-1 and 91.47% Top-5, outperforming GDP-0.5, GAL-0.5-joint, and HRank. Furthermore, compared to AKECP, FilterSketch, and CLR-RNF, this method achieves faster acceleration without significant loss of accuracy.

[0132] For the specific implementation scheme of this embodiment, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.

[0133] It is understood that the same or similar parts in the above embodiments can be referred to each other, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.

[0134] It should be noted that in the description of this invention, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means at least two.

[0135] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.

[0136] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution device. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0137] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The corresponding program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiments.

[0138] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0139] The storage media mentioned above can be read-only memory, disk, or optical disk, etc.

[0140] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0141] The present invention employs a method, apparatus, processor, and computer-readable storage medium for model compression based on feature map correlation and entropy. Model compression, especially model pruning, can effectively reduce the time cost and computational resources of convolutional neural networks and is well-suited for lightweight edge devices. However, current pruning methods mostly focus on the inherent properties of the filters themselves to prune the network, paying less attention to the relationship between filters and feature maps. For feature maps, higher uniqueness is better, indicating lower correlation with other feature maps and better reflecting information not found in other feature maps. If such feature maps are pruned, it is difficult to recover their unique information during network fine-tuning. Furthermore, the Gram matrix in style transfer is suitable for evaluating the correlation between feature maps. Moreover, the information richness in a feature map reflects the importance of the filter, and entropy in information theory can well represent the amount of information in a feature map.

[0142] In this specification, the invention has been described with reference to specific embodiments thereof. However, it will be apparent that various modifications and variations can be made without departing from the spirit and scope of the invention. Therefore, the specification and drawings should be considered illustrative rather than restrictive.

Claims

1. A method for model compression based on the correlation and entropy of feature maps, characterized in that, The method includes the following steps: (1) Obtain the image classification dataset and perform preprocessing; (2) Obtain publicly available pre-trained convolutional neural network models online; (3) Use the hook function to obtain and save the output feature maps of the convolutional layers in the convolutional neural network architecture; (4) Calculate the correlation of the feature maps; (5) Calculate the two-dimensional entropy of the feature map; (6) Weighted fusion pruning; (7) Recovery performance; Step (4) specifically includes the following steps: (4.1) Calculate the feature correlation between any two feature maps within the same convolutional layer using the Gram matrix; (4.2) Calculate the cumulative inner product of a feature map with other feature maps; In step (4.1), the feature correlation between any two feature maps within the same convolutional layer is calculated as follows: The feature correlation between any two feature maps within the same convolutional layer can be calculated using the following formula: in, This represents the inner product of the i-th feature map and the j-th feature map. and N represents the activation values ​​of the i-th and j-th feature maps at position k in layer l, respectively. l This represents the number of output feature maps in the l-th layer; In step (4.2), the cumulative inner product of a feature map with other feature maps is calculated as follows: Calculate the cumulative inner product of a feature map with other feature maps using the following formula: in, N represents the cumulative inner product of the i-th feature map and other feature maps in the same layer. l This represents the number of output feature maps in the l-th layer. It is the inner product of the i-th feature map and the n-th feature map.

2. The method for model compression based on the correlation and entropy of feature maps according to claim 1, characterized in that, Step (5) specifically refers to: Let (g, a) represent the spatial feature formed by the pixel grayscale, where g and a represent the grayscale value of the pixel and the mean grayscale value of the neighborhood, respectively, and g and a take the same value range, both being [0, 255]. Calculate the probability definition of p(g, a) appearing in the feature map, and calculate the 2D entropy value of the i-th feature map in the l-th convolutional layer.

3. The method for model compression based on the correlation and entropy of feature maps according to claim 2, characterized in that, The probability definition for calculating the occurrence of p(g, a) in the feature map in step (5) is as follows: The probability of p(g, a) appearing in the feature map is defined using the following formula: Where p(g, a) is the number of times the feature binary (g, a) appears, and m h and m ω It is the dimension of the i-th feature map; In step (5), the 2D entropy value of the i-th feature map in the l-th convolutional layer is calculated as follows: The 2D entropy value of the i-th feature map in the l-th convolutional layer is calculated using the following formula: in, V represents the 2D entropy value of the i-th feature map in the l-th convolutional layer. ga It is the probability that p(g, a) appears in the feature map.

4. The method for model compression based on the correlation and entropy of feature maps according to claim 1, characterized in that, Step (6) specifically includes the following steps: (6.1) Weight the correlation and two-dimensional entropy of the feature map; (6.2) Sort the importance of each feature map in each layer, and prune the filters corresponding to the feature maps at the bottom of the ranking according to the set pruning rate.

5. The method for model compression based on the correlation and entropy of feature maps according to claim 4, characterized in that, In step (6.1), the correlation and two-dimensional entropy of the feature map are weighted, specifically as follows: The correlation and two-dimensional entropy of the feature map are weighted according to the following formula: in, η represents the importance score of the i-th feature map in the l-th convolutional layer, and η is the weight coefficient.

6. An apparatus for model compression based on the correlation and entropy of feature maps, characterized in that, The device includes: A processor is configured to execute computer-executable instructions; The memory stores one or more computer-executable instructions, which, when executed by the processor, implement the steps of the method for model compression based on feature map correlation and entropy as described in any one of claims 1 to 5.

7. A processor for model compression based on the correlation and entropy of feature maps, characterized in that, The processor is configured to execute computer-executable instructions, which, when executed by the processor, implement the steps of the method for model compression based on feature map correlation and entropy as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, It stores a computer program that can be executed by a processor to implement the steps of the method for model compression based on feature map correlation and entropy as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Structured network model compression acceleration method based on multistage pruning

    CN110619385A

  • Parcel identification method and system based on pruning lightweight model

    CN114548884A