Structural neural network pruning aims to remove the redundant channels in the deep convolutional neural networks (CNNs) by pruning the filters of less importance to the final output accuracy. To reduce the degradation of performance after pruning, many methods utilize the loss with sparse regularization to produce structured sparsity. In this paper, we analyze these sparsity-training-based methods and find that the regularization of unpruned channels is unnecessary. Moreover, it restricts the network's capacity, which leads to under-fitting. To solve this problem, we propose a novel pruning method, named MaskSparsity, with pruning-aware sparse regularization. MaskSparsity imposes the fine-grained sparse regularization on the specific filters selected by a pruning mask, rather than all the filters of the model. Before the fine-grained sparse regularization of MaskSparity, we can use many methods to get the pruning mask, such as running the global sparse regularization. MaskSparsity achieves 63.03%-FLOPs reduction on ResNet-110 by removing 60.34% of the parameters, with no top-1 accuracy loss on CIFAR-10. On ILSVRC-2012, MaskSparsity reduces more than 51.07% FLOPs on ResNet-50, with only a loss of 0.76% in the top-1 accuracy. The code is released at https://github.com/CASIA-IVA-Lab/MaskSparsity. Moreover, we have integrated the code of MaskSparity into a PyTorch pruning toolkit, EasyPruner, at https://gitee.com/casia_iva_engineer/easypruner.
翻译:结构神经网络剪枝旨在通过修剪对最终输出精度影响较小的卷积核,来移除深度卷积神经网络(CNNs)中的冗余通道。为减少剪枝后的性能退化,许多方法利用带有稀疏正则化的损失函数产生结构化稀疏性。本文分析了这些基于稀疏训练的方法,发现对未剪枝通道的正则化是不必要的,且会限制网络容量,导致欠拟合。为解决该问题,我们提出一种新型剪枝方法MaskSparsity,其采用对剪枝感知的稀疏正则化。MaskSparsity仅对剪枝掩码选定的特定过滤器施加细粒度稀疏正则化,而非对模型所有过滤器施加。在执行MaskSparsity的细粒度稀疏正则化前,可采用多种方法(如全局稀疏正则化)获取剪枝掩码。MaskSparsity在ResNet-110上移除60.34%参数,实现63.03%的FLOPs下降,且在CIFAR-10数据集上未损失top-1精度。在ILSVRC-2012上,MaskSparsity使ResNet-50减少超过51.07%的FLOPs,仅损失0.76%的top-1精度。代码已发布在https://github.com/CASIA-IVA-Lab/MaskSparsity。此外,我们已将MaskSparsity代码集成至PyTorch剪枝工具包EasyPruner中,地址为https://gitee.com/casia_iva_engineer/easypruner。