基于BiFPN和Triplet注意力机制的YOLOv5s缺陷苹果识别算法

    A YOLOv5s algorithm based on BiFPN and Triplet attention mechanism for identifing defective apple

    • 摘要:
      目的 为了充分利用上下文信息和融合多尺度特征,提出基于BiFPN和Triplet注意力机制的YOLOv5s (BTF-YOLOv5s)缺陷苹果识别算法。
      方法 首先,加权双向特征金字塔网络(BiFPN)引入额外的权重学习不同输入特征的重要性,模型通过自顶向下和自底向上的双向路径,实现多尺度特征的反复融合,提高多尺度的检测能力;其次,将Triplet注意力机制应用到Neck层以增强模型对目标之间的关联和上下文信息的表示能力,使模型更专注于苹果特征的学习;最后,采用Focal-CIoU损失函数调整损失权重,使模型更关注缺陷苹果的识别,提升模型的感知能力。通过消融试验对比不同损失函数,改变注意力机制在YOLOv5s结构中的位置,并与主流算法进行比较。
      结果 BTF-YOLOv5s在初始YOLOv5s模型基础上,准确率、召回率和mAP方面分别提高了5.7、2.2和3.5个百分点,模型内存使用量为14.7 MB;平均精度比SSD、YOLOv3、YOLOv4、YOLOv5s、YOLOv7、YOLOv8n、YOLOv8s和YOLOv9的分别提升了5.7、3.5、13.3、3.5、2.9、2.6、2.8和0.3个百分点。
      结论 模型在缺陷苹果识别中表现出显著的优越性,为采摘机器人在采摘过程中实现优质苹果与缺陷苹果的自动分拣提供了一定的技术支持。

       

      Abstract:
      Objective In order to make full use of context information and integrate multi-scale features, a YOLOv5s algorithm based on BiFPN and Triplet attention mechanism (BTF-YOLOv5s) for identifing defective apple was proposed.
      Method Firstly, the additional weights were introduced to the weighted bidirectional feature pyramid network ( BiFPN ) to learn the importance of different input features. The model realized the repeated fusion of multi-scale features through the top-down and bottom-up bidirectional paths, and improved the multi-scale detection ability. Secondly, the Triplet attention mechanism was applied to the Neck layer to enhance the model's ability to represent the correlation between target and contextual information, so that the model could focus more on the learning of apple features. Finally, the Focal-CIoU loss function was used to adjust the loss weight, so that the model payed more attention to defective apple recognition, and improved the perception ability of the model. Different loss functions were compared through ablation experiments. The position of attention mechanism in YOLOv5 structure was changed, and compared with the mainstream algorithms.
      Result On the basis of the initial YOLOv5s model, BTF-YOLOv5s improved the accuracy, recall and mAP by 5.7, 2.2 and 3.5 percentage points respectively, and the memory usage of the model was 14.7 MB. The average accuracy of BTF-YOLOv5s was 5.7, 3.5, 13.3, 3.5, 2.9, 2.6, 2.8 and 0.3 percentage points higher than those of SSD, YOLOv3, YOLOv4, YOLOv5s, YOLOv7, YOLOv8n, YOLOv8s and YOLOv9, respectively.
      Conclusion The model of BTF-YOLOv5s shows significant superiority in identifing defective apples, which provides certain technical support for the picking robot to realize the automatic sorting of high-quality apples and defective apples in the picking process.

       

    /

    返回文章
    返回