Multi-level traffic accident warning method and system based on spatio-temporal data mining

By constructing a multi-level early warning method for traffic accidents based on spatiotemporal data mining, and utilizing an encoder-decoder model and a multi-agent interaction mechanism, the problem of insufficient extraction of dynamic traffic flow characteristics in existing technologies is solved, and high-precision risk assessment and dynamic traffic control for complex intersections are achieved.

CN122200995APending Publication Date: 2026-06-12JIANGSU TESHI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JIANGSU TESHI INTELLIGENT TECH CO LTD
Filing Date
2026-03-26
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing traffic accident early warning technologies are unable to effectively capture the dynamic correlation between traffic flow and vehicle trajectories at intersections, and cannot accurately characterize the evolution of traffic conditions at complex intersections, resulting in low early warning accuracy.

Method used

The multi-level early warning method for traffic accidents based on spatiotemporal data mining acquires spatiotemporal data of target intersections, constructs a bidirectional temporal correlation graph network model with an encoder-decoder structure, and generates a spatial propagation network of traffic flow congestion by combining a multi-agent interaction mechanism, thereby predicting risk levels and implementing dynamic traffic control.

Benefits of technology

It improves the accuracy of traffic accident risk assessment under complex road conditions, enhances the model's adaptability to diverse traffic scenarios, and enables graded early warning and dynamic traffic control for different risk levels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122200995A_ABST
    Figure CN122200995A_ABST
Patent Text Reader

Abstract

The application provides a traffic accident multi-level early warning method and system based on spatio-temporal data mining, relates to the technical field of traffic safety, and comprises the following steps: acquiring spatio-temporal data of a target intersection and extracting a multi-dimensional spatio-temporal feature sequence, constructing a bidirectional time sequence correlation graph network model, analyzing congestion evolution mode and risk propagation characteristics, constructing a space propagation network based on a multi-agent interaction mechanism, calculating risk propagation intensity and generating a risk level prediction result, and dynamically adjusting traffic control measures, so that the accuracy and timeliness of traffic accident early warning are improved, and the traffic accident occurrence rate is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of traffic safety technology, and in particular to a multi-level early warning method and system for traffic accidents based on spatiotemporal data mining. Background Technology

[0002] Traffic accident early warning, as a crucial means of preventing traffic accidents, has become a key research area in intelligent transportation systems. Traditional traffic accident early warning methods primarily rely on historical data statistical analysis and experience-based judgment. However, with the development of technologies such as the Internet of Things, big data, and artificial intelligence, traffic accident early warning methods based on spatiotemporal data mining have gradually become a research hotspot. These methods collect multi-source spatiotemporal data, including road traffic flow, vehicle trajectories, and traffic light timings, and utilize data mining and deep learning techniques to predict and issue early warnings of traffic accident risks.

[0003] Currently, urban intersections are high-incidence areas for traffic accidents, with complex and ever-changing traffic flows and various traffic participants interacting and intertwining, posing unique challenges to traffic accident early warning at intersections. Existing technologies have begun to explore the application of spatiotemporal data mining techniques to traffic accident early warning at intersections. By analyzing traffic flow patterns, vehicle trajectory characteristics, and historical accident distribution, potential risk factors can be identified, providing decision support for traffic management departments.

[0004] Existing traffic accident early warning technologies still have some obvious shortcomings. Most existing methods are unable to effectively capture the dynamic correlation between traffic flow and vehicle trajectory at intersections, and cannot accurately characterize the traffic state evolution process at complex intersections, resulting in low early warning accuracy. Summary of the Invention

[0005] This invention provides a multi-level early warning method and system for traffic accidents based on spatiotemporal data mining, which can solve the problems in the prior art.

[0006] A first aspect of this invention provides a multi-level early warning method for traffic accidents based on spatiotemporal data mining, comprising: Acquire spatiotemporal data of the target intersection, extract temporal features based on a sliding time window, and construct a spatiotemporal correlation matrix by combining the intersection topology data to generate a multidimensional spatiotemporal feature sequence; Based on the multidimensional spatiotemporal feature sequence, a bidirectional temporal correlation graph network model with an encoder-decoder structure is constructed. The encoder encodes the traffic flow change features and vehicle trajectory evolution features of the target intersection into a dynamic correlation graph structure. The decoder, based on the spatiotemporal distribution features of historical accidents, generates the congestion evolution pattern and risk propagation features of the intersection traffic flow through a forward state prediction mechanism and a backward pattern extraction mechanism. The real-time traffic status information of the target intersection is matched with the congestion evolution pattern to obtain the current congestion situation characteristics of the intersection. Based on the congestion situation characteristics and the risk propagation characteristics, a spatial propagation network of traffic flow congestion degree is constructed based on a multi-agent interaction mechanism. The risk propagation intensity is calculated by establishing a state transition equation for risk diffusion. Combined with a risk accumulation threshold judgment mechanism, the traffic accident risk level prediction results for different areas of the target intersection are generated. Based on the traffic accident risk level prediction results, a tiered early warning strategy is adopted to dynamically adjust traffic control measures at target intersections.

[0007] The encoder encodes the traffic flow variation characteristics and vehicle trajectory evolution characteristics of the target intersection into a dynamic correlation graph structure, including: Obtain real-time trajectory data and traffic flow data of vehicles at the target intersection; Based on the real-time trajectory data, spatial distance parameters and motion direction parameters between vehicles are calculated, and a spatial correlation matrix is ​​constructed according to the spatial distance parameters and motion direction parameters. The spatial correlation matrix is ​​used to characterize the spatial correlation strength between vehicles. Based on the traffic flow data, a traffic flow feature matrix is ​​constructed using a time decay function. The traffic flow feature matrix is ​​used to characterize the temporal variation characteristics of traffic flow. The spatial correlation matrix and the traffic flow feature matrix are fused to generate a dynamic correlation graph structure. The dynamic correlation graph structure includes a node set and an edge set, wherein the node set includes vehicle trajectory nodes and traffic flow nodes, and the edge set represents the correlation relationship between nodes.

[0008] The decoder, based on the spatiotemporal distribution characteristics of historical accidents, generates congestion evolution patterns and risk propagation characteristics of intersection traffic flow through a forward state prediction mechanism and a backward pattern extraction mechanism, including: The historical state sequence and current state information of the target intersection are obtained, and the historical state sequence is weighted based on the attention weight calculation mechanism to obtain the forward state features. The forward state features and the current state information are fused together, and a future state prediction result for the target intersection is generated through nonlinear transformation. Historical accident time-series data of the target intersection is obtained, and features are extracted from the historical accident time-series data based on the temporal attention pooling mechanism to obtain backward evolution features; The future state prediction results are fused with the backward evolution features after normalization to construct a congestion evolution state transition matrix. The congestion evolution state transition matrix represents the state transition probability between different areas of the intersection. The congestion evolution mode is determined based on the congestion evolution state transition matrix. A risk propagation network is constructed based on the congestion evolution state transition matrix. The risk propagation network calculates risk propagation characteristics by integrating the spatial adjacency relationship and congestion state transition relationship between intersection areas.

