郭冬冬,蔡祥,齐建东,等. 基于FPGA加速CNN的低成本芒果外观品质检测装置[J]. 农业工程学报,2024,40(21):1-9. DOI: 10.11975/j.issn.1002-6819.202404087
    引用本文: 郭冬冬,蔡祥,齐建东,等. 基于FPGA加速CNN的低成本芒果外观品质检测装置[J]. 农业工程学报,2024,40(21):1-9. DOI: 10.11975/j.issn.1002-6819.202404087
    GUO Dongdong, CAI Xiang, QI Jiandong, et al. A low-cost mango appearance quality grading device based on FPGA accelerated CNN[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2024, 40(21): 1-9. DOI: 10.11975/j.issn.1002-6819.202404087
    Citation: GUO Dongdong, CAI Xiang, QI Jiandong, et al. A low-cost mango appearance quality grading device based on FPGA accelerated CNN[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2024, 40(21): 1-9. DOI: 10.11975/j.issn.1002-6819.202404087

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

    A low-cost mango appearance quality grading device based on FPGA accelerated CNN

    • 摘要: 针对卷积神经网络(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.072s,功耗为2.6W。表明该研究实现了一种低成本、低功耗、准确率高和速度快的芒果外观品质分级检测装置,能够在生产现场进行芒果品质的实时动态分级检测。

       

      Abstract: Utilizing the convolutional neural network (CNN) algorithm for grading mango appearance quality could achieve high accuracy. Due to the CNN algorithm is computation-intensive and storage-intensive, it is challenging to implement CNN on low-cost and performance-constrained edge devices, which greatly limits the application and promotion of CNN based methods for mango appearance quality grading. To address this problem, this paper takes into account the grading accuracy, speed, power consumption, and cost of mango appearance quality grading detection, and proposes a grading device based on FPGA-accelerated CNN. Firstly, a lightweight network called “Compact MobileNet” (CMNet) with a simple and efficient structure was designed. The parameter and computational complexity of CMNet were significantly reduced by compressing the network structure, making it suitable for deployment on edge devices while ensuring an acceptable accuracy. Secondly, in order to accelerate the execution speed of CMNet on cost- and performance- constrained edge devices, BN layer fusion and model quantization methods were used to further reduce the storage requirements and computational complexity of the model. Meanwhile, an FPGA-based hardware accelerator for CMNet was designed. As the basic function of the accelerator achieved, the high-level synthesis (HLS) optimization methods, including “unrolling the for-loop”, “pipelining the for-loop”, and “array partitioning”, were used to optimize the parallelism of the hardware accelerator. Finally, a device for grading the appearance quality of mangoes was developed using an FPGA development board, specifically the “ZYNQ Z7 Lite 7020” model. This device integrates an OV5640 camera module, the CMNet network acceleration circuit, and an HDMI interface, enabling mango image collection, real-time appearance quality detection, and the display of results. To verify the performance of CMNet and the grading device, experiments were conducted in a laboratory environment. The Dosehri mango dataset, downloaded from 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 experiment demonstrates that CMNet has very lightweight model scale, only with 0.015M parameters and 7.2MFlops computations, while maintaining a high grading accuracy of 96.4%. This indicates that CMNet is suitable for deployment on a resource-limited FPGA terminal. The assessment experiments of the FPGA-based accelerator of CMNet demonstrate that the accelerator can significantly expedite the quality grading process, achieving a speed of 0.11 s per frame, this indicates that the accelerator is capable of detecting the mango appearance quality in real-time. The performance comparison experiment among various computing devices reveals that the power consumption of the FPGA-based grading device is 2.6 W, the lowest among the tested devices. In comparison to CPUs and GPUs, the FPGA-based detection device offers substantial advantages in terms of power consumption and portability. When compared to portable Raspberry Pi devices and Android smartphones, the FPGA excels in the best unit cost performance. In summary, all experimental results indicate that this paper presents a low-cost, low-power, high-accuracy, and high-speed grading device for assessing mango appearance quality. This device can be effectively utilized for real-time grading of mango quality in the field. Furthermore, this paper provides a reference solution for similar agricultural applications where artificial intelligence methods are employed to rapidly extract information from video data.

       

    /

    返回文章
    返回