首页|基于注意力机制的轻量化YOLO v5s蓝莓检测算法

基于注意力机制的轻量化YOLO v5s蓝莓检测算法

扫码查看
为实现自然环境下蓝莓的精确快速检测,在YOLO v5s的基础上提出了一种结合轻量级网络和注意力机制的改进算法。首先,在主干网络和检测头的位置去除了最大目标检测层的结构,因而降低模型的参数量,增强模型对小目标的检测能力。其次,将MHSA(Multi-head self-attention,多头自注意力)替换了SPPF(Spatial pyramid pooling-fast,快速空间金字塔池化)前面的C3模块,使模型学习到更全面的特征表示,增强模型对蓝莓图像中复杂空间关系和上下文信息的理解能力。最后,在C3模块中加入了S-PSA(Sequential polarized self-attention,顺序极化自注意力),以便模型能够更好地捕捉特征图中相邻区域之间的上下文依赖关系。结果表明,改进后的YOLO v5s算法对成熟、半成熟和未成熟蓝莓的检测精度分别提升1。2、4。4、2。6百分点,平均精度提升2。7百分点,模型参数量减少76。0%。与当前主流轻量化目标检测模型相比,改进后的模型性能更加优越,能为自然环境下蓝莓采摘机器人视觉系统提供一种有效的方案。
Lightweight YOLO v5s Blueberry Detection Algorithm Based on Attention Mechanism
To achieve precise and rapid detection of blueberries in natural environments,an improved algorithm combining lightweight networks and attention mechanisms was proposed based on YOLO v5s.Firstly,the structure of the maximum object detection layer was removed at the positions of the backbone network and detection heads,thereby reducing the number of model parameters and enhancing the model's ability to detect small targets.Secondly,MHSA(Multi-head self-attention)was used to replace the C3 module before SPPF(Spatial pyramid pooling-fast),enabling the model to learn more comprehensive feature representations and enhancing its understanding of complex spatial relationships and contextual information in blueberry images.Finally,S-PSA(Sequential polarized self-attention)was added to the C3 module to better capture the contextual dependencies between adjacent regions in the feature map.The experimental results showed that the improved YOLO v5s algorithm improved the detection accuracy of mature blueberries,semi mature blueberries,and immature blueberries by 1.2,4.4,2.6 percentage points,respectively,with average accuracy increase of 2.7 percentage points and 76%reduction in model parameter count.Compared with the current mainstream lightweight object detection models,the improved model has superior performance and can provide an effective solution for the visual system of blueberry picking robots in natural environments.

Blueberry detectionYOLO v5sLightweight networkAttention mechanismMHSA

刘拥民、张炜、麻海志、刘原、张毅

展开 >

中南林业科技大学 计算机与信息工程学院,湖南 长沙 410004

中南林业科技大学 智慧林业云研究中心,湖南 长沙 410004

蓝莓检测 YOLO v5s 轻量级网络 注意力机制 多头自注意力

国家自然科学基金湖南省自然科学基金湖南省教育科学规划基金(十三五)

318705322021JJ31163XJK20BGD048

2024

河南农业科学
河南省农业科学院

河南农业科学

CSTPCD北大核心
影响因子:0.787
ISSN:1004-3268
年,卷(期):2024.53(3)
  • 21