[0009] Matching the real-time traffic status information of the target intersection with the congestion evolution pattern yields the current congestion situation characteristics of the intersection, including: Calculate the state distance metric between the real-time traffic state information and the congestion evolution mode. The state distance metric is obtained by weighted Euclidean distance of each feature dimension. The temporal matching distance between the traffic state feature vector corresponding to the real-time traffic state information and the congestion evolution mode is calculated based on the dynamic time warping algorithm. The temporal matching distance is obtained by aligning time series. The best-matching congestion evolution mode is selected based on a weighted combination of the state distance metric and the temporal matching distance; congestion situation features are constructed based on the best-matching congestion evolution mode, and the congestion situation features include congestion degree components and diffusion trend components.

[0010] Based on the congestion situation characteristics and the risk propagation characteristics, a spatial propagation network for traffic flow congestion is constructed using a multi-agent interaction mechanism. The risk propagation intensity is calculated by establishing a state transition equation for risk diffusion, including: For each area in the target intersection, a corresponding agent node is established, and the interaction influence strength between agent nodes is calculated based on the physical distance between areas, as well as the congestion situation characteristics and the risk propagation characteristics, to generate an interaction influence matrix. The congestion state update parameters are calculated based on the interaction influence matrix. The congestion state update parameters take into account the congestion degree differences and vehicle density changes in adjacent areas to generate a network state transition matrix. The risk intensity value of each region is calculated by combining the network state transition matrix with the risk diffusion state transition equation. The risk intensity value is obtained by combining the current congestion level and the historical risk state.

[0011] For each area within the target intersection, a corresponding agent node is established. Based on the physical distance between areas, as well as the congestion situation characteristics and the risk propagation characteristics, the interaction influence strength between agent nodes is calculated, generating an interaction influence matrix including: Extract the diffusion trend component and congestion degree component from the congestion situation features, calculate the congestion state correlation between agent nodes, and determine the congestion state correlation by normalizing the diffusion trend component and congestion degree component and combining it with the state transition probability to generate a congestion situation influence matrix. Based on the risk propagation range and risk propagation speed in the aforementioned risk propagation characteristics, a risk propagation impact matrix for intelligent agent nodes is constructed. The physical distance between regions, the congestion situation impact matrix, and the risk propagation impact matrix are normalized and then weighted and fused to obtain the interaction impact matrix.

[0012] A second aspect of the present invention provides a multi-level early warning system for traffic accidents based on spatiotemporal data mining, comprising: The first unit is used to acquire spatiotemporal data of the target intersection, extract temporal features based on a sliding time window, and construct a spatiotemporal correlation matrix by combining the intersection topology data to generate a multidimensional spatiotemporal feature sequence. The second unit is used to construct a bidirectional temporal correlation graph network model with an encoder-decoder structure based on the multidimensional spatiotemporal feature sequence. The encoder encodes the traffic flow change features and vehicle trajectory evolution features of the target intersection into a dynamic correlation graph structure. The decoder generates the congestion evolution pattern and risk propagation features of the intersection traffic flow based on the spatiotemporal distribution features of historical accidents through a forward state prediction mechanism and a backward pattern extraction mechanism. The third unit is used to match the real-time traffic status information of the target intersection with the congestion evolution mode to obtain the congestion situation characteristics of the current intersection. The fourth unit is used to construct a spatial propagation network of traffic flow congestion degree based on the congestion situation characteristics and risk propagation characteristics and a multi-agent interaction mechanism. It calculates the risk propagation intensity by establishing a state transition equation for risk diffusion and generates traffic accident risk level prediction results for different areas of the target intersection by combining a risk accumulation threshold judgment mechanism. The fifth unit is used to dynamically adjust traffic control measures at target intersections based on the traffic accident risk level prediction results and using a graded early warning strategy.

[0013] A third aspect of the embodiments of the present invention, An electronic device is provided, comprising: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.

[0014] Fourth aspect of the present invention, A computer-readable storage medium is provided, having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.

[0015] The beneficial effects of this application are as follows: This invention generates a multidimensional spatiotemporal feature sequence by extracting temporal features based on a sliding time window and constructing a spatiotemporal correlation matrix in combination with the intersection topology. This solves the problem of insufficient utilization of spatiotemporal data correlation in traditional traffic accident early warning methods and improves the accuracy of traffic accident risk assessment under complex road conditions.

[0016] This invention constructs a bidirectional temporal correlation graph network model with an encoder-decoder structure. Through forward state prediction and backward pattern extraction mechanisms, it effectively captures the evolution patterns of traffic flow and risk propagation characteristics, overcoming the shortcomings of existing technologies in extracting dynamic changes in traffic flow and enhancing the model's adaptability to diverse traffic scenarios.

[0017] This invention constructs a spatial propagation network for traffic flow congestion based on a multi-agent interaction mechanism, and generates graded early warning results by combining a risk accumulation threshold judgment mechanism. This enables dynamic adjustment of traffic control measures at target intersections. Compared with traditional single-threshold early warning methods, the multi-level early warning method provided by this invention can adopt corresponding traffic control strategies for different risk levels. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating the multi-level early warning method for traffic accidents based on spatiotemporal data mining, as described in an embodiment of the present invention. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0021] Figure 1 This is a flowchart illustrating the multi-level early warning method for traffic accidents based on spatiotemporal data mining, as described in an embodiment of the present invention. Figure 1 As shown, the method includes: Acquire spatiotemporal data of the target intersection, extract temporal features based on a sliding time window, and construct a spatiotemporal correlation matrix by combining the intersection topology data to generate a multidimensional spatiotemporal feature sequence; Based on the multidimensional spatiotemporal feature sequence, a bidirectional temporal correlation graph network model with an encoder-decoder structure is constructed. The encoder encodes the traffic flow change features and vehicle trajectory evolution features of the target intersection into a dynamic correlation graph structure. The decoder, based on the spatiotemporal distribution features of historical accidents, generates the congestion evolution pattern and risk propagation features of the intersection traffic flow through a forward state prediction mechanism and a backward pattern extraction mechanism. The real-time traffic status information of the target intersection is matched with the congestion evolution pattern to obtain the current congestion situation characteristics of the intersection. Based on the congestion situation characteristics and the risk propagation characteristics, a spatial propagation network of traffic flow congestion degree is constructed based on a multi-agent interaction mechanism. The risk propagation intensity is calculated by establishing a state transition equation for risk diffusion. Combined with a risk accumulation threshold judgment mechanism, the traffic accident risk level prediction results for different areas of the target intersection are generated. Based on the traffic accident risk level prediction results, a tiered early warning strategy is adopted to dynamically adjust traffic control measures at target intersections.

