Urban road traffic risk prediction method and device, electronic equipment and storage medium
By using a spatiotemporal sequence deep learning model, combined with CNN and LSTM, to process multi-source data and fuse spatial and temporal features, it solves the problem of high computational complexity in large-scale spatiotemporal data processing in the existing technology, and improves the accuracy of urban road traffic risk prediction. Accuracy and efficiency.
Patent Information
- Application Number
- CN202411295743.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-01-24
AI Technical Summary
The prior art has high computational complexity when processing large-scale and high-dimensional spatiotemporal data, resulting in low accuracy in predicting urban road traffic risks.
The spatiotemporal sequence deep learning model is used, combined with the convolutional neural network (CNN) and the long short-term memory network (LSTM), to preprocess and extract features from multi-source data, fuse spatial and temporal features, and conduct traffic risk prediction.
By reducing the complexity of calculation, the accuracy and efficiency of traffic risk prediction have been improved, and more accurate decision support is provided for urban traffic management.
Smart Images

Figure CN119359012A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent transportation technology, and in particular to a method, device, electronic equipment and computer-readable storage medium for predicting urban road traffic risks. Background Art
[0002] Among the related technologies, urban traffic risk prediction mainly relies on traditional statistical analysis methods and machine learning techniques, such as random forests and support vector machines. Although these methods perform well in some cases, they have obvious limitations when processing large-scale, high-dimensional spatiotemporal data. For example, although random forests can handle classification and regression tasks, their ability to capture spatiotemporal correlations is limited; support vector machines work well on small sample data, but when processing large-scale data, the computational complexity is high and it is difficult to apply in real time.
[0003] Therefore, when processing large-scale data, how to reduce computational complexity and improve the accuracy of traffic risk prediction is a problem that needs to be solved. Summary of the invention
[0004] The present invention provides a method, device, electronic device and computer-readable storage medium for predicting urban road traffic risks, so as to at least solve the problem in the related art that the accuracy of traffic risk prediction is low due to high computational complexity in processing large-scale data. The technical solution of the present invention is as follows:
[0005] According to a first aspect of an embodiment of the present invention, there is provided a method for predicting urban road traffic risks, comprising:
[0006] Obtain multi-source data of each road in the target city to be predicted;
[0007] Preprocessing the multi-source data to obtain standardized data;
[0008] Based on the trained spatiotemporal sequence deep learning model, traffic risk prediction is performed on the standardized data to obtain the traffic risk probability of each road in the target city in the future time period, wherein the spatiotemporal sequence deep learning model includes a concatenated convolutional neural network CNN model and a long short-term memory network LSTM model, the CNN model is used for extracting spatial feature vectors, and the LSTM model is used for extracting time series feature vectors and sequence learning.
[0009] Optionally, the method further includes:
[0010] According to the set risk threshold, the traffic risk probability of each road in the target city in the future time period is converted into a corresponding traffic risk category, and the traffic risk category includes high traffic risk or low traffic risk.
[0011] Optionally, the method further includes:
[0012] The traffic risk probabilities of various roads in the target city in the future time period are visualized.
[0013] Optionally, the traffic risk prediction is performed on the extracted standardized data based on the trained spatiotemporal sequence deep learning model to obtain the traffic risk probability of each road in the target city in a future time period, including:
[0014] Determine the spatial feature vector of the standardized data based on the convolutional neural network (CNN) in the spatiotemporal sequence deep learning model; and
[0015] Determine the time series feature vector of the standardized data based on the long short-term memory network LSTM in the spatiotemporal sequence deep learning model;
[0016] The spatial feature vector and the time series feature vector are fused in time order to obtain a spatiotemporal feature vector;
[0017] The spatiotemporal feature vector is passed through one or more fully connected layers, and the spatiotemporal feature vector is mapped to the risk prediction task to obtain the traffic risk probability of each road in the target city in the future time period.
[0018] Optionally, the determining the spatial feature vector of the standardized data based on a convolutional neural network (CNN) in the spatiotemporal sequence deep learning model includes:
[0019] Dividing the standardized data into a plurality of grids according to each road area;
[0020] Obtain traffic flow data and accident hotspot data for each grid, and organize them into traffic data in time series;
[0021] The traffic data of each grid is input into the convolutional neural network (CNN), and the spatial feature vector corresponding to each network is obtained through pixel conversion, convolution operation, nonlinear transformation and maximum pooling.
[0022] Optionally, determining the time series feature vector of the standardized data based on the long short-term memory network LSTM in the spatiotemporal sequence deep learning model includes:
[0023] Extracting a time series corresponding to the spatial feature vector in each time step in the standardized data;
[0024] The extracted spatial feature vector is input into a long short-term memory network LSTM according to the time series, the law of evolution of traffic conditions with the time series and the dependency relationship are learned, and a time series feature vector corresponding to the spatial feature vector is obtained.
[0025] Optionally, after fusing the spatial feature vector and the time series feature vector in time order to obtain the spatiotemporal feature vector, the method further includes:
[0026] Determine the correlation between the spatiotemporal feature vector of each grid and each road of the target city to be predicted in each time step;
[0027] Using the attention mechanism, the similarity between the query vector and the key vector is calculated through the dot product operation;
[0028] Convert the similarity into attention weight through a softmax function;
[0029] Multiply the spatiotemporal feature vector of each time step and each grid by the corresponding attention weight;
[0030] All weighted spatiotemporal feature vectors are summed to obtain the optimized spatiotemporal feature vector.
[0031] Optionally, the method includes: pre-training the spatiotemporal sequence deep learning model in the following manner:
[0032] Get the dataset;
[0033] Preprocessing the data set;
[0034] Divide the preprocessed dataset into training set and validation set;
[0035] The training set is input into a pre-built spatiotemporal sequence deep learning model for training; during the training process, the spatiotemporal feature vector of the training set is extracted, and the spatiotemporal feature vector is mapped to the risk prediction task to obtain a predicted traffic risk probability; the predicted traffic risk probability is compared with the traffic risk probability evaluated based on the validation set, and a loss value is calculated according to the comparison result. Based on the loss value, the parameters of the spatiotemporal sequence deep learning model are updated through a back propagation mechanism, and after multiple iterations, until the spatiotemporal sequence deep learning model converges, a trained spatiotemporal sequence deep learning model is obtained.
[0036] According to a second aspect of an embodiment of the present invention, there is provided an urban road traffic risk prediction device, the device comprising:
[0037] The first acquisition module is used to acquire multi-source data of various roads in the target city to be predicted;
[0038] A first preprocessing module, used for preprocessing the multi-source data to obtain standardized data;
[0039] The prediction module is used to perform traffic risk prediction on the standardized data based on the trained spatiotemporal sequence deep learning model to obtain the traffic risk probability of each road in the target city in the future time period, wherein the spatiotemporal sequence deep learning model includes a concatenated convolutional neural network CNN model and a long short-term memory network LSTM model, the CNN model is used for extracting spatial feature vectors, and the LSTM model is used for extracting time series feature vectors and sequence learning.
[0040] Optionally, the device also includes: a first conversion module, used to convert the traffic risk probability of each road in the target city in a future time period into a corresponding traffic risk category according to a set risk threshold, and the traffic risk category includes high traffic risk or low traffic risk.
[0041] Optionally, the device further comprises: a visualization module, wherein:
[0042] The visualization module is used to visualize the traffic risk probabilities of various roads in the target city in the future time period.
[0043] Optionally, the prediction module includes:
[0044] A first determination module is used to determine the spatial feature vector of the standardized data based on a convolutional neural network (CNN) in the spatiotemporal sequence deep learning model; and
[0045] A second determination module is used to determine the time series feature vector of the standardized data based on the long short-term memory network LSTM in the spatiotemporal sequence deep learning model;
[0046] A fusion module, used for fusing the spatial feature vector and the time series feature vector in time order to obtain a spatiotemporal feature vector;
[0047] A mapping module is used to map the spatiotemporal feature vector to the risk prediction task through one or more fully connected layers to obtain the traffic risk probability of each road in the target city in the future time period.
[0048] Optionally, the first determining module includes:
[0049] A first division module, used for dividing the standardized data into a plurality of grids according to each road area;
[0050] The second acquisition module acquires the traffic flow data and accident hotspot data of each grid and organizes them into traffic data according to the time series;
[0051] The first processing module is used to input the traffic data sorted by each grid into the convolutional neural network CNN, and obtain the spatial feature vector corresponding to each network through pixel conversion, convolution operation, nonlinear transformation and maximum pooling in sequence.
[0052] Optionally, the second determining module includes:
[0053] A second extraction module is used to extract the time series corresponding to the spatial feature vector in each time step in the standardized data;
[0054] The second processing module is used to input the extracted spatial feature vector into the long short-term memory network LSTM according to the time series, learn the evolution law and dependency of traffic conditions with the time series, and obtain the time series feature vector corresponding to the spatial feature vector.
[0055] Optionally, the prediction module further includes:
[0056] A correlation determination module, used to determine the correlation between the spatiotemporal feature vector of each grid and each road of the target city to be predicted in each time step after the fusion module fuses the spatial feature vector and the time series feature vector in time order to obtain the spatiotemporal feature vector;
[0057] A similarity determination module, for calculating the similarity between the query vector and the key vector through a dot product operation using an attention mechanism;
[0058] A second conversion module, used for converting the similarity into an attention weight through a softmax function;
[0059] A weighting module is used to multiply the spatiotemporal feature vector of each time step and each grid by the corresponding attention weight;
[0060] The summation module is used to sum all weighted spatiotemporal feature vectors to obtain an optimized spatiotemporal feature vector.
[0061] Optionally, the device includes: a training module, configured to pre-train the spatiotemporal sequence deep learning model in the following manner:
[0062] A third acquisition module is used to acquire a data set;
[0063] A second preprocessing module, used for preprocessing the data set;
[0064] A second division module, used to divide the data set preprocessed by the second preprocessing module into a training set and a validation set;
[0065] The model training module is used to input the training set into a pre-built spatiotemporal sequence deep learning model for training; during the training process, the spatiotemporal feature vector of the training set is extracted, and the spatiotemporal feature vector is mapped to the risk prediction task to obtain a predicted traffic risk probability; and the predicted traffic risk probability is compared with the traffic risk probability evaluated based on the validation set, and a loss value is calculated according to the comparison result. Based on the loss value, the parameters of the spatiotemporal sequence deep learning model are updated through a back propagation mechanism, and after multiple iterations, the spatiotemporal sequence deep learning model converges to obtain a trained spatiotemporal sequence deep learning model.
[0066] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, including:
[0067] processor;
[0068] a memory for storing instructions executable by the processor;
[0069] Wherein, the processor is configured to execute the instructions to implement the urban road traffic risk prediction method as described above.
[0070] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the urban road traffic risk prediction method as described above.
[0071] According to a fifth aspect of an embodiment of the present invention, a computer program product is provided, including a computer program or instructions, which, when executed by a processor of an electronic device, implements the urban road traffic risk prediction method as described above.
[0072] The technical solution provided by the embodiments of the present invention brings at least the following beneficial effects:
[0073] In an embodiment of the present invention, multi-source data of each road in the target city to be predicted is obtained, and the multi-source data is preprocessed to obtain standardized data; based on the trained spatiotemporal sequence deep learning model, the standardized data is subjected to traffic risk prediction to obtain the traffic risk probability of each road in the target city in the future time period, wherein the spatiotemporal sequence deep learning model includes a concatenated convolutional neural network CNN model and a long short-term memory network LSTM model, the CNN model is used to extract spatial feature vectors, and the LSTM model is used to extract time series feature vectors and sequence learning. That is to say, in an embodiment of the present invention, the multi-source data obtained is preprocessed to enhance the generalization ability and adaptability of the model, and the standardized data is subjected to traffic risk prediction based on the trained spatiotemporal sequence deep learning model, which can automatically learn complex patterns from a large amount of spatiotemporal data, improve the accuracy of risk prediction, and bring convenience to urban traffic management. .
[0074] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present invention, and are used together with the specification to explain the principles of the present invention, and do not constitute an improper limitation of the present invention. In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0076] Figure 1 It is a flow chart of a method for predicting urban road traffic risks provided by an embodiment of the present invention.
[0077] Figure 2 It is a schematic diagram of data collection and integration provided by an embodiment of the present invention.
[0078] Figure 3 This is a flow chart of extracting spatiotemporal feature vectors provided by an embodiment of the present invention.
[0079] Figure 4 It is a flowchart of a training process for a spatiotemporal sequence deep learning model provided by an embodiment of the present invention.
[0080] Figure 5 It is a block diagram of a device for predicting urban road traffic risks provided by an embodiment of the present invention.
[0081] Figure 6It is another block diagram of a device for predicting urban road traffic risks provided by an embodiment of the present invention.
[0082] Figure 7 It is a block diagram of a prediction module provided by an embodiment of the present invention.
[0083] Figure 8 It is a block diagram of an electronic device provided by an embodiment of the present invention.
[0084] Fig. 9 It is a block diagram of a device for predicting urban road traffic risks provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0085] In order to enable ordinary persons in the art to better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings.
[0086] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0087] Technical terms:
[0088] Deep Learning: A machine learning method based on artificial neural networks that can automatically learn and extract complex features from large amounts of data by simulating the way the human brain processes information.
[0089] Spatiotemporal Data Analysis: involves analyzing data that has both spatial and temporal attributes to identify and predict patterns and trends in the data.
[0090] Risk Assessment Technology: A technology that assesses potential risks and their possible impact on a specific system or activity. In this invention, it is used to predict urban traffic risks.
[0091] Data Preprocessing: The process of cleaning, transforming and preparing data before data analysis to improve data quality.
[0092] Data Fusion: The process of integrating data from different sources and formats into a unified data view.
[0093] ETL tools (Extract, Transform, Load Tools): tools used for data extraction, transformation and loading, used for data warehouse construction and data integration.
[0094] Model Training: Use a training dataset to train the model so that it can learn patterns and relationships in the data.
[0095] Performance Evaluation: The process of evaluating the predictive performance of a model, usually using specific metrics such as MAE, RMSE, and MAPE.
[0096] On the basis of understanding the above technical terms, please refer to the following embodiments.
[0097] Figure 1 is a flow chart of a method for predicting urban road traffic risks provided by an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0098] Step 101: Obtain multi-source data of various roads in the target city to be predicted.
[0099] Step 102: pre-process the multi-source data to obtain standardized data.
[0100] Step 103: Based on the trained spatiotemporal sequence deep learning model, traffic risk prediction is performed on the standardized data to obtain the traffic risk probability of each road in the target city in the future time period, wherein the spatiotemporal sequence deep learning model includes a concatenated convolutional neural network CNN model and a long short-term memory network LSTM model, the CNN model is used for extracting spatial feature vectors, and the LSTM model is used for extracting time series feature vectors and sequence learning.
[0101] The urban road traffic risk prediction method described in the present invention can be applied to terminals, servers, etc., without limitation herein. The terminal implementation device can be electronic devices such as smart phones, laptops, tablet computers, desktop computers, personal digital assistants (PDAs) and wearable devices. The server can be an independent server or a server cluster, or a server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, intermediate services, domain name services, security services, content distribution networks, or a big data and artificial intelligence platform, etc., without limitation herein.
[0102] Combine the following Figure 1 , the specific implementation steps of an XX method provided in an embodiment of the present invention are described in detail.
[0103] In step 101, multi-source data of roads in a target city to be predicted is obtained.
[0104] The multi-source data in this step may include real-time traffic flow, historical accident data, weather forecasts, special event schedules, etc.
[0105] The multi-source data in this step can be automatically obtained from multiple channels, including but not limited to urban traffic monitoring cameras, historical accident databases of traffic management departments, real-time weather forecasts from weather stations, special event announcements on social media, etc.
[0106] Afterwards, you can use ETL (Extract, Transform, Load) tools to unify the format of the data obtained from different sources and store the unified data in the database to ensure data consistency and integrity.
[0107] The specific methods of acquiring multi-source data include:
[0108] 1) Data collection method
[0109] 11) Data collection through urban traffic monitoring cameras: Before data collection, it is usually necessary to establish a stable cooperative relationship with the city management agency to ensure high-quality and stable real-time video streams. Considering the huge amount of data, the use of efficient video processing technology, such as extracting 1 frame of high-definition image per minute, can not only retain key information, but also reduce the pressure of storage and processing.
[0110] 12) Collect data from the historical accident database of the traffic management department: Obtain the latest accident data from the traffic management department regularly (such as daily) to ensure the timeliness and integrity of the database. The data should include detailed information such as the specific time of the accident, location coordinates, accident type, number of injured, property loss, etc.
[0111] 13) Collect weather forecasts in real time through weather stations: You can cooperate with the meteorological department to establish a data sharing agreement to automatically receive updated meteorological data every hour, including temperature, humidity, wind speed, precipitation probability, etc. These data are crucial for predicting traffic risks.
[0112] 14) Collect traffic-related dynamics through social media platforms: Set up a keyword trigger mechanism through API interfaces or web crawler technology to monitor traffic-related dynamic information in real time, such as road closures, traffic accidents, emergencies, etc. The keyword list needs to be updated regularly to capture the latest traffic hot words.
[0113] Of course, in practical applications, the method of acquiring multi-source data is not limited to the above, and this embodiment will not elaborate on them one by one.
[0114] 2) Data extraction (Extract), using ETL tools to extract the required data from various data sources. For video data, use computer vision technology to identify and extract key frames; for structured data, such as accident records and meteorological data, obtain them through API calls or database queries; for social media data, use crawler technology to capture keyword-related posts and comments.
[0115] Of course, in practical applications, the method of extracting required data is not limited to the above, and this embodiment will not go into details one by one.
[0116] 3) Data transformation (Transform), including:
[0117] Data cleaning: Remove outliers, duplicate data, and irrelevant information, fill in missing values, and ensure data quality and integrity. For example, use interpolation or statistical methods to fill in missing values.
[0118] Data fusion: Match and integrate data from different sources according to time and space coordinates to form a unified data view. For example, match the location of an accident with the geographic location of meteorological data to analyze the impact of weather conditions on the accident.
[0119] Data format unification: All data is converted into a unified format to facilitate subsequent processing and analysis. For example, all timestamps are converted to UTC standard time, and all geographic location information is converted to latitude and longitude coordinates.
[0120] 4) Data loading: storing the data in a unified format into the database for subsequent data preprocessing and analysis.
[0121] Optionally, the storage method can adopt a tiered storage strategy, storing frequently accessed data on high-performance storage devices and infrequently accessed historical data on lower-cost storage media to optimize storage costs and access efficiency.
[0122] Specific as Figure 2 As shown, Figure 2 A schematic diagram of data collection and integration provided by an embodiment of the present invention. Figure 2 As shown, including:
[0123] Step 201: Start data collection.
[0124] Step 202: Select a data source.
[0125] In this step, you can select data sources such as city monitoring, historical accidents, weather forecasts, and social media.
[0126] Step 203: Determine the data source collection method.
[0127] After selecting the data source, data can be collected through urban traffic surveillance cameras, historical accident databases of traffic management departments, real-time weather forecasts from meteorological stations, special event announcements on social media on social platforms, etc., and the data source can be determined based on the collected data.
[0128] Step 204: Real-time acquisition strategy.
[0129] In this step, data is collected in real time based on the collection method of the determined data source.
[0130] Step 205: Data extraction and conversion, which may specifically include:
[0131] Data cleaning: remove duplications and outliers, that is, remove outliers, duplicate data, and irrelevant information, fill in missing values, and ensure data quality and integrity.
[0132] Unified format: Convert all cleaned data into a unified format, such as JSON, to facilitate subsequent processing and analysis.
[0133] Timestamp standardization can convert the timestamps of all data after data cleaning to UTC standard time, and convert all geographic location information to latitude and longitude coordinates, for example, setting ISO 8601 timestamps, etc.
[0134] Step 206: Data loading.
[0135] In this step, the extracted and converted data is loaded into a data warehouse or database for subsequent data preprocessing and analysis.
[0136] Step 207: End.
[0137] In step 102, the multi-source data is preprocessed to obtain standardized data.
[0138] In this step, preprocessing includes: detecting and removing outliers and duplicate data, filling missing values, reducing the impact of noise on subsequent analysis, normalizing or standardizing numerical data, and ensuring that data of different scales are compared at the same level. Split the continuous time series data into sliding windows of fixed length to prepare for model input.
[0139] In step 103, based on the trained spatiotemporal sequence deep learning model, traffic risk prediction is performed on the standardized data to obtain the traffic risk probability of each road in the target city in the future time period, wherein the spatiotemporal sequence deep learning model includes a concatenated convolutional neural network CNN model and a long short-term memory network LSTM model, the CNN model is used for extracting spatial feature vectors, and the LSTM model is used for extracting time series feature vectors and sequence learning.
[0140] This step specifically includes:
[0141] 1) Determine the spatial feature vector of the standardized data based on the convolutional neural network (CNN) in the spatiotemporal sequence deep learning model.
[0142] In this step, the standardized data is divided into multiple grids according to each road area; the traffic flow data and accident hotspot data of each grid are obtained and sorted into traffic data according to the time series; the sorted traffic data of each grid is input into the convolutional neural network CNN, and the spatial feature vector corresponding to each network is obtained through pixel conversion, convolution operation, nonlinear transformation and maximum pooling in sequence.
[0143] 2) Determine the time series feature vector of the standardized data based on the long short-term memory network LSTM in the spatiotemporal sequence deep learning model.
[0144] In this step, the time series corresponding to the spatial feature vector in each time step in the standardized data is extracted; the extracted spatial feature vector is input into the long short-term memory network LSTM according to the time series, the law and dependency of the evolution of traffic conditions with the time series are learned, and the time series feature vector corresponding to the spatial feature vector is obtained.
[0145] 3) fusing the spatial feature vector and the time series feature vector in chronological order to obtain a spatiotemporal feature vector;
[0146] Wherein, step 1) to step 3) are as follows Figure 3 As shown, Figure 3 A flow chart of extracting spatiotemporal feature vectors provided by an embodiment of the present invention. Figure 3 Steps 302 to 307 are the process of extracting spatial features, and steps 308 and 311 are the process of extracting temporal features, which specifically include:
[0147] Step 301: Start feature extraction.
[0148] Step 302: spatial feature extraction.
[0149] Step 303: Data preparation.
[0150] In this step, the study area (such as the main street areas of the target city, etc.) is divided into (N\timesN) grids, assuming that each grid is (1\km\times 1\km).
[0151] Step 304: Grid division.
[0152] In this step, the main roads of the target city are divided into a series of grids, each grid is (1km\times1km), covering the main roads and important areas of the entire target city. After that, detailed traffic flow data and accident records are collected from multiple data sources, including: the number of vehicles passing through each grid per hour, the use of crosswalks in a specific time period, bicycle and motorcycle flow statistics, traffic accident reports that occurred in each grid in the past five years, etc., and these data are organized into a time series format to reflect the changes in traffic conditions over time.
[0153] Step 305: Collect traffic flow and accident data.
[0154] In this step, the traffic flow and accident hotspot data of each grid are obtained from the historical database and organized into a time series form.
[0155] Step 306: Apply to CNN. That is, input traffic flow and accident data into CNN. Specifically include:
[0156] Input layer: The traffic data of each grid is converted into a (32\times 32) pixel image, and each pixel value represents the traffic density or accident frequency at a specific time point. For example, a high pixel value may mean heavy traffic or frequent accidents.
[0157] Convolutional layer: The first layer of CNN uses (3\times 3) filters for convolution operation, with stride and padding of 1 to keep the image size unchanged. The subsequent two layers use (5\times 5) and (7\times 7) filters respectively, with the same stride and padding to extract more complex local features.
[0158] Activation function: The ReLU activation function is applied after each layer to introduce nonlinear transformations, enabling the model to learn more complex patterns.
[0159] Pooling layer: A (2\times 2) maximum pooling layer with a stride of 2 is added after each convolution operation to effectively reduce the spatial dimension while retaining key features.
[0160] Output layer: Finally, each grid generates a feature vector with dimension (d), for example (d = 128), which is used to highly summarize the spatial features.
[0161] Step 307: Generate a spatial feature vector.
[0162] Step 308: Time feature extraction, that is, time series feature extraction.
[0163] Step 309: LSTM processing.
[0164] In this step, time feature extraction can be performed based on the long short-term memory network (LSTM). Specifically, it includes:
[0165] Input layer: Receives a sequence of (T) time steps, each of which contains the feature vectors of all (N^2) grids, which is the output of the CNN.
[0166] LSTM layer: A bidirectional LSTM structure is used, and the number of hidden layer units in each direction is (h), for example (h = 256), which helps capture the forward and reverse time dependencies and enhances the model's understanding of time series.
[0167] Step 310: Input time series data.
[0168] Integrating time series data: The feature vectors extracted by CNN are input into LSTM in chronological order, which enables the model to learn the evolution of traffic conditions over time, especially long-term dependencies, which is crucial for predicting future traffic risks.
[0169] Step 311: Extract time series features.
[0170] Typically, CNN and LSTM work serially, where CNN first processes spatial data and extracts spatial features, and then these features are input into LSTM as a sequence, which further processes the time series properties of these features.
[0171] Step 312: Fusion of spatial features and temporal features.
[0172] In this step, the spatial feature vector and the time series feature vector are fused in time order to obtain a spatiotemporal feature vector.
[0173] Step 313: End feature extraction.
[0174] 4) Passing the spatiotemporal feature vector through one or more fully connected layers, mapping the spatiotemporal feature vector to the risk prediction task, and obtaining the traffic risk probability of each road in the target city in the future time period.
[0175] In this step, the fused spatiotemporal features are input into one or more fully connected layers (also called dense layers), which are responsible for mapping the extracted spatiotemporal feature vectors to the risk prediction task. Finally, the model outputs the risk probability of each grid area.
[0176] In an embodiment of the present invention, for spatial feature extraction: a convolutional neural network (CNN) can be used to process the input spatial data. CNN extracts spatial features through a series of convolutional layers, activation functions (such as ReLU), and pooling layers. These spatial features reflect spatial information such as traffic flow and accident frequency in different grid areas. For temporal feature extraction: the spatial feature vectors extracted by CNN can be input into a long short-term memory network (LSTM) in chronological order. LSTM can capture long-term dependencies in time series data, which is crucial for understanding the evolution of traffic conditions over time. For spatiotemporal feature fusion: the outputs of CNN and LSTM are fused to form a comprehensive spatiotemporal feature representation. This fusion can be achieved in a variety of ways, such as merging feature vectors through a connection operation, or designing a more complex structure to interactively integrate spatial features and temporal features. Risk prediction: The fused spatiotemporal features are input into one or more fully connected layers (also called dense layers), which are responsible for mapping the extracted features to the risk prediction task. Finally, the model outputs the risk probability of each grid area.
[0177] In an embodiment of the present invention, multi-source data of each road in the target city to be predicted is obtained, and the multi-source data is preprocessed to obtain standardized data; based on the trained spatiotemporal sequence deep learning model, the standardized data is subjected to traffic risk prediction to obtain the traffic risk probability of each road in the target city in the future time period, wherein the spatiotemporal sequence deep learning model includes a concatenated convolutional neural network CNN model and a long short-term memory network LSTM model, the CNN model is used for the extraction of spatial feature vectors, and the LSTM model is used for the extraction of time series feature vectors and sequence learning. That is to say, in an embodiment of the present invention, the obtained multi-source data is preprocessed to enhance the generalization ability and adaptability of the model, and based on the trained spatiotemporal sequence deep learning model, the standardized data is subjected to traffic risk prediction, which can automatically learn complex patterns from a large amount of spatiotemporal data, improve the accuracy of risk prediction, and bring convenience to urban traffic management.
[0178] Optionally, in another embodiment, based on the above embodiment, after fusing the spatial feature vector and the time series feature vector in chronological order to obtain the spatiotemporal feature vector, this embodiment may also include: determining the correlation between the spatiotemporal feature vector of each grid and the roads of the target city to be predicted in each time step; using the attention mechanism to calculate the similarity between the query vector and the key vector through a dot product operation; converting the similarity into an attention weight through a softmax function; multiplying the spatiotemporal feature vector of each time step and each grid by the corresponding attention weight; and summing all weighted spatiotemporal feature vectors to obtain an optimized spatiotemporal feature vector.
[0179] That is, in the embodiment of the present invention, the use of the attention mechanism is a further optimization of the spatiotemporal features, which is part of the deep learning model, especially in the post-processing stage of the model. The attention mechanism enhances the model's attention to important features by calculating the relevance of the feature vector of each time step and each grid to the current prediction task. This mechanism allows the model to dynamically focus on the most critical information for the prediction task, thereby improving the accuracy of the prediction.
[0180] The embodiment of the present invention provides a more efficient and accurate spatiotemporal sequence deep learning model, which pays special attention to the accuracy of real-time traffic risk prediction and the generalization ability of the model, while taking into account data fusion and capturing spatiotemporal correlation.
[0181] After the model is trained, the attention mechanism can help the model better understand which features are most critical for risk prediction, and by weighting the feature vectors, the model's performance can be further improved. This approach not only optimizes feature representation, but also improves the model's ability to understand complex data patterns, especially when dealing with high-dimensional spatiotemporal data.
[0182] In this way, the model can more accurately convert risk probabilities into risk categories, providing stronger support for the final decision.
[0183] Afterwards, integration and prediction are performed based on the optimized spatiotemporal feature vectors.
[0184] That is to say, the weighted feature vector is sent to the fully connected layer, and the prediction performance of the model is evaluated using indicators such as MAE, RMSE, and MAPE. The model structure or hyperparameters are adjusted according to the evaluation results, and multiple rounds of iterations are performed until the performance meets the requirements.
[0185] Optionally, in another embodiment, based on the above embodiment, the method may also include: according to a set risk threshold, converting the traffic risk probability of each road in the target city in a future time period into a corresponding traffic risk category, wherein the traffic risk category includes high traffic risk or low traffic risk.
[0186] That is, after the model outputs the risk probability of each grid area, post-processing can also be performed, that is, the continuous risk probability is converted into discrete risk categories (such as high risk and low risk) according to the preset risk threshold.
[0187] That is to say, the prediction output of the model is a continuous risk probability value. In order to convert these continuous values into discrete risk categories (such as high risk and low risk), it is necessary to set a risk threshold, which is represented by θ in this embodiment.
[0188] Specifically, the predicted risk probability can be converted into risk category using the following method:
[0189]
[0190] Among them, Riski is the risk category of the i-th grid, 1 represents high risk, and 0 represents low risk. y^i is the risk probability of the i-th grid predicted by the model, and θ is the preset risk threshold, which can be set according to the actual situation and safety standards.
[0191] For example, if the prediction target is the traffic risk probability of each grid in the future, the fully connected layer will output a probability distribution in which each element corresponds to the risk probability of a grid. The prediction formula can be expressed as:
[0192] [\hat{y}=f(X;W,b)]
[0193] Where (\hat{y}) is the predicted output, (X) is the input feature vector, (f) is the prediction function of the model, (W) and (b) are the weight matrix and bias term respectively.
[0194] In deep learning, (f) is usually a complex nonlinear function consisting of multiple layers of neural networks. Performance Evaluation The prediction performance is evaluated by comparing the predicted output of the model (\hat{y}) with the actual observed value (y).
[0195] Commonly used evaluation metrics include mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE).
[0196] Mean Absolute Error (MAE): measures the average absolute difference between the predicted value and the true value.
[0197] The formula is: [\text{MAE}=\frac{1}{N}\sum_{i=1}^{N}|y_i-\hat{y}_i|]
[0198] Root mean square error (RMSE): The square root of the square of the average prediction error is taken to emphasize larger errors. The formula is:
[0199] [\text{RMSE}=\sqrt{\frac{1}{N}\sum_{i=1}^{N}(y_i-\hat{y}_i)^2}]
[0200] Mean Absolute Percentage Error (MAPE): Measures the average percentage of the forecast error to the true value, which is suitable for comparing the forecast accuracy of data of different magnitudes.
[0201] The formula is: [\text{MAPE}=\frac{100%}{N}\sum_{i=1}^{N}\left|\frac{y_i-
[0202] \hat{y}_i}{y_i}\right|
[0203] The prediction output (\hat{y}) of the risk model is a probability distribution, where each element (\hat{y}_i) represents the risk probability of grid (i).
[0204] In practical applications, it is usually necessary to set a threshold (\theta). When the predicted risk probability exceeds the threshold, the area is considered to be high risk.
[0205] For example: [\text{Risk}_{i}=\begin{cases}1&\text{if}\hat{y}_i>\theta\0&
[0206] \text{otherwise}\end{cases}]
[0207] Here (\theta) can be set according to actual needs and safety standards, such as 0.5 or higher, to filter out lower-risk alerts and concentrate resources on truly high-risk areas.
[0208] Through the above steps, the deep learning model can effectively predict traffic risks, provide decision-making support for traffic management departments, optimize resource allocation, and improve the safety and efficiency of urban traffic.
[0209] Prediction and result generation
[0210] The preprocessed latest data is input into the trained model to perform real-time or near real-time traffic risk prediction.
[0211] The model outputs the traffic risk probability of each grid area within a specific time period, and the output format can be customized as required, such as heat maps, tables, etc.
[0212] Optionally, in another embodiment, based on the above embodiment, the method may further include: visually displaying the traffic risk probabilities of each road in the target city in a future time period.
[0213] In this step, the forecast results are displayed through GIS maps or other visualization tools to intuitively present the traffic risk level of each area. An interpretable report can also be generated to analyze the key factors behind the forecast results, such as special weather conditions, holiday effects, etc., to help decision makers understand the forecast logic.
[0214] Optionally, in another embodiment, based on the above embodiment, the method may further include: model evaluation and updating. That is, the prediction performance of the model is evaluated regularly using an independent test set, including indicators such as accuracy, recall, and F1 score. Based on the evaluation results and actual application feedback, the model parameters are updated regularly, or the model is retrained when necessary to adapt to changes in data distribution and emerging traffic patterns.
[0215] Through the above detailed steps, the embodiment of the present invention realizes the full process automation from data collection to prediction result output, and provides accurate and real-time traffic risk prediction services for urban traffic management departments.
[0216] Optionally, in another embodiment, based on the above embodiment, the method may also include: pre-training the spatiotemporal sequence deep learning model in the following manner: acquiring a data set; preprocessing the data set; dividing the preprocessed data set into a training set and a validation set; inputting the training set into a pre-built spatiotemporal sequence deep learning model for training; during the training process, extracting the spatiotemporal feature vector of the training set, and mapping the spatiotemporal feature vector to the risk prediction task to obtain a predicted traffic risk probability; and comparing the predicted traffic risk probability with the traffic risk probability evaluated based on the validation set, calculating a loss value based on the comparison result, and based on the loss value, updating the parameters of the spatiotemporal sequence deep learning model through a back propagation mechanism, and after multiple iterations, until the spatiotemporal sequence deep learning model converges, a trained spatiotemporal sequence deep learning model is obtained.
[0217] In this embodiment, the training process of the spatiotemporal sequence deep learning model is as follows: Figure 4 As shown, Figure 4 A flowchart of a training process for a spatiotemporal sequence deep learning model provided by an embodiment of the present invention specifically includes:
[0218] Step 401: Start model training.
[0219] Among them, the model in this embodiment refers to a spatiotemporal sequence deep learning model.
[0220] Step 402: Model architecture construction.
[0221] In this step, a model architecture including CNN and LSTM is designed. The CNN part is responsible for spatial feature extraction, and the LSTM part is responsible for temporal feature extraction and sequence learning.
[0222] Step 403: Integrate CNN and LSTM.
[0223] CNN and LSTM are serially integrated to form an end-to-end spatiotemporal sequence deep learning model.
[0224] Step 404: data preparation;
[0225] Collect data and preprocess the data, including data cleaning and normalization.
[0226] Step 405: Divide the data.
[0227] In this step, the data is divided into training set, validation set and test set.
[0228] Step 406: Model training.
[0229] In this step, you can use the training set data to train the model, select an appropriate loss function (such as cross entropy or mean squared error), and use an optimizer (such as Adam) to update the model weights.
[0230] Step 407: Evaluate model performance.
[0231] Evaluate the performance of the model on the validation set using metrics such as MAE, RMSE, and MAPE. Adjust the model structure or hyperparameters based on performance feedback.
[0232] Early stopping strategy: Set early stopping conditions. If the model performance does not improve significantly in multiple consecutive iterations, stop training to avoid overfitting.
[0233] Step 408: Determine whether the model performance is satisfactory, if not, execute step 409; if yes, execute step 410.
[0234] Step 409: Adjust the model structure or model parameters or hyperparameters.
[0235] That is, model tuning requires multiple rounds of iterations. After adjusting the model structure or hyperparameters, the process returns to step 406 to continue model training until satisfactory performance is achieved on the validation set.
[0236] Final evaluation: Evaluate the trained model on the test set to ensure that the model has good generalization ability.
[0237] Step 410: Finish and deploy the model, and obtain the trained model.
[0238] When the model reaches the predetermined performance index on the validation set and the performance on the test set is also satisfactory, the model training can be considered complete.
[0239] In the embodiment of the present invention, multi-source data fusion is proposed, and an efficient data fusion strategy is proposed, which can process multi-source heterogeneous data and improve information utilization efficiency. It can capture spatiotemporal correlation: adopt the CNN-LSTM combined model (i.e., spatiotemporal sequence deep learning model) to enhance the capture of spatial proximity and time series dependency and improve prediction accuracy. Real-time prediction and model generalization: optimize the model structure to ensure good real-time response capability and adaptability to new environments while maintaining high prediction accuracy.
[0240] In the embodiments of the present invention, data fusion capability: the data fusion strategy of the present invention significantly improves the efficiency of information utilization and provides a more comprehensive data foundation for the prediction model. Capture of spatiotemporal correlation: the CNN-LSTM combined model can more accurately capture spatiotemporal correlation, improving the accuracy and stability of the prediction. Real-time and generalization capability: the optimized model structure and algorithm design ensure the high efficiency of real-time prediction, while the generalization capability in the new environment is enhanced. Through the above technical means, the present invention has made significant progress in the field of urban traffic risk prediction and has made important contributions to the development of intelligent transportation systems.
[0241] In the embodiments of the present invention, traffic congestion and accident-prone areas are predicted in advance to provide data support for urban traffic planning, optimize road layout and traffic signal control. During special weather conditions or large-scale events, potential traffic risks are quickly predicted to guide the rational allocation of emergency resources. Insurance companies and other corporate units can use the traffic risk information predicted by this system to conduct risk assessment and dynamic adjustment of insurance premiums. Combined with navigation software, it provides users with route suggestions to avoid high-risk areas, improving travel safety and efficiency.
[0242] It should be noted that, for the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that this implementation disclosure is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the present invention.
[0243] See also Figure 5 , is a block diagram of a device for predicting urban road traffic risks provided by an embodiment of the present invention, the device comprising: a first acquisition module 501, a first preprocessing module 502 and a prediction module 503, wherein,
[0244] The first acquisition module 501 is used to acquire multi-source data of various roads in the target city to be predicted;
[0245] A first preprocessing module 502, used to preprocess the multi-source data to obtain standardized data;
[0246] The prediction module 503 is used to perform traffic risk prediction on the standardized data based on the trained spatiotemporal sequence deep learning model to obtain the traffic risk probability of each road in the target city in the future time period, wherein the spatiotemporal sequence deep learning model includes a concatenated convolutional neural network CNN model and a long short-term memory network LSTM model, the CNN model is used for extracting spatial feature vectors, and the LSTM model is used for extracting time series feature vectors and sequence learning.
[0247] Optionally, in another embodiment, based on the above embodiment, the device further includes: a first conversion module 601, whose structural block diagram is as follows: Figure 6 As shown,
[0248] The first conversion module 601 is used to convert the traffic risk probability of each road in the target city in the future time period into a corresponding traffic risk category according to a set risk threshold, and the traffic risk category includes high traffic risk or low traffic risk.
[0249] Optionally, in another embodiment, based on the above embodiment, the device further includes: a visualization module, wherein:
[0250] The visualization module is used to visualize the traffic risk probabilities of various roads in the target city in the future time period.
[0251] Optionally, in another embodiment, based on the above embodiment, the prediction module 503 includes: a first determination module 701, a second determination module 702, a fusion module 703 and a mapping module 704, and its structural block diagram is as follows: Figure 7 As shown,
[0252] A first determination module 701 is used to determine the spatial feature vector of the standardized data based on a convolutional neural network (CNN) in the spatiotemporal sequence deep learning model; and
[0253] A second determination module 702 is used to determine the time series feature vector of the standardized data based on the long short-term memory network LSTM in the spatiotemporal sequence deep learning model;
[0254] A fusion module 703 is used to fuse the spatial feature vector and the time series feature vector in time order to obtain a spatiotemporal feature vector;
[0255] The mapping module 704 is used to map the spatiotemporal feature vector to the risk prediction task through one or more fully connected layers to obtain the traffic risk probability of each road in the target city in the future time period.
[0256] Optionally, in another embodiment, based on the above embodiment, the first determining module includes:
[0257] A first division module, used for dividing the standardized data into a plurality of grids according to each road area;
[0258] The second acquisition module acquires the traffic flow data and accident hotspot data of each grid and organizes them into traffic data according to the time series;
[0259] The first processing module is used to input the traffic data sorted by each grid into the convolutional neural network CNN, and obtain the spatial feature vector corresponding to each network through pixel conversion, convolution operation, nonlinear transformation and maximum pooling in sequence.
[0260] Optionally, in another embodiment, based on the above embodiment, the second determining module includes:
[0261] A second extraction module is used to extract the time series corresponding to the spatial feature vector in each time step in the standardized data;
[0262] The second processing module is used to input the extracted spatial feature vector into the long short-term memory network LSTM according to the time series, learn the evolution law and dependency of traffic conditions with the time series, and obtain the time series feature vector corresponding to the spatial feature vector.
[0263] Optionally, in another embodiment, based on the above embodiment, the prediction module further includes:
[0264] A correlation determination module, used to determine the correlation between the spatiotemporal feature vector of each grid and each road of the target city to be predicted in each time step after the fusion module fuses the spatial feature vector and the time series feature vector in time order to obtain the spatiotemporal feature vector;
[0265] A similarity determination module, for calculating the similarity between the query vector and the key vector through a dot product operation using an attention mechanism;
[0266] A second conversion module, used for converting the similarity into an attention weight through a softmax function;
[0267] A weighting module is used to multiply the spatiotemporal feature vector of each time step and each grid by the corresponding attention weight;
[0268] The summation module is used to sum all weighted spatiotemporal feature vectors to obtain an optimized spatiotemporal feature vector.
[0269] Optionally, in another embodiment, based on the above embodiment, the device includes: a training module for pre-training the spatiotemporal sequence deep learning model.
[0270] Optionally, in another embodiment, based on the above embodiment, the training module includes:
[0271] A third acquisition module is used to acquire a data set;
[0272] A second preprocessing module, used for preprocessing the data set;
[0273] A second division module, used to divide the data set preprocessed by the second preprocessing module into a training set and a validation set;
[0274] The model training module is used to input the training set into a pre-built spatiotemporal sequence deep learning model for training; during the training process, the spatiotemporal feature vector of the training set is extracted, and the spatiotemporal feature vector is mapped to the risk prediction task to obtain a predicted traffic risk probability; and the predicted traffic risk probability is compared with the traffic risk probability evaluated based on the validation set, and a loss value is calculated according to the comparison result. Based on the loss value, the parameters of the spatiotemporal sequence deep learning model are updated through a back propagation mechanism, and after multiple iterations, the spatiotemporal sequence deep learning model converges to obtain a trained spatiotemporal sequence deep learning model.
[0275] Optionally, an embodiment of the present invention further provides an electronic device, including:
[0276] processor;
[0277] a memory for storing instructions executable by the processor;
[0278] Wherein, the processor is configured to execute the instructions to implement the urban road traffic risk prediction method as described above.
[0279] Optionally, an embodiment of the present invention further provides a computer-readable storage medium, which, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to execute the urban road traffic risk prediction method as described above.
[0280] Optionally, an embodiment of the present invention further provides a computer program product, including a computer program or instructions, which, when executed by a processor of an electronic device, implements the urban road traffic risk prediction method as described above.
[0281] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0282] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0283] Figure 8 800 is a block diagram of an electronic device 800 provided in an embodiment of the present invention. For example, the electronic device 800 may be a mobile terminal or a server, and the electronic device is a mobile terminal as an example for explanation in the embodiment of the present invention. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a message transceiver device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0284] Reference Figure 8 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0285] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0286] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0287] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.
[0288] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0289] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0290] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0291] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0292] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0293] In an embodiment, the electronic device 800 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the urban road traffic risk prediction method shown above.
[0294] In an embodiment, a computer-readable storage medium is also provided, and when the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device 800 can execute the urban road traffic risk prediction method shown above. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0295] In an embodiment, a computer program product is also provided, including a computer program or instructions. When the computer program or instructions are executed by the processor 820 of the electronic device 800, the electronic device 800 executes the above-mentioned urban road traffic risk prediction method.
[0296] Fig. 9 is a block diagram of a device 900 for predicting urban road traffic risks provided by an embodiment of the present invention. For example, the device 900 may be provided as a server. Fig. 9 , the apparatus 900 includes a processing component 922, which further includes one or more processors, and a memory resource represented by a memory 932 for storing instructions, such as an application, that can be executed by the processing component 922. The application stored in the memory 932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 922 is configured to execute the instructions to perform the above method.
[0297] The device 900 may also include a power supply component 926 configured to perform power management of the device 900, a wired or wireless network interface 950 configured to connect the device 900 to a network, and an input / output (I / O) interface 958. The device 900 may operate based on an operating system stored in the memory 932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.
[0298] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0299] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A method for predicting urban road traffic risks, characterized in that: include: Obtain multi-source data of roads in the target city to be predicted; Preprocessing the multi-source data to obtain standardized data; Based on the trained spatiotemporal sequence deep learning model, traffic risk prediction is performed on the standardized data to obtain the traffic risk probability of each road in the target city in the future time period, wherein the spatiotemporal sequence deep learning model includes a concatenated convolutional neural network CNN model and a long short-term memory network LSTM model, the CNN model is used for extracting spatial feature vectors, and the LSTM model is used for extracting time series feature vectors and sequence learning.
2. The urban road traffic risk prediction method according to claim 1, characterized in that: The method further comprises: According to the set risk threshold, the traffic risk probability of each road in the target city in the future time period is converted into a corresponding traffic risk category, and the traffic risk category includes high traffic risk or low traffic risk.
3. The urban road traffic risk prediction method according to claim 1, characterized in that: The method further comprises: The traffic risk probabilities of various roads in the target city in the future time period are visualized.
4. The urban road traffic risk prediction method according to any one of claims 1 to 3, characterized in that: The traffic risk prediction is performed on the extracted standardized data based on the trained spatiotemporal sequence deep learning model to obtain the traffic risk probability of each road in the target city in the future time period, including: Determine the spatial feature vector of the standardized data based on the convolutional neural network (CNN) in the spatiotemporal sequence deep learning model; and Determine the time series feature vector of the standardized data based on the long short-term memory network LSTM in the spatiotemporal sequence deep learning model; The spatial feature vector and the time series feature vector are fused in time order to obtain a spatiotemporal feature vector; The spatiotemporal feature vector is passed through one or more fully connected layers, and the spatiotemporal feature vector is mapped to the risk prediction task to obtain the traffic risk probability of each road in the target city in the future time period.
5. The urban road traffic risk prediction method according to claim 4 is characterized in that: Determining the spatial feature vector of the standardized data based on the convolutional neural network (CNN) in the spatiotemporal sequence deep learning model includes: Dividing the standardized data into a plurality of grids according to each road area; Obtain traffic flow data and accident hotspot data for each grid, and organize them into traffic data in time series; The traffic data of each grid is input into the convolutional neural network (CNN), and the spatial feature vector corresponding to each network is obtained through pixel conversion, convolution operation, nonlinear transformation and maximum pooling.
6. The urban road traffic risk prediction method according to claim 4 is characterized in that: The determining of the time series feature vector of the standardized data based on the long short-term memory network LSTM in the spatiotemporal sequence deep learning model includes: Extracting a time series corresponding to the spatial feature vector in each time step in the standardized data; The extracted spatial feature vector is input into a long short-term memory network LSTM according to the time series, the law of evolution of traffic conditions with the time series and the dependency relationship are learned, and a time series feature vector corresponding to the spatial feature vector is obtained.
7. The urban road traffic risk prediction method according to claim 4 is characterized in that: After fusing the spatial feature vector and the time series feature vector in time order to obtain the spatiotemporal feature vector, the method further includes: Determine the correlation between the spatiotemporal feature vector of each grid and each road of the target city to be predicted in each time step; Using the attention mechanism, the similarity between the query vector and the key vector is calculated through the dot product operation; Convert the similarity into attention weight through a softmax function; Multiply the spatiotemporal feature vector of each time step and each grid by the corresponding attention weight; All weighted spatiotemporal feature vectors are summed to obtain the optimized spatiotemporal feature vector.
8. The urban road traffic risk prediction method according to any one of claims 1 to 3, characterized in that: The method comprises: pre-training the spatiotemporal sequence deep learning model in the following manner: Get the dataset; Preprocessing the data set; Divide the preprocessed data set into training set and validation set; The training set is input into a pre-built spatiotemporal sequence deep learning model for training; during the training process, the spatiotemporal feature vector of the training set is extracted, and the spatiotemporal feature vector is mapped to the risk prediction task to obtain a predicted traffic risk probability; the predicted traffic risk probability is compared with the traffic risk probability evaluated based on the validation set, and a loss value is calculated according to the comparison result; based on the loss value, the parameters of the spatiotemporal sequence deep learning model are updated through a back propagation mechanism, and after multiple iterations, until the spatiotemporal sequence deep learning model converges, a trained spatiotemporal sequence deep learning model is obtained.
9. An urban road traffic risk prediction device, characterized in that: include: The first acquisition module is used to acquire multi-source data of various roads in the target city to be predicted; A first preprocessing module, used for preprocessing the multi-source data to obtain standardized data; The prediction module is used to perform traffic risk prediction on the standardized data based on the trained spatiotemporal sequence deep learning model to obtain the traffic risk probability of each road in the target city in the future time period, wherein the spatiotemporal sequence deep learning model includes a concatenated convolutional neural network CNN model and a long short-term memory network LSTM model, the CNN model is used for extracting spatial feature vectors, and the LSTM model is used for extracting time series feature vectors and sequence learning.
10. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; Wherein, the processor is configured to execute the instructions to implement the urban road traffic risk prediction method as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the urban road traffic risk prediction method as described in any one of claims 1 to 8.
Citation Information
Cited By
Ship weather risk and congestion probability prediction method based on multi-source data
CN120277393A
Snow layer stability monitoring method and system
CN120403773A
Snow layer stability monitoring method and system
CN120403773B
Highway area risk intelligent early warning method and system based on space-time coupling model
CN120472694A
Time series data acquisition method, system and equipment based on large model and medium
CN120632289A