A method and system for accident perception on a highway
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTH CHINA UNIV OF TECH
- Filing Date
- 2026-06-02
- Publication Date
- 2026-08-07
AI Technical Summary
[0004]但该现有技术仍中所采用的纯数据驱动模型虽能学习特征与事故间的统计关联,但其结构本身不具备显式的领域知识嵌入机制,导致在事故样本稀疏或分布偏移(如节假日、恶劣天气)场景下,模型决策可能偏离交通运行常识,且结果缺乏可解释性
本发明通过Mamba模块对相邻门架交通流序列进行长时序局部建模,连续追踪车速、流量等参数的渐变趋势,在异常尚未突破传统规则阈值时实现灵敏捕获;Transformer模块利用自注意力机制捕捉跨时间步的非局部依赖,有效辨识多参数协同变化中的隐性事故模式。两者结合形成的感知模型能够从车辆通行流水数据中自动抽取事故演进的内在特征表示,识别规则难以覆盖的隐性或渐进式异常,提高高速公路事故感知的精度。
Smart Images

Figure CN122336996B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic information sensing technology, and in particular to a method and system for detecting accidents on highways. Background Technology
[0002] How to detect accidents on highways in a timely and accurate manner has become an important research direction for ensuring traffic safety and improving road management efficiency.
[0003] Existing methods for detecting highway accidents mainly adopt two paradigms: one is a pure rule-driven method, which relies on preset thresholds (such as abnormal vehicle travel time, sudden speed changes, etc.) to determine accidents; the other is a pure data-driven method, such as using gradient boosting tree models such as CatBoost and XGBoost to classify and predict the aggregated road segment-level traffic flow features.
[0004] However, the pure data-driven model used in this existing technology can learn the statistical relationship between features and accidents, but its structure itself does not have an explicit domain knowledge embedding mechanism. As a result, in scenarios where accident samples are sparse or the distribution is off (such as holidays or severe weather), the model's decisions may deviate from common sense about traffic operations, and the results lack interpretability. Summary of the Invention
[0005] Therefore, it is necessary to provide a method and system for accident perception on highways to address the aforementioned technical problems.
[0006] This invention provides a method for accident detection on highways, comprising: Acquire vehicle traffic flow data collected by the highway ETC gantry system; The time axis is divided into continuous sliding windows, and the vehicle traffic flow data of adjacent gantries in the highway ETC gantry system are aggregated to extract traffic flow features within each sliding window of adjacent gantries and obtain the road segment-level traffic flow sequence. The segment-level traffic flow sequence is input into a pre-trained perception model, which includes a Mamba module and a Transformer module connected in sequence. The Mamba module processes the segment-level traffic flow sequence to model the accident-related local temporal dependencies in the long-term trend, obtaining the first local feature. The Transformer module extracts features from the first local feature to capture the accident-related non-local temporal dependencies, obtaining the second local feature. The first and second local features are fused using residuals, and the fused features are classified and mapped to obtain the probability of accident occurrence. Traffic anomaly criteria are used to determine anomalies in road segment-level traffic flow sequences to generate rule trigger flags and obtain rule reasoning results. The traffic anomaly criteria are dynamically adjusted based on the rule threshold correction factor output by the knowledge graph, which is obtained by training a large language model with historical accident data. The result of rule reasoning and the probability of accident occurrence are integrated by confidence fusion to obtain a fusion score. When the fusion score exceeds a set threshold, it is determined that a traffic accident has occurred in the corresponding monitoring interval, and the vehicles related to the accident are identified.
[0007] Optionally, the time axis is divided into continuous sliding windows, and vehicle traffic flow data of adjacent gantries in the highway ETC gantry system are aggregated to extract traffic flow features within each sliding window of adjacent gantries, resulting in a road segment-level traffic flow sequence, specifically including: Vehicle passage data includes: vehicle identification number, timestamp of passing through gantry, gantry number, and distance between adjacent gantry; Based on the road network structure data, two adjacent ETC gantries are matched as a single monitoring interval, and the time axis is divided into multiple sliding windows with fixed durations and continuous operation. For each sliding window, the traffic flow data of all vehicles passing through the current monitoring interval within the sliding window are used to obtain the current road segment level traffic flow characteristics. The current road segment level traffic flow characteristics include: the number of vehicles in the current road segment, the average speed of the current road segment, the standard deviation of the average speed of the current road segment, the maximum vehicle speed of the current road segment, and the minimum vehicle speed of the current road segment. For all vehicle traffic flow data passing through the upstream gantry section adjacent to the current monitoring section within the sliding window, the upstream road segment level traffic flow characteristics are obtained; the upstream road segment level traffic flow characteristics include: the number of vehicles in the upstream road segment, the average speed of the upstream road segment, the standard deviation of the average speed of the upstream road segment, the maximum vehicle speed of the upstream road segment, and the minimum vehicle speed of the upstream road segment. For all vehicle traffic flow data passing through the downstream gantry section adjacent to the current monitoring section within the sliding window, downstream road segment-level traffic flow characteristics are obtained; downstream road segment-level traffic flow characteristics include: number of vehicles in the downstream road segment, average speed of the downstream road segment, standard deviation of average speed of the downstream road segment, maximum vehicle speed of the downstream road segment, and minimum vehicle speed of the downstream road segment. The current road segment-level traffic flow features, upstream road segment-level traffic flow features, and downstream road segment-level traffic flow features extracted from all sliding windows are combined to obtain the road segment-level traffic flow features of the corresponding monitoring interval within the sliding window; all road segment-level traffic flow features are arranged in chronological order according to the time axis to obtain the road segment-level traffic flow sequence.
[0008] Optionally, training the perception model includes: Acquire historical vehicle passage data collected by the highway ETC gantry system; The time axis is divided into continuous sliding windows, and the historical vehicle traffic flow data of adjacent gantries are aggregated to obtain the input feature vector of each sliding window. The actual accident result of whether a traffic accident occurred is used as the label to construct a training sample set. The training sample set is input into the perception model to obtain the accident prediction probability. The hyperparameters of the perceptual model are searched and tuned using Bayesian optimization methods. These hyperparameters include at least the number of model layers and the number of hidden layer neurons, specifically: Define the vector of hyperparameters to be optimized and set the search range for each hyperparameter; Using the evaluation metric of the perceptual model on the validation set as the objective function, and employing a Gaussian process as a surrogate model to approximate the objective function, the Gaussian process is represented by the following equation: ; in, Let be the objective function. For the proxy model, It is a mean function. It is the covariance function; Based on historical hyperparameter evaluation data, the distribution of the objective function value at a new point is predicted using a Gaussian process based on the following formula: ; in, To predict the mean at the new point, To predict the variance at the new point; The next optimal evaluation point is selected based on the following formula by optimizing the acquisition function: ; in, The current optimal function value, To the extent of improvement; Iteratively update the surrogate model until convergence, and obtain the optimal set of hyperparameters that minimizes the objective function; The perception model is configured using the optimal hyperparameter set, and the parameters of the perception model are updated with the goal of minimizing the loss function between the accident prediction probability and the actual accident result, thus obtaining the perception model after preliminary training. The precision and recall rates are used to evaluate the initially trained perceptual model based on the following formula: ; ; in, For precision, To achieve recall, The number of accidents that are correctly perceived. The number of false alarms. This represents the number of unreported accidents. If the pre-trained perception model simultaneously meets the preset precision and preset recall, it is used as the final trained perception model; otherwise, the hyperparameters or training strategy are adjusted and retraining is performed.
[0009] Optionally, the Mamba module employs a selective state-space model, based on the following formula to model the local temporal dependencies related to accidents in long-term trends, thus obtaining the first local feature: ; ; ; in, It is in the hidden state of SSM. For local temporal features, A is the state transition matrix, B is the input mapping matrix, and C is the output mapping matrix. The gate signal is driven by the input. This is the first local feature; The Transformer module employs an attention mechanism, capturing nonlocal temporal dependencies related to incidents based on the following formula to obtain the second local feature: ; ; ; ; ; in, This is a second local feature. For query, As key, For value, , and This is the projection matrix.
[0010] Optionally, the probability of an accident can be obtained by performing residual fusion of the first and second local features based on the following formula, and then classifying and mapping the fused features: ; ; in, Features obtained through the fusion of Mamba and Transformer This is the first local feature. This is a second local feature. and For classification layer parameters, For the Sigmoid function, This represents the probability of an accident occurring.
[0011] Optionally, the knowledge graph is obtained by training a large language model using historical incident data, specifically including: Acquire historical accident data collected by the highway ETC gantry system, including: historical traffic accident records, road maintenance operation logs, traffic police handling reports, weather warnings, and weather text information; By using a large language model to perform joint semantic analysis and entity relation extraction on historical traffic accident records and corresponding road segment structural features and historical traffic flow data, the association patterns of accident-prone periods, road segment geometry, frequently congested nodes, and adverse weather conditions are identified, resulting in a knowledge graph with road segments as nodes and accident causal relationships as edges. The large language model is fine-tuned and trained using historical traffic accident records and historical road segment feature data. Based on the matching results of accident risk levels and real-time related events of each road segment in the knowledge graph, a rule threshold correction factor is obtained. The rule threshold correction factor is used to dynamically adjust the preset threshold parameters in the traffic anomaly criterion.
[0012] Optionally, the traffic anomaly criterion is dynamically adjusted based on the rule threshold correction factor output by the knowledge graph, specifically including: rule This includes: the current average speed reduction ratio in the monitoring interval exceeds the first ratio threshold multiplied by the first rule threshold correction factor, and the interval flow is greater than the first flow threshold. ; rule This includes: the increase in downstream interval velocity relative to current interval velocity exceeding the second proportional threshold multiplied by the second rule threshold correction factor, and interval flow exceeding the second flow threshold. ; rule Including: within the time window Within this range, the cumulative decrease in average speed exceeds the first speed threshold rule threshold multiplied by the third rule threshold correction factor, and the interval flow is greater than the third flow threshold: ; rule This includes situations where the current maximum speed of a single vehicle is lower than the second speed threshold multiplied by the fourth rule threshold correction factor, and the interval flow is greater than the fourth flow threshold. ; rule This includes: the current average speed is lower than the third speed threshold multiplied by the fifth rule threshold correction factor, and the interval flow is greater than the fifth flow threshold. ; in, The first proportional threshold, The second proportional threshold, The first flow threshold, The second flow threshold, The third flow threshold, The fourth flow threshold, The fifth flow threshold, The first speed threshold, The second speed threshold, The third speed threshold, This is the first rule threshold correction factor. This is the threshold correction factor for the second rule. This is the third rule threshold correction factor. This is the fourth rule threshold correction factor. This is the threshold correction factor for the fifth rule.
[0013] Optionally, the rule-based reasoning results and the probability of accident occurrence are integrated using a confidence fusion method to obtain a fusion score. When the fusion score exceeds a set threshold, a traffic accident is determined to have occurred in the corresponding monitoring interval, and the vehicles involved in the accident are identified, specifically including: Based on the following formula, a fusion score is obtained by integrating the rule reasoning results and the probability of accident occurrence through confidence fusion: ; in, For integrated scoring, The result of rule-based reasoning, , The dynamic weighting coefficients satisfy the following conditions: , This represents the probability of an accident occurring. When the fusion score exceeds a set threshold, the vehicles related to the accident are identified based on the following formula: ; in, For vehicles related to the accident, , This is an adjustable parameter.
[0014] This invention provides an accident detection system for highways, comprising: The data acquisition module is used to acquire vehicle traffic flow data collected by the highway ETC gantry system; The information extraction module is used to divide the time axis into continuous sliding windows and aggregate the vehicle traffic flow data of adjacent gantries in the highway ETC gantry system to extract the traffic flow characteristics in each sliding window of adjacent gantries and obtain the road segment-level traffic flow sequence. The model perception module is used to input the segment-level traffic flow sequence into a pre-trained perception model. The pre-trained perception model includes a Mamba module and a Transformer module connected in sequence. The Mamba module processes the segment-level traffic flow sequence to model the accident-related local temporal dependencies in the long-term trend, obtaining the first local feature. The Transformer module extracts features from the first local feature to capture the accident-related non-local temporal dependencies, obtaining the second local feature. The first and second local features are fused using residuals, and the fused features are classified and mapped to obtain the probability of accident occurrence. The anomaly detection module is used to detect anomalies in road segment-level traffic flow sequences using traffic anomaly criteria to generate rule trigger flags and obtain rule reasoning results. The traffic anomaly criteria are dynamically adjusted based on the rule threshold correction factor output by the knowledge graph, which is obtained by training a large language model using historical accident data. The accident perception module is used to integrate the rule reasoning results with the probability of accident occurrence through confidence fusion to obtain a fusion score. When the fusion score exceeds a set threshold, it is determined that a traffic accident has occurred in the corresponding monitoring area and the vehicles related to the accident are identified.
[0015] The accident detection method and system for highways provided in this invention have the following advantages compared with the prior art: This invention utilizes the Mamba module to perform long-term local modeling of traffic flow sequences from adjacent gantries, continuously tracking the gradual trends of parameters such as vehicle speed and flow rate, achieving sensitive detection before anomalies exceed traditional rule thresholds. The Transformer module employs a self-attention mechanism to capture non-local dependencies across time steps, effectively identifying latent accident patterns in multi-parameter collaborative changes. The combined perception model can automatically extract the intrinsic feature representation of accident evolution from vehicle traffic flow data, identifying latent or gradual anomalies that are difficult to cover by rules, thus improving the accuracy of highway accident perception. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating an accident detection method for highways provided in one embodiment. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0018] Currently, highway accident detection methods mainly rely on technologies such as video surveillance, sensors, and vehicle-to-everything (V2X) networks. However, traditional methods suffer from problems such as incomplete data, poor real-time performance, and high false alarm rates. Especially in the complex highway environment, the accuracy and robustness of existing detection systems still need improvement. Therefore, researching more efficient and accurate accident detection methods has become an important task in current practice.
[0019] To improve the effectiveness and efficiency of accident detection, an increasing number of studies are focusing on the construction of digital sensing systems. In particular, there is a strong emphasis on strengthening digital sensing and monitoring coverage of key routes and hubs to enhance all-weather, full-cycle operational status monitoring and proactive early warning capabilities. Electronic Toll Collection System (ETC) data, as a crucial component of digital sensing systems, offers advantages such as high real-time performance, large data volume, and wide coverage, providing data support for accident detection across the entire road network.
[0020] This invention provides a method for accident detection on highways. It uses full-segment traffic flow modeling based on ETC data, combines rule-based reasoning with a Mamba-Transformer hybrid model, and introduces Bayesian optimization to improve model generalization performance, thereby achieving automatic accident detection and suspected vehicle identification on highways. Figure 1 As shown, the method includes: Acquire vehicle traffic flow data collected by the highway ETC gantry system. Divide the time axis into continuous sliding windows and aggregate the vehicle traffic flow data of adjacent gantries in the highway ETC gantry system to extract traffic flow features within each sliding window of adjacent gantries, thereby obtaining a road segment-level traffic flow sequence.
[0021] The segment-level traffic flow sequence is input into a pre-trained perception model, which includes a Mamba module and a Transformer module connected in sequence. The Mamba module processes the segment-level traffic flow sequence to model accident-related local temporal dependencies in a long-term trend, obtaining the first local feature. The Transformer module extracts features from the first local feature to capture accident-related non-local temporal dependencies, obtaining the second local feature. The first and second local features are then fused using residuals, and the fused features are classified and mapped to obtain the accident occurrence probability.
[0022] Traffic anomaly criteria are used to determine anomalies in road segment-level traffic flow sequences, generating rule trigger flags and obtaining rule inference results. The traffic anomaly criteria are dynamically adjusted based on rule threshold correction factors output from a knowledge graph, which is obtained by training a large language model using historical accident data.
[0023] The results of rule-based reasoning and the probability of accident occurrence are integrated using a confidence-based fusion method to obtain a fusion score. When the fusion score exceeds a set threshold, a traffic accident is determined to have occurred in the corresponding monitoring area, and the vehicles involved in the accident are identified.
[0024] Preferably, the time axis is divided into continuous sliding windows, and the vehicle traffic flow data of adjacent gantries in the highway ETC gantry system are aggregated to extract traffic flow features within each sliding window of adjacent gantries, resulting in a road segment-level traffic flow sequence, specifically including: Vehicle traffic flow data includes: vehicle identification number, gantry passage timestamp, gantry number, and distance between adjacent gantries. Based on road network structure data, two adjacent ETC gantries are matched as a single monitoring interval, and the time axis is divided into multiple sliding windows of fixed duration.
[0025] For each sliding window, the traffic flow data of all vehicles passing through the current monitoring interval within the sliding window are used to obtain the current road segment-level traffic flow characteristics. The current road segment-level traffic flow characteristics include: the number of vehicles in the current road segment, the average speed of the current road segment, the standard deviation of the average speed of the current road segment, the maximum vehicle speed of the current road segment, and the minimum vehicle speed of the current road segment.
[0026] For all vehicle traffic flow data passing through the upstream gantry section adjacent to the current monitoring section within the sliding window, upstream segment-level traffic flow characteristics are obtained. These characteristics include: number of vehicles in the upstream segment, average speed of the upstream segment, standard deviation of the average speed of the upstream segment, maximum vehicle speed of the upstream segment, and minimum vehicle speed of the upstream segment.
[0027] For all vehicle traffic flow data passing through the downstream gantry section adjacent to the current monitoring section within the sliding window, downstream segment-level traffic flow characteristics are obtained. These characteristics include: number of vehicles in the downstream segment, average speed of the downstream segment, standard deviation of the average speed of the downstream segment, maximum vehicle speed of the downstream segment, and minimum vehicle speed of the downstream segment.
[0028] The current road segment-level traffic flow features, upstream road segment-level traffic flow features, and downstream road segment-level traffic flow features extracted from all sliding windows are combined to obtain the road segment-level traffic flow features of the corresponding monitoring interval within the sliding window. All road segment-level traffic flow features are then arranged chronologically along the time axis to obtain the road segment-level traffic flow sequence.
[0029] Preferably, the knowledge graph is obtained by training a large language model using historical accident data, specifically including: Acquire historical accident data collected by the highway ETC gantry system, including: historical traffic accident records, road maintenance operation logs, traffic police handling reports, weather warnings, and weather text information.
[0030] By employing a large language model, joint semantic analysis and entity relation extraction are performed on historical traffic accident records and corresponding road segment structural features, as well as historical traffic flow data. This identifies association patterns between accident-prone time periods, road segment geometry, frequently congested nodes, and adverse weather conditions, resulting in a knowledge graph with road segments as nodes and accident causal relationships as edges. The large language model is fine-tuned and trained using historical traffic accident records and historical road segment feature data.
[0031] Based on the matching results of accident risk levels and real-time related events of each road segment in the knowledge graph, a rule threshold correction factor is obtained. The rule threshold correction factor is used to dynamically adjust the preset threshold parameters in the traffic anomaly criterion.
[0032] A specific embodiment of the present invention is provided: 1. Data acquisition.
[0033] This method first acquires multi-source heterogeneous text data, including: historical accident records, maintenance logs, traffic police handling records, construction notices, and meteorological texts. Entity and relation extraction is performed on the above text data using a large language model to construct a highway accident risk knowledge graph. The large language model is then used to infer the meaning of the prompts.
[0034] Please extract information related to highway accident risks from the following text: Text content: {text} Output format: - Road segment identification: {chainage range or distinctive location} - Road section type: [Tunnel / Bridge / Ramp / Curve / Long Downhill / Straight Road] - Accident type: [Rear-end collision / rollover / hit with fixed object / secondary accident] - Contributing factors: [Flooding / Fog / High proportion of heavy-duty trucks / Construction encroaching on roads / Drowsy driving / Sudden changes in speed] - Time characteristics: [Holidays / Rush Hour / Early Morning / Off-Peak] - Environmental characteristics: [Rainy / Foggy / Backlight / Night / Sunny] - Upstream and downstream propagation patterns: [Sudden speed drop upstream leads to rear-end collision downstream / Mainline congestion backflows onto ramps / None] - Confidence level: {0-1}.
[0035] The structured information output by the large language model is validated and then stored in a graph database to form a knowledge graph. The nodes of the knowledge graph include: road segment, accident type, cause, time feature, and environmental feature; the edges include: the causal relationship between environmental factors and accidents, the positional relationship between upstream and downstream road segments, and the association between scenarios and rules.
[0036] Secondly, acquire vehicle passage data collected by the highway ETC gantry system, including: vehicle identification number (such as license plate number), gantry passage timestamp, gantry number, and distance between adjacent gantries. Then, based on the highway ETC gantry system's road network structure data, use adjacent gantries as monitoring intervals. .
[0037] 2. Construct a machine learning training dataset.
[0038] Divide the timeline into minute-level continuous sliding windows. For each monitoring interval The vehicle traffic information within the monitoring area is aggregated, and the traffic flow features of each monitoring section are extracted, as shown in Table 1, to form a road segment-level traffic flow sequence for input to the perception model.
[0039] ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; in, For the time within the window Number of vehicles on the current road section This represents the total number of vehicles on the current road segment within the window. For the current road segment The speed of the car For the time within the window The number of vehicles on the upstream section, This represents the total number of vehicles on the upstream section within the window. For the upstream section The speed of the car For the time within the window The number of vehicles on the upstream section, This represents the total number of vehicles on the upstream section within the window. For the downstream section The speed of the vehicle.
[0040] Table 1 Feature Variable Names
[0041] The data sample set input to the model is ,in It is the feature vector of the sample. It is the corresponding target variable.
[0042] 3. Construct a Mamba-Transformer hybrid model. Taking the road segment-level traffic flow sequence as input, firstly, the Mamba module is used to model local temporal dependencies with linear computational complexity. Then, a single-layer Transformer enhancement module is introduced to explicitly capture key anomaly correlations across time steps, thereby improving the ability to perceive sudden and gradual accidents while ensuring inference efficiency.
[0043] Mamba employs a selective state-space model to efficiently model long-term trends, and its continuous form can be expressed as: ; ; ; in, It is in the hidden state of SSM. For local temporal features, A, B, and C are the state transition matrix, input mapping matrix, and output mapping matrix, respectively. The gate signal is driven by the input. This is the first local feature.
[0044] Building upon Mamba output, we introduce Transformer to capture event-related nonlocal temporal dependencies: ; ; ; ; in, They are query, key, and value, respectively. This is the projection matrix.
[0045] The second local feature output by the Transformer layer is To combine the advantages of both types of models, residual fusion is adopted. The probability of the final accident occurring is: ; in, Features obtained through the fusion of Mamba and Transformer and For classification layer parameters, For the Sigmoid function, The probability of an accident occurring ( ).
[0046] Model structure parameters, including the number of layers and hidden layer neurons, are searched and tuned using Bayesian optimization. Bayesian optimization builds a probabilistic model of the objective function and predicts the next hyperparameter values most likely to yield the best results based on current observations. This is useful when the task requires optimizing a black-box function. , The vector representing the hyperparameters uses a Gaussian process (GP) as a surrogate model. This approximates the objective function, and the next optimal evaluation point is selected through the following optimization process. A Gaussian process is defined by the following formula: ; in, It is the mean function. It is the covariance function. Based on historical data. Gaussian processes can predict at new points Distribution at location: ; in, and These are the predicted mean and variance, respectively.
[0047] Selecting the next evaluation point is typically done by optimizing the acquisition function, with the desired improvement expressed in mathematical form as follows: ; in, This is the current optimal function value. This indicates the magnitude of the improvement; the expected improvement is expressed at a given position. At that time, the expected amount of improvement.
[0048] Through the iterative process of Bayesian optimization, the surrogate model is continuously updated and eventually converges to an optimal set of hyperparameters that minimizes the objective function. .
[0049] 4. Construct a rule-based reasoning module. This module sets multiple traffic anomaly criteria and uses parameterized expression to improve versatility. The main rules include: rule The current average speed decrease rate in the monitored area exceeds the first percentage threshold. Multiply by the correction factor And the interval flow is greater than the first flow threshold. : ; rule The increase in the downstream speed relative to the current speed exceeds the second proportional threshold. Multiply by the correction factor And the interval flow is greater than the second flow threshold. : ; rule : in the time window Within this range, the cumulative decrease in average speed exceeds the first speed threshold. Multiply by the correction factor And the flow rate is greater than the third flow rate threshold. : ; rule The current maximum speed of the single vehicle is lower than the second speed threshold. Multiply by the correction factor And the flow rate is greater than the fourth flow rate threshold. : ; rule The current average speed is below the third speed threshold. Multiply by the correction factor And the flow rate is greater than the fifth flow rate threshold. : ; in, The first proportional threshold, The second proportional threshold, The first flow threshold, The second flow threshold, The third flow threshold, The fourth flow threshold, The fifth flow threshold, The first speed threshold, The second speed threshold, The third speed threshold, This is the first rule threshold correction factor. This is the threshold correction factor for the second rule. This is the third rule threshold correction factor. This is the fourth rule threshold correction factor. This is the threshold correction factor for the fifth rule.
[0050] 5. The results of rule-based reasoning and the probability of accident occurrence will be integrated using a confidence level fusion method. The fusion scoring formula is as follows: ; in, The result of rule-based reasoning, , To dynamically adjust the weight coefficients of the rule engine for the knowledge graph based on the current road segment and scenario, Set a threshold for the probability of an accident occurring. Later, when At that time, it was determined that a traffic accident had occurred in the monitored area.
[0051] 6. Based on the determination that the accident zone is valid, this invention further identifies the vehicles related to the accident. By combining timestamps, continuity of travel paths, and characteristics of sudden speed changes and stops, vehicles that passed through the monitoring zone within the accident time window and exhibited abnormal speed changes or abnormal stops are identified. The criteria for screening suspected vehicles are: ; in, , This is an adjustable parameter.
[0052] 7. Configure the perception model using the optimal hyperparameter set, and update the parameters of the perception model with the goal of minimizing the loss function between the accident prediction probability and the actual accident result, to obtain the perception model after preliminary training; The precision and recall rates are used to evaluate the initially trained perceptual model based on the following formula: ; ; in, For precision, To achieve recall, The number of accidents that are correctly perceived. The number of false alarms. This represents the number of accidents that were not reported.
[0053] If the initially trained perceptual model simultaneously meets the preset precision and preset recall, then it is used as the final trained perceptual model. Otherwise, the hyperparameters or training strategy are adjusted and retraining is performed.
[0054] A specific embodiment of the present invention is provided: This embodiment first utilizes a large language model to construct an accident risk knowledge graph for highways in Province X. A total of 1,286 text data items were collected, including historical accident records, maintenance logs, traffic police handling records, construction notices, and meteorological texts from highways in Province X over the past two years.
[0055] Taking a typical road section ( to Taking the tunnel exit section as an example, the large language model extracts the following key information from the text: Table 2 to Example of road segment knowledge graph extraction results
[0056] Based on the knowledge graph information mentioned above, the system outputs a correction factor for the road segment-scenario combination: Table 3. Example of Road Segment-Scene Correction Factor Output
[0057] The Mamba-Transformer hybrid model was systematically tuned using Bayesian optimization to achieve optimal model performance. The final optimal hyperparameter combination, as shown in Table 2, was obtained through the optimization process. These hyperparameter selections included important metrics such as the maximum number of iterations, tree depth, and learning rate. The maximum number of iterations was selected as optimal (380) between 100 and 500, effectively ensuring sufficient model learning. The optimal tree depth was between 4 and 10, with a result of 10, which improves model performance on complex data. The optimal learning rate was selected as 0.2 after optimization, ranging from 0.01 to 0.3, which helps improve convergence speed and avoid overfitting. This combination of hyperparameters enhances the performance of the Mamba-Transformer hybrid model, achieving better prediction results.
[0058] Table 4 Optimal Hyperparameter Combinations for the Mamba-Transformer Hybrid Model
[0059] The inference layer consists of two components, with the following rules defined, where the threshold for each rule is a correction factor output from the knowledge graph. to Dynamic adjustment is implemented when the current cross-sectional velocity decreases by more than 30%. Furthermore, the flow rate is greater than 30; the downstream section velocity is 50% higher than the current section velocity. And the flow rate is >30; the cumulative decrease in cross-sectional velocity within 15 minutes is 30 km / h. And the flow rate is >30; the maximum speed of a single vehicle in the cross-section is less than 40km / h. And the flow rate is >30; the cross-sectional velocity is less than 40 km / h. And the traffic flow is greater than 30. If the traffic flow on a road segment triggers any threshold set by the rule engine, a rule inference warning will be triggered.
[0060] exist to Under the road segment, dynamic rule thresholds: Trigger threshold 39%, Trigger threshold 60%, Trigger threshold 42km / h Trigger threshold 20km / h The trigger threshold is 24 km / h, and the weights for scene rule reasoning and model reasoning are respectively... , , ,when At that time, it was believed that a traffic accident had occurred in the monitoring area.
[0061] One application embodiment of the present invention is provided: The verification period was from February 1 to April 30, and Highway A was selected, which included 23 accident records and 194 congestion records.
[0062] For 23 accident records, the model output 219 accident detection records, as shown in Table 5, successfully identifying 19 accidents. Four accidents were not identified. For the unidentified accident records, the traffic flow on the day of the accident was reviewed, indicating that the accidents had a minor impact and did not cause significant changes in traffic flow on the road segment. Based on this, for the 23 accident records, the model performed 219 detections, successfully identifying 19 accidents and failing to identify 4. The model's accident recall rate was 82%.
[0063] For accidents and congestion events, including 217 event records, the model performed 219 tests, successfully identifying 189 events and failing to identify 28 events. The model's recall rate was 87%, and its precision rate was 86%.
[0064] Table 5. Results of the Accident and Congestion Incident Perception Test on Highway A
[0065] Another application embodiment of the present invention is provided: The verification period was from February 1st to April 30th, using Highway B as the selection point. This included 11 accident records and 129 congestion records. The model performed 151 detections on the accident records, as shown in Table 6. Nine accidents were successfully identified, while two were not.
[0066] Table 6. Results of the Accident and Congestion Incident Perception Test on Highway B
[0067] Based on this, the model performed 151 tests on 11 accident records, successfully identifying 9 accidents and failing to identify 2. The model's accident recall rate was 82%.
[0068] For accidents and congestion events, including 140 event records, the model performed 151 tests, successfully identifying 131 events and failing to identify 9 events. The model's recall rate was 94%, and its precision rate was 87%.
[0069] Based on the same inventive concept, embodiments of the present invention also provide an accident detection system for highways, the system comprising: The data acquisition module is used to acquire vehicle traffic flow data collected by the highway ETC gantry system.
[0070] The information extraction module is used to divide the time axis into continuous sliding windows and aggregate the vehicle traffic flow data of adjacent gantries in the highway ETC gantry system to extract traffic flow features within each sliding window of adjacent gantries and obtain the road segment-level traffic flow sequence.
[0071] The model perception module is used to input segment-level traffic flow sequences into a pre-trained perception model. The pre-trained perception model includes a Mamba module and a Transformer module connected in sequence. The Mamba module processes the segment-level traffic flow sequences to model accident-related local temporal dependencies in long-term trends, obtaining the first local feature. The Transformer module extracts features from the first local feature to capture accident-related non-local temporal dependencies, obtaining the second local feature. The first and second local features are then fused using residuals, and the fused features are classified and mapped to obtain the accident occurrence probability.
[0072] The anomaly detection module is used to determine anomalies in road segment-level traffic flow sequences using traffic anomaly criteria, generating rule trigger flags and obtaining rule inference results. The traffic anomaly criteria are dynamically adjusted based on rule threshold correction factors output from the knowledge graph, which is obtained by training a large language model using historical accident data.
[0073] The accident perception module integrates the rule-based reasoning results with the probability of accident occurrence using a confidence-based fusion method to obtain a fusion score. When the fusion score exceeds a set threshold, a traffic accident is determined to have occurred in the corresponding monitoring area, and the vehicles involved in the accident are identified.
[0074] The embodiments described above are merely examples of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.
Claims
1. A method for accident detection on highways, characterized in that, include: Acquire vehicle traffic flow data collected by the highway ETC gantry system; The time axis is divided into continuous sliding windows, and the vehicle traffic flow data of adjacent gantries in the highway ETC gantry system are aggregated to extract traffic flow features within each sliding window of adjacent gantries and obtain the road segment-level traffic flow sequence. A segment-level traffic flow sequence is input into a pre-trained perception model, which includes a Mamba module and a Transformer module connected in sequence. The Mamba module processes the segment-level traffic flow sequence to model accident-related local temporal dependencies in a long-term trend, obtaining a first local feature. The Transformer module extracts features from the first local feature to capture accident-related non-local temporal dependencies, obtaining a second local feature. The first and second local features are fused using residuals, and the fused features are classified and mapped to obtain the probability of accident occurrence. Traffic anomaly criteria are used to determine anomalies in road segment-level traffic flow sequences to generate rule trigger flags and obtain rule reasoning results. The traffic anomaly criteria are dynamically adjusted based on the rule threshold correction factor output by the knowledge graph, which is obtained by training a large language model with historical accident data. The knowledge graph is obtained by training a large language model using historical accident data, and specifically includes: Acquire historical accident data collected by the highway ETC gantry system, including: historical traffic accident records, road maintenance operation logs, traffic police handling reports, weather warnings, and weather text information; By using a large language model, joint semantic analysis and entity relation extraction are performed on the historical traffic accident records and the structural features of the corresponding road segments, as well as historical traffic flow data, to identify the association patterns between accident-prone periods, road segment geometry, frequently congested nodes, and unfavorable weather conditions, resulting in a knowledge graph with road segments as nodes and accident causal relationships as edges. The large language model is obtained through fine-tuning and training using historical traffic accident records and historical road segment feature data. Based on the matching results of the accident risk level of each road segment and the real-time related events in the knowledge graph, a rule threshold correction factor is obtained. The rule threshold correction factor is used to dynamically adjust the preset threshold parameters in the traffic anomaly criterion. The result of rule reasoning and the probability of accident occurrence are integrated by confidence fusion to obtain a fusion score. When the fusion score exceeds a set threshold, it is determined that a traffic accident has occurred in the corresponding monitoring interval, and the vehicles related to the accident are identified.
2. The method for accident detection on highways as described in claim 1, characterized in that, The process involves dividing the time axis into continuous sliding windows and aggregating vehicle traffic flow data from adjacent gantries in the highway ETC gantry system to extract traffic flow features within each sliding window of adjacent gantries, thereby obtaining a road segment-level traffic flow sequence. Specifically, this includes: The vehicle passage data includes: vehicle identification number, timestamp of passing through gantry, gantry number, and distance between adjacent gantry; Based on the road network structure data, two adjacent ETC gantries are matched as a single monitoring interval, and the time axis is divided into multiple sliding windows with fixed durations and continuous operation. For each sliding window, traffic flow data of all vehicles passing through the current monitoring interval within the sliding window are used to obtain the current road segment level traffic flow characteristics; the current road segment level traffic flow characteristics include: the number of vehicles in the current road segment, the average speed of the current road segment, the standard deviation of the average speed of the current road segment, the maximum vehicle speed of the current road segment, and the minimum vehicle speed of the current road segment; For all vehicle traffic flow data passing through the upstream gantry section adjacent to the current monitoring section within the sliding window, upstream road segment-level traffic flow characteristics are obtained; the upstream road segment-level traffic flow characteristics include: number of vehicles in the upstream road segment, average speed of the upstream road segment, standard deviation of average speed of the upstream road segment, maximum vehicle speed of the upstream road segment, and minimum vehicle speed of the upstream road segment; For all vehicle traffic flow data passing through the downstream gantry section adjacent to the current monitoring section within the sliding window, downstream road segment-level traffic flow characteristics are obtained; the downstream road segment-level traffic flow characteristics include: number of vehicles in the downstream road segment, average speed of the downstream road segment, standard deviation of average speed of the downstream road segment, maximum vehicle speed of the downstream road segment, and minimum vehicle speed of the downstream road segment. The current road segment-level traffic flow features, the upstream road segment-level traffic flow features, and the downstream road segment-level traffic flow features extracted from all sliding windows are combined to obtain the road segment-level traffic flow features of the corresponding monitoring interval within the sliding window; all road segment-level traffic flow features are arranged in chronological order according to the time axis to obtain the road segment-level traffic flow sequence.
3. The method for accident detection on highways as described in claim 1, characterized in that, Training the perception model includes: Acquire historical vehicle passage data collected by the highway ETC gantry system; The time axis is divided into continuous sliding windows, and the historical vehicle traffic flow data of adjacent gantries are aggregated to obtain the input feature vector of each sliding window. The actual accident result of whether a traffic accident occurred is used as a label to construct a training sample set. The training sample set is input into the perception model to obtain the accident prediction probability. The hyperparameters of the perceptual model are searched and tuned using a Bayesian optimization method. These hyperparameters include at least the number of model layers and the number of hidden layer neurons, specifically: Define the vector of hyperparameters to be optimized and set the search range for each hyperparameter; Using the evaluation metric of the perceptual model on the validation set as the objective function, and employing a Gaussian process as a surrogate model to approximate the objective function, the Gaussian process is represented by the following equation: ; in, Let be the objective function. For the proxy model, It is a mean function. It is the covariance function; Based on historical hyperparameter evaluation data, the distribution of the objective function value at a new point is predicted using a Gaussian process based on the following formula: ; in, To predict the mean at the new point, To predict the variance at the new point; The next optimal evaluation point is selected based on the following formula by optimizing the acquisition function: ; in, The current optimal function value, To what extent the improvement is made; Iteratively update the surrogate model until convergence, and obtain the optimal set of hyperparameters that minimizes the objective function; The perception model is configured using the optimal hyperparameter set, and the parameters of the perception model are updated with the goal of minimizing the loss function between the accident prediction probability and the actual accident result, thus obtaining the perception model after preliminary training. The precision and recall rates are used to evaluate the initially trained perceptual model based on the following formula: ; ; in, To achieve precision, To achieve recall, The number of accidents that are correctly perceived. The number of false alarms. This represents the number of unreported accidents. If the pre-trained perception model simultaneously satisfies the preset precision and preset recall, it is used as the final trained perception model; otherwise, the hyperparameters or training strategy are adjusted and retraining is performed.
4. The method for accident detection on highways as described in claim 1, characterized in that, The Mamba module employs a selective state-space model, and based on the following formula, models the local temporal dependencies related to accidents in long-term trends to obtain the first local feature: ; ; ; in, It is in the hidden state of SSM. For local temporal features, A is the state transition matrix, B is the input mapping matrix, and C is the output mapping matrix. The gate signal is driven by the input. This is the first local feature; The Transformer module employs an attention mechanism to capture nonlocal temporal dependencies related to incidents, obtaining the second local feature based on the following formula: ; ; ; ; ; in, This is a second local feature. For query, As key, For value, , and This is the projection matrix.
5. The method for accident detection on highways as described in claim 4, characterized in that, The probability of an accident is obtained by performing residual fusion of the first and second local features based on the following formula, and then classifying and mapping the fused features: ; ; in, Features obtained through the fusion of Mamba and Transformer This is the first local feature. This is a second local feature. and For classification layer parameters, For the Sigmoid function, This represents the probability of an accident occurring.
6. The method for accident detection on highways as described in claim 1, characterized in that, The traffic anomaly criterion is dynamically adjusted based on the rule threshold correction factor output by the knowledge graph, specifically including: rule This includes: the average speed reduction ratio in the current monitoring interval exceeds the first proportional threshold multiplied by the first rule threshold correction factor, and the interval flow is greater than the first flow threshold. ; rule This includes situations where the increase in downstream interval velocity relative to the current interval velocity exceeds the second proportional threshold multiplied by the second rule threshold correction factor, and the interval flow is greater than the second flow threshold. ; rule Including: within the time window Within this range, the cumulative decrease in average speed exceeds the first speed threshold rule threshold multiplied by the third rule threshold correction factor, and the interval flow rate is greater than the third flow rate threshold. ; rule This includes: the current maximum speed of a single vehicle is lower than the second speed threshold multiplied by the fourth rule threshold correction factor, and the interval flow is greater than the fourth flow threshold. ; rule This includes: the current average speed is lower than the third speed threshold multiplied by the fifth rule threshold correction factor, and the interval flow is greater than the fifth flow threshold. ; in, The first proportional threshold, The second proportional threshold, The first flow threshold, The second flow threshold, The third flow threshold, The fourth flow threshold, The fifth flow threshold, The first speed threshold, The second speed threshold, The third speed threshold, This is the first rule threshold correction factor. This is the threshold correction factor for the second rule. This is the third rule threshold correction factor. This is the fourth rule threshold correction factor. This is the threshold correction factor for the fifth rule.
7. The method for accident detection on highways as described in claim 1, characterized in that, The method integrates the rule-based reasoning results with the probability of accident occurrence through confidence fusion to obtain a fusion score. When the fusion score exceeds a set threshold, it is determined that a traffic accident has occurred in the corresponding monitoring interval, and the vehicles related to the accident are identified. Specifically, this includes: Based on the following formula, a fusion score is obtained by integrating the rule reasoning results and the probability of accident occurrence through confidence fusion: ; in, For integrated scoring, The result of rule-based reasoning, , These are the weighting coefficients. This represents the probability of an accident occurring. When the fusion score exceeds a set threshold, the vehicles related to the accident are identified based on the following formula: ; in, For vehicles related to the accident, , This is an adjustable parameter.
8. An accident detection system for highways, characterized in that, include: The data acquisition module is used to acquire vehicle traffic flow data collected by the highway ETC gantry system; The information extraction module is used to divide the time axis into continuous sliding windows and aggregate the vehicle traffic flow data of adjacent gantries in the highway ETC gantry system to extract the traffic flow characteristics in each sliding window of adjacent gantries and obtain the road segment-level traffic flow sequence. The model perception module is used to input the road segment-level traffic flow sequence into a pre-trained perception model. The pre-trained perception model includes a Mamba module and a Transformer module connected in sequence. The Mamba module processes the road segment-level traffic flow sequence to model the accident-related local temporal dependencies in the long-term trend, obtaining a first local feature. The Transformer module extracts features from the first local feature to capture the accident-related non-local temporal dependencies, obtaining a second local feature. The first local feature and the second local feature are fused using residuals, and the fused features are classified and mapped to obtain the probability of accident occurrence. The anomaly detection module is used to detect anomalies in road segment-level traffic flow sequences using traffic anomaly criteria, generate rule trigger flags, and obtain rule reasoning results. The traffic anomaly criteria are dynamically adjusted based on the rule threshold correction factor output by the knowledge graph, which is obtained by training a large language model using historical accident data. The knowledge graph is obtained by training a large language model using historical accident data, and specifically includes: Acquire historical accident data collected by the highway ETC gantry system, including: historical traffic accident records, road maintenance operation logs, traffic police handling reports, weather warnings, and weather text information; By using a large language model, joint semantic analysis and entity relation extraction are performed on the historical traffic accident records and the structural features of the corresponding road segments, as well as historical traffic flow data, to identify the association patterns between accident-prone periods, road segment geometry, frequently congested nodes, and unfavorable weather conditions, resulting in a knowledge graph with road segments as nodes and accident causal relationships as edges. The large language model is obtained through fine-tuning and training using historical traffic accident records and historical road segment feature data. Based on the matching results of the accident risk level of each road segment and the real-time related events in the knowledge graph, a rule threshold correction factor is obtained. The rule threshold correction factor is used to dynamically adjust the preset threshold parameters in the traffic anomaly criterion. The accident perception module is used to integrate the rule reasoning results with the probability of accident occurrence through confidence fusion to obtain a fusion score. When the fusion score exceeds a set threshold, it is determined that a traffic accident has occurred in the corresponding monitoring area and the vehicles related to the accident are identified.
Citation Information
Patent Citations
Expressway real-time traffic accident risk assessment method based on deep learning
CN112562337A
Expressway traffic flow prediction method based on ETC portal frame data
CN116504076A