重庆理工大学学报(自然科学) ›› 2023, Vol. 37 ›› Issue (4): 166-173.

• 智能技术 • 上一篇    下一篇

结合注意力机制的 YOLOv5红绿灯检测算法

邓天民,王春霞,刘金凤   

  1. 重庆交通大学 交通运输学院,重庆 400074
  • 出版日期:2023-05-06 发布日期:2023-05-06
  • 作者简介:邓天民,男,博士,副教授,主要从事交通大数据、自动驾驶、交通控制研究,Email:260731323@163.com;通信作 者 王春霞,女,硕士研究生,主要从事深度学习、交通环境感知研究,Email:2401789472@163.com。

YOLOv5 traffic light detection algorithm combined with attention mechanism

  • Online:2023-05-06 Published:2023-05-06

摘要: 针对现有交通灯算法对小目标、遮挡目标检测识别效果不佳等问题,提出一种基于 注意力与多尺度特征融合的 YOLOv5检测算法(YOLOv5detectionalgorithmbasedonattention andmultiscalefeaturefusion,AMYOLOv5)。通过在残差结构中引入坐标注意力模块,提高对小 目标的特征提取能力;设计四尺度检测层,通过引入更浅层特征改善对小尺度目标的检测性能, 提高检测精度;针对引入注意力和检测层导致计算量增大、速度降低的问题,采用分布移位卷积 替换部分主干卷积的方法,简化模型,提升速度。实验结果表明:该算法在 Lara数据集上平均 精度均值达到 90.8%,相较于经典 YOLOv5算法,精度提升 2.7%,速度达到 59.9FPS,在复杂 恶劣环境下的 BDD100K数据集上,精度提升 3.6%,速度达到 34.8FPS,具有良好的检测效果, 能较好地满足交通灯的实时检测。

关键词: 交通灯检测, 注意力机制, 多尺度检测, 深度学习

Abstract: Aiming at the problems that the existing traffic light algorithm has poor detection and recognition effect on small targets and occlusive objects, this paper proposes a YOLOv5 detection algorithm based on feature fusion of attention and multi-scale (AM-YOLOv5). Firstly, by introducing a coordinate attention module into the residual block, the feature extraction ability of small targets is improved. Secondly, a four-scale detection layer is designed to improve the detection performance and accuracy of small-scale targets by introducing more shallower features. Finally, aiming at the problem that the introduction of attention and detection layers leads to an increase in the amount of computation and a decrease in speed, the method of replacing partial trunk convolution with distributed displacement convolution is used to simplify the model and improve the speed. The experimental results show that the average accuracy of the proposed algorithm reaches 90.8% in Lara dataset, which is 2.7% higher than that of the classical YOLOv5 algorithm, and the speed reaches 59.9 FPS. In the BDD100K dataset in a complex and harsh environment, the accuracy increases by 3.6%, and the speed reaches 34.8 FPS, which has a good detection effect and can better meet the real-time detection of traffic lights.

中图分类号: 

  • TP391.4