Transform-based intersection traffic conflict severity and scene type identification method

Through the Transformer-based intersection traffic conflict identification method, the problem of misjudgment and generalization performance of identifying the severity of intersection traffic conflicts and scenario types in the prior art is solved, and more accurate and efficient traffic conflict analysis and risk identification are achieved.

CN120088743APending Publication Date: 2025-06-03TONGJI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510025348.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-08
Publication Date
2025-06-03

AI Technical Summary

Technical Problem

The prior art has problems such as misjudgment, limited generalization performance and difficulty in batch processing of multiple intersection data when identifying the severity and scenario type of intersection traffic conflicts at the prior art.

Method used

The intersection traffic conflict identification method based on Transformer is adopted, and the intersection conflict severity and scene type are defined, and the Transformer-based identification model is constructed. The multi-head attention mechanism and position-level feedforward network are used to extract the kinematic characteristics of the conflict trajectory, and the severity and scene type of the conflict event are output.

Benefits of technology

It improves the accuracy and generalization performance of traffic conflict identification at intersections, can batch process data from multiple intersections, determine traffic risks in real time, extract high-value risk scenarios, and provide quantitative references to improve traffic safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120088743A_ABST
    Figure CN120088743A_ABST
Patent Text Reader

Abstract

The invention relates to an intersection traffic conflict severity and scene type identification method based on Transform. The method comprises the following steps: defining intersection conflict severity and scene type; collecting track data of various types of intersections, processing and marking the track data, and constructing a data set; an intersection traffic conflict identification model based on a Transform is constructed; taking a weighted cross entropy function as a training loss function, training an intersection traffic conflict recognition model based on the constructed data set, and selecting an optimal model as a reference model based on a weighted F1 score; and inputting to-be-detected intersection conflict pair trajectory information into the reference model, and identifying to obtain severity and scene type information of all conflict events of the intersection. Compared with the prior art, the method avoids the limitation of a threshold value method and a semantic rule method in the process of judging the vehicle conflict at the intersection, can be migrated to different intelligent intersections, and identifies the severity of traffic conflicts and scene types in batches.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of traffic conflict analysis, and particularly to a method for identifying the severity of intersection traffic conflicts and scene types based on Transformer. Background Art

[0002] Road intersections are important nodes connecting roads in all directions, and are also bottlenecks in road operation and hotspots for accidents. Traffic conflict technology is one of the effective means for analyzing the operation safety of intersections. Compared with accident data analysis based on accidents with low probability of occurrence, it has statistical advantages such as large samples, short cycle, easy observation, and strong real-time performance. Manual observation is a common way to investigate traffic conflicts, but it has problems such as high cost, strong subjectivity, and low accuracy of observation results.

[0003] Sensing technologies such as video and radar have been widely used in the field of intelligent transportation, providing solutions to overcome the defects of manual observation and achieve automatic investigation of traffic conflicts. For the image and point cloud data collected by roadside cameras, radars, drones, vehicle-mounted sensing devices, etc., researchers apply tracking algorithms to obtain the movement trajectories of traffic participants at intersections, calculate surrogate safety measures (SSMs) such as time to collision (TTC) and post-encroachment time (PET), use threshold methods to screen the severity of conflicts, and combine the design characteristics of intersections to describe the spatial relationship of trajectories through semantic rules to determine conflict scenarios.

[0004] However, the above methods still have the following limitations: 1) The threshold method is difficult to capture the changes in the movement states and behavioral differences of traffic participants, resulting in misjudgment of the severity of conflicts; 2) The semantic rule method performs poorly in the face of diverse intersection designs and is difficult to describe all possible conflict scenarios, with limited generalization performance; 3) The data collected from different intersections is heterogeneous, and it is difficult for the threshold method and the semantic rule method to batch process a large amount of intersection data. Summary of the Invention

[0005] The object of the present invention is to solve the limitations of the conflict in the recognition between the threshold method and the semantic rule method, and provide a method for identifying the severity of intersection traffic conflicts and scene types based on Transformer. Combining the motion characteristics of intersection trajectory data, the severity of conflicts and scene types are defined, and the information of two traffic participants in the conflict event is calibrated. Based on Transformer, an AI Conflict Observer (AICO) model that can automatically batch extract the severity of intersection conflict events and scenes is trained. The AICO model can be directly deployed to the edge computing device of the intelligent intersection for real-time discrimination and analysis of traffic risks, extraction of high-value risk scenes, and providing quantitative references for safety improvement and governance.

[0006] The object of the present invention can be achieved by the following technical solutions:

[0007] A method for identifying the severity of intersection traffic conflicts and scene types based on Transformer, comprising the following steps:

[0008] Step 1) Define the severity of intersection traffic conflicts and scene types;

[0009] Step 2) Collect the trajectory data of various types of intersections, clean the trajectory data, extract the trajectory information of possible traffic conflict pairs, and label the severity of each conflict event and scene type according to the definition in Step 1) to construct a data set;

[0010] Step 3) Construct an intersection traffic conflict recognition model based on Transformer, where the model takes the trajectory information of conflict pairs as input and outputs the recognition results of the severity of conflict events and scene types;

[0011] Step 4) Use the weighted cross-entropy function as the training loss function, train the intersection traffic conflict recognition model constructed in Step 3) based on the data set constructed in Step 2), and select the optimal model as the benchmark model based on the weighted F1 score;

