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