{'fraction_non_alphanumeric': 0.043225270157938485, 'fraction_numerical': 0.01763706675340634, 'mean_word_length': 4.5797539826577935, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
HRank: Filter Pruning using High-Rank Feature Map

Neural network pruning offers a promising prospect to facilitate deploying deep neural networks on resource-limited devices. However, existing methods are still challenged by the training inefficiency and labor cost in pruning designs, due to missing theoretical guidance of non-salient network components. In this paper, we propose a novel filter pruning method by exploring the High Rank of feature maps (HRank). Our HRank is inspired by the discovery that the average rank of multiple feature maps generated by a single filter is always the same, regardless of the number of image batches CNNs receive. Based on HRank, we develop a method that is mathematically formulated to prune filters with low-rank feature maps. The principle behind our pruning is that low-rank feature maps contain less information, and thus pruned results can be easily reproduced. Besides, we experimentally show that weights with high-rank feature maps contain more important information, such that even when a portion is not updated, very little damage would be done to the model performance. Without introducing any additional constraints, HRank leads to significant improvements over the state-of-the-arts in terms of FLOPs and parameters reduction, with similar accuracies. For example, with ResNet-110, we achieve a 58.2%-FLOPs reduction by removing 59.2% of the parameters, with only a small loss of 0.14% in top-1 accuracy on CIFAR-10. With Res-50, we achieve a 43.8%-FLOPs reduction by removing 36.7% of the parameters, with only a loss of 1.17% in the top-1 accuracy on ImageNet. The codes can be available at https://github.com/lmbxmu/HRank.


Introduction
Convolutional Neural Networks (CNNs) have demonstrated great success in computer vision applications, like classification [33,11], detection [7,30], and segmentation [25,2]. However, their high demands in computing power and memory footprint prohibit most state-of-the-art CNNs to be deployed in edge devices such as smartphones or wearable devices. While good progress has been made in designing new hardware and/or hardware-specific CNN acceleration frameworks like TensorRT, it retains as a significant demand to reduce the FLOPs and size of CNNs, with limited compromise on accuracy [4]. Popular techniques include filter compression [6], parameter quantization [3], and network pruning [10].
Among them, network pruning has shown broad prospects in various emerging applications. Typical works either prune the filter weights to obtain sparse weight matrices (weight pruning) [10,9,1], or remove entire filters from the network (filter pruning) [18,19,20]. Besides network compression, weight pruning approaches can also achieve acceleration on specialized software [28] or hardware [8]. However, they have limited applications on general-purpose hardware or BLAS libraries. In contrast, filter pruning approaches do not have this limitation since entire filters are removed. In this paper, we focus on the filter pruning to achieve model compression (reduction in parameters) and acceleration (reduction in FLOPs), aiming to provide a versatile solution for devices with low computing power.
The core of filter pruning lies in the selection of filters, which should yield the highest compression ratio with the lowest compromise in accuracy. Based on the design of filter evaluation functions, we empirically categorize filter pruning into two groups as discussed below.
Property Importance: The filters are pruned based on the intrinsic properties of CNNs. These pruning approaches do not modify the network training loss. After the pruning, the model performance is enhanced through fine-tuning. Among these methods, Hu et al. [14] utilized the sparsity of outputs in a large network to remove filters with a high percentage of zero activations. The 1 -norm based pruning [18] assumes that parameters or features with small norms are less informative, and thus should be pruned first. Molchanov et al. [27] considered the first-order gradient to evaluate the importance of filters and removed the least important ones. In [34], the importance scores of the final responses are propagated to every filter in the network and the CNNs are pruned by removing the one with the least importance. He et al. [12] calculated the geometric median in the layers, and the filters closest to this are pruned. Most designs for filter evaluation functions are ad-hoc, which brings the advantage of low time complexity, but also limits the acceleration and compression ratios.
Adaptive Importance: Different from the property importance based approaches, another direction embeds the pruning requirement into the network training loss, and employs a joint-retraining optimization to generate an adaptive pruning decision. Liu et al. [24] and Zhao et al. [36] imposed a sparsity constraint on the scaling factor of the batch normalization layer, allowing channels with lower scaling factors to be identified as unimportant. Huang et al. [16] and Lin et al. [23] introduced a new scaling factor parameter (also known as a mask) to learn a sparse structure pruning where filters corresponding to a scaling factor of zero are removed. Compared with property importance based filter pruning, adaptive importance based methods usually yield better compression and acceleration results due to their joint optimization. However, because the loss is changed, the required retraining step is heavy in both machine time and human labor, usually demanding another round of hyper-parameter tuning. For some methods, e.g., the mask-based scheme, the modified loss even requires specialized optimizers [16,23], which affects the flexibility and ease of using approaches based on adaptive importance.
Overall, filter pruning remains an open problem so far. On one hand we pursuit higher compression/acceleration ratios, while on the other hand we are restricted by heavy machine time and human labor (especially for adaptive importance based methods). We attribute these problems to the lack of practical/theoretical guidance regarding to the filter importance and redundancy. In this paper, we propose an effective and efficient filter pruning approach that explores the High Rank of the feature map in each layer (HRank), as shown in Fig. 1. The proposed HRank performs as such a guidance, which is a property importance based filter pruner. It eliminates the need of introducing additional auxiliary constraints or retraining the model, thus simplifying  Figure 1. Framework of HRank. In the left column, we first use images to run through the convolutional layers to get the feature maps. In the middle column, we then estimate the rank of each feature map, which is used as the criteria for pruning. The right column shows the pruning (the red filters), and fine-tuning where the green filters are updated and the blue filters are frozen. the pruning complexity. Moreover, compared with existing property importance based methods, HRank also leads to significant improvements in acceleration and compression [18,34] , achieving even better results than state-of-the-art adaptive importance based methods [13,24,26,16,23,36]. The motivation behind enforcing the high rank of feature maps comes from an empirical and quantitative observation. As shown in Fig. 2, we have found that the average rank of feature maps generated by a single filter is always the same, regardless of how much data the CNN has seen. It suggests that the ranks of feature maps in deep CNNs can be accurately estimated using only a small portion of the input images, and thus can be highly efficient. Based on this idea, we mathematically prove that feature maps with lower ranks contribute less to accuracy. Thus the filters generating these feature maps can be removed first.
We conduct extensive experiments on two benchmarks, CIFAR-10 [17] and ImageNet [31], using many representative large CNN models, including VGGNet [32], GoogLeNet [33], ResNet [11] and DenseNet [15]. The results demonstrate the superior performance of HRank over existing filter pruning methods, including property importance based approaches [18,34] and state-of-the-art adaptive importance based models [13,24,26,16,23,36]. We also carry out experiments to show that, even when we freeze a portion of filters with high-rank feature maps during the fine-tuning after pruning, the model still retains high accuracy, which verifies our assumption.
To summarize, our main contributions are three-fold: • Based upon extensive statistical verification, we empirically demonstrate that the average rank of feature maps generated by a single filter is almost unchanged.
To the best of our knowledge, this is the first time this observation is reported.
• We mathematically prove that filters with lower-rank feature maps are less informative and thus less important to preserve accuracy, which can be removed first. The opposite is true for high-rank feature maps.

Related Work
Filter Pruning. Opposed to weight pruning, which prunes the weight matrices, filter pruning removes the entire filters according to certain metrics. Filter pruning not only significantly reduces storage usage, but also decreases the computational cost in online inference. As discussed in Sec. 1, filter pruning can be divided into two categories: property importance approaches and adaptive importance approaches. Property importance based filter pruning aims to exploit the intrinsic properties of CNNs (e.g., 1 -norm and gradient, etc), and then uses them as criteria for discriminating less important filters. For example, the sparser filters in [27] are considered less important while [14] prunes filters with smaller 1 -norm. In contrast, adaptive importance based filter pruning typically retrain the networks with additional constraints to generate an adaptive pruning decision. Beyond the related work discussed in Sec. 1, Luo et al. [26] established filter pruning as an optimization problem, where the filters are pruned based on the statistics information from the next layer. He et al. [13] proposed a two-step algorithm including a LASSO regression to remove redundant filters and a linear least square to construct the outputs.
Low-rank Decomposition. As shown in [5], neural networks tend to be over-parameterized, which suggests that the parameters in each layer can be accurately recovered from a small subset. Inspired by this, low-rank decomposition has emerged as an alternative for network compression. It approximates convolutional operations by representing the weight matrix as a low-rank product of two smaller matrices. Unlike pruning, it aims to reduce the computational costs of the network instead of changing the original number of filters. To this end, Denton et al. [6] exploited the linear structure of CNNs by exploring an appropriate lowrank approximation of the weights and keeping the accuracy within a 1% loss of the original model. Further, Zhang et al. [35] considered the subsequent nonlinear units while learning the low-rank decomposition to provide significant speed-up. Lin et al. [21] proposed a low-rank decomposition for both convolutional filters and fully-connected matrices, which are then solved by a closed-form solver with a fixed rank. Though low-rank decomposition can benefit the compression and speedup of CNNs, it normally incurs a large loss in accuracy under high compression ratios.
Discussion. Compared with weight pruning, filter pruning tends to be more favorable in reducing model complexity. Besides, its structured pruning can be easily integrated into the highly efficient BLAS libraries without specialized software or hardware support. Nevertheless, existing fil-ter pruning methods suffer from inefficient acceleration and compression (property importance based filter pruning) or machine and labor costs (adaptive importance based filter pruning), as discussed in Sec. 1. These two issues bring fundamental challenges to the deployment of deep CNNs on resource-limited devices. We attribute the dilemma to the missing of practical/theoretical guidance regarding to the filter importance and redundancy. We focus on the rank of feature maps and analyze its effectiveness both theoretically and experimentally. Note that our approach is orthogonal to low-rank decomposition approaches. We aim to prune filters generating low-rank feature maps rather than decompose filters. Note that, the low-rank methods can be integrated into our model (e.g., to decompose fully-connected layers) to achieve higher compression and speedup ratios.

Notations
Assume a pre-trained CNN model has a set of K convolutional layers 1 , and C i is the i-th convolutional layer. The parameters in C i can be represented as a set of 3- . n i represents the number of filters in C i and k i denotes the kernel size. The outputs of filters, i.e., feature maps, are denoted as g is the size of input images. h i and w i are the height and width of the feature map, respectively. In filter pruning, W C i can be split into two groups, i.e., a subset to be kept } and a subset, with less importance, to be pruned }, where I i j and U i j are the indices of the j-th important and unimportant filter, respectively. n i1 and n i2 are the number of important and unimportant filters, respectively. We have:

