Boosting Convolutional Neural Networks with Middle Spectrum Grouped
  Convolution
This paper proposes a novel module called middle spectrum grouped convolution
(MSGC) for efficient deep convolutional neural networks (DCNNs) with the
mechanism of grouped convolution. It explores the broad "middle spectrum" area
between channel pruning and conventional grouped convolution. Compared with
channel pruning, MSGC can retain most of the information from the input feature
maps due to the group mechanism; compared with grouped convolution, MSGC
benefits from the learnability, the core of channel pruning, for constructing
its group topology, leading to better channel division. The middle spectrum
area is unfolded along four dimensions: group-wise, layer-wise, sample-wise,
and attention-wise, making it possible to reveal more powerful and
interpretable structures. As a result, the proposed module acts as a booster
that can reduce the computational cost of the host backbones for general image
recognition with even improved predictive accuracy. For example, in the
experiments on ImageNet dataset for image classification, MSGC can reduce the
multiply-accumulates (MACs) of ResNet-18 and ResNet-50 by half but still
increase the Top-1 accuracy by more than 1%. With 35% reduction of MACs, MSGC
can also increase the Top-1 accuracy of the MobileNetV2 backbone. Results on MS
COCO dataset for object detection show similar observations. Our code and
trained models are available at https://github.com/hellozhuo/msgc.
Zhuo Su, Jiehua Zhang, Tianpeng Liu, Zhen Liu, Shuanghui Zhang, Matti Pietikäinen, Li Liu
# Boosting Convolutional Neural Networks with Middle Spectrum Grouped Convolution

###### Abstract

