Traffic accident risk prediction method and system based on space-time geography and social semantics
By constructing a traffic accident risk prediction model that integrates spatiotemporal geography and social semantics, the problem of insufficient consideration of social semantic information in existing technologies is solved, and accurate identification and rapid response to high-risk areas and time periods are achieved.
Patent Information
- Application Number
- CN202510794049.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-09-19
AI Technical Summary
Existing technologies fail to fully consider social semantic information in traffic accident risk prediction, resulting in poor accuracy and timeliness of prediction results in complex traffic environments.
Construct a traffic accident risk prediction model based on spatiotemporal geography and social semantics. Extract spatiotemporal data features through convolutional neural networks and long short-term memory networks, combine social media sentiment analysis, construct a social semantic feature model, and perform weighted fusion. Use graph attention networks to analyze social semantic information and construct a risk prediction model.
It significantly improves the accuracy and response speed of traffic accident risk prediction, especially in complex and dynamic traffic environments, and can accurately identify high-risk areas and time periods to reduce misjudgments.
Smart Images

Figure CN120673589A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of intelligent transportation, and specifically relates to a traffic accident risk prediction method and system based on spatiotemporal geography and social semantics. Background Art
[0002] With the rapid development of intelligent transportation systems and autonomous driving technologies, traffic accident risk prediction has become one of the key technologies to improve traffic safety and optimize traffic management.
[0003] Early methods for predicting traffic accident risk primarily relied on traditional machine learning algorithms, which used physical environmental information such as traffic flow, road type, and weather data for modeling. First, most traditional models relied on a single type of physical environmental data, such as traffic flow and weather, and failed to fully consider the interactions and spatiotemporal dynamics of multi-dimensional data. Second, existing methods generally ignored the potential impact of social semantic information on accident prediction, particularly social factors such as public sentiment on social media. Therefore, in emergency scenarios such as severe weather, large-scale events, or traffic accident hotspots, traditional models failed to integrate real-time social media sentiment, resulting in delayed or even ineffective predictions. This paper proposes a traffic accident risk prediction method and system based on spatiotemporal geography and social semantics. Summary of the Invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art; to this end, the present invention proposes a traffic accident risk prediction method and system based on spatiotemporal geography and social semantics, which is used to solve the technical problem that the prior art ignores the influence of social semantic information, making it difficult to accurately identify high-risk areas and high-risk time periods when faced with complex traffic environments, resulting in poor accuracy and timeliness of prediction results.
[0005] To achieve the above objectives, the first aspect of the present invention provides a traffic accident risk prediction method based on spatiotemporal geography and social semantics, comprising:
[0006] Extract historical spatiotemporal data and align them with the corresponding historical time series to build a spatiotemporal geographic feature model;
[0007] Extract historical social data and align it with historical time series, construct several social semantic graphs, analyze the social semantic correlation between social semantic information and traffic accident risks, and build a social semantic feature model;
[0008] The spatiotemporal geographic features and social semantic features are weightedly integrated to obtain a traffic accident risk prediction model.
[0009] Preferably, the process of constructing the spatiotemporal geographic feature model includes:
[0010] The convolutional neural network is used to extract the spatial local features of historical spatiotemporal data, and the long short-term memory network is used to extract the features of the historical time series of historical spatiotemporal data. The temporal attention mechanism is used to assign weights to each time point in the historical time series, and the spatiotemporal geographic feature model is constructed as follows:
[0011]
[0012] Where t is the time interval, t∈[1,T], is the output result of the spatiotemporal geography module, α t is the time attention score vector at time interval t, h t is the hidden state at time interval t; spatiotemporal data include traffic flow data, road type data, meteorological data, traffic accident data and social media data.
[0013] Preferably, the social media data obtains public opinion data related to traffic accidents through a social media platform, and performs polarity scoring on the text content through a sentiment analysis method based on a VADER model to obtain a sentiment polarity score, and the sentiment polarity score range is [-1, 1]; wherein -1 represents a strong negative emotion and 1 represents a strong positive emotion.
[0014] Preferably, the temporal attention score vector 1 includes:
[0015] Through the temporal attention mechanism, a weight is assigned to each time point in the historical time series, and the attention score is calculated as follows:
[0016] α t =softmax[ReLU(HW H +z T W z +b α )];
[0017] Among them, α t is the temporal attention score vector, W H is a learnable weight matrix used to linearly transform the encoder output H, W z is a learnable weight matrix for the decoder state z T Perform linear transformation, b α is the bias term, H=[h1,h2,…,h T ] is the hidden state vector of all regions, z T is the time characteristic of the target time interval T.
[0018] Preferably, the process of constructing the social semantic feature model includes:
[0019] Extract several nodes from each social semantic information and calculate the similarity of the impact of different nodes in each social semantic information on traffic accidents. For each node i, extract several nodes whose similarity difference with node i is greater than the difference threshold, mark them as adjacent nodes of node i, and construct an adjacency matrix for node i; where i is the node number;
[0020] It should be noted that the adjacency matrix is used to represent the structural relationship between nodes. As one of the input structures of the graph attention network, it guides the model to propagate and aggregate features between nodes, thereby forming a social semantic feature model.
[0021] The features of the nodes in the adjacency matrix are updated through the graph attention network, the historical time series modeling of the node features is performed through the long short-term memory network, and the weight is assigned to each time point in the historical time series through the computational time attention mechanism. The social semantic feature model is constructed as follows:
[0022]
[0023] in, is the output result of the social semantic feature model, F is the output result of the temporal attention, and M is the projection mapping matrix of each node to the spatial grid.
[0024] Preferably, the social semantic information includes a risk similarity map, a road topology map, and a regional function map;
[0025] The risk similarity graph analyzes the similarities in traffic accident risk impacts across different regions;
[0026] The road topology map analyzes the similarity of the impact of traffic flow on traffic accident risks between different roads;
[0027] The regional functional map analyzes the similarity of the impact of different regions on accident risks in terms of functional distribution;
[0028] Among them, the nodes of the risk similarity graph represent different areas, the nodes of the road topology graph represent different roads, and the nodes of the regional function graph represent the functions of different areas.
[0029] Preferably, updating node features through a graph attention network includes:
[0030]
[0031] in, is the updated attention score vector, is the node feature vector after node update, Respectively represent the feature vectors of nodes i and j at time interval t, W, W k, a is the learning parameter matrix, || represents the connection operation, σ is the activation function, d is the dimension of each node feature vector, Ν(i) is the adjacency matrix of node i, k is the sequence number of the attention mechanism, and K is the total number of attention mechanisms.
[0032] Preferably, the weighted fusion of the spatiotemporal geographic feature model and the social semantic feature model to construct a traffic accident risk prediction model includes:
[0033] The weighted spatiotemporal geographic features and social semantic features are input into the fully connected layer, which performs feature fusion and generates a traffic accident risk prediction model:
[0034]
[0035] in, represents the traffic accident risk level vector for a future time interval, * represents the convolution operation, W1 and W2 are the weight coefficients of the spatiotemporal geographic feature model and the social semantic feature model, respectively, and FC(·) represents the fully connected layer.
[0036] Preferably, the weighted loss function of the traffic accident risk prediction model is constructed, including:
[0037] The weighted loss function is constructed as follows:
[0038]
[0039] Where r is the traffic accident risk level, r = {0, 1, 2, ..., R}, R is a positive integer, Y(r) is the ground truth value of the traffic accident with risk level r, λ r Represents the weight of the training sample with risk level r, and its value is the inverse of the number of samples with level r. It is the value predicted by the traffic accident risk prediction model for traffic accidents with risk level r.
[0040] Preferably, the second aspect of the present invention provides a traffic accident risk prediction system based on spatiotemporal geography and social semantics, comprising an analysis module and a prediction module;
[0041] Analysis module: used to extract historical spatiotemporal data, align the historical spatiotemporal data with the corresponding historical time series, and build a spatiotemporal geographic feature model;
[0042] Furthermore, we extract historical social data and align the historical social data with historical time series to construct a number of social semantic information, analyze the social semantic correlation between social semantic information and traffic accident risks, and construct a social semantic feature model;
[0043] Prediction module: weighted fusion of spatiotemporal geographic features and social semantic features to obtain a traffic accident risk prediction model.
[0044] Compared with the prior art, the present invention has the following beneficial effects:
[0045] The model based on the dual-channel fusion of spatiotemporal geographic features and social semantic features can accurately capture the complex relationship between time, space and social behavior by combining physical environmental data such as traffic flow, road conditions, and weather, as well as social semantic features such as social media sentiment analysis. This fusion solves the problem that traditional methods fail to fully consider the impact of social semantic information on the occurrence of traffic accidents, significantly improves the accuracy of traffic accident risk prediction, and provides more accurate decision-making support for traffic management; secondly, the dynamic fusion mechanism of social semantic features and spatiotemporal geographic features performs weighted fusion of features from different data sources through a learnable weight matrix, and automatically adjusts the weights according to the spatiotemporal characteristics of the data and the importance of social behavior, thereby more accurately identifying high-risk areas and time periods. In particular, when facing complex and dynamic traffic environments, it can adapt to real-time changes and improve the response speed to emergencies; and, in response to the zero inflation problem and insufficient high-risk samples in traffic accident risk prediction, the present invention designs a weighted loss function based on risk level. This optimization method assigns higher training weights to samples in high-risk areas, allowing the model to pay more attention to high-risk areas, significantly improving the prediction accuracy of these areas, reducing misjudgments caused by too many samples in low-risk areas, and ensuring more accurate predictions during high-risk periods. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0047] Figure 1 Schematic diagram of the process of the present invention;
[0048] Figure 2 Schematic diagram of the system structure of the present invention. DETAILED DESCRIPTION
[0049] The technical solutions of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the embodiments described are only a part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0050] See also Figure 1 The first embodiment of the present invention provides a traffic accident risk prediction method based on spatiotemporal geography and social semantics, including:
[0051] Extract historical spatiotemporal data and align the historical spatiotemporal data with the corresponding historical time series;
[0052] Among them, spatiotemporal data includes traffic flow data, road type data, meteorological data, traffic accident data and social media data; spatiotemporal data is collected through cameras, radars and other sensor devices.
[0053] Public opinion data related to traffic accidents was obtained through social media platforms, and the sentiment polarity score was extracted using the sentiment analysis tool VADER. The sentiment polarity score ranged from [-1, 1] and was associated with the geographic location tag.
[0054] Temporal alignment and spatial mapping of these data types were performed, converting all data into a unified gridded format to ensure that data from different sources could be analyzed at the same temporal and spatial scales. Temporal alignment was performed using a sliding window method, and spatial mapping was performed based on the UTM coordinate system, dividing the urban area into a 2km×2km grid. The UTM coordinate system used was Zone 50N.
[0055] The construction process of the spatiotemporal geographic feature model is as follows;
[0056] Specifically, the spatial local features of historical spatiotemporal data are extracted through a convolutional neural network. The convolutional neural network model is as follows:
[0057]
[0058] Among them, t is the time interval, t∈[1,T], k is the convolution layer number, is the output of the kth convolutional layer at time interval t, is the output of the kth convolutional layer at time interval t-1, that is The previous output, W t k 、 are learnable convolution kernels and bias terms, * represents convolution operation, and ReLU represents activation function.
[0059] Among them, the number of layers k of the convolutional neural network can be set to 2, and the convolution kernel size can be set to 3×3.
[0060] The long short-term memory network is used to model the historical time series of historical spatiotemporal data and identify the temporal patterns of traffic accidents. The long short-term memory network model is as follows:
[0061]
[0062] in, represents the input features of the i-th region at time interval t, including the spatiotemporal information of the region, such as traffic flow, road conditions, and weather data. is the hidden state at time interval t-1, is the hidden state at time interval t, and LSTM is a long short-term memory network.
[0063] Through the temporal attention mechanism, a weight is assigned to each time point in the historical time series, highlighting the time period features that have the greatest impact on the current moment, thereby enhancing the time series prediction ability of the long short-term memory network model;
[0064] The calculation model of attention score vector 1 is as follows:
[0065] α t =softmax[ReLU(HW H +z T W z +b α )];
[0066] Among them, α t is the temporal attention score vector, W H is a learnable weight matrix used to linearly transform the encoder output H, W z is a learnable weight matrix for the decoder state z T Perform linear transformation, b α is the bias term, H=[h1,h2,…,h T ] is the hidden state vector of all regions, z T is the time feature at the target time interval T. The softmax function is used to normalize the calculation results so that the sum of all attention scores is 1, which facilitates the model to dynamically adjust the attention weight according to the importance of different time points. Finally, the weighted hidden states of all historical time intervals are dynamically merged to obtain the output of the spatiotemporal geographic feature model:
[0067]
[0068] in, is the output of the spatiotemporal geographic model, α t is the time attention score vector at time interval t, h t is the hidden state at time interval t.
[0069] Extract historical social data and align them with historical time series to construct several social semantic graphs. Analyze the social semantic correlation between social semantic information and traffic accident risks, and construct a social semantic feature model as follows:
[0070] The graph attention network is used to construct social semantic information, including risk similarity graph, road topology graph and regional function graph, and calculate the similarity between nodes in each social semantic information to capture the social semantic relevance of traffic accidents;
[0071] The similarity between risk areas is captured through the risk similarity graph, which represents the similarity of different risk areas in terms of traffic accident risks. Each risk area is a node.
[0072] The road topology graph is used to represent the traffic flow similarity between different roads and to capture the impact of traffic flow patterns on accident risks; each road is a node.
[0073] The regional function diagram is used to represent the impact of regional functions on accident risks and capture the similarities in functional distribution among different regions; each function in each region is a node.
[0074] The POI similarity score between any two nodes in a certain social semantic information is calculated. To measure the similarity, Jensen-Shannon Divergence (JSD) is used as a metric. JSD is a symmetric metric that can quantify the similarity between two probability distributions and is applicable to asymmetry between distributions.
[0075] By using JSD, the POI similarity score between any two nodes in a certain social semantic information is calculated as follows:
[0076]
[0077] in, represents the POI distribution of nodes i and j, for The lth dimension of for The lth dimension of , p is the abbreviation symbol of POI, q represents the total number of interest point categories, and is the dimension used to construct the POI distribution vector.
[0078] For each node i, several nodes whose similarity difference with node i is greater than the difference threshold are extracted, marked as adjacent nodes of node i, and the adjacency matrix of node i is constructed; where i is the node sequence number to ensure the sparsity and effectiveness of the graph.
[0079] The node features in the adjacency matrix are updated through the graph attention network, and the final feature representation of the node is calculated. Specifically, at the time interval t, the feature of each node i can be expressed as The features of all nodes constitute the graph signal matrix Then calculate the attention score process:
[0080]
[0081] in, Denote the feature vectors of nodes i and j at time interval t, W, W k , a is the learning parameter matrix, || represents the connection operation, σ represents the activation function, the selection of all neighbor nodes is normalized by the softmax function, and the weight of each neighbor node's influence on the target node is obtained, d represents the d-dimensional feature of each input node, Ν(i) represents the set of neighbor nodes of node i, and the number of attention mechanisms is represented by K. Update the feature vector of node for the updated node feature vector of node .
[0082] Node features are modeled as time series using a long short-term memory (LSTM) network. Specifically, data from the most recent p time intervals and the same time intervals from the previous q weeks are selected as inputs to the social semantics module. These inputs are then processed using the LSTM network to model temporal correlations. The process is described as follows:
[0083]
[0084] in, is the graph attention network output of node i at time interval t, is the hidden state at time t, is the hidden state at time interval t-1.
[0085] Temporal correlation is captured by calculating the temporal attention score. Specifically, let H′ = [h′1,h′2,…,h′ T ] is the hidden state of all nodes. Then, by calculating the hidden state H′ and time feature z T The attention score between them is used to dynamically capture the temporal correlation using the temporal attention mechanism. The process is described as follows:
[0086] Δ′=softmax[ReLU(H′W′ H +z T W′ z +b′ α )];
[0087] Among them, W H ′ is used to linearly transform the weight matrix of the historical feature matrix H′, W z ′ is used to linearly transform the target moment feature Z T The weight matrix, b′ αis the attention scoring bias term, and α′ is the temporal attention score vector 2, which represents the importance distribution of different historical time intervals on the target time interval. The dynamic weight of temporal correlation is calculated through the temporal attention mechanism, and the output of temporal attention is finally obtained:
[0088]
[0089] Among them, F is the output result of temporal attention, α i ′ is the attention score vector at time interval i, h i ′ is the hidden state at time interval i.
[0090] The spatiotemporal geographic features and social semantic features are weighted by a learnable weight matrix to learn the relative importance of each feature.
[0091] The fused features are input into the traffic accident risk prediction model to output the traffic accident risk level of each spatial grid at the target time.
[0092] Specifically, in order to better fuse the graph signal with the grid feature, a pre-calculated mapping matrix M is constructed to convert F into a grid format. For example, if node n corresponds to region i, then M i,n =1, otherwise M i,n =0. Finally, through this mapping, the output of the spatiotemporal semantic model is obtained:
[0093]
[0094] Traffic accident risk prediction model:
[0095]
[0096] Among them, * represents convolution operation. The present invention uses a 1×1 convolution kernel, W1 and W2 are the parameters of the convolution kernel, and FC(·) represents the fully connected layer. After dynamic fusion, the final traffic accident risk prediction result is generated. Indicates the risk of traffic accidents in the next time interval.
[0097] The weighted loss function optimization of the traffic accident risk prediction model mainly includes the following steps:
[0098] All training samples are divided into four levels according to the risk level of traffic accidents, and each level has a different weight.
[0099] Optimize the weighted loss function and give higher weights to samples Y(r) with higher risk levels to enhance their impact on model training. The final weighted loss function is:
[0100]
[0101] Where r is the traffic accident risk level, r = {0, 1, 2, ..., R}, R is a positive integer, Y(r) is the ground truth value of the traffic accident with risk level r, λ r Represents the weight of the training sample with risk level r, and its value is the inverse of the number of samples with level r. It is the value predicted by the traffic accident risk prediction model for traffic accidents with risk level r.
[0102] A second aspect of the present invention provides a traffic accident risk prediction system based on spatiotemporal geography and social semantics, comprising an analysis module and a prediction module;
[0103] Analysis module: used to extract historical spatiotemporal data, align the historical spatiotemporal data with the corresponding historical time series, and build a spatiotemporal geographic feature model;
[0104] Furthermore, we extract historical social data and align the historical social data with historical time series to construct a number of social semantic information, analyze the social semantic correlation between social semantic information and traffic accident risks, and construct a social semantic feature model;
[0105] Prediction module: weighted fusion of spatiotemporal geographic features and social semantic features to obtain a traffic accident risk prediction model.
[0106] Some of the data in the above formula are calculated by removing the dimensions and taking their numerical values. The formula is a formula that is closest to the actual situation obtained by software simulation of a large amount of collected data; the preset parameters and preset thresholds in the formula are set by technical personnel in this field according to actual conditions or obtained through simulation of a large amount of data.
[0107] The above embodiments are only used to illustrate the technical method of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.
Claims
1. A traffic accident risk prediction method based on spatiotemporal geography and social semantics, characterized by: include: Extract historical spatiotemporal data and align it with the corresponding historical time series to build a spatiotemporal geographic feature model; the spatiotemporal data includes traffic flow data, road type data, meteorological data, traffic accident data, and social media data; Extract historical social data and align it with historical time series to construct social semantic information. Analyze the social semantic correlation between social semantic information and traffic accident risk, and build a social semantic feature model. Social semantic information includes risk similarity maps, road topology maps, and regional functional maps. The spatiotemporal geographic features and social semantic features are weightedly integrated to obtain a traffic accident risk prediction model.
2. The traffic accident risk prediction method based on spatiotemporal geography and social semantics according to claim 1 is characterized in that: The process of constructing the spatiotemporal geographic feature model includes: The convolutional neural network is used to extract the spatial local features of historical spatiotemporal data, and the long short-term memory network is used to extract the features of the historical time series of historical spatiotemporal data. The temporal attention mechanism is used to assign weights to each time point in the historical time series, and the spatiotemporal geographic feature model is constructed as follows: in, is the output of the spatiotemporal geographic model, t is the time interval of historical spatiotemporal data, t∈[1,T], α t is the time attention score vector at time interval t, h t is the hidden state at time interval t.
3. The traffic accident risk prediction method based on spatiotemporal geography and social semantics according to claim 1 is characterized in that: The social media data obtains public opinion data related to traffic accidents through social media platforms, and performs polarity scoring on text content through the sentiment analysis method of the VADER model to obtain a sentiment polarity score; the sentiment polarity score range is [-1, 1]; where -1 represents strong negative sentiment and 1 represents strong positive sentiment.
4. The traffic accident risk prediction method based on spatiotemporal geography and social semantics according to claim 2 is characterized in that: The temporal attention score vector 1 includes: Through the temporal attention mechanism, a weight is assigned to each time point in the historical time series, and the attention score is calculated as follows: α t =softmax[ReLU(HW H +z T W z +b α )]: Among them, α t is the temporal attention score vector, W H is a learnable weight matrix used to linearly transform the encoder output H, W z is a learnable weight matrix for the decoder state z T Perform linear transformation, b α is the bias term, H=[h1,h2,…,h T ] is the hidden state vector of all regions, z T is the time characteristic of the target time interval T.
5. The traffic accident risk prediction method based on spatiotemporal geography and social semantics according to claim 1 is characterized in that: The process of constructing the social semantic feature model includes: Extract several nodes from each social semantic information and calculate the similarity of the impact of different nodes in each social semantic information on traffic accidents. For each node i, extract several nodes whose similarity difference with node i is greater than the difference threshold, mark them as adjacent nodes of node i, and construct an adjacency matrix for node i; where i is the node number; The features of the nodes in the adjacency matrix are updated through the graph attention network, the historical time series modeling of the node features is performed through the long short-term memory network, and the weight is assigned to each time point in the historical time series through the computational time attention mechanism. The social semantic feature model is constructed as follows: in, is the output result of the social semantic feature model, F is the output result of the temporal attention, and M is the projection mapping matrix of each node to the spatial grid.
6. The traffic accident risk prediction method based on spatiotemporal geography and social semantics according to claim 1 is characterized in that: The risk similarity map is used to analyze the similarity of traffic accident risk impacts in different regions; The road topology map is used to analyze the similarity of the impact of traffic flow on traffic accident risks between different roads; The regional functional map is used to analyze the similarity of the impact of functional distribution on accident risks in different regions; Among them, the nodes of the risk similarity graph represent different areas, the nodes of the road topology graph represent different roads, and the nodes of the regional function graph represent the functions of different areas.
7. The traffic accident risk prediction method based on spatiotemporal geography and social semantics according to claim 5 is characterized in that: The updating of the features of the nodes in the adjacency matrix through the graph attention network includes: in, is the updated attention score vector, s i ' t is the node feature vector after node update, Respectively represent the feature vectors of nodes i and j at time interval t, W, W k , a is the learning parameter matrix, || represents the connection operation, σ is the activation function, d is the dimension of each node feature vector, Ν(i) is the adjacency matrix of node i, k is the sequence number of the attention mechanism, and K is the total number of attention mechanisms.
8. The traffic accident risk prediction method based on spatiotemporal geography and social semantics according to claim 1 is characterized in that: The weighted fusion of the spatiotemporal geographic feature model and the social semantic feature model to construct a traffic accident risk prediction model includes: The weighted spatiotemporal geographic features and social semantic features are input into the fully connected layer, where they are fused and a traffic accident risk prediction model is constructed: in, represents the traffic accident risk level vector for a future time interval, * represents the convolution operation, W1 and W2 are the weight coefficients of the spatiotemporal geographic feature model and the social semantic feature model, respectively, and FC(·) represents the fully connected layer.
9. The method for predicting traffic accident risk based on spatiotemporal geography and social semantics according to claim 8, characterized in that: The weighted loss function of the traffic accident risk prediction model is constructed, including: The weighted loss function is constructed as follows: Where r is the traffic accident risk level, r = {0, 1, 2, ..., R}, R is a positive integer, Y(r) is the ground truth value of the traffic accident with risk level r, λ r Represents the weight of the training sample with risk level r, and its value is the inverse of the number of samples with level r. It is the value predicted by the traffic accident risk prediction model for traffic accidents with risk level r.
10. A traffic accident risk prediction system based on spatiotemporal geography and social semantics, operating based on the traffic accident risk prediction method based on spatiotemporal geography and social semantics according to any one of claims 1 to 9, characterized in that: Includes analysis module and prediction module; Analysis module: This module is used to extract historical spatiotemporal data, align it with the corresponding historical time series, and construct a spatiotemporal geographic feature model. The spatiotemporal data includes traffic flow data, road type data, meteorological data, traffic accident data, and social media data. Furthermore, historical social data is extracted and aligned with historical time series to construct a number of social semantic information, analyze the social semantic correlation between social semantic information and traffic accident risk, and construct a social semantic feature model; the social semantic information includes risk similarity maps, road topology maps, and regional functional maps; Prediction module: weighted fusion of spatiotemporal geographic features and social semantic features to obtain a traffic accident risk prediction model.