HRank
Filter pruning aims to identify and remove the less important filter set from I C i , which can be formulated as an optimization problem:  where measures the importance of a filter input to the CNN. Thus minimizing Eq. (1) is equal to removing the n i2 least important filters in C i .
In this framework, most prior works resort to directly designing L(·) on the filters. We argue that ad-hoc designs of L on the filters ignore the distribution of the input images as well as the output labels, and might be the reason why property importance based approaches show suboptimal performance. In contrast, in this paper, we propose to define L on the feature maps. The rationale lies in that the feature maps are an intermediate step that can reflect both the filter properties and the input images. As investigated in [37], individual feature maps, even within the same layer, play different roles in the network. Furthermore, they can capture how an input image is transformed in each layer, and finally, to the predicted labels. To that effect, we reformulate Eq. (1) as: where I is the input image, which is sampled from a distribution P (I).L(·) is used to estimate the information of feature maps o i j (I, :, :) generated by the filter w i j . In our settings, the expectation ofL(·) is proportional to L(·) in Eq. (1), i.e., the more information the feature map contains, the more important the corresponding filter is.
Thus our key problem falls in designing a proper func-tionL(·) which can well reflect the information richness of feature maps. Prior property importance based method [14] utilizes the sparsity of feature maps. It calculates the zero activations from extensive input images and removes the filters with a large portion of zeros in the feature maps. However, such a data-driven scheme heavily relies on the distribution P (I) of the input images, which is extremely complex to describe. While the Monte-Carlo approximation can be adopted, it is still intractable since a large number of input images (over ten thousand in [14]) are required to maintain a reasonable prediction.
Instead, we exploit the rank of feature maps which is demonstrated to be not only an effective measure of information, but also a stable representation across P (I). We first define our information measurement as: where Rank(·) is the rank of a feature map for input image I. We conduct a Singular Value Decomposition (SVD) for o i j (I, :, :): where r = Rank(o i j (I, :, :)) and r < r. δ i , u i and v i are the top-i singular values, left singular vector and right singular vector of o i j (I, :, :), respectively. It can be seen that a feature map with rank r can be decomposed into a lowerrank feature map with rank r , i.e., r i=1 σ i u i v T i , and some additional information, i.e., r i=r +1 σ i u i v T i . Hence, higher-rank feature maps actually contain more information than lower-rank ones. Thus, the rank can serve as a reliable measurement for information richness.

