作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2026, Vol. 52 ›› Issue (6): 352-364. doi: 10.19678/j.issn.1000-3428.0069727

• 交叉融合与工程应用 • 上一篇    下一篇

基于改进YOLOv5s的莴笋芯部检测算法

代尹翘, 肖武龙, 李柏林, 李立*()   

  1. 西南交通大学机械工程学院, 四川 成都 610031
  • 收稿日期:2024-04-11 修回日期:2024-07-13 出版日期:2026-06-15 发布日期:2024-12-09
  • 通讯作者: 李立
  • 作者简介:

    代尹翘,男,硕士研究生,主研方向为机器视觉、深度学习

    肖武龙,硕士研究生

    李柏林,教授、博士

    李立(通信作者),教授、博士

  • 基金资助:
    四川省科技厅重点研发项目(2023YFG0047)

Lettuce Core Detection Algorithm Based on Improved YOLOv5s

DAI Yinqiao, XIAO Wulong, LI Bailin, LI Li*()   

  1. School of Mechanical Engineering, Southwest Jiaotong University, Chengdu 610031, Sichuan, China
  • Received:2024-04-11 Revised:2024-07-13 Online:2026-06-15 Published:2024-12-09
  • Contact: LI Li

摘要:

精确的作物行检测作为智能化农业的一项重要技术, 对于无人收获装置的导航和采摘具有重要意义。对莴笋生长过程中歪斜、移位和倒伏等因素导致作物行提取不准确的问题, 将其转化为莴笋芯部区域的目标检测问题, 提出一种以成熟期莴笋芯部为目标的目标检测算法。该算法基于广泛采用的目标检测框架YOLOv5s, 通过在主干网络中嵌入动态卷积模块, 以动态感知的方式过滤特征图中的背景干扰, 在局部区域保留重要细节特征, 从而增强网络对莴笋芯部特征的学习能力。同时, 在网络的特征金字塔网络(FPN)结构中引入基于空洞卷积和权值共享的多尺度融合模块, 确保网络经过多次下采样后能够有效保留目标结构信息, 有利于对莴笋芯部这类小目标的检测。此外, 引入CARAFE上采样操作充分利用特征提取过程中的上下文信息, 增强网络对小目标特征的提取能力。进一步, 基于Wasserstein距离和SIoU提出一种新的损失函数, 解决了传统IoU方法对小目标位置敏感的问题, 并加快了网络拟合速度。实验结果表明, 改进算法对莴笋芯部提取的平均精确度和召回率分别达到了0.586和0.574, 较于YOLOv5s提高了6.1和6.3百分点。网络检测出莴笋芯部坐标信息后, 采用最小二乘法将坐标点进行直线拟合, 得到莴笋作物行中心线。该算法使原始YOLOv5s模型在不同光照条件下对莴笋芯部的漏检问题得到明显改善, 从而能够提取出更加准确的作物行中心线。

关键词: 目标检测网络, 小目标检测, 注意力机制, 多尺度特征融合, 作物行中心线

Abstract:

Precise crop row detection is crucial in intelligent agriculture because it significantly affects the navigation and harvesting capabilities of unmanned harvesters. Crop row extraction accuracy is affected by factors such as slanting, displacement, and lodging during lettuce growth. This study transforms this issue into a target detection problem focusing on the core area of mature lettuce and proposes a target detection algorithm. This algorithm is based on YOLOv5s, a widely adopted target detection framework, and incorporates a dynamic convolution module into its backbone network. By dynamically filtering out background interference from feature maps, it preserves important detail features in local areas, thereby enhancing the network's ability to learn the features of the lettuce core. Additionally, the Feature Pyramid Network (FPN) structure introduces a multiscale fusion module based on dilated convolution and weight sharing, ensuring effective retention of target structural information after multiple downsampling processes, which is beneficial for detecting small targets such as lettuce cores. Furthermore, the CARAFE upsampling operation is introduced to fully utilize the contextual information during the feature extraction process, thereby enhancing the network's ability to extract small target features. Moreover, a new loss function based on the Wasserstein distance and SIoU is proposed to address the sensitivity of traditional IoU methods to the positions of small targets and accelerate the fitting speed of the network. Experimental results demonstrate that the improved algorithm achieves an average precision and recall of 0.586 and 0.574 for lettuce core extraction, representing increases of 6.1 and 6.3 percentage points compared to those achieved by YOLOv5s, respectively. After detecting the coordinates of the lettuce core, the algorithm uses the least squares method to fit the coordinate points into a straight line, thereby obtaining the central line of the lettuce crop row. Experimental results indicate that this algorithm significantly improves the performance of the original YOLOv5s model in detecting lettuce cores under different lighting conditions, thereby enabling a more accurate extraction of the crop row centerline.

Key words: object detection network, small target detection, attention mechanism, multi-scale feature fusion, crop row centerline