Highway confluence area real-time conflict prediction method based on deep transfer learning
Through deep transfer learning methods, a real-time conflict prediction framework for highway merging areas was constructed. Using the Gated-Transformer model and transfer learning architecture, the portability and precision issues of the real-time conflict prediction model for highway merging areas were solved, achieving higher prediction accuracy and applicability.
Patent Information
- Application Number
- CN202510967312.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-14
- Publication Date
- 2025-09-16
AI Technical Summary
Existing real-time traffic conflict prediction models lack portability and accuracy in highway merging areas, and ignore the time-varying characteristics of traffic flow, resulting in poor prediction results.
A method based on deep transfer learning is adopted. By constructing a real-time conflict prediction framework, the Gated-Transformer model is used to extract the potential correlation features between traffic variables and conflicts. The maximum mean difference method is used to measure the distribution difference of feature data in the source and target domains. The loss function and transfer learning architecture are designed to improve the portability and prediction accuracy of the model.
The model's prediction accuracy and portability in different locations have been improved, as well as the accuracy and reliability of real-time conflict prediction, making it suitable for accident risk warning systems in vehicle-road collaborative environments.
Smart Images

Figure CN120656323A_ABST
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the technical field related to traffic conflict prediction, and specifically to a real-time conflict prediction method for highway merging areas based on deep transfer learning. Background Art
[0002] Real-time traffic conflict prediction has become a research hotspot in the field of intelligent transportation due to its enormous potential for active traffic safety management. Automatic traffic conflict identification technology based on trajectory extraction has gradually matured, and significant progress has also been made in the research of real-time risk prediction models based on traffic conflicts. However, existing research still has significant shortcomings in terms of model portability, as analyzed below:
[0003] (1) Traditional manual observation methods are highly subjective in conflict acquisition, resulting in low conflict data collection accuracy. With the development of computer vision and deep learning technologies, it has become feasible to automatically extract vehicle trajectories from videos and identify traffic conflicts, and this technology is gradually maturing. With the help of trajectory data, the continuous spatiotemporal trajectory changes of each vehicle in the study area, as well as its acceleration, deceleration, lane changing, and other behaviors, can be observed, which is conducive to the flexible selection of multiple conflict measurement indicators for in-depth analysis.
[0004] (2) Given the limitations of accident data in road traffic safety assessment, real-time road risk prediction models based on conflict data have become a current research trend. However, existing real-time conflict prediction models mainly focus on basic road sections, with relatively little research on bottleneck sections of highways. In addition, existing methods usually use traffic flow characteristics within a fixed time period as model input, which ignores the time-varying characteristics of traffic flow. Traffic flow fluctuation characteristics at different times may also be a potential factor affecting the occurrence of conflicts.
[0005] (3) With superior prediction performance, machine learning and deep learning methods have greater advantages in building real-time conflict prediction models for real-world application scenarios. However, existing technologies do not focus on the portability of real-time conflict prediction models. Due to the significant differences in traffic flow characteristics distribution in different locations, the prediction accuracy of a real-time conflict prediction model trained at one location often decreases significantly when it is transferred to another location, showing poor portability. Summary of the Invention
[0006] To address the shortcomings of current technology, the present invention combines existing technologies and, based on practical applications, provides a real-time conflict prediction method for highway merging areas based on deep transfer learning. Taking highway merging areas as the object, based on traffic conflict technology and transfer learning theory, and taking full account of the time-varying characteristics of traffic flow, a real-time conflict prediction framework for highway merging areas is established. Based on this, a conflict prediction model based on deep transfer learning is constructed to improve the accuracy and portability of real-time conflict prediction.
[0007] The technical solutions of the present invention are as follows:
[0008] The real-time conflict prediction method for highway merging areas based on deep transfer learning includes the following steps:
[0009] S1. Build a real-time conflict prediction framework and extract data, including:
[0010] S11. Based on traffic conflict theory and the traffic operation characteristics of the area, the conflict types in the merging area of highways are divided into rear-end collision conflicts and lane change conflicts, using time to collision (TTC) and time to intrusion (PET) as measurement indicators respectively.
[0011] S12. Introducing a sliding window mechanism to extract time-varying characteristics of traffic flow and constructing a real-time conflict prediction framework for highway merging areas;
[0012] S13. Select the exiD dataset as the trajectory data source and extract the severe conflict samples and traffic flow characteristics required for modeling;
[0013] S2. Establish a deep transfer learning method for real-time conflict prediction, specifically including:
[0014] S21. Considering traffic variables as channels of time series, we reconstruct the Gated-Transformer model as a feature extraction network to obtain the potential correlation features between traffic variables and conflicts.
[0015] S22. Build an independent transfer learning architecture, use the maximum mean difference method to measure the difference in feature data distribution between the source and target domains, and use a two-step difference optimization framework to achieve model knowledge transfer;
[0016] S23. Design a loss function for the model, use Focal Loss to calculate the classification prediction loss, and use the Bayesian optimization algorithm to determine the optimal migration loss weight;
[0017] S3. Build a prediction model based on deep transfer learning and implement real-time conflict prediction in highway merging areas based on the prediction model.
[0018] Furthermore, in step S11, the time-to-collision (TTC) indicator represents the time required for two vehicles to collide if they maintain their current speed and path. Multiple TTC values are generated during continuous driving, and the minimum TTC value is recorded. The moment when the minimum value occurs is considered the most dangerous time point for a rear-end collision.
[0019] In the PET metric, PET represents the time difference between the rear end of the leading vehicle leaving the conflict zone and the front end of the following vehicle arriving at the conflict zone. Assume that the lane-changing vehicle is denoted as SV, the following vehicle in the target lane is denoted as FV, and the leading vehicle is denoted as LV. The PET calculation process for lane-changing conflicts between SV and FV in the target lane is as follows:
[0020] The time when the SV successfully enters the target lane is T1. The tail of the SV is the intrusion line position at this time, and the front end of the FV passes the intrusion line at T2. The time difference between T2 and T1 is the conflict time PET. The time when the SV successfully enters the target lane is T3. The head of the SV is the intrusion line position at this time, and the rear end of the LV passes the intrusion line at T4. The time difference between T3 and T4 is the conflict time PET between the lane-changing vehicle and the leading vehicle in the target lane. Each lane-changing conflict event may generate two PET values, and the smaller value is taken as the lane-changing conflict.
[0021] Furthermore, in step S11, the method for classifying rear-end collision and lane change conflict is as follows:
[0022] First, the temporal proximity of the conflicting vehicles at any moment is calculated based on the continuous vehicle trajectory data;
[0023] Secondly, the moment with the smallest time proximity is defined as the most dangerous time point. The definition of the most dangerous time point is different for different conflict types. The most dangerous time point for rear-end collision is defined as the moment with the minimum TTC value T f The most dangerous time point of lane change conflict is defined as the moment when the lane-changing vehicle enters the target lane T p , when T f Less than T p , the collision event is recorded as a rear-end collision; when T p Less than T f , at this time, the conflict event is recorded as a lane-changing conflict.
[0024] Further, step S12 specifically includes:
[0025] First, vehicle trajectory data is obtained. After the trajectory data is extracted, TTC and PET are selected as conflict metrics to identify rear-end collisions and lane change conflicts, respectively, and to locate the road section and lane where the conflict occurred.
[0026] Secondly, the upstream and downstream traffic flow characteristics of the road section before the conflict event are extracted to obtain conflict samples. The trajectory data before the conflict event is deleted, and the remaining trajectory data is randomly divided into different time segments. Non-conflict samples are extracted by road section in different time segments. When extracting traffic flow features, the traffic flow detection time is set, and a sliding time window is added within the traffic flow detection time period. The fixed detection time period is divided into multiple "small intervals". Traffic flow features are extracted separately in each "small interval" to obtain the time-varying characteristics of traffic flow.
[0027] Finally, a real-time conflict prediction model is constructed based on deep learning technology by utilizing the time-varying characteristics of traffic flow corresponding to conflict samples and non-conflict samples.
[0028] Furthermore, in step S13, the method for extracting severe conflict samples is as follows:
[0029] The TTC and PET index values were calculated based on the parameters in the exiD dataset. The negative values of the two types of conflict index values were processed. The 85% percentile was selected as the criterion for severe conflict. The conflict threshold was determined, and events below the threshold were defined as severe conflict events.
[0030] Furthermore, in step S21, the Gated-Transformer model reconstruction method is as follows:
[0031] For the embedding layer: the embedding layer is replaced with a fully connected linear layer to better adapt to the distribution characteristics of time series. The nonlinear activation function tanh is used to replace the traditional linear projection to enhance the nonlinear expression ability of the model. Positional encoding is introduced in the post-nonlinear transformation of time series data to explicitly encode time information.
[0032] For the dual-tower structure: It consists of a channel encoder and a step encoder. The channel encoder is used to calculate the attention weights of various traffic variables. The step encoder uses a masked multi-head attention mechanism to calculate pairwise attention weights across all time steps. The channel encoder and the step encoder process the vector input in parallel. Each branch implements feature extraction and representation learning by stacking N layers with the same structure.
[0033] For the gating mechanism: After obtaining the output of each tower, the output of the two encoders is first processed through a fully connected layer with a nonlinear activation function to generate two features. Secondly, the two feature representations are cascaded and the final features are obtained through linear projection. On this basis, the gating weight is calculated using the Softmax function. Each gating weight is then multiplied by the output of the corresponding tower and finally encapsulated into a comprehensive output vector.
[0034] Furthermore, in step S22, an adaptive layer is added, and an independent transfer learning architecture is constructed based on the adaptive layer. The maximum mean difference (MMD) is selected as the metric for the data distribution difference between the source domain and the target domain. The Gaussian kernel function is used as the kernel function of the MMD. The metric calculation formula for the data distribution difference is as follows:
[0035]
[0036] Where, X s 、X t Represents the source domain and target domain feature data respectively, n s Indicates the number of source domain samples, n t represents the number of samples in the target domain, H represents the regenerated Hilbert space, x si represents the i-th data sample in the source domain, x sj represents the jth data sample in the source domain, x tj represents the i-th data sample in the target domain, x ti The jth data sample in the target domain, k(·) represents the Euclidean distance between samples.
[0037] Furthermore, in step S22, the terminal output layer of the feature extraction network is defined as the first adaptive layer, and a fully connected linear layer is added after the feature extraction network as the second adaptive layer. Both adaptive layers use the MMD method to measure the difference in feature distribution between the source domain and the target domain. Through the above two-step optimization mechanism, a complete transfer learning architecture is constructed. The steps of implementing the architecture during the model training process are as follows:
[0038] First, the labeled source domain data is input into the feature extraction network to obtain feature data; then, the unlabeled target domain data is also input into the feature extraction network to obtain feature data; secondly, the MMD method is used to calculate the difference between the feature data; thirdly, the source domain feature number is input into the linear layer for processing to obtain new features, and the target domain feature data is also input into the linear layer for processing to obtain new features. The MMD criterion is also used to measure the difference. The measured difference is used as the migration loss to guide the model optimization process, and gradually reduce the distribution difference between the source domain and the target domain; then, Softmax is used as the normalization function to output the predicted probability of conflict events and non-conflict events; finally, by comparing the two probabilities, the larger value is taken as the conflict prediction result.
[0039] Furthermore, in step S23, the Focal Loss loss function expression is as follows:
[0040] FL(p t )=-(1-p t ) γ log(p t )
[0041] In the formula, FL represents the Focal Loss loss function, γ represents the focus parameter, and p t The expression is as follows:
[0042]
[0043] Where y i represents the true label of the i-th sample, represents the predicted probability of the i-th sample.
[0044] Furthermore, in step S23, the Bayesian optimization algorithm is used to determine the optimal migration loss weight, as follows:
[0045] (1) Randomly sample N initial points in the weight search space, train the model for each initial point and calculate the validation set performance;
[0046] (2) Perform iterative optimization:
[0047] (a) Fitting a Gaussian process based on the current observation dataset;
[0048] (b) Select the next candidate point by optimizing the acquisition function:
[0049] (c) Train the model at the next candidate point and calculate the validation set performance;
[0050] (d) Update the dataset;
[0051] (3) Iteration termination: when the maximum number of iterations is reached or the objective function value converges, the optimal weight is output.
[0052] Beneficial effects of the present invention:
[0053] This paper establishes a real-time conflict prediction framework for highway merging areas and proposes a deep transfer learning method for real-time conflict prediction. This method has been shown to improve the effectiveness and reliability of model portability.
[0054] The verification results show that the model of the present invention is significantly superior to the traditional baseline model in terms of feature extraction ability and prediction performance, and the model achieves the best prediction effect; after the introduction of the transfer learning architecture, the precision, recall rate, F1 score and AUC value of all models are improved, which proves the effectiveness and rationality of the transfer learning architecture proposed in the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 This is the technical roadmap adopted by the present invention.
[0056] Figure 2PET measurement schematic diagram in an embodiment of the present invention, (a) is a schematic diagram of the conflict between the lane-changing vehicle and the following vehicle in the target lane, and (b) is a schematic diagram of the conflict between the lane-changing vehicle and the leading vehicle in the target lane.
[0057] Figure 3 Schematic diagram of a real-time conflict prediction framework in an embodiment of the present invention.
[0058] Figure 4 Schematic diagram of the prediction timeline and non-conflicting observations.
[0059] Figure 5 Figure 1 illustrates the calculation of the PET values for the exiD dataset. (a) illustrates the calculation of the PET values for the lane-changing host vehicle and the following vehicle in the target lane, and (b) illustrates the calculation of the PET values for the lane-changing host vehicle and the leading vehicle in the target lane.
[0060] Figure 6 Schematic diagram for selecting the 85% percentile threshold value for TTC and PET indicators, where (a) is the statistical distribution of -PET and (b) is the statistical distribution of -TTC.
[0061] Figure 7 Schematic diagram of the Gated-Transformer model network architecture.
[0062] Figure 8 Schematic diagram of transfer learning architecture.
[0063] Figure 9 A validation framework for degree transfer learning methods.
[0064] Figure 10 This is the model prediction performance when the transfer learning architecture is not added. In the figure, (a) is an illustration when the conflict threshold is (TTC = 2.0s & PET = 0.55s), and (b) is an illustration when the conflict threshold is (TTC = 1.5s & PET = 0.50s).
[0065] Figure 11 To show the change in model prediction F1 score before and after adding the transfer learning architecture, (a) is an illustration of the conflict threshold (TTC = 2.0s & PET = 0.55s), and (b) is an illustration of the conflict threshold (TTC = 1.5s & PET = 0.50s).
[0066] Figure 12 It is an application scenario of real-time conflict prediction model in V2I environment. DETAILED DESCRIPTION
[0067] The present invention will be further described with reference to the accompanying drawings and specific embodiments. It should be understood that these embodiments are intended only to illustrate the present invention and are not intended to limit the scope of the present invention. In addition, it should be understood that after reading the contents of the present invention, those skilled in the art may make various changes or modifications to the present invention, and these equivalent forms also fall within the scope defined by the present application.
[0068] This embodiment provides a real-time conflict prediction method for highway merging areas based on deep transfer learning. Its technical roadmap is as follows: Figure 1 shown.
[0069] In this embodiment, the prediction method is mainly completed in three steps: (1) construction of a real-time conflict prediction framework and data extraction; (2) establishment of a deep transfer learning method for real-time conflict prediction; and (3) construction and application of a deep transfer learning model.
[0070] (1) Real-time conflict prediction framework construction and data extraction:
[0071] In this embodiment, highway merging areas are taken as the research object. Based on traffic conflict theory and the traffic operation characteristics of the area, the conflict types in highway merging areas are divided into rear-end collisions and lane change conflicts, and appropriate indicators are selected to measure these two types of conflicts. A sliding window mechanism is introduced to capture the time-varying characteristics of traffic flow and construct a real-time conflict prediction framework for highway merging areas. The exiD (exits and entries Drone) dataset is selected as the trajectory data source to extract severe conflict samples and traffic flow characteristics required for modeling.
[0072] (2) Establishment of a deep transfer learning method for real-time conflict prediction:
[0073] In the embodiment, from the perspective of improving model portability, a deep transfer learning method for real-time conflict prediction is proposed. Different merging area scenarios are divided into source and target domains. A prediction model is constructed based on the source domain, and the changes in the model's prediction performance in the target domain are explored. The Gated-Transformer model is reconstructed as a feature extraction network to deeply explore the potential correlation characteristics between traffic variables and conflicts. An independent transfer learning architecture is designed, and the maximum mean difference method is used to measure the difference in the distribution of feature data in the source and target domains. A two-step difference optimization framework is established to achieve model knowledge transfer. A customized loss function is designed for the model, and Focal Loss is used to calculate the classification prediction loss. The Bayesian optimization algorithm is used to determine the optimal transfer loss weight.
[0074] (3) Construction and application of deep transfer learning model:
[0075] In this example, a method validation framework was designed to verify the effectiveness and reliability of the proposed deep transfer learning method in improving the portability of real-time conflict prediction models. Source domain data was used to construct the model training set, while target domain data served as an independent test set. Precision, recall, F1 score, and AUC were used as evaluation metrics to compare the prediction performance of different deep learning models before and after adding a transfer learning framework, providing an in-depth assessment of the model's portability. A sensitivity analysis of key model parameters was performed to provide parameter guidance for the real-world application of the real-time conflict prediction model. A real-world application scenario for the model was also designed, providing a technical reference for the construction of an accident risk warning system in a vehicle-road collaborative environment.
[0076] The real-time conflict prediction method for highway merging areas based on deep transfer learning is as follows.
[0077] (1.1) Traffic conflict measurement in highway merging areas
[0078] Initial research on traffic conflicts focused primarily on intersections. Consequently, traditional conflict classification methods are primarily applicable to intersection scenarios. Traffic flow characteristics at freeway merging areas differ significantly from those at intersections. First, vehicles entering the ramp initially accelerate in the acceleration lane while simultaneously seeking a gap in the outermost lane of the mainline. When a gap appears, they merge into the outermost lane of the mainline and then further into the target lane. During this process, merging vehicles disrupt the flow of vehicles on the mainline, easily causing traffic conflicts, especially in the outer lanes. Second, vehicles in the outer lanes of the mainline often slow down or switch lanes from the outer lanes to the inner lanes to provide sufficient merging space for merging vehicles, leading to traffic conflicts between vehicles on the mainline. Therefore, the frequent acceleration, deceleration, and lane changing of traffic on the mainline and ramps are the main causes of traffic conflicts in this area. To more accurately describe the characteristics of traffic conflicts in merging areas, this embodiment considers both lateral and longitudinal conflict risks during vehicle movement and divides conflict types in highway merging areas into rear-end collisions and lane change conflicts.
[0079] This embodiment divides the conflict types in the merging area of a highway into rear-end collisions and lane change conflicts. Therefore, it is necessary to select appropriate conflict discrimination indicators to measure these two types of conflicts respectively. For the measurement of rear-end collisions, this embodiment selects the TTC indicator. TTC is defined as "the time required for two vehicles to maintain their current speed and path and cause a collision." A TTC value is only generated when the speed of the rear vehicle is greater than that of the front vehicle. The TTC calculation formula is shown in formula (1). A vehicle will generate multiple TTC values during continuous driving. This embodiment records the minimum TTC value and regards the moment when the minimum value appears as the most dangerous time point for rear-end collisions.
[0080]
[0081] Where, TTC I Indicates the distance between the rear vehicle and the front vehicle and the collision time (s); Vx(t i ) represents t i The headway between the front and rear vehicles at the moment (m); l i-1 Indicates the length of the vehicle in front (m); Vv(t i ) represents t i The speed difference between the two vehicles at the moment (m / s).
[0082] This embodiment uses Post Encroachment Time (PET) as a metric to measure lane change conflicts. PET is defined as the time difference between the rear end of the leading vehicle leaving the conflict zone and the front end of the following vehicle arriving at the conflict zone. This embodiment also considers conflicts between the lane-changing vehicle (SV), the following vehicle (FV) in the target lane, and the leading vehicle (LV). Figure 2 As shown. The lane change conflict PET calculation process between SV and the target lane FV is as follows: the moment when SV successfully enters the target lane is taken as T1, the moment when the tail of SV is taken as the intrusion line position, and the moment when the front end of FV passes through the intrusion line is T2, then the time difference between T2 and T1 is the conflict time PET; similarly, the moment when SV successfully enters the target lane is taken as T3, the moment when the head of SV is taken as the intrusion line position, and the moment when the rear end of LV passes through the intrusion line is T4, then the time difference between T3 and T4 is the conflict time PET between the lane-changing vehicle and the leading vehicle in the target lane. Therefore, each lane change conflict event may generate two PET values. In order to avoid repeated measurement of conflict events, this embodiment takes the smaller value of the two and records it as a lane change conflict event.
[0083] Regarding the method of distinguishing rear-end collisions and lane-changing conflicts, previous studies have mainly focused on the conflict angle. This method is mainly suitable for manual conflict judgment based on risk avoidance behavior observation, that is, when the vehicle exhibits obvious risk avoidance behavior, the conflict type is distinguished by manually observing the conflict angle. However, due to the strong subjectivity of manual observation of the conflict angle, this method is prone to errors in the conflict judgment results. In order to more accurately distinguish rear-end collisions and lane-changing conflict events, this embodiment uses vehicle trajectory data to propose a conflict type judgment method based on the most dangerous time point. The implementation steps of this method are as follows: first, the time proximity of the conflicting vehicles at any moment is calculated based on the continuous trajectory data; secondly, the moment with the minimum time proximity is defined as the most dangerous time point. The most dangerous time point is defined differently for different conflict types. The most dangerous time point for a rear-end collision is defined as the moment T with the minimum TTC value. f The most dangerous time point of lane change conflict is defined as the time when the lane-changing vehicle enters the target lane T p When Tf Less than T p , indicating that the rear-end collision occurs earlier than the lane-changing conflict, and the conflict event is recorded as a rear-end collision; when T p Less than T f , indicating that the lane-changing conflict occurs earlier than the rear-end collision. In this case, the conflict event is recorded as a lane-changing conflict.
[0084] (1.2) Construction of real-time conflict prediction framework
[0085] Trajectory data can observe the continuous spatiotemporal trajectory changes and acceleration, deceleration, lane changing and other behaviors of each vehicle in the study area, providing important basic information for the identification of conflict events. Therefore, the real-time conflict prediction model based on trajectory data has become the main trend of current research. The traffic operation conditions in the merging area of the highway are complex, and it is a typical traffic bottleneck area. The previous real-time conflict prediction framework for basic sections is no longer applicable in this area. To this end, this embodiment divides the merging area into three sections: upstream section, merging section, and downstream section. Among them, the upstream section and the merging section are bounded by the merging nose end, and the merging section and the downstream section are bounded by the end of the acceleration lane. Based on this section division method, this embodiment constructs a real-time conflict prediction framework based on trajectory data for the merging area of the highway, such as Figure 3 According to this framework, the real-time conflict modeling process is as follows:
[0086] First, drones were used to survey highway merging areas, and vehicle trajectory data was extracted based on video automatic detection technology. After trajectory data extraction was completed, TTC and PET were selected as conflict metrics to identify rear-end collisions and lane change conflicts, respectively, and to locate the road section and lane where the conflict occurred.
[0087] Secondly, the upstream and downstream traffic flow characteristics of the road section before the conflict event occurred are extracted at the lane level. The traffic flow detection time is set to 30 seconds, that is, the traffic flow status is continuously observed within 30 seconds to obtain the dangerous traffic flow characteristics before the conflict occurs. It should be noted that in the merging section, not only the influence of the main line traffic flow needs to be considered, but also the influence of vehicles merging from the ramp. In addition, the extraction of non-conflict events is equally important because they exhibit traffic flow characteristics that are essentially different from conflict-prone situations. In order to obtain non-conflict samples, the trajectory data before the conflict event is first deleted, and then the remaining trajectory data is randomly divided into different time segments, and non-conflict samples are extracted by road section within different time segments.
[0088] Finally, using the traffic flow characteristics corresponding to conflict samples and non-conflict samples, a real-time conflict prediction model is constructed based on deep learning technology to explore the potential correlation between traffic flow characteristics and conflicts.
[0089] Selecting an appropriate traffic flow detection time is the key to real-time conflict modeling. By aggregating traffic flow characteristics within a fixed detection time period, the connection between traffic variables and conflicts can be established, but this approach ignores the temporal variation trend of traffic flow characteristics. The fluctuation characteristics of traffic flow at different times are also potential factors affecting the occurrence of conflicts. In order to capture the time-varying characteristics of traffic flow, this embodiment adds a sliding time window (Δt, such as 3s, 6s, 10s, etc.) to the traffic flow detection time period, divides the fixed detection time period into multiple "small intervals", and extracts traffic flow characteristics separately in each "small interval". After adding the sliding time window, the model input is converted from one-dimensional traffic flow characteristics to high-dimensional traffic flow time series. Correspondingly, the real-time conflict prediction task is transformed into exploring the potential correlation characteristics between traffic flow time series and traffic conflicts.
[0090] Figure 4 A real-time conflict prediction timeline was constructed. The core elements of this timeline include traffic flow detection time, warning time, and the time reference point of the conflict event (i.e., conflict event time zero). The concept of conflict event time zero is crucial in this study and is defined as the most dangerous time point in a conflict event. For rear-end collisions, time zero is the moment when the vehicle's TTC value is minimum during continuous driving, and for lane change conflicts, time zero is the moment when the lane-changing vehicle enters the target lane. The period before conflict event time zero is defined as the warning time. Previous real-time conflict prediction studies typically did not include a warning time, meaning only the immediate probability of conflict occurring after the current period was predicted. A significant drawback of this approach is that it fails to provide drivers or vehicles with sufficient reaction time to take timely evasive measures based on the predicted conflict risk. The introduction of the warning time greatly enhances the practicality and application value of the real-time conflict prediction model. This improvement, particularly in future vehicle-road collaborative environments, can provide an important reference for the development of active safety systems for connected autonomous vehicles. The period before the warning time is the traffic flow detection time. During this time, upstream and downstream traffic flow characteristics within each sliding time window are collected and used as input variables for the real-time conflict prediction model.
[0091] Conflict metrics typically rely on microscopic vehicle motion characteristics, such as speed and acceleration. Therefore, when a conflict occurs, obtaining macroscopic traffic flow characteristics for the matching road segment presents significant challenges. This embodiment specifically proposes a method for setting up virtual upstream and downstream detectors for merging areas. This method deploys virtual detectors on the mainline and ramps to more comprehensively capture traffic dynamics in merging areas.
[0092] (1.3) Modeling data extraction
[0093] The exiD dataset is a newly released drone trajectory dataset that fills the gap in high-precision trajectory data for merging areas. The dataset provides detailed information about each frame of a vehicle trajectory, including vehicle ID, vehicle type, speed, acceleration, lane position, and time-to-travel (TTC) value.
[0094] To identify the conflict data needed for modeling, we first need to calculate the TTC and PET values of the vehicle during continuous motion. Using the pre-processed trajectory data, the specific calculation process of the two types of conflict indicators is as follows:
[0095] Because the exiD dataset contains real-time TTC values for both the vehicle and the preceding vehicle during motion, calculating the TTC value for rear-end collisions is relatively simple. Identifying rear-end collisions requires only finding the minimum TTC value during a complete following maneuver and recording the time and corresponding TTC value of this minimum. This data serves as an important indicator for extracting traffic flow features for subsequent rear-end collision samples. The extraction process first iterates through all leading vehicle IDs and checks whether there is a preceding vehicle. If there is no preceding vehicle, a rear-end collision will not occur. If there are multiple preceding vehicle IDs, the system iterates through these preceding vehicle IDs one by one, querying all the leading vehicle's TTC values at that time, and recording the minimum value and its corresponding time. This method, after traversing all vehicles, yields the potential TTC values for all vehicles in a rear-end collision.
[0096] The key to calculating the PET index value for lane change conflict is to accurately determine the moment when the main vehicle (SV) involved in the lane change and the following vehicle (FV) or the leading vehicle (LV) in the target lane pass through the intrusion line. When calculating the PET values of the SV and the target lane FV, the midpoint of the rear of the vehicle at the moment when the SV successfully enters the target lane is used as the position of the intrusion line. However, in the exiD dataset, each vehicle trajectory coordinate actually represents the geometric center point of the vehicle. Therefore, whether the vehicle enters the target lane should be determined based on whether its geometric center point crosses the lane boundary line. In order to improve the calculation accuracy of the PET values of SV and FV, this embodiment takes into account the influence of the length and heading angle of the vehicle when defining the intrusion line and the FV reference line. Figure 5 As shown in (a), assuming that the SV enters the target lane at time T1, the coordinates of its geometric center point are (X1, Y1), and the vehicle heading angle is θ, then the X-axis coordinate of the intrusion line can be expressed as:
[0097]
[0098] Where θ represents the heading angle (°) when the SV enters the target lane, and L1 represents the length of the SV vehicle (m).
[0099] Assuming the real-time geometric center coordinates of the target lane FV are (X2, Y2), the vehicle head position is used as the reference line to determine whether the FV has passed the intrusion line. The X-axis coordinates of the target lane FV reference line are:
[0100]
[0101] Where L2 is the vehicle width of the target lane FV (m).
[0102] During the FV driving process, when the X-axis coordinate X of the FV reference line f Greater than X q When , record this moment as T2, then the time difference between T2 and T1 is the PET value t1 of SV and target lane FV.
[0103] Similarly, when calculating the PET values of the SV and the target lane LV, the midpoint of the vehicle head when the SV successfully enters the target lane is used as the intrusion line position, such as Figure 5 As shown in (b), assuming that the SV enters the target lane at time T3, the coordinates of its geometric center point are (X1, Y1), and the vehicle heading angle is θ, then the X-axis coordinate of the intrusion line can be expressed as:
[0104]
[0105] Assuming that the real-time geometric center coordinates of the target lane LV are (X3, Y3), the rear position of the vehicle is used as the reference line to determine whether LV has passed the intrusion line. The X-axis coordinates of the reference line of the target lane LV are:
[0106]
[0107] Where L3 represents the vehicle length in the target lane LV (m).
[0108] During LV driving, when the X-axis coordinate X v Greater than X q When t1 is reached, record this moment as T4. The time difference between T3 and T4 is the PET value t2 between SV and the target lane LV. Compare t1 and t2 and retain the smaller value as the PET value for the lane change conflict event.
[0109] During the data extraction process, PET values are calculated using the following steps: First, all lane-changing maneuvers are filtered out using the laneChange parameter in the exiD dataset. Second, the PET values for the FV and LV in both the host vehicle and target lanes are calculated using the aforementioned method. (If both exist, the smaller value is retained as the PET value for that lane-changing maneuver.) Once the PET values for all host vehicle lane-changing maneuvers are calculated, the PET values for all potential lane-changing conflicts are obtained.
[0110] Regarding the TTC and PET metrics, smaller values indicate closer temporal and spatial proximity between the active vehicle (the vehicle involved in the collision) and surrounding vehicles, and a higher degree of danger. After calculating the TTC and PET metrics, an appropriate threshold is selected to define the severity of the collision. Events below this threshold are defined as severe collisions.
[0111] This embodiment uses the traditional cumulative frequency curve method to determine the conflict threshold. The specific steps include: first, the two types of conflict index values are processed as negative values; second, the 85% percentile value is selected as the classification standard for severe conflicts. Figure 6 As shown, the 85% percentile values of -PET and -TTC are set as thresholds, resulting in a threshold combination of TTC = 2.0s & PET = 0.55s. In addition, to further distinguish between conflicting events and non-conflicting events, this embodiment also selects a lower threshold combination (TTC = 1.5s & PET = 0.50s) to evaluate model prediction performance and guide threshold selection.
[0112] Once the conflict samples needed for modeling are identified, in order to establish the connection between traffic variables and conflicts, it is necessary to extract traffic flow characteristics before the conflict samples occurred. Based on the constructed real-time conflict prediction framework, traffic flow characteristics are extracted by road section and lane.
[0113] To extract traffic flow features from conflict samples, we first need to locate the lane involved in the conflict. Based on the zero time of the conflict, we filter the trajectory data for the lane involved and surrounding lanes during the traffic flow detection period. If the conflict occurs at a merging section, we further filter the trajectory data from the ramp. Next, based on the selected trajectory data for the corresponding lane, we utilize the previously proposed virtual upstream and downstream detector method to extract lane-level upstream and downstream traffic flow features. This method uses virtual detectors to capture the driving status of upstream and downstream vehicles, thereby obtaining key features such as traffic flow, speed, and standard deviation.
[0114] To extract traffic flow features for non-conflict samples, trajectory data at the time of rear-end collisions and lane-changing conflicts is first deleted. Next, the remaining trajectory data is randomly divided into time segments. Within each time segment, the primary lane is selected from each road segment to extract upstream and downstream traffic flow features. In this embodiment, the merging areas selected based on the exiD dataset all have two main lanes. The primary lanes for non-conflict samples are selected as follows: In the upstream and downstream sections, one lane is randomly selected from either the inner or outer lane to extract non-conflict samples. In the merging section, both the inner and outer lanes are designated as the primary lanes for extracting non-conflict samples. This is because the model inputs for merging sections differ significantly due to the presence of ramps. However, for both upstream and downstream sections, when generating non-conflict observation samples, the model inputs for the inner and outer lanes have a high linear correlation. Using both lanes as primary lanes for extracting non-conflict observation samples could seriously affect the effectiveness of model training. Therefore, to ensure that the extracted non-conflict samples can effectively support model training, this embodiment adopts the aforementioned method for selecting primary lanes to improve sample independence and representativeness.
[0115] (2.1) Gated-Transformer model reconstruction
[0116] Compared with the original Transformer architecture, the Gated-Transformer architecture mainly includes three key components: an embedding layer, a two-tower structure, and a gating mechanism. In time series classification tasks, the concept of "channel" is crucial. It specifically refers to the representation of independent variables or features in a time series dataset. In this embodiment, traffic variables are regarded as "channels" in a time series, and each "channel" represents a different traffic variable. By introducing a sliding time window, one-dimensional traffic flow features can be converted into a high-dimensional traffic flow time series. By treating traffic variables as channels of a time series, a Gated-Transformer feature extraction network for real-time conflict prediction is established, such as Figure 7 shown.
[0117] Embedding layer: This embodiment replaces the embedding layer with a fully connected linear layer to better adapt to the distribution characteristics of time series. In addition, the Gated-Transformer uses the nonlinear activation function tanh instead of the traditional linear projection to enhance the nonlinear expression capability of the model. Consistent with the original Transformer architecture, this embodiment introduces positional encoding in the post-nonlinear transformation of time series data to explicitly encode temporal information.
[0118] Dual-Tower Architecture: The dual-tower architecture is a framework designed for multivariate time series, aiming to independently capture the correlation between temporal and channel information in multivariate time series. This architecture is the core component of the Gated-Transformer network and consists primarily of a channel encoder and a step encoder. Within each tower, the encoder captures temporal and channel correlations through attention and masking mechanisms. The channel encoder is primarily responsible for calculating attention weights for various traffic variables. Since the spatial position of traffic variables does not affect the calculation of weights, positional encoding is not required before the channel encoder. The step encoder employs a masked multi-head attention mechanism to calculate pairwise attention weights across all time steps, effectively encoding the temporal characteristics of traffic flow. Similar to the original Transformer architecture, each encoder utilizes multi-head attention to process the input sequence and passes its output to an enhanced feedforward neural network. To ensure the stability and better convergence of the training process, residual connections are used around each sublayer and combined with layer normalization technology. In addition, in order to further enhance the ability of the dual-tower structure in extracting complex features, this embodiment adopts a layer stacking design strategy. Specifically, Channel-wise Encoder and Step-wise Encoder process vector inputs in a parallel manner, and each branch realizes feature extraction and representation learning by stacking N layers with the same structure. This parallel stacking structure can not only promote feature interaction and fusion between the two branches, but also effectively improve the model's ability to extract multi-level features.
[0119] Gating mechanism: Gated-Transformer uses a direct gating mechanism to integrate the features of the two towers, which represent the temporal and channel correlations respectively. The specific expressions of the gating mechanism are shown in formulas (6) to (8). After obtaining the output of each tower, the output of the two encoders is first processed by a fully connected layer with a nonlinear activation function to produce feature representations C and S. Secondly, the two feature representations are cascaded and the final feature representation h is obtained by linear projection. On this basis, the gating weights g1 and g2 are calculated using the Softmax function. Each gating weight is then multiplied by the output of the corresponding tower and finally encapsulated into a comprehensive output vector y.
[0120] h=w·Concat(C,S)+b (6)
[0121] g1,g2=Softmax(h) (7)
[0122] y=Concat(C·g1+S·g2)(8)
[0123] Where C and S are the feature outputs of the Channel-wise encoder and Step-wise encoder respectively, w represents the weight matrix, b represents the bias vector, h represents the output of the linear connection layer, g1 and g2 represent the gating weights, and y represents the feature vector of the final packaged output.
[0124] (2.2) Construction of real-time conflict prediction transfer learning architecture
[0125] Due to differences in road infrastructure, environmental conditions, and traffic management measures (such as speed limits and lane-changing prohibitions), traffic flow distribution characteristics often vary significantly across locations. This variability results in a significant decrease in prediction accuracy when a real-time conflict prediction model trained at one location is transferred to a new location, limiting the model's portability. Therefore, building a highly portable real-time conflict prediction model by matching traffic flow characteristics across different scenarios would be cost-effective and practical. Transfer learning effectively transfers knowledge by exploiting data similarities between different domains, enabling pre-trained models to quickly adapt to new domains and significantly improving the model's portability and generalization capabilities.
[0126] This embodiment adopts the method of adding adaptation layers and building an independent transfer learning architecture based on the adaptation layers. The adaptation layers can not only improve the generalization ability of the model, but also effectively reduce the risk of overfitting.
[0127] In transfer learning, source domain and target domain are basic concepts. The source domain specifically refers to the dataset or environment used for the initial pre-training of the model, while the target domain refers to the new dataset or environment to which the model will be applied. In this embodiment, the source domain and target domain are distinguished by different confluence area locations. The source confluence area location used for model training is the source domain D s , the source domain data can be expressed as:
[0128]
[0129] in, Represents multidimensional traffic flow time series data, which is an N×K dimensional matrix, where N represents the number of sliding time windows within the traffic flow detection time, and K represents the number of traffic variables. Is the conflict label, 1 represents a conflict, 0 represents no conflict, n sRepresents the number of source domain samples. The new location used to test the model's prediction performance and portability is defined as the target domain. The target domain data can be expressed as:
[0130]
[0131] in, Represents the target domain multidimensional traffic flow time series data, n t Represents the number of samples in the target domain. Since the target domain has no conflicting labels, prediction is required. The traffic flow time series data of the source domain and the target domain are input into the feature extraction network. Through forward propagation, the source domain and target domain feature data X can be obtained. s 、X t , as defined in equations (11) and (12) respectively.
[0132]
[0133] In transfer learning, choosing an appropriate difference metric is crucial, as it directly determines the accuracy of the similarity assessment between the source and target domains. The commonly used Maximum Mean Discrepancy (MMD) is a kernel-based learning method that calculates the distance between two distributions in a regenerated Hilbert space. As a non-parametric method, MMD is independent of specific distributions and is applicable to a wide range of data types. Furthermore, MMD is highly scalable and can be combined with a variety of machine learning algorithms.
[0134] Based on these advantages, this example uses MMD as a metric to measure the difference in data distribution between the source and target domains, thereby ensuring that the model can effectively utilize the similarities between traffic flow characteristics at different locations during the knowledge transfer process. MMD is calculated according to formula (13). If the result is 0, it means that the data distribution of the source and target domains is the same.
[0135]
[0136] Where H represents the regenerated Hilbert space; Represents a mapping function.
[0137] The mapping function can map traffic flow characteristic data to the regenerated Hilbert space. The key to the MMD method is how to determine the appropriate mapping function For ease of calculation, square equation (13) to obtain the following result:
[0138]
[0139] Introducing kernel function simplification The present embodiment uses the Gaussian kernel function as the kernel function of the MMD method, which is expressed as follows:
[0140]
[0141] Where k(u·v) is a monotonic function of the Euclidean distance from any point u to the center point v in space, and σ is the bandwidth. Substituting formula (15) into formula (14), we can obtain a measure of data distribution differences:
[0142]
[0143] In the design of the transfer learning architecture, this example constructs a two-step difference optimization framework to integrate the goal of minimizing the difference in traffic flow distribution between the source and target domains into the optimization process of the feature extraction network. This framework effectively narrows the feature distribution gap between the source and target domains by embedding an adaptive layer in the feature extraction network, significantly improving the model's cross-domain generalization capabilities.
[0144] In this embodiment, the terminal output layer of the feature extraction network is defined as the first adaptive layer. In addition, in order to further constrain the difference between the feature distribution of the source domain and the target domain, this embodiment adds a fully connected linear layer as the second adaptive layer after the feature extraction network. Both adaptive layers use the MMD method to measure the difference in feature distribution between the source domain and the target domain. Through this two-step optimization mechanism, a complete transfer learning architecture is constructed, as shown in the schematic diagram of the architecture. Figure 8 In this architecture, the adaptive layers corresponding to the target domain and the source domain share the same set of weight coefficient matrices and bias vectors to achieve weight sharing.
[0145] The steps of implementing this architecture in the model training process are as follows: First, the labeled source domain data D s Input feature extraction network to obtain feature data X s ; Then, the target domain data D without labels t Also input the feature extraction network to obtain feature data X t ; Secondly, use the MMD method to calculate the difference L' between feature data mmd ; Again, the source domain feature number X s Input linear layer processing to obtain new feature representation X' s , the target domain feature data is also input into the linear layer for processing, and X' is obtained t , also use the MMD criterion to measure the difference and get L" mmd , L' mmd and L" mmdThe transfer loss guides the model optimization process, gradually reducing the distribution difference between the source and target domains. Softmax is then used as a normalization function to output the predicted probabilities of conflict and non-conflict events. Finally, the larger of these two probabilities is compared and used as the conflict prediction result. A predicted value of 0 indicates no conflict, while a value of 0 indicates conflict.
[0146] (2.3) Loss function construction
[0147] In transfer learning, the design of the loss function is particularly important because it directly affects the knowledge transfer effect between the source task and the target task. The loss function constructed in this embodiment mainly consists of two parts: the classification prediction loss of the source domain data and the transfer loss of the two adaptive layers, as shown in Equation (17).
[0148]
[0149] Where, Represents the classification prediction loss of source domain data; Indicates the true conflict label (0 or 1); Indicates the predicted conflict label (0 or 1); Represents the migration loss of adaptive layer 1; Loss mmd (X' s ,X' t ) represents the migration loss of adaptive layer 2; λ1 and λ2 represent the weight coefficients related to the migration loss
[0150] The classification prediction loss is calculated using the Focal Loss loss function, and the adaptive layer migration loss is solved according to formula (16). After the source and target domain data are input into the feature extraction network for processing, the corresponding feature data and prediction values are obtained, and the total loss value is calculated using formula (17). Through backpropagation, the network continuously optimizes the weight matrix and bias vector, thereby achieving accurate prediction of conflict events and effectively reducing the difference between the feature data distribution of the source and target domains.
[0151] To address the imbalance between conflict and non-conflict events, this embodiment introduces Focal Loss as a loss function for classification prediction. Focal Loss is introduced based on the binary cross entropy (CE) loss function, which is generally expressed as:
[0152]
[0153] Where L represents the loss function; N represents the number of samples; y i represents the true label of the i-th sample (0 or 1); represents the predicted probability of the i-th sample (0 or 1).
[0154] For the sake of notation, assume that p t :
[0155]
[0156] At this time, the cross entropy loss of a single sample can be recorded as CE(p t ):
[0157] CE(p t )=-log(p t ) (20)
[0158] The dynamic adjustment scaling factor introduced by Focal Loss can be expressed as (1-p t ) γ , introducing it into the cross entropy loss, we can get the Focal Loss loss function:
[0159] FL(p t )=-(1-p t ) γ log(p t ) (twenty one)
[0160] Where FL represents the Focal Loss function; γ represents the focusing parameter.
[0161] The introduced scaling factor dynamically adjusts the sample's contribution to the loss based on the degree of discrepancy between the predicted result and the true label. When the difference between the predicted result and the true label is small, the sample's weight in the loss function is reduced; conversely, when the difference increases, the sample's loss weight is increased. The focusing parameter γ controls the strength of this adjustment. A larger γ value increases the adjustment force, and the model's attention to difficult samples is also increased. When γ = 0, Focal Loss degenerates into traditional cross-entropy loss. Therefore, by properly selecting the value of γ, the model's learning strategy can be effectively adjusted, significantly improving the prediction ability of minority class samples (conflict events).
[0162] In order to improve the efficiency of parameter optimization, this embodiment uses the Bayesian optimization method to find the optimal migration loss weight coefficients λ1 and λ2. In the Bayesian optimization method, the objective function is first selected. The objective function is usually to minimize the negative performance index f(λ1,λ2) = -performance(λ1,λ2) on the validation set, that is, to maximize the performance index of the model on the validation set (such as accuracy, F1 score, etc.). The core of Bayesian optimization is to model the objective function f(λ) through a Gaussian process (GP). Assume that f(λ) obeys the Gaussian process with a mean of zero as shown in formula (22):
[0163] f(λ)~GP(0,k(λ,λ')) (22)
[0164] Among them, the kernel function k(λ,λ') uses the radial basis function (RBF):
[0165]
[0166] Where l represents the length scale parameter, which controls the smoothness of the function.
[0167] This kernel function can measure the similarity between two weight combinations λ and λ'. When selecting the next weight combination to be evaluated, an acquisition function needs to be defined to explore the uncertainty region. The expected improvement function (EI) is an acquisition function commonly used in Bayesian optimization. Its mathematical form is:
[0168] α EI (λ)=E[max(f min -f(λ),0)] (24)
[0169] Among them, f min is the current optimal observation value. Under the Gaussian process assumption, EI can be analytically expressed as:
[0170] α EI (λ)=(f min -u t (λ)-ξ)Φ(Z)+σ t (λ)ψ(Z) (25)
[0171]
[0172] Where Φ(·) represents the cumulative distribution function of the standard normal distribution; ψ(·) represents the probability density function of the standard normal distribution; and ξ represents the exploration coefficient, which is used to adjust the exploration intensity of the unknown area.
[0173] The Bayesian optimization process gradually approaches the optimal weight combination by continuously iteratively updating the Gaussian process and acquisition function. The specific steps for performing Bayesian optimization are as follows:
[0174] (1) Randomly sample N initial points in the weight search space (e.g. N = 10), for each initial point, train the model and calculate the validation set performance f(λ i ).
[0175] (2) Perform iterative optimization (t=N+1, N+2, ..., T):
[0176] (a) Based on the current observation dataset Fitting a Gaussian process.
[0177] (b) By optimizing the acquisition function α EI (λ), select the next candidate point:
[0178] λ t+1 =argmax(α EI (λ)) (27)
[0179] (c) In λ t+1 Train the model and calculate f(λ t+1 ).
[0180] (d) Update dataset D t+1 =D t ∪{(λ t+1 ,f(λ t+1 ))}.
[0181] (3) Iteration terminates. When the maximum number of iterations is reached or the objective function value converges, the optimal weight is output.
[0182] (3.1) Construction of deep transfer learning conflict prediction model
[0183] In order to verify the effectiveness and reliability of the deep transfer learning method proposed in this application in improving the portability of the real-time conflict prediction model, this embodiment designs a method verification framework. Figure 9 As shown in the figure, the exiD dataset is used as the trajectory data source, and different merging areas are selected and divided into source domains and target domains. The source domain data is used to build the model training set, while the target domain data is used as an independent test set.
[0184] The deep transfer learning method proposed in this embodiment mainly consists of a feature extraction network and a transfer learning architecture. In terms of portability evaluation, this embodiment adopts a cross-domain prediction performance comparison method for evaluation. This method evaluates the portability of the model by quantitatively analyzing the performance indicator differences of the source domain training model on the target domain test set: if the performance of the source domain training model in the target domain test is significantly reduced, it indicates that its portability is poor; conversely, if the performance remains stable, it proves that the proposed method has effectively improved the scenario adaptability and portability of the real-time conflict prediction model.
[0185] In terms of the selection of evaluation indicators, this embodiment constructs a multi-dimensional evaluation system and selects three types of indicators: precision, recall, and F1 score to comprehensively quantify the predictive performance of the model. Based on the characteristics of independent design of the transfer learning architecture and the feature extraction network, this embodiment conducts comparative experiments on four types of feature extraction networks (FCN, LSTM-FCN, MLSTM-FCN, and Gated-Transformer). Specifically, each network architecture independently conducts two groups of verification experiments: the control group only uses the original network for training, and the experimental group adds a transfer learning architecture on this basis. By comparing the performance indicator differences between the two groups of models in the target domain, the improvement of the model portability by the proposed deep transfer learning method is quantitatively analyzed.
[0186] This example uses source domain data as the training set and target domain data as the test set. A 6-second sliding window and a 5-second warning time were selected to evaluate the predictive performance of various deep learning models, both without and with the transfer learning framework. The experimental results are detailed in Table 1. Furthermore, Table 2 shows the improvement in predictive performance of different deep learning models after adding the transfer learning framework.
[0187] Table 1 Comparison of model prediction performance before and after adding transfer learning architecture
[0188]
[0189] Figure 10 The prediction performance of each model without the introduction of a transfer learning architecture is presented. Experimental data shows that without the addition of a transfer learning architecture, the prediction performance of each model in the target domain did not meet expectations, with both precision and recall rates below 0.8. A horizontal comparison of the prediction performance of each model reveals that under two sets of conflicting threshold conditions, the Gated-Transformer model demonstrates stronger feature extraction capabilities and prediction performance, with relatively higher precision and recall rates. Specifically, at the thresholds TTC = 2.0s & PET = 0.55s, the F1 score of the Gated-Transformer model reached 0.761; at the thresholds TTC = 1.5s & PET = 0.50s, its F1 score reached 0.768.
[0190] Table 2: Model prediction performance improvement after adding transfer learning architecture
[0191]
[0192] The above experimental results verify that when a real-time conflict prediction model trained in the source domain is directly transplanted to the target domain, the model's prediction performance will significantly degrade, demonstrating poor portability. This finding also emphasizes the necessity of introducing transfer learning technology to improve the prediction performance of real-time conflict prediction models in the target domain.
[0193] Figure 11 Comparative analysis validated the transfer learning architecture's effectiveness in improving model performance under the current dataset. Experimental data (see Tables 1 and 2) demonstrate that the introduction of the transfer learning architecture significantly improved the overall performance of all models, with varying degrees of improvement in F1 score, precision, and recall. Specifically, the FCN model experienced relatively limited F1 score improvements (less than 7%) under the two conflict thresholds, while the deep LSTM-FCN, MLSTM-FCN, and Gated-Transformer models exhibited significant performance improvements. The LSTM-FCN and MLSTM-FCN models achieved average F1 score improvements of 10.2% and 10.0%, respectively, under the two thresholds, while the Gated-Transformer model achieved the best performance with an average increase of 11.9%. Notably, the Gated-Transformer model achieved the best prediction performance under the conflict threshold combination of TTC = 1.5s and PET = 0.50s, achieving an F1 score of 0.864.
[0194] Experimental results show that the transfer learning architecture proposed in this embodiment can effectively improve the prediction performance of the pre-trained model in the target domain and improve the portability of the real-time conflict prediction model. In addition, the Gated-Transformer model outperforms the other three baseline models due to its advantages such as gating mechanism and parallel feature extraction, and is the most suitable feature extraction network for integration into the transfer learning architecture. In addition, in terms of conflict threshold selection, the prediction performance is optimal under the conflict threshold combination of TTC = 1.5s & PET = 0.50s. This threshold can be used as a priority configuration parameter for building a real-time conflict prediction model for real-world application scenarios, especially in scenarios with high incidence of traffic conflicts such as road merging areas.
[0195] The above experiments demonstrate that the proposed deep transfer learning method effectively improves the portability of the real-time conflict prediction model. This example will analyze the real-world application scenarios of the real-time conflict prediction model by combining it with real-world traffic control measures and intelligent traffic equipment, and further expand and optimize its application boundaries and functionality.
[0196] To ensure the accuracy of conflict prediction, this embodiment sets the warning time to 5 to 6 seconds. The setting of this time parameter poses a challenge to traditional intelligent traffic control measures. Traditional measures such as dynamic speed limit and ramp flow control usually require a long time of traffic flow regulation to ensure operational safety, and the response speed has exceeded the time requirement of short-term warning. On the contrary, short-term conflict warning is more in line with the technical characteristics of the vehicle-to-infrastructure (V2I) communication environment. Its low latency and highly reliable information interaction capabilities can effectively support the closed-loop implementation of real-time risk warning and vehicle control decision-making. Therefore, this embodiment will design a real-time conflict risk warning scenario in the merging area based on V2I communication.
[0197] In the real-time conflict prediction modeling process, this embodiment uses trajectory data collected from camera-equipped drones to extract traffic flow information. However, considering the feasibility of practical applications, relying on drone aerial photography to obtain real-time traffic flow data is not practical. To address this technical bottleneck, this embodiment uses smart cameras or radar detectors, which are commonly used in smart highway systems with V2I communication, to obtain real-time traffic flow data. Figure 12 This paper demonstrates a real-world application scenario of the real-time conflict prediction model designed in this paper. In this scenario, intelligent roadside units (RSUs) are installed along the road. These RSUs integrate a variety of intelligent devices, including cameras, radar, and other data acquisition tools, and possess edge computing and communication capabilities. Furthermore, this scenario not only provides real-time conflict warnings for intelligent vehicles equipped with V2I communication equipment but also provides avoidance strategies for conventional vehicles through variable message signs (VMS).
[0198] The practical application process of this scenario is as follows: First, real-time lane-level traffic flow characteristics are collected through data collection tools in the RSUs, or directly using traditional loop detectors. These devices continuously monitor traffic flow conditions and transmit relevant data to edge computing devices. Next, a real-time conflict prediction model embedded in the edge computing device instantly calculates the probability of a conflict event occurring in 5-6 seconds. If a potential conflict is predicted, the system sends a warning message via real-time communication devices to promptly alert the vehicle or driver. These warnings prompt the driver to take appropriate safety measures, such as reducing speed, increasing vigilance, and implementing risk-avoidance maneuvers, to avoid potential conflicts. Furthermore, for autonomous vehicles equipped with advanced driving assistance systems (ADAS), these warnings can be combined with the vehicle's automatic control system to implement more proactive intervention measures, such as automatic deceleration and route adjustment. At the same time, warning information will also be sent to the VMS, which is deployed on the gantry at the end of each section of the merging area. When a conflict occurs in a lane, the VMS will alert the drivers of traditional vehicles in the corresponding lane by flashing lights, making them aware of the potential risk of conflict and taking timely risk-avoidance measures.
Claims
1. A real-time conflict prediction method for highway merging areas based on deep transfer learning, characterized by: The steps include: S1. Build a real-time conflict prediction framework and extract data, including: S11. Based on traffic conflict theory and the traffic operation characteristics of the area, the conflict types in the merging area of highways are divided into rear-end collision conflicts and lane change conflicts, using time to collision (TTC) and time to intrusion (PET) as measurement indicators respectively. S12. Introducing a sliding window mechanism to extract time-varying characteristics of traffic flow and constructing a real-time conflict prediction framework for highway merging areas; S13. Select the exiD dataset as the trajectory data source and extract the severe conflict samples and traffic flow characteristics required for modeling; S2. Establish a deep transfer learning method for real-time conflict prediction, specifically including: S21. Considering traffic variables as channels of time series, we reconstruct the Gated-Transformer model as a feature extraction network to obtain the potential correlation features between traffic variables and conflicts. S22. Build an independent transfer learning architecture, use the maximum mean difference method to measure the difference in feature data distribution between the source and target domains, and use a two-step difference optimization framework to achieve model knowledge transfer; S23. Design a loss function for the model, use Focal Loss to calculate the classification prediction loss, and use the Bayesian optimization algorithm to determine the optimal migration loss weight; S3. Build a prediction model based on deep transfer learning and implement real-time conflict prediction in highway merging areas based on the prediction model.
2. The method for real-time conflict prediction in highway merging areas based on deep transfer learning according to claim 1 is characterized in that: In step S11, the time-to-collision (TTC) indicator represents the time required for two vehicles to collide if they maintain their current speed and path. Multiple TTC values are generated during continuous driving, and the minimum TTC value is recorded. The moment when the minimum value occurs is considered the most dangerous time point for a rear-end collision. In the PET metric, PET represents the time difference between the rear end of the leading vehicle leaving the conflict zone and the front end of the following vehicle arriving at the conflict zone. Assume that the lane-changing vehicle is denoted as SV, the following vehicle in the target lane is denoted as FV, and the leading vehicle is denoted as LV. The PET calculation process for lane-changing conflicts between SV and FV in the target lane is as follows: The time when the SV successfully enters the target lane is T1. The tail of the SV is the intrusion line position at this time, and the front end of the FV passes the intrusion line at T2. The time difference between T2 and T1 is the conflict time PET. The time when the SV successfully enters the target lane is T3. The head of the SV is the intrusion line position at this time, and the rear end of the LV passes the intrusion line at T4. The time difference between T3 and T4 is the conflict time PET between the lane-changing vehicle and the leading vehicle in the target lane. Each lane-changing conflict event may generate two PET values, and the smaller value is taken as the lane-changing conflict.
3. The real-time conflict prediction method for highway merging areas based on deep transfer learning according to claim 2 is characterized in that: In step S11, the method for classifying rear-end collision and lane-changing conflict is as follows: First, the temporal proximity of the conflicting vehicles at any moment is calculated based on the continuous vehicle trajectory data; Secondly, the moment with the smallest time proximity is defined as the most dangerous time point. The definition of the most dangerous time point is different for different conflict types. The most dangerous time point for rear-end collision is defined as the moment with the minimum TTC value T f The most dangerous time point of lane change conflict is defined as the moment when the lane-changing vehicle enters the target lane T p , when T f Less than T p , the collision event is recorded as a rear-end collision; when T p Less than T f , at this time, the conflict event is recorded as a lane-changing conflict.
4. The real-time conflict prediction method for highway merging areas based on deep transfer learning according to claim 1 is characterized in that: Step S12 specifically includes: First, vehicle trajectory data is obtained. After the trajectory data is extracted, TTC and PET are selected as conflict metrics to identify rear-end collisions and lane change conflicts, respectively, and to locate the road section and lane where the conflict occurred. Secondly, the upstream and downstream traffic flow characteristics of the road section before the conflict event are extracted to obtain conflict samples. The trajectory data before the conflict event is deleted, and the remaining trajectory data is randomly divided into different time segments. Non-conflict samples are extracted on the road section within each time segment. When extracting traffic flow features, the traffic flow detection time is set, and a sliding time window is added within the traffic flow detection time period. The fixed detection time period is divided into multiple "small intervals". Traffic flow features are extracted separately in each "small interval" to obtain the time-varying traffic flow characteristics. Finally, a real-time conflict prediction model is constructed based on deep learning technology by utilizing the time-varying characteristics of traffic flow corresponding to conflict samples and non-conflict samples.
5. The real-time conflict prediction method for highway merging areas based on deep transfer learning according to claim 1 is characterized in that: In step S13, the method for extracting severe conflict samples is as follows: The TTC and PET index values were calculated based on the parameters in the exiD dataset. The negative values of the two types of conflict index values were processed. The 85% percentile was selected as the criterion for severe conflict. The conflict threshold was determined, and events below the threshold were defined as severe conflict events.
6. The real-time conflict prediction method for highway merging areas based on deep transfer learning according to claim 1 is characterized in that: In step S21, the Gated-Transformer model reconstruction method is as follows: For the embedding layer: the embedding layer is replaced with a fully connected linear layer to better adapt to the distribution characteristics of time series. The nonlinear activation function tanh is used to replace the traditional linear projection to enhance the nonlinear expression ability of the model. Positional encoding is introduced in the post-nonlinear transformation of time series data to explicitly encode time information. For the dual-tower structure: It consists of a channel encoder and a step encoder. The channel encoder is used to calculate the attention weights of various traffic variables. The step encoder uses a masked multi-head attention mechanism to calculate pairwise attention weights across all time steps. The channel encoder and the step encoder process the vector input in parallel. Each branch implements feature extraction and representation learning by stacking N layers with the same structure. For the gating mechanism: After obtaining the output of each tower, the output of the two encoders is first processed through a fully connected layer with a nonlinear activation function to generate two features. Secondly, the two feature representations are cascaded and the final features are obtained through linear projection. On this basis, the gating weight is calculated using the Softmax function. Each gating weight is then multiplied by the output of the corresponding tower and finally encapsulated into a comprehensive output vector.
7. The method for real-time conflict prediction in highway merging areas based on deep transfer learning according to claim 1, characterized in that: In step S22, an adaptive layer is added and an independent transfer learning architecture is constructed based on the adaptive layer. The maximum mean difference (MMD) is selected as the metric for the data distribution difference between the source domain and the target domain. The Gaussian kernel function is used as the kernel function of the MMD. The metric calculation formula for the data distribution difference is as follows: Where, X s 、X t Represents the source domain and target domain feature data respectively, n s Indicates the number of source domain samples, n t represents the number of samples in the target domain, H represents the regenerated Hilbert space, x si represents the i-th data sample in the source domain, x sj represents the jth data sample in the source domain, x tj represents the i-th data sample in the target domain, x ti The jth data sample in the target domain, k(·) represents the Euclidean distance between samples.
8. The method for real-time conflict prediction in highway merging areas based on deep transfer learning according to claim 7, characterized in that: In step S22, the terminal output layer of the feature extraction network is defined as the first adaptive layer. A fully connected linear layer is added after the feature extraction network as the second adaptive layer. Both adaptive layers use the MMD method to measure the difference in feature distribution between the source domain and the target domain. Through the above two-step optimization mechanism, a complete transfer learning architecture is constructed. The steps of implementing the architecture during the model training process are as follows: First, the labeled source domain data is input into the feature extraction network to obtain feature data; then, the unlabeled target domain data is also input into the feature extraction network to obtain feature data; secondly, the MMD method is used to calculate the difference between the feature data; thirdly, the source domain feature number is input into the linear layer for processing to obtain new features, and the target domain feature data is also input into the linear layer for processing to obtain new features. The MMD criterion is also used to measure the difference. The measured difference is used as the migration loss to guide the model optimization process, and gradually reduce the distribution difference between the source domain and the target domain; then, Softmax is used as the normalization function to output the predicted probability of conflict events and non-conflict events; finally, by comparing the two probabilities, the larger value is taken as the conflict prediction result.
9. The method for real-time conflict prediction in highway merging areas based on deep transfer learning according to claim 8, characterized in that: In step S23, the Focal Loss loss function expression is as follows: FL(p t )=-(1-p t ) γ log(p t ) In the formula, FL represents the Focal Loss loss function, γ represents the focus parameter, and p t The expression is as follows: Where y i represents the true label of the i-th sample, represents the predicted probability of the i-th sample.
10. The method for real-time conflict prediction in highway merging areas based on deep transfer learning according to claim 8, characterized in that: In step S23, the Bayesian optimization algorithm is used to determine the optimal migration loss weight, as follows: (1) Randomly sample N initial points in the weight search space, train the model for each initial point and calculate the validation set performance; (2) Perform iterative optimization: (a) Fitting a Gaussian process based on the current observation dataset; (b) Select the next candidate point by optimizing the acquisition function: (c) Train the model at the next candidate point and calculate the validation set performance; (d) Update the dataset; (3) Iteration termination: when the maximum number of iterations is reached or the objective function value converges, the optimal weight is output.
Citation Information
Cited By
Health service data management method based on machine learning
CN121054264A