上海大学学报(自然科学版) ›› 0, Vol. ›› Issue (): 94-105.doi: 10.12066/j.issn.1007-2861.2411

• • 上一篇    下一篇

基于改进 YOLOv5s 的轻量化交通灯检测算法

蔡管鸿1, 李国平1, 王国中1, 滕国伟2   

  1. 1. 上海工程技术大学 电子电气工程学院, 上海 201620; 2. 上海大学 通信与信息工程学院, 上海 200444
  • 收稿日期:2022-03-15 发布日期:2024-02-28
  • 通讯作者: 李国平 (1974—), 男, 高级工程师, 博士, 研究方向为智能媒体处理. E-mail:liguoping@sues.edu.cn

Lightweight traffic-light detection algorithm based on improved YOLOv5s

CAI Guanhong1, LI Guoping1, WANG Guozhong1, TENG Guowei2   

  1. 1. School of Electronic and Electrical Engineering, Shanghai University of Engineering Science, Shanghai 201620, China; 2. School of Communication and Information Engineering, Shanghai University, Shanghai 200444, China
  • Received:2022-03-15 Published:2024-02-28
  • Supported by:
    国家重点研发计划资助项目 (2019YFB1802700)

摘要: 针对目前交通灯检测算法网络模型参数量过大、实时性差的问题, 提出了一种基于改 进 YOLOv5s 的轻量化交通灯检测算法. 首先, 用轻量化网络 MobileNetv3 替换原主干网络 并引入注意力机制, 在对检测精度影响不大的前提下降低模型参数量; 然后, 使用深度可分离 卷积替换颈部网络中的传统标准卷积, 进一步降低模型参数量; 接着, 针对交通灯尺度小的 特点, 删除检测大目标的检测层; 最后, 改进边框回归损失函数, 提升边框检测精度. 同时, 为 了能实时部署在嵌入式平台, 该算法对网络进行通道剪枝实现模型压缩和加速. 实验结果表 明, 该算法在嵌入式平台 NVIDIA Jetson Xavier NX 上能达到 48.1 帧/s 的检测速度, 相比 原始 YOLOv5s 牺牲了 1.5% 的 mAP, 但是该模型体积压缩了 54.3%, 检测速度提高为原来的 2.6 倍, 可以满足在交通道路中实时对交通灯检测的需要.

关键词: 交通灯检测, 轻量化模型, YOLOv5s, MobileNetv3, 通道剪枝

Abstract: A lightweight traffic-light detection algorithm based on improved YOLOv5s is proposed to solve the issue of numerous network model parameters and poor real-time performance of current traffic-light detection algorithms. First, a lightweight network, Mo- bileNetv3, is used to replace the original backbone network, and the attention mechanism is introduced to reduce the number of model parameters on the premise of minimal impact on detection accuracy. Next, the depth separable convolution is used to replace the traditional standard convolution in the neck network to further reduce the number of model parameters. Subsequently, the detection layer for detecting large targets is deleted based on the small scale of traffic lights. Finally, the frame regression loss function is improved to improve the frame detection accuracy. The network is pruned to compress and accelerate the model to be deployed on the embedded platform in real time. The experimental results show that the proposed algorithm can achieve a detection speed of 48.1 frame/s on the embedded platform NVIDIA Jetson Xavier NX, which sacrifices 1.5% mAP compared with the original YOLOv5s. However, the model size is compressed by 54.3%, and the detection speed is increased by 2.6 times, which can satisfy the needs of real-time traffic-light detection on traffic roads.

Key words: traffic-light detection, lightweight model, YOLOv5s, MobileNetv3, channel pruning

中图分类号: