系统仿真学报 ›› 2022, Vol. 34 ›› Issue (7): 1639-1650.doi: 10.16182/j.issn1004731x.joss.21-0175

• 仿真模型/系统置信度评估技术 • 上一篇    下一篇

一种量化因子自适应学习量化训练算法

聂慧1,2(), 李康顺1,2,3(), 苏洋1   

  1. 1.东莞城市学院 计算机与信息学院, 广东 东莞 523430
    2.广东科技学院 计算机学院, 广东 东莞 523000
    3.华南农业大学 数学与信息学院, 广东 广州 510046
  • 收稿日期:2021-03-07 修回日期:2021-06-09 出版日期:2022-07-30 发布日期:2022-07-20
  • 通讯作者: 李康顺 E-mail:928753616@qq.com;likangshun@sina.com
  • 作者简介:聂慧(1987-),女,硕士,讲师,研究方向为图像处理,机器学习。E-mail:928753616@qq.com
  • 基金资助:
    广东省教育厅重点领域专项(新一代信息技术)(2021ZDX1029);广东省自然科学基金面上项目(2020A1515010784);东莞城市学院青年教师发展基金(2021QJY003Z)

A Quantization Training Algorithm of Adaptive Learning Quantization Scale Fators

Hui Nie1,2(), Kangshun Li1,2,3(), Yang Su1   

  1. 1.School of Computer and Informatics, City College of Dongguan University of Technology, Dongguan 523430, China
    2.School of Computer Science, Guangdong University of Science and Technology, Dongguan 523000, China
    3.College of Mathematics and Informatics College, South China Agricultural University, Guangzhou 510046, China
  • Received:2021-03-07 Revised:2021-06-09 Online:2022-07-30 Published:2022-07-20
  • Contact: Kangshun Li E-mail:928753616@qq.com;likangshun@sina.com

摘要:

深度神经网络因参数量过多而影响嵌入式部署,解决的办法之一是模型小型化(如模型量化,知识蒸馏等)。针对这一问题,提出了一种基于BN(batch normg lization)折叠的量化因子自适应学习的量化训练算法(简称为LSQ-BN算法)。采用单个CNN(convolutional neural)构造BN折叠以实现BN与CNN融合;在量化训练过程中,将量化因子设置成模型参数;提出了一种自适应量化因子初始化方案以解决量化因子难以初始化的问题。实验结果表明:8bit的权重和激活量化,量化模型的精度与FP32预制模型几乎一致;4bit的权重量化和8 bit的激活量化,量化模型的精度损失在3%以内。因此,LSQ-BN是一种优异的模型量化算法。

关键词: BN折叠, CNN卷积, 自适应初始化, 模型量化因子

Abstract:

Deep neural network model is difficult to effectively deploy in embedded terminals due to its excessive number of components, andone of the solutions is model miniaturization (such as model quantization, knowledge distillation, etc.). To address this problem, a quantization training algorithm (referred to as LSQ-BN algorithm) based on adaptive learning of quantizationscale factors with BN folding is proposed.A single CNN (convolutional neural) is usedtoconstruct BN folding and achieve BN and CNN fusion. During the process of quantitative training,the quantization scale factors are set as model parameters. An adaptive quantizationscale factor initialization scheme is proposed to solve the problem of difficult initialization of quantizationscale factors.The experimental results show that the precision of the quantized model is almost the same as that of the FP32 prefabricated model when the weight and activation are both 8bit quantization. When the weight is 4 bit quantization and the activation is 8bit quantization, the precision loss of the quantization model is within 3%. Therefore, LSQ-BN proposed in this paper is an excellent model quantization algorithm.

Key words: BN folding, CNN convolution, adaptive initialization, model quantization scale-factor

中图分类号: