Research on a Real-Time Tunnel Vehicle Speed Detection System Based on YOLOv8 and DeepSORT Algorithms

Honglin Mu, Xinyuan Wang, Junshan Tian, Yanqun YangIntelligent 2025 · DOI

TL;DR

This paper presents a real-time vehicle speed detection system for tunnels, combining YOLOv8 for object detection and DeepSORT for tracking. The system achieves high accuracy in identifying vehicles and estimating their speeds, offering a robust solution for improving tunnel traffic safety and management.

What Problem Does This Paper Address?

Tunnels, while crucial for urban transport, present unique challenges for traffic monitoring. Their enclosed nature and monotonous environments can lead to speeding, a major cause of accidents. Traditional monitoring methods are often costly, difficult to maintain, and struggle with tunnel-specific issues like varying lighting and perspective distortion. This research aims to develop an efficient, accurate, and real-time system to monitor vehicle speeds and detect speeding within these complex environments.

Methods

The core of the system relies on a two-stage approach:

  • Object Detection (YOLOv8s): The YOLOv8s model is used to detect and classify vehicles into three categories: cars, trucks, and buses. It's chosen for its balance of speed and accuracy, making it suitable for real-time edge deployment.
  • Multi-Object Tracking (DeepSORT): DeepSORT is employed to track detected vehicles across frames. It uses Kalman filtering for motion prediction and the Hungarian algorithm for data association, enhanced by deep appearance features to maintain consistent vehicle identities and trajectories, even through occlusions.

For speed estimation, the system utilizes:

  • Perspective Geometric Transformation: This technique maps 2D image coordinates to real-world 3D coordinates, correcting for camera perspective and enabling accurate distance measurements. This involves selecting corresponding points in the original image and a transformed "bird's-eye view."
  • Sliding-Window Smoothing: To improve speed estimation stability and reduce the impact of noise from individual frames, a sliding window approach is used to average speeds over recent frames.
  • Speeding Detection: A fixed threshold of 100 km/h is used to identify speeding vehicles, triggering visual alerts (red bounding boxes and "SPEEDING!" text).

Datasets

The study used surveillance video data collected from an expressway tunnel. The dataset was preprocessed, and bounding box annotations were generated in YOLO format for model training. The final experimental dataset comprised 2564 images, with a training set of 2051 images and a validation set of 513 images. A separate test set was not used; instead, performance was assessed on the validation set through multiple training runs.

Key Insights and Ideas

  • Tunnel-Specific Challenges: The research highlights how tunnel environments (lighting, perspective) significantly complicate speed detection compared to open roads.
  • YOLOv8s + DeepSORT Synergy: The combination of a powerful object detector (YOLOv8s) with a robust tracker (DeepSORT) is crucial for reliable vehicle identification and trajectory maintenance in dynamic tunnel scenarios.
  • Perspective Transformation is Key: Accurately mapping image data to real-world coordinates via perspective transformation is fundamental for non-contact speed measurement.
  • Speed Profile in Tunnels: The study reveals a consistent "deceleration-acceleration-deceleration" inverted U-shaped speed profile across tunnel sections, with speeds peaking in the middle section.
  • Vehicle Type Differences: Cars consistently travel faster than trucks, with notable differences in speed distribution and variability across tunnel segments.

Key Results

  • Detection Accuracy: The YOLOv8s model achieved high classification accuracies: 98% for cars, 96% for trucks, and 91% for buses. The overall mean Average Precision ([email protected]) was 0.988.
  • Speed Estimation Accuracy: The system demonstrated good speed estimation accuracy with an average speed difference (ASD) of 2.54 km/h, a deviation degree (DDVS) of 3.12, speed stability (VST) of 1.22, and a speed difference ratio (SDR) of 2.9%.
  • Real-Time Performance: The system achieved an average processing time of 0.0338 seconds per frame, corresponding to approximately 29.6 FPS, indicating real-time capability.
  • Statistical Significance: Mann-Whitney U and Kruskal-Wallis tests confirmed highly significant differences in speeds between car and truck types and across different tunnel sections.

Limitations and Future Work

  • Calibration Sensitivity: The accuracy of speed estimation is sensitive to the precision of initial point calibration during perspective transformation. Calibration errors can introduce systematic biases.
  • Lighting Conditions: The system's performance can be affected by extreme lighting scenarios, such as strong reflections or deep shadows.
  • Fixed Speed Threshold: The current overspeed detection threshold is fixed and does not adapt to dynamic traffic flow or weather conditions.
  • Dataset Limitations: The dataset primarily comes from a single tunnel, limiting its coverage of diverse conditions (weather, multiple tunnel types).

Future work suggested includes:

  • Developing automatic calibration algorithms or multi-sensor fusion for improved accuracy.
  • Expanding the dataset to include data from various regions and weather conditions.
  • Implementing dynamic threshold adjustment strategies for overspeed detection.
  • Integrating vehicle-to-vehicle communication and vehicle-road coordination for a more intelligent system.

Summary updated

Abstract

Tunnels serve as a critical hub in urban transportation networks; their monotonous and enclosed environment is prone to inducing speeding behavior, necessitating an efficient vehicle speed monitoring system. Traditional methods suffer from high costs and slow response times, making them inadequate for the complex scenarios encountered in tunnel environments. This study proposes a real-time tunnel vehicle speed monitoring system based on YOLOv8s and DeepSORT. YOLOv8s is used to detect and classify cars, trucks, and buses, while DeepSORT applies Kalman filtering and the Hungarian algorithm to construct motion trajectories. Vehicle speed is estimated through perspective geometric transformation combined with a sliding-window approach, with a speeding threshold of 100 km/h and corresponding visual alerts. Using surveillance video from an expressway tunnel as the dataset, the system achieved detection accuracies of 98% for cars, 96% for trucks, and 91% for buses. Speed detection performance metrics included an average speed deviation (ASD) of 2.54 km/h, a deviation degree of vehicle speed (DDVS) of 3.12, vehicle speed stability (VST) of 1.22, and speed difference ratio (SDR) of 2.9%. Analysis revealed a longitudinal “deceleration–acceleration–deceleration” inverted U-shaped speed profile along the tunnel. Statistical tests confirmed these findings: the Mann–Whitney U test showed highly significant differences in vehicle speeds between cars and trucks across different tunnel sections, and the Kruskal–Wallis test further indicated significant speed variations across the entrance, middle, and exit segments for both vehicle types.
BibTeX
@inproceedings{mu2025research,
  author = {Honglin Mu and Xinyuan Wang and Junshan Tian and Yanqun Yang},
  title = {{Research on a Real-Time Tunnel Vehicle Speed Detection System Based on YOLOv8 and DeepSORT Algorithms}},
  booktitle = {Intelligent},
  year = {2025},
  doi = {10.3390/iic1030010},
}
Figure