A spatio-temporal graph convolution traffic prediction method and system
By using a traffic prediction system based on spatiotemporal graph convolution, combined with a safety rule knowledge base and adversarial safety detection, and dynamically adjusting the safety threshold, the problem of prediction results violating safety rules under extreme traffic events is solved, achieving a balance between safety and accuracy.
Patent Information
- Application Number
- CN202511272639.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-09-08
AI Technical Summary
Existing traffic prediction methods may produce predictions that violate safety rules under extreme traffic events, lack the ability to generalize to extreme situations, cannot dynamically adjust safety thresholds, and have difficulty identifying prediction schemes that are "technically reasonable but actually unsafe".
A traffic prediction system based on spatiotemporal graph convolution is constructed. A safety rule knowledge base is established by acquiring traffic data, an adversarial example generator and a safety boundary detector are designed, adversarial security detection and progressive security stress testing are implemented, the safety threshold is dynamically adjusted, and prediction results with enhanced security verification are generated.
It improves the safety and reliability of traffic forecasting, can proactively identify potential safety risks, ensure that forecast results comply with safety regulations, dynamically adjust safety thresholds to adapt to different traffic conditions, and maintain a balance between forecast accuracy and safety.
Smart Images

Figure CN120748213B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent traffic prediction, more particularly, it relates to a traffic prediction method and system based on spatio-temporal graph convolution. BACKGROUND
[0002] With the wide application of intelligent transportation systems, traffic prediction methods based on spatio-temporal graph convolution have become an important tool for optimizing traffic management and planning. Existing traffic prediction methods mainly focus on improving prediction accuracy under normal traffic conditions, but when facing extreme traffic events (such as major accidents, severe weather, large-scale activities, etc.), these prediction methods may produce technically reasonable but actually unsafe prediction results. For example, the predicted traffic density may exceed the safety threshold, or the recommended speed may exceed the safety limit under certain conditions.
[0003] The existing technology has the following problems:
[0004] Under extreme traffic events, the prediction model may produce prediction results that violate traffic safety rules, because there are few extreme case samples in the training data, resulting in insufficient generalization ability of the model for such cases; traditional safety verification methods lack systematic detection ability for boundary conditions, these methods can only verify known test scenarios, and cannot actively find potential safety risk points; existing technology is difficult to distinguish between "technically reasonable" but "actually unsafe" prediction schemes, for example, some prediction results perform well on mathematical models, but may ignore physical constraints and safety requirements in the actual traffic system; lack of mechanism for dynamically adjusting safety constraints, under different traffic states, the safety threshold should be different, but existing methods often use static safety standards.
[0005] In summary, the present application aims to solve the above technical problems by constructing a traffic prediction method that integrates safety rule knowledge and adversarial safety detection, ensuring that even in extreme traffic situations, prediction results that comply with safety specifications can be generated. SUMMARY
[0006] The present application provides a traffic prediction method and system based on spatio-temporal graph convolution, which solves the technical problem of possible prediction results that violate safety rules under extreme traffic events in related technologies.
[0007] The present application provides a traffic prediction method based on spatio-temporal graph convolution, comprising:
[0008] Obtain traffic data and establish a safety rule knowledge base, encode traffic safety specifications into structured safety rules;
[0009] Process historical traffic data and design an adversarial sample generator;
[0010] The established safety rules and the generated adversarial samples are analyzed, and a safety boundary detector is trained to identify potential safety rule violations in the prediction results;
[0011] Adversarial safety probing is performed using the generated adversarial samples and the trained safety boundary detector;
[0012] Progressive safety stress testing is implemented based on the results of adversarial safety probing;
[0013] Real-time safety protection layers are deployed based on the results of adversarial safety probing and progressive safety stress testing;
[0014] The operation data of the real-time safety protection layers are analyzed to build an adaptive safety constraint mechanism, which dynamically adjusts safety thresholds and correction strategies;
[0015] The original prediction results are fused with the built safety constraints to generate safety-verified and enhanced prediction results.
[0016] Further, the traffic data is preprocessed after being obtained, including data cleaning, time alignment, feature standardization, encoding processing, and spatiotemporal feature extraction.
[0017] Further, the rules in the safety rule knowledge base are represented as constraint conditions, each of which contains a safety rule identifier, a traffic state parameter, and a prediction parameter. By evaluating whether the traffic state and prediction parameters meet the conditions of the safety rules, a Boolean result value is returned, indicating whether the safety rule is met.
[0018] Further, the safety boundary detector adopts a deep neural network structure, receives traffic prediction results as input, and outputs the possibility scores of traffic prediction results violating each safety rule; the safety boundary detector includes an input layer, a feature extraction module, a rule evaluation module, and an output layer.
[0019] Further, the safety boundary detector adopts a graph neural network structure, representing safety rules as nodes in a graph and the dependency relationships between rules as edges. Through the transmission and aggregation of information between nodes, the cascading effect of rule violations is captured.
[0020] Further, the process of performing adversarial safety probing includes generating extreme traffic scenarios using an adversarial sample generator, inputting these scenarios into a traffic prediction model to obtain prediction results, evaluating the safety of these prediction results using a safety boundary detector, and updating the parameters of the adversarial sample generator based on the safety evaluation results.
[0021] Further, the running data needs to be pre-processed before the adaptive security constraint mechanism is constructed, and the pre-processing includes time series segmentation, outlier filtering, feature normalization, state label generation and time series feature extraction;The adaptive security constraint mechanism includes a traffic state classifier, a security parameter adjuster and an adaptive learning module.
[0022] Further, the fusion of the original prediction result and the constructed security constraint to generate a safety verification enhanced prediction result includes: obtaining the output result of the original traffic prediction model;Using a safety boundary detector to evaluate the safety of the prediction result;For the prediction result that detects safety problems, identify the violated safety rules and apply adaptive security constraints for parameter adjustment;The adjusted result is subjected to secondary safety verification;Output the final safety verification enhanced prediction result.
[0023] Further, the graph neural network structure further comprises: a node representation module for encoding each safety rule as a node in the graph;An edge representation module for encoding the dependency relationship between rules as an edge in the graph;An information transmission layer composed of a graph convolution layer, for realizing the transmission and aggregation of information between nodes;An integrated evaluation layer for fusing the state of each node and outputting an integrated safety evaluation result;Through the graph structure representation, the cascade effect of rule violation can be captured.
[0024] The application provides a kind of spatio-temporal graph convolution traffic prediction system, for executing the spatio-temporal graph convolution traffic prediction method described above, comprising:
[0025] Data processing module, for obtaining traffic data and establishing safety rule knowledge base, traffic safety specification is encoded as structured safety rule;
[0026] Adversarial sample generation module, for processing historical traffic data and designing adversarial sample generator;
[0027] Detector training module, for analyzing the established safety rules and generated adversarial samples, training safety boundary detector for identifying potential safety rule violations in prediction results;
[0028] Safety detection module, for performing adversarial safety detection using generated adversarial samples and trained safety boundary detector;
[0029] Pressure detection module, for implementing progressive safety stress test according to adversarial safety detection results;
[0030] Protection deployment module, for deploying real-time security protection layer according to the results of adversarial safety detection and progressive safety stress test;
[0031] A constraint construction module is configured to analyze operation data of the real-time security shield, construct an adaptive security constraint mechanism, and dynamically adjust a security threshold and a correction strategy;
[0032] A result fusion module is configured to fuse the original prediction result with the constructed security constraint to generate a prediction result with enhanced security verification.
[0033] The present application has the beneficial effects that the adversarial security probing mechanism combines an adversarial sample generator and a security boundary detector, can systematically explore possible security vulnerabilities of the prediction model in extreme cases, and compared with the traditional security verification method which can only verify known test scenarios, the present application can actively find potential security risk points, and fundamentally improves the safety and reliability of traffic prediction;
[0034] By establishing a security rule knowledge base and training the security boundary detector, the present embodiment can accurately distinguish between prediction results that are "technically reasonable" but "not actually safe", which solves the problem that the prior art is difficult to identify prediction schemes that violate physical constraints or safety specifications, and ensures the actual usability of the prediction result;
[0035] The adaptive security constraint mechanism can dynamically adjust the security threshold and the correction strategy according to the current traffic state, overcoming the limitations of using static security standards in traditional methods, which makes the system maintain the best safety performance in different traffic environments, while not excessively sacrificing the prediction accuracy;
[0036] By combining the progressive security stress test and the real-time security shield, the present application establishes a perfect security protection mechanism in the model training phase and the running phase, and this double protection ensures that the system can maintain basic security protection even when encountering extreme situations that have never been seen before, avoiding prediction results that may cause traffic accidents;
[0037] When generating the prediction result with enhanced security verification, the present application adopts a multi-objective optimization method to ensure safety while maintaining prediction accuracy as much as possible, which solves the problem that the traditional security correction method may cause the prediction performance to decline, and realizes a good balance between safety and performance. BRIEF DESCRIPTION OF DRAWINGS
[0038] Figure 1 is a flowchart of a spatio-temporal graph convolution traffic prediction method in the present application;
[0039] Figure 2 is a column chart comparing the detection rates of the adversarial security probing mechanism and the traditional method in detecting different types of security vulnerabilities;
[0040] Figure 3 is a combination chart comparing the accuracy of the adaptive security constraint mechanism and the traditional security correction method under different rainfall intensity conditions;
[0041] Figure 4 is a combination chart of performance indicators of the security boundary detector on different security rule types;
[0042] Figure 5 is a Sankey chart of the conversion of different types of security problems before and after security verification reinforcement. DETAILED DESCRIPTION
[0043] The subject matter described herein will now be discussed with reference to example implementations. It should be understood that discussions of these implementations are merely provided to enable those with skill in the art to better understand and thus implement the subject matter described herein, and variations of elements discussed can be made without departing from the scope of the disclosure. Various examples can omit, substitute, or add various procedures or components as appropriate, and the methods described can not necessarily be executed in any specific order, unless expressly stated otherwise. Additionally, some examples described can be performed in parallel or concurrently.
[0044] A traffic prediction method based on spatio-temporal graph convolution is disclosed in at least one embodiment of the present application, as shown in Figure 1 The method comprises the following steps:
[0045] Step 1, obtain traffic data and establish a safety rule knowledge base, encode traffic safety specifications into structured safety rules;
[0046] This step first obtains historical traffic data and real-time traffic monitoring data, and then analyzes the safety constraint relationships in these data and encodes them into a structured safety rule knowledge base. The safety rule knowledge base contains various constraint conditions that must be followed in the traffic system, which serves as the basis for judging the safety of the prediction results in the subsequent steps.
[0047] The traffic data includes road network topology data, traffic flow data, vehicle speed data, vehicle spacing data, and traffic event records, etc. These data can come from various traffic sensors, cameras, satellite navigation systems, and other traffic monitoring devices.
[0048] After obtaining the traffic data, the following data preprocessing steps are needed: data cleaning to remove outliers and handle missing values, ensuring data quality; time alignment to align data from different sensors by timestamp, ensuring data synchronization; feature standardization to standardize different dimension data such as speed and flow, making their mean value 0 and variance 1, and eliminating the influence of dimension; encoding processing to convert categorical data such as road type and traffic event type into numerical representation through One-Hot Encoding; spatio-temporal feature extraction to extract spatio-temporal features from the original traffic data, preparing for subsequent processing.
[0049] The safety rule coding algorithm includes the following steps: collecting various traffic safety norms, regulations, and physical constraints; classifying the rules into different categories such as traffic flow density rules, speed limit rules, and vehicle spacing rules; representing each rule as a formal constraint condition; establishing the relationship and priority ranking between rules; and storing the formal rules in a safety rule knowledge base.
[0050] Each security rule can be formally represented as:
[0051] ;
[0052] in, Indicates the first One security rule, Indicates traffic status. Indicates the prediction parameters. This indicates that the safety rules are met. This indicates that the security rules are not met. It represents the constraint relationship of the rule.
[0053] Furthermore, in this embodiment of the application, in order to improve the interpretability and adaptability of safety rules, the safety rule knowledge base also includes priority relationships and condition triggering mechanisms between rules, enabling the system to dynamically select applicable safety rules according to different traffic scenarios.
[0054] Step 2: Process historical traffic data and design an adversarial example generator;
[0055] This step involves designing and training an adversarial example generator by analyzing anomalies and boundary conditions in historical traffic data. The adversarial example generator can create extreme traffic scenarios that challenge the safety boundaries of the prediction model, allowing for testing of the model's safety performance under these conditions.
[0056] Before training the adversarial example generator, historical traffic data needs to be preprocessed specifically:
[0057] Abnormal scenario filtering: Filter out data samples that include unconventional traffic conditions such as traffic accidents, extreme weather, and large-scale events;
[0058] Data augmentation: Augmenting rare and extreme scenario data by generating more samples through slight transformations;
[0059] Normalization processing: The traffic scene data is normalized to the range of [-1, 1], which meets the input requirements of generative adversarial networks;
[0060] Conditional encoding: embedding conditional information such as scene category into the input data through encoding;
[0061] Noise distribution calibration: adjust noise distribution parameters according to data distribution characteristics to generate more realistic adversarial samples.
[0062] Noise parameter preprocessing: the input noise parameters of the generator are adjusted and normalized to ensure that their distribution meets the network training requirements, usually normal distribution or uniform distribution, and are normalized to the range of [-1, 1] or [0, 1]; and
[0063] Among them, the adversarial sample generator adopts the architecture of Conditional Generative Adversarial Network (CGAN), which contains a generator network and a discriminator network . The generator receives normal traffic data and random noise as input to generate simulated extreme traffic scenarios; the discriminator is responsible for distinguishing whether the generated scene meets the real traffic physical law and has challenges.
[0064] Further, the generator network is composed of the following components: a conditional encoding module that encodes normal traffic data into a latent space representation; a noise injection module that integrates random noise to introduce variability; an upsampling module composed of multiple transposed convolutional layers to gradually restore the complete traffic scene representation; a scene generation module that generates the final extreme traffic scene data.
[0065] Further, the discriminator network is composed of the following components: a feature extraction module that extracts the feature representation of the input scene through convolutional layers; a reality evaluation module composed of fully connected layers to evaluate whether the scene is real; a challenge evaluation module to evaluate the challenge degree of the scene to the prediction model; a fusion decision module that integrates the above two aspects of evaluation to output the final discrimination result.
[0066] The training objective function of the adversarial sample generator can be represented as:
[0067] ;
[0068] Among them represents the optimization target of the generator , represents the optimization target of the discriminator , represents the value function of the generator and the discriminator , represents the distribution of real traffic data, represents the distribution of noise, denotes the adversarial sample generated by the generator, denotes the discrimination result of the input by the discriminator, denotes the logarithmic function.
[0069] Further, in the embodiments of the present application, in order to enhance the pertinence of the adversarial sample, the adversarial sample generator also introduces a guidance mechanism of safety rule knowledge, which specifically includes: a rule encoding module, which converts safety rules into numerical representation; a target guiding layer, which adjusts the generation direction according to the target safety rule; and a boundary detection module, which ensures that the generated sample is within the physically reasonable range.
[0070] By adding a regularization term to the loss function of the generator, wherein the target safety rule makes the generator more inclined to generate samples that are close to violating the rule but still within the physically reasonable range.
[0071] Step 3, analyze the established safety rules and the generated adversarial samples, and train a safety boundary detector for identifying potential safety rule violation situations in the prediction results;
[0072] This step is based on the safety rule knowledge base established in step 1 and the adversarial samples generated in step 2, and trains a safety boundary detector. The safety boundary detector can identify potential safety rule violation situations in the prediction results and quantitatively evaluate the possible safety risks.
[0073] Before training the safety boundary detector, the input data needs to be preprocessed as follows:
[0074] Data balancing processing, since safety violation samples are usually less, over-sampling or synthetic minority oversampling technique (SMOTE) technology is used to balance the positive and negative sample ratio; feature engineering, extracting key features related to safety rules, constructing derived features, and enhancing the sensitivity of the model to safety boundaries; label conversion, converting safety rule violation situations into binary labels or multi-level labels for supervised learning; feature normalization, normalizing the rule violation degree of different rules to within the range of [0, 1], which is convenient for calculating the comprehensive risk score; cross-validation grouping, using stratified sampling strategy for data division to ensure that the training set and validation set contain all types of safety boundary situations.
[0075] The traffic prediction results are standardized to eliminate dimensional differences and make the evaluation results of different rules comparable;
[0076] The safety boundary detector adopts a deep neural network structure, receives the traffic prediction results as input, and outputs the possibility scores of the traffic prediction results violating each safety rule. The training data of the detector includes normal prediction results marked as "safe" and adversarial sample prediction results marked as "unsafe".
[0077] Further, the safety boundary detector is composed of the following components: the input layer is responsible for receiving traffic prediction data, including traffic flow, vehicle speed, and other prediction parameters; the feature extraction module is composed of multiple convolutional layers, which are used to extract the spatio-temporal features in the prediction results; the rule evaluation module includes multiple fully connected layers, which are used to evaluate the compliance of each safety rule; and the output layer generates a possibility score vector of violating each safety rule.
[0078] The loss function of the safety boundary detector is designed as:
[0079] ;
[0080] wherein represents the loss function, represents the summation operator, is the number of training samples, is the number of safety rules, is the weight of the th safety rule, is the binary cross-entropy loss function, is the true label (violation or non-violation) of the th sample to the th safety rule, is the prediction result of the model.
[0081] The inner function is the binary cross-entropy loss function, which is used to quantify the difference between the predicted label and the true label , and its calculation formula is:
[0082] ;
[0083] wherein represents the binary cross-entropy loss function, is the true label, is the predicted label, is the logarithmic function.
[0084] Further, in the embodiments of the present application, in order to handle the mutual dependence between security rules, the security boundary detector adopts a graph neural network structure. The graph neural network structure of the security boundary detector includes: a node representation module that encodes each security rule as a node in a graph; an edge representation module that encodes the dependence between rules as an edge in the graph; an information transmission layer composed of multiple graph convolution layers, which realizes the transmission and aggregation of information between nodes; and a comprehensive evaluation layer that fuses the states of each node to output a comprehensive security evaluation result.
[0085] Through this graph structure representation, the detector can capture the cascading effect of rule violations and improve the accuracy of security evaluation.
[0086] Step 4, using the generated adversarial samples and the trained security boundary detector to perform adversarial security probing;
[0087] This step combines the adversarial sample generator in step 2 and the security boundary detector in step 3 to systematically explore the boundary conditions in which the prediction model may violate security rules and build an adversarial security probing mechanism.
[0088] As Figure 2 shown, the adversarial security probing mechanism of the present embodiment has advantages over traditional security verification methods in detecting different types of security vulnerabilities. The detection rates of traditional methods in traffic volume over-limit, vehicle speed over-limit, missing road condition information, mismatch between road conditions and rainfall, and composite security risks are 56.1%, 59.7%, 27.9%, 21.1%, and 31.1%, respectively, with an average of only 42.0%; while the detection rates of the present embodiment in these aspects are 93.0%, 93.5%, 90.7%, 84.2%, and 91.1%, respectively, with an average of 91.0%, significantly improving the detection capability of security vulnerabilities.
[0089] The adversarial security probing algorithm includes the following steps: using the adversarial sample generator to generate a batch of potential extreme traffic scenarios; inputting these scenarios into the traffic prediction model to be evaluated to obtain the prediction results; using the security boundary detector to evaluate the safety of these prediction results; based on the safety evaluation results, updating the parameters of the adversarial sample generator to guide it to generate more challenging samples; repeating until enough security boundary conditions are found or the preset number of iterations is reached; classifying and statistically analyzing the discovered security boundary conditions; generating a security boundary report including risk point distribution and severity assessment.
[0090] The probing process can be formally represented as an optimization problem:
[0091] ;
[0092] where represents the maximization operation, is a noise space, is an adversarial sample generator, is a traffic prediction model to be evaluated, is an unsafety score given by a safety boundary detector.
[0093] inner function represents a generation process that maps noise to traffic scene data, generator outputs as input of a traffic prediction model , while represents a process of making predictions on the generated traffic scene, the prediction result generated by the traffic prediction model is evaluated by the safety boundary detector. .
[0094] Further, in the embodiments of the present application, in order to improve the detection efficiency and coverage, the adversarial safety detection algorithm also introduces a multi-objective optimization strategy, which is realized through the following additional steps:
[0095] define a sample diversity measurement function ;
[0096] construct a composite optimization objective:
[0097] ;
[0098] wherein represents a maximization operation, is a noise parameter, is a noise space, is an unsafety score given by a safety boundary detector, is a traffic prediction model to be evaluated, is an adversarial sample generator, is a trade-off parameter, is a sample diversity measurement function;
[0099] wherein the sample diversity measurement function is used to quantify the difference between the traffic scene generated by the noise parameter and the existing scene, and a diversity evaluation method based on kernel density estimation is adopted, and the calculation formula is:
[0100] ;
[0101] wherein is a sample diversity measurement function, represents the size of a sample diversity pool , and is a sample set in the sample diversity pool, represents a summation operator, is a sample in the sample diversity pool, is a kernel function, which measures the similarity between two noise parameter generated scenarios;
[0102] Evolutionary algorithms or gradient ascent methods are used to solve the optimization problem;
[0103] A sample diversity pool is maintained to save representative samples of the explored region.
[0104] This multi-objective strategy avoids the detection process from falling into local optimal solutions, improving the comprehensiveness of the security boundary detection.
[0105] Step 5: Implementing progressive security stress testing based on the results of the adversarial security detection;
[0106] This step is based on the results of the adversarial security detection in step 4. By gradually increasing the complexity of the scene, the safety of the traffic prediction model is tested progressively, and the safety and robustness of the model are comprehensively evaluated.
[0107] Among them, the progressive security stress testing is carried out according to the following process: starting from the basic security level, gradually increasing the complexity and extremeness of the traffic scene; At each complexity level, the performance and safety performance of the prediction model are evaluated; Record the critical point at which the model begins to have safety problems, and analyze the root cause of the safety problem; According to the analysis results, the model is improved in a targeted manner.
[0108] The complexity increasing strategy of the progressive security stress testing can be represented by the function :
[0109] ;
[0110] Among them represents the complexity of the scene at time , is the initial complexity, is the test phase, represents the rate of complexity increase, represents the degree of nonlinearity of complexity increase.
[0111] In the embodiments of the present application, in order to comprehensively evaluate the robustness of the model under different safety rules, the progressive security stress testing adopts a multi-dimensional safety evaluation matrix to quantitatively score the performance of the model in each safety dimension, so as to identify the safety short board of the model and the priority improvement direction.
[0112] Step 6: Deploying real-time security protection layer according to the results of adversarial security detection and progressive security stress testing;
[0113] Based on the results of the adversarial safety probing in Step 4 and the results of the progressive safety stress testing in Step 5, a real-time safety shield is designed and deployed to monitor the prediction process and correct potential unsafe decisions, ensuring that the final output prediction results meet safety specifications.
[0114] As shown in Figure 5 , the conversion of different types of safety problems before and after safety verification enhancement intuitively presents the effectiveness of the embodiment. The problems of traffic flow exceeding limit, speed exceeding limit, missing road condition information, mismatch between road condition and rainfall, and composite safety risk in the original prediction are converted into safe traffic flow, safe speed, complete road condition information, matching between road condition and rainfall, and no safety risk after safety verification enhancement, realizing the comprehensive solution of safety problems.
[0115] Among them, the real-time safety shield contains three functional modules: a safety monitoring module that monitors the input and output of the traffic prediction model in real time to detect potential safety risks; a decision correction module that automatically adjusts the prediction parameters when detecting unsafe prediction results to bring the results back within the safety boundary; and an exception recording module that records all situations that trigger safety protection to provide data support for subsequent model optimization.
[0116] The safety monitoring algorithm includes the following steps: receiving the input data and output results of the prediction model; extracting the safety rules related to the current situation from the safety rule knowledge base; verifying each relevant rule to check whether the prediction results meet the rule constraints; calculating the violation degree and comprehensive unsafe score of each rule; generating a safety alert and triggering the correction process when the score exceeds the threshold; recording the specific scene and reason for triggering the alert.
[0117] The alert generation of the safety monitoring algorithm can be represented as a function:
[0118] ;
[0119] Among them, is the input data, is the prediction result, is the safety rule set, is a specific rule in the safety rule set, represents the rule verifies the input data and the prediction result , is an existential quantifier, the output of the function represents whether to trigger a safety alert.
[0120] Further, in the embodiments of the present application, in order to reduce the interference of the security protection layer on the normal prediction result, the security monitoring algorithm also introduces a confidence threshold mechanism, which is realized through the following additional steps: calculating the confidence interval of the insecurity score; setting a dynamically adjusted confidence threshold; only when the insecurity score exceeds the confidence threshold, the correction operation is triggered.
[0121] This mechanism avoids the performance loss caused by excessive intervention, and balances safety and prediction accuracy.
[0122] Step 7, analyze the running data of the real-time security protection layer, and construct an adaptive security constraint mechanism to dynamically adjust the security threshold and correction strategy;
[0123] This step is based on the running data of the real-time security protection layer in step 6, and constructs an adaptive security constraint mechanism that can dynamically adjust the security threshold and correction strategy according to the current traffic state, improving the adaptability of the system in different traffic environments.
[0124] As shown in Figure 3 Under different rainfall intensity conditions (0-20 mm / h, 20-40 mm / h, 40-60 mm / h, 60+ mm / h), the adaptive security constraint mechanism of the present embodiment has an advantage over the traditional security correction method. The original prediction accuracy decreases with the increase of rainfall intensity (from 92.5% to 83.2%), the traditional method has a large accuracy loss while ensuring safety (from 1.7% to 11.7%, an average of 6.8%), while the accuracy loss of the present embodiment is significantly smaller (from 0.6% to 2.9%, an average of only 1.8%), effectively balancing safety and prediction accuracy.
[0125] Before constructing the adaptive security constraint mechanism, the following preprocessing steps need to be performed on the running data:
[0126] Time series segmentation, according to the change of traffic state, the continuous running data is segmented into multiple time periods, which is convenient for analyzing the safety constraint demand under different states; outlier filtering, identifying and processing abnormal adjustment values of safety threshold and correction intensity, to ensure data quality; feature normalization, normalizing different types of safety parameters (such as threshold, correction intensity, monitoring frequency, etc.), so that they have comparability; state label generation, according to traffic flow, speed, weather conditions and other factors, generate traffic state label for each time period data; time sequence feature extraction, extract the time sequence feature representing the evolution process of traffic state, provide the basis for the adaptive mechanism; traffic state feature fusion, the input features of the traffic state classifier are fused through multi-modal feature fusion, different sources and types of traffic data (such as traffic flow, speed, weather conditions, road type, etc.) are unified to the same representation space through normalization and feature transformation, ensuring that each type of feature has a reasonable weight in the classification process.
[0127] wherein the adaptive safety constraint mechanism comprises the following core components: a traffic state classifier that classifies the current traffic state into different levels such as normal, mild abnormality, moderate abnormality, and severe abnormality; a safety parameter adjuster that dynamically adjusts parameters such as safety threshold, correction strength, and monitoring frequency according to the traffic state level; an adaptive learning module that continuously optimizes the safety parameter adjustment strategy based on historical data and real-time feedback.
[0128] Further, the traffic state classifier is composed of the following components: a data preprocessing module responsible for standardizing and feature extracting the input traffic data; a feature fusion layer that fuses time features and spatial features to form a comprehensive representation; a classification network composed of multiple fully connected layers and activation functions that outputs the probability distribution of different traffic states; a decision layer that determines the final traffic state category based on the probability distribution.
[0129] The mathematical representation of traffic state classification is:
[0130] ;
[0131] wherein, represents the current traffic data corresponding to the traffic state, is the set of all possible traffic states, is the posterior probability of the traffic state given the traffic data , and argmax represents the traffic state that maximizes the posterior probability .
[0132] Further, the safety parameter adjuster is composed of the following components: a parameter library that stores safety parameter configurations under various traffic states; a mapping network that maps traffic states to corresponding safety parameter configurations; a smooth transition module that ensures smooth transition of safety parameters between different states to avoid abrupt changes.
[0133] Further, in the embodiments of the present application, in order to handle the time sequence dependency of traffic states, the adaptive learning module of the adaptive safety constraint mechanism adopts a recurrent neural network structure. The recurrent neural network structure comprises: an input gate that controls the influence degree of new input data; a forgetting gate that determines the degree of retaining or forgetting historical state information; a memory unit that stores long-term dependency information; an output gate that controls the influence degree of the memory unit on the current output; and a prediction layer that predicts the possible safety risks in the future based on the current state.
[0134] Through this recurrent structure, the adaptive safety constraint mechanism can consider the historical evolution trend of traffic states, predict possible safety risks in advance, and realize preventive safety constraint adjustment.
[0135] Step 8: Fuse the original prediction results with the constructed security constraints to generate prediction results with enhanced security verification;
[0136] This step integrates the output of the original traffic prediction model with the safety constraint mechanism established in the previous steps to generate a final prediction result that has been enhanced with safety verification, ensuring that traffic predictions that comply with safety regulations can still be provided even in extreme cases.
[0137] like Figure 4 As shown, the safety boundary detector exhibits excellent performance across different safety rule types. For traffic flow rules, vehicle speed rules, road condition rules, and combined rules, the accuracy rates reached 94.2%, 95.7%, 91.3%, and 93.8%, respectively; the recall rates were 92.8%, 93.6%, 89.5%, and 91.2%, respectively; and the F1 scores were 93.5%, 94.6%, 90.4%, and 92.5%, respectively, demonstrating stable and excellent overall performance. Simultaneously, the false alarm rate and false negative rate remained at low levels, at 5.5% and 7.7%, respectively, ensuring the reliability of the enhanced safety verification.
[0138] Before performing security verification and enhancement, the prediction results and security constraint data need to be preprocessed as follows:
[0139] The prediction results are formatted by converting prediction results of different formats into a standard format for easier subsequent processing; constraint parameter matching is performed by selecting and loading corresponding safety constraint parameters from the safety parameter library based on the current traffic state; multi-scale representation conversion converts the prediction results into a multi-scale representation to facilitate safety rule verification at different granularity levels; risk scoring standardization standardizes the violation scores of different safety rules to the [0, 1] interval; prediction constraint association mapping establishes a mapping relationship between prediction parameters and corresponding safety constraints for targeted correction; and prediction result dimension normalization adjusts the safety adjustment function. Prediction results and Normalization is performed on each dimension to ensure a balanced contribution from different dimensions (such as vehicle speed and density) when calculating Euclidean distance, preventing certain dimensions from dominating the distance calculation due to their large numerical range; weight coefficients are calibrated to adjust the deviation of the prediction results from the metric function based on the importance and sensitivity of different prediction dimensions. Weighting coefficients in Proper settings and calibrations should be implemented to ensure that the contribution of each dimension in assessing the degree of deviation from the prediction results is commensurate with its actual importance.
[0140] The safety verification reinforcement algorithm includes the following steps: obtaining the output result of the original traffic prediction model; using a safety boundary detector to evaluate the safety of the prediction result; for prediction results that detect safety problems, identifying specific safety rules violated; according to the type of violated rules, selecting the corresponding correction strategy; applying adaptive safety constraints for parameter adjustment; performing secondary safety verification on the adjusted result to ensure compliance with safety specifications; if the secondary verification still fails, further adjust the parameters until the safety specifications are met; output the final safety verification reinforced prediction result; record the correction process for subsequent model improvement.
[0141] The safety verification reinforced prediction result can be represented as:
[0142] ;
[0143] where represents the safety verification reinforced prediction result; is the original prediction result; is a safety risk score function used to evaluate the safety of given traffic data and prediction result ; is a safety threshold representing the maximum allowed safety risk; is a safety adjustment function used to adjust the original prediction result when it does not meet safety requirements; otherwise represents the application of the safety adjustment function when the safety threshold is not met.
[0144] The inner function is used to calculate the safety risk score of the prediction result, with inputs being the original traffic data and prediction result , and output being a score representing the degree of insecurity, calculated by the weighted sum of the safety boundary detector's score for each safety rule violation:
[0145] ;
[0146] where, represents the safety risk score of given traffic data and prediction result , is the total number of safety rules, is the weight of the th safety rule, is the risk assessment function for the th safety rule, denotes the summation operator.
[0147] The inner function is a safety adjustment function, which is used to adjust the prediction result that does not meet the safety constraint, that is, to find a new prediction result with the minimum deviation from the original prediction result under the condition of meeting all safety rules; and the specific implementation is as follows:
[0148]
[0149] wherein, denotes the safety risk score of the given traffic data and the prediction result ; is the Euclidean distance square of the prediction result, which is used to measure the difference between the prediction results before and after adjustment; denotes the adjusted safety prediction result, denotes the original prediction result; denotes finding that minimizes the objective function. denotes "for all", denotes the th safety rule, is the set of safety rules; denotes the constraint condition.
[0150] Further, in the embodiments of the present application, in order to balance the safety and prediction accuracy, the safety verification reinforcement algorithm adopts a multi-objective optimization method, and the specific implementation steps include:
[0151] defining a prediction result deviation measurement function ;
[0152] constructing an optimization objective:
[0153]
[0154] wherein, denotes the prediction result deviation measurement function, is the original prediction result, is the adjusted prediction result; denotes finding that minimizes the objective function.
[0155] constraint condition:
[0156]
[0157] wherein, denotes the safety risk score of the given traffic data and the prediction result ; is a safety threshold, which represents the maximum safety risk allowed.
[0158] Prediction result deviation metric function For evaluating the adjusted prediction result The deviation degree relative to the original prediction result The weighted distance metric method is adopted:
[0159] ;
[0160] Wherein, represents the prediction result deviation metric function, is the dimension of the prediction result, represents the summation operator, is the weight coefficient of the first dimension, is the distance metric function for the first dimension, is the original prediction result, is the adjusted prediction result, is the first dimension of the original prediction result, is the first dimension of the adjusted prediction result.
[0161] The Lagrange multiplier method or the sequential quadratic programming method is used to solve the optimization problem; the smoothness constraint is introduced to ensure the continuity of the prediction results before and after adjustment. It is ensured that the accuracy and smoothness of the prediction results are maintained as much as possible under the premise of ensuring safety constraints, and the prediction performance decline caused by excessive safety correction is avoided.
[0162] A space-time graph convolution traffic prediction system for performing the above-mentioned space-time graph convolution traffic prediction method, comprising:
[0163] A data processing module for acquiring traffic data and establishing a safety rule knowledge base, and encoding traffic safety specifications into structured safety rules;
[0164] An adversarial sample generation module for processing historical traffic data and designing an adversarial sample generator;
[0165] A detector training module for analyzing the established safety rules and generated adversarial samples, training a safety boundary detector for identifying potential safety rule violations in the prediction results;
[0166] A safety detection module for performing adversarial safety detection using the generated adversarial samples and the trained safety boundary detector;
[0167] A stress detection module for implementing progressive safety stress testing based on the adversarial safety detection results;
[0168] A protection deployment module for deploying real-time security protection layers according to the results of adversarial security probes and progressive security stress tests;
[0169] A constraint construction module for analyzing the operation data of the real-time security protection layers, constructing an adaptive security constraint mechanism, and dynamically adjusting security thresholds and correction strategies;
[0170] A result fusion module for fusing the original prediction results with the constructed security constraints to generate security-verified and enhanced prediction results.
[0171] Here, the present embodiment provides an application example:
[0172] A traffic prediction and management system for a large city under heavy rain weather conditions. Under heavy rain weather conditions, urban trunk roads and overpass areas are prone to extreme traffic conditions such as waterlogging, vehicle deceleration, and congestion. At this time, the traditional traffic prediction model may produce technically reasonable but actually unsafe prediction results, such as recommending vehicles to maintain high speed on waterlogged sections or recommending high-density traffic on poor visibility areas.
[0173] The test area includes the trunk road network within a 20 km x 15 km range of the city center, a total of 35 trunk roads, 12 traffic hubs, and 8 waterlogging points. The system has collected nearly 3 years of historical traffic data and weather data, including traffic flow, vehicle speed, road conditions, and other information under normal and extreme weather conditions. Some of the original traffic data under heavy rain weather conditions are shown in Table 1:
[0174] Table 1: Original traffic data under heavy rain weather conditions (part)
[0175]
[0176] Based on historical data, we also established a safety rule knowledge base and defined safety limits under different road and weather conditions. Some of the safety rule knowledge base under heavy rain weather conditions are shown in Table 2:
[0177] Table 2: Safety rule knowledge base under heavy rain weather conditions (part)
[0178]
[0179] In this application example, we use the adversarial sample generator to create different levels of extreme traffic scenarios under simulated heavy rain weather conditions to test the safety performance of the traffic prediction model. The adversarial samples we designed mainly target the following safety risk points:
[0180] Sudden increase in rainfall leading to rapid deterioration of road conditions;
[0181] Part of the road is waterlogged but not reflected in the monitoring data in time;
[0182] Unreasonable combinations of traffic flow and speed under adverse weather.
[0183] The adversarial sample generator generates a batch of simulated extreme traffic scenarios by analyzing anomalies and boundary conditions in historical data. Some of the extreme traffic scenarios created by the adversarial sample generator are shown in Table 3:
[0184] Table 3: Extreme traffic scenarios created by the adversarial sample generator (partial)
[0185]
[0186] Based on the safety rule knowledge base and the generated adversarial samples, we trained a safety boundary detector to identify situations in the prediction results that may violate safety rules. The safety boundary detector uses a deep neural network structure and combines graph neural networks to handle the dependencies between rules.
[0187] The training data includes two categories:
[0188] Safe samples: traffic prediction results that comply with safety rules;
[0189] Unsafe samples: prediction results under extreme traffic scenarios generated by the adversarial sample generator.
[0190] The performance evaluation results of the safety boundary detector are shown in Table 4:
[0191] Table 4: Performance evaluation results of the safety boundary detector
[0192]
[0193] Using the trained adversarial sample generator and safety boundary detector, we performed adversarial safety exploration, systematically exploring the boundary conditions that the prediction model may violate safety rules under heavy rain weather. The exploration process adopts a multi-objective optimization strategy, maximizing the safety risk score while maintaining sample diversity to avoid falling into local optimal solutions.
[0194] The exploration process discovered various types of safety vulnerabilities, including traffic flow overruns, speed overruns, missing road condition information, and road condition and rainfall mismatches. These findings provide important evidence for subsequent steps.
[0195] Based on the results of adversarial safety exploration, we implemented gradual safety stress testing to evaluate the safety robustness of the model by gradually increasing the complexity of the scenarios. The test starts from the basic safety level and gradually increases the difficulty according to the following complexity increase function, where the initial complexity is 1, the rate of complexity increase is 0.15, and the degree of nonlinearity of complexity increase 1.5.
[0196] At each complexity level, we recorded the critical point where the model started to have safety issues and analyzed the root causes, providing important references for the deployment of subsequent security layers.
[0197] Based on the results of the previous steps, we deployed real-time security layers and built adaptive security constraint mechanisms. The security layer monitors the prediction process in real time and automatically triggers the correction process when it detects unsafe predictions. The adaptive security constraint mechanism dynamically adjusts the safety threshold and correction strategy based on the current traffic state.
[0198] Finally, we integrated the results of the original traffic prediction model with the security constraint mechanism to generate safety-verified and enhanced prediction results. The comparison between the original prediction results and the safety-verified and enhanced prediction results in some extreme traffic scenarios is shown in Table 5:
[0199] Table 5: Comparison between original prediction results and safety-verified and enhanced prediction results in some extreme traffic scenarios
[0200]
[0201] We systematically verified the technical effects of this embodiment, focusing on the following two core technical effects: systematic discovery of security vulnerabilities and balancing safety and prediction performance.
[0202] We compared the effects of traditional security verification methods and the adversarial security probing mechanism of this embodiment in discovering security vulnerabilities. In the same test scenarios, the comparison between traditional security verification methods and this embodiment in security vulnerability detection is shown in Table 6:
[0203] Table 6: Comparison between traditional security verification methods and this embodiment in security vulnerability detection
[0204]
[0205] The data shows that through the adversarial security probing mechanism, the security vulnerability detection rate of this embodiment has increased from 42.0% in traditional methods to 91.0%, with a total increase of 116.5%. In particular, in terms of hidden risks such as missing road condition information and mismatch between road conditions and rainfall, the detection capability has improved more significantly.
[0206] We also evaluated the effect of this embodiment in maintaining prediction performance while improving safety. The impact of safety verification enhancement on prediction accuracy under different rainfall intensities is shown in Table 7:
[0207] Table 7: Impact of safety verification enhancement on prediction accuracy under different rainfall intensities
[0208]
[0209] The data show that while ensuring 100% safety compliance (0 safety violation rate), the present embodiment only causes an average decrease in prediction accuracy of 1.8%, which is a significant improvement compared to the 6.8% accuracy loss of the traditional safety correction method. In particular, under extreme rainfall conditions (above 60 mm / h), the accuracy loss of the present embodiment is only 2.9%, while the traditional method reaches 11.7%.
[0210] This result demonstrates that the present embodiment can improve the safety and reliability of traffic prediction while maintaining prediction accuracy. By systematically discovering safety vulnerabilities through the adversarial safety probing mechanism and balancing safety and prediction performance through the multi-objective optimization safety verification reinforcement method, the present embodiment provides an effective solution for safe traffic prediction under extreme traffic conditions.
[0211] The above describes embodiments of the present application, but the embodiments are not limited to the specific embodiments described above, which are merely illustrative and not limiting. Those skilled in the art can make more forms of equivalent embodiments under the inspiration of the embodiments, which are all within the protection of the embodiments.
Claims
1. A traffic prediction method based on spatiotemporal graph convolution, characterized in that, include: Acquire traffic data and establish a safety rule knowledge base, encoding traffic safety regulations into structured safety rules; Process historical traffic data and design an adversarial example generator; Analyze established security rules and generated adversarial examples to train a security boundary detector to identify potential security rule violations in the prediction results; The safety boundary detector uses a deep neural network structure, receives traffic prediction results as input, and outputs a score indicating the likelihood of the traffic prediction results violating various safety rules. The safety boundary detector includes an input layer, a feature extraction module, a rule evaluation module, and an output layer. The security boundary detector uses a graph neural network structure to represent security rules as nodes in a graph and the dependencies between rules as edges. By transmitting and aggregating information between nodes, it captures the cascading effect of rule violations. The graph neural network structure also includes: a node representation module, which encodes each security rule as a node in the graph; an edge representation module, which encodes the dependencies between rules as edges in the graph; an information transmission layer, composed of graph convolutional layers, which is used to realize the transmission and aggregation of information between nodes; and a comprehensive evaluation layer, which is used to fuse the states of each node and output a comprehensive security evaluation result; through graph structure representation, it is possible to capture the cascading effect of rule violations. Adversarial security detection is performed using generated adversarial examples and a trained security boundary detector; Implement progressive security stress tests based on the results of adversarial security detection; Deploy real-time security protection layers based on the results of adversarial security detection and progressive security stress testing; Analyze the operational data of the real-time security protection layer, construct an adaptive security constraint mechanism, and dynamically adjust security thresholds and correction strategies; The original prediction results are fused with the constructed security constraints to generate prediction results that enhance security verification.
2. The traffic prediction method based on spatiotemporal graph convolution according to claim 1, characterized in that, After acquiring traffic data, the traffic data is preprocessed, including data cleaning, time alignment, feature standardization, encoding, and spatiotemporal feature extraction.
3. The traffic prediction method based on spatiotemporal graph convolution according to claim 1, characterized in that, The rules in the safety rule knowledge base are represented as constraints. Each constraint includes a safety rule identifier, traffic state parameters, and prediction parameters. By evaluating whether the traffic state and prediction parameters meet the conditions of the safety rule, a Boolean result value is returned, indicating whether the safety rule is met.
4. The traffic prediction method based on spatiotemporal graph convolution according to claim 1, characterized in that, The process of performing adversarial security detection includes: generating extreme traffic scenarios using an adversarial example generator; inputting these scenarios into a traffic prediction model to obtain prediction results; evaluating the security of these prediction results using a security boundary detector; and updating the parameters of the adversarial example generator based on the security evaluation results.
5. The traffic prediction method based on spatiotemporal graph convolution according to claim 1, characterized in that, Before constructing the adaptive safety constraint mechanism, the running data needs to be preprocessed. The preprocessing includes time series segmentation, outlier filtering, feature normalization, state label generation, and time series feature extraction. The adaptive safety constraint mechanism includes a traffic state classifier, a safety parameter adjuster, and an adaptive learning module.
6. The traffic prediction method based on spatiotemporal graph convolution according to claim 1, characterized in that, The process of fusing the original prediction results with the constructed safety constraints to generate safety-verified and enhanced prediction results includes: obtaining the output results of the original traffic prediction model; evaluating the safety of the prediction results using a safety boundary detector; for prediction results that detect safety issues, identifying the violated safety rules and applying adaptive safety constraints to adjust the parameters; performing secondary safety verification on the adjusted results; and outputting the final safety-verified and enhanced prediction results.
7. A traffic prediction system based on spatiotemporal graph convolution, characterized in that, A traffic prediction method for performing a spatiotemporal graph convolution as described in any one of claims 1-6 includes: The data processing module is used to acquire traffic data and establish a safety rule knowledge base, encoding traffic safety regulations into structured safety rules; The adversarial example generation module is used to process historical traffic data and design adversarial example generators. The detector training module is used to analyze established security rules and generated adversarial examples to train a security boundary detector, which is used to identify potential security rule violations in the prediction results. The security detection module is used to perform adversarial security detection using generated adversarial examples and a trained security boundary detector; The pressure detection module is used to conduct progressive security pressure tests based on the results of adversarial security detection. The protection deployment module is used to deploy a real-time security protection layer based on the results of adversarial security detection and progressive security stress testing. The constraint construction module is used to analyze the operational data of the real-time security protection layer, build an adaptive security constraint mechanism, and dynamically adjust security thresholds and correction strategies. The results fusion module is used to fuse the original prediction results with the constructed security constraints to generate prediction results with enhanced security verification.
Citation Information
Patent Citations
Traffic speed prediction method based on space-time diagram convolution-generative adversarial network
CN113450561A
Traffic flow prediction method based on clustering and space-time fusion graph convolutional network
CN120375614A