吉林大学学报(工学版) ›› 2025, Vol. 55 ›› Issue (1): 185-197.doi: 10.13229/j.cnki.jdxbgxb.20230321

• 交通运输工程·土木工程 • 上一篇    

基于深度学习的车载图像车辆目标检测和测距

徐慧智(),蒋时森,王秀青,陈爽   

  1. 东北林业大学 土木与交通学院,哈尔滨 150040
  • 收稿日期:2023-04-07 出版日期:2025-01-01 发布日期:2025-03-28
  • 作者简介:徐慧智(1977-),男,副教授,博士.研究方向:交通环境感知理论与方法.E-mail: stedu@126.com
  • 基金资助:
    国家自然科学基金青年科学基金项目(71701041);黑龙江省自然科学基金项目(LH2019E007)

Vehicle target detection and ranging in vehicle image based on deep learning

Hui-zhi XU(),Shi-sen JIANG,Xiu-qing WANG,Shuang CHEN   

  1. School of Civil Engineering and Transportation,Northeast Forestry University,Harbin 150040,China
  • Received:2023-04-07 Online:2025-01-01 Published:2025-03-28

摘要:

为提高驾驶环境中的车辆目标检测精度与测距稳定性,提出了一种基于深度学习的车辆目标检测与测距方法。以YOLOX-S算法为车辆目标检测框架进行改进:在原算法的基础上引入卷积块注意力模块,增强网络特征表达能力,并将置信度损失函数更换为Focal Loss,降低简单样本训练权重,提高正样本关注度。根据车载相机成像原理和几何关系建立车辆测距模型,并输入测距特征点坐标和相机内参得到测距结果。采用自制Tlab数据集和BDD 100K数据集对改进的YOLOX-S算法进行训练与评价,搭建静态测距实验场景对车辆测距模型进行验证。实验结果表明:改进的YOLOX-S算法在实验数据集上检测速度为70.14帧/s,与原算法相比精确率、召回率、F1值、mAP分别提高了0.86%、1.32%、1.09%、1.54%;在纵向50 m、横向11.25 m的测量范围内,平均测距误差保持在3.20%以内。可见,本文方法在满足车辆检测实时性要求的同时,具有良好的车辆测距准确性与稳定性。

关键词: 交通运输规划与管理, 深度学习, 环境感知, 车载图像, 目标检测, 单目测距

Abstract:

In order to improve the vehicle target detection accuracy and ranging stability in the driving environment, a deep learning-based vehicle target detection and ranging method is proposed. The YOLOX-S algorithm is used as the vehicle target detection framework for improvement: on the basis of the original algorithm, the CBAM attention module is introduced to enhance the network feature expression ability, and the confidence loss function is replaced with Focal Loss, which reduces the training weight of simple samples and improves the positive sample attention. The vehicle ranging model is established according to the imaging principle and geometric relationship of the vehicle camera, and the ranging results are obtained by inputting the coordinates of the ranging feature points and the internal reference of the camera. The improved YOLOX-S algorithm is trained and evaluated using the home-made Tlab dataset and BDD 100K dataset, and the static ranging experimental scenario is constructed to validate the vehicle ranging model. The experimental results show that the improved YOLOX-S algorithm has a detection speed of 70.14 frames/s on the experimental dataset, and the precision, recall, F1 value, and mAP are improved by 0.86%, 1.32%, 1.09%, and 1.54% respectively compared with the original algorithm; the average ranging error stays within 3.20% in the longitudinal 50m and lateral 11.25 m measurement range. It can be seen that the method in this paper has good vehicle ranging accuracy and stability while meeting the real-time requirements of vehicle detection.

Key words: transportation planning and management, deep learning, environment awareness, in-vehicle imagery, target detection, monocular ranging

中图分类号: 

  • U495

图1

车载图像车辆目标检测流程"

图2

YOLOX-S网络结构"

图3

Focus结构"

图4

CBAM结构"

图5

