Vehicle Detection and Tracking Algorithm for Distant Small Targets Based on Improved YOLOv5s-CSC and Deep-Sort
-
摘要:
针对交通监控场景中远端小目标车辆易漏检、跟踪过程中ID切换与跳变等问题,提出一种改进YOLOv5s (You Only Look Once version 5 small)与改进Deep-Sort (deep simple online and realtime tracking)相结合的小目标检测跟踪算法. 在检测方面,以YOLOv5s为基础网络,引入CBAM (convolutional block attention module)注意力机制增强对小目标特征的捕捉,将Swin Transformer Block与主干网络中的CSP (cross stage partial)融合,构建CSPSTB模块,强化全局信息关注;并采用CARAFE (content-aware reassembly of features)上采样算子减少特征损失,形成YOLOv5s-CSC检测网络. 在跟踪方面,设计含Res_SE (residual squeeze-and-excitation)结构的深度表观特征提取网络,在数据关联过程中更能适应车辆特征. 在UA-DETRAC数据集上的实验结果表明,相较于原YOLOv5s模型,改进后的检测算法在平均精度均值
m AP、交并比(IoU)阈值为0.50的平均精度均值m AP50及IoU阈值为0.75的平均精度均值m AP75分别提高1.5%、1.5%、1.9%,小目标检测精度提升4.2%. 在VERI-Wild数据集上的跟踪实验显示,结合改进检测器与跟踪网络后,多目标跟踪精度、高阶跟踪精度、IDF1分数(identity F1 score)分别提高9.6%、3.2%、7.7%. YOLOv5s-CSC与改进的Deep-Sort结合后,有效克服了远端小目标车辆跟踪失效及跟踪过程中ID切换、跳变等难题,验证了改进后模型在跟踪精度与鲁棒性方面的优越性.-
关键词:
- 目标检测 /
- 目标跟踪 /
- YOLOv5s /
- Deep-Sort /
- Swin Transformer
Abstract:To address the problems of missed detection of distant small vehicle targets, as well as ID switching and jumping during tracking in traffic surveillance scenarios, a small-target detection and tracking algorithm combining improved You Only Look Once version 5 small (YOLOv5s) and improved deep simple online and realtime tracking (Deep-Sort) was proposed. For detection, based on the YOLOv5s baseline network, the convolutional block attention module (CBAM) mechanism was introduced to enhance the feature capture of small targets. The Swin Transformer Block was fused with the cross stage partial (CSP) structure in the backbone network to construct the CSPSTB module and strengthen global information attention. The content-aware reassembly of features (CARAFE) upsampling operator was adopted to reduce feature loss, forming the YOLOv5s-CSC detection network. For tracking, a deep appearance feature extraction network containing a residual squeeze-and-excitation (Res_SE) structure was designed, which was more adaptable to vehicle features during data association. Experimental results on the UA-DETRAC dataset indicate that, compared with the original YOLOv5s model, the improved detection algorithm increases the mean average precision (
m AP), mean average precision at an intersection over union (IoU) threshold of 0.50 (m AP50), and mean average precision at an IoU threshold of 0.75 (mAP75) by 1.5%, 1.5%, and 1.9%, respectively, and the small-target detection accuracy improves by 4.2%. Tracking experiments on the VERI-Wild dataset show that, after combining the improved detector and tracking network, the multi-target tracking accuracy, high-order tracking accuracy, and IDF1 (identity F1) score increase by 9.6%, 3.2%, and 7.7%, respectively. The combination of YOLOv5s-CSC and the improved Deep-Sort effectively overcomes difficulties of tracking failure of distant small vehicle targets, as well as ID switching and jumping during tracking, verifying the superiority of the improved model in tracking accuracy and robustness.-
Key words:
- target detection /
- target tracking /
- YOLOv5s /
- Deep-Sort /
- Swin Transformer
-
表 1 实验参数配置
Table 1. Experimental parameter configuration
名称 目标检测算法 目标跟踪算法 数据集 UA-DETRAC VERI-Wild 输入尺寸 640 × 640 64 × 128 优化器(Optimizer) SGD SGD 训练批次(Batch size) 8 64 训练轮次(Epoch) 100 200 学习率 0.01 0.10 最小学习率 0.0001 0.0100 表 2 YOLOv5s-CSC算法的检测结果
Table 2. Detection results of YOLOv5s-CSC algorithm
类型 mAP/% mAP50/% mAP75/% car 65.2 85.4 74.4 bus 66.1 89.4 76.4 van 60.5 80.5 73.5 others 50.4 70.1 58.1 全部 58.3 84.0 69.2 表 3 YOLOv5s添加不同模块检测算法实验对比
Table 3. Experimental comparison of detection algorithms with different modules added to YOLOv5s
% 模型 mAP mAP50 mAP75 APS APM APL YOLOv5s 56.8 82.5 67.3 11.0 54.9 78.0 YOLOv5s + CSPSTB 58.2 83.5 69.0 11.7 56.2 78.9 YOLOv5s + CBAM 57.9 83.9 68.5 13.6 55.8 78.3 YOLOv5s + CARAFE 57.4 83.6 67.9 11.5 55.8 78.3 YOLOv5s + CSPSTB + CBAM + CARAFE 58.3 84.0 69.2 15.2 56.3 78.4 表 4 不同天气下算法改进前后对比
Table 4. Comparison of algorithm before and after improvement under different weather conditions
时段 原图 YOLOv5s YOLOv5s-CSC 白天 


