计算机工程与应用 ›› 2025, Vol. 61 ›› Issue (11): 249-258.DOI: 10.3778/j.issn.1002-8331.2403-0084

• 图形图像处理 • 上一篇    下一篇

应用归一化通道注意力机制的YOLOv7交通标志检测算法

刘晶,刘俊伟   

  1. 西安理工大学 计算机科学与工程学院,西安 710048
  • 出版日期:2025-06-01 发布日期:2025-05-30

YOLOv7 Traffic Sign Detection Algorithm with Normalized Channel Attention Mechanism

LIU Jing, LIU Junwei   

  1. School of Computer Science and Engineering, Xi’an University of Technology, Xi’an 710048, China
  • Online:2025-06-01 Published:2025-05-30

摘要: 现有目标检测算法对背景复杂下小交通标志的检测效果并不理想。为此,提出了一种基于归一化通道注意力机制YOLOv7的交通标志检测算法(YOLOv7 based on normalized channel attention mechanism,YOLOv7- NCAM)。为了使YOLOv7-NCAM模型具有像素级建模能力,提高它对小目标交通标志特征的提取能力,YOLOv7-NCAM算法使用FReLU激活函数构建了DBF和CBF两种卷积层,并用它们来组建模型的Backbone模块和Neck模块;提出一种归一化通道注意力机制(normalized channel attention mechanism,NCAM)并加入Head模块中。通过与整体网络一起训练,得到归一化(batch normalization,BN)缩放因子,利用缩放因子算出各个通道的权重因子,提升网络对交通标志特征的表达能力,从而使YOLOv7-NCAM网络模型能够集中关注检测目标交通标志。通过在CCTSDB-2021交通标志检测数据集上的测试,与YOLOv7网络模型对比结果表明,YOLOv7-NCAM算法对背景复杂下小交通标志的检测各项指标均有明显提高:准确率(precision,P)达到91.5%,比原网络高出9.5个百分点;召回率(recall,R)达到85.9%,比原网络高出5.7个百分点;均值平均精度(mean average precision,mAP)达到了91.4%,比原网络高出4.7个百分点。与现有的交通标志检测算法相比,YOLOv7-NCAM算法的检测准确率也有提高,且检测速度48.3 FPS,能满足实时需求。

关键词: YOLOv7, 归一化通道注意力机制, 交通标志, 激活函数

Abstract: Aiming at the problem that the existing target detection algorithms are not effective in detecting small traffic signsin complex background, a YOLOv7 based on normalized channel attention mechanism (YOLOV7-NCAM) for detecting traffic signs is proposed. The YOLOv7-NCAM algorithm first constructs two types of convolutional layers, which are called DBF and CBF, using the FReLU activation function, and then uses them to form the Backbone module and the Neck module of the model. Then, a normalized channel attention mechanism (NCAM) is proposed and added to the Head module. By using the attention operator and the normalized (BN) scale factor, the NCAM mechanism can reduce the weight of the complex background to weaken the interference of complex background information and enhance the representation ability of target features, which allows the network to pay more attention to the traffic signs in the image. The test results on the CCTSDB 2021 dataset show that YOLOv7-NCAM achieves advantages over the YOLOv7 network in terms of various indexes: the accuracy (P) reaches 91.5%, which is 9.5 percentage points greater than that of the YOLOv7; Recall rate (R) reaches 85.9%, being 5.7 percentage points greater than that of the YOLOv7; and the mean average precision (mAP) reaches 91.4%, exceeding that of the YOLOv7 by about 4.7 percentage points. Furthermore, YOLOv7-NCAM achieves the accuracy results significantly superior to those of the state-of-the-art algorithms in detecting small traffic signs in complex background and meets real-time requirements with the detection speed of 48.3 FPS.

Key words: YOLOv7, normalized channel attention mechanism (NCAM), traffic sign, activation function