Tractability of Optimization
One critical point in the pruning procedures discussed above falls in the calculation of ranks. However, it is possible that the rank of the feature maps o i j ∈ R g×hi×wi is sensitive to the distribution of input images, P (I). For example, the rank of o i j (1, :, :) is not necessarily the same as that of o i j (2, :, :). To accurately estimate the expectation of ranks, extensive input images have to be used, as with [14]. This poses a great challenge when evaluating the relative importance of filters.
Fortunately, we empirically observe that the expectation of ranks generated by a single filter is robust to the input images. To illustrate, we plot the average of rank values w.r.t. different numbers of input batches in Fig. 2. It is obvious that the colors (which indicate the values) of the average ranks from a single filter are the same, which are irrespective to the image that CNNs receive. To explain, although different images may have different ranks, the variance is negligible. Hence, a small batch of input images can be used to accurately estimate the expectation of the feature map rank. Then, we define the rank expectation of feature map o i j as: In our experiments, we set the number of images, g = 500, to estimate the average rank, which is several orders of magnitude smaller than [14], where over ten thousand input images are used to estimate the sparsity of feature maps. Besides, calculating the ranks of feature maps can be implemented offline. Hence, Eq. (3) is easily tractable using the above approximation. Combining Eq. (2) and Eq. (5), we derive our final optimization objective as follows: Rank o i j (t, :, :) , It is intuitive that Eq. (6) can be minimized by pruning the filters with n i2 least average ranks of feature maps.
Pruning Procedure. Given filters W C i in C i and their generated feature maps O i , as defined in Sec. 3.1, we prune W C i as follows: First, we calculate the average rank of feature map o i j in O i , forming a rank set R i = {r i 1 , r i 2 , ..., r i ni } ∈ R ni . Second, we re-rank the rank set in decreasing orderR i = {r i j is the index of the j-th top value in R i . Third, we determine the values of n i1 (number of preserved filters) and n i2 (number of pruned filters). Fourth, we obtain the important filter set Similarly, we obtain the filter set }. Lastly, we remove the set U C i and fine-tune the network with I C i as the initialization.

