3.1 Traffic Conflict Characteristics Recognition System in diversion and merging Zones
The data collection site, shown in Fig. 2, is located in Rabat City, Morocco. The Simulation of Urban MObility (SUMO) simulator was employed to extract extensive traffic data for Rabat, focusing on a variety of vehicle types over specified periods. This simulation environment provided a rich dataset that captures essential details about urban mobility, offering a detailed view of traffic dynamics within the city. The dataset included several key columns, such as dateandtime, which records the precise timestamp of each observation, vehid for vehicle identification, coord and gpscoord for spatial positioning, spd for vehicle speed, edge and lane for road network and lane-specific data, displacement indicating the distance traveled by each vehicle, and turnAngle, which reflects the vehicle's change in direction. Additionally, the nextTLS column documented the state of the next traffic light encountered by the vehicle, providing critical context for analyzing traffic flow.
From this detailed dataset, relevant features were systematically extracted to support the development of predictive models focused on traffic behavior. The extraction process included deriving temporal features from the dateandtime field, such as the hour of the day and the day of the week, which are crucial for identifying patterns in traffic congestion and flow over time. Vehicle speed, captured in the spd field, was another vital feature, offering insights into the movement dynamics of different vehicles throughout the urban landscape. Lane-specific data were extracted from the lane field, enabling an analysis of traffic behavior within individual lanes, which is essential for understanding lane utilization and congestion. The displacement field provided a measure of the distance each vehicle traveled, offering a direct indicator of mobility efficiency and potential bottlenecks within the city.
Moreover, the state of traffic lights, captured in the nextTLS field, was analyzed to understand its impact on vehicle movement and overall traffic flow. Beyond these basic features, additional data engineering techniques were applied to create new features that could further enhance the model's predictive accuracy. By leveraging both the original and engineered features, the model developed a more comprehensive understanding of traffic patterns in Rabat, ultimately contributing to more effective urban traffic management and planning. This systematic approach to data extraction and feature engineering from SUMO's rich dataset ensures a robust foundation for predictive modeling, aiding in the development of intelligent traffic management solutions tailored to the unique dynamics of Rabat's urban environment.
Table 1
Type of vehicle | Number of instances | Mean instance per frame |
Bus | 1234 | 1.26 |
Truck | 2415 | 2.46 |
Car | 53083 | 4.06 |
Trolleybus | 611 | 0.62 |
TRAM | 1298 | 1.28 |
Moto | 2783 | 2.83 |
3.2 Traffic data preprocessing method based on yolov8-deepsort
This study focuses on improving the prediction of traffic conflicts in complex areas like diversion and merging zones, where accurate analysis is often challenging. These zones are prone to accidents due to the high level of vehicle interaction, making precise traffic detection crucial. To address this, the research combines the SUMO simulator with advanced video analysis techniques, specifically YOLOv8 for vehicle recognition and DeepSORT for tracking.
The process begins with data collection in Table, anf Fig. 4 where roadside video footage is gathered to create a comprehensive dataset. This data includes images of various vehicle types under different traffic conditions, which are essential for training and testing the detection models.
Next, the YOLOv8 model is trained to accurately recognize different vehicles within the video footage. This model is refined through multiple training iterations to ensure high precision in identifying cars, buses, trucks, and other vehicles. The trained model is then evaluated based on its precision, recall, and overall accuracy.
Finally, DeepSORT is used to track the recognized vehicles across video frames. This algorithm predicts vehicle movements and updates tracking in real-time, ensuring that each vehicle's path is accurately monitored.
By integrating these techniques, the study enhances the detection of traffic conflicts at a micro-level, providing valuable insights into how vehicles interact in merging and diversion zones. This improved accuracy in traffic situation detection supports better traffic management and helps reduce the risk of accidents in these critical areas.
Figure 4 presents an integrated framework that combines advanced traffic simulation and machine learning techniques to enhance vehicle detection, tracking, and prediction. By utilizing SUMO (Simulation of Urban MObility) for generating synthetic traffic data, the framework employs YOLOv8 for accurate object detection and DeepSORT for robust tracking across frames. To address class imbalance in the dataset, SMOTE (Synthetic Minority Over-sampling Technique) is applied, ensuring balanced data for effective model training. The CatBoost algorithm is then used for classification and prediction, leveraging its ability to handle categorical data and optimize model performance. The framework is evaluated using a comprehensive set of metrics, including precision, recall, F1-score, and AUC-ROC, demonstrating its effectiveness in real-time traffic analysis and predictive modeling.
Figure 6. Illustrate the optimized traffic that the traffic simulation data from SUMO with YOLOv8-DeepSORT for precise vehicle tracking, CatBoost for conflict detection, and SMOTE for addressing sample imbalance. By optimizing performance with Bayesian methods and interpreting results with SHAP, the algorithm offers a comprehensive solution to enhance urban traffic safety, particularly in complex zones where traditional methods are less effective. This approach ensures accurate detection and management of traffic conflicts, leading to safer and more efficient urban traffic systems.
This paper primarily aims to enhance the accuracy of traffic situation detection from video images by leveraging roadside video data and applying computer vision and deep learning technologies. It constructs a traffic situation detection system to analyze traffic conflicts in diversion and merging zones at a micro-level, providing data support for detailed traffic conflict analysis. The study follows these specific steps:
S1. Data Collection: Collecting data is crucial for video vehicle recognition, traffic condition detection, traffic flow analysis, and vehicle speed measurement. To build the training dataset, vehicle images of various models are gathered. Additionally, roadside video data covering different congestion scenarios are collected to validate the algorithm’s accuracy.
S2. Vehicle Recognition: The YOLOv8 model is employed to train the vehicle image dataset, and the training weights are used for model validation. The YOLOv8s pre-trained network is adapted through transfer learning with 70 epochs of iterative training. The model's performance is evaluated using recall and precision metrics. Precision measures the ratio of correctly predicted samples to the total number of samples, while recall reflects the model’s ability to correctly identify positive examples. The mean Average Precision (mAP) is used to gauge overall accuracy across different vehicle categories. For instance, the accuracy for cars is 0.90, for buses is 0.98,, for Moto is 0.97, for TRAM is 0.98, and for trucks is 0.96, with an overall mAP of 0.95. The training and testing results, shown in Figs. 7 and 8, indicate model convergence. The final vehicle recognition model achieves 90.9% precision, 95.8% recall, and 91.7% average precision ([email protected]), meeting the requirements for late detection.
S3. Vehicle Target Tracking: The DeepSORT algorithm processes each video frame to generate detection frames, seal target attributes, and perform Kalman filtering. This method updates the tracking predictions and successfully tracks targets, as illustrated in Fig. 3.