Traffic accident risk prediction method and system based on space-time hypergraph contrast learning
Through the method based on space-time hypergraph comparison learning, the zero expansion and overfitting problems of existing traffic accident risk prediction models in fine-grained data processing are solved, and a more accurate and robust traffic accident risk prediction is achieved.
Patent Information
- Application Number
- CN202510268724.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-06-27
AI Technical Summary
Existing traffic accident risk prediction models are prone to zero expansion problems and overfitting when processing fine-grained data, and it is difficult to effectively capture the spatiotemporal and spatial characteristics and cross-regional semantic relationships of traffic accidents.
Using a method based on spatiotemporal hypergraph comparison learning, aggregating neighborhood geographical features and cross-domain semantic features, dynamically modeling of temporal features, and using collaborative supervision training and zero-expansion negative binomial distribution (ZINB) model, robust traffic accident risk representation is generated.
It effectively alleviates the problems of sparse data and imbalance in spatial distribution, improves the accuracy and robustness of traffic accident risk prediction, and adapts to the non-Gaussian distribution characteristics of accident risk data.
Smart Images

Figure CN120218601A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of traffic accident prediction, and in particular, to a traffic accident risk prediction method and system based on spatio-temporal hypergraph contrast learning. Background Art
[0002] With the acceleration of the urbanization process, the number of vehicles has increased rapidly in the past few decades, resulting in frequent traffic accidents. To address this issue, accurate traffic accident risk prediction has become particularly important. Effective prediction can help the government take targeted measures, such as detecting high-risk areas in the traffic network, identifying accident-prone points and potential dangerous road sections, so as to implement road renovation and optimize resource allocation to improve the overall road safety level. In addition, timely prediction of high-risk situations on the road can enable emergency response departments to respond more quickly and effectively to potential accident risks, thereby minimizing casualties and property losses. Therefore, fine-grained and high-precision traffic accident risk prediction is of great significance for the construction of smart cities and the improvement of road public safety.
[0003] Traffic accident prediction has been studied for decades and plays an important role in many practical applications. In the early days, traditional statistical methods were widely used, such as zero-inflated Poisson regression models, negative binomial models, and Bayesian networks. Subsequently, machine learning models, such as support vector regression, K-nearest neighbor, and decision trees, performed well in capturing the non-linear relationships between traffic accidents. However, they have limitations in modeling more complex and implicit spatio-temporal relationships. With the emergence of artificial intelligence, deep learning methods have gradually become dominant due to their powerful automatic feature extraction and representation capabilities. Therefore, researchers have attempted to use deep learning-based methods to predict traffic accidents. The literature "Hetero-ConvLSTM: A Deep Learning Approach to Traffic Accident Prediction on Heterogeneous Spatio-Temporal Data" uses a convolutional long short-term memory neural network (ConvLSTM) to capture the temporal trends and spatial heterogeneity of traffic accident data. The literature "GSNet: Learning Spatial-Temporal Correlations from Geographical and Semantic Aspects for Traffic Accident Risk Forecasting" considers the impact of multi-source spatio-temporal factors on accidents and models the spatio-temporal correlations of traffic accident data from both geographical and semantic aspects.
[0004] Due to the sparsity of traffic accidents, a large number of zero values exist in the fine-grained accident data, which leads to the zero-inflation problem in model training and makes the prediction results invalid. However, previous methods have adopted coarse-grained predictions to avoid this problem. Most existing methods use graph convolutional neural networks (GCNs) to model spatial correlations. However, compared with the entire urban space, the traffic accident data in each fine-grained area is extremely sparse, and this sparse supervision signal makes the current graph-based traffic accident prediction models prone to generating suboptimal spatio-temporal embeddings, resulting in overfitting. In addition, the distribution of traffic accident risk data generally conforms to three characteristics: discrete, variance greater than the mean, and containing many zero values. This deviates from the Gaussian assumption of previous deterministic deep learning models, and in this case, it is more appropriate to adopt the zero-inflated negative binomial distribution (ZINB). Summary of the Invention
[0005] To solve the deficiencies of the above-mentioned prior art, the present invention provides a traffic accident risk prediction method and system based on spatio-temporal hypergraph contrast learning. The present invention can effectively model the spatio-temporal characteristics of traffic accidents, learn the skewed and long-tailed distributions of the data, and alleviate the problems of data sparsity and spatial distribution imbalance.
[0006] The technical solution adopted by the present invention to solve the above technical problems is as follows:
[0007] The first aspect of the present invention relates to a traffic accident risk prediction method based on spatio-temporal hypergraph contrast learning, including the following steps:
[0008] (1) Input historical traffic accident features to obtain historical traffic accident risk values Y and traffic accident spatio-temporal feature tensors X;
[0009] (2) Aggregate neighborhood geographical features to perform spatial feature modeling on the traffic accident spatio-temporal feature tensor X for neighboring regions to generate traffic accident area embeddings based on local geographical perception;
[0010] (3) Extract cross-domain semantic features to perform cross-regional semantic feature modeling on the traffic accident spatio-temporal feature tensor X to generate traffic accident area embeddings based on global semantic perception;
[0011] (4) Rely on dynamic time recurrence to perform dynamic modeling of time features on the area embeddings to obtain local spatio-temporal feature embeddings Z l and global spatio-temporal feature embeddings
[0012] (5) Through collaborative supervised training, perform contrast training on the local and global spatio-temporal feature embeddings in step (4), aiming to reduce the distance between embeddings of the same region and increase the distance between embeddings of different regions, thereby obtaining a robust traffic accident risk representation. The formula of the contrast loss function is as follows:
[0013]
[0014] (6) By uncertain perception prediction, integrate the zero-inflated negative binomial (ZINB) model into the representation of traffic accident risk to obtain the three parameters n T+1 , p T+1 , π T+1 for predicting the risk value at the next moment.
[0015] (7) Adopt the method of point estimation for the ZINB distribution parameters described in step (6) to obtain the predicted value of traffic accident risk at the next moment for each region.
[0016] Furthermore, in the said step (1), obtaining the traffic accident risk value Y and the traffic accident spatio-temporal feature tensor X includes the following steps:
[0017] (1.1) According to the longitude and latitude of the urban space, evenly divide the entire urban space into R geographical regions of the same size by using the grid method;
[0018] (1.2) According to the number of casualties in traffic accidents, divide traffic accidents into three categories: minor, injured, and fatal, and set their corresponding risk values as 1, 2, and 3 respectively; calculate the total accident risk within one-hour time interval for each said geographical region as the accident risk value Y at time t in this region t ;
[0019] (1.3) Obtain historical traffic accident spatio-temporal feature data, and its data preprocessing steps are as follows:
[0020] (1.3.1) Obtain historical time information, including hour, day of the week, and the mark of whether it is a holiday, and convert it into one-hot encoding;
[0021] (1.3.2) Obtain the historical meteorological information of each said geographical region and convert it into one-hot encoding;
[0022] (1.3.3) Obtain the point of interest (POI) data of each said geographical region, count the number C of POI categories and their corresponding quantities, and convert it into a C-dimensional vector as the regional functional attribute of this area;
[0023] (1.3.4) Obtain taxi order data, project it onto the corresponding geographical region according to the pick-up and drop-off longitude and latitude of passengers, and summarize it at each time interval as the traffic flow information of this area;
[0024] (1.4) Generate a traffic accident spatio-temporal feature tensor X from the accident risk value Y generated in the step (1.2), the historical time information generated in the step (1.3.1), the meteorological data generated in the step (1.3.2), the POI data generated in the step (1.3.3), and the taxi order data generated in the step (1.3.4).
[0025] Further, the specific method of the step (2) is as follows:
[0026] (2.1) Use a multi-channel convolutional network to learn and aggregate the representations of different feature channels on local receptive fields;
[0027] (2.2) Obtain the influence weights of different feature channels on traffic accidents. The specific formula is as follows:
[0028]
[0029] where σ and δ represent the Sigmoid and ReLU functions respectively, are the parameters of the fully connected layer, AvgPool(·) represents average pooling, and X t represents the traffic accident feature at time t.
[0030] (2.3) Multiply the weights obtained in the step (2.2) by the original traffic accident features to obtain a new representation with weights, and add it to the initial input to obtain the final output of the neighborhood geographical feature aggregation module.
[0031] Further, the specific method of the step (3) is as follows:
[0032] (3.1) Enhance the original traffic accident risk data X at time t t through a linear layer to obtain the risk embedding at this time
[0033] (3.2) Use a hypergraph network to extract the high-order relationships of different regions. Hyperedges are used as intermediate hubs to connect a group of regions with similar accident occurrence patterns. The formula for the hypergraph information transfer mode is as follows:
[0034]
[0035] where, represents the learnable hypergraph dependence structure matrix, H is the number of hyperedges, and ε(·) is the LeakyReLU activation function;
[0036] (3.3) Construct a hypergraph information network to inject the global relationships between regions into the representation paradigm of each region to enhance the regional self-supervision signal.
[0037] Further, step (4) specifically includes the following steps:
[0038] (4.1) Extract time features from the most recent ξ time intervals and the same time intervals in the previous η weeks;
[0039] (4.2) Based on the gated recurrent unit (GRU), model the time features extracted in step (4.1) to obtain the short-term proximity and long-term periodicity features of traffic accidents;
[0040] (4.3) Adopt a time attention mechanism to highlight the time features more relevant to the target time point by calculating the attention scores between the hidden state output in step (4.2) and the time features of the target time interval T+1.
[0041] Further, step (6) specifically includes the following steps:
[0042] (6.1) Use a fully connected layer to fuse the local and global spatio-temporal feature embeddings to obtain the final potential representation of traffic accidents
[0043] (6.2) Define three fully connected layer neural networks to decode the potential representation of traffic accidents in step (6.1) Thereby estimating the shape parameters n, p and the sparse parameter π in the ZINB model, and the specific formulas are as follows:
[0044]
[0045] Among them, is the Softplus activation function, σ is the Sigmoid function, and W* and b* are trainable parameters;
[0046] (6.3) Define the log-likelihood function of the ZINB model, and the specific formula is as follows:
[0047]
[0048] Among them, y is the true value of the accident risk, and Γ represents the Gamma function.
[0049] (6.4) Finally, the specific formula of the negative log-likelihood loss function of the ZINB model is defined as:
[0050]
[0051] Further, the construction of the hypergraph information network in step (3.3) specifically includes the following steps:
[0052] (3.3.1) Define a Readout function to obtain a graph-level summary representation, and the specific formula is as follows:
[0053]
[0054] Among them, aggregates the global information of the entire graph at time t;
[0055] (3.3.2) Define a corruption function to obtain the damaged hypergraph structure from the original graph as negative samples. The specific formula is as follows:
[0056]
[0057] Among them, the Corruption function destroys by randomly shuffling the region indices;
[0058] (3.3.3) Define a discriminant function to score the region-level representation to determine whether the node comes from the original graph or the negative sample graph. The specific formula is as follows:
[0059]
[0060] Among them, is a learnable discriminant matrix, and σ is the Sigmoid function;
[0061] (3.3.4) Use a noise contrastive objective to maximize the mutual information between the generated in step (3.2) and the s t generated in step (3.3.1), so as to inject the global context information of the graph into the single region representation. The specific formula is as follows:
[0062]
[0063] The present invention also relates to a traffic accident risk prediction system based on spatio-temporal hypergraph contrastive learning.
[0064] The working principle of the present invention is:
[0065] In view of the problem that when modeling the characteristics of traffic accidents, due to the complex and non-linear causal relationship between external factors and accidents, previous models often have difficulty accurately capturing accident characteristics and their correlations, resulting in unsatisfactory modeling effects, this invention uses a multi-channel attention convolutional network to capture local spatial relationships and adaptively learn the influence of different feature channels. Due to the difficulty in capturing cross-regional implicit semantic relationships and the problem of unbalanced data spatial distribution, a hypergraph structure is introduced to model high-order spatio-temporal correlations. The hyperedges in the hypergraph act as hubs to connect regions with similar traffic accident patterns, well preserving the semantic information between regions. The hypergraph information network designed in this invention maximizes the mutual information between all node-level representations and the global graph summary, alleviating the problem of unbalanced spatial distribution. Due to the contingency of traffic accidents, the traffic accident data in each fine-grained region is extremely sparse. Such sparse supervised accident signals can easily cause the model to generate suboptimal spatio-temporal embeddings, leading to overfitting problems. This invention uses a co-supervised training strategy to learn the consistent representations shared between the same region from different feature perspectives and distinguish the noise interference involved in different regions. Since the distribution of traffic accident risk data conforms to three characteristics: discrete, variance greater than the mean, and containing many zero values, deviating from the Gaussian assumption of previous deep learning models, this invention uses a zero-inflated negative binomial (ZINB) distribution to capture the large number of zero values in accident risk values and the negative binomial distribution of each non-zero entry, and uses a deep learning model to fit the parameters in the probability distribution to solve the skewness and long-tail problems of traffic accident risk data distribution.
[0066] The advantages of this invention are as follows:
[0067] This invention alleviates the problem of unbalanced data spatial distribution, reduces the overfitting risk brought by data sparsity, and adapts to the non-Gaussian distribution characteristics of traffic accident risk data, thereby more accurately modeling cross-regional semantic information and traffic accident characteristics and improving the accuracy of traffic accident risk prediction. Brief Description of the Drawings
[0068] Figure 1 is the flowchart of the method of this invention;
[0069] Figure 2 is the model architecture diagram of the method of this invention;
[0070] Figure 3 is the system structure diagram of this invention. Detailed Implementation Manner
[0071] To make the technical solutions of the present invention clearer and more explicit, the following will describe in detail the specific implementation manners of the present invention in combination with embodiments and drawings. The embodiments described below are only used to illustrate the present invention, but not to limit the protection scope of the present invention. For the embodiments of the present invention, any modification, change or equivalent replacement that can be made by those skilled in the art without creative work shall be regarded as being included in the protection scope of the present invention.
[0072] Embodiment 1
[0073] Combined with Figure 1 and Figure 2 as shown, this embodiment provides a traffic accident risk prediction method based on spatio-temporal hypergraph contrast learning, including,
[0074] (1) Obtain the historical traffic accident risk value Y and the traffic accident spatio-temporal feature tensor X through the historical traffic accident feature input module (100);
[0075] (2) Perform spatial feature modeling on the traffic accident spatio-temporal feature tensor X in the neighboring area through the neighborhood geographical feature aggregation module (200) to generate a traffic accident area embedding based on local geographical perception;
[0076] (3) Perform cross-regional semantic feature modeling on the traffic accident spatio-temporal feature tensor X through the cross-domain semantic feature extraction module (300) to generate a traffic accident area embedding based on global semantic perception;
[0077] (4) Perform dynamic modeling of the time features of the area embedding through the dynamic time loop dependence module (400) to obtain local spatio-temporal feature embedding and global spatio-temporal feature embedding
[0078] (5) Perform contrast training on the local and global spatio-temporal feature embeddings in step (4) through the collaborative supervision training module (500), aiming to reduce the distance between the same area embeddings and increase the distance between different area embeddings, so as to obtain a robust traffic accident risk representation;
[0079] (6) Integrate the zero-inflated negative binomial (ZINB) model into the traffic accident risk representation through the uncertainty-aware prediction module (600) to obtain three parameters n T+1 , p T+1 , π T+1 for predicting the risk value at the next moment;
[0080] (7) Obtain the traffic accident risk prediction value at the next moment of each area by using point estimation for the ZINB distribution parameters in step (6) through the output module (700).
[0081] In this embodiment, first, according to the longitude and latitude of the urban space, the entire urban space is evenly divided into R geographical regions of the same size using the grid method. Then, according to the number of casualties in traffic accidents, the traffic accidents are divided into three categories: minor, injured, and fatal, and the corresponding risk values of 1, 2, and 3 are set for them respectively. Calculate the total accident risk within each one-hour time interval for each of the geographical regions as the accident risk value of the region r at time t. Obtain the historical time information of traffic accident data, including the hour, the day of the week, and the flag indicating whether it is a holiday, and convert it into one-hot encoding; obtain the historical meteorological information of each of the geographical regions and convert it into one-hot encoding; obtain the point of interest (POI) data of each of the geographical regions, calculate the number of different POI categories within each geographical region as the regional functional attribute of the region; obtain taxi order data, project it onto the corresponding geographical region according to the pick-up and drop-off longitude and latitude of the passengers, and summarize it at each time interval as the traffic flow information of the region; finally, generate a traffic accident spatio-temporal feature tensor from the accident risk value, historical time information, meteorological data, POI data, and taxi order data.
[0082] According to the first law of geography, the traffic conditions within geographically closely connected regions are usually highly correlated. This means that the traffic characteristics of neighboring regions tend to be similar and interdependent. Therefore, this embodiment uses a multi-channel convolutional neural network to learn and aggregate the representations of different feature channels on local receptive fields, expressed as:
[0083]
[0084] where δ is the ReLU activation function, W l and b l are the learnable parameters in the l-th layer of convolution, and * represents the convolution operation. represents the output after the l-th layer of convolution at time t, and After L layers of convolution, where d C represents the compressed feature channel dimension, and each element x c represents the feature embedding learned on the c-th feature channel.
[0085] Furthermore, the traffic accident risk may be related to various external factors, and the influence degrees of these factors are different at different times and locations. To capture the influence of different features on the traffic accident risk, the weight coefficients of each channel are learned as follows:
[0086]
[0087] Among them, σ and δ represent the Sigmoid and ReLU functions respectively, are the parameters of the fully connected layer, AvgPool(·) represents average pooling, and the obtained ω is the channel-level attention score, representing the weights of different channels. Then, the obtained coefficients are multiplied by the original representation to obtain a new weighted representation, and it is added to the initial input:
[0088]
[0089] to obtain the final output In this way, the model can automatically learn the importance of different feature channels, thereby achieving dynamic calibration of each feature channel.
[0090] In addition to being affected by local areas, global semantic dependencies are also key factors for accurately predicting traffic accident risks. For example, at the intersections of two commercial areas, although they are geographically far apart, due to their similar urban functional attributes and road structure designs, they may have similar traffic accident occurrence patterns. Therefore, this embodiment uses a hypergraph network to extract high-order semantic relationships in different regions. The hyperedge serves as an intermediate hub to connect a group of regions with similar accident occurrence patterns. The formula for the hypergraph information transmission mode is as follows:
[0091]
[0092] Among them, is the traffic accident risk embedding, d h is the dimension of the embedding. This embedding is obtained by enhancing the original data X through a linear layer t obtained, represents the learnable hypergraph dependency structure matrix, H is the number of hyperedges, and ε(·) is the LeakyReLU activation function. Through the embedding propagation mechanism based on hyperedges, the correlation between different regions and potential hyperedge representations can be effectively modeled. This embodiment can generate region embeddings with a global knowledge background without the limitation of jump distance to complete the self-extraction of cross-regional accident risk semantic relationships with global context awareness ability.
[0093] To inject the global relationship between regions into the representation paradigm of each region, this project enhances the self-supervision signal of the region by introducing a hypergraph information network. First, a Readout function is defined to obtain a graph-level summary representation. The specific formula is as follows:
[0094]
[0095] Among them, Aggregates the global information of the entire graph at time t. Secondly, a corruption function is defined to obtain the corrupted hypergraph structure from the original graph as negative samples, and the specific formula is as follows:
[0096]
[0097] Among them, the Corruption function destroys by randomly shuffling the region indices; then, a discrimination function is defined to score the region-level representation to determine whether the node comes from the original graph or the negative sample graph, and the specific formula is as follows:
[0098]
[0099]
[0100] Among them, is a learnable discrimination matrix, and σ is the Sigmoid function;
[0101] Finally, a noise contrastive objective is used to maximize the mutual information between and s t so as to inject the global context information of the graph into the single region representation, and the specific formula is as follows:
[0102]
[0103] From a time perspective, due to the inherent periodic characteristics of traffic data, the occurrence of accidents is also accompanied by daily and weekly patterns. In this embodiment, time features are extracted from the most recent ξ time intervals and the same time intervals in the previous η weeks, and then the short-term proximity and long-term periodicity of traffic accidents are modeled through GRU. Here, taking the neighborhood geographical feature aggregation module as an example, the cross-domain semantic feature extraction module also models the time relationship in the same way. The GRU calculation process of region r at time step t is defined as follows:
[0104]
[0105] Among them, represents the output of region r after multi-channel attention convolution at time t, is the hidden state of region r at time t, and d is the number of hidden units. Thus, the hidden state output of each region at time t However, the complex time autocorrelation varies in different situations. Therefore, this project introduces a time attention mechanism to dynamically capture the time patterns in accident data by calculating the attention scores between the hidden states output by GRU and the time feature q T+1 of the target time interval T+1:
[0106] α = softmax(δ(HW H + q T+1 W q + b α )) (17)
[0107] where H = [h1, h2,..., h τ , τ = ξ + η, W H , W q , b α are learnable parameters, representing the weight distribution of different historical time steps for the target time step. Finally, the output of the temporal attention is:
[0108]
[0109] Finally, the local and global spatio-temporal feature embeddings Z l and
[0110] To alleviate the problem of sparse supervision signals in traffic accident data and achieve a robust representation of traffic accident data, this embodiment performs contrastive learning in the latent embedding space to learn the consistent representations shared between the same regions from different feature perspectives and distinguish the noise interference involved in different regions. This embodiment regards the same regions from different views as positive pairs and the views of different regions as negative pairs. Thus, the contrastive loss at time t is defined as:
[0111]
[0112] Furthermore, a fully connected layer is used to fuse the local and global spatio-temporal feature embeddings and to obtain the final traffic accident latent representation
[0113] To solve the zero-inflation problem in traffic accident data, the present invention uses the ZINB distribution to capture the large number of zeros in the traffic accident risk values and the NB distribution for each non-zero entry to comprehensively understand the inherent uncertainty and complex risk patterns in traffic accidents. Three fully connected layer neural networks are defined to decode the traffic accident latent representation so as to estimate the shape parameters n, p and the sparsity parameter π in the ZINB model. The specific formulas are as follows:
[0114]
[0115] where, is the Softplus activation function, σ is the Sigmoid function, and W* and b* are trainable parameters.
[0116] To solve the problem that zero will provide an infinite value for the variational lower bound based on the KL divergence, the present invention uses a log-likelihood function to better fit the distribution to the data. The specific formula is as follows:
[0117]
[0118] where y is the true value of the accident risk, and Γ represents the Gamma function; the specific formula for finally defining the negative log-likelihood loss function of the ZINB model is:
[0119]
[0120] The final objective function is defined as:
[0121]
[0122] where λ1, λ2, λ3 are parameters that control different loss weights to balance the loss. A regularization term with weight decay is further applied, representing the L2 norm of all parameter vectors and transformation matrices Θ.
[0123] Finally, in this example, the point estimation method is adopted, and the three parameters n T+1 , p T+1 , π T+1 output by the model are converted into the expected values of the accident risks in each geographical area at the next moment, so as to predict the high-risk areas in the entire urban space for subsequent decision-making tasks.
[0124] In this embodiment, the traffic accident data of two cities, New York and Chicago, are processed. The training set, validation set, and test set are divided in a ratio of 6:2:2 in chronological order, and the training is carried out according to the Figure 2 process, and the Adam optimizer is used to optimize the parameters.
[0125] Example 2
[0126] Referring to Figure 3 , this embodiment relates to a traffic accident risk prediction system based on spatio-temporal hypergraph contrast learning for implementing the method of Example 1, including:
[0127] A historical traffic accident feature input module 100 for obtaining the historical traffic accident risk value Y and the traffic accident spatio-temporal feature tensor X;
[0128] A neighborhood geographical feature aggregation module 200 for performing spatial feature modeling on the traffic accident spatio-temporal feature tensor X in adjacent regions to generate traffic accident area embeddings based on local geographical perception;
[0129] The cross - domain semantic feature extraction module 300 is used to perform cross - regional semantic feature modeling on the traffic accident spatio - temporal feature tensor X to generate traffic accident area embeddings based on global semantic perception;
[0130] The dynamic time - loop dependence module 400 is used to perform dynamic modeling of time features on the area embeddings to obtain local spatio - temporal feature embeddings Z l and global spatio - temporal feature embeddings
[0131] The collaborative supervision training module 500 is used to perform contrast training on local and global spatio - temporal feature embeddings, aiming to reduce the distance between embeddings of the same area and increase the distance between embeddings of different areas, so as to obtain a robust traffic accident risk representation;
[0132] The uncertainty - aware prediction module 600 is used to integrate the zero - inflated negative binomial (ZINB) model into the traffic accident risk representation to obtain three parameters n T+1 , p T+1 , π T+1 for predicting the risk value at the next moment.
[0133] The output module 700 uses point estimation for the ZINB distribution parameters to obtain the traffic accident risk prediction value at the next moment for each area.
[0134] The above is only used to illustrate the technical solutions of the present invention. It should be understood that the present invention is not limited to the above - mentioned embodiments. Those skilled in the art can make various changes, modifications and substitutions to the foregoing embodiments, and these changes, modifications and substitutions should all be regarded as the scope of the present invention. Therefore, the protection scope of the present invention should be determined by the scope defined in the appended claims.
Claims
1. A traffic accident risk prediction method based on spatiotemporal hypergraph contrastive learning, characterized in that: include: (1) Input historical traffic accident characteristics to obtain historical traffic accident risk value Y and traffic accident spatiotemporal feature tensor X; (2) Aggregating neighborhood geographic features, modeling the spatial features of the neighborhood of the traffic accident spatiotemporal feature tensor X, and generating a traffic accident area embedding based on local geographic perception; (3) extracting cross-domain semantic features and performing cross-region semantic feature modeling on the traffic accident spatiotemporal feature tensor X to generate a traffic accident region embedding based on global semantic perception; (4) Relying on dynamic time cycles, dynamically modeling the temporal features of the region embedding to obtain the local spatiotemporal feature embedding Z l and global spatiotemporal feature embedding Z g ; (5) The local and global spatiotemporal feature embeddings described in step (4) are contrastively trained through collaborative supervised training to reduce the distance between embeddings in the same region and increase the distance between embeddings in different regions, thereby obtaining a robust representation of traffic accident risk. The formula of the contrast loss function is as follows: (6) Integrate the zero-inflated negative binomial ZINB model into the traffic accident risk representation and obtain the three parameters n of the ZINB distribution: T+1 ,p T+1 ,π T+1 Used to predict the risk value at the next moment. (7) The ZINB distribution parameters are estimated by point estimation to obtain the traffic accident risk prediction value of each area at the next moment.
2. The traffic accident risk prediction method based on spatiotemporal hypergraph contrastive learning according to claim 1 is characterized in that: The step (1) of obtaining the traffic accident risk value Y and the traffic accident spatiotemporal feature tensor X comprises the following steps: (1.1) Based on the longitude and latitude of the urban space, the entire urban space is evenly divided into R geographical areas of equal size using the grid method; (1.2) According to the number of casualties in traffic accidents, traffic accidents are divided into three categories: minor, injured, and fatal, and the corresponding risk values are set to 1, 2, and 3 respectively; the sum of the accident risks of each geographical area within a one-hour time interval is calculated as the accident risk value Y of the area at time t t ; (1.3) Obtaining the spatiotemporal characteristic data of historical traffic accidents, the data preprocessing steps are as follows: (1.3.1) Obtain historical time information, including the hour, day of the week, and whether it is a holiday, and convert it into a one-hot encoding; (1.3.2) obtaining historical meteorological information of each of the geographical areas and converting the historical meteorological information into a one-hot code; (1.3.3) obtaining point of interest (POI) data of each of the geographical areas, counting the number of POI categories C and their corresponding quantities, and converting them into a C-dimensional vector as the regional functional attribute of the area; (1.3.4) Obtain taxi order data, project it to the corresponding geographical area according to the longitude and latitude of the passengers getting on and off the taxi, and summarize it at each time interval as the traffic flow information of the area; (1.4) The accident risk value Y generated by step (1.2), the historical time information generated by step (1.3.1), the meteorological data generated by step (1.3.2), the POI data generated by step (1.3.3) and the taxi order data generated by step (1.3.4) are used to generate a traffic accident spatiotemporal feature tensor X.
3. The traffic accident risk prediction method based on spatiotemporal hypergraph contrastive learning according to claim 1 is characterized in that: Step (2) specifically includes: (2.1) Use a multi-channel convolutional network to learn and aggregate the representations of different feature channels on the local receptive field; (2.2) Obtain the influence weights of different characteristic channels on traffic accidents. The specific formula is as follows: Among them, σ and δ represent Sigmoid and ReLU functions respectively. is the parameter of the fully connected layer, AvgPool(·) represents average pooling, X t Represents the traffic accident characteristics at time t. (2.3) Multiplying the weight obtained in step (2.2) by the original traffic accident feature to obtain a new representation with weight, and adding it to the initial input to obtain the final output of the neighborhood geographic feature aggregation module.
4. The traffic accident risk prediction method based on spatiotemporal hypergraph contrastive learning according to claim 1 is characterized in that: Step (3) specifically includes: (3.1) The original traffic accident risk data X at time t is enhanced by a linear layer t , and get the risk embedding at that moment (3.2) The hypergraph network is used to extract high-order relationships between different regions. Hyperedges are used as intermediate hubs to connect a group of regions with similar accident occurrence patterns. The formula for the hypergraph information transmission model is as follows: in, represents the learnable hypergraph dependency structure matrix, H is the number of hyperedges, and ε(·) is the LeakyReLU activation function; (3.3) Construct a hypergraph information network to inject the global relationship between regions into the representation paradigm of each region to enhance the regional self-supervision signal.
5. The traffic accident risk prediction method based on spatiotemporal hypergraph contrastive learning according to claim 4 is characterized in that: The construction of the hypergraph information network described in step (3.3) specifically includes the following steps: (3.3.1) Define a Readout function to get a graph-level summary representation. The specific formula is as follows: in, Gathers the global information of the entire graph at time t; (3.3.2) Define a destruction function to obtain the damaged hypergraph structure from the original graph as a negative sample. The specific formula is as follows: Among them, the Corruption function uses the method of randomly disrupting the region index to cause damage; (3.3.3) Define a discriminant function to score the region-level representation to determine whether the node comes from the original graph or the negative sample graph. The specific formula is as follows: in, is a learnable discriminant matrix, σ is the Sigmoid function; (3.3.4) Use the noise contrast objective to maximize the and s generated in step (3.3.1) t The mutual information between them is used to inject the global context information of the graph into a single region representation. The specific formula is as follows:
6. The traffic accident risk prediction method based on spatiotemporal hypergraph contrastive learning according to claim 1 is characterized in that: Step (4) specifically includes the following steps: (4.1) Extract temporal features from the most recent ξ time intervals and the same time intervals in the previous η weeks; (4.2) Based on the gated recurrent unit GRU, the temporal features extracted in step (4.1) are modeled to obtain the short-term proximity and long-term periodicity features of traffic accidents; (4.3) A temporal attention mechanism is adopted to highlight the temporal features that are more relevant to the target time point by calculating the attention score between the hidden state output by the step (4.2) and the temporal features of the target time interval T+1.
7. The traffic accident risk prediction method based on spatiotemporal hypergraph contrastive learning according to claim 1 is characterized in that: The formula of the ratio loss function described in step (5) is as follows:
8. The traffic accident risk prediction method based on spatiotemporal hypergraph contrastive learning according to claim 1 is characterized in that: Step (6) specifically includes the following steps: (6.1) Use a fully connected layer to fuse local and global spatiotemporal feature embeddings to obtain the final potential representation of traffic accidents (6.2) Define three fully connected neural networks to decode the potential representation of traffic accidents in step (6.1) Thus, the shape parameters n, p and sparse parameter π in the ZINB model are estimated. The specific formula is as follows: in, is the Softplus activation function, σ is the Sigmoid function, W * and b * is a trainable parameter; (6.3) Define the log-likelihood function of the ZINB model. The specific formula is as follows: Among them, y is the true value of accident risk, Γ represents the Gamma function; (6.4) The specific formula for the negative log-likelihood loss function of the ZINB model is finally defined as:
9. A traffic accident risk prediction system based on spatiotemporal hypergraph contrast learning, characterized in that: include: A historical traffic accident feature input module (100) is used to obtain a historical traffic accident risk value Y and a traffic accident spatiotemporal feature tensor X; A neighborhood geographic feature aggregation module (200) is used to perform spatial feature modeling of the neighborhood area on the traffic accident spatiotemporal feature tensor X to generate a traffic accident area embedding based on local geographic perception; A cross-domain semantic feature extraction module (300) is used to perform cross-region semantic feature modeling on the traffic accident spatiotemporal feature tensor X to generate a traffic accident region embedding based on global semantic perception; A time cycle dependency module (400) is used to dynamically model the time characteristics of the region embedding to obtain a local spatiotemporal feature embedding Z l and global spatiotemporal feature embedding Z g ; A collaborative supervised training module (500) for comparative training of local and global spatiotemporal feature embeddings, aiming to reduce the distance between embeddings in the same region and increase the distance between embeddings in different regions, thereby obtaining a robust traffic accident risk representation; The uncertainty perception prediction module (600) is used to integrate the zero-inflated negative binomial (ZINB) model into the traffic accident risk representation to obtain the three parameters n of the ZINB distribution. T+1 ,p T+1 ,π T+1 Used to predict the risk value at the next moment. The output module (700) uses a point estimation method to estimate the ZINB distribution parameters to obtain a traffic accident risk prediction value for each area at the next moment.
Citation Information
Cited By
Project cost intelligent management and control method and system based on dynamic multi-dimensional modeling
CN120542881A
Road transport vehicle driving risk uncertainty prediction method and system
CN120808595A
Method and system for evaluating influence of highway traffic accidents in high-altitude area
CN121615936A
A method and system for evaluating the influence of a highway traffic accident in a high-altitude area
CN121615936B
Traffic accident risk prediction method, electronic device, storage medium and program product
CN122175388A