基于改进YOLOv5s模型的自然场景中绿色柑橘果实检测

    Detecting green citrus fruit in natural scenes using improved YOLOv5s model

    • 摘要: 针对未成熟柑橘果实智能检测存在精度低、模型大的问题,该研究提出了一种基于YOLOv5s改进的绿色柑橘检测算法模型YOLO-GC,实现对复杂自然环境中果实的实时准确检测。首先,针对YOLOv5s网络模型较大且难以部署的问题,以轻量级GhostNet网络替换原始的骨干网络,同时为减小模型轻量化后精度下降的影响和提高对绿色柑橘特征的关注度,嵌入全局注意力机制(global attention mechanism,GAM)增强网络在复杂环境下对果实特征的提取能力;其次,为了改善密集与小目标果实的检测效果,引入BiFPN(bi-directional feature pyramid network)架构进行多尺度的加权特征融合;最后,为减少果实与枝叶遮挡、重叠造成的漏检,采用GIoU(generalized intersection over union)损失函数结合Soft-NMS(soft-non-maximum suppression)算法优化边界框回归机制。试验结果表明:相较于YOLOv5s,YOLO-GC的权重模型内存减小了53.9%,参数量减少了55.2%,平均精度AP0.5提升了1.2个百分点,平均推理时长减少46.2%。YOLO-GC模型的综合检测性能优于YOLOv8等7种常用网络模型,在安卓手机APP中检测准确率达到97.2%,推理时长减少了85.8%。研究表明,该研究模型为复杂环境中绿色果实检测及模型部署应用提供了技术支撑。

       

      Abstract: Accurate detection of immature green citrus fruits in trees is one of the most critical steps for production decisions, such as early yield prediction, precise water and fertilizer management, and regulation of number of fruits hanging. However, the large model has been confined to identifying the immature citrus, due to the similar green citrus to the canopy background. Great challenges have been brought to rapidly and accurately detect the fruits, even to deploy the model. In this study, an improved model, YOLO-GC (you only look once-green citrus) was proposed to detect the green citrus fruits using YOLOv5s. The improved model was also deployed into the edge mobile devices, in order to achieve the real-time and convenient detection of green citrus fruits in trees. Firstly, the original backbone network was replaced with a lightweight GhostNet one, because the YOLOv5s network model was large and difficult to deploy. Meanwhile, the attention was then improved to the green citrus features. Accuracy degradation was reduced after the model was lightweight. Global Attention Mechanism (GAM) was embedded in the backbone network and the feature fusion layer, in order to extract the fruit features in complex environments. Secondly, a BiFPN (Bi-directional Feature Pyramid Network) architecture was introduced into the feature fusion layer for the multi-scale weighted feature fusion, in order to improve the dense and small-targeted fruits. Finally, the GIoU (Generalized Intersection over Union) loss function combined with Soft-NMS (Soft-Non-Maximum Suppression) was used to optimize the bounding box regression, in order to reduce the omission caused by the occlusion and overlapping of fruits and branches. The experimental results showed that the weight model memory of YOLO-GC was reduced by 53.9%, compared with the YOLOv5s. The number of parameters and the average inference time were reduced by 55.2% and 46.2%, respectively, whereas, the average precision (AP0.5) was improved by 1.2 percentage points. There was a lower amount of fruit leakage and misdetection in a variety of complex natural environments. The comprehensive performance of the YOLO-GC model was superior to that of CenterNet and seven commonly used network models, such as the YOLOv5s, YOLOv7, YOLOX, YOLOv8, CenterNet, Faster R-CNN, and RetinaNet target networks. The average accuracy of the YOLO-GC model was improved by 1.2, 1.3, 1.4, 0.9, 1.7, 4.6, and 3.9 percentage points, respectively, only 6.69 MB of weighted memory, thus achieving 97.6%, 90.3%, 97.8%, and 97.0% for the precision, recall, average precision, and F1 score, respectively. The YOLO-GC model was then deployed to the Android mobile App for testing. The detection accuracy reached 97.2%, which was 2.4 percentage points higher than that of the YOLOv5s. Furthermore, the inference duration (1 038 ms) was reduced by 85.8%. The IC model fully met the requirements of high-accuracy recognition and real-time inference of green citrus on the Android phone side. The finding can provide technical support to detect the green-like fruits in complex environments. The improved model was also deployed in the edge intelligent devices.

       

    /

    返回文章
    返回