This paper proposes a novel module called middle spectrum grouped convolution (MSGC) for efficient deep convolutional neural networks (DCNNs) with the mechanism of grouped convolution. It explores the broad "middle spectrum" area between channel pruning and conventional grouped convolution. Compared with channel pruning, MSGC can retain most of the information from the input feature maps due to the group mechanism; compared with grouped convolution, MSGC benefits from the learnability, the core of channel pruning, for constructing its group topology, leading to better channel division. The middle spectrum area is unfolded along four dimensions: group-wise, layer-wise, sample-wise, and attention-wise, making it possible to reveal more powerful and interpretable structures. As a result, the proposed module acts as a booster that can reduce the computational cost of the host backbones for general image recognition with even improved predictive accuracy. For example, in the experiments on ImageNet dataset for image classification, MSGC can reduce the multiply-accumulates (MACs) of ResNet-18 and ResNet-50 by half but still increase the Top-1 accuracy by more than \(1\%\). With \(35\%\) reduction of MACs, MSGC can also increase the Top-1 accuracy of the MobileNetV2 backbone. Results on MS COCO dataset for object detection show similar observations. Our code and trained models are available at [https://github.com/hellozhuo/msgc](https://github.com/hellozhuo/msgc).

 Efficient networks, grouped convolution, network pruning, image recognition

## I Introduction

DCNN has revolutionized the computer vision community in many applications, from preliminary tasks like salient object detection [1] and edge detection [2], to semantically more sophisticated tasks like image classification [3], object detection [4], and human pose estimation [5]. The increasing prediction accuracy is usually at the cost of considerable consumed energies, with large computational cost by deep models [6]. How to reduce the computational cost of DCNNs without sacrificing accuracy has been a pressing topic, especially in the era of edge computing, since deep models are moving to resource constrained devices like smart phones and IoTs. In recent years, numerous efforts have been made in the community to tackle this issue, such as network pruning [7, 8], compact and lighter network design [9, 10], network quantization [11, 12], _etc._

Among these attempts, network pruning [7, 13, 14, 15, 16] and grouped convolution [17, 18, 19, 20, 21] have attracted tremendous research interests. The former aims to prune the unnecessary redundant parts of deep models to make them lighter and more efficient to run, while the latter focuses on constructing compact structures by splitting computational operations into groups. It is not surprising that many research works considered either of these two methods alone, since they are structurally independent. In this paper, we give a novel view by regarding them as two poles of a network designing spectrum (Fig. 1), inside which we find there are a big variety of structural possibilities that incorporate these two paradigms. Based on that, we further build our module that can effectively reveal powerful structures within the spectrum, outperforming both the previous channel pruning and grouped convolution based counterparts in both accuracy and computational cost. To make our motivation clearer, we start by giving a brief introduction on both methods below.

Without loss of generality, supposing a convolutional layer takes the input tensor \(\mathbf{X}\) with \(C\) channels and generates the output tensor \(\mathbf{Y}\), the convolutional operation can be formulated as:

\[\mathbf{Y}=[f^{1}(\pi^{1}(\mathbf{X})),f^{2}(\pi^{2}(\mathbf{X})),...,f^{G}( \pi^{G}(\mathbf{X})], \tag{1}\]

where \([,]\) represents the concatenation operation, \(G\) is the number of groups, \(f^{i}\) is a standard convolutional function that generates \(1/G\) part of \(\mathbf{Y}\), and \(\pi^{i}\) is a selecting function extracting a sub-tensor from \(\mathbf{X}\) with possibly fewer channels.

When \(G=1\) and \(\pi\equiv\mathbf{1}\in\left\{1\right\}^{1\times C}\), which means all the input channels are kept as they are, the formulation reduces to the standard convolution. As the network often contains feature

Fig. 1: MSGC reveals a powerful network structure in the “middle-spectrum” area.
redundancy, it might be unnecessary to keep all the input channels. It is essentially the design spirit of many channel pruning methods, which focus on tuning \(\pi\).

The grouped convolution is formulated when we set \(1<G\leq C\) and the reduction of feature redundancy is neatly organized in a predefined way. For example, \(\{\pi^{i}(\mathbf{X})|i=1,2,..,G\}\) are a series of regularly partitioned segments of the input tensor in the channel extent. This derived a lot of classical approaches in recent years like Deep Roots [20], ResNeXt [19], ShuffleNet [22], IGC series [21, 23, 24], UGConvs [25], ChannelNets [26], SCGNet [27], sharing grouped convolution [17], and the extreme case of depthwise separable convolution used in the Inception modules [28, 29], MobileNet [9], and Xception [30], where \(G=C\). One main focus of these methods is to design the correlation between groups to make the convolution complementary [21] (means that each output channel has at least one path to any of the input channels in the connection topology). Such encouragement of inter-group communication plays an important role in breaking the intrinsic order of channels [31] to maximally preserve the prediction accuracy.

However, we may rethink the relationship between the grouped convolution and channel pruning methods, since both aim to reduce the network redundancy from the channel extent. The design strategies behind them help us to derive the method proposed in the paper. The two frameworks are illustrated in Fig. 2.

On the one hand, channel pruning [13, 14, 15, 32, 33] attempts to learn the most important feature maps that contribute to the final prediction accuracy. Such **learnability** helps channel pruning to identify the unimportant channels that can be pruned without degrading the network performance significantly. However, since it is not easy to guarantee the correctness of such identification, or due to the bounded representation capacity by a pruning rate, there might always be some channels that contain specific useful and meaningful information than other channels. This is evidenced by the fact that a certain pruning rate usually causes a performance drop.

On the other hand, grouped convolution preserves all the input channels that may to some extent, avoid the above issue of information loss. In effect, different from channel pruning, grouped convolution hypothesizes that the grouped network can still learn enough information to give comparable prediction accuracy than the original network, by regularly sparsifying the connection but keeping all the input channels intact. In this way, the efforts on finding the most important channels, can be circumvented. In other words, grouped convolution is powered by **channel preservation**.

Generally, learning to prune and learning to group are manners that both lead to efficient and accurate networks. Previous works tend to consider them separately, which restrict their methods to go beyond.

We believe there is a better balance between information preservation and learnability that can be achieved by integrating both worlds toward building more powerful network structures. To achieve this, we proposed our module named MSGC (middle spectrum grouped convolution), which enables the learning process to find a structure in between, by unfolding the spectrum along four dimensions:

1. Group-wise: injecting learnability for each group to learn how to segment channels;
2. Layer-wise: allowing layer-dependent pruning ratios;
3. Sample-wise: dynamically building grouped connection topology for individual samples (middle of Fig. 2);
4. Attention-wise: decoupling channel gating and attention for individual groups.

We conduct extensive experiments including image classification and object detection on large-scale datasets on the ResNet [34], MobileNetV2 [10], and DenseNet [35] backbones, which consistently verify the superiority of MSGC compared with prior state-of-the-art methods. Those methods include both existing pruning-based and grouped convolution-based ones. Notably, we achieve not only the MAC reduction, but enhanced accuracy as well, due to the flexibility of forming groups. For example, on the ImageNet [36] dataset for image classification, MSGC reduces computational cost of the ResNet backbones by 50% and the MobileNetV2 backbone by 35% with even improved accuracy. On the MS COCO [37] dataset for object detection, MSGC can also effectively slim the backbones with negligible performance drop. In addition, MSGC can also be used to simply improve the prediction accuracy of the original networks with a relatively small pruning rate. In this case, the main role of MSGC transfers from an "computation booster" to a strong "accuracy booster".

The rest of this article is organized as follows. In Sec. II, we review the related works. Following that, we illustrate our method in detail in Sec. III. A comprehensive experimental comparison with state-of-the-art methods is provided in Sec. IV, with detailed ablation studies. Finally, we conclude our paper in Sec. V.

## II Related work

**Network pruning** aims to prune the network weights or feature maps in convolutional layers to make the network less redundant, therefore less computational cost or memory storage is used to achieve the similar accuracy as before pruning. According to the pruning granularity, network pruning is generally categorized into structured pruning and unstructured pruning. The former prunes network by removing individual weights, leading to irregular structures after pruning [16]. While the latter prunes groups of weights which belong to the whole filters, channels, or kernel blocks. Structured pruning keeps the pruned network in regular structures which can be more easily accelerated with existing

Fig. 2: Illustration of the three paradigms.
deep learning frameworks on hardware [14]. Therefore, it obtains more research attention than unstructured pruning in recent years. Among different methods, the core is how to evaluate the importance of network weights, thereby to guide the pruning process. Many kinds of criteria were developed during last years, such as reconstruction error [14, 15], \(\ell_{1}\)-norm and \(\ell_{2}\)-norm [8, 38, 39], geometric median [33], discrimination [40, 41], channel sensitivity [42], category-aware discrimination ability [13], _etc._ The way of pruning can also be searched [7, 32, 43, 44] or learnt with a slimmable structure [45, 46]. In addition, for dynamic pruning, which our methods are most related to, the importance scores can be directly generated [47, 48]. The proposed MSGC belong to structured pruning, more specifically, channel pruning, where the pruned weights are the complete kernels connected to some certain channels. The importance scores of the network weights are data-dependent, which are calculated on-the-fly with dynamic execution.

**Grouped convolution** dates back to AlexNet [49], if not earlier, where the convolutional filters were put on two GPUs to suit the network's training memory. However, the by-product of this "filter groups" inspired a lot of following grouped convolution-based methods like [19, 20, 22], to improve the performance and reduce the MACs of DCNNs. The main spirit of grouped convolution has been introduced in the previous section.

**MSGC-like methods**: Some previous works share certain similarities with our MSGC. Specifically, methods like LGC [31], FLGC [50], and DGC [18] can also preserve most or all of the input channels in a convolutional layer due to the group mechanism and at the same time benefit from the learnability for channel partition. However, these methods suffer from their relatively narrow exploration scores as shown in Fig. 1. For example, DGC [18] generates dynamic connection topology but is constrained with a predefined pruning rate in each layer. FBS [47] is a common dynamic channel pruning method without the consideration of grouped convolution. FLGC [50] and DGConv [51] actually shuffle the input channels (_i.e._, restrict each input channel belongs and only belongs to one group), and give fixed group topology. For LGC [31] and SG-CNN [52], they are only limited to the first dimension: learning how to divide the channels into groups. In contrast, our method searches for a highly optimal structure from all four dimensions, which leads to better efficiency and predictive performance compared with both channel pruning- and grouped convolution-based methods.

**Dynamic network** or conditional network tunes its network topology or filters on the fly depending on the current input data, which can better increase its representation power and achieve a desired balance between accuracy and efficiency. The runtime execution of DCNNs can be implemented by dynamically skipping the layers [53, 54], re-weighting the filters [55, 56], pruning the channels or pixels [57, 47, 58], decomposing the kernels [59], adjusting the nonlinear activations [60], routing the inference paths [61], cascading multiple networks [62]. A more comprehensive review can be found in [63]. The proposed MSGC can be seen as a dynamic routing method that adjusts its connection topology among channels at runtime, a dynamic pruning method on the channel level, and a dynamic filter re-weighting method, in which we can use data-dependent attention for the selected channels.

## III Methodology

### _Criteria_

To unfold the spectrum, namely, the possible structure candidates, from the four dimensions mentioned in Sec. I, we aim to build powerful structures that conform to the following criteria:

1. **Group-wise**: (Fig. 3 (a)) We inject learnability for each group to learn how to segment channels. It indicates a soft assignment of the input channels to each group. Therefore a more flexible group topology is learned during network training. It should be noted that our algorithm does not restrict each input channel to be assigned to only one group, but possibly zero, or multiple groups as well.
2. **Layer-wise**: (Fig. 3 (b)) Different layers are enabled to have varying pruning ratios, due to the fact the each layer has its own property. For example, shallower and deeper layers may extract image abstraction in different semantic levels. Allowing layer-wise pruning ratios is expected to give better performance.
3. **Sample-wise**: (Fig. 3 (c)) The connection topology (_e.g._, how the input and output channels are connected with each other) in groups would be dynamically determined depending on the individual input samples. It helps improve the adaptiveness of our network, _i.e._, enabling

Fig. 3: MSGC unfolds network structures along four dimensions during the learning process: (a) group-wise: input channels are assigned to certain group(s) in a learnable way; (b) layer-wise: the pruning rate automatically varies in different layers; (c) the connection topology varies with different samples even in the same layer. Please also see the illustration of attention-wise learning in our method part.
the network adapt to the varying characteristics of individual samples. The dynamic execution can also lead to a better optimization of resource allocation, as MSGC automatically learns to pay more computation for harder samples and vice versa, but keep the average computation at a low level.
4. **Attention-wise**: In order to prune or select particular channels (_i.e._, gating), one typical way is to firstly generate a saliency vector/matrix with each element corresponding to a channel, then use the _Top-K_[18, 47] function or thresholds [64, 50] to select the top ranking channels. After gating, the saliency values can be reused as the attention of the associated survived channels1[18, 47]. In this way, it essentially couples the functionality of gating and attention via the same saliency values. Instead, we decouple them in MSGC as two separate sub-modules to diversify the gating process. Footnote 1: By element-wise multiplying the feature map with the saliency value.

### _Detailed design of MSGC_

The overview of the MSGC, which can be plugged into existing general convolutional backbones, is shown in Fig. 4. Assuming we have a building block (_e.g._, a Bottleneck block in ResNet, a Reverted Bottleneck block in MobileNetV2, _etc._) consisting of \(M\) consecutive convolutional layers \(\{L_{i}|i=1,2,...,M\}\), where the input and output tensor of \(L_{i}\) have \(C_{i}\) and \(C_{i+1}\) channels, respectively (it should be noted that \(L_{1}\) is denoted as the first layer of the block, not the network), and supposing the group number for each layer is \(\{G_{i}|i=1,2,...,M\}\), the pipeline of building MSGC is detailed as follows:

**Step 1: Generating binary masks.** To segment the input channels into groups for each layer in a learnable way, we use binary gating masks \(\{\mathbf{B}_{i}^{G_{i}\times C_{i}}|i=1,2,...,M\}\), where each row in \(\mathbf{B}_{i}^{G_{i}\times C_{i}}\) only has 0/1 values representing which channels are selected (1) or not selected (0) to a certain group in layer \(i\). For example, \(\mathbf{B}_{3}^{2.5}=0\) means for the 3rd layer \(L_{3}\), the 5th input channel is not assigned to the 2nd group. We build a mask generator to create the gating masks, where we simply take the input of the block (which is also the input of \(L_{1}\)) as the input of the generator. Since each channel is a \(H\times W\) feature map, we use global average pooling (GAP) to firstly downsample the input to \(\mathbb{R}^{1\times C_{1}}\), followed by \(M\) light Multi-layer Perceptrons (MLPs) to generate \(M\) saliency tensors \(\{\mathbf{S}_{i}^{G_{i}\times C_{i}}|i=1,2,...,M\}\) for each later layer respectively (including \(L_{1}\)), where \(\mathbf{S}_{i}^{G_{i}\times C_{i}}\in\mathbb{R}^{G_{i}\times C_{i}}\).

Particularly, inspired by [55], each MLP consists of two mapping matrices \(W_{1}\in\mathbb{R}^{C_{1}\times\frac{C_{1}}{M}}\) and \(W_{2}\in\mathbb{R}^{\frac{C_{1}}{M}\times G_{i}C_{i}}\), where \(R\) is the reduction rate. The output of the MLP is then reshaped to \(\mathbb{R}^{G_{i}\times C_{i}}\). We also insert a BN [65] and ReLU

Fig. 4: The exemplary illustration of a MSGC based network block with \(M=2\) convolutional layers \(L_{1}\) and \(L_{2}\), where \(G_{1}=G_{2}=2\), \(C_{1}=C_{2}=8\). Here, the subscript “\(1\)” in \(L_{1}\) or \(G_{1}\) indicates the 1st layer in the block (which is actually “Layer \(i\)” in the network). Please refer to the text for the meaning of the denotations. Best viewed in color.

Fig. 5: Structure of the mask generator in MSGC. Best viewed in color.
layer between the two mappings to make the MLP a nonlinear transformation.

Then, the Sign function (\(\text{Sign}(x)=1\) if \(x\geq 0\) and \(=0\) otherwise) is used to convert each \(\mathbf{S}_{i}^{G_{i}\times C_{i}}\) to \(\mathbf{B}_{i}^{G_{i}\times C_{i}}\). The whole process is depicted in Fig. 5.

**Step 2: Matching sub-filters and sub-input tensors for each group to conduct convolutions.** Specifically, the complete filters for a group in layer \(L_{i}\) are \(W\in\mathbb{R}^{k\times k\times C_{i}\times C_{i+1}}\), where \(k\) is the kernel size. Based on the gating mask \(\mathbf{B}_{i}^{G_{i}\times C_{i}}\), we take the sub filters along the "\(C_{i}\)" dimension, followed by the convolution with the correspondingly selected sub-input tensor. For example, supposing \(L_{i}\) has 4 input and 8 output channels respectively and there are two groups in this layer, the 2nd row of \(\mathbf{B}_{i}^{G_{i}\times C_{i}}\) is \([1,0,0,1]\), we then select the 1st and 4th channel as the input for group 2. Meanwhile, the 5-8th output channels also belong to group 2 (output channels are regularly divided in groups). Thereby, the sub-filters that connect the 1st and 4th input channels to the 5-8th output channels are selected to conduct the convolution for group 2. Since the connection topology varies with different samples, all the filters will be kept in the memory to be selected and learnt with gradient descent. Therefore, we are able to preserve the whole capacity of the original network.

It is worth mentioning that the above convolution process is different to the normal convolution, the standard grouped convolution, and network pruning. First, compared with the normal convolution where the 5-8th output channels are generated by all the input channels, convolution in MSGC only chooses a part of input channels which saves computation. Second, instead of choosing the input channels in a predefined way in the standard grouped convolution (_e.g._, the last two input channels will be chosen as the input for group 2 in standard grouped convolution), MSGC applies a mask generator to dynamically choose the channels, which brings more learnability. Finally, compared with network pruning, MSGC preservers more input channels. In other words, the input channels that are not selected (or pruned) by one group may be selected by other groups. We illustrate those specific chosen input channels for a random image sample in Fig. 6, where most of the channels are chosen by at least one group. Therefore, the channels are not easily pruned (please also see the following discussion).

**Step 3: Decoupling gating and attention (Optional).** We can attach a parallel MLP to generate another saliency tensor \(\mathbf{A}_{i}^{G_{i}\times C_{i}}\in\mathbb{R}^{G_{i}\times C_{i}}\) as the attention tensor for layer \(L_{i}\). The input feature maps in the selected channels will then be rescaled with the associated attention values.

**End-to-end learning.** We may notice the only non-differentiable part is the Sign function, which converts the continuous saliency tensors to binary gating masks. However, we could use gradient approximation techniques like the straight-through estimator (STE) [66] or the Gumbel-Softmax reparameterization technique [67] such that the whole pipeline can be optimized by gradient descent in an end-to-end manner. Once the gating masks are learnable with no restrictions _w.r.t._ groups, layers, and samples, the "middle-spectrum" space is freely unfolded.

### _Discussions_

#### Iii-C1 Pyramid structure of feature maps

It is interesting to find that the group mechanism helps to rank the input feature maps in a softer way. Specifically, channel pruning only learns to select important channels once. _I.e._, once channels have been pruned, they are totally discarded. Grouped convolution preserves all channels but reduces the computation by conducting convolution in groups. When channel pruning and grouped convolution come together in MSGC, channels are not easily discarded because every group has an independent selection process. As shown in Fig. 6, we can identify those channels that are selected by all groups (canonical channels), channels selected by part of the groups (less important but still valuable channels), and finally the discarded channels (meaningless channels). The importance scores of channels become more reliable, leading to better performance compared with channel pruning-based methods (Tab. II).

#### Iii-C2 Discussion about plug-in

MSGC serves as a plug-in module for a backbone for reducing its computational cost and retaining its predictive performance to a large extent. In the implementation, the filters of a normal convolutional layer \(W\in\mathbb{R}^{k\times k\times C_{i}\times C_{i+1}}\) can be divided to \(\{W_{g}\in\mathbb{R}^{k\times k\times C_{i}\times\frac{C_{i+1}}{G_{i}}}|g=1,2,...,G_{i}\}\) as the initial state of the filters in each group when the module is plugged in.

#### Iii-C3 Discussion about computational cost

The reduction of computational cost of a network block, where MSGC is applied, mainly comes from the sparse connections in the groups. It is also attributed to the fact that the gating masks for all layers are generated using the input of \(L_{1}\) of the block. In other words, the group topology (formulated as \(\mathbf{B}_{i}^{G_{i}\times C_{i}}\)) for the whole block can be already determined given the input of the first layer. If a certain channel is not selected by any group in a later layer in the block, we can directly skip the

Fig. 6: MSGC is different form channel pruning, where the rank of channels is simply described by “pruned” and “unpruned”. The group mechanism allows to create a richer pyramid structure: on the bottom are the canonical or fundamental channels that are selected by all groups, then the less general but potentially more specific channels for particular groups when we looking upward, finally the discarded channels on the top that are completely pruned for the current image sample.
calculation of this channel in the previous layer. For example, if the 2nd input channel of \(L_{3}\) is not selected by any group in \(L_{3}\), we can directly skip the convolutions in the previous layer \(L_{2}\) that generate this channel. Besides, the MACs of the light MLPs is negligible compared with the original model. For example, in ResNet-18, MLPs take 1.8 million MACs, which is less than \(0.1\%\) of that of the original model that has 1.8 billion MACs.

### _Loss function_

MACs of the network can be calculated based on the binary gating masks \(\mathbf{B}_{i}^{G_{i}\times C_{i}}\). A zero value in the gating masks indicates a certain part of convolutions are skipped. Take the same example in the illustration of Step 1 of MSGC, \(\mathbf{B}_{3}^{2,5}=0\) indicates the 5th input channel of \(L_{3}\) is not considered as an input for calculating the 2nd group output channels, its associated MACs (=\(k\times k\times\frac{C_{4}}{G_{3}}\), where \(k\) is the kernel size) are therefore not included in the final MACs.

To control both the final MACs and accuracy of the model during training, we adopts a budget loss \(\mathcal{L}_{bgt}\) and the standard task-specific loss \(\mathcal{L}_{task}\) (_e.g._, cross entropy loss for image classification). Specifically, the budget loss is formulated as:

\[\mathcal{L}_{bgt}=\text{max}(\lambda(\frac{\mathcal{M}_{b}}{\mathcal{M}_{ori} }-\tau),0), \tag{2}\]

where \(\mathcal{M}_{b}\) is the mean running MACs over the current mini-batch, \(\mathcal{M}_{ori}\) is the MACs of the original model, \(\lambda\) is a controlling parameter, and \(\tau\) is a target remaining rate. A more detailed description about \(\lambda\) and \(\tau\) can be found in the next section. The final loss is \(\mathcal{L}=\mathcal{L}_{bgt}+\mathcal{L}_{task}\).

## IV Experiments

To demonstrate the effectiveness of the proposed method, we compare it with prior state-of-the-art (SOTA) methods including both channel pruning- and grouped convolution-based ones. The generalizability of our method is also validated on the task of object detection under both one- and two-stage frameworks. Model analysis and ablation study is given in the last part of this section.

### _Image classification_

**Dataset**: We use the large scale ImageNet dataset [36] to validate MSGC. There are 1.2 million images for training and 50K images for validation with 1K classes. During training, the data is augmented with random cropping (to size \(224\times 224\)) and random horizontal flipping. The Top-1 and Top-5 accuracy on validation set are used for comparison.

**Training setup**: As a plug-in module, MSGC has the advantage to directly prune and boost the pretrained models. We start by setting \(\tau\) (in Eq. (2)) to \(1.0\), then progressively decrease it to a target value \(\tau_{end}\) during the first half of the training process. Precisely, if we want to reduce MACs of the network by half, we set \(\tau_{end}=0.5\). By using a big \(\lambda\) (_i.e._, \(\lambda=30\) in the experiments), we gradually reduce the computational cost to a target budget (_i.e._, \(\tau_{end}\cdot\mathcal{M}_{ori}\)). The second half of training can be seen as a fine-tuning process. Following [18], we train ResNet-18/50 and CondenseNet for 120 epochs and MobileNetV2 for 150 epochs, with a batch size of 256. The initial learning rate is set to 0.075 for the MLPs, and 0.015 for the pretrained weights in the backbone, which are both decayed with cosine-shape annealing [31] to 0. Stochastic gradient descent (SGD) with momentum of 0.9 is used as the optimizer, weight decay is set to \(10^{-4}\) and only applied on the backbone weights. We use Gumbel-Softmax [67] when binarizing the saliency vectors (please refer to appendix A for more details). The whole process is implemented with the Pytorch library [68] on two NVIDIA A100 GPUs.

**Backbones**: To make a comprehensive comparison with prior approaches, we choose the widely adopted backbones, namely, ResNet-18/50, DenseNet, and MobileNetV2. Our MSGC module is plugged in those backbones with the configurations illustrated in Tab. I.

In Tab. II and Tab. III, we compare MSGC with the prior SOTA works based on channel pruning and grouped convolution respectively on both ResNet and MobileNetV2 backbones. Due to the fact that there is a relatively lack of works on DenseNet, we compare MSGC with the previous methods that aimed to build light DenseNet-like structures, namely, the CondenseNet [31] variants, by replacing the LGC [31] module in CondenseNet with MSGC (the same for other modules in other methods). The results on different methods based on CondenseNet are given in Tab. V.

Unlike prior methods, MSGC maintains accuracy with a more aggressive MAC reduction when other prior methods often cause accuracy drop. Notably, we even obtain accuracy gains for ResNet and MobileNetV2 when the MAC is considerably reduced by 50% and 35% respectively. Comparing with the latest method FFP [7], our method improves ResNet-18 by 1.75% with 51.3% MAC reduction, while FFP decreases the accuracy by 0.60% with a smaller MAC reduction rate (40.0%). On ResNet-50, our method increases the accuracy by 0.63% with a considerable 53.8% MAC reduction, while FFP only has a 0.05% accuracy increase, even with a smaller MAC reduction rate (39.5%). We conjecture that the phenomenon may result from the reorganization of channel usage from two perspectives: first, the effective removal of redundant parameters; second, the more reliable ranking of input channels as shown in Fig. 6 (also see our analysis in Sec. IV-C).

We also completely remove the attention MLPs in our models, denoted as "MSGC w/o Attention" in the tables, to see the influence of our attention-wise design. Generally, the attention-wise design works well on relatively light backbones
like ResNet-18 and MobileNetV2, but may give diminishing or negative returns for large backbones like DenseNet and
ResNet-50, meaning that a saturated status is reached under current configurations before applying attentions.

An illustration of training dynamics is shown in Fig. 7, where we could see the computational cost stably drops to the budget with a slowly growing accuracy in the first half of the training, with the budget loss keeping around 0. In the second half of training, the accuracy is significantly compensated.

### _Object detection_

**Dataset**: We conduct our experiments on the COCO 2017 detection dataset [37], which has 118K and 5K images for training and validation. During training, the images are resized with the longer edge \(=\) 1333, combined with random horizontal flipping. During validation, the images are resized such that the shorter edge \(\leq 800\), and the longer edge \(\leq 1333\).

**Backbones**: We evaluate MSGC on ResNet-50 and MobileNetV2 under Faster R-CNN [77] (2-stage) and RetinaNet [78] (1-stage) frameworks. The configurations of the backbones are the same as in Sec. IV-A. Observed from the previous section on image classification, we attach the attention MLPs to MobileNetV2 and not to ResNet-50.

**Training setup**: The training scheme mostly follows the experiments on ImageNet. The differences are illustrated as follows. All the models are trained for 90,000 iterations with 16 images in a mini-batch. The basic initial learning rate is set as 0.02 for Faster-RCNN and 0.01 for RetinaNet. For the weights in the backbone (including the MLPs in the MSGC module), the initial learning rate is further multiplied with 0.5. Learning rate is decayed with a factor of 0.1 at iteration 60,000 and 80,000. For others like batch size per image, we adopted the default settings in the Detectron2 library [79]. The whole process is implemented with the Pytorch library [68] on two NVIDIA A100 GPUs.

The results are shown in Tab. IV. For ResNet-50, MSGC can effectively cut the MACs of the backbone by \(54\%\) with only a slight or negligible accuracy drop. For MobileNetV2, MSGC outperforms MobileNetV2-0.75 by a large margin with a similar computational overhead on both frameworks. Notably, on the RetinaNet framework, the performance of MobileNetV2 can also be improved with the plugged MSGC, from 30.7% to 31.3% in mAP, with a \(28.5\%\) reduction on MACs. The comparison shows MSGC has a good generalizability on the object detection task.

### _Model analysis and ablation study_

In this section, we give our analysis from the dimensions of group-wise, layer-wise, sample-wise, and attention-wise, respectively. Experiments are based on Sec. IV-A. More exploratory studies are given at the end. The attention MLPs are not applied in MSGC for simplicity if not specified.

**Group-wise**: Configuration of a MSGC module can be varied. Though in Sec. IV-A, we empirically set the group numbers \(\{G_{i}\}\), it is definitely possible to seek more advanced techniques like neural architecture search (NAS) [80] to give a better structural setting. Here, we changed the group numbers on ResNet-18 (more specifically, we change the group number for the 2nd layer of the Basic block) and MobileNetV2 under similar MACs. The results are shown in Tab. VI.

Group \(=1\) reduces MSGC to a dynamic channel pruning module. Like [47], the dynamic execution helps the network to prune redundant information specific to the input samples, potentially leading to better discrimination ability. As expected, using groups achieves an increasing improvement.

Fig. 7: Curves of validation accuracy, computational cost, and training losses during the training process.
It peaks at group \(=4\) since a bigger group number may bring extra learning complexity [18].

We dig deeper into the pyramid-style reuse of the feature channels, as illustrated in Fig. 8. MSGC can detect those canonical, general, and meaningless channels automatically, leading to a more reliable channel ranking. It is worth mentioning that the curves in shallower layers look steeper (means a major proportion of samples selected the same channels), which is in line with the fact that feature maps in shallow layers usually contain low-level or fundamental image information shared by most samples. While in deeper layers, samples become more distinguished due to their varying semantic characteristics.
to hold the information.

**Sample-wise**: As mentioned in Sec. III, MSGC gives an adaptive resource allocation due to its dynamic property. This is shown in Fig. 10. It is found that both the original model and the MSGC equipped model can obtain good prediction accuracies on those "easy" samples. However, MSGC can automatically spend more computation on those "harder" samples, leading to a better prediction (remembering that the original model uses much more MACs on each sample equally). Therefore, the overall performance can be enhanced with MSGC. Interestingly, the "easy" and "hard" samples determined by MSGC are quite intuitive for humans, which are partially illustrated at the bottom of Fig. 10. For example, "easy" samples have less cluttered backgrounds and easy to be recognized by human eyes, while the "hard" samples show the opposite (_e.g._, the rightmost samples even tend to be in a black and white style and more confusing).

**Attention-wise**: Consistent with Fig. 8, in Fig. 11 (a), shallower layers show a relatively fixed gating pattern, _i.e._, the gating probabilities (the probabilities of being selected) in shallow layers are either close to zero or close to one. The close-to-one values indicate the associated channels (the yellow cells) were selected by a major part of samples. While deeper layers have larger variations. It is interesting to find that the visualized attention matrix in Fig. 11 (b) shows a similar sparse pattern with the gating matrix. In other words, the channels with close-to-zero gating probabilities also have close-to-zero attentions. However, different to the gating probabilities in shallow layers, the attention scores in shallow layers have more middle-range values, which inject extra variations that can enrich the representation of those layers.

**Influence of the controlling parameter \(\lambda\)**: We conduct the experiments with ResNet-18 on ImageNet dataset to show how the controlling parameter \(\lambda\), which controls the weight of the budget loss (Eq. (2)) during training, influences the performance. The results are shown in Tab. VII. We can see that a too small \(\lambda\) may cause a larger model than expected. When \(\lambda\) is big enough (_i.e._, \(\geq 30\)), we can precisely control the target MAC and the method is quite stable.

**From MAC reducer to accuracy enhancer**: Setting different values of \(\tau_{end}\) controls the computational overhead of the final model. For example, it is demonstrated in the previous sections that \(\tau_{end}=0.5\) leads to a computational reduction of 50% on the ResNet structures without sacrificing the accuracy. In this study, we give a more detailed exploration of how MSGC balances accuracy and MAC by changing \(\tau_{end}\). The results are shown in Tab. VIII where ResNet-18 is used. Since \(\tau_{end}<1\), MSGC always acts as a "MAC reducer" for the original baseline architecture. A small \(\tau_{end}\) results in a good computation reduction, but at the same time a degraded performance on prediction accuracy. However, when the computation reduction is not our focus, we can simply apply MSGC as an effective accuracy enhancer. Surprisingly, when \(\tau_{end}=0.9\), the model achieves a absolute 2.57% Top-1 accuracy gain, from 69.76% to 72.33%. Meanwhile, further increasing \(\tau_{end}\) to 0.99 does not incur additional accuracy gain, implying necessary removal of redundant or meaningless features is important for achieving the optimal performance.

**Discussion on hardware implementation**: When our focus is to reduce computation, one factor we may consider is the actual hardware implementation. It is indeed a common

Fig. 11: The visualization is based on ResNet-18, where each row represents a group in a certain layer, every four rows represent a convolutional layer. Therefore, each element in the visualized matrices indicates an input channel for a certain group in a certain layer. Left is the the gating probability of the channels, calculated based on the associated saliency values over the ImageNet validation set. Right is the attached average attention values.