[论文解读] TinyCNN: A Tiny Modular CNN Accelerator for Embedded FPGA
本文提出 TinyCNN,一种模块化框架,用于在嵌入式 FPGA 上设计和部署资源感知的微型卷积神经网络(CNN)加速器。该框架通过软件后端实现硬件感知的 CNN 设计,利用 CHISEL 自动生成 RTL 代码,并通过仿真实现精度调优,以最小化精度损失——与在 ARM 上使用 32 位浮点数相比,使用 16 位定点数时,最高可实现 15.75 倍的加速,且精度仅下降 3%。
In recent years, Convolutional Neural Network (CNN) based methods have achieved great success in a large number of applications and have been among the most powerful and widely used techniques in computer vision. However, CNN-based methods are computational-intensive and resource-consuming, and thus are hard to be integrated into embedded systems such as smart phones, smart glasses, and robots. FPGA is one of the most promising platforms for accelerating CNN, but the limited on-chip memory size limit the performance of FPGA accelerator for CNN. In this paper, we propose a framework for designing CNN accelerator on embedded FPGA for image classification. The proposed framework provides a tool for FPGA resource-aware design space exploration of CNNs and automatically generates the hardware description of the CNN to be programmed on a target FPGA. The framework consists of three main backends; software, hardware generation, and simulation/precision adjustment. The software backend serves as an API to the designer to design the CNN and train it according to the hardware resources that are available. Using the CNN model, hardware backend generates the necessary hardware components and integrates them to generate the hardware description of the CNN. Finaly, Simulation/precision adjustment backend adjusts the inter-layer precision units to minimize the classification error. We used 16-bit fixed-point data in a CNN accelerator (FPGA) and compared it to the exactly similar software version running on an ARM processor (32-bit floating point data). We encounter about 3% accuracy loss in classification of the accelerated (FPGA) version. In return, we got up to 15.75x speedup by classifying with the accelerated version on the FPGA.
研究动机与目标
- 解决在资源受限的嵌入式 FPGA 上部署计算密集型 CNN 的挑战。
- 通过自动化降低在 FPGA 上定制 CNN 加速器的设计复杂度和部署时间。
- 在 FPGA 上的 CNN 推理中使用低精度定点数(16 位)时,最小化精度损失。
- 提供一种通用的、模块化的 CNN 加速器生成框架,支持硬件资源约束。
- 通过集成 CNN 训练、RTL 生成和精度调优的统一流程,实现高效的软硬件协同设计。
提出的方法
- 软件后端使用 Python 设计和训练 CNN,实时估算硬件资源,以指导架构选择。
- 硬件后端使用 CHISEL 生成 RTL 代码,根据 CNN 架构自动组合卷积层、池化层和全连接层。
- 仿真与精度调优后端通过迭代调整层间数据路径的字长(整数部分和小数部分),以最小化分类误差。
- 框架支持两种硬件模式:共享模式(所有层共用一个卷积单元)和独占模式(每层分配专用单元),后者可减少访问冲突。
- 整个流程通过 Xilinx SDSoC 2016.4 集成,支持基于 HLS 的 Zynq SoC FPGA 合成与编程。
- 框架使用 CIFAR-10 数据集(灰度输入)和一个小型 5 层 CNN,在 PYNQ Zynq-7000 板上验证性能。
实验结果
研究问题
- RQ1完全自动化的框架能否显著降低在嵌入式 FPGA 上设计 CNN 加速器所需的设计工作量和部署时间?
- RQ2在基于 FPGA 的 CNN 推理中,16 位定点数相较于 32 位浮点数,在多大程度上能保持分类精度?
- RQ3在小型 FPGA 上,硬件资源利用率(尤其是 BRAM)如何限制 CNN 设计?该框架能否缓解这一限制?
- RQ4在嵌入式 FPGA 加速器中,与共享分配相比,独占卷积单元分配是否能提升性能?
- RQ5对数据路径字长进行迭代精度调优,能否显著减少低精度 CNN 中的精度损失?
主要发现
- 当使用 16 位定点数时,TinyCNN 框架在 FPGA 上实现的推理速度相比 ARM Cortex-A9 软件实现(每张图像 42.54 ms 对比 2.70 ms)实现了 15.75 倍的加速。
- 在独占模式下,FPGA 加速版本的精度为 62.28%,相比 32 位浮点数软件基线(65.54%)仅下降了 3.26%。
- 共享模式硬件加速器(HW-SM)的推理时间为 8.12 ms,精度为 62.28%,表明独占模式通过消除访问冲突显著提升了性能。
- BRAM 利用率是主要的硬件约束,而框架的软件后端有效指导了 CNN 设计,使其保持在资源限制范围内。
- 精度调优后端通过调整各层的整数和小数部分位宽,成功将分类误差最小化,在低精度运算下仍保持了高精度。
- 该框架成功从基于 Python 的 CNN 模型生成了可工作且优化的 CNN 加速器,仅需极少的人工干预。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。