基于改进YOLOv7算法的自然环境下柑橘缺陷检测

    Detection of citrus defects in natural environment based on improved YOLOv7 algorithm

    • 摘要:
      目的 柑橘缺陷识别是实现柑橘果实自动采摘、把控柑橘果实品质的关键环节。本研究致力于提高自然环境下的柑橘缺陷识别精度,实现智能采摘的全天候作业。
      方法 通过对关键模块进行优化,提出改进的YOLOv7算法,具体做法包括引入完全交并比(Complete intersection over union, CIoU)损失函数提升边界框回归精度;采用HardSwish激活函数增强网络学习与计算效率;融合无注意力机制 (Attention free transformer, AFT)强化目标特征识别;结合残差多层感知机(Residual multi-layer perceptron, ResMLP)和动态卷积(Dynamic convolution, DC)技术,提高模型在复杂光照下的适应性与稳定性。
      结果 利用双光源系统,该算法可实现自然环境下柑橘果实和缺陷的全天候检测,在自然光或白光下能检测黑斑、裂纹等缺陷;而在夜间可将紫光作为补充手段,基于荧光反应检测在白光或自然光下的不明显缺陷。试验结果表明,改进后的YOLOv7算法,在日间对柑橘及缺陷的识别精度分别达97.9%和92.8%,比原算法提升3.8和13.4个百分点;在夜间对缺陷识别精度为82.4%。
      结论 本文提出的柑橘缺陷识别方法准确率高、适用时段广,可为柑橘产业采摘智能化提供新思路。

       

      Abstract:
      Objective Citrus defect recognition is a key link in realizing automatic citrus fruit picking and controlling fruit quality. This study aims to improve the accuracy of citrus defect recognition in natural environments and achieve all-weather operation of intelligent picking.
      Method By optimizing key modules, an improved YOLOv7 algorithm was proposed. The specific improvements included: Introducing the complete intersection over union (CIoU) loss function to improve bounding box regression accuracy; adopting the HardSwish activation function to enhance network learning and computational efficiency; integrating the attention free transformer (AFT) to strengthen target feature recognition; and combining the residual multilayer perceptron (ResMLP) and dynamic convolution (DC) technologies to improve model’s adaptability and stability under complex lighting conditions.
      Result Using a dual light source system, this algorithm achieved all-weather detection of citrus fruits and their defects in natural environments. It detected defects such as black spots and cracks under natural light or white light, while at night, violet light served as a complementary means to detect defects that were not obvious under white light or natural light based on fluorescent responses. The experimental results showed that the improved YOLOv7 algorithm achieved 97.9% recognition accuracy for citrus fruits and 92.8% for defects during daytime, which were 3.8 and 13.4 percentage points higher than those of the original YOLOv7 algorithm, respectively; The defect recognition accuracy at night reached 82.4%.
      Conclusion The citrus defect recognition method proposed in this paper has high accuracy and a wide applicable time range, providing new insights for the intelligent harvesting in the citrus industry.

       

    /

    返回文章
    返回