高芳芳, 武振超, 索睿, 周忠贤, 李瑞, 傅隆生, 张昭. 基于深度学习与目标跟踪的苹果检测与视频计数方法[J]. 农业工程学报, 2021, 37(21): 217-224. DOI: 10.11975/j.issn.1002-6819.2021.21.025
    引用本文: 高芳芳, 武振超, 索睿, 周忠贤, 李瑞, 傅隆生, 张昭. 基于深度学习与目标跟踪的苹果检测与视频计数方法[J]. 农业工程学报, 2021, 37(21): 217-224. DOI: 10.11975/j.issn.1002-6819.2021.21.025
    Gao Fangfang, Wu Zhenchao, Suo Rui, Zhou Zhongxian, Li Rui, Fu Longsheng, Zhang Zhao. Apple detection and counting using real-time video based on deep learning and object tracking[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2021, 37(21): 217-224. DOI: 10.11975/j.issn.1002-6819.2021.21.025
    Citation: Gao Fangfang, Wu Zhenchao, Suo Rui, Zhou Zhongxian, Li Rui, Fu Longsheng, Zhang Zhao. Apple detection and counting using real-time video based on deep learning and object tracking[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2021, 37(21): 217-224. DOI: 10.11975/j.issn.1002-6819.2021.21.025

    基于深度学习与目标跟踪的苹果检测与视频计数方法

    Apple detection and counting using real-time video based on deep learning and object tracking

    • 摘要: 基于机器视觉技术自动检测苹果树上的果实并进行计数是实现果园产量测量和智慧果园生产管理的关键。该研究基于现代种植模式下的富士苹果视频,提出基于轻量级目标检测网络YOLOv4-tiny和卡尔曼滤波跟踪算法的苹果检测与视频计数方法。使用YOLOv4-tiny检测视频中的苹果,对检测到的果实采用卡尔曼滤波算法进行预测跟踪,基于欧氏距离和重叠度匹配改进匈牙利算法对跟踪目标进行最优匹配。分别对算法的检测性能、跟踪性能和计数效果进行试验,结果表明:YOLOv4-tiny模型的平均检测精度达到94.47%,在果园视频中的检测准确度达到96.15%;基于改进的计数算法分别达到69.14%和75.60%的多目标跟踪准确度和精度,较改进前算法分别提高了26.86和20.78个百分点;改进后算法的平均计数精度达到81.94%。该研究方法可有效帮助果农掌握园中苹果数量,为现代化苹果园的测产研究提供技术参考,为果园的智慧管理提供科学决策依据。

       

      Abstract: Abstract: Yield estimation for apples is a key for predicting stock volumes, allocating needed labor, and planning harvesting operations. Manual visual yield estimation for a small number of trees to predict the number of fruits in an orchard has traditionally been employed, resulting in inaccurate and misleading information. Therefore, an automated solution for orchard yield measurement is urgently needed. Detection and counting of fruits infield based on machine vision coupled with advanced machine learning algorithms is a key to realizing orchard yield measurement automatically, which can provide baseline information for better production management. Therefore, this study aims to develop an automated video processing method to realize the automated detection and counting of apple fruits in an orchard environment with a modern vertical fruiting-wall architecture. This study proposed a fruit counting method based on a lightweight YOLOv4-tiny network and Kalman filter algorithm toward this end. ‘Fuji’ variety was selected, which is widely planted in modern planting patterns. 800 images and 10 videos of apple trees were acquired using a remote-controlled car equipped with a Realsense D435 camera. Firstly, fruits in the orchard video were detected using the trained YOLOv4-tiny model. Secondly, all detected apples would be predicted based on the Kalman filter algorithm. Subsequently, all predicted and detected apples in the subsequent frame would be optimally matched based on the Hungarian algorithm of the Euclidean distance and Intersection over Union (IoU). Successfully matched fruits would be added to the tracked track, based on which the corresponding Kalman filter was updated. The trajectory that failed to match would be temporarily saved until the match failed for 30 consecutive frames, while the detection target that failed to match was regarded as a new fruit. Finally, the fruit digital ID would be assigned based on the appearance sequence of the fruit in the video frame to realize the fruit count. In order to prove the superior performance of the deep learning network trained in this study, YOLOv3-tiny was chosen to use the same test dataset for comparison with YOLOv4-tiny. The test results showed that the Average Detection Precision (ADP) based on YOLOv4-tiny reached 94.47%, which was 1.76 percentage points higher than that of YOLOv3-tiny. Besides, YOLOv4-tiny only took 0.018 s on average to detect fruits in one image with the resolution of 720×1 080 pixels, which was 0.009 s faster than YOLOv3-tiny. It could be seen that YOLOv4-tiny could achieve high-precision detection of fruits at a faster speed, which provided a good foundation for fruit counting. The Multiple Object Tracking Accuracy (MOTA) and the Multiple Object Tracking Precision (MOTP) based on Kalman and improvement Hungarian algorithms were 69.14% and 75.60%, which were 26.86 percentage points and 20.78 percentage points higher than the indicators based on Kalman and the unimproved Hungarian algorithm, respectively, indicating the reliability of the tracking algorithm. Furthermore, an average precision of 81.94% and a determination coefficient of 0.986 with counting performed by manual observation were reached in 10 orchard videos. The method developed in this study can effectively feedback the detection and counting results of apples in the orchard for growers, provide technical reference for the production measurement research of modern apple orchards, and provide scientific decision-making basis for intelligent management of orchards.

       

    /

    返回文章
    返回