雨天 


傍晚 


夜间 


表 5 YOLOv5s加入不同注意力
Table 5. YOLOv5s with different attention mechanisms
% 模型 mAP mAP50 mAP75 YOLOv5s + SE 57.1 82.6 67.8 YOLOv5s + ECA 57.5 83.7 68.0 YOLOv5s + CA 57.8 83.7 68.6 YOLOv5s + CBAM 57.9 83.9 68.5 表 6 不同网络性能对比
Table 6. Performance comparison of different networks
模型 主干网络 mAP/% mAP50/% mAP75/% 参数量/MB FPS/(帧·s−1) SSD VGG 45.1 72.0 50.8 26.29 88.7 Faster R-CNN ResNet-50 43.8 77.8 44.4 137.10 13.4 YOLOv3 Darknet-53 46.6 78.6 51.3 61.95 56.4 YOLOv4 CSPDarknet-53 52.5 81.8 60.3 64.36 45.3 YOLOv5s CSPDarknet-53 56.8 82.5 67.3 7.27 78.5 YOLOX Darknet-53 58.1 83.5 68.8 8.97 77.2 CenterNet ResNet-50 53.4 81.3 62.2 32.67 70.3 YOLOv7-tiny ELAN 55.4 80.3 65.2 6.23 85.6 YOLOv8s CSPDarknet-53 56.9 82.4 66.9 5.64 95.4 YOLOv9s CSPDarknet-53 57.2 82.8 67.2 6.42 90.8 YOLOv10s CSPDarknet-53 57.4 83.0 67.0 8.69 86.4 YOLO11s CSPDarknet-53 58.0 83.6 68.4 7.53 87.7 YOLOv5s-CSC CSPDarknet-53 58.3 84.0 69.2 8.42 63.7 表 7 不同改进方法对比实验
Table 7. Comparison experiments of different improvement methods
% 模型 AMOTA AHOTA F1,ID YOLOv5s + WRN 69.2 63.3 82.5 YOLOv5s-CSC + WRN 78.1 65.2 87.9 YOLOv5s-CSC + Impoved Net 78.5 66.3 89.4 YOLOv5s-CSC + Res_SE Net 78.8 66.5 90.2 -
[1] 赵雪亭, 胡立伟. 城市交通拥塞源参数反演性能综合对比[J]. 西南交通大学学报, 2025, 60(1): 243-252. doi: 10.3969/j.issn.0258-2724.20230008Zhao Xueting, Hu Liwei. Comprehensive comparison of inversion performance of urban traffic congestion source parameters[J]. Journal of Southwest Jiaotong University, 2025, 60(1): 243-252. doi: 10.3969/j.issn.0258-2724.20230008 [2] 夏英, 刘敏. 基于时空注意力卷积神经网络的交通流量预测[J]. 西南交通大学学报, 2023, 58(2): 340-347. doi: 10.3969/j.issn.0258-2724.20210526Xia Ying, Liu Min. Traffic flow prediction based on spatial-temporal attention convolutional neural network[J]. Journal of Southwest Jiaotong University, 2023, 58(2): 340-347. doi: 10.3969/j.issn.0258-2724.20210526 [3] Redmon J, Divvala S, Girshick R, et al. You only look once: unified, real-time object detection[C]//2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). Piscataway: IEEE, 2016: 779-788. [4] Redmon J, Farhadi A. YOLO9000: better, faster, stronger[C]//2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). Piscataway: IEEE, 2017: 6517-6525. [5] Redmon J, Farhadi A. YOLOv3: an incremental improvement[PP/OL]. V1. arXiv (2018-04-08)[2024-10-12]. https://doi.org/10.48550/arXiv.1804.02767. [6] Bochkovskiy A, Wang C Y, Liao H M. YOLOv4: optimal speed and accuracy of object detection[PP/OL]. V1. arXiv (2020-04-23) [2024-10-12]. https://doi.org/10.48550/arXiv.2004.10934. [7] Li C Y, Li L L, Jiang H L, et al. YOLOv6: a single-stage object detection framework for industrial applications[PP/OL]. V1. arXiv (2022-09-07) [2024-10-14]. https://doi.org/10.48550/arXiv.2209.02976. [8] Wang C Y, Bochkovskiy A, Liao H M. YOLOv7: trainable bag-of-freebies sets new state-of-the-art for real-time object detectors[C]//2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). Piscataway: IEEE, 2023: 7464-7475. [9] Tian Z, Shen C H, Chen H, et al. FCOS: fully convolutional one-stage object detection[C]//2019 IEEE/CVF International Conference on Computer Vision (ICCV). Piscataway: IEEE, 2019: 9626-9635. [10] Girshick R, Donahue J, Darrell T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation[C]//2014 IEEE Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2014: 580-587. [11] Ren S Q, He K M, Girshick R, et al. Faster R-CNN: towards real-time object detection with region proposal networks[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017, 39(6): 1137-1149. doi: 10.1109/TPAMI.2016.2577031 [12] 蒲玲玲, 杨柳. 改进YOLOv5的多车辆目标实时检测及跟踪算法[J]. 科学技术与工程, 2023, 23(28): 12159-12167. doi: 10.3969/j.issn.1671-1815.2023.28.031Pu Lingling, Yang Liu. Improved real-time detection and tracking algorithm for multi vehicle targets in YOLOv5[J]. Science Technology and Engineering, 2023, 23(28): 12159-12167. doi: 10.3969/j.issn.1671-1815.2023.28.031 [13] Abdelali H A, Derrouz H, Zennayi Y, et al. Multiple hypothesis detection and tracking using deep learning for video traffic surveillance[J]. IEEE Access, 2021, 9: 164282-164291. doi: 10.1109/ACCESS.2021.3133529 [14] Hassaballah M, Kenk M A, Muhammad K, et al. Vehicle detection and tracking in adverse weather using a deep learning framework[J]. IEEE Transactions on Intelligent Transportation Systems, 2021, 22(7): 4230-4242. doi: 10.1109/TITS.2020.3014013 [15] Zhang X X, Story B, Rajan D. Night time vehicle detection and tracking by fusing vehicle parts from multiple cameras[J]. IEEE Transactions on Intelligent Transportation Systems, 2022, 23(7): 8136-8156. doi: 10.1109/TITS.2021.3076406 [16] Jin J N, Wu Y F, Gao J P. Research on target detection and tracking algorithm for campus driverless vehicle based on improved DeepSORT[C]//2022 China Automation Congress (CAC). Piscataway: IEEE, 2022: 1304-1308. [17] Tian Z L, Wahab M N A, Akbar M F, et al. SFFSORT multi-object tracking by shallow feature fusion for vehicle counting[J]. IEEE Access, 2023, 11: 76827-76841. doi: 10.1109/ACCESS.2023.3297190 [18] Choi J, Ha S, Lee Y, et al. Vehicle tracking system in drone imagery with YOLOv5 and histogram[C]//2023 62nd Annual Conference of the Society of Instrument and Control Engineers (SICE). Piscataway: IEEE, 2023: 778-783. [19] 华泽玺, 施会斌, 罗彦, 等. 基于轻量级YOLO-v4模型的变电站数字仪表检测识别[J]. 西南交通大学学报, 2024, 59(1): 70-80. doi: 10.3969/j.issn.0258-2724.20210544Hua Zexi, Shi Huibin, Luo Yan, et al. Detection and recognition of digital instruments based on lightweight YOLO-v4 model at substations[J]. Journal of Southwest Jiaotong University, 2024, 59(1): 70-80. doi: 10.3969/j.issn.0258-2724.20210544 [20] Woo S, Park J, Lee J Y, et al. CBAM: convolutional block attention module[C]//Computer Vision– ECCV 2018. Cham: Springer International Publishing, 2018: 3-19. [21] Liu Z, Lin Y T, Cao Y, et al. Swin transformer: hierarchical vision transformer using shifted windows[C]//2021 IEEE/CVF International Conference on Computer Vision (ICCV). Piscataway: IEEE, 2021: 9992-10002. [22] Wang J Q, Chen K, Xu R, et al. CARAFE: content-aware reassembly of features[C]//2019 IEEE/CVF International Conference on Computer Vision (ICCV). Piscataway: IEEE, 2019: 3007-3016. [23] 胡欣, 胡帅, 马丽军, 等. 基于融合MBAM与YOLOv5的PCB缺陷检测方法[J]. 图学学报, 2024, 45(1): 47-55. doi: 10.11996/JG.j.2095-302X.2024010047Hu Xin, Hu Shuai, Ma Lijun, et al. PCB defect detection method based on fusion of MBAM and YOLOv5[J]. Journal of Graphics, 2024, 45(1): 47-55. doi: 10.11996/JG.j.2095-302X.2024010047 [24] Wojke N, Bewley A, Paulus D. Simple online and realtime tracking with a deep association metric[C]//2017 IEEE International Conference on Image Processing (ICIP). Piscataway: IEEE, 2017: 3645-3649. [25] Bewley A, Ge Z Y, Ott L, et al. Simple online and realtime tracking[C]//2016 IEEE International Conference on Image Processing (ICIP). Piscataway: IEEE, 2016: 3464-3468. [26] Zagoruyko S, Komodakis N. Wide residual networks[PP/OL]. V4. arXiv (2017-06-14)[2024-09-20]. https://doi.org/10.48550/arXiv.1605.07146. [27] Hu J, Shen L, Sun G. Squeeze-and-excitation networks[C]//2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2018: 7132-7141. [28] Wen L Y, Du D W, Cai Z W, et al. UA-DETRAC: a new benchmark and protocol for multi-object detection and tracking[J]. Computer Vision and Image Understanding, 2020, 193: 102907. doi: 10.1016/j.cviu.2020.102907 [29] Lou Y H, Bai Y, Liu J, et al. VERI-wild: a large dataset and a new method for vehicle re-identification in the wild[C]//2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). Piscataway: IEEE, 2019: 3230-3238. [30] Wang Q L, Wu B G, Zhu P F, et al. ECA-net: efficient channel attention for deep convolutional neural networks[C]//2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). Piscataway: IEEE, 2020: 11531-11539. [31] Hou Q B, Zhou D Q, Feng J S. Coordinate attention for efficient mobile network design[C]//2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). Piscataway: IEEE, 2021: 13708-13717. -
下载: