基于FPGA加速CNN的低成本芒果外观品质检测装置

    Low-cost grading device for mango appearance quality using accelerated CNN with FPGA

    • 摘要: 针对卷积神经网络(CNN)算法对硬件性能要求高,难以在成本低、性能受限的边缘设备上部署实现的问题,该研究综合考虑芒果外观品质检测的准确性,速度,功耗,成本等因素,设计开发了基于现场可编程门阵列(FPGA)加速CNN的品质分级检测装置。首先,设计了一种基于MobileNetV2的结构简单且高效的轻量级网络(Compact MobileNet,CMNet),通过压缩网络结构降低模型参数量和计算量,保证其在准确率可接受前提下,适合在边缘设备部署。其次,为了加快CMNet在成本和性能受限边缘设备上的执行速度,通过BN层融合和模型量化方法进一步减少模型的存储需求和计算量,同时设计实现了基于FPGA加速CMNet网络的硬件电路,并使用高层次综合(high-level synthesis,HLS)优化方法对加速电路进行并行优化。最后,基于FPGA开发板Zynq Z7-Lite 7020,设计开发了芒果外观品质分级检测装置,装置集成OV5640摄像头,CMNet网络加速电路和HDMI显示器。在实验室环境下,将芒果外观品质依据中国芒果农业行业标准(NY/T 492-2002)分为3个等级,利用Dosehri芒果数据集对检测装置进行效果验证。结果显示本研究的芒果外观品质检测装置准确率达到了96%,检测速度为每帧0.072 s,功耗为2.6 W。表明该研究实现了一种低成本、低功耗、准确率高和速度快的芒果外观品质分级检测装置,能够进行芒果品质的实时动态分级检测。

       

      Abstract: A convolutional neural network (CNN) can be expected to grade the mango appearance quality for high accuracy. However, it is still challenging to implement CNN on low-cost and performance-constrained edge devices, due to the computation- and storage-intensive CNN algorithm. This has greatly limited the application and promotion of CNN for mango appearance quality grading. In this study, a low-cost grading device was proposed to balance the grading accuracy, speed, power consumption, and detection cost of mango appearance quality using FPGA-accelerated CNN. Firstly, a lightweight network called “Compact MobileNet” (CMNet) was designed with a simple and efficient structure. The parameter and computational complexity of CMNet were significantly reduced to compress the network structure suitable for the deployment of edge devices with acceptable accuracy. Secondly, Batch normalization (BN) layer fusion and model quantization were used to further reduce the storage requirements and computational complexity of the model, in order to accelerate the execution speed of CMNet on cost- and performance-constrained edge devices. Meanwhile, an FPGA-based hardware accelerator was designed for CMNet. Since the basic function of the accelerator was achieved, the high-level synthesis (HLS) optimization, including “unrolling the for-loop”, “pipelining the for-loop”, and “array partitioning”, were used to optimize the parallelism of the hardware accelerator. Finally, a grading device was developed for the appearance quality of mangoes using an FPGA development board, specifically the “ZYNQ Z7 Lite 7020” model. An OV5640 camera module, the CMNet network acceleration circuit, and an HDMI interface were integrated to enable the mango image collection, real-time detection, and display of appearance quality. A series of experiments were conducted in a laboratory environment, in order to verify the performance of CMNet and the grading device. The Dosehri mango dataset downloaded from the internet was used to train and validate CMNet. The mango appearance quality was classified into three grades, according to China's agricultural industry standard for mango (NY/T 492-2002). The model comparison demonstrated that the CMNet shared a very lightweight model scale, only with 0.015M parameters and 7.2MFlops computations, with a high grading accuracy of 96.4%. Therefore, the CMNet was suitable for deployment on a resource-limited FPGA terminal. The assessment experiments on the FPGA-based accelerator of CMNet demonstrated that the accelerator significantly expedited the quality grading, with a speed of 0.072 s per frame. The accelerator was capable of detecting the mango appearance quality in real time. The performance comparison among various computing devices revealed that the power consumption of the FPGA-based grading device was 2.6 W, which was the lowest among the tested devices. The FPGA-based detection device offered substantial advantages, in terms of power consumption and portability, compared with the CPUs and GPUs. The FPGA excelled in the best unit cost performance, compared with the portable Raspberry Pi devices and Android smartphones. In summary, all experimental results indicate that a low-cost, low-power, high-accuracy, and high-speed grading device was suitable for assessing mango appearance quality. This device can also be effectively utilized for the real-time grading of mango quality in the field. Furthermore, this finding can provide a strong reference for similar agricultural applications, where artificial intelligence can be employed to rapidly extract information from video data.

       

    /

    返回文章
    返回