CAM结构"

图6

SAM结构"

图7

车辆测距流程"

图8

相机成像原理"

图9

车辆测距模型"

图10

部分数据集样例"

图11

训练损失值和mAP曲线"

表1

消融实验结果"

模 型Precision/%Recall/%F1/%mAP/%FPS/(帧·s-1
YOLOX-S86.7790.7988.7593.1775.49
YOLOX-S+CBAM87.45(+0.68)91.13(+0.34)89.26(+0.51)93.62(+0.45)70.36(-5.13)
YOLOX-S+Focal Loss87.08(+0.31)91.27(+0.48)89.11(+0.36)93.89(+0.72)75.32(-0.17)
YOLOX-S+CBAM+Focal Loss87.63(+0.86)92.11(+1.32)89.84(+1.09)94.71(+1.54)70.14(-5.35)

表2

对比实验结果"

模 型Precision/%Recall/%F1/%mAP/%FPS/(帧·s-1模型大小/MB
Fater R-CNN61.1395.3074.4992.1626.54108.29
SSD84.4584.7284.6289.0158.8792.13
YOLOv485.6863.8773.1576.5440.58244.45
YOLOv5s83.5977.3680.3777.1476.2227.17
YOLOX-S86.7790.7988.7593.1775.4934.39
改进的YOLOX-S87.6392.1189.8494.7169.1436.08

图12

部分标定图片样例"

表3

相机内部参数"

fx /像素fy /像素u0/像素v0/像素
1 422.861 422.73963.46544.27

图13

车辆测距实验场景"

表4

测距特征点及预测距离对比"

实验场景检测算法uminvminumaxvmaxuv预测纵向距离/m预测横向距离/m预测实际距离/m
图13(a)1 2764701 6416981 458.5069810.453.6511.07
1 2804721 644696.501 462696.5010.563.7211.19
图13(b)1 1844731 421634.501 302.50634.5015.243.6415.67
1 1804711 422638130163914.743.5115.15
图13(c)1 5324751 855643.501 693.50643.5014.327.3716.11
1 5294751 8516461 69064614.097.2215.83
图13(d)1 1544811 328602.501241602.5019.793.8720.16
1 1564781 3336021 244.5060319.683.8920.06
图13(e)1 3634791 5706001 466.5060020.267.1821.49
1 3594821 569602.501 46459920.417.1921.64
图13(f)1 6404801 842603.501 741603.5019.6110.7522.36
1 6404831 8446061 74260619.1310.5221.83

表5

车辆测距对比实验结果"

纵向

距离/m

横向

距离/m

实际

距离/m

预测距离/m预测误差/%
纵向距离/m横向距离/m实际距离/m纵向误差/%横向误差/%实际误差/%
Ⅰ ⅡⅠ ⅡⅠ ⅡⅠ ⅡⅠ ⅡⅠ Ⅱ
5-55.22 5.26-5.22 5.264.40 5.20-4.40 5.20
10-1010.39 10.45-10.39 10.453.90 4.50-3.90 4.50
3.7510.6810.45 10.563.65 3.7211.07 11.204.50 5.602.67 0.803.64 4.83
15-1515.57 15.63-15.57 15.633.80 4.20-3.80 4.20
3.7515.4615.24 14.743.64 3.5115.67 15.151.60 1.732.93 6.401.35 1.99
7.516.7714.32 14.097.37 7.2216.11 15.834.53 6.071.73 3.733.94 5.59
20-2019.43 20.47-19.43 20.472.85 2.35-2.85 2.35
3.7520.3519.79 19.683.87 3.8920.16 20.061.05 1.603.20 3.730.91 1.43
7.521.3620.26 20.417.18 7.1921.49 21.641.30 2.054.27 4.130.63 1.31
11.2522.9519.61 19.1310.75 10.5222.36 21.831.95 4.354.44 6.492.56 4.88
25-2524.31 24.02-24.31 24.022.76 3.92-2.76 3.92
3.7525.2826.11 26.433.57 3.6126.35 26.684.44 5.724.80 3.734.24 5.54
7.526.124.04 24.137.13 7.0225.08 25.133.84 3.484.93 6.403.93 3.71
11.2527.4123.78 26.3511.82 11.9526.56 28.934.88 5.405.07 6.223.12 5.56
30-3029.14 28.59-29.14 28.592.87 4.70-2.87 4.70
3.7530.2328.82 31.353.91 3.8729.08 31.593.93 4.504.27 3.203.79 4.49
7.530.9228.58 29.057.60 7.9129.57 30.114.73 3.171.33 5.474.36 2.63
11.2532.0430.91 31.1110.66 10.9532.70 32.983.03 3.705.24 2.672.05 2.94
35-3533.57 33.24-33.57 33.244.09 5.03-4.09 5.03
3.7535.234.29 34.433.94 3.6034.52 34.622.03 1.635.07 4.001.94 1.65
7.535.7936.13 36.637.89 7.9336.98 37.483.23 4.665.20 5.733.33 4.72
11.2536.7635.95 36.2911.56 11.4437.76 38.052.71 3.692.76 1.692.73 3.51
40-4038.52 38.76-38.52 38.763.70 3.10-3.70 3.10
3.7540.1841.69 41.943.57 3.4641.74 42.084.22 4.854.80 7.733.88 4.73
7.540.738.25 38.057.75 7.9239.03 38.874.38 4.883.33 5.604.11 4.51
11.2541.5539.26 40.9211.78 11.8540.99 42.601.85 2.304.71 5.331.35 2.53
45-4544.66 46.61-44.66 46.610.76 3.58-0.76 3.58
3.7545.1646.17 46.943.81 3.8246.33 47.102.60 4.311.60 1.872.58 4.29
7.545.6243.39 43.057.88 7.9744.10 43.783.58 4.335.07 6.273.33 4.03
11.2546.3846.50 43.2411.57 11.6047.92 44.773.33 3.912.84 3.113.32 3.47
50-5047.87 47.28-47.87 47.284.26 5.44-4.26 5.44
3.7550.1448.35 48.543.91 3.9848.51 48.703.30 2.924.27 6.133.26 2.87
7.550.5649.85 52.567.62 7.7050.43 53.120.30 5.121.60 2.670.26 5.07
11.2551.2551.18 52.9011.28 11.1952.41 54.072.36 5.800.27 0.532.26 5.50
1 刘旖菲, 胡学敏, 陈国文, 等. 视觉感知的端到端自动驾驶运动规划综述[J]. 中国图象图形学报, 2021, 26(1): 49-66.
Liu Yi-fei, Hu Xue-min, Chen Guo-wen, et al. A review of end-to-end autonomous driving motion planning with visual perception[J]. Chinese Journal of Graphical Graphics, 2021, 26(1): 49-66.
2 原晓佩, 陈小锋, 廉明. 基于Haar-like和LBP的多特征融合目标检测算法[J]. 计算机科学, 2021, 48(11): 219-225.
Yuan Xiao-pei, Chen Xiao-feng, Lian Ming. A multi-feature fusion target detection algorithm based on Haar-like and LBP[J]. Computer Science, 2021, 48(11): 219-225.
3 Lienhart R, Maydt J. An extended set of Haar-like features for rapid object detection[C]∥The IEEE International Conference on Image Processing, New York, USA, 2002: 900-903.
4 辛元雪, 史朋飞, 薛瑞阳. 基于区域提取与改进LBP特征的运动目标检测[J]. 计算机科学, 2021, 48(7): 233-237.
Xin Yuan-xue, Shi Peng-fei, Xue Rui-yang. Motion target detection based on region extraction with improved LBP features[J]. Computer Science, 2021, 48(7): 233-237.
5 Duan J, Ye H, Zhao H, et al. Deep cascade AdaBoost with unsupervised clustering in autonomous vehicles[J]. Electronics, 2022, 12(1):No.12010044.
6 Yang J, Jun Z. Improved HOG feature vehicle recognition algorithm based on sliding window[J]. Journal of Physics: Conference Series, 2020, 1627(1):No. 012013.
7 耿庆田, 于繁华, 王宇婷, 等. 基于特征融合的车型检测新算法[J]. 吉林大学学报:工学版, 2018, 48(3): 929-935.
Geng Qing-tian, Yu Fan-hua, Wang Yu-ting, et al. A new algorithm for model detection based on feature fusion[J]. Journal of Jilin University(Engineering Edition), 2018, 48(3): 929-935.
8 高明华, 杨璨. 基于改进卷积神经网络的交通目标检测方法[J]. 吉林大学学报:工学版, 2022, 52(6): 1353-1361.
Gao Ming-hua, Yang Can. An improved convolutional neural network based traffic target detection method[J]. Journal of Jilin University(Engineering Edition), 2022, 52(6): 1353-1361.
9 Redmon J, Farhadi A. YOLOv3: an incremental improvement[DB/OL].[2023-03-22]..
10 Yue Z, Wei Z, Nan L. A novel detection method using YOLOv5 for vehicle target under complex situation[J]. Traitement du Signal, 2022, 39(4): 1153-1158.
11 Guan X, Meng Y, Meng W, et al. Research on highway vehicle detection based on faster R-CNN and domain adaptation[J]. Applied Intelligence, 2022, 52(4): 3483-3498.
12 Ren S, He K, Girshick R, et al. Faster r-cnn: towards realtime object detection with region proposal networks[J]. Advances in Neural Information Processing Systems, 2015, 28: 91-99.
13 Mescheder L, Oechsle M, Niemeyer M, et al. Occupancy networks: learning 3D reconstruction in function space[C]∥Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, USA, 2019: 4460-4470.
14 黄孝慈, 舒方林, 曹文冠. 基于双目视觉的前方车辆测距方法研究[J]. 汽车技术, 2021(12): 16-21.
Huang Xiao-ci, Shu Fang-lin, Cao Wen-guan. Research on forward vehicle ranging method based on binocular vision[J]. Automotive Technology, 2021(12): 16-21.
15 Hou A L, Chen J, Jin Z J, et al. Binocular vision measurement of distance based on vehicle logo location[J]. Applied Mechanics and Materials, 2012, 229(1): 1154-1157.
16 Ho H W, Croon G D, Chu Q P. Distance and velocity estimation using optical flow from a monocular camera[J]. International Journal of Micro Air Vehicles, 2017, 9(3): 198-208.
17 高维岳, 陈宇拓, 刘洋, 等. 基于单目视觉的车辆前方障碍物测距方法[J]. 计算机工程与设计, 2022, 43(4): 1016-1022.
Gao Wei-yue, Chen Yu-tuo, Liu Yang, et al. A monocular vision-based approach to vehicle forward obstacle ranging[J]. Computer Engineering and Design, 2022, 43(4): 1016-1022.
18 Ge Z, Liu S, Wang F, et al. YOLOX: exceeding YOLO Series in 2021[DB/OL].[2023-01-10]. .
19 He K M, Zhang X Y, Ren S Q, et al. Spatial pyramid pooling in deep convolutional networks for visual recognition[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2015, 37(9): 1904-1916.
20 Woo S, Park J, Lee J Y, et al. CBAM: convolutional block attention module[C]∥Proceedings of the European Conference on Computer Vision. Munich: Springer, 2018: 3-19.
21 Lin T, Goyal P, Girshick R, et al. Focal loss for dense object detection[C]∥IEEE International Conference on Computer Vision, Venice, Italy, 2017: 2980-2988.
22 刘佳涛, 张亚萍, 杨雨薇. 基于迁移学习的高效单目图像深度估计[J]. 激光与光电子学进展, 2022, 59(16): 236-244.
Liu Jia-tao, Zhang Ya-ping, Yang Yu-wei. Efficient monocular image depth estimation based on migration learning[J]. Advances in Lasers and Optoelectronics, 2022, 59(16): 236-244.
23 彭妍, 郭君斌, 于传强, 等. 基于平面变换的高精度相机标定方法[J]. 北京航空航天大学学报, 2022, 48(7): 1297-1303.
Peng Yan, Guo Jun-bin, Yu Chuan-qiang, et al. A high-precision camera calibration method based on planar transformation[J]. Journal of Beijing University of Aeronautics and Astronautics, 2022, 48(7): 1297-1303.
[1] 顾明臣,熊慧媛,刘增军,罗清玉,刘宏. 融合多头注意力机制的货车载重估计模型[J]. 吉林大学学报(工学版), 2024, 54(10): 2771-2780.
[2] 何永明,权聪,魏堃,冯佳,万亚楠,陈世升. 超高速公路车路协同路侧单元感知融合方法[J]. 吉林大学学报(工学版), 2024, 54(7): 1923-1934.
[3] 胡钊政,孙勋培,张佳楠,黄戈,柳雨婷. 基于时空图模型的车-路-图协同定位方法[J]. 吉林大学学报(工学版), 2024, 54(5): 1246-1257.
[4] 黄玲,崔躜,游峰,洪佩鑫,钟浩川,曾译萱. 适用于多车交互场景的车辆轨迹预测模型[J]. 吉林大学学报(工学版), 2024, 54(5): 1188-1195.
[5] 惠冰,刘伟,周宇坤,李淑琪. 强侧风作用下桥隧连接段行车仿真与安全性分析[J]. 吉林大学学报(工学版), 2023, 53(8): 2312-2320.
[6] 田彦涛,黄兴,卢辉遒,王凯歌,许富强. 基于注意力与深度交互的周车多模态行为轨迹预测[J]. 吉林大学学报(工学版), 2023, 53(5): 1474-1480.
[7] 刘嫣然,孟庆瑜,郭洪艳,李嘉霖. 图注意力模式下融合高精地图的周车轨迹预测[J]. 吉林大学学报(工学版), 2023, 53(3): 792-801.
[8] 田彦涛,季言实,唱寰,谢波. 深度强化学习智能驾驶汽车增广决策模型[J]. 吉林大学学报(工学版), 2023, 53(3): 682-692.
[9] 田彦涛,许富强,王凯歌,郝子绪. 考虑周车信息的自车期望轨迹预测[J]. 吉林大学学报(工学版), 2023, 53(3): 674-681.
[10] 裴莉莉,孙朝云,韩雨希,李伟,户媛姣. 基于SSC与XGBoost的高速公路异常收费数据修复算法[J]. 吉林大学学报(工学版), 2022, 52(10): 2325-2332.
[11] 李志慧,钟涛,赵永华,胡永利,李海涛,赵景伟. 面向车辆自主驾驶的行人跟踪算法[J]. 吉林大学学报(工学版), 2019, 49(3): 680-687.
[12] 吴骅跃,段里仁. 基于RGB熵和改进区域生长的非结构化道路识别方法[J]. 吉林大学学报(工学版), 2019, 49(3): 727-735.
[13] 李志慧, 胡永利, 赵永华, 马佳磊, 李海涛, 钟涛, 杨少辉. 基于车载的运动行人区域估计方法[J]. 吉林大学学报(工学版), 2018, 48(3): 694-703.
[14] 李志慧, 夏英集, 曲昭伟, 任景琛. 视频监控的数据驱动背景模型[J]. 吉林大学学报(工学版), 2017, 47(4): 1286-1294.
[15] 李琳辉, 伦智梅, 连静, 袁鲁山, 周雅夫, 麻笑艺. 基于卷积神经网络的道路车辆检测方法[J]. 吉林大学学报(工学版), 2017, 47(2): 384-391.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!