Experimental Settings
Datasets and Baselines. To demonstrate our efficiency in reducing model complexity, we conduct experiments on both small and large datasets, i.e., CIFAR-10 [17] and Im-ageNet [31]. We study the performance of different algorithms on the mainstream CNN models, including VG-GNet with a plain structure [32], GoogLeNet with an inception module [33], ResNet with a residual block [11] and DenseNet with a dense block [15]. Fig. 3 provides standards for pruning these popular networks. For all benchmarks and architectures, we randomly sample 500 images to estimate the average rank of each feature map.
Evaluation Protocols. We adopt the widely-used protocols, i.e., number of parameters and required Float Points Operations (denoted as FLOPs), to evaluate model size and computational requirement. To evaluate the task-specific capabilities, we provide top-1 accuracy of pruned models and the pruning rate (denoted as PR) on CIFAR-10, and top-1 and top-5 accuracies of pruned models on ImageNet.
Configurations. We use PyTorch [29] to implement the proposed HRank approach. We solve the optimization problem by using Stochastic Gradient Descent algorithm (SGD) with an initial learning rate of 0.01. The batch size, weight decay and momentum are set to 128, 0.0005 and 0.9, respectively. For each layer, we retrain the network for 30 epochs after pruning 2 , with the learning rate being divided by 10 at epochs 5 and 10 on CIFAR-10, and divided by 10 every 10 epochs on ImageNet. All experiments are conducted on two NVIDIA GTX 1080Ti GPUs. It is worth noting that for ResNet-50 on ImageNet, instead of fine-tuning the network every time after pruning a convolution layer, we prune the network in a per-block fashion, i.e. we fine-tune the network only after performing pruning within the entire  . An illustration of mainstream network structures to be pruned, including Plain structure [32], Inception module [33], Residual block [11] and Dense block [15]. The black lines denote the inference streams of CNNs. The red dots denote the outputs of a convolutional layer (i.e., feature maps). The red dashed lines denote the to-be-pruned layers after observing the ranks of feature maps. Note that, for 1 × 1 convolutions followed by n × n convolution (n = 3 in (b)), we do not consider pruning the 1 × 1 filter since it contains fewer parameters and less computation compared with an n × n filter.
block, as shown in Fig. 3 (c). So the computational cost can be further reduced, which is important for large-scale datasets such as ImageNet. For a fair comparison, we fix the accuracy to be similar to the baselines and measure the parameters and FLOPs reductions, or fix similar reductions of parameters and FLOPs, and measure the accuracy.

Results on CIFAR-10
We analyze the performance on CIFAR-10, comparing against several popular CNNs, including VGG-16, GoogLeNet, ResNet56/110 and DenseNet-40. We use a variation of VGG-16, as in [18]. Following the state-ofthe-art baseline [23], the output of the original GoogLeNet is changed to fit the class number in CIFAR-10. And for DenseNet-40, it has 40 layers with a growth rate of 12. VGG-16. Tab. 1 shows the performance of different methods, including a property importance based method, i.e., L1 [18] and several adaptive importance based methods, i.e., SSS [16], Zhao et al. [36] and GAL [23]. Compared with L1, HRank provides significantly better parameters and FLOPs reductions (53.5% vs. 34.3% and 82.9% vs. 64.0%), which demonstrates the superiority of exploiting the rank of feature maps as an intrinsic property of Hence, HRank demonstrates its ability to compress and accelerate a neural network with a plain structure.
GoogLeNet. The results for GoogLeNet are shown in Tab. 2. HRank again demonstrates its ability to obtain a high accuracy of 94.53%, with around 55% FLOPs and parameters reduction. This is significantly better than L1 and randomized pruning, which indicates that pruning with HRank is more compact and efficient. Furthermore, compared with adaptive importance based methods, GAL-ApoZ and GAL-0.05, HRank obtains a better top-1 accuracy (94.07% vs. 92.11% by GAL-ApoZ and 93.93% by GAL-0.05), faster acceleration (70.4% vs. 50.0% by GAL-ApoZ and 38.2% by GAL-0.05.) and more compact parameters (69.8% reduction vs. 53.7% by GAL-ApoZ and 49.3% by GAL-0.05%). Without introducing additional constraints, HRank still reduces model complexity while maintaining a good accuracy, showing that the ranks of feature maps can serve as a discriminative property for identifying the redundant filters. Besides, it demonstrates that HRank can be effectively applied to compressing neural networks with inception modules.
ResNet-56/110. We compress ResNet-56 and ResNet-110, results of which are displayed in Tab. 3. We begin with ResNet-56. Under similar FLOPs and parameters reduction with L1, HRank obtains an excellent top-1 accuracy (93.52% vs. 93.06%), which is even better than the  Therefore, the rank can effectively reflect the relative importance of a filter and serve as a better intrinsic property. Finally, in comparison with GAL-0.5, HRank greatly reduces the model complexity (58.2% vs. 48.5% for FLOPs and 59.2% vs. 44.8% for parameters) with only a small loss in accuracy of 0.14%, while GAL-0.5 suffers a 0.95% accuracy drop. Moreover, we also maintain a similar accuracy with GAL-0.5 (92.65% vs. 92.55%). Obviously, HRank further accelerates the computation (68.6% vs. 48.5%) and relieves the overload (68.7% vs. 44.8%). This indicates that HRank is especially suitable for pruning neural networks with residual blocks.
DenseNet-40. Tab. 4 summarizes the experimental results on DenseNet. We observe that HRank has the poten-

