Please wait a minute...
浙江大学学报(工学版)  2023, Vol. 57 Issue (3): 486-494    DOI: 10.3785/j.issn.1008-973X.2023.03.006
计算机与控制工程     
基于强化学习和3σ准则的组合剪枝方法
徐少铭(),李钰*(),袁晴龙
华东理工大学 信息科学与工程学院,上海 200237
Combination pruning method based on reinforcement learning and 3σ criterion
Shao-ming XU(),Yu LI*(),Qing-long YUAN
School of Information Science and Engineering, East China University of Science and Technology, Shanghai 200237, China
 全文: PDF(920 KB)   HTML
摘要:

针对结构复杂、参数冗余的深度神经网络无法部署到资源受限的嵌入式系统的问题,受稀疏率对性能影响的启示,提出基于强化学习和3σ准则的组合剪枝方法. 根据稀疏率对准确率的影响,确定最佳全局稀疏率,使稀疏率和精度达到较好平衡. 在最佳全局稀疏率的指导下,利用强化学习方法自动搜索每层卷积层的最佳剪枝率,根据剪枝率剪去不重要的权重. 通过3σ准则确定全连接层每层的权重剪枝阈值,对全连接层进行权重剪枝. 通过再训练来恢复模型识别的精度. 实验结果表明,所提剪枝方法可以将网络VGG16、ResNet56和ResNet50的参数,分别压缩83.33%、70.1%和80.9%,模型的识别准确率分别降低1.55%、1.98%和1.86%.

关键词: 深度神经网络模型压缩稀疏率强化学习组合剪枝    
Abstract:

In order to resolve the problem that deep neural network with complex structure and redundant parameters could not be deployed to the resource constrained embedded system, an efficient combination pruning method based on reinforcement learning and 3σ criterion was proposed, which was inspired by the effect of sparsity rate on performance. Firstly, an optimal global sparsity rate was determined according to the influence of sparsity rate on accuracy, which could achieve a good balance between sparsity rate and accuracy. Secondly, under the guidance of optimal global sparsity rate, the reinforcement learning method was used to search the optimal pruning rate of each convolutional layer automatically, and the unimportant weights were cut off on the basis of the pruning rate. Then, the weight pruning threshold of each fully connected layer was determined by 3σ criterion, and for each fully connected layer, the weight which below the threshold would be pruned. Finally, the accuracy of model recognition was restored by retraining. Experimental results showed that the proposed pruning method could compress the parameters of VGG16, ResNet56 and ResNet50 network by 83.33%, 70.1% and 80.9% respectively, and the model’s recognition accuracy could be reduced by 1.55%, 1.98% and 1.86% respectively.

Key words: deep neural network    model compression    sparsity rate    reinforcement learning    combination pruning
收稿日期: 2022-03-12 出版日期: 2023-03-31
CLC:  TP 391  
通讯作者: 李钰     E-mail: X18912726309@163.com;liyu@ecust.edu.cn
作者简介: 徐少铭(1998—),女,硕士生,从事深度学习、智能传感与信息处理研究. orcid.org/0000-0001-8430-5925.E-mail: X18912726309@163.com
服务  
把本文推荐给朋友
加入引用管理器
E-mail Alert
作者相关文章  
徐少铭
李钰
袁晴龙

引用本文:

徐少铭,李钰,袁晴龙. 基于强化学习和3σ准则的组合剪枝方法[J]. 浙江大学学报(工学版), 2023, 57(3): 486-494.

Shao-ming XU,Yu LI,Qing-long YUAN. Combination pruning method based on reinforcement learning and 3σ criterion. Journal of ZheJiang University (Engineering Science), 2023, 57(3): 486-494.

链接本文:

https://www.zjujournals.com/eng/CN/10.3785/j.issn.1008-973X.2023.03.006        https://www.zjujournals.com/eng/CN/Y2023/V57/I3/486

图 1  强化学习下的自动化剪枝结构
图 2  网络组合剪枝框架图
图 3  3σ准则的分布图
图 4  基于3种网络的稀疏率
卷积层 pt/kB ac/%
conv1-1 6.752 2.0
conv1-2 144 3.0
conv2-1 288 10.0
conv2-2 576 15.0
conv3-1 1 152 38.0
conv3-2 2 304 56.0
conv3-3 2 304 80.0
conv4-1 4 608 80.0
conv4-2 9 216 80.0
conv4-3 9 216 80.0
conv5-1 9 216 80.0
conv5-2 9 216 80.0
conv5-3 9 216 80.0
总计 57 479.25 76.4
表 1  VGG16的各卷积层剪枝结果
阈值 全连接层 t pa/MB af/% pp/% ?p/%
μ Fc1 0.001 9 15.32 44.28 91.88 ?1.82
Fc2 0.000 2
Fc3 0.007 0
σ Fc1 0.002 5 7.04 50.75 91.97 ?1.73
Fc2 0.000 9
Fc3 0.018 7
μ+σ Fc1 0.004 4 4.48 52.74 92.42 ?1.28
Fc2 0.001 2
Fc3 0.024 8
μ+2σ Fc1 0.007 3 2.12 54.57 92.31 ?1.39
Fc2 0.002 2
Fc3 0.043 9
μ+3σ Fc1 0.009 6 1.00 55.34 92.27 ?1.43
Fc2 0.003 2
Fc3 0.063 1
表 2  VGG16全连接层不同阈值下的实验结果
方法 pt/MB ao/% pp/%
基线 128.0 0 93.70
卷积层剪枝 92.0 28.00 92.95
全连接层剪枝 57.2 55.34 92.27
组合剪枝 21.0 83.33 92.15
表 3  VGG16网络剪枝前后的性能对比
方法 ao/% ?p/%
强化学习权重剪枝 28.08 ?0.75
3σ权重剪枝 99.05 ?6.11
GAL-0.05[30] 77.46 ?6.86
LI正则化[31] 64.08 ?7.13
Entropy-based[32] 43.00 ?2.06
组合剪枝 83.33 ?1.55
表 4  组合剪枝方法与其他方法在VGG16上的比较
块名称 pt/kB ab/%
卷积层 1.687 6 80.00
残差块1 234 52.30
残差块2 936 67.54
残差块3 2 304 72.94
ResNet56 3475.68 70.10
表 5  ResNet56块的剪枝结果
阈值 t af/% ao/% pp/% ?p/%
μ 0.197 1 56.86 1.30 68.28 ?3.22
σ 0.148 9 45.70 1.05 68.66 ?2.84
μ+σ 0.345 6 83.66 1.92 66.65 ?4.85
μ+2σ 0.499 0 95.56 2.20 65.33 ?5.76
μ+3σ 0.646 1 99.07 2.28 35.48 ?35.61
表 6  ResNet56全连接层不同阈值下的实验结果
图 5  不同方法在ResNet56上的性能比较
剪枝方法 块名称 pt/kB ab/% ?pT1/%
强化学习权重 卷积层 36.76 80 ?0.65
残差块1 832 74.3
残差块2 4 736 75.6
残差块3 26 624 79.2
残差块4 40 960 80
3σ权重 全连接层 8 000 94.6 ?1.78
组合 ResNet50 81 188.8 80.9 ?1.86
表 7  ResNet50块的剪枝结果
方法 ao/% ?pT1/%
GAL 42.47 ?5.65
ABCPruner 55.42 ?2.56
HRank 67.57 ?4.32
组合剪枝 80.9 ?1.86
表 8  组合剪枝方法与其他方法在ResNet50上的比较
21 CHOLLET F. Xception: deep learning with depthwise separable convolutions [C]// Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. Honolulu: IEEE, 2017: 1251-1258.
22 HOWARD A G, ZHU M, CHEN B, et al. MobileNets: efficient convolutional neural networks for mobile vision applications [EB/OL]. (2017-04-17) [2022-12-10]. https: arxiv.org/pdf/1704.04861. pdf.
23 HE Y H, LIN J, LIU Z J, et al. AMC: AutoML for model compression and acceleration on mobile devices [C]// Proceedings of the European Conference on Computer Vision. [S. l.]: Springer, 2018: 815-832.
24 ASHOK A, RHINEHART N, BEAINY F, et al. N2N learning: network to network compression via policy gradient reinforcement learning [EB/OL]. (2017-12-17)[2022-12-10]. https://arxiv.org/pdf/1709.06030v1.pdf.
25 LIU Z C, MU H Y, ZHANG X Y, et al. MetaPruning: meta learning for automatic neural network channel pruning [C]// Proceedings of the IEEE/CVF International Conference on Computer Vision. Seoul: IEEE, 2019: 3296-3305.
26 LILLICRAP T P, HUNT J J, PRITZEL A, et al. Continuous control with deep reinforcement learning [EB/OL]. (2019-07-15)[2022-12-12]. https://arxiv.org/pdf/1509.02971.pdf.
27 LIN M B, JI R R, ZHANG Y X. Channel pruning via automatic structure search [EB/OL]. (2020-06-29)[2022-12-16]. https://arxiv.org/pdf/2001.08565.pdf.
28 HUANG Z Z, SHAO W Q, WANG X J. Rethinking the pruning criteria for convolutional neural network [C]// Conference and Workshop on Neural Information Processing Systems. Montreal: MIT Press, 2021, 34: 16305-16318.
29 盛骤, 谢式千, 潘承毅. 概率论与数理统计[M]. 北京高等教育出版社, 2008: 112-114.
30 LIN S H, JI R R, YAN C Q, et al. Towards optimal structured CNN pruning via generative adversarial learning [C]// Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Long Beach: IEEE, 2019: 2790-2799.
31 LI H, KADAV A, DURDANOVIC I, et al. Pruning filters for efficient convnets [EB/OL]. (2017-03-10)[2022-12-20]. https://arxiv.org/pdf/1608.08710.pdf.
32 LUO J H, WU J X. An entropy-based pruning method for CNN compression [EB/OL]. (2017-06-19)[2022-12-20]. https: arxiv.org/pdf/1706.05791.pdf.
33 HU H Y, PENG R, TAI Y W, et al. Network trimming: a data-driven neuron pruning approach towards efficient deep architectures [EB/OL]. (2016-07-12)[2022-12-20]. https://arxiv.org/pdf/1607.03250.pdf.
1 KRIZHEVSKY A, SUTSKEVER I, HINTON G E. ImageNet classification with deep convolutional neural networks [C]// Proceedings of the 25th International Conference on Neural Information Processing Systems. Lake Tahoe: Curran Associates Inc, 2012: 1097-1105.
2 ZHANG L B, HUANG S L, LIU W. Intra-class part swapping for fine-grained image classification [C]// Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision. Waikoloa: IEEE, 2021: 3209-3218.
3 REN S K, HE K M, GIRSHICK R, et al. Object detection networks on convolutional feature maps [J]. IEEE Transactions on Pattern Analysis and Machine Intelligence. 2017, 39(7): 1476-1481.
4 REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: unified, real-time object detection [C]// Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. Las Vegas: IEEE, 2016: 779-788.
5 BLAIVAS M, ARNTFIELD R, WHITE M Creation and testing of a deep learning algorithm to automatically identify and label vessels, nerves, tendons, and bones on cross-sectional point-of-care ultrasound scans for peripheral intravenous catheter placement by novices[J]. Journal of Ultrasound in Medicine, 2020, 39 (9): 1721- 1727
doi: 10.1002/jum.15270
6 LONG J, SHELHAMER E, DARRELL T. Fully convolutional networks for semantic segmentation [C]// Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. Boston: IEEE, 2015: 3431-3440.
7 TANZI L, PIAZZOLLA P, PORPIGLIA F, et al Real-time deep learning semantic segmentation during intra-operative surgery for 3D augmented reality assistance[J]. International Journal of Computer Assisted Radiology and Surgery, 2021, 16: 1435- 1445
doi: 10.1007/s11548-021-02432-y
8 张哲晗, 方薇, 杜丽丽, 等 基于编码-解码卷积神经网络的遥感图像语义分割[J]. 光学学报, 2020, 40 (3): 46- 55
ZHANG Zhe-han, FANG Wei, DU Li-li, et al Semantic segmentation of remote sensing image based on coding-decoding convolutional neural network[J]. Acta Optica Sinica, 2020, 40 (3): 46- 55
9 吕永发. 基于深度学习的手机表面缺陷检测算法[D]. 郑州: 郑州大学, 2020.
LV Yong-fa. Mobile phone surface detect detection algorithm based on deep learning [D]. Zhengzhou: Zhengzhou University, 2020.
10 JIANG Y, WANG W, ZHAO C. A machine vision-based realtime anomaly detection method for industrial products using deep learning [C]// 2019 Chinese Automation Congress. Hangzhou: IEEE, 2019: 4842-4847.
11 GONG R H, LIU X L, JIANG S H, et al. Differentiable soft quantization: bridging full-precision and low-bit neural networks [C]// Proceedings of the IEEE/CVF International Conference on Computer Vision. Seoul: IEEE, 2019: 4852-4861.
12 COURBARIAUX M, HUBARA I, SOUDRY D, et al. Binarized neural networks: training neural networks with weights and activations constrained to +1 or −1 [EB/OL]. (2016-03-17)[2022-12-10]. https:arxiv.org/pdf/1602.02830.pdf.
13 LI F F, LIU B, WANG X X. Ternary weight networks [EB/OL]. (2022-11-20)[2022-12-10]. https://arxiv.org/pdf/1605.04711.pdf.
14 KALMAN D A singularly valuable decomposition: the SVD of a matrix[J]. The College Mathematics Journal, 1996, 27 (1): 2- 23
doi: 10.1080/07468342.1996.11973744
15 KIM Y D, PARK E, YOO S, et al. Compression of deep convolutional neural networks for fast and low power mobile applications [EB/OL]. (2016-12-24) [2022-12-10]. https://arxiv.org/pdf/1511.06530.pdf.
16 LATHAUWER L D Decompositions of a higher-order tensor in block terms[J]. SIAM Journal on Matrix Analysis and Applications, 2008, 30 (3): 1022- 1032
doi: 10.1137/060661685
17 ZAGORUYKO S, KOMODAKIS N. Paying more attention to attention: improving the performance of convolutional neural networks via attention transfer [EB/OL]. (2017-12-12)[2022-12-10]. https://arxiv.org/pdf/1612.03928.pdf.
18 ZHANG L F, SONG J B, GAO A, et al. Be your own teacher: improve the performance of convolutional neural networks via self distillation [C]// Proceedings of the IEEE/CVF International Conference on Computer Vision. Seoul: IEEE, 2019: 3713-3722.
19 IANDOLA F N, HAN S, MOSKEWICZ M W, et al. SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and<0.5MB model size [EB/OL]. (2016-11-04)[2022-12-10]. https:arxiv.org/pdf/1602.07360.pdf.
20 ZHANG X Y, ZHOU X Y, LIN M X, et al. ShuffleNet: an extremely efficient convolutional neural network for mobile devices [C]// Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Salt Lake City: IEEE, 2018: 6848-6856.
[1] 华夏,王新晴,芮挺,邵发明,王东. 视觉感知的无人机端到端目标跟踪控制技术[J]. 浙江大学学报(工学版), 2022, 56(7): 1464-1472.
[2] 刘智敏,叶宝林,朱耀东,姚青,吴维敏. 基于深度强化学习的交通信号控制方法[J]. 浙江大学学报(工学版), 2022, 56(6): 1249-1256.
[3] 徐小高,夏莹杰,朱思雨,邝砾. 基于强化学习的多路口可变车道协同控制方法[J]. 浙江大学学报(工学版), 2022, 56(5): 987-994, 1005.
[4] 陈扬钊,袁伟娜. 深度学习辅助上行免调度NOMA多用户检测方法[J]. 浙江大学学报(工学版), 2022, 56(4): 816-822.
[5] 李广龙,申德荣,聂铁铮,寇月. 数据库外基于多模型的学习式查询优化方法[J]. 浙江大学学报(工学版), 2022, 56(2): 288-296.
[6] 韩冬阳,林泽宇,郑宇,郑美妹,夏唐斌. 基于选择性深度神经网络集成的涡扇发动机剩余寿命预测[J]. 浙江大学学报(工学版), 2022, 56(11): 2109-2118.
[7] 邓齐林,鲁娟,陈勇辉,冯健,廖小平,马俊燕. 基于深度强化学习的数控铣削加工参数优化方法[J]. 浙江大学学报(工学版), 2022, 56(11): 2145-2155.
[8] 马一凡,赵凡宇,王鑫,金仲和. 密集观测场景下的敏捷成像卫星任务规划方法[J]. 浙江大学学报(工学版), 2021, 55(6): 1215-1224.
[9] 许佳辉,王敬昌,陈岭,吴勇. 基于图神经网络的地表水水质预测模型[J]. 浙江大学学报(工学版), 2021, 55(4): 601-607.
[10] 王虹力,郭斌,刘思聪,刘佳琪,仵允港,於志文. 边端融合的终端情境自适应深度感知模型[J]. 浙江大学学报(工学版), 2021, 55(4): 626-638.
[11] 毛奕喆,龚国芳,周星海,王飞. 基于马尔可夫过程和深度神经网络的TBM围岩识别[J]. 浙江大学学报(工学版), 2021, 55(3): 448-454.
[12] 马一凡,赵凡宇,王鑫,金仲和. 基于改进指针网络的卫星对地观测任务规划方法[J]. 浙江大学学报(工学版), 2021, 55(2): 395-401.
[13] 陈世达,刘强,韩亮. 降低分布式训练通信的梯度稀疏压缩方法[J]. 浙江大学学报(工学版), 2021, 55(2): 386-394.
[14] 陈纬奇,王敬昌,陈岭,杨勇勤,吴勇. 基于深度神经网络的多因素感知终端换机预测模型[J]. 浙江大学学报(工学版), 2021, 55(1): 109-115.
[15] 江金生,任浩然,李瀚野. 基于卷积自编码器的地震数据处理[J]. 浙江大学学报(工学版), 2020, 54(5): 978-984.