[0012] Step 5) Input the trajectory information of the intersection conflict pairs to be detected into the benchmark model to identify the severity and scene type information of all conflict events at the intersection.

[0013] In the above Step 1), the severity of the conflict is defined as: taking the surrogate safety index as a quantitative index and observing whether a collision avoidance behavior occurs as a qualitative index, and dividing the severity of each moment of the traffic conflict into severe conflict, general conflict and no conflict.

[0014] In step 1), the conflict scenario types are defined as follows: according to the lane and turning direction information of traffic participants, using the exhaustive method and considering the symmetric exchangeability of both parties in the conflict, the conflict scenarios within the intersection and at the approach and departure lanes of the intersection are defined respectively. Among them, the conflicts within the intersection include motor vehicle-motor vehicle and motor vehicle-non-motor vehicle conflicts, and the conflicts at the approach and departure lanes of the intersection include motor vehicle-non-motor vehicle, motor vehicle-pedestrian, and non-motor vehicle-pedestrian conflicts.

[0015] Step 2) includes the following steps:

[0016] Step 21) Select multiple intersections with different geometric designs as data collection objects. For the video and point cloud data obtained by the sensing devices deployed at the intersections, apply the target recognition and tracking algorithm to extract the trajectory data of traffic participants.

[0017] Step 22) Conduct data cleaning on the trajectory data, including outlier removal, trajectory smoothing and merging, and correction of target misidentification.

[0018] Step 23) Based on the surrogate safety index as the extraction basis and set a threshold, perform rough extraction of conflict pair information on the trajectory data cleaned in step 22) to screen possible conflict events, and export the speed, horizontal and vertical relative coordinates, and direction angle fields of both parties in the conflict; use the conflict pair trajectory with the longest duration selected as the standard to unify the sequence lengths of all conflict trajectories.

[0019] Step 24) Based on the definition in step 1), label the conflict pair trajectory data preliminarily screened in step 23), specifically label the severity of each moment of the conflict event and the conflict scenario type of the event; divide the labeled conflict data into training set, test set, and validation set.

[0020] The intersection traffic conflict recognition model performs the following steps on the input data:

[0021] Step 31) Input the coordinate, speed, and direction angle information of each conflict pair at the input end of the intersection traffic conflict recognition model to form a tensor with a size of (n, m, 8), where n is the total number of conflict pairs, m is the unified sequence length of each conflict trajectory, and 8 represents the number of fields of the input conflict pair trajectory information X, specifically:

[0022] X = {x i t1:tn , y i t1:tn , v i t1:tn , DA i t1:tn ; x j t1:tn , y jt1:tn , v j t1:tn , DA j t1:tn}

[0023] Among them, (x i t1:tn , y i t1:tn ), (x j t1:tn , y j t1:tn ) are the relative coordinates of the center points of conflict participants i and j from t1 to t n moment; v i t1:tn , v j t1:tn are the speeds of conflict participants i and j respectively; DA i t1:tn and DA j t1:tn are the direction angles of conflict participants i and j respectively;

[0024] Step 32) Position encoding: Use sine and cosine functions to generate unique encodings PE for each position of the conflict pair trajectory information:

[0025]

[0026] Among them, t represents the index of the t moment, i represents the dimension index, and d model represents the dimension of the input;

[0027] Step 33) Use the encoder of the Transformer to convert the high-dimensional trajectory data after position encoding into an internal low-dimensional continuous representation, extract the deep features of traffic conflicts and transmit the global information of the trajectory. The encoder contains n identical layers, and each layer contains two modules: the multi-head attention mechanism and the fully connected position-wise feed-forward network. Both modules are set with residual connections and layer normalization;

[0028] Step 34) Flatten the sequence processed by the encoder and pass it through a linear layer to map it to a low-dimensional space, and generate a prediction result through the Softmax layer. The prediction result is the probability distribution of the severity of the conflict and the corresponding conflict scenarios at each timestamp

[0029]

[0030] Among them, is the probability distribution of the three predicted conflict severities at each timestamp from t 1 to t n ; The probability distribution of the conflict event being predicted as several scenario types.

[0031] The step 33) includes the following steps:

[0032] In step 331), the multi-head attention mechanism is adopted to capture the motion information in the trajectory data of the conflict pair in parallel, and the mathematical expression of each attention head is as follows:

[0033]

[0034] where Q, K, and V correspond to query, key, and value respectively, and d K is the dimension of the key K vector, and Attention represents the attention score;

[0035] The multi-head attention is expressed as:

[0036] MultiHead(Q, K, V) = Concat(head 1 ,..., head h )W h

[0037] where, head i = Attention(QW i Q , KW i K , VW i V )

[0038] In the formula, are all parameter matrices; i = 1, 2,..., h, and h is the number of heads of the multi-head attention;

[0039] In step 332), a fully connected position-wise feed-forward network is set up to enhance the model's response ability to positions. The position-wise feed-forward network consists of two linear layers, uses ReLU as the activation function, the input and output have the same d model dimension, and the hidden layer has dimension d ffn . After each multi-head attention and feed-forward network, the residuals are connected through a layer normalization layer.

[0040] In the step 4), the cross-entropy loss is introduced to measure the difference between the predicted probability distribution of the model output and the target probability distribution of the true label, and weights are set for different target categories to solve the problem of class imbalance in the classification task of conflict severity and scenarios. Among them, the weight w i of the i-th category is defined as:

[0041]

[0042] where N i is the number of occurrences of the i-th category in the test set; M represents the number of categories;

