Tunnel traffic safety real-time evaluation method based on traffic state and deep learning
Through a deep learning model based on traffic state, the tunnel macro traffic characteristics are collected in real time, combined with multi-head attention mechanism and residual connection, the second-level real-time evaluation of tunnel traffic safety and online model updates are realized, solving the problems of long data collection period and frequent model updates in the existing technology, and improving the prediction accuracy.
Patent Information
- Application Number
- CN202510417155.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-04-03
AI Technical Summary
In the real-time traffic safety assessment in the prior art, there are problems in the data collection period in the tunnel, relying on low-frequency collision events, and the difficulty in real-time acquisition of micro-trajectory data and model update frequency and prediction accuracy.
Using a method based on traffic state and deep learning, the macroscopic traffic characteristics in the tunnel are collected in real time, and a pre-trained deep learning model that integrates multi-lane interaction characteristics is used to predict safety level, combining multi-head attention mechanisms and residual connections to realize online updates of the model and real-time evaluation of safety level.
Real-time evaluation of traffic safety in the tunnel is realized, which reduces data acquisition delay, improves prediction accuracy, and supports online update of model parameters, solving the problems of data imbalance and frequent updates of models in the existing technology.
Smart Images

Figure CN120298984A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of tunnel traffic safety. Specifically, it relates to a real-time evaluation method for tunnel traffic safety based on traffic conditions and deep learning. Background Art
[0002] Tunnels are an important part of the road network, reducing travel time and providing convenience. However, driving in dark and narrow tunnels can cause anxiety and uncertainty, requiring extra attention and mental load. The probability of traffic accidents in tunnels is lower than that on open highways, but once an accident occurs, the situation is much more serious. Therefore, it is very meaningful to conduct real-time traffic safety evaluations in narrow, dark tunnels where GPS signals may not be stable.
[0003] The existing technologies mainly have the following deficiencies:
[0004] (1) The technical data collection cycle relying on motor vehicle collision data is too long:
[0005] Some studies have investigated the relationship between motor vehicle collision accidents and macroscopic traffic characteristics (i.e., traffic condition data). Although evaluating traffic safety based on collision data (the frequency and severity of motor vehicle collisions) is the most direct and indisputable way, there are significant limitations in collecting collision data, including underreporting and low quality. The biggest limitation is that motor vehicle collisions are extremely rare events, usually requiring a long time of collection for meaningful analysis. Many studies have used unbalanced datasets, that is, the samples of collision data are far fewer than those of non-collision data samples. Some existing studies have tried to use bias correction based on the Firth method, deep generative models, and focal loss to alleviate the data imbalance problem. These methods allow the classification boundary to be shifted towards the minority class to train the classification model, so that an ideal model can be trained with a small proportion of collision data. It does reduce the time for collecting data to a certain extent, but it still takes a long time to collect sufficient collision data in tunnels for meaningful analysis.
[0006] (2) Technologies based on traffic conflicts are difficult to evaluate the traffic safety level in real time:
[0007] As a "near - collision event" that occurs more frequently than actual collisions, multiple studies have shown that traffic conflicts can serve as precursor indicators of accidents, identifying hazards before accidents occur and enabling more timely traffic safety assessments. Most studies on traffic conflicts use the surrogate safety measure TTC (time - to - collision) index to evaluate traffic safety levels. However, the TTC index is a microscopic measure and must be calculated using specific micro - trajectory data, which is difficult to collect in real - time in tunnels. Some studies use traffic simulation software to simulate the results of traffic conflicts and micro - trajectory data, which is considered an unreliable way to obtain real - world motor vehicle collision predictions. Other studies combine vehicle trajectory data collected by multiple detectors (such as GPS, radar, in - vehicle built - in sensors, etc.) to reduce the risk of collisions for connected vehicles, which is difficult to achieve in tunnels with limited space and unstable signals. Recently, some studies have extracted micro - trajectory data from traffic videos using drones (UAVs), and the extraction process is time - consuming and requires specialized software to complete offline. Therefore, in tunnels, it is unrealistic to directly collect micro - trajectory data and calculate the TTC index to evaluate the safety level in real - time.
[0008] (3) Limitations of the current model in terms of accurate prediction and frequent update:
[0009] Most existing technologies use typical machine - learning classification methods to predict traffic collisions or conflicts. In traditional machine - learning methods, the Gradient Boosting Decision Tree (GBDT) method often achieves the best results, but its tree is non - differentiable. Therefore, overly frequent retraining from scratch makes the learning efficiency of GBDT in online prediction scenarios low. In deep - learning methods, only the Multi - Layer Perceptron (MLP) and Convolutional Neural Network (CNN) are used to predict traffic conflicts. Due to their use of the mini - batch training mode, they are easy to update for online prediction but cannot obtain satisfactory prediction results. This increases the need for a dedicated real - time prediction model that can not only effectively evaluate traffic safety levels based on traffic conflicts but is also easy to update frequently over time. Summary of the Invention
[0010] The present invention aims to provide a real - time evaluation method for tunnel traffic safety based on traffic status and deep learning, which can solve the above problems.
[0011] To solve the above problems, the technical solutions adopted by the present invention are as follows:
[0012] The present invention provides a real - time evaluation method for tunnel traffic safety based on traffic status and deep learning, including:
[0013] Collect the macroscopic traffic characteristics of each monitoring area in the tunnel in real time. The macroscopic traffic characteristics include numerical attribute characteristics, lane ID, and camera ID. The numerical attribute characteristics include average vehicle speed, vehicle speed standard deviation, traffic density, proportion of small vehicles, proportion of medium and large vehicles, and proportion of hazardous chemical vehicles.
[0014] Input the macroscopic traffic characteristics collected in real time into a pre-trained deep learning model that fuses multi-lane interaction features. This model includes a feature encoding layer, a single-lane information extraction module, and a safety level prediction module. The feature encoding layer is used to map the numerical attribute characteristics into high-dimensional vectors, and fuse the encodings of time ID, lane ID, and camera ID to generate a multi-segment joint feature matrix. The single-lane information extraction module is used to extract the interaction features between the upstream and downstream segments of its corresponding lane based on the multi-segment joint feature matrix, using the multi-head attention mechanism and residual connection, and finally obtain an enhanced segment representation carrying the spatio-temporal interaction features within the lane. The safety level prediction module is used to fuse all the enhanced segment representations carrying the spatio-temporal interaction features within the lane and output the safety level prediction results for each monitoring area.
[0015] During the training stage, the deep learning model that fuses multi-lane interaction features uses historical macroscopic traffic characteristics and TTC safety level labels calculated based on microscopic trajectories for supervised learning.
[0016] Further, the implementation of the feature encoding layer specifically includes: performing categorical encoding on the time bin ID and lane ID using a trainable embedding matrix; performing sine and cosine position encoding on the camera ID; performing embedding encoding after binning and discretizing the numerical attribute characteristics; adding the encoding vectors to obtain segment-level features, and concatenating them to obtain a multi-segment joint feature matrix.
[0017] Further, the processing flow of the single-lane information extraction module specifically includes: inputting the upstream and downstream segment encodings of the same lane into parallel segment modules. The segment modules extract the characteristics of the numerical attribute features themselves and the interaction information between different segments of the same lane based on the feed-forward neural network FFN1, the multi-head attention mechanism, and residual connection; fusing the outputs of each segment module through the feed-forward neural network FFN2, and retaining the original feature information through residual connection, and finally outputting an enhanced segment representation carrying the spatio-temporal interaction features within the lane.
[0018] Further, the safety level prediction module first makes independent predictions for each lane based on the enhanced segment representation carrying the spatio-temporal interaction features within the lane to obtain independent prediction results S single , then makes an overall prediction to obtain an overall prediction result S overall , and finally fuses the independent prediction results S single and the overall prediction result S overall, and the safety level prediction result is obtained through the softmax layer.
[0019] Furthermore, the deep learning model that fuses multi-lane interaction features continuously updates the model parameters based on the data stream during the use process.
[0020] Furthermore, the TTC safety level division adopts multi-threshold dynamic determination, including: setting three-level thresholds of 1 second, 2.5 seconds, and 4 seconds according to the minimum TTC value of the vehicles in the monitoring area to divide four safety levels.
[0021] Furthermore, the loss function used by the deep learning model that fuses multi-lane interaction features during training is the cross-entropy loss function, and the Adam optimizer is used to optimize the model parameters, and weight decay is used to prevent overfitting.
[0022] Compared with the prior art, the beneficial effects of the present invention are:
[0023] (1) By performing supervised learning on the macroscopic traffic features and the TTC-based safety labels, an evaluation paradigm driven by non-collision data is constructed. Using the macroscopic parameters such as the average speed and density of vehicles that can be obtained in real time by the conventional tunnel monitoring equipment to replace the microscopic trajectory data and actual collision records that are necessary but difficult to obtain in the traditional method, the model training is freed from the dependence on low-frequency collision events, and the problems of the long data collection period and the model failure caused by serious data imbalance in the prior art are solved.
[0024] (2) An innovative mapping mechanism between macroscopic features and TTC safety levels is established. Through the deep learning model, topological features such as camera ID and lane ID are spatially and temporally correlated with dynamic parameters such as speed standard deviation to indirectly represent the TTC index that originally relied on microscopic trajectories. Compared with the method of obtaining TTC by using dedicated sensors or offline video processing in the prior art, while maintaining the safety assessment accuracy, the data acquisition delay of the present invention is reduced from the minute level to the second level, meeting the real-time early warning requirements of the tunnel scenario.
[0025] (3) The lane-level feature extraction module is constructed by adopting the multi-head attention mechanism and residual connection, and the parallel calculation of multi-lane interaction features is realized through the parallel processing structure. Compared with the GBDT model and CNN model in the prior art, while maintaining a prediction accuracy of more than 85%, it supports the online update of model parameters under incremental learning, and solves the contradiction that the model update frequency and prediction accuracy cannot be both achieved in the prior art.
[0026] To make the above objects, features, and advantages of the present invention more obvious and understandable, the embodiments of the present invention are specifically described below in conjunction with the accompanying drawings as follows. Description of the Drawings
[0027] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0028] Figure 1 is a schematic diagram of TTC calculation;
[0029] Figure 2 is a schematic diagram of the method for real-time division of tunnel safety levels based on TTC proposed by the present invention;
[0030] Figure 3 is a schematic diagram of the deep learning model architecture integrating multi-lane interaction features designed by the present invention;
[0031] Figure 4 is a schematic diagram of the road section module designed by the present invention. Specific Embodiments
[0032] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention.
[0033] Please refer to Figure 1 , the present invention provides a method for real-time assessment of tunnel traffic safety based on macroscopic traffic characteristics and deep learning, which includes two parts: a method for real-time division of tunnel safety levels based on TTC and a deep learning model architecture integrating multi-lane interaction features.
[0034] Among them, the method for real-time division of tunnel safety levels based on TTC has different functions during the training and prediction of the deep learning model integrating multi-lane interaction features:
[0035] During training, it is used to extract tunnel macroscopic traffic data and microscopic trajectory data, calculate TTC using the microscopic trajectory data, use TTC as a basis to divide the safety levels of each monitoring area in the tunnel, and the model is trained with macroscopic traffic data as input and safety levels as labels;
[0036] During prediction, it is used to extract real-time track macroscopic traffic data, and after feeding it into the model, the prediction of the safety level of each monitoring area in the tunnel by the model can be obtained, which is convenient for real-time early warning.
[0037] The following takes a two-lane one-way tunnel as an example to illustrate the method of the present invention:
[0038] First, the definitions of the time-to-collision (TTC) index, the camera monitoring area, the safety level, the macroscopic traffic characteristics, and the MF-TSE problem are described as follows:
[0039] (1) Time-to-collision (TTC) index: It is defined as the time required for the target vehicle to maintain its current motion state until a collision occurs with the vehicle in front. For example, Figure 1 , assuming the motion states of the target vehicle and the vehicle in front are (s n , v n ) and (s n+1 , v n+1 ), respectively, the TTC n calculation formula for vehicle n is:
[0040]
[0041] where s n represents the distance of vehicle n from the tunnel entrance, v n is the current speed, l n is the vehicle length (5 meters for small cars and 12 meters for non-small cars), and TTC n represents the time-to-collision of vehicle n.
[0042] (2) Camera monitoring area: Abbreviated as the monitoring area, a monitoring area consists of two road sections and is the basic unit for measuring the traffic safety level of the tunnel. That is, a safety level is assigned to each monitoring area at each moment. The detailed settings are as Figure 2 shown. The m-th monitoring area and its downstream (m + 1)-th area together contain four road sections. Among them, the 0th and 1st road sections belong to the m-th monitoring area, and the 2nd and 3rd road sections belong to the (m + 1)-th monitoring area. Note that the 0th and 2nd road sections are located in the left lane, and the 1st and 3rd road sections are located in the right lane.
[0043] (3) Safety level: Set the TTC threshold TTC * . When TTC n < TTC * , the target vehicle is considered to have a traffic conflict with the vehicle in front. The minimum TTC within the monitoring area (i.e., TTC min ) is used to measure its safety level. As shown in Equation (2), three thresholds (1 second, 2.5 seconds, 4 seconds) are set to divide the safety level of the monitoring area into four levels: extremely dangerous (y = 0), dangerous (y = 1), risky (y = 2), and safe (y = 3).
[0044]
[0045] The entire tunnel consists of multiple monitoring areas. Real-time monitoring of the safety level of each area is equivalent to evaluating the overall safety state of the tunnel.
[0046] (4) Macroscopic traffic characteristics:
[0047] The macroscopic traffic feature MTF consists of eight variables, denoted as MTF=(v mean ,v std ,k,p1,p2,p3,c cam ,c lane ), and the specific meanings are shown in Table 1. Suppose it is necessary to evaluate the safety level y of the m-th monitoring area at time t. As Figure 2 shown, collect the macroscopic traffic features, lane and camera information of four road sections belonging to the m-th and (m + 1)-th monitoring areas within the time period Δt before time t, denoted as x=(t b ,mtf0,mtf1,mtf2,mtf4). The whole day is evenly divided into n time time bins, t b is the ID of the time bin to which t belongs, and mtf i corresponds to Figure 2 the macroscopic traffic feature of the i-th road section in it.
[0048] Table 1 Macroscopic traffic features
[0049] Feature Meaning <![CDATA[v mean > Average vehicle speed (km / h) <![CDATA[v std > Standard deviation of vehicle speed (km / h) k Traffic density (vehicles / km) <![CDATA[p1]]> Proportion of small vehicles <![CDATA[p2]]> Proportion of medium and large vehicles <![CDATA[p3]]> Proportion of hazardous chemicals vehicles <![CDATA[c cam > Current camera monitoring area ID <![CDATA[c lane > Lane ID to which it belongs
[0050] (5) Definition of the MF-TSE problem: Given the macroscopic traffic features, lane, camera and time information x of a monitoring area, the MF-TSE problem aims to evaluate the safety level y of this area. In practice, the present invention estimates the macroscopic features of each monitoring area through traffic videos of Δt seconds and organizes them into data features x, inputs them into a classification model to predict the safety level of each area, and then issues warnings in real time. The safety level of each area is updated every Δt seconds. To continuously update the model, specific trajectory data will be sent to the model in the form of a data stream after dozens of hours (the extraction of microscopic trajectory data takes several hours). The goal is to more accurately and quickly predict the safety level of each area and continuously update the model based on the data stream.
[0051] The deep learning model architecture designed in the embodiment of the present invention for fusing multi-lane interaction features is used to accurately and real-time predict the safety level of each monitoring area through macroscopic traffic features, and requires the model to be continuously updated based on the data stream. As Figure 3 shown, this framework mainly includes: a feature encoding layer, a single-lane information extraction module and a safety level prediction module. The following takes a two-lane road as an example to describe this framework:
[0052] (1) Feature encoding layer: responsible for mapping the numerical attribute features in the macroscopic traffic features into high-dimensional vectors and injecting additional information (lane ID, camera ID, time bin). According to the settings of the macroscopic traffic features in Table 1, the data sample x=(t b ,mtf0,mtf1,mtf2,mtf3) is a 33-dimensional vector and will be encoded as a matrix (where d is the encoding dimension). Use Concat(·) to represent vertical matrix concatenation, and W and b represent the linear transformation matrix and bias respectively.
[0053] 1) Temporal encoding and lane encoding: Consider the lane ID c lane and the time bin ID t b as categorical attributes, and define the trainable embedding matrices and Given c lane and t b , their embedding vectors can be retrieved
[0054] 2) Traffic feature encoding: The six types of macroscopic traffic features other than the camera monitoring area ID and lane ID are all numerical attributes, i.e., the aforementioned numerical attribute features. For each type of numerical attribute feature x f (such as v mean ), evenly divide its value range into bins and initialize the trainable encoding for each bin. Let the upper and lower bounds of x f be x max , x min , and the bin width be Δx f , then define the embedding matrix Given x f0 , its bin ID is If it exceeds the range, it is truncated.
[0055] 3) Camera encoding: The camera ID c cam has spatial location characteristics, and use positional encoding to generate its encoding matrix The generation method is as shown in Equation [eq:pe]:
[0056]
[0057] where i is the camera index and j is the dimension index.
[0058] 4) Encoding fusion: For each macroscopic traffic feature x f , its final encoding is the sum of each encoding vector:
[0059]
[0060] Each section contains six macroscopic traffic features, and each sample x contains four sections. Therefore, the multi-section joint feature matrix E = Concat(E0, E1, E2, E3) can be obtained, where is the encoding matrix of the i-th section.
[0061] (2) Single - lane information extraction module: Organize the information of the macro - traffic characteristics themselves, and extract the interaction characteristics between two sections of the same lane in the road tunnel. The input is the encoding matrices of two consecutive sections in the same lane Output the processed matrix Note that one single - lane information extraction module is required for one lane, which is abbreviated as a lane block. Next, the processing flow of the lane block will be described first, and then its underlying components will be introduced in detail.
[0062] 1) Processing flow: Input the encoding matrices \(E\) a and \(E\) b of the upstream and downstream sections of the same lane into their respective section modules. Then connect the outputs of the two section modules together and input them into the feed - forward neural network FFN2. Finally, add two residual connections to the output of FFN2 (denoted by ), and generate the processed encoding matrix That is, an enhanced section representation carrying the spatio - temporal interaction characteristics within the same lane is obtained. The detailed process is as follows:
[0063]
[0064] 2) Section module: This module is the core component of the lane - block module, which is used to extract the characteristics of the macro - traffic characteristics themselves and the interaction information between different sections in the same lane. It consists of two feed - forward neural networks FFN1, one multi - head attention module and several residual connections. The structure is as Figure 4 shown. The outputs of the first and second residual connections are denoted as respectively. Its detailed calculation process is as follows
[0065]
[0066] where the scaling factor is used to control the network variance fluctuation. The above process is briefly denoted as
[0067] 3) Underlying components:
[0068] Multi - head attention: This group is used to fuse the information of the two sections. Suppose it contains \(H\) heads, and the input is (\(n\) is a positive integer). The calculation of the \(h\) - th head is as follows:
[0069]
[0070] \(A\) (h) =\(SoftMax(Q\) (h) \(K\) (h)T \()\), \(O\) (h) =\(A\) (h) \(V\) (h)
[0071] Among them
[0072] Horizontally splice the outputs of all heads and perform a linear transformation:
[0073] O a = Concat horizontal ([O (1) , O (2) , …, O (H) )W a
[0074] Among them The operation of this module is briefly denoted as O a = MHA(X q , X k , X v ).
[0075] Feed - forward neural network FFN1: This module is used for feature extraction. Let the input be (n is the number of features), and the calculation process is:
[0076] O1 = X F1 W1 + b1, O2 = Dropout(Relu(O1))
[0077] O3 = O2W2 + b2, O F1 = Dropout(Relu(O3))
[0078] Among them And d′ is usually greater than d. The operation of this module is briefly denoted as O F1 = FFN1(X F1 ).
[0079] Feed - forward neural network FFN2: This module is used for feature interaction. Let the input be (n is the number of features), and the calculation process is:
[0080] O5 = Dropout(Relu(O4))
[0081] O6 = O5W4 + b4, O F2 = Dropout(Relu(O6)) T
[0082] Among them
[0083] The operation of this module is briefly denoted as O F2 = FFN2(X F2 ), that is, an enhanced road segment representation carrying spatio - temporal interaction features within the lane is obtained.
[0084] (3) Safety level prediction module: This module outputs the probability distribution of the safety level of the monitoring area by integrating all road segment coding information (enhanced road segment representations carrying spatio-temporal interaction features within the lane). Since lane changes are prohibited in tunnels, the safety level of the monitoring area is determined by the road segment with the lowest safety level. Therefore, independent predictions are first made for each lane, and then the overall prediction results are combined. Taking a two-lane tunnel as an example (road segments 0 and 2 belong to the left lane, and road segments 1 and 3 belong to the right lane), the processing flow is as follows:
[0085] S left = FFN(Concat(E p0 ,E p2 ))W trans + b trans
[0086] S right = FFN(Concat(E p1 ,E p3 ))W trans + b trans
[0087] S single = Concat(E left ,E right )W single + b single
[0088] where FFN(·) represents FFN2(FFN1(·)), but with special parameter dimensions set as follows:
[0089] Here and
[0090] To comprehensively consider the features of all lanes, the overall prediction is made using the entire embedding matrix:
[0091] S overall = FFN(Concat(E p0 ,E p1 ,E p2 ,E p3 ))W trans + b trans
[0092] where the FFN(·) parameters are set as Output
[0093] Finally, the two types of scores are fused through a linear layer, and the probability distribution, that is, the safety level prediction result, is obtained through a softmax layer:
[0094] S = Concathorizontal (S single , S overall )
[0095] p = Softmax(SW inte + b inte )
[0096] Where
[0097] (4) Training of the deep learning model for fusing multi - lane interaction features:
[0098] In the embodiments of the present invention, the model is trained based on the cross - entropy loss function, and the cross - entropy loss function is:
[0099]
[0100] Where y i is the one - hot label of the i - th sample, and p i is the output of the model. The Adam optimizer is used for optimization, and weight decay is used to prevent overfitting.
[0101] Experiments on the deep learning model for fusing multi - lane interaction features of the present invention are as follows:
[0102] The experimental dataset of the embodiments of the present invention is collected from a highway tunnel in Shanxi, China. The speed limit of this tunnel is 70 km / h. Fourteen cameras are selected, which are continuously installed on the top of the tunnel and continuously collect tunnel monitoring videos for 24 hours. The installation spacing of the cameras is 150 meters, and each camera can provide monitoring videos with a resolution of 6 million pixels. Through video processing technologies such as object detection, multi - object tracking, and vehicle re - identification, the microscopic trajectory data of 27,842 vehicles driving in the tunnel are finally obtained.
[0103] At each moment t, we select the minimum TTC of the vehicles in the monitoring area of each camera as the basis for classifying the safety level of the monitoring area. This moment is then used as an anchor point to obtain the corresponding macroscopic traffic features of the monitoring area within the previous Δt seconds. Each vehicle is used to calculate the minimum TTC time at most once in each monitoring area. Then, we divide the safety level according to the TTC time and obtain 88,929 data samples. Among them, the number of data samples with safety levels 0, 1, 2, and 3 are 5,401, 31,044, 10,771, and 41,713 respectively. Finally, we divide the processed dataset into a training set, a validation set, and a test set according to the ratio of 7:1:2.
[0104] To evaluate the effectiveness of these methods, we use the following four metrics: Recall, Precision, F1-score, and ROC_AUC. These metrics are widely used to evaluate the effectiveness of classification models. Since the four-category distribution of the finally generated dataset is not balanced enough, we do not use Accuracy as an evaluation metric, and the above metrics are all weighted metrics. It should be noted that the value ranges of these four metrics are all between 0 and 1, and the larger the Recall, Precision, F1-score, and ROC_AUC values, the higher the effectiveness of the method. The test results are shown in the following table:
[0105]
[0106] Table 2 Headquarters Prediction Effect
[0107] As shown in Table 2, among traditional machine learning methods, the overall performance of the two ensemble methods (i.e., RF and XGBoost) is much better than that of the two single learner methods (i.e., SVM and RF). In this classification task, the overall performance of XGBoost is better than that of RF. Among deep learning methods, the methods specifically designed for tabular data (i.e., TabNet and DANet) are generally better than Transformer, CNN, and MLP, which indicates that deep learning methods optimized for tabular data are more suitable for traffic safety assessment tasks. Among all deep learning methods, our model has achieved the best results in all metrics. Among all methods, XGBoost has achieved the best performance in almost all metrics. However, the effect of our model is also comparable to that of XGBoost. Considering that the decision trees of the GBDT method are not differentiable, resulting in extremely low learning efficiency of the GBDT method when retraining from scratch frequently in the online prediction scenario. And our model is a deep learning method, and its mini-batch training mode enables it to be updated efficiently in online tasks with large-scale data. Therefore, we believe that considering the comprehensive prediction effect and online learning ability, our model has achieved the best prediction effect.
[0108] The above is only the preferred embodiment of the present invention and is not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A real-time evaluation method for tunnel traffic safety based on traffic conditions and deep learning, characterized in that, Including: Macro traffic characteristics of each monitoring area in the tunnel are collected in real time. The macro traffic characteristics include numerical attribute characteristics, lane ID, and camera ID. The numerical attribute characteristics include average vehicle speed, standard deviation of vehicle speed, traffic density, proportion of small vehicles, proportion of medium and large vehicles, and proportion of hazardous chemical vehicles; The macro traffic characteristics collected in real time are input into a pre-trained deep learning model that integrates multi-lane interaction features. This model includes a feature encoding layer, a single-lane information extraction module, and a safety level prediction module. The feature encoding layer is used to map the numerical attribute characteristics into high-dimensional vectors, and fuse the encodings of time ID, lane ID, and camera ID to generate a multi-segment joint feature matrix; The single-lane information extraction module is used to extract the interaction features between upstream and downstream segments of its corresponding lane based on the multi-segment joint feature matrix, using a multi-head attention mechanism and residual connection, and finally obtain an enhanced segment representation carrying spatio-temporal interaction features within the lane. The safety level prediction module is used to fuse all enhanced segment representations carrying spatio-temporal interaction features within the lane and output the safety level prediction results of each monitoring area; During the training phase, the deep learning model that integrates multi-lane interaction features uses historical macro traffic characteristics and TTC safety level labels calculated based on microscopic trajectories for supervised learning.
2. The method according to claim 1, characterized in that The specific implementation of the feature encoding layer includes: performing categorical encoding on the time bin ID and lane ID using a trainable embedding matrix; performing sine and cosine position encoding on the camera ID; performing embedding encoding after binning and discretizing the numerical attribute characteristics; adding the encoded vectors to obtain segment-level features, and concatenating them to obtain a multi-segment joint feature matrix.
3. The method according to claim 1, wherein The processing flow of the single-lane information extraction module specifically includes: inputting the upstream and downstream segment encodings of the same lane into parallel segment modules. The segment modules extract the characteristics of the numerical attribute features themselves and the interaction information between different segments of the same lane based on a feed-forward neural network FFN1, a multi-head attention mechanism, and residual connection; fusing the outputs of each segment module through a feed-forward neural network FFN2, and retaining the original feature information through residual connection, and finally outputting an enhanced segment representation carrying spatio-temporal interaction features within the lane.
4. The method according to claim 1, characterized in that, The safety level prediction module first makes independent predictions for each lane based on the enhanced road segment representation carrying spatio-temporal interaction features in the lane to obtain the independent prediction result S single , then makes an overall prediction to obtain the overall prediction result S overall , and finally fuses the independent prediction result S single and the overall prediction result S overall through a linear layer, and obtains the safety level prediction result through a softmax layer.
5. The method according to claim 1, characterized in that, It also includes an update mechanism for continuously updating the deep learning model that integrates multi-lane interaction features based on the data stream.
6. The method according to claim 1, wherein The TTC safety level division uses multi-threshold dynamic determination, including: setting three-level thresholds of 1 second, 2.5 seconds, and 4 seconds according to the minimum TTC value of vehicles in the monitoring area to divide four safety levels.
7. The method according to claim 1, wherein The loss function used by the deep learning model that integrates multi-lane interaction features during training is the cross-entropy loss function, and the Adam optimizer is used to optimize the model parameters, and weight decay is used to prevent overfitting.
Citation Information
Patent Citations
Tunnel accident risk assessment method, system and equipment
CN118014349A
Cascade deep reinforcement learning security decision-making method based on multi-modal space-time representation
CN118861965A
Vehicle trajectory prediction method based on attention mechanism
CN118953406A