[0022] For example, the spatiotemporal data of the target intersection may include basic traffic parameters such as the number of vehicles passing through, average vehicle speed, queue length, and traffic light status. The raw data is processed using a sliding time window to extract temporal features, with a window length of 5 minutes and a sliding window every minute. For traffic flow data, the mean, variance, maximum, and minimum values ​​of the number of vehicles passing through are calculated as basic features within each time window. For vehicle speed data, features such as average speed, speed standard deviation, and speed change rate are extracted. Simultaneously, the differences and trends in feature values ​​between adjacent time windows are calculated to form a temporal evolution feature vector.

[0023] The intersection is divided into multiple functional zones, including approach lanes, exit lanes, conflict zones, and waiting areas. Each zone is assigned a unique identifier, and an adjacency matrix is ​​established between the zones. The element values ​​in the adjacency matrix represent the connectivity between two zones; directly adjacent zones are assigned a value of 1, while indirectly adjacent zones are assigned a weight value between 0 and 1 based on their distance.

[0024] The spatiotemporal correlation matrix is ​​constructed by fusing temporal features and spatial topological relationships. The extracted temporal features are grouped according to spatial location, with each intersection area corresponding to a set of feature vectors. The rows and columns of the spatiotemporal correlation matrix represent different time steps and spatial regions, respectively, and the matrix element values ​​reflect the traffic state intensity at specific times and spatial locations. By calculating the correlation coefficients of feature vectors from different regions within the same time period, as well as the autocorrelation coefficients of the same region within different time periods, a complete spatiotemporal correlation description is formed.

[0025] The multi-agent interaction mechanism models each area of ​​the intersection as an independent agent. Each agent maintains its own area's traffic state information and exchanges information with neighboring agents. The interactions between agents include three types: state information sharing, risk warning transmission, and coordinated control decision-making. State information sharing allows each agent to obtain real-time traffic conditions from neighboring areas; risk warning transmission ensures that risk information is promptly disseminated to potentially affected areas; and coordinated control decision-making determines the optimal traffic control strategy through negotiation among multiple agents.

[0026] The spatial propagation network is constructed with intersection areas as nodes and traffic flow connections between areas as edges. Each edge in the network has a corresponding weight value, representing the propagation intensity of the risk along that path. The propagation intensity is affected by traffic flow, road capacity, and geometric features. When a node experiences a high-risk state, the risk propagates along the connecting edges to other nodes, with the propagation intensity decreasing as distance increases.

[0027] The state transition equation for risk diffusion describes the process of risk transfer between adjacent regions. The transfer probability depends on the risk level of the source region, the current state of the target region, and the propagation conditions of the connecting path. Regions with higher risk levels have a stronger ability to propagate risk outwards; regions already in a high-risk state have a lower threshold for accepting additional risk; and the stronger the portability of the propagation path, the easier it is for risk transfer to occur.

[0028] The risk accumulation threshold assessment mechanism sets corresponding risk thresholds based on the traffic characteristics of different areas. Major roads have higher risk thresholds, while minor roads have lower thresholds. The determination of the thresholds takes into account the frequency of historical accidents, road design standards, and traffic management requirements. When the accumulated risk value of an area exceeds the set threshold, the area is deemed high-risk and corresponding preventative measures are required.

[0029] Traffic accident risk levels are divided into four categories: low risk, medium risk, high risk, and very high risk. Low risk indicates normal traffic conditions and a very low probability of an accident. Medium risk indicates abnormal fluctuations in traffic conditions, requiring close monitoring. High risk indicates severe traffic congestion or the presence of other hazardous factors, resulting in a relatively high probability of an accident. Very high risk indicates extremely poor traffic conditions, with a very high probability of an accident, requiring immediate control measures.

[0030] The tiered early warning strategy formulates corresponding traffic control measures for different risk levels. For low-risk areas, normal traffic signal control is maintained, and status monitoring is conducted regularly. For medium-risk areas, monitoring frequency is increased, and signal timing is adjusted appropriately to optimize traffic flow. For high-risk areas, flow restriction measures are implemented, guiding some vehicles to detour via alternative routes, while additional traffic management personnel are deployed to direct traffic on-site. For extremely high-risk areas, temporary traffic control is implemented, prohibiting non-essential vehicles from entering, and emergency plans are activated to ensure traffic safety.

[0031] In one optional implementation, the encoder encodes the traffic flow variation characteristics and vehicle trajectory evolution characteristics of the target intersection into a dynamic correlation graph structure, including: Obtain real-time trajectory data and traffic flow data of vehicles at the target intersection; Based on the real-time trajectory data, spatial distance parameters and motion direction parameters between vehicles are calculated, and a spatial correlation matrix is ​​constructed according to the spatial distance parameters and motion direction parameters. The spatial correlation matrix is ​​used to characterize the spatial correlation strength between vehicles. Based on the traffic flow data, a traffic flow feature matrix is ​​constructed using a time decay function. The traffic flow feature matrix is ​​used to characterize the temporal variation characteristics of traffic flow. The spatial correlation matrix and the traffic flow feature matrix are fused to generate a dynamic correlation graph structure. The dynamic correlation graph structure includes a node set and an edge set, wherein the node set includes vehicle trajectory nodes and traffic flow nodes, and the edge set represents the correlation relationship between nodes.

[0032] In practical applications, real-time trajectory data is collected through cameras or radar devices installed at intersections, including the position coordinates, speed, and direction of travel of each vehicle at different times. For example, trajectory data collected at an intersection records the position information of 50 vehicles every 0.5 seconds over a continuous 300 seconds, with the specific data format being {vehicle ID, timestamp, X coordinate, Y coordinate, speed, direction angle}. Traffic flow data is obtained through induction coils or video counters, including changes in traffic flow in all directions at the intersection, recording the number of vehicles passing through at 5-minute intervals to form time-series data.

