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

计算机工程 ›› 2025, Vol. 51 ›› Issue (7): 362-374. doi: 10.19678/j.issn.1000-3428.0069524

• 开发研究与工程应用 • 上一篇    下一篇

改进YOLOv8的实时轻量化鲁棒绿篱检测算法

张佳承1, 韦锦1,*(), 陈义时2   

  1. 1. 广西大学机械工程学院, 广西 南宁 530004
    2. 广西机械工业研究院有限责任公司, 广西 南宁 530004
  • 收稿日期:2024-03-09 出版日期:2025-07-15 发布日期:2024-06-25
  • 通讯作者: 韦锦
  • 基金资助:
    国家自然科学基金(52365001); 广西创新驱动发展项目(GuiKeAA23023011)

Improved YOLOv8 Real-time Lightweight Robust Hedge Detection Algorithm

ZHANG Jiacheng1, WEI Jin1,*(), CHEN Yishi2   

  1. 1. College of Mechanical Engineering, Guangxi University, Nanning 530004, Guangxi, China
    2. Guangxi Research Institute of Mechanical Industry Co., Ltd., Nanning 530004, Guangxi, China
  • Received:2024-03-09 Online:2025-07-15 Published:2024-06-25
  • Contact: WEI Jin

摘要:

针对道路两侧绿篱修剪的目标检测过程中对算法实时性、轻量化的要求以及算法在实际检测中的精度和光照鲁棒性问题,提出一种基于YOLOv8n的算法MGW-YOLO,并给出一种新的C2f_ModuGhost+模块来替换主干网络中的C2f模块,其中设计的调制可变形卷积增加了偏移量特征通道数,以加速模型的推理,增强算法实时性。在颈部网络中引入分组空间卷积(GSConv)轻量级卷积技术和slim-neck设计范式,并通过融合标准卷积、深度可分离卷积和Shuffle模块的思想,降低模型的参数量,实现模型的轻量化。设计一种具有双重加权机制的Focal-WIoU损失函数,WIoU中的双层交叉注意力机制可有效降低多个绿篱相连和遮挡时的误检率,并且利用Focal Loss权重因子提升对特殊形状绿篱等难分类样本的检测精度。另外采用TRADES方法的对抗训练策略,在分类问题鲁棒性与精度之间进行有效权衡。实验结果表明,相比基线算法YOLOv8n,MGW-YOLO的mAP@0.5和mAP@0.5 ∶0.95分别提高了3.29和2.87百分点,在无人驾驶底盘上的实验结果表明,MGW-YOLO相较于原始算法的预处理时间、每帧平均推理时间和每帧后处理时间分别降低了0.7 ms、10.7 ms和0.7 ms,检测速度提升了15.7帧/s,适用于绿篱修剪机在道路两侧实时性作业的需求。

关键词: YOLOv8算法, 目标检测, C2f_ModuGhost+模块, 分组空间卷积轻量级卷积, Focal-WIoU损失函数, 对抗训练

Abstract:

This study presents MGW-YOLO, an algorithm based on YOLOv8n. The study aims to address the need for an accurate, real-time, robust, and lightweight algorithm for target detection during hedge trimming on both sides of a road. The study also proposes a new C2f_ModuGhost+ module to replace the C2f module in the backbone network, in which modulated deformable convolution increases the number of offset feature channels, which accelerates model inference and improves the real-time algorithm. The Grouped Spatial Convolution (GSConv) lightweight convolution technique and slim-neck design paradigm are introduced into the neck of the network, which integrates concepts such as standard convolution, depth-separable convolution, and Shuffle module; reduces the number of parameters; and makes the model lightweight. A focal-WIoU loss function with a double weighting mechanism is designed. The two-layer cross-attention mechanism in WIoU effectively reduces the false detection rate when multiple hedges are connected and occluded, and the focal loss weighting factor is utilized to improve the detection accuracy of difficult-to-classify samples such as special-shaped hedges. In addition, the adversarial training strategy of TRADES is adopted to balance robustness and accuracy in the classification problem. Experimental results show that, compared with the baseline algorithm, i.e., YOLOv8n, the mAP@0.5 and mAP@0.5 ∶0.95 of MGW-YOLO increases by 3.29 and 2.87 percentage points, respectively. Experiments on an unmanned chassis show that the pre-processing time, average inference time per frame, and post-processing time per frame of MGW-YOLO are reduced by 0.7 ms, 10.7 ms and 0.7 ms, respectively. The detection speed improves by 15.7 frame/s compared to that of the original algorithm, which is suitable for the real-time operation of hedge trimmers on both sides of a road.

Key words: YOLOv8 algorithm, object detection, C2f_ModuGhost+module, Grouped Spatial Convolution(GSConv)lightweight convolution, Focal-WIoU loss function, adversarial training