[0043] Then the loss function of the intersection traffic conflict recognition model is expressed as:

[0044]

[0045] where N is the number of samples, w k and w l are the weights of severity and scenario type respectively, K and L are the number of categories of severity and scenario type respectively, which are taken as 3 and 22 in this embodiment, y ij t1:tn is the true value of the three conflict severities at each time stamp from t 1 to t n ; is the predicted probability distribution of the three conflict severities at each time stamp from t 1 to t n ; y ij s is the true value of the scenario type of this conflict event; is the predicted probability distribution of this conflict event as several scenario types.

[0046] In the said step 4), after configuring the software and hardware training environment, set hyperparameters for the model according to the size of the dataset, and select the weighted F1 score as the evaluation index of the model recognition performance:

[0047]

[0048] where P i and R i represent the precision rate and recall rate of the i-th category respectively, and w i is the weight of the i-th category;

[0049] Select the Transformer model with the highest weighted F1 score for the two recognition tasks in multiple rounds of training as the benchmark model for detecting the severity and scenario type of traffic conflicts at intersections.

[0050] The said step 5) includes the following steps:

[0051] Step 51) Clean the to-be-detected trajectory data collected by the sensing devices in the intersection according to the method in step 2), and export each possible conflict pair trajectory as a CSV file, including the speed, position coordinates and direction angle information of each conflict participant at each moment;

[0052] Step 52) Input the conflict pair trajectory file to be detected into the benchmark model to obtain the severity of each traffic conflict at each moment and the scene classification result of this conflict event.

[0053] Step 5) further includes:

[0054] Step 53) According to actual requirements, count the severity and scene types of general or severe conflict events, and analyze the conflict distribution characteristics: count the time distribution characteristics of conflicts according to the change of the number of conflicts over time; draw potential conflict points on the intersection map to form a conflict heat map to obtain the spatial distribution characteristics of conflicts; count the severity of conflicts of different vehicle types and different conflict types to obtain the severity distribution characteristics of conflicts.

[0055] Compared with the prior art, the present invention has the following beneficial effects:

[0056] 1. The present invention proposes a scientific definition of the severity and scene type of intersection conflicts: from the quantitative and qualitative perspectives, a comprehensive definition of severe conflicts, general conflicts, and non-conflicts is given; using the exhaustive method and considering symmetric commutativity, a detailed definition of conflict scenarios within the intersection and at the approach and departure lanes of the intersection is given.

[0057] 2. Avoid the limitations of the threshold method and the semantic rule method in judging intersection conflicts: The intersection traffic conflict recognition model of the present invention uses the multi-head attention mechanism of Transformer to learn the kinematic characteristics of conflict pair trajectories, further considering the occurrence of collision avoidance behavior based on the proximity of the two conflict parties, without the need to set a threshold to judge the severity. At the same time, the model can learn the type of conflict scenario from the trajectory form without information such as lanes, and is applicable to complex traffic flow situations;

[0058] 3. The intersection traffic conflict recognition model of the present invention has strong generalization performance and can be migrated to multiple intelligent intersections for batch conflict analysis: The model uses the trajectory data of intersections with different geometric designs as the source, and learns the rich motion characteristics of a large number of conflict event samples. Only by providing the speed, relative coordinates, and direction angle information of the conflict pair, the model can batch detect conflict events within various types of intersections and extract the severity and scene of the conflicts. Description of the Drawings

[0059] Figure 1 is the flowchart of the method of the present invention;

[0060] Figure 2 is the schematic diagram of the generalized TTC principle in an embodiment;

[0061] Figure 3 is the distribution map of intersections in two places in an embodiment;

[0062] Figure 4It is the conflict scenario type within the intersection in one embodiment;

[0063] Figure 5 It is the conflict scenario type at the approach and departure lanes of the intersection in one embodiment;

[0064] Figure 6 It is the framework diagram of the intersection traffic conflict recognition model in one embodiment;

[0065] Figure 7 It is the distribution map of severe conflict hours in one embodiment;

[0066] Figure 8 It is the spatial heat map of severe conflicts in one embodiment;

[0067] Figure 9 It is the box plot of conflict severity in one embodiment. Among them, 9a) is the box plot of the generalized TTC for different vehicle types, and 9b) is the box plot of the generalized TTC for different conflict types;

[0068] Figure 10 It is the box plot of the duration of severe conflicts in one embodiment. Among them, 10a) is the box plot of the conflict duration for different vehicle types, and 10b) is the box plot of the conflict duration for different conflict types. Detailed implementation manner

[0069] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. This embodiment is implemented on the premise of the technical solution of the present invention, and gives detailed implementation manners and specific operation processes, but the protection scope of the present invention is not limited to the following embodiments.

[0070] This embodiment provides a method for identifying the severity and scenario type of intersection traffic conflicts based on Transformer. It defines the severity of intersection conflicts in a quantitative and qualitative combination manner, and defines the intersection conflict scenario type by the exhaustive method and considering the symmetry and exchangeability of intersection conflicts; collects the trajectory data of various types of intersections, extracts the possible traffic conflict pair trajectory information after data cleaning, marks the severity and severity of each conflict event according to the definition criteria, and divides the data set. Construct based on Transformer rAn intersection traffic conflict recognition model. Using the weighted cross-entropy function as the training loss function, after adjusting appropriate parameters, the Transformer encoder is trained in the same configuration environment. Using the weighted F1 score as the evaluation metric for the model performance, the model with the best performance during training is selected as the AICO benchmark model; the trajectory data of the intersection conflict pairs to be detected is input into the AICO model to identify the severity and scenario type information of all conflict events at the intersection, and analyze the conflict distribution characteristics. The present invention avoids the limitations of the threshold method and the semantic rule method in judging vehicle conflicts at intersections, can be transferred to intelligent intersections with different designs, and batch-identifies the severity and scenario types of traffic conflicts. It can be used for the real-time discrimination and analysis of intersection traffic risks, extraction of high-value risk scenarios, and provides quantitative references for safety improvement and governance.

[0071] Specifically, as Figure 1 shown, the method includes the following steps:

[0072] Step 1) Define the severity and scenario type of intersection conflicts.

[0073] Step 11) Definition of conflict severity: Using the Surrogate Safety Measures (SSM) as the quantitative index and observing whether collision avoidance behavior occurs as the qualitative index, the severity of each moment of traffic conflict is divided into severe conflict, general conflict, and no conflict.

[0074] In this embodiment, the generalized TTC is selected as the quantitative index and observing whether collision avoidance behavior occurs as the qualitative index. The severity of each moment of traffic conflict is divided into severe conflict, general conflict, and no conflict as follows:

[0075] 1) Severe conflict: Two traffic participants satisfy 0s < TTC < 1s and are observed to have collision avoidance behavior;

[0076] 2) General conflict: Two traffic participants satisfy 1s < TTC < 2s and are observed to have collision avoidance behavior, or satisfy 0s < TTC < 1s but have no collision avoidance behavior;

[0077] 3) No conflict: Two traffic participants satisfy TTC ≥ 2s.

[0078] The schematic of the generalized TTC is as Figure 2 shown. It considers the conflict angle and size between traffic participants. The center coordinates o i , o j and speeds v i , v j of the i-th and j-th objects are all vectors, and l i and l j are the lengths of the i-th and j-th objects respectively. Assuming the approach rate of the front center Proximity rate to the nearest point is the same. Therefore, the generalized TTC can be defined as the distance d between two traffic participants ij and the proximity rate The ratio is shown in Equation (1):

[0079]

[0080] Step 12) Definition of conflict scenario types: According to the lane and turning direction information of traffic participants, an exhaustive method is adopted, and considering the symmetry and exchangeability of both sides of the conflict, the conflict scenarios within the intersection and at the entrance and exit lanes of the intersection are defined respectively. Among them, the conflicts within the intersection include motor vehicle-motor vehicle and motor vehicle-non-motor vehicle conflicts, and the conflicts at the entrance and exit lanes of the intersection include motor vehicle-non-motor vehicle, motor vehicle-pedestrian, and non-motor vehicle-pedestrian conflicts.

[0081] In this embodiment, 13 conflict scenarios within the intersection as shown in Figure 4 are defined respectively, and 8 conflict scenarios at the entrance and exit lanes of the intersection as shown in Figure 5 are defined. Combining the possible other conflict situations in the conflict scenarios within the intersection and at the entrance and exit lanes of the intersection, a total of 22 conflict scenario types are defined. Figure 4 Among them, 1 is lane-changing conflict; 2 is following conflict; 3 is straight-ahead and near / far-end straight-ahead conflicts; 4 is straight-ahead and proximal left-turn conflict; 5 is straight-ahead and distal left-turn conflict; 6 is straight-ahead and oncoming left-turn conflict; 7 is straight-ahead and distal right-turn conflict; 8 is straight-ahead and oncoming U-turn conflict; 9 is left-turn and near / far-end left-turn conflicts; 10 is left-turn and oncoming left-turn conflict; 11 is left-turn and oncoming right-turn conflict; 12 is left-turn and proximal U-turn conflict; 13 is right-turn and distal U-turn conflict. Figure 5 Among them, 14 is straight-ahead and cross-street conflict at the entrance lane; 15 is straight-ahead and cross-street conflict at the exit lane; 16 is left-turn and cross-street conflict at the entrance lane; 17 is left-turn and cross-street conflict at the exit lane; 18 is right-turn and cross-street conflict at the entrance lane; 19 is right-turn and cross-street conflict at the exit lane; 20 is U-turn and cross-street conflict at the entrance lane; 21 is U-turn and cross-street conflict at the exit lane. In addition, 22 is supplemented for other non-conventional conflict situations, such as straight-ahead and oncoming right-turn conflict within the intersection, etc.

[0082] Step 2) Collect the trajectory data of various types of intersections, clean and process the trajectory data, extract the trajectory information of possible traffic conflict pairs, and label the severity and scenario type of each conflict event according to the definition in Step 1) to construct a dataset.

[0083] Specifically, Step 2) includes the following steps:[[]]

[0084] Step 21) Select multiple intersections with different geometric designs as data sources, such as cross intersections, skew intersections, T-shaped intersections, Y-shaped intersections, multi-way intersections, etc. For the video and point cloud data obtained by sensing devices such as cameras, radars, and drones deployed at intersections, apply target recognition and tracking algorithms to extract traffic participant trajectory data.

[0085] In this embodiment, the holographic intersection technology is applied. A total of 168 hours of trajectory data is collected from 7 holographic intersections in two places. The distribution of the intersections is as Figure 3 shown. This technology is based on algorithms such as deep learning to identify traffic participants and trajectories from the video and point cloud data collected by up to 12 cameras and 4 millimeter-wave radars at each intersection, and the collection frequency is 10Hz.