[0033] Based on real-time trajectory data, spatial distance parameters and motion direction parameters between vehicles are calculated, and a spatial correlation matrix is ​​constructed based on these two parameters. The spatial distance parameter is calculated using the Euclidean distance formula. For any two vehicles A and B, their position coordinates (XA, YA) and (XB, YB) at a certain moment are taken, and the distance between the two points is calculated. For example, if vehicle A's coordinates are (120.5, 85.3) and vehicle B's coordinates are (125.8, 90.6), the calculated distance is 7.58 meters. The motion direction parameter is obtained by calculating the cosine of the angle between the direction vectors of the two vehicles, with a value ranging from [-1, 1]. The closer the value is to 1, the more similar the directions are. For example, if vehicle A's direction of travel is 75 degrees and vehicle B's direction of travel is 85 degrees, the calculated direction similarity is 0.9848. In the construction of the spatial association matrix, a higher association strength value is assigned when the distance between two vehicles is less than a set distance threshold, such as 20 meters, and the directional similarity is higher than a specified directional threshold, such as 0.8; otherwise, a lower association strength value is assigned. In specific implementation, the association strength is calculated by multiplying the inverse of the distance by the directional similarity, and then normalized to obtain a spatial association matrix of size N×N, where N is the number of vehicles.

[0034] Based on traffic flow data, a traffic flow feature matrix is ​​constructed using a time decay function. First, the intersection is divided into different areas; for example, a crossroads is divided into four entrance areas (east, west, south, and north) and four exit areas, for a total of eight areas. For each area, traffic flow data over a past period (e.g., 30 minutes) is collected, and the historical data is weighted using the time decay function. The time decay function uses a negative exponential form, so that traffic flow data further away from the current time has a smaller weight. For example, assuming the traffic flow in a certain area over the past 30 minutes was 45, 52, 60, 58, 65, and 70 vehicles per 5 minutes, after applying a decay coefficient of 0.8, the weights of the traffic flow in each time period are 0.32, 0.41, 0.51, 0.64, 0.8, and 1.0, respectively. The weighted traffic flow value is the sum of the corresponding products. This process is repeated for all regions to form a flow feature matrix that characterizes the time-series changes in flow in each region. The matrix size is M×K, where M is the number of regions and K is the feature dimension. In this embodiment, K is 6, corresponding to the weighted flow features of 6 time periods.

[0035] The spatial correlation matrix and the traffic flow feature matrix are fused to generate a dynamic correlation graph structure. The fusion process employs an attention mechanism to calculate the correlation between vehicle trajectory features and traffic flow features. Specifically, for each vehicle node in the spatial correlation matrix, its trajectory feature vector (containing information such as position, speed, acceleration, and direction) is extracted; then, the similarity score between this feature vector and the traffic flow features of each region in the traffic flow feature matrix is ​​calculated; and based on the score, connection edges between vehicle nodes and traffic flow nodes are constructed.

[0036] For example, if a vehicle is located at the east entrance of an intersection and is decelerating, the system calculates a connection weight of 0.85 between the vehicle and the traffic flow nodes in the east entrance area, indicating a high correlation. The resulting dynamic association graph structure contains 50 vehicle trajectory nodes and 8 traffic flow nodes, and the edge set includes spatial association edges between vehicle nodes (based on a spatial association matrix) and traffic flow association edges between vehicle nodes and traffic flow nodes. This graph structure comprehensively captures the interactive relationships between vehicles in the intersection traffic environment and their coupling effect with the overall traffic flow, and can be used for subsequent traffic state prediction and control decisions.

[0037] The node features and edge weights of the aforementioned dynamic association graph structure are dynamically adjusted as real-time data is updated, updating every 5 seconds to ensure that the graph structure can accurately reflect the actual traffic conditions at the current intersection, providing reliable data support for traffic signal optimization and vehicle behavior prediction.

[0038] In one optional implementation, the decoder, based on the spatiotemporal distribution characteristics of historical accidents, generates congestion evolution patterns and risk propagation characteristics of intersection traffic flow through a forward state prediction mechanism and a backward pattern extraction mechanism, including: The historical state sequence and current state information of the target intersection are obtained, and the historical state sequence is weighted based on the attention weight calculation mechanism to obtain the forward state features. The forward state features and the current state information are fused together, and a future state prediction result for the target intersection is generated through nonlinear transformation. Historical accident time-series data of the target intersection is obtained, and features are extracted from the historical accident time-series data based on the temporal attention pooling mechanism to obtain backward evolution features; The future state prediction results are fused with the backward evolution features after normalization to construct a congestion evolution state transition matrix. The congestion evolution state transition matrix represents the state transition probability between different areas of the intersection. The congestion evolution mode is determined based on the congestion evolution state transition matrix. A risk propagation network is constructed based on the congestion evolution state transition matrix. The risk propagation network calculates risk propagation characteristics by integrating the spatial adjacency relationship and congestion state transition relationship between intersection areas.

[0039] The decoder first acquires the historical state sequence and current state information of the target intersection. The historical state sequence includes intersection state data over a certain time window, such as the past 24 hours. The decoder performs weighted processing on the historical state sequence based on an attention weight calculation mechanism to obtain forward state features.

[0040] The attention weighting mechanism assigns a weight to each historical state by calculating its correlation with the current state and states at various historical points in time. Specifically, for each state in the historical sequence, its similarity to the current state is calculated, and a weight coefficient is obtained through normalization. For example, if the current time is 8 AM (morning rush hour), the morning rush hour period in the historical data might receive a higher weight. Assuming that yesterday's state at 8 AM was highly similar to the current state, that time point might receive a weight of 0.15, while data points from off-peak periods might only receive a weight of 0.01. These weights are multiplied by the corresponding historical states and summed to obtain the weighted forward state features.

[0041] The system fuses forward state features with current state information and generates a future state prediction for the target intersection through a nonlinear transformation. Feature fusion employs a join operation, concatenating the forward state feature vector with the current state vector to form a fused feature vector. This fused feature vector undergoes a multi-layer nonlinear transformation, using two fully connected layers with activation functions. Each layer has 128 and 64 neurons, respectively, using the ReLU activation function. The number of neurons in the final output layer matches the dimension of the prediction target. For example, to predict traffic flow for the next hour, the output layer dimension would be 4 times the state dimension. The prediction results are represented as traffic flow, vehicle speed, and other state values ​​at various future time points.

[0042] The decoder also acquires historical accident time-series data for the target intersection. This data includes information on traffic accidents that occurred at the target intersection over a period of time. Each record contains attributes such as the time, location, type, and severity of the accident. For example, it records 30 traffic accidents that occurred at the target intersection in the past 3 years. Each accident record includes the time of the incident, precise GPS coordinates, accident type (such as rear-end collision, minor collision, running a red light), and severity.

[0043] Feature extraction from historical accident time-series data is performed using a temporal attention pooling mechanism to obtain backward evolution features. This mechanism considers the temporal distribution patterns of accidents, assigning different weights to accidents in different time periods. First, a day is divided into multiple time periods, such as every 2 hours, for a total of 12 time periods. The accident frequency within each time period is counted and normalized, serving as the temporal weight for that period. Then, for each accident sample, a weighted average is applied based on the weight of its occurrence time, and a feature vector containing encoded information such as location, type, and severity is extracted. By summing these weighted feature vectors, the backward evolution features are obtained, reflecting the spatiotemporal distribution patterns of accidents at the target intersection.

[0044] The predicted future state is fused with the normalized backward evolution features to construct a congestion evolution state transition matrix. Normalization ensures that both types of features are within the same numerical range, preventing one feature from dominating the fusion result due to excessively large values. Feature fusion uses a weighted summation method, with weights optimized based on the validation dataset, such as a forward feature weight of 0.7 and a backward feature weight of 0.3. The fused features are used to construct the congestion evolution state transition matrix, which has a size of N×N, where N represents the number of intersection areas. For example, if the intersection is divided into 16 areas with a 4×4 grid, the state transition matrix is ​​a 16×16 square matrix. Each element M(i,j) in the matrix represents the congestion state transition probability from area i to area j, with a value ranging from 0 to 1. The state transition matrix reflects how congestion propagates and evolves between different areas of the intersection, thus determining the congestion evolution pattern.

[0045] A risk propagation network is constructed based on the congestion evolution state transition matrix. The risk propagation network is a weighted directed graph where nodes represent different areas of an intersection, and edges represent the risk propagation relationships between areas. The edge weights are determined by two parts: spatial adjacency and congestion state transition relationships. Spatial adjacency is calculated based on the physical distance between areas, with higher adjacency degrees between adjacent areas; congestion state transition relationships are directly derived from the state transition matrix. The two are linearly combined to obtain the final edge weights; for example, the spatial adjacency weight can be set to 0.4, and the state transition weight to 0.6. In the constructed risk propagation network, by calculating the centrality indices of nodes (such as degree centrality, betweenness centrality, etc.), key areas and propagation paths of risk propagation are identified, thereby obtaining the risk propagation characteristics of the target intersection.

[0046] In one optional implementation, the real-time traffic status information of the target intersection is matched with the congestion evolution pattern to obtain the current congestion situation characteristics of the intersection, including: Calculate the state distance metric between the real-time traffic state information and the congestion evolution mode. The state distance metric is obtained by weighted Euclidean distance of each feature dimension. The temporal matching distance between the traffic state feature vector corresponding to the real-time traffic state information and the congestion evolution mode is calculated based on the dynamic time warping algorithm. The temporal matching distance is obtained by aligning time series. The best-matching congestion evolution mode is selected based on a weighted combination of the state distance metric and the temporal matching distance; congestion situation features are constructed based on the best-matching congestion evolution mode, and the congestion situation features include congestion degree components and diffusion trend components.

[0047] A congestion evolution model library has been established based on historical data. This library contains various typical congestion development patterns, such as "gradual escalation," "sudden severe congestion," "fluctuating escalation," and "rapid recovery." Each model consists of a series of time-series feature vectors, depicting the complete process from the onset to the dissipation of different types of congestion. For example, the "gradual escalation" model might include data from 30 time points, showing a gradual evolution from mild congestion (e.g., traffic flow of 300 vehicles / hour and speed of 25 km / h) to severe congestion (e.g., traffic flow of 150 vehicles / hour and speed of 5 km / h).

[0048] The state distance metric between real-time traffic state information and congestion evolution patterns is calculated. This value is obtained by weighted Euclidean distance calculation of each feature dimension. A dynamic time warping algorithm is used to calculate the temporal matching distance between real-time traffic state information and congestion evolution patterns. This algorithm allows for non-linear scaling on the time axis and can identify sequences with distorted time scales but similar patterns. In practice, a cumulative distance matrix is ​​constructed, and the optimal path is found through dynamic programming. This path represents the best alignment between the two time series. For example, data from 24 real-time time points may be matched with 30 time points in a "fluctuation aggravation" pattern library. The dynamic time warping algorithm finds the optimal alignment path with a total matching distance of 78.5.

[0049] The optimal congestion evolution mode is selected based on a weighted combination of state distance metric and temporal matching distance. In practical applications, the state distance weight is set to 0.4, and the temporal matching distance weight is set to 0.6. For each candidate mode, a comprehensive distance score is calculated. For example, for the "gradually worsening" mode, the state distance is 5.39, and the temporal matching distance is 82.3, so the comprehensive score is 0.4 × 5.39 + 0.6 × 82.3 = 51.5; for the "fluctuating" mode, the state distance is 6.12, and the temporal matching distance is 78.5, so the comprehensive score is 0.4 × 6.12 + 0.6 × 78.5 = 49.6. In this example, the "fluctuating" mode has the lowest comprehensive score and is selected as the optimal matching mode.

[0050] Based on the optimal matching congestion evolution model, the system constructs congestion situation characteristics, including a congestion severity component and a diffusion trend component. The congestion severity component reflects the severity of current intersection congestion and can be divided into four levels: smooth traffic, light congestion, moderate congestion, and severe congestion, with a corresponding value range of [0,1]. The diffusion trend component describes the direction and rate of congestion development and can be represented by three trends: rising, stable, and falling, with a corresponding value range of [-1,1].

[0051] This method can also integrate the congestion characteristics of multiple adjacent intersections to construct a regional congestion propagation network, enabling greater-scale traffic situation perception and prediction, and providing decision support for traffic management departments to formulate traffic management measures.

[0052] In one optional implementation, based on the congestion situation characteristics and the risk propagation characteristics, a spatial propagation network for traffic flow congestion is constructed using a multi-agent interaction mechanism. The risk propagation intensity is calculated by establishing a state transition equation for risk diffusion, including: For each area in the target intersection, a corresponding agent node is established, and the interaction influence strength between agent nodes is calculated based on the physical distance between areas, as well as the congestion situation characteristics and the risk propagation characteristics, to generate an interaction influence matrix. The congestion state update parameters are calculated based on the interaction influence matrix. The congestion state update parameters take into account the congestion degree differences and vehicle density changes in adjacent areas to generate a network state transition matrix. The risk intensity value of each region is calculated by combining the network state transition matrix with the risk diffusion state transition equation. The risk intensity value is obtained by combining the current congestion level and the historical risk state.

[0053] Establishing intelligent agent nodes requires dividing the target intersection into zones based on its function and location characteristics. Each zone has its boundaries determined according to traffic function characteristics, including an approach lane zone, an exit lane zone, a conflict zone, and a buffer zone. The approach lane zone covers the road segment before vehicles enter the intersection, typically extending to within 100 meters before the stop line. The exit lane zone covers the road segment after vehicles exit the intersection, extending to within 50 meters after the stop line. The conflict zone is located in the center of the intersection and is the core area where traffic flows from all directions converge. The buffer zone is located between the turning lane and the straight lane, used for lane changes and merging.

[0054] The process of establishing an agent node includes node initialization, attribute configuration, and communication interface setup. Node initialization assigns a unique identifier and coordinate information to each region. The identifier uses a two-digit code, with the first digit indicating direction and the second indicating the function type. Attribute configuration includes setting the node's detection capability, computing capability, and storage capability parameters. Communication interface setup establishes information transmission channels between nodes, supporting status information broadcasting, query request processing, and coordination command execution.

[0055] Calculating the strength of interactions between agent nodes requires quantifying the degree of interaction between regions. Physical distance influence is achieved by measuring the Euclidean distance between the center points of the regions, with a measurement accuracy down to the meter level. Distance weights are calculated using an inverse proportional function, where the weight value equals a baseline distance divided by the actual distance, with the baseline distance set at fifty meters. When two regions are fifty meters apart, the weight is one; when the distance is one hundred meters, the weight is 0.5; and when the distance is two hundred meters, the weight is 0.25.

[0056] The contribution of congestion characteristics to the intensity of interactive effects is calculated using congestion propagation tendency. Congestion propagation tendency reflects the strength of a region's ability to spread congestion to surrounding areas. The calculation process includes assessing the congestion saturation, vehicle backlog, and traffic flow output capacity of the source region. Congestion saturation is obtained by the ratio of the current number of vehicles to the region's capacity limit; a ratio exceeding 0.8 is considered close to saturation. Vehicle backlog is measured by statistically analyzing the number of vehicles in queues and the average waiting time. Traffic flow output capacity is determined by analyzing the number of vehicles leaving the region per unit time.

[0057] The calculation of the impact intensity of risk propagation characteristics considers the effectiveness of the propagation path and the magnitude of propagation resistance. The effectiveness of the propagation path is determined by analyzing whether there are direct traffic flow connections between areas. Areas with lane-level connections have an effectiveness coefficient of one; connections requiring transfers through other areas have an effectiveness coefficient of 0.5; and areas without direct connections have an effectiveness coefficient of zero. The magnitude of propagation resistance is affected by road geometry, traffic control measures, and traffic light timing. Road geometry includes factors such as lane width, turning radius, and gradient; better conditions result in lower propagation resistance.

[0058] The interaction influence matrix is ​​generated by organizing the influence strength values ​​between all nodes in matrix form. The matrix dimension is equal to the square of the number of regions, and the positions of the matrix elements are determined by the identifiers of the source and target nodes. The influence strength value is calculated by weighting and summing distance weights, congestion propagation tendency, and propagation path effectiveness. The weight coefficients for distance weights, congestion propagation tendency, and propagation path effectiveness are all 0.4 and 0.2 respectively. The matrix exhibits asymmetry, meaning that the influence strength from region A to region B is usually not equal to the influence strength from region B to region A.

[0059] The congestion status update parameters are calculated based on the congestion gradient and dynamic changes between adjacent regions. The congestion gradient is obtained by comparing the differences in congestion levels between adjacent regions. The congestion level is represented by a standardized congestion index, with the index value varying between zero and one. The standardized congestion index is calculated by comprehensively scoring multiple indicators such as current vehicle density, average speed, and queue length. Vehicle density accounts for 40% of the index weight, average speed accounts for 30%, and queue length accounts for 30%.

[0060] Vehicle density variation characteristics are obtained by analyzing the trend and rate of change of density in time-series data. The trend is categorized into three types: rising, stable, and falling, determined by comparing density values ​​at consecutive time points. The rate of change is measured by calculating the amount of density change per unit time; a larger change indicates more drastic changes in traffic conditions. The periodicity of density changes is extracted using Fourier transform to identify periodic fluctuation patterns in traffic flow.

[0061] The congestion status update parameters comprehensively consider the spatial distribution of the congestion gradient and the temporal characteristics of density changes. Spatial distribution characteristics are obtained by analyzing the differences in the distribution of the congestion gradient in different directions; directions with larger gradients correspond to the main paths of congestion propagation. Temporal characteristics are obtained by analyzing the performance of density changes at different time scales, including short-term fluctuations, medium-term trends, and long-term patterns. The calculation of the update parameters employs a multi-level fusion method, combining spatial and temporal characteristics at different levels.

[0062] The network state transition matrix describes the transition patterns of congestion states within a regional network. The matrix is ​​constructed based on congestion state update parameters and the topological connections between regions. The calculation of transition probabilities considers the congestion output capacity of the source region and the congestion acceptance capacity of the target region. Congestion output capacity is related to the region's traffic pressure and flow output limits; higher pressure results in greater output capacity, but it is limited by physical capacity. Congestion acceptance capacity is related to the region's remaining capacity and buffer capacity; greater remaining capacity results in greater acceptance capacity.

[0063] The state transition matrix needs to satisfy the probability normalization constraint, meaning the sum of the transition probabilities starting from any region equals one. Normalization is achieved by scaling the transition probabilities; the scaling factor is equal to one divided by the original sum of the transition probabilities. The time dependence of the matrix is ​​reflected by introducing a time decay factor, which decreases over time, reflecting the time-sensitive nature of congestion impacts.

[0064] The state transition equation for risk diffusion establishes a mathematical description of risk propagation in spatial networks. The core of the equation is the principle of risk conservation, which states that the total amount of risk remains constant during propagation but is redistributed across different regions. Risk propagation is influenced by both the diffusion coefficient and the convection coefficient. The diffusion coefficient reflects the natural diffusion trend of risk and is related to connectivity and distance between regions. The convection coefficient reflects the directional propagation characteristics of risk and is consistent with the dominant direction of traffic flow.

[0065] The risk intensity value is calculated by combining information from two dimensions: current congestion level and historical risk status. Current congestion level reflects the immediate risk level of the area and is calculated using real-time traffic data. Historical risk status reflects the cumulative effect and evolution trend of risk in the area and is obtained by analyzing risk change patterns within historical time windows. The length of the historical time window is determined based on the characteristic cycle of traffic flow and is typically set between thirty minutes and two hours.

[0066] The risk intensity value is synthesized using a weighted average method, with different weight coefficients assigned to the current congestion level and historical risk status. The weight coefficients are determined considering both the real-time requirements of traffic management and the reference value of historical patterns. During peak traffic hours, the weight coefficient for the current congestion level increases to 0.7, while the weight coefficient for historical risk status decreases to 0.3. During off-peak traffic hours, the weight coefficients for both are nearly equal, at 0.5 and 0.5 respectively.

[0067] The dynamic update mechanism for risk intensity values ​​ensures timely reflection of changes in traffic conditions. The update frequency adaptively adjusts according to the rate of change in traffic flow; when traffic conditions change drastically, the update frequency increases to once per minute, while when traffic conditions are relatively stable, the update frequency decreases to once every five minutes. The update process employs a sliding window technique, where new observation data replaces the oldest historical data, while maintaining a constant time window length.

[0068] In one optional implementation, a corresponding agent node is established for each area in the target intersection, and the interaction influence strength between agent nodes is calculated based on the physical distance between areas, as well as the congestion situation characteristics and the risk propagation characteristics, to generate an interaction influence matrix, including: Extract the diffusion trend component and congestion degree component from the congestion situation features, calculate the congestion state correlation between agent nodes, and determine the congestion state correlation by normalizing the diffusion trend component and congestion degree component and combining it with the state transition probability to generate a congestion situation influence matrix. Based on the risk propagation range and risk propagation speed in the aforementioned risk propagation characteristics, a risk propagation impact matrix for intelligent agent nodes is constructed. The interaction influence matrix is ​​obtained by normalizing the physical distance between regions, the congestion situation influence matrix, and the risk propagation influence matrix, and then weighting and fusing them.

[0069] After establishing the agent nodes, it is necessary to calculate the intensity of the interaction influence between the nodes. The calculation of the interaction influence intensity includes three aspects: the influence based on physical distance, the influence based on congestion situation characteristics, and the influence based on risk propagation characteristics.

[0070] To process congestion characteristics, it's necessary to extract the diffusion trend component and the congestion severity component. The diffusion trend component reflects the likelihood of congestion spreading to surrounding areas and can be obtained through the traffic flow change rate at adjacent time points. For example, if the traffic flow rate in a certain area increases by 30% within 5 minutes, its diffusion trend component is relatively high and can be set to 0.8; if the increase rate is 10%, the value can be set to 0.5. The congestion severity component directly reflects the current level of congestion in the area and can be determined through indicators such as vehicle density and average speed. For example, if the average vehicle speed in a certain area is below 5 km / h and the vehicle density reaches 80%, the congestion severity component can be set to 0.9; if the average vehicle speed is 20 km / h and the vehicle density is 50%, the value can be set to 0.6.

[0071] The extracted diffusion trend component and congestion degree component are normalized to unify their value range to between 0 and 1. Normalization can be performed using the maximum-minimum normalization method, that is, for the original value x, the normalized value is (x-min) / (max-min), where min and max are the minimum and maximum values ​​among all values, respectively.

[0072] The correlation of congestion states is determined by combining state transition probabilities. State transition probabilities represent the probability that the congestion state of one area will affect another area, and can be learned through historical data. For example, by analyzing historical traffic data, it is found that after the congestion state of area A changes, there is an 80% probability that the congestion state of area B will also change within 5 minutes. Therefore, the state transition probability from area A to area B is 0.8.

[0073] Based on the above processing, a congestion situation impact matrix is ​​generated. In the specific calculation, the normalized diffusion trend component, congestion severity component, and state transition probability are multiplied to obtain the impact strength value. For example, if the normalized diffusion trend component of node 1 is 0.8, the congestion severity component is 0.7, and the state transition probability from node 1 to node 2 is 0.6, then the value of element a_12 in the matrix is ​​0.8 × 0.7 × 0.6 = 0.336.

[0074] The characteristics of risk propagation are mainly considered from two factors: the scope of risk diffusion and the speed of risk propagation. The scope of risk diffusion refers to the area that a risk event may affect. For example, if a traffic accident occurs in a certain area, its impact range may be within a 50-meter or 100-meter radius, depending on the severity of the accident. The speed of risk propagation indicates how quickly the impact of the risk spreads, which can be determined through historical data analysis. For example, analysis shows that the impact of a traffic accident spreads outward at an average speed of 20 meters per minute.

[0075] A risk propagation impact matrix is ​​constructed based on the risk diffusion range and risk propagation speed. The impact intensity is related to the distance between nodes and the risk propagation speed. For example, if the distance between node 1 and node 3 is 30 meters and the risk propagation speed is 20 meters per minute, then a risk event at node 1 will take 1.5 minutes to propagate to node 3. The corresponding impact intensity b_13 can be set as exp(-1.5 / 5) = 0.74, where 5 is a time decay factor, representing the degree of decay of the risk impact over time.

[0076] Finally, the physical distance matrix, congestion situation impact matrix, and risk propagation impact matrix are normalized to ensure that the value ranges of the three matrices are consistent. Then, a weighted fusion is performed to obtain the final interaction impact matrix. During the weighted fusion, three weight coefficients w1, w2, and w3 can be set, corresponding to the importance of physical distance, congestion situation, and risk propagation, respectively, and satisfying w1 + w2 + w3 = 1.

[0077] This invention provides a multi-level early warning system for traffic accidents based on spatiotemporal data mining, comprising: The first unit is used to acquire spatiotemporal data of the target intersection, extract temporal features based on a sliding time window, and construct a spatiotemporal correlation matrix by combining the intersection topology data to generate a multidimensional spatiotemporal feature sequence. The second unit is used to construct a bidirectional temporal correlation graph network model with an encoder-decoder structure based on the multidimensional spatiotemporal feature sequence. The encoder encodes the traffic flow change features and vehicle trajectory evolution features of the target intersection into a dynamic correlation graph structure. The decoder generates the congestion evolution pattern and risk propagation features of the intersection traffic flow based on the spatiotemporal distribution features of historical accidents through a forward state prediction mechanism and a backward pattern extraction mechanism. The third unit is used to match the real-time traffic status information of the target intersection with the congestion evolution mode to obtain the current congestion situation characteristics of the intersection. The fourth unit is used to construct a spatial propagation network of traffic flow congestion degree based on the congestion situation characteristics and risk propagation characteristics and a multi-agent interaction mechanism. It calculates the risk propagation intensity by establishing a state transition equation for risk diffusion and generates traffic accident risk level prediction results for different areas of the target intersection by combining a risk accumulation threshold judgment mechanism. The fifth unit is used to dynamically adjust traffic control measures at target intersections based on the traffic accident risk level prediction results and using a graded early warning strategy.

[0078] A third aspect of the present invention provides an electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.

[0079] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.

[0080] This invention can be a method, apparatus, system, and / or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of the invention.

[0081] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A multi-level early warning method for traffic accidents based on spatiotemporal data mining, characterized in that, include: Acquire spatiotemporal data of the target intersection, extract temporal features based on a sliding time window, and construct a spatiotemporal correlation matrix by combining the intersection topology data to generate a multidimensional spatiotemporal feature sequence; Based on the multidimensional spatiotemporal feature sequence, a bidirectional temporal correlation graph network model with an encoder-decoder structure is constructed. The encoder encodes the traffic flow change features and vehicle trajectory evolution features of the target intersection into a dynamic correlation graph structure. The decoder, based on the spatiotemporal distribution features of historical accidents, generates the congestion evolution pattern and risk propagation features of the intersection traffic flow through a forward state prediction mechanism and a backward pattern extraction mechanism. The real-time traffic status information of the target intersection is matched with the congestion evolution pattern to obtain the current congestion situation characteristics of the intersection. Based on the congestion situation characteristics and the risk propagation characteristics, a spatial propagation network of traffic flow congestion degree is constructed based on a multi-agent interaction mechanism. The risk propagation intensity is calculated by establishing a state transition equation for risk diffusion. Combined with a risk accumulation threshold judgment mechanism, the traffic accident risk level prediction results for different areas of the target intersection are generated. Based on the traffic accident risk level prediction results, a tiered early warning strategy is adopted to dynamically adjust traffic control measures at target intersections.

2. The method according to claim 1, characterized in that, The encoder encodes the traffic flow variation characteristics and vehicle trajectory evolution characteristics of the target intersection into a dynamic correlation graph structure, including: Obtain real-time trajectory data and traffic flow data of vehicles at the target intersection; Based on the real-time trajectory data, spatial distance parameters and motion direction parameters between vehicles are calculated, and a spatial correlation matrix is ​​constructed according to the spatial distance parameters and motion direction parameters. The spatial correlation matrix is ​​used to characterize the spatial correlation strength between vehicles. Based on the traffic flow data, a traffic flow feature matrix is ​​constructed using a time decay function. The traffic flow feature matrix is ​​used to characterize the temporal variation characteristics of traffic flow. The spatial correlation matrix and the traffic flow feature matrix are fused to generate a dynamic correlation graph structure. The dynamic correlation graph structure includes a node set and an edge set, wherein the node set includes vehicle trajectory nodes and traffic flow nodes, and the edge set represents the correlation relationship between nodes.

3. The method according to claim 1, characterized in that, The decoder, based on the spatiotemporal distribution characteristics of historical accidents, generates congestion evolution patterns and risk propagation characteristics of intersection traffic flow through a forward state prediction mechanism and a backward pattern extraction mechanism, including: The historical state sequence and current state information of the target intersection are obtained, and the historical state sequence is weighted based on the attention weight calculation mechanism to obtain the forward state features. The forward state features and the current state information are fused together, and a future state prediction result for the target intersection is generated through nonlinear transformation. Historical accident time-series data of the target intersection is obtained, and features are extracted from the historical accident time-series data based on the temporal attention pooling mechanism to obtain backward evolution features; The future state prediction results are fused with the backward evolution features after normalization to construct a congestion evolution state transition matrix. The congestion evolution state transition matrix represents the state transition probability between different areas of the intersection. The congestion evolution mode is determined based on the congestion evolution state transition matrix. A risk propagation network is constructed based on the congestion evolution state transition matrix. The risk propagation network calculates risk propagation characteristics by integrating the spatial adjacency relationship and congestion state transition relationship between intersection areas.

4. The method according to claim 1, characterized in that, Matching the real-time traffic status information of the target intersection with the congestion evolution pattern yields the current congestion situation characteristics of the intersection, including: Calculate the state distance metric between the real-time traffic state information and the congestion evolution mode. The state distance metric is obtained by weighted Euclidean distance of each feature dimension. The temporal matching distance between the traffic state feature vector corresponding to the real-time traffic state information and the congestion evolution mode is calculated based on the dynamic time warping algorithm. The temporal matching distance is obtained by aligning time series. The best-matching congestion evolution mode is selected based on a weighted combination of the state distance metric and the temporal matching distance; congestion situation features are constructed based on the best-matching congestion evolution mode, and the congestion situation features include congestion degree components and diffusion trend components.

5. The method according to claim 1, characterized in that, Based on the congestion situation characteristics and the risk propagation characteristics, a spatial propagation network for traffic flow congestion is constructed using a multi-agent interaction mechanism. The risk propagation intensity is calculated by establishing a state transition equation for risk diffusion, including: For each area in the target intersection, a corresponding agent node is established, and the interaction influence strength between agent nodes is calculated based on the physical distance between areas, as well as the congestion situation characteristics and the risk propagation characteristics, to generate an interaction influence matrix. The congestion state update parameters are calculated based on the interaction influence matrix. The congestion state update parameters take into account the congestion degree differences and vehicle density changes in adjacent areas to generate a network state transition matrix. The risk intensity value of each region is calculated by combining the network state transition matrix with the risk diffusion state transition equation. The risk intensity value is obtained by combining the current congestion level and the historical risk state.

6. The method according to claim 5, characterized in that, For each area within the target intersection, a corresponding agent node is established. Based on the physical distance between areas, as well as the congestion situation characteristics and the risk propagation characteristics, the interaction influence strength between agent nodes is calculated, generating an interaction influence matrix including: Extract the diffusion trend component and congestion degree component from the congestion situation features, calculate the congestion state correlation between agent nodes, and determine the congestion state correlation by normalizing the diffusion trend component and congestion degree component and combining it with the state transition probability to generate a congestion situation influence matrix. Based on the risk propagation range and risk propagation speed in the aforementioned risk propagation characteristics, a risk propagation impact matrix for intelligent agent nodes is constructed. The interaction influence matrix is ​​obtained by normalizing the physical distance between regions, the congestion situation influence matrix, and the risk propagation influence matrix, and then weighting and fusing them.

7. A multi-level early warning system for traffic accidents based on spatiotemporal data mining, used to implement the method as described in any one of claims 1-6, characterized in that, include: The first unit is used to acquire spatiotemporal data of the target intersection, extract temporal features based on a sliding time window, and construct a spatiotemporal correlation matrix by combining the intersection topology data to generate a multidimensional spatiotemporal feature sequence. The second unit is used to construct a bidirectional temporal correlation graph network model with an encoder-decoder structure based on the multidimensional spatiotemporal feature sequence. The encoder encodes the traffic flow change features and vehicle trajectory evolution features of the target intersection into a dynamic correlation graph structure. The decoder generates the congestion evolution pattern and risk propagation features of the intersection traffic flow based on the spatiotemporal distribution features of historical accidents through a forward state prediction mechanism and a backward pattern extraction mechanism. The third unit is used to match the real-time traffic status information of the target intersection with the congestion evolution mode to obtain the current congestion situation characteristics of the intersection. The fourth unit is used to construct a spatial propagation network of traffic flow congestion degree based on the congestion situation characteristics and risk propagation characteristics and a multi-agent interaction mechanism. It calculates the risk propagation intensity by establishing a state transition equation for risk diffusion and generates traffic accident risk level prediction results for different areas of the target intersection by combining a risk accumulation threshold judgment mechanism. The fifth unit is used to dynamically adjust traffic control measures at target intersections based on the traffic accident risk level prediction results and using a graded early warning strategy.

8. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 6.