Ablation Study
We conduct detailed ablation studies on variants of HRank and keeping a portion of filters frozen during finetuning. For brevity, we report the results of the ResNet-56 with top-1 accuracy of 93.17% in Tab. 3. Similar observations can be found in other networks and datasets. Variants of HRank. Three variants are proposed to demonstrate the appropriateness of preserving filters with high-rank feature maps, including: (1) Edge: Filters generating both low-and high-rank feature maps are pruned, (2) Random: Filters are randomly pruned. (3) Reverse: Filters generating high-rank feature maps are pruned. The pruning rate is set to be the same as that with 93.17% top-1 accuracy of HRank in Tab. 3. We report the corresponding top-1 accuracy for each variant in Fig. 4. Among the variants, Edge shows the best performance. To analyze, though part of filters with high-rank feature maps removed, it retains some of those with relatively high-rank feature maps, which contains rich information. Besides, HRank obviously outperforms its variants and Reverse performs the worst, demonstrating that low-rank feature maps contain less information and the corresponding filters can be safely removed.
Freezing Filters during Fine-tuning. We show that not updating filters with higher-rank feature maps does little damage to the model performance. To that effect, we show the top-1 accuracy w.r.t. different rates of untrained weights in Fig. 5. In Fig. 5(a), all the reserved filters are involved in updating, which yields a top-1 accuracy of 93.17% (this can be seen as the upper boundary for Fig. 5(b) and Fig. 5(c)). In Fig. 5(b), around 15% -20% of filters are untrained, which returns a top-1 accuracy of 93.13%, which is only slightly worse than the 93.17% of Fig. 5(a). The effect of a larger percentage of untrained filters is displayed in Fig. 5(c), consisting of around 20% -25% of the overall weights. The pruned model obtains a top-1 accuracy of 93.01%. Though with a 0.11% drop in performance, it still outperforms the methods compared in Fig. 3. Fig. 5 well supports our claim that feature maps with high ranks contain more information.

Conclusions
In this paper, we present a novel filter pruning method called HRank, which determines the relative importance of filters by observing the rank of feature maps. To that effect, we empirically demonstrate that the average rank of feature maps generated by a single filter are always the same. Then, we mathematically prove that filters that gen-  erate lower-rank feature maps are less important and should be removed first, and vice versa, which is also verified by the experiments. In addition, we propose to freeze a portion of the filters producing high-rank feature maps to further reduce the fine-tuning cost, showing little compromise to the model performance. Extensive experiments on various modern CNNs demonstrate the effectiveness of HRank in reducing the computational complexity and model size. In the future work, we will do more on the theoretical analysis on why the average rank of feature maps generated by a single filter are always the same.