[0086] Step 22) Perform data cleaning on the trajectory data, including removing outliers in fields such as speed and coordinates, trajectory smoothing and merging, and correcting target misidentifications.

[0087] Apply the high-computing-power intelligent transportation edge device ITS800 to fuse and perform edge computing on multi-view sensing devices, effectively preventing incomplete target trajectories caused by occlusion, and at the same time correcting the longitude and latitude errors caused by slopes and object heights. Screen and optimize trajectory outliers based on discrete wavelets and threshold methods, smooth the horizontal and vertical trajectories based on Kalman filtering, and after verifying the speed consistency, the correct recognition rates of trajectories and objects are higher than 95%.

[0088] Step 23) Take the surrogate safety indicator as the extraction basis and set a threshold to roughly extract conflict pair information from the trajectory data cleaned in Step 22) to screen possible conflict events, and export the speed, horizontal and vertical relative coordinates, and direction angle fields of both parties in the conflict; use the conflict pair trajectory with the longest duration screened out as the standard to unify the sequence lengths of all conflict trajectories for training data annotation.

[0089] In this embodiment, with the generalized TTC less than 2s as the threshold, initially screen possible conflict events in the trajectory data cleaned in Step 22).

[0090] Step 24) Based on the definitions in Step 1), annotate the conflict pair trajectory data preliminarily screened in Step 23), specifically annotating the severity of each moment of the conflict event and the conflict scenario type of the event; divide the annotated conflict data into a training set, a test set, and a validation set.

[0091] In this embodiment, after removing homogeneous and low-risk conflict events, a total of 4682 typical conflict pair trajectory data are finally annotated, including 2051 non-conflict events, 2088 general conflict events, and 543 serious conflict events. The ratio of the training set to the validation set is 7:3.

[0092] Step 3) Construct an intersection traffic conflict recognition model based on Transformer. This model takes the trajectory information of conflict pairs as input and outputs the severity of conflict events and the recognition results of scenario types. As Figure 6 shown, this model consists of four parts: an input end (Input), a positional encoding (Positional Encoding), an encoder (Encoder), and a detection end (Prediction).

[0093] The intersection traffic conflict recognition model performs the following steps on the input data:

[0094] Step 31) Input the coordinate, speed, and direction angle information of each conflict pair at the input end of the intersection traffic conflict recognition model to form a tensor with a size of (n, m, 8), where n is the total number of conflict pairs, m is the length of each conflict trajectory sequence after unification, and 8 represents the number of fields of the input conflict pair trajectory information X, specifically as shown in Equation (1):

[0095] X = {x i t1:tn , y i t1:tn , v i t1:tn , DA i t1:tn ; x j t1:tn , y j t1:tn , v j t1:tn , DA j t1:tn} (2)

[0096] Among them, (x i t1:tn , y i t1:tn ), (x j t1:tn , y j t1:tn ) are the relative coordinates of the center points of conflict participants i and j from time t 1 to time t n ; v i t1:tn , v j t1:tn are the speeds of conflict participants i and j, with the unit of km / h; DA i t1:tn and DA j t1:tn are the direction angles of conflict participants i and j, respectively.

[0097] Step 32) Positional Encoding: Use positional encoding to introduce temporal and spatial position information, assisting the self-attention mechanism to distinguish data at different positions in the trajectory and improving the model's classification ability for traffic conflicts. In this embodiment, sine and cosine functions are used to generate unique encodings PE for each position of the conflict pair trajectory information:

[0098]

[0099] where t represents the index at time t, i represents the dimension index, and d model represents the dimension of the input, that is, the 8 variables shown in Equation (2).

[0100] Step 33) Use the encoder of Transformer to convert the high-dimensional trajectory data after positional encoding into an internal low-dimensional continuous representation, extract the deep features of traffic conflicts and transmit the global information of the trajectory. The encoder contains n identical layers, and each layer contains two modules: the multi-head attention mechanism and the fully connected position-wise feed-forward network. Residual connections are set for both modules, and layer normalization is performed.

[0101] Step 331) Use the multi-head attention mechanism to capture the motion information in the conflict pair trajectory data in parallel. The mathematical expression of each attention head is as follows:

[0102]

[0103] where Q, K, and V correspond to Query, Key, and Value respectively, and d K is the dimension of the key K vector, and Attention represents the attention score. Calculate to solve the problem of model overestimation, and then calculate the weights based on the Softmax function and multiply by the value V to obtain the attention score.

[0104] Therefore, the multi-head attention can be expressed as:

[0105]

[0106] In the formula, are all parameter matrices; i = 1, 2,..., h, and h is the number of heads of the multi-head attention.

[0107] Step 332) Set up a fully connected position-wise feed-forward network to enhance the model's response ability to positions. The position-wise feed-forward network consists of two linear layers, uses ReLU as the activation function, the input and output have the same dmodel dimension, and the hidden layer has dimension d ffn, after each multi-head attention and feed-forward network, the residuals are connected through a layer normalization layer to prevent excessive changes in the element values between layers, improving the generalization ability and training speed of the model.

[0108] Step 34) Flatten the sequence processed by the encoder and pass it through a linear layer to map it to a low-dimensional space, and generate a prediction result through a Softmax layer. The prediction result is the probability distribution of the conflict severity and the corresponding conflict scenarios at each timestamp

[0109]

[0110] Among them, is for t 1 to t n The probability distribution of the three conflict severities predicted at each timestamp; is the probability distribution that this conflict event is predicted as several scenario types.

[0111] Step 4) Use the weighted cross-entropy function as the training loss function, train the intersection traffic conflict recognition model constructed in Step 3 based on the dataset constructed in Step 2, and select the optimal model as the benchmark model based on the weighted F1 score.

[0112] Step 41) Introduce cross-entropy loss to measure the difference between the predicted probability distribution output by the model and the target probability distribution of the true label, and set weights for different target categories to solve the problem of class imbalance in the classification tasks of conflict severity and scenarios. Among them, the weight w i is defined as:

[0113]

[0114] Among them, N i is the number of occurrences of the i-th category in the test set; M represents the number of categories.

[0115] Then the loss function of the intersection traffic conflict recognition model is expressed as:

[0116]

[0117] Among them, N is the number of samples, w k and wl are the weights of severity and scenario types respectively, K and L are the number of categories of severity and scenario categories respectively, y ij t1:tn is for t 1 to t n The true values of the three conflict severities at each timestamp, is for t 1 to t nThe probability distributions of the three conflict severity levels predicted at each timestamp, y ij s is the true value of the scenario type of this conflict event, is the probability distribution that this conflict event is predicted as several scenario types. This loss function includes conflict severity loss and conflict type loss.

[0118] Step 42) After configuring the software and hardware training environment such as GPU, set hyperparameters such as the optimizer and learning rate for the model according to the dataset size, and select the weighted F1 score as the evaluation metric for the model recognition performance:

[0119]

[0120] where P i and R i respectively represent the precision rate and recall rate of the i-th category, and w i is the weight of the i-th category, as shown in Equation (7).

[0121] In this embodiment, 4682 conflict events are used as samples, and the maximum length of the trajectory data is 2798. The model uses the Adam optimizer and is trained for 300 rounds using backpropagation. The learning rate is 0.001, the dropout rate is 0.3, the batch size is 32, d ffn = 32, d K = d Q = d V = 8.

[0122] To ensure the fairness and reliability of the experiment, all experiments in this embodiment are carried out in the following software and hardware configurations: Linux ubuntu 20.04, NVIDIA A100-SXM4 (80GB, GPU), Intel(R) Xeon(R) Platinum 8358P@2.90GHz (CPU), 120GB RAM, Python 3.8, PyTorch 1.11.0, Cuda 11.3.

[0123] Introduce the Long Short-Term Memory (LSTM) as a control, and the specific parameters and performance of the model training are shown in Table 1:

[0124] Table 1

[0125]

[0126] Step 43) Take the Transformer with the highest weighted F1 score for the two recognition tasks in multiple rounds of training rThe model, as the benchmark model of the AICO model, is used for detecting the severity of traffic conflicts and the types of scenarios at intersections.

[0127] According to Table 1, the 2-layer 8-attention-head Transformer r has the highest F1 scores for the severity and conflict scenarios, which are 0.723 and 0.853 respectively. Taking this model as the benchmark model of the AI conflict observer model, it is used for detecting the severity of traffic conflicts and the types of scenarios at intersections.

[0128] Step 5) Input the trajectory information of the conflict pairs to be detected at the intersection into the AICO model, identify the severity and scenario type information of all conflict events at the intersection, and analyze the conflict distribution characteristics.

[0129] Step 5) includes the following steps:

[0130] Step 51) After cleaning the trajectory data to be detected collected by the perception device in the intersection according to the method in Step 2), export each possible conflict pair trajectory as a CSV file, which contains the speed, position coordinates and direction angle information of each conflict participant at each moment.

[0131] In this embodiment, taking the trajectory data collected by lidar in a medium-sized T-shaped intersection with a right-turn dedicated lane in a certain area for a total of 200 minutes as an example, after cleaning according to the method in Step 2), 7978 possible conflict pair trajectories are exported as CSV files, which contain the speed, position coordinates and direction angle information of each conflict pair at each moment.

[0132] Step 52) Input the conflict pair trajectory file to be detected into the benchmark model to obtain the severity of each traffic conflict at each moment and the scenario classification result of this conflict event.

[0133] The specific field table of the classification results of legal persons in this embodiment is shown in Table 2, and finally 89 serious conflict events and 788 general conflict events are obtained.

[0134] Table 2

[0135] Field Name Field Description Example filename Conflicting Corresponding Filename 202407021130000 conflict_pairs Conflict Pair Track Number 10559_10599 classification Conflict Scenario Type Straight and Left Turn Against Conflict duration Conflict Duration 1 start_time Conflict Start Time 2024-07-02 11:32:10.381 end_time Conflict End Time 2024-07-02 11:32:11.381 severity Severity Severe Conflict conflict_point Conflict Point Coordinates (1579.2456489923197,-1054.5463485541272) ETTC Generalized TTC Value 0.360190468 object_type1 Type of the First Conflicting Object Sedan, SUV object_type2 Type of the Second Conflicting Object Truck

[0136] Step 53) According to actual needs, count the severity and scenario types of general or serious conflict events, and analyze the conflict distribution characteristics: count the time distribution characteristics of conflicts according to the change of the number of conflicts and time; draw potential conflict points on the intersection map to form a conflict heat map to obtain the spatial distribution characteristics of conflicts; count the severity of conflicts of different vehicle types and different conflict types to obtain the severity distribution characteristics of conflicts.

[0137] In this embodiment, taking the 89 serious conflicts detected as an example, the conflict distribution characteristics are counted.

[0138] Step 531) Statistically analyze the distribution characteristics of conflict time, and draw a statistical chart of the hourly change in the number of conflicts as shown in Figure 7 . The results show that there are obvious peaks in the morning and evening rush hours for various types of severe conflicts, indicating a high collision risk at intersections during peak hours.

[0139] Step 532) Statistically analyze the distribution characteristics of conflict space, and plot potential conflict points on the intersection map to form a conflict heat map, as shown in Figure 8 . At the same time, statistically analyze the distribution of approach roads for various types of conflict scenarios. It can be seen that the severe conflicts at the west and east approach roads account for the highest proportions, 49% and 34% respectively; the conflicts between straight-ahead and oncoming left-turning, and lane-changing conflicts account for the highest proportions, 44% and 25% respectively.

[0140] Step 533) Conduct a distribution of conflict severity, and statistically analyze the conflict severity for different vehicle types and different conflict types, as shown in Figure 9 . According to Figure 9 a), it can be known that in the intersections of the embodiments, the conflicts involving sedans and SUVs are the most severe, with an average generalized TTC of 0.58 s; according to Figure 9 b), it can be known that the conflict between straight-ahead and oncoming left-turning is the most severe, with an average generalized TTC of 0.39 s.

[0141] Step 534) Conduct a distribution of conflict duration, and statistically analyze the conflict duration for different vehicle types and different conflict types, as shown in Figure 10 . According to Figure 10 a), it can be known that in the intersections of the embodiments, the average conflict duration of bicycles is the longest, at 1.40 s; according to Figure 10 b), it can be known that the conflict between straight-ahead and oncoming left-turning has the longest average conflict duration, at 1.10 s.

[0142] The preferred specific embodiments of the present invention have been described in detail above. It should be understood that those of ordinary skill in the art can make many modifications and variations based on the concept of the present invention without creative efforts. Therefore, all technical solutions that can be obtained by those skilled in the art in the technical field based on the concept of the present invention through logical analysis, reasoning, or limited experiments on the basis of the prior art should fall within the protection scope determined by the claims.

Claims

1. A method for identifying the severity and scene type of traffic conflicts at intersections based on Transformer, characterized in that: The following steps are involved: Step 1) define intersection conflict severity and scenario types; Step 2) Collect trajectory data of various types of intersections, clean the trajectory data, extract possible traffic conflict trajectory information, and mark the severity and scene type of each conflict event according to the definition of step 1) to construct a data set; Step 3) constructing a Transformer-based intersection traffic conflict recognition model, wherein the model takes conflict pair trajectory information as input and outputs conflict event severity and scene type recognition results; Step 4) using the weighted cross entropy function as the training loss function, training the intersection traffic conflict recognition model constructed in step 3) based on the data set constructed in step 2), and selecting the optimal model as the benchmark model based on the weighted F1 score; Step 5) Input the trajectory information of the intersection conflict pair to be detected into the benchmark model to identify the severity and scene type information of all conflict events at the intersection.

2. According to the Transformer-based method for identifying the severity and scene type of intersection traffic conflicts, the method is characterized in that: In the step 1), the severity of the conflict is defined as: using the alternative safety index as a quantitative index and observing whether collision avoidance behavior occurs as a qualitative index, the severity of the traffic conflict at each moment is divided into severe conflict, general conflict and no conflict.

3. According to the Transformer-based method for identifying the severity and scene type of intersection traffic conflicts, the method is characterized in that: In the step 1), the conflict scenario type is defined as follows: according to the lane and turning direction information of the traffic participants, an exhaustive method is adopted, and the symmetric exchangeability of the conflicting parties is considered to define the conflict scenarios within the intersection and at the entrance and exit of the intersection respectively, wherein the conflicts within the intersection include conflicts between motor vehicles and motor vehicles, and between motor vehicles and non-motor vehicles, and the conflicts at the entrance and exit of the intersection include conflicts between motor vehicles and non-motor vehicles, between motor vehicles and pedestrians, and between non-motor vehicles and pedestrians.

4. The method for identifying the severity and scene type of traffic conflicts at intersections based on Transformer according to claim 1, characterized in that: The step 2) comprises the following steps: Step 21) selecting multiple intersections with different geometric designs as data collection objects, applying target recognition and tracking algorithms to the video and point cloud data obtained by the sensing devices deployed at the intersections, and extracting the trajectory data of traffic participants; Step 22) performing data cleaning on the trajectory data, including outlier removal, trajectory smoothing and merging, and target misidentification correction; Step 23) Using the alternative safety index as the extraction basis and setting the threshold, the trajectory data cleaned in step 22) is roughly extracted for conflict pair information to screen possible conflict events and derive the speed, horizontal and vertical relative coordinates, and direction angle fields of the conflicting parties; the conflict pair trajectory with the longest duration is used as the standard to unify the sequence length of all conflict trajectories; Step 24) Based on the definition in step 1), the conflict trajectory data after the initial screening in step 23) is labeled, specifically, the severity of the conflict event at each moment and the conflict scene type of the event are labeled; the labeled conflict data is divided into a training set, a test set and a validation set.

5. The method for identifying the severity and scene type of traffic conflicts at intersections based on Transformer according to claim 1, characterized in that: The intersection traffic conflict identification model performs the following steps on the input data: Step 31) The coordinates, speed and direction angle information of each conflict pair are input at the input end of the intersection traffic conflict recognition model to form a tensor of size (n, m, 8), where n is the total number of conflict pairs, m is the length of each conflict trajectory sequence after unification, and 8 represents the number of fields of the input conflict pair trajectory information X, specifically: X={x i t1:tn ,y i t1:tn ,v i t1:tn ,YES i t1:tn ;x j t1:tn ,y j t1:tn ,v j t1:tn ,YES j t1:tn } Among them, (x i t1:tn ,y i t1:tn ), (x j t1:tn ,y j t1:tn ) are conflict participants i and j from t1 to t n The relative coordinates of the center point at the moment; v i t1:tn , v j t1:tn are the speeds of conflict participants i and j respectively; DA i t1:tn and DA j t1:tn are the direction angles of conflict participants i and j respectively; Step 32) Position encoding: Use sine and cosine functions to generate a unique encoding PE for each position of the collision pair trajectory information: Among them, t represents the index at time t, i represents the dimension index, and d model Indicates the dimension of the input; Step 33) using a Transformer encoder to convert the position-encoded high-dimensional trajectory data into an internal low-dimensional continuous representation, extracting deep features of traffic conflicts and transmitting trajectory global information, the encoder comprises n identical layers, each layer comprises two modules: a multi-head attention mechanism and a fully connected position-by-position feed-forward network, both modules are set with residual connections, and layer normalization is performed; Step 34) Flatten the sequence processed by the encoder and map it to a low-dimensional space through a linear layer, and generate a prediction result through a Softmax layer. The prediction result is the probability distribution of the severity of the conflict and the corresponding conflict scene at each timestamp. in, From t1 to t n The probability distribution of the three conflict severities predicted at each timestamp; The conflict event is predicted to be a probability distribution of several scenario types.

6. The method for identifying the severity and scene type of traffic conflicts at intersections based on Transformer according to claim 5, characterized in that: The step 33) comprises the following steps: Step 331) uses a multi-head attention mechanism to capture the motion information in the collision pair trajectory data in parallel, where the mathematical expression of each attention head is as follows: Among them, Q, K, and V correspond to query, key, and value respectively. K is the dimension of the key K vector, Attention represents the attention score; Multi-head attention is expressed as: MultiHead(Q,K,V)=Concat(head1,…,head h )W h where,head i =Attention(QW i Q ,KW i K ,VW i V ) In the formula, are all parameter matrices; i = 1, 2, ..., h, where h is the number of heads of multi-head attention; Step 332) Set a fully connected position-by-position feed-forward network to enhance the model's ability to respond to position. The position-by-position feed-forward network consists of two linear layers, uses ReLU as the activation function, and the input and output have the same d model dimension, the hidden layer has dimension d ffn ,After each multi-head attention and feed-forward network, the residuals are connected through a norm-adding layer.

7. The method for identifying the severity and scene type of traffic conflicts at intersections based on Transformer according to claim 1, characterized in that: In step 4), the cross entropy loss is introduced to measure the difference between the predicted probability distribution of the model output and the target probability distribution of the true label, and weights are set for different target categories to solve the problem of category imbalance in the classification task of conflict severity and scene, where the weight w of the i-th category is i Defined as: Among them, N i is the number of occurrences of the i-th category in the test set; M represents the number of categories; The loss function of the intersection traffic conflict recognition model is expressed as: Where N is the number of samples, w k and w l are the weights of severity and scene type, K and L are the number of severity and scene categories, y ij t1:tn From t1 to t n The true values ​​of the three conflict severity levels at each timestamp, From t1 to t n The probability distribution of the three conflict severity levels predicted at each timestamp, y ij s is the true value of the scene type of the conflict event, The conflict event is predicted to be a probability distribution of several scenario types.

8. The method for identifying the severity and scene type of traffic conflicts at intersections based on Transformer according to claim 7, characterized in that: In step 4), after configuring the software and hardware training environment, set hyperparameters for the model according to the size of the data set, and select the weighted F1 score as the evaluation indicator of the model recognition performance: Among them, P i and R i They represent the accuracy and completeness of the i-th category, w i is the weight of the i-th category; The Transformer model with the highest weighted F1 score for the two recognition tasks in multiple rounds of training is taken as the baseline model for detecting the severity and scene type of traffic conflicts at intersections.

9. The method for identifying the severity and scene type of traffic conflicts at intersections based on Transformer according to claim 1, characterized in that: The step 5) comprises the following steps: Step 51) After cleaning the trajectory data to be detected collected by the sensing device in the intersection according to the method of step 2), each possible conflict trajectory is exported as a CSV file, which contains the speed, position coordinates and direction angle information of the conflict participants at each moment; Step 52) Input the trajectory file of the conflict pair to be detected into the benchmark model to obtain the conflict severity at each moment of each traffic conflict and the scene classification result of the conflict event.

10. The method for identifying the severity and scene type of traffic conflicts at intersections based on Transformer according to claim 9, characterized in that: The step 5) further comprises: Step 53) According to actual needs, the severity and scenario types of general or serious conflict events are counted, and the conflict distribution characteristics are analyzed: the time distribution characteristics of the conflict are counted according to the changes in the number of conflicts and time; the potential conflict points are plotted in the intersection map to form a conflict heat map to obtain the spatial distribution characteristics of the conflict; the conflict severity of different vehicle models and different conflict types is counted to obtain the conflict severity distribution characteristics.