Intersection traffic flow statistics strategy based on deep learning
-
摘要:
为实现交叉路口交通流量同步统计,提出了一种基于深度学习的交叉口交通参与者流量统计策略。选取西安市5个典型交叉口进行无人机航拍视频采集,构建了适用于深度学习的数据集;基于YOLOv8原始网络结构,增加小目标检测层P2,以减少对小目标的漏检率,并融合BiFPN结构,提升了对小样本类别的识别效果,改进了检测模型,实现对交叉路口交通参与者的全类别检测;在此基础上,通过动态调整虚拟检测线,利用Trigger函数捕获车辆过线前后的状态变化实现计数,并建立映射表,对车辆目标流向进行判定,同时针对行人运动方向与车辆不同的特点,额外设定行人检测线,采用相同方法实现计数与流向判定,最终提出一种基于动态虚拟检测线的交叉口流量统计方法。研究结果表明:改进后的模型相比原始模型在mAP50指标上提升11.23%,行人检测的召回率与精度显著提高,同时提升了数据集中样本量较少客车的召回率;用本文流量统计方法对西安市另一交叉口流量进行试验验证,该方法对交叉口流量的平均统计精度为93.6%,重复计数率较固定检测线大幅下降,检测速度较其他方法提升至24帧·s-1,能够满足交叉口流量精准统计的需求。本文方法实现了对交叉口各交通参与者的计数与流向的高精度同步检测,可用于优化信号配时,缓解交通拥堵,提升交通安全。
Abstract:To achieve synchronous statistical analysis of traffic flow at intersections, a traffic flow statistics strategy for monitoring traffic participants at intersections was proposed based on deep learning. The unmanned aerial vehicle (UAV) aerial videos were collected at five typical intersections in Xi'an to construct a dataset applicable for deep learning. Based on the original YOLOv8 network architecture, a small-target detection layer P2 was added to reduce the missed detection rate of small targets. The BiFPN structure was also integrated to enhance the recognition effectiveness for categories with small samples, thereby improving the detection model to achieve comprehensive detection of all traffic participants at intersections. Based on this, through dynamic adjustment of virtual detection lines, trigger functions were utilized to capture state changes of vehicles before and after crossing the lines to achieve counting. A mapping table was then established to determine the flow direction of vehicle targets. Meanwhile, considering the different movement characteristics of pedestrians compared to vehicles, additional pedestrian detection lines were set up by employing the same method to achieve counting and flow direction determination. Ultimately, an intersection traffic flow statistics method was proposed based on dynamic virtual detection lines. Research results demonstrate that compared to the original model, the improved model shows an 11.23% increase in mAP50 metrics, with significant improvements in both recall rate and precision for pedestrian detection. The recall rate for buses with limited samples in the dataset is also increased. After using the proposed traffic flow statistics method for experimental validation at another intersection in Xi'an, the verification results indicate that this method achieves an average statistical accuracy of 93.6% for intersection traffic flow, with a substantial reduction in duplicate counting rates compared to fixed detection lines. Compared to other methods, the detection speed rises to 24 FPS. The requirements for precise intersection traffic flow statistics can be met. The proposed method achieves high-precision synchronous detection of counting and flow direction for all traffic participants at intersections, applicable for optimizing signal timing, alleviating traffic congestion, and enhancing traffic safety.
-
Key words:
- traffic engineering /
- traffic flow statistic /
- deep learning /
- intersection /
- UAV /
- small target
-
表 1 数据集对比
Table 1. Comparison of datasets
数据集 目标类别数 分辨率 航拍高度 拍摄视角 覆盖交叉口各进口道 是否包含行人/非机动车 标注格式 UAVDT 3 1 080p 多种高度 斜视 否 否 VOC DroneVehicle 2 4K 低空为主 斜视/俯视 否 否 专用格式 VisDrone 2019 10 多种分辨率 多种高度 斜视 部分覆盖 是 VOC/COCO 自建数据集 7 4K 90~120 m 俯视 是 是 YOLO 表 2 目标状态信息
Table 2. Target status information
状态 身份编码 方向 False/True 标号 in/out 表 3 车辆流向信息
Table 3. Vehicle flow information
驶入方向/驶出方向 上 下 左 右 上 掉头 直行 右转 左转 下 直行 掉头 左转 右转 左 左转 右转 掉头 直行 右 右转 左转 直行 掉头 表 4 行人状态信息表
Table 4. Pedestrian status information table
行人状态 身份编码 方向 穿过的线 False/True 标号 顺/逆 上/下/左/右 表 5 基线模型与改进模型训练结果
Table 5. Training results of baseline model versus improved model
类别 平均精度 召回率 mAP50或AP50 mAP50~95或AP50~90 基线模型 改进模型 基线模型 改进模型 基线模型 改进模型 基线模型 改进模型 全部 0.789 0.911 0.801 0.921 0.837 0.931 0.602 0.680 轿车 0.924 0.965 0.963 0.974 0.976 0.984 0.756 0.787 货车 0.795 0.921 0.833 0.935 0.895 0.933 0.673 0.722 客车 0.435 0.924 0.829 0.857 0.772 0.860 0.712 0.746 行人 0.783 0.873 0.325 0.796 0.510 0.879 0.122 0.368 两轮车 0.861 0.877 0.770 0.917 0.808 0.901 0.421 0.521 三轮车 0.718 0.829 0.892 0.969 0.907 0.967 0.595 0.666 人行横道 0.986 0.987 0.996 0.996 0.994 0.990 0.948 0.949 表 6 消融试验结果
Table 6. Ablation study results
类别 模型 检测框平均精度/% 召回率 AP50 AP50~90 客车 YOLOv8n 43.5 0.829 0.772 0.712 YOLOv8+BiFPN 98.9 0.784 0.852 0.750 YOLOv8+P2 86.4 0.726 0.819 0.672 YOLOv8+P2+BiFPN 92.4 0.857 0.860 0.746 行人 YOLOv8n 78.3 0.325 0.510 0.122 YOLOv8+BiFPN 78.1 0.522 0.658 0.194 YOLOv8+P2 82.2 0.793 0.875 0.383 YOLOv8+P2+BiFPN 87.3 0.796 0.879 0.368 表 7 路口流量流向检测结果
Table 7. Intersection flow direction detection result
路口 行驶方向 轿车/veh 货车/veh 客车/veh 两轮车/veh 三轮车/veh 路口转向流量统计精度/% 行人/个 检测 实测 检测 实测 检测 实测 检测 实测 检测 实测 检测 实测 上方路口 左转 41 46 8 8 0 0 12 12 3 3 92.75 顺时针 右转 45 49 8 10 0 0 8 8 9 10 90.91 15 17 直行 77 79 0 0 0 0 24/25 24 11 11 98.25 逆时针 掉头 0 0 0 0 0 0 0 0 0 0 100.00 12 12 下方路口 左转 56 62 0 0 0 0 28 35 6 6 87.38 顺时针 右转 49 51 0 0 0 0 25/26 28 10 12 92.31 18 20 直行 86 87 0 0 0 0 15 18 10 12 94.87 逆时针 掉头 5 5 0 0 0 0 0 0 0 0 100.00 35 37 左侧路口 左转 57 60 0 0 0 0 30/31 36 9 11 89.72 顺时针 右转 41 41 0 0 0 0 22 25 8 8 95.95 23 26 直行 95 99 28 28 12 12 26/27 30 10 13 93.96 逆时针 掉头 3 3 0 0 0 0 0 0 0 0 100.00 21 24 右侧路口 左转 32 32 0 0 0 0 0 0 7 7 100.00 顺时针 右转 20 22 8 8 0 0 24 24 3 3 96.49 12 12 直行 140 143 63 68 12 12 9 10 10 11 95.90 逆时针 掉头 4 4 0 0 0 0 0 0 0 0 100.00 20 25 总流量 751 783 115 122 24 24 223 250 96 107 93.60 156 173 注:数据中“24/25”,后者为包含重复计数数据,前者为去除重复计数数据;转向流量统计精度为各路口除行人外各流向数据去除重复计数后的检测值之和与实测数据之和的比值;顺时针、逆时针为行人在各个路口的行走方向。 表 8 动态检测线重复计数率
Table 8. Repetition counting rate of dynamic detection line
类型 轿车 货车 客车 行人 两轮车 三轮车 实际计数/veh 751 115 24 156 223 96 总计数/veh 751 115 24 156 226 96 重复计数率/% 0 0 0 0 1.33 0 表 9 模型性能指标
Table 9. Model performance indicators
指标类型 MOTA MOTP IDF1 召回率 精度 数值 0.799 0.289 0.859 0.829 0.973 表 10 固定检测线重复计数率
Table 10. Repetition counting rate of fixed detection line
类型 轿车 货车 客车 行人 两轮车 三轮车 实际计数/veh 753 117 23 165 220 98 总计数/veh 765 120 24 165 225 101 重复计数率/% 1.57 2.5 4.16 0 2.22 2.97 -
[1] 宋浪, 安实, 俞山川, 等. 设置借道左转车道的排阵式交叉口组合设计方法[J]. 交通运输工程学报, 2025, 25(1): 295-310. doi: 10.19818/j.cnki.1671-1637.2025.01.021SONG Lang, AN Shi, YU Shan-chuan, et al. Combination design method of tandem intersections with contraflow left-turn lane[J]. Journal of Traffic and Transportation Engineering, 2025, 25(1): 295-310. doi: 10.19818/j.cnki.1671-1637.2025.01.021 [2] 赵红星, 王钰捷, 聂江龙, 等. 元胞推演多步决策的交叉口深度强化学习信号连续控制[J]. 交通运输工程学报, 2025, 25(4): 296-310. doi: 10.19818/j.cnki.1671-1637.2025.04.021ZHAO Hong-xing, WANG Yu-jie, NIE Jiang-long, et al. Deep reinforcement learning signal continuous control of intersection based on cellular deduction multi-step decision mechanism[J]. Journal of Traffic and Transportation Engineering, 2025, 25(4): 296-310. doi: 10.19818/j.cnki.1671-1637.2025.04.021 [3] 张印辉, 计凯, 何自芬, 等. 注意力引导的多尺度红外行人车辆实时检测[J]. 红外与激光工程, 2024, 53(5): 20240063.ZHANG Yin-hui, JI Kai, HE Zi-fen, et al. Attention-guided multi-scale infrared real-time detection of pedestrian and vehicle[J]. Infrared and Laser Engineering, 2024, 53(5): 20240063. [4] DU K, GUO X P, LI L T, et al. Traffic prediction in time series, spatial temporal, and OD data: A systematic survey[J]. Journal of Traffic and Transportation Engineering (English Edition), 2025, 12(3): 666-700. doi: 10.1016/j.jtte.2025.03.001 [5] XIE Z M, RAJAMANI R. Vehicle counting and maneuver classification with support vector machines using low-density flash lidar[J]. IEEE Transactions on Vehicular Technology, 2022, 71(1): 86-97. doi: 10.1109/TVT.2021.3125919 [6] MANDELLOS N A, KERAMITSOGLOU I, KIRANOUDIS C T. A background subtraction algorithm for detecting and tracking vehicles[J]. Expert Systems with Applications, 2011, 38(3): 1619-1631. doi: 10.1016/j.eswa.2010.07.083 [7] 周经美, 赵祥模, 程鑫, 等. 结合光流法的车辆运动估计优化方法[J]. 哈尔滨工业大学学报, 2016, 48(9): 65-69.ZHOU Jing-mei, ZHAO Xiang-mo, CHENG Xin, et al. Optical flow-based optimization method of vehicle motion estimation[J]. Journal of Harbin Institute of Technology, 2016, 48(9): 65-69. [8] GIRSHICK R, DONAHUE J, DARRELL T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation[C]//IEEE. 2014 IEEE Conference on Computer Vision and Pattern Recognition. New York: IEEE, 2014: 580-587. [9] REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: Unified, real-time object detection[C]//IEEE. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). New York: IEEE, 2016: 779-788. [10] GOMAA A, ABDELWAHAB M M, ABO-ZAHHAD M, et al. Robust vehicle detection and counting algorithm employing a convolution neural network and optical flow[J]. Sensors, 2019, 19(20): 4588. doi: 10.3390/s19204588 [11] XIAO W J, LIU J F. Application of vision sensing technology in urban intelligent traffic control system[C]//IEEE. 2018 4th International Conference on Computer and Technology Applications (ICCTA). New York: IEEE, 2018: 74-77. [12] FEDOROV A, NIKOLSKAIA K, IVANOV S, et al. Traffic flow estimation with data from a video surveillance camera[J]. Journal of Big Data, 2019, 6(1): 73. doi: 10.1186/s40537-019-0234-z [13] 孔方方, 宋蓓蓓. 改进YOLOv3的全景交通监控目标检测[J]. 计算机工程与应用, 2020, 56(8): 20-25.KONG Fang-fang, SONG Bei-bei. Improved YOLOv3 panoramic traffic monitoring target detection[J]. Computer Engineering and Applications, 2020, 56(8): 20-25. [14] 赖见辉, 王扬, 罗甜甜, 等. 基于YOLO_V3的侧视视频交通流量统计方法与验证[J]. 公路交通科技, 2021, 38(1): 135-142.LAI Jian-hui, WANG Yang, LUO Tian-tian, et al. A YOLO_V3-based road-side video traffic volume counting method and verification[J]. Journal of Highway and Transportation Research and Development, 2021, 38(1): 135-142. [15] 马永杰, 马芸婷, 程时升, 等. 基于改进YOLOv3模型与Deep-SORT算法的道路车辆检测方法[J]. 交通运输工程学报, 2021, 21(2): 222-231. doi: 10.19818/j.cnki.1671-1637.2021.02.019MA Yong-jie, MA Yun-ting, CHENG Shi-sheng, et al. Road vehicle detection method based on improved YOLOv3 model and Deep-SORT algorithm[J]. Journal of Traffic and Transportation Engineering, 2021, 21(2): 222-231. doi: 10.19818/j.cnki.1671-1637.2021.02.019 [16] 李永上, 马荣贵, 张美月. 改进YOLOv5s+DeepSORT的监控视频车流量统计[J]. 计算机工程与应用, 2022, 58(5): 271-279.LI Yong-shang, MA Rong-gui, ZHANG Mei-yue. Traffic monitoring video vehicle volume statistics method based on improved YOLOv5s+DeepSORT[J]. Computer Engineering and Applications, 2022, 58(5): 271-279. [17] 陈婷, 姚大春, 高涛, 等. 基于PReNet和YOLOv4融合的雨天交通目标检测网络[J]. 交通运输工程学报, 2022, 22(3): 225-237. doi: 10.19818/j.cnki.1671-1637.2022.03.018CHEN Ting, YAO Da-chun, GAO Tao, et al. A fused network based on PReNet and YOLOv4 for traffic object detection in rainy environment[J]. Journal of Traffic and Transportation Engineering, 2022, 22(3): 225-237. doi: 10.19818/j.cnki.1671-1637.2022.03.018 [18] 刘展威, 黄鹤飞, 许广路. 基于YOLOv8n+StrongSORT的车流量检测方法[J]. 计算机技术与发展, 2025, 35(9): 156-164.LIU Zhan-wei, HUANG He-fei, XU Guang-lu. Traffic flow detection method based on YOLOv8n+StrongSORT[J]. Computer Technology and Development, 2025, 35(9): 156-164. [19] LIU H L, MA Y J, JIANG H, et al. SPR-YOLO: A traffic flow detection algorithm for fuzzy scenarios[J]. Arabian Journal for Science and Engineering, 2025, 50(19): 15843-15856. doi: 10.1007/s13369-025-09997-9 [20] XU S Z, CUI K D. YOLO-EFM: Efficient traffic flow monitoring algorithm with enhanced multi-level information fusion[J]. Results in Engineering, 2025, 26: 105545. doi: 10.1016/j.rineng.2025.105545 [21] SHOKROLAH SHIRAZI M, MORRIS B T. Vision-based turning movement monitoring: count, speed & waiting time estimation[J]. IEEE Intelligent Transportation Systems Magazine, 2016, 8(1): 23-34. doi: 10.1109/MITS.2015.2477474 [22] 陈秀锋, 吴阅晨, 邴其春, 等. 基于类锚虚拟线圈的多流向车流量检测算法[J]. 交通运输系统工程与信息, 2021, 21(2): 51-57.CHEN Xiu-feng, WU Yue-chen, BING Qi-chun, et al. A multi-direction traffic flow statistics algorithm based on anchor-like visual loops[J]. Journal of Transportation Systems Engineering and Information Technology, 2021, 21(2): 51-57. [23] 颜洵. 高空场景下的交叉路口车流量统计算法研究[D]. 宜昌: 三峡大学, 2021: 3.YAN Xun. Research on traffic statistics algorithms at intersections in high-altitude scenes[D]. Yichang: China Three Gorges University, 2021: 3. [24] 张敬, 张林, 王长伟. 基于航拍视频的交叉口车流量统计方法研究[J]. 计算机仿真, 2020, 37(12): 117-121.ZHANG Jing, ZHANG Lin, WANG Chang-wei. Research on statistical method of traffic flow at intersection based on aerial video[J]. Computer Simulation, 2020, 37(12): 117-121. [25] 张韡, 李永, 刘涛, 等. 基于深度学习的转弯车流量检测方法[J]. 科学技术与工程, 2025, 25(4): 1701-1710.ZHANG Wei, LI Yong, LIU Tao, et al. Turning traffic flow detection method based on deep learning[J]. Science Technology and Engineering, 2025, 25(4): 1701-1710. [26] TAN M X, PANG R M, LE Q V. EfficientDet: scalable and efficient object detection[C]//IEEE. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). New York: IEEE, 2020: 10778-10787. [27] 罗瑞琪, 张兴宇, 刘岩. 交叉口行人过街溢出轨迹分析及优化方法研究[J]. 现代交通技术, 2020, 17(5): 52-56.LUO Rui-qi, ZHANG Xing-yu, LIU Yan. Study on pedestrian trajectory analysis and optimizing method for crossing overflow[J]. Modern Transportation Technology, 2020, 17(5): 52-56. [28] 张帅奇. 基于交叉口行人过街特性的行人轨迹预测及车辆路径规划研究[D]. 西安: 长安大学, 2024: 9.ZHANG Shuai-qi. Research on pedestrian trajectory prediction and vehicle path planning based on crosswalk pedestrian behavior[D]. Xi'an: Chang'an University, 2024: 9. [29] HOSSAIN M S, BETTS J M, PAPLINSKI A P. Dual focal loss to address class imbalance in semantic segmentation[J]. Neurocomputing, 2021, 462: 69-87. doi: 10.1016/j.neucom.2021.07.055 [30] LIN T Y, GOYAL P, GIRSHICK R, et al. Focal loss for dense object detection[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020, 42(2): 318-327. doi: 10.1109/TPAMI.2018.2858826 [31] ZHANG Y F, SUN P Z, JIANG Y, et al. ByteTrack: multi-object tracking by associating every detection box[C]//Springer. Computer Vision - ECCV 2022. Cham: Springer, 2022: 1-21. -
下载: