Journal of Computer Applications

    Next Articles

Nighttime vehicle detection algorithm based on spatial and channel synergistic attention mechanism

  

  • Received:2025-01-09 Revised:2025-03-31 Online:2025-04-27 Published:2025-04-27

基于空间与通道协同注意力机制的夜间车辆检测算法

曹正杰1,2,丁玲1,王光伟1,元帅3,王书敏1   

  1. 1. 湖北第二师范学院 计算机学院
    2. 湖北师范大学 物理与电子科学学院
    3. 湖北第二师范学院
  • 通讯作者: 曹正杰
  • 基金资助:
    湖北省自然科学基金面上项目

Abstract: To address the decline in vehicle detection performance in nighttime environments, an improved algorithm based on YOLOv8 is proposed, referred to as YOLO-SA (You Only Look Once with Synergistic Attention). The algorithm incorporates Spatial and Channel Synergistic Attention (SCSA) into the backbone network of YOLOv8, constructing the C2f with Spatial and Channel Synergistic Attention (C2f-SCSA) module to enhance feature extraction capabilities for nighttime images. Next, the Four-Adaptively Spatial Feature Fusion (FASFF) detection head is used to optimize the algorithm's ability to process multi-scale features and improve its detection capability for small objects. Finally, the sample weighting function Slideloss is adopted to replace the original classification loss function, which improves the algorithm's ability to identify difficult samples and alleviates the problem of unbalance of difficult and easy samples. Experimental results demonstrate that on the BDD100K dataset, YOLO-SA achieves higher accuracy in the nighttime vehicle detection task, which outperforms YOLOv8 by 3.4 percentage points in mAP0.5 and 2.9 percentage points in mAP0.5:0.95. These improvements enable the model to more effectively address the challenges of vehicle detection in nighttime environments.

Key words: YOLOv8, nighttime vehicle detection, deep learning, attention mechanism, small target detection

摘要: 针对夜间环境下的车辆检测性能下降的问题,提出了一种基于YOLOv8的改进算法,记作YOLO-SA (You Only Look Once with Synergistic Attention)。该算法在YOLOv8的主干网络中,引入SCSA(Spatial and Channel Synergistic Attention)注意力,构造了C2f-SCSA (C2f with Spatial and Channel Synergistic Attention)模块,提升对夜间图像的特征提取能力;其次,使用FASFF(Four-Adaptively Spatial Feature Fusion)检测头,优化算法处理多尺度特征的能力,并增强对小目标的检测能力;最后,利用样本加权函数Slideloss代替原分类损失函数,提高算法对困难样本的识别能力,缓解难易样本不均衡的问题。实验结果表明:在BDD100K数据集上,YOLO-SA在夜间车辆检测任务中具有更高的精度,在mAP0.5和mAP0.5:0.95指标上相较于YOLOv8分别提高了3.4和2.9个百分点,能够更加有效地应对夜间环境下车辆检测的挑战。

关键词: YOLOv8, 夜间车辆检测, 深度学习, 注意力机制, 小目标检测

CLC Number: