A method and system for warning of lane-changing accident risk in a weaving area on a highway based on vehicle trajectory data

CN121305922BActive Publication Date: 2026-10-23SOUTHEAST UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511607981.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-05
Publication Date
2026-10-23
Estimated Expiration
2045-11-05

AI Technical Summary

Technical Problem

此外,随着深度学习的发展,结合时空神经网络进行交通行为分析成为趋势,但对于复杂路段(如交织区)仍缺乏有效模型

Benefits of technology

[0061]有益效果:本发明能够充分挖掘车辆轨迹数据的空间和时序特征,提高识别精度。同时采用大样本与小样本相结合的训练策略,避免了仅使用交织区稀缺样本带来的过拟合风险,增强了模型对未知场景的适应性,本发明提出一种多任务类平衡(Multi-Task FocalLoss)结合不确定性加权(Uncertainty-weighted)的训练损失函数设计,可以针对交织区事故样本稀疏性有效训练,该复合损失可同时解决事故类别长尾、多任务权衡、事故-非事故样本数不平衡与难样本聚焦问题,适合交织区稀缺事故场景。最终,本发明可实现对交织区换道事故风险的实时预测与预警,提高了高速公路安全管理的效率和准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121305922B_ABST
    Figure CN121305922B_ABST
Patent Text Reader

Abstract

The application provides a highway interweaving area lane changing accident risk early warning method and system based on vehicle trajectory data, specifically: collecting relevant information of vehicles on the whole route and in the interweaving area of the highway; preprocessing the collected data, enhancing the lane changing accident data samples of the interweaving area road section after preprocessing to obtain new samples; merging the new samples with the original lane changing accident data samples to obtain a merged training set; extracting the spatial features of the training set; inputting the spatial features into an improved Transformer model to obtain features containing time dynamics, obtaining lane changing risk prediction values and prediction values of auxiliary tasks; and training the model for extracting the spatial features of the training set and the improved Transformer model based on a multi-task class balance and uncertainty weighted loss function. The application improves the efficiency and accuracy of highway safety management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of traffic engineering, and in particular relates to a method and system for early warning of lane-changing accident risks in highway weaving areas based on vehicle trajectory data. Background Technology

[0002] Weaving zones are a typical type of road segment on highways, characterized by vehicles needing to simultaneously merge and change lanes at ramps and exits, resulting in complex traffic flow characteristics and a high risk of traffic accidents. Current technologies for analyzing highway safety risks primarily focus on macroscopic traffic parameters or overall road segment flow assessments. Existing lane-change risk assessment and accident warning methods largely rely on rules or traditional machine learning methods, fitting accidents using alternative risk indices. Furthermore, with the development of deep learning, combining spatiotemporal neural networks for traffic behavior analysis has become a trend, but effective models are still lacking for complex road segments (such as weaving zones). Limited spatiotemporal feature extraction capabilities prevent accurate vehicle risk warnings for moments approaching accidents. Due to the high frequency of accidents in weaving zones, but the limited availability of high-risk samples (such as pre-accident trajectories), the lack of real pre-accident trajectory data for model training leads to problems such as insufficient data, overfitting, or poor generalization ability in risk identification models. Summary of the Invention

[0003] Purpose of the invention: To address the problems existing in the prior art, the present invention provides a method and system for early warning of lane-changing accident risks in highway weaving areas based on vehicle trajectory data.

[0004] Technical solution: This invention discloses a method for early warning of lane-changing accident risks in highway weaving areas based on vehicle trajectory data, specifically as follows:

[0005] Collect relevant information on vehicles along the entire highway route and in weaving areas;

[0006] The collected data is preprocessed;

[0007] Enhance the preprocessed lane-changing accident data samples in the weaving area to obtain new samples;

[0008] The new samples are merged with the original lane change accident data samples to obtain the merged training set.

[0009] Extract spatial features from the training set;

[0010] Spatial features are input into an improved Transformer model, which includes multiple tasks such as classification and auxiliary tasks. The classification task classifies lane change risks. A loss function is designed based on multi-task class balance and uncertainty weighting to train the overall model. The overall model includes a model that takes spatial features from the training set and an improved Transformer model.

[0011] Furthermore, the preprocessing of the collected data specifically includes:

[0012] Step 1: Based on timestamps and spatial gating, the nearest neighbor algorithm is used to perform cross-frame mapping of the same target; short trajectory segments of the same target are connected to complete the connection.

[0013] Step 2: Smooth the trajectory using Kalman filtering;

[0014] Step 3: If there are dropped frames in the trajectory, perform frame interpolation on the trajectory.

[0015] Furthermore, in step 3, frame interpolation is performed using the following method: If ,and If the frame loss is long-term, then cubic spline interpolation or Kalman prediction-based interpolation is used for frame loss processing; other frame loss cases are identified as short-term frame loss and linear interpolation is used for frame loss processing. This represents the time difference between adjacent frames of the same vehicle trajectory. The threshold for the duration of missing data. This represents the displacement difference between adjacent frames of the same vehicle trajectory. For maximum speed, This is random error.

[0016] Furthermore, the data samples related to lane-changing accidents are enhanced, specifically as follows:

[0017] Step 1: Calculate the i-th lane-changing accident sample using the k-nearest neighbor algorithm. nearest neighbor set ;

[0018] Step 2: Set the oversampling ratio :

[0019] ;

[0020] in, This is a collection of lane-changing accident samples. This represents the desired number of lane-change accident samples.

[0021] Step 3: For From its nearest neighbor set Based on sampling ratio Select several neighbor samples For any selected neighbor sample New synthetic samples are generated by interpolation using the following formula. :

[0022] ;

[0023] in, for Uniformly distributed random numbers within an interval;

[0024] Repeat step 3 until the required number of synthetic samples is met: .

[0025] Furthermore, the improved Transformer model processes the input features as follows:

[0026] A. Timing encoding of the timing within the sliding window:

[0027] B. Embed the time-series coding into the corresponding feature sequence. middle: ,in The embedded feature sequence, For timing numbering;

[0028] C. Features are obtained by inputting into a multi-head self-attention module. ;

[0029] D. Features Features are obtained by inputting into a feedforward network ,Will The input is normalized to obtain the hidden vector. ;

[0030] E. Hidden vectors The data is input into the multi-task prediction module to obtain the predicted values ​​for each risk in the classification task. and the predicted value of auxiliary tasks The auxiliary task includes calculating the target vehicle's collisions with all possible objects within the prediction window. sequence, Sequence, minimum headway and rapid deceleration events within a time window:

[0031]

[0032] in, These represent the weights and biases for the classification task, respectively. These represent the probabilities of low, medium, and high risk classifications, respectively. Indicates the first A supplementary task, For the first The weights and biases of each auxiliary task;

[0033] F, in The category corresponding to the maximum value is selected as the predicted lane change risk.

[0034] Furthermore, step B uses a sine-cosine function for timing encoding:

[0035] ;

[0036] Where j is the time frame index, Indexed by feature dimensions, For feature dimensions;

[0037] For the j-th time frame, its temporal coding is as follows:

[0038] ;

[0039] The temporal codes corresponding to all time frames within the sliding window are combined to form the temporal codes corresponding to all feature sequences within the sliding window. .

[0040] Furthermore, when a high risk is predicted, a warning is issued to the V2X roadside variable message signs or the vehicle assistance ADAS system.

[0041] Furthermore, the loss function used in this method Specifically:

[0042] ;

[0043] in, The equilibrium loss corresponding to the classification task, To regress the loss, For time consistency regularization, This represents the total number of lane-change risk categories in the classification task. To assist in the total number of tasks, This is a gradient regularization or model regularization term. They represent the weights, These are hyperparameters, The expression is as follows:

[0044] ;

[0045] in, Indicates in the sample Above, the model categorizes lane change risks. The predicted probability, and its range. , As weight, An adaptive focusing factor. and The expression is:

[0046] ;

[0047] ;

[0048] in, This represents the number of samples corresponding to the c-th type of lane-changing risk. , , Based on, This is the scaling factor. The error rate of type c lane change risk in the most recent epochs. The baseline error rate, The expression is:

[0049] ;

[0050] in, Smoothing threshold For auxiliary tasks The target measurement true value, This represents the model's predicted value for the auxiliary task;

[0051] The expression is:

[0052] ;

[0053] This represents the predicted value for each risk in the classification task.

[0054] A highway lane-changing accident risk early warning system based on vehicle trajectory data includes:

[0055] The data acquisition module is used to collect relevant information about vehicles along the entire highway route and in weaving areas.

[0056] The preprocessing module is used to preprocess the collected data.

[0057] The sample augmentation module is used to augment the preprocessed lane change accident data samples of the weaving area to obtain new samples; the new samples are then merged with the original lane change accident data samples to obtain the merged training set.

[0058] The spatial feature extraction module is used to extract spatial features from the training set;

[0059] An improved Transformer model is used to input spatial features into the improved Transformer model to obtain features that include temporal dynamics, thereby obtaining risk prediction values ​​and prediction values ​​for auxiliary tasks.

[0060] When training the spatial feature extraction module and the improved Transformer model, a loss function based on multi-task class balancing and uncertainty weighting is adopted.

[0061] Beneficial Effects: This invention can fully exploit the spatial and temporal features of vehicle trajectory data, improving recognition accuracy. Simultaneously, it employs a training strategy combining large and small samples, avoiding the overfitting risk associated with using only scarce samples from weaving zones, and enhancing the model's adaptability to unknown scenarios. This invention proposes a training loss function design combining multi-task focal loss and uncertainty-weighted loss, which can effectively train the model to address the sparsity of accident samples in weaving zones. This composite loss simultaneously solves the problems of long-tailed accident categories, multi-task trade-offs, imbalance between accident and non-accident sample numbers, and difficult sample focusing, making it suitable for accident scenarios with scarce samples in weaving zones. Ultimately, this invention enables real-time prediction and early warning of lane-changing accident risks in weaving zones, improving the efficiency and accuracy of highway safety management. Attached Figure Description

[0062] Figure 1 This is a schematic diagram illustrating an application scenario of the present invention.

[0063] Figure 2 This is a flowchart of the method of the present invention.

[0064] Figure 3 This is a flowchart of the accident pre-processing procedure.

[0065] Figure 4 This is a flowchart illustrating the CNN-Transformer model structure used in this invention.

[0066] Figure 5 This is a scene diagram of a traffic section in an embodiment of the present invention.

[0067] Figure 6 The spatiotemporal trajectory of the vehicle is plotted ten minutes before and after time T.

[0068] Figure 7 This is a trajectory diagram of the vehicle involved in the accident and the two vehicles in front of and behind it.

[0069] Figure 8 The risk index curves for vehicles with different IDs are shown in Figure (a), which is the speed curve, Figure (b) is the acceleration curve, and Figure (c) is the TTC (time to collision) curve. Detailed Implementation

[0070] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0071] This invention is applied to, for example Figure 1 The diagram shows the risk prediction of lane-changing accidents occurring under the vehicle trajectory in the weaving zone.

[0072] like Figure 2 As shown, the method includes steps S1 to S6, specifically including:

[0073] Step S1: Data Acquisition and Preprocessing. Collect lane-changing accident information and raw trajectory data before and after accidents for the entire highway route and weaving zones. Data fields include, but are not limited to, timestamp, vehicle ID, longitudinal position, lateral position, speed, longitudinal speed, lateral speed, vehicle size, and lane. Supplement with a large amount of non-accident vehicle trajectory data for the corresponding road segment to ensure sample balance. Perform quality diagnostics and assessment, standardized manual annotation, noise filtering, and normalization on the collected trajectory data, specifically as follows: Figure 3 As shown, this is to ensure data quality and consistency.

[0074] First, the feature space of the pre-accident trajectory in the interlacing zone after the original preprocessing is defined as follows:

[0075] ;

[0076] This represents the trajectory feature space before the accident, including lane-changing accidents and rear-end collisions. For the first One trajectory sample, For feature dimensions.

[0077] Traffic accidents can be mainly classified into rear-end collisions and lane-changing accidents. It can also be expressed as follows:

[0078] ;

[0079] The sample set labeled as "lane change accidents" is denoted as:

[0080] ;

[0081] Will This will serve as the primary data sample set for subsequent research.

[0082] When processing vehicle trajectory data, due to errors, there is a certain deviation between the actual trajectory points and the actual state of the vehicle. Therefore, it is necessary to reduce the noise of millimeter-wave radar observations and repair lost frames. The preprocessing uses a Kalman filter to smooth the trajectory sequence and Kalman prediction to interpolate frames. Trajectory data preprocessing (Kalman filter fusion and interpolation) is as follows: Figure 3 As shown, specifically:

[0083] To reduce observation noise from millimeter-wave radar, correct for frame drops, and address interference from multiple vehicle numbering, this embodiment first processes the original trajectory in step S1. Perform the following processing:

[0084] 1) Association and trajectory stitching: Based on timestamps and spatial gating (time tolerance and distance threshold), the nearest neighbor algorithm is used to complete the cross-frame ID mapping of the same target, eliminating the problem of multiple numbering. Trajectory segments with obvious breaks in the same ID are stitched together.

[0085] 2) Kalman Filtering for Smoothing Trajectories: The main idea of ​​Kalman filtering is to compare the next trajectory point with the previous position. If there is a significant and unreasonable trajectory drift in the current frame, it can be determined that the next trajectory point has an anomaly. The Kalman filtering process processes each frame of data in two main steps:

[0086] Prediction Steps – Based on previous state estimates and system dynamics models, predict the current state and its error covariance.

[0087] Update steps—Use the current observations and Kalman gain to correct the prediction results, thereby updating the state estimate and error covariance.

[0088] Define state vector Measurement vector The system matrix and measurement matrix are F and H, respectively, for the common uniform velocity model. Prediction and updates are performed according to the standard Kalman filter:

[0089] ;

[0090] ;

[0091] ;

[0092] ;

[0093] ;

[0094] in:

[0095] The prior state estimate (predicted value) at time k is derived from the posterior state estimate at the previous time.

[0096] : State transition matrix, which describes the dynamic model of the system state evolution over time, such as a uniform or uniformly accelerated motion model.

[0097] The previous moment The posterior state estimate (updated optimal estimate).

[0098] The prior estimation error covariance matrix represents the uncertainty of the predicted state.

[0099] The previous moment The posterior error covariance matrix.

[0100] The process noise covariance matrix describes the random disturbances in the dynamic process of the system.

[0101] Kalman gain matrix: used to perform weighted fusion between predicted and observed values ​​to determine the update magnitude.

[0102] The observation matrix maps state-space variables to the observation space, for example, extracting position observations from position and velocity states.

[0103] The observation noise covariance matrix describes the uncertainty of sensor measurements.

[0104] :time The actual observed vector (e.g., the measured position coordinates of the vehicle).

[0105] :time The posterior state estimate (updated optimal estimate).

[0106] : Identity matrix, used to maintain consistent matrix dimensions.

[0107] : Posterior estimation error covariance matrix, representing the uncertainty of the updated state.

[0108] The process noise covariance Q and measurement noise covariance R are set according to radar calibration or online estimation methods (typical values ​​can be determined empirically or through cross-validation). This embodiment... Under the uniform velocity model, process noise for A diagonal matrix, using the same noise level for both position and velocity states, is smaller. This indicates a high degree of confidence in the uniform motion model. (This embodiment...) Measure noise According to radar calibration, A diagonal matrix, using the same noise level for both position and velocity measurements, is relatively large. This indicates a low level of confidence in the measured values.

[0109] 3) Frame interpolation strategy: Let the state vector be... Measurement vector Kalman prediction and update are performed according to the standard formula (see formula above). For short-term frame drops ( Linear interpolation is used for frame replacement to maintain good performance and computational efficiency, and improve the stability of downstream feature extraction and short-term risk prediction. For longer frame drops, cubic spline or Kalman prediction interpolation is used to maintain dynamic consistency. The measurement noise covariance R and process noise Q are determined by radar calibration or online estimation. Longer frame drops are... ,and ;in The time difference between adjacent frames of the same ID trajectory. In this embodiment, the missing duration threshold is used. , The displacement difference between adjacent frames of the same ID trajectory. The expected maximum speed is set to (33m / s, corresponding to 120km / h). It is a random error and follows a normal distribution.

[0110] Step S2: Sample data augmentation.

[0111] The collected lane change accident data samples may come from different road segment types, including four categories: basic road segments, merging areas, diverging areas, and weaving areas, as shown below.

[0112] ;

[0113] Accidents in the weaving area To address the issue of insufficient sample size, small sample data augmentation methods include using the SMOTE algorithm to generate synthetic trajectory data of lane-changing behavior in interleaving zones, thereby expanding the training samples and improving the model's generalization ability. The SMOTE algorithm process is as follows:

[0114] 1) Calculate the k-nearest neighbors

[0115] ;

[0116] in: Indicates the first The trajectory sample to the first The Euclidean distance between each trajectory sample in the sample space. For the first One trajectory sample, Representing trajectory samples The 1 eigenvector The number of feature dimensions.

[0117] For each minority class sample, calculate its distance from other minority class samples using Euclidean distance:

[0118] Find the smallest The nearest neighbor set corresponding to each distance.

[0119] 2) Determine the oversampling ratio

[0120] For each minority class sample (accident sample in the weaving zone), the oversampling ratio Defined as:

[0121]

[0122] in, This represents the target number of samples that the minority class samples are expected to reach after oversampling.

[0123] 3) Synthetic sample generation

[0124] For each minority class sample From its nearest neighbor set Based on sampling ratio Randomly select several neighbors And generate new synthetic samples by interpolation using the following formula:

[0125] ;

[0126] in, For the synthetic sample, for Uniform random numbers within an interval.

[0127] Repeat the above process until the required number of synthetic samples is met. .

[0128] 4) Merge the enhanced datasets

[0129] Synthetic sample set With the original sample set Merge the sets to obtain the enhanced training set:

[0130] .

[0131] The merged samples are processed using the CNN-Transformer model, specifically as follows: Figure 4 As shown.

[0132] Step S3: Spatial Feature Extraction. The preprocessed trajectory data is input into a convolutional neural network (CNN). Two-dimensional convolution operations are performed on the time series of the trajectory to extract spatial features during vehicle motion, such as driving position and the status of nearby vehicles. Multiple convolutional layers of the CNN extract high-level features layer by layer to obtain the corresponding feature representations.

[0133] For trajectory sequences The formula for performing a one-dimensional convolution is as follows:

[0134] ;

[0135] in, To simplify the calculation formula for convolution, For convolution kernel weights, The number of feature dimensions. The time step length, For time Time characteristics The sequence vector value, The kernel size is [size]. For bias.

[0136] Step S4: Temporal Correlation Modeling. The spatial feature sequence extracted by the CNN is input into the Transformer architecture model. The Transformer models the temporal sequence of the vehicle trajectory and the feature input through a multi-head self-attention mechanism, capturing the dependencies between different time steps and obtaining a feature representation containing temporal dynamics. Furthermore, the Transformer can fuse information from the vehicle and surrounding vehicles, improving the dynamic prediction capability of lane-changing behavior. The specific steps are as follows:

[0137] Step S4: Temporal Correlation Modeling. The spatial feature sequence extracted by the CNN is input into the Transformer architecture model. The Transformer models the temporal sequence of the vehicle trajectory and the feature input through a multi-head self-attention mechanism, capturing the dependencies between different time steps and obtaining a feature representation containing temporal dynamics. Furthermore, the Transformer can fuse information from the vehicle and surrounding vehicles, improving the dynamic prediction capability of lane-changing behavior. The specific steps are as follows:

[0138] 1) Sliding time window construction:

[0139] Current time is , sort the feature sequences by length Slicing the input tensor using a sliding window yields the following:

[0140] ;

[0141] in For a moment eigenvectors, For feature dimension, This is the window length.

[0142] 2) Timing coding:

[0143] Timing coding uses sine-cosine functions for generation, making it suitable for modeling periodic or smoothly changing trajectory signals.

[0144] , ;

[0145] in, For timing coding, For time step index, Indexed by feature dimensions, As a feature dimension, alternating sine and cosine values ​​constitute the position embedding.

[0146] For each time step The position vector consists of a series of alternating sine and cosines:

[0147] ;

[0148] Time embedding definition:

[0149] ;

[0150] in, This represents the time position vector of the nth frame within the time window. and They are sine-cosine pairs at the same frequency, and together they represent the first... At the time step Periodic positional features in the dimensional frequency domain.

[0151] Adding time embeddings to the feature sequence yields a time-aware input:

[0152] ;

[0153] in, The original feature sequence, This is the feature sequence after incorporating time information.

[0154] 3) Multi-head self-attention-based computation:

[0155] Calculate the query, key, and value matrix using multi-head attention:

[0156] ;

[0157] ;

[0158] ;

[0159] in:

[0160] For the number of heads;

[0161] Key vector in each attention head The dimension, used for scaling to prevent the inner product result from becoming too large, is defined as follows: ,in The total feature dimension;

[0162] Outputs a linear mapping matrix, used to fuse multi-head attention results.

[0163] The hidden vector is then obtained through a feedforward network and layer normalization:

[0164] ;

[0165] ;

[0166] The network portion described in steps 2 and 3 above is a single-layer decoder structure, which can be modified according to actual needs. Layered stacking.

[0167] in:

[0168] This indicates a feedforward network. Represents a normalized network. The output After connecting with the residuals, layer normalization is then performed.

[0169] The weight matrix of the feedforward network;

[0170] : The corresponding bias vector;

[0171] The ReLU activation function is used to enhance nonlinear expressive power.

[0172] 4) Multi-task output:

[0173] The main task of this embodiment is risk classification probability prediction.

[0174] These are the hidden feature vectors in the decoding stage of the model. Inputting the multi-task prediction head yields:

[0175] ;

[0176] ;

[0177] in:

[0178] For the first Predicted probability of classification task at each time step;

[0179] For the first Predicted value of the s-th auxiliary task (such as regression TTC) at time step;

[0180] For a moment The hidden state vector;

[0181] These are the classification task weights and biases, respectively.

[0182] Let be the weights and biases of the s-th auxiliary task;

[0183] These represent the probabilities of low, medium, and high risk classifications, respectively.

[0184] In this embodiment, all auxiliary tasks are regression tasks, including:

[0185] Minimum Time-to-Collision ( Regression: Calculates the collision probability of the target vehicle with all possible collision objects within the prediction window. sequence;

[0186] MinHeadway regression: the minimum headway (THW) between two vehicles within a time window.

[0187] Emergency deceleration DRAC: Whether an emergency deceleration event occurs within the prediction step ( ), used to indicate the risk of sudden deceleration;

[0188] Trajectory Intersection Time (TIT): If the trajectories of two vehicles extend in space and intersect, TIT represents the time difference between their arrival at the intersection point. It is commonly used for lateral collision risk assessment.

[0189] To address the imbalance between accident and non-accident samples caused by the sparsity of accident samples in the interleaving region, a training loss function of Class Class Balancing Focal Loss + Uncertainty-weighted Multi-Task Focal Loss is proposed. Its objectives are simultaneously: ① focusing on difficult examples for the classification task; ② performing class balancing based on the number of effective samples per class; and ③ adaptively allocating weights across multiple tasks to avoid negative transfer. The overall loss function of this invention is expressed as follows:

[0190] ;

[0191] in, To balance the loss for different task categories, To regress the loss, For time consistency regularization, For the risk category of the sample, This represents the total number of lane-change risk categories in the classification task. (High risk, medium risk, low risk) For the number of regression tasks, This is a gradient regularization or model regularization term. They represent the weights, These are hyperparameters for time consistency regularization and other regularization terms, used to adjust their weight in the overall loss. Initial values ​​are set here. , , The expression is as follows:

[0192] ;

[0193] in, Indicates in the sample Above, the model categorizes lane change risks. The predicted probability, with a value range of . , For category weights, A focus factor that adapts to the category or task. and The expression is:

[0194] ;

[0195] ;

[0196] in, This represents the number of samples corresponding to the c-th type of lane-changing risk. , , Based on, This is the scaling factor. The error rate of type c lane change risk in the most recent epochs. The baseline error rate, The expression is:

[0197] ;

[0198] The expression is: ;

[0199] in, To set the smoothing threshold (with the same unit as the regression variable, e.g., meters), we set it here. (Empirical value, which can be adjusted according to the target variable scale). For auxiliary tasks The target measurement true value, This represents the model's predicted value for the regression objective (and...). (same dimension) for and The predicted probability of the time-matter model for the main task classification target. This represents the total time step of the time window.

[0200] During training, this invention first pre-trains on a large sample of accident and non-accident data from ordinary road sections, and then performs secondary fine-tuning on a small sample of weaving areas to learn the features of the weaving areas. Using SMOTE / GAN to enhance the minority class and combining it with Focal Loss yields better results. Early stopping, learning rate decay, and Class-BalancedBatch sampling strategies are employed.

[0201] Step S6: Result Output and Early Warning. The predicted risk level results are used to generate early warning signals. When a vehicle or road segment is determined to be high-risk, the system issues a warning to the V2X roadside variable message sign or the vehicle assistance ADAS system, such as a visual warning like "High risk around the current vehicle, please change lanes with caution" or takes active intervention measures. The method of this invention can realize early warning and decision support for lane changing accident risks in weaving areas.

[0202] To verify the effectiveness of the technical solution of this invention, actual application effects of the method of this invention are demonstrated using measured data from a highway as an example:

[0203] Accident detection and calibration

[0204] like Figure 5 As shown, through roadside surveillance video playback, it was manually confirmed that a two-vehicle rear-end collision occurred at time T, involving two vehicles. The accident type was a minor rear-end collision, and the specific time of occurrence was 15:08:26 on March 8, 2025.

[0205] The accident vehicle is calibrated in the video frame, and its unique ID, lane number and location coordinates are recorded simultaneously as a reference for subsequent trajectory alignment.

[0206] Trajectory Extraction and Visualization

[0207] like Figure 6 As shown, within the observation range of a single radar, a spatiotemporal trajectory map of the vehicle is drawn ten minutes before and after time T. The color intensity represents the speed change. The accident location is quickly located and marked based on the characteristics of the trajectory map.

[0208] Locate the trajectories of vehicles involved in the accident and those preceding and following vehicles, perform Kalman filtering smoothing and interpolation.

[0209] This embodiment extracts the trajectory data of the accident vehicle and the two vehicles in front and behind it to obtain a time-location sequence. The plotted vehicle trajectory diagram is shown below. Figure 7 As shown, the location and time of the accident are marked, and different colors represent the speeds of the vehicles involved in the accident and those not involved, facilitating observation of their relative motion. To address noise and short-term frame drops in the original trajectory, a state vector is used... The Kalman filter is used for state prediction and updating, and linear interpolation or cubic spline interpolation is used to restore equally spaced samples for missing frames. The smoothed trajectory curve is more continuous, and the vehicle's acceleration and deceleration behavior is more realistic. Examples of smoothed trajectories are shown in Table 1 below, which has been anonymized:

[0210] Table 1:

[0211]

[0212] Accident key information marking and feature calculation

[0213] Traffic flow data (in JSON format) collected from the radar recording the location of the accident for one hour before and after the accident, with a detection cycle of five minutes, including 5-minute average flow rate, speed, occupancy, lane number, headway, and distance between vehicles. An example is shown below:

[0214] {"time":1741417234047,"flow":103,"speed":17.05,"lines":[

[0215] {"flow":0,"speed":0.0,"occupancy":0.0,"line_id":1,"head_time_dis":0.0,"head_space_dis":0.0};

[0216] {"flow":14,"speed":19.38,"occupancy":0.36,"line_id":2,"head_time_dis":4.28,"head_space_dis":83.07};

[0217] {"flow":17,"speed":22.16,"occupancy":0.44,"line_id":3,"head_time_dis":3.52,"head_space_dis":78.22};

[0218] {"flow":15,"speed":24.51,"occupancy":0.34,"line_id":4,"head_time_dis":4.0,"head_space_dis":98.05};

[0219] {"flow":18,"speed":13.46,"occupancy":0.67,"line_id":5,"head_time_dis":3.33,"head_space_dis":44.89};

[0220] {"flow":25,"speed":13.02,"occupancy":0.83,"line_id":6,"head_time_dis":2.4,"head_space_dis":31.26};

[0221] {"flow":14,"speed":12.33,"occupancy":0.61,"line_id":7,"head_time_dis":4.28,"head_space_dis":52.88};

[0222] {"flow":0,"speed":0.0,"occupancy":0.0,"line_id":8,"head_time_dis":0.0,"head_space_dis":0.0}],"head_time_dis":0.58,"head_space_dis":9.93,"line_total":8}};

[0223] As Figure 8As shown, based on the smoothed trajectory data, key time-series data for 20 seconds before and after the accident are extracted, and key risk indicators such as speed, acceleration, and TTC (time of collision) are calculated for the two vehicles involved in the accident and more than 10 vehicles in front and behind them.

[0224] The accident site was marked as a high-risk sample, and the time periods before and after it were marked as the risk escalation phase and the risk mitigation phase, respectively.

[0225] Model Inference and Results Display

[0226] After inference, the model selects vehicle pairs marked as high, medium, and low risk and their related risk characteristics from the complete pre-accident trajectory samples. Detailed examples are shown in Table 2 below:

[0227] Table 2:

[0228]

[0229] The feature sequences are input into a trained multi-task deep learning model to obtain accident risk prediction results. The model outputs that the risk level of the accident vehicle and surrounding vehicles before the accident is high, accurately capturing abnormal deceleration and sudden lane change behaviors before the accident. The inference results are visualized as risk probability curves and risk level labels (high risk, medium risk, and low risk).

[0230] As demonstrated in this case, this method can automatically extract accident-related vehicle trajectories from raw observation videos and radar data, smooth and complete the trajectory sequence, calculate risk characteristics, and identify accident risks in advance, demonstrating strong practicality and engineering value.

[0231] It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the present invention will not describe the various possible combinations separately.

Claims

1. A method for early warning of lane-changing accident risks in highway weaving areas based on vehicle trajectory data, characterized in that, Specifically: Collect relevant information on vehicles along the entire highway route and in weaving areas; The collected data is preprocessed; Enhance the preprocessed lane-changing accident data samples in the weaving area to obtain new samples; The new samples are merged with the original lane change accident data samples to obtain the merged training set. Extract spatial features from the training set; Spatial features are input into an improved Transformer model, which incorporates multiple tasks, including classification and auxiliary tasks. The classification task categorizes lane-change risks. A loss function is designed based on multi-task class balance and uncertainty weighting to train the overall model. The overall model includes a model for extracting spatial features from the training set and an improved Transformer model. The improved Transformer model processes the input features as follows: A. Timing encoding of the timing within the sliding window: B. Embed the time-series coding into the corresponding feature sequence. middle: ,in The embedded feature sequence, For timing numbering; C. Features are obtained by inputting into a multi-head self-attention module. ; D. Features Features are obtained by inputting into a feedforward network ,Will The input is normalized to obtain the hidden vector. ; E. Hidden vectors The data is input into the multi-task prediction module to obtain the predicted values ​​for each risk in the classification task. and the predicted value of auxiliary tasks The auxiliary task includes calculating the target vehicle's collisions with all possible objects within the prediction window. sequence, Sequence, minimum headway and rapid deceleration events within a time window: ; in, These represent the weights and biases for the classification task, respectively. These represent the probabilities of low, medium, and high risk classifications, respectively. Indicates the first A supplementary task. For the first Weights and biases for each auxiliary task. Let be the hidden state vector at time t; F, in The category corresponding to the maximum value is selected as the predicted lane change risk. The loss function used in this method Specifically: ; in, The equilibrium loss corresponding to the classification task, To regress the loss, For time consistency regularization, This represents the total number of lane-change risk categories in the classification task. To assist in the total number of tasks, This is a gradient regularization or model regularization term. They represent the weights, These are hyperparameters, The expression is as follows: ; in, Indicates in the sample Above, the model classifies lane change risks. The predicted probability, and its range. , As weight, An adaptive focusing factor. and The expression is: ; ; in, This represents the number of samples corresponding to the c-th type of lane-changing risk. , , Based on, This is the scaling factor. The error rate of type c lane change risk in the most recent epochs. The baseline error rate, The expression is: ; in, Smoothing threshold For auxiliary tasks The target measurement true value, This represents the model's predicted value for the auxiliary task; The expression is: 。 2. The method for early warning of lane-changing accident risks in highway weaving areas based on vehicle trajectory data according to claim 1, characterized in that, The preprocessing of the collected data specifically involves: Step 1: Based on timestamps and spatial gating, the nearest neighbor algorithm is used to perform cross-frame mapping of the same target; short trajectory segments of the same target are connected to complete the connection. Step 2: Smooth the trajectory using Kalman filtering; Step 3: If there are dropped frames in the trajectory, perform frame interpolation on the trajectory.

3. The method for early warning of lane-changing accident risks in highway weaving areas based on vehicle trajectory data according to claim 2, characterized in that, In step 3, frame interpolation is performed using the following method: If ,and If the frame loss is long-term, then cubic spline interpolation or Kalman prediction-based interpolation is used for frame loss processing; other frame loss cases are identified as short-term frame loss and linear interpolation is used for frame loss processing. This represents the time difference between adjacent frames of the same vehicle trajectory. The threshold for the duration of missing data. This represents the displacement difference between adjacent frames of the same vehicle trajectory. For maximum speed, This is random error.

4. The method for early warning of lane-changing accident risks in highway weaving areas based on vehicle trajectory data according to claim 1, characterized in that, Enhancement is performed on lane-change accident data samples, specifically as follows: Step 1: Calculate the i-th lane-changing accident sample using the k-nearest neighbor algorithm. nearest neighbor set ; Step 2: Set the oversampling ratio : ; in, This is a collection of lane-changing accident samples. This represents the desired number of lane-change accident samples. Step 3: For From its nearest neighbor set Based on sampling ratio Select several neighbor samples For any selected neighbor sample New synthetic samples are generated by interpolation using the following formula. : ; in, for Uniformly distributed random numbers within an interval; Repeat step 3 until the required number of synthetic samples is met: .

5. The method for early warning of lane-changing accident risks in highway weaving areas based on vehicle trajectory data according to claim 1, characterized in that... Step B uses a sine-cosine function for timing coding: ; Where j is the time frame index, Indexed by feature dimensions, For feature dimensions; For the j-th time frame, its temporal coding is as follows: ; The temporal codes corresponding to all time frames within the sliding window are combined to form the temporal codes corresponding to all feature sequences within the sliding window. .

6. The method for early warning of lane-changing accident risks in highway weaving areas based on vehicle trajectory data according to claim 1, characterized in that, When a high-risk prediction is made, an alert is sent to the V2X roadside variable message signs or the vehicle assistance ADAS system.

7. A system applied to the method for early warning of lane-changing accident risks in highway weaving areas based on vehicle trajectory data as described in claim 1, characterized in that, include: The data acquisition module is used to collect relevant information about vehicles along the entire highway route and in weaving areas. The preprocessing module is used to preprocess the collected data; The sample augmentation module is used to augment the preprocessed lane change accident data samples of the weaving area to obtain new samples; the new samples are then merged with the original lane change accident data samples to obtain the merged training set. The spatial feature extraction module is used to extract spatial features from the training set; An improved Transformer model is used to input spatial features into the improved Transformer model to obtain features that include temporal dynamics, thereby obtaining risk prediction values ​​and prediction values ​​for auxiliary tasks. When training the spatial feature extraction module and the improved Transformer model, a loss function based on multi-task class balancing and uncertainty weighting is adopted.

Citation Information

Patent Citations

  • Expressway vehicle lane change two-stage prediction method under vehicle-road cooperation environment

    CN118351689A

  • Automatic driving vehicle track prediction method and system based on double cross Transformer

    CN118419065A

  • Interleaving area microscopic simulation system based on space-time diagram Transform

    CN119312673A