A high-speed traffic emergency prediction and detection integrated method and system
By integrating multiple machine learning models and video image analysis, combined with camera data, the prediction and detection of traffic emergencies on highways can be achieved, solving the problem of low prediction accuracy of single models and improving traffic safety and detection efficiency.
Patent Information
- Application Number
- CN202310406853.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-17
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2043-04-17
AI Technical Summary
In the prediction of highway traffic incidents, the use of a single model in existing technologies leads to a decrease in the accuracy and reliability of prediction results, and there is a lack of effective detection methods, making it difficult to meet the development needs of intelligent transportation.
Multiple machine learning models (LR, KNN, DT, SVM, LSTM, Seasonal, AdaBoost, GBDT, RF, Xgboost) are used as base models. A prediction model is constructed through ensemble learning and combined with video image analysis and camera data to achieve prediction and detection of emergencies.
It improves the accuracy of traffic emergency prediction and detection efficiency, reduces the risk of highway traffic accidents, provides real-time alerts and emergency response, and enhances traffic safety.
Smart Images

Figure CN116434547B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic accident prediction technology, specifically to an integrated method and system for predicting and detecting high-speed traffic emergencies. Background Technology
[0002] Highways are an inevitable product of national economic development, adapting to the country's industrialization and urbanization. With the development and popularization of emerging technologies such as the Internet of Things and big data, the integration of these new technologies with highways is an inevitable trend. The concept of smart highways, derived from intelligent transportation systems, aims to ensure traffic efficiency, improve road capacity, and enhance traffic safety. The construction of smart highways is a crucial issue in the construction of transportation infrastructure in the new era, and has become an irresistible global trend, playing a vital role in the development of a nation's transportation system and even the enhancement of its overall national strength.
[0003] With the continuous development of modern society, economy, and high technology, people's transportation needs are constantly increasing, leading to a gradual increase in vehicles on highways and consequently, increasingly prominent traffic safety issues. Vehicles travel at high speeds on highways, making it difficult for drivers to react promptly to emergencies. Traffic accidents can result in significant economic losses and tragic casualties. Therefore, preventing traffic accidents on highways is of paramount importance. While traffic accidents are random events, making it difficult to estimate their exact location, time, and impact, and thus difficult to predict precisely, the number of traffic accidents occurring within a certain time and space can be roughly predicted. Utilizing artificial intelligence to predict the number of potential traffic accidents in real time is an effective means of preventing traffic accidents. This can help transportation departments make scientific decisions and is also an important part of building smart highways.
[0004] Traffic incident prediction is a key issue in the construction of smart highways, and many scholars at home and abroad have conducted a series of studies on this topic. Li et al. used grey relational analysis to measure the correlation between various factors and the occurrence of traffic incidents, and established a multivariate grey model to predict traffic incidents. Liyong et al. used deep learning methods to analyze spatial and temporal features, and used an autoencoder with a monotonic attention mechanism to learn the embedded input of traffic incidents, thereby reducing the prediction error. Tian et al. proposed a deep learning framework including a spatiotemporal attention mechanism to solve the problem of traffic incident prediction in urban areas, helping to alleviate traffic pressure. Zhang et al. used factor analysis to explore the main influencing factors of traffic incidents, and then applied the random forest algorithm to establish a road traffic incident severity prediction model to predict Class II and Class III traffic accidents. Zhao et al. input real-time traffic data into a convolutional neural network for feature extraction, and proposed a traffic incident risk prediction algorithm based on deep learning for edge cloud vehicle-to-everything (V2X) networks. Tantaoui et al. proposed a real-time prediction system based on big data analysis to improve vehicle mobile communication networks, predicting traffic incident risks in real time through parallel data processing. However, current methods only use a single model for prediction, which often limits the prediction results due to the inherent characteristics of the single model. Furthermore, current methods typically use single features for prediction, which is often limited by limited information, leading to reduced accuracy and reliability of the prediction results. In addition, current methods can only predict traffic events without employing corresponding detection methods. These reasons prevent existing research from adequately addressing the current needs of intelligent transportation development. Summary of the Invention
[0005] The purpose of this invention is to provide an integrated method and system for predicting and detecting high-speed traffic emergencies. This method and system can predict the number of possible high-speed traffic emergencies and detect the traffic emergencies that have occurred.
[0006] To achieve the above objectives, the technical solution adopted by the present invention is: an integrated method for predicting and detecting sudden high-speed traffic events, characterized by comprising the following steps:
[0007] Step A: Process the collected historical data of highway traffic emergencies to obtain a standard historical emergency dataset D. Organize this dataset to obtain an emergency dataset Psd for the past seven days on a specific historical date and historical road weather conditions Weather, calculating the percentage of bad weather w. Construct the feature u=(psd,w) and combine it with the actual number of emergencies act to form the dataset r=(u,act). Further construct the dataset R={r z |z=1,...,l-7}, and divide it into training set R1, test set R2 and validation set R3;
[0008] Step B: Using LR, KNN, DT, SVM, LSTM, Seasonal, AdaBoost, GBDT, RF, and Xgboost models as base models, train each model using the training set R1 as input. Calculate the number of possible daily traffic emergencies, compare this number with the actual number of emergencies (act), and calculate the loss using a loss function to adjust the model parameters. When the model reaches the set number of iterations and the improvement in model accuracy is less than the set value, terminate the model training. This yields the trained base models and the data result set M = {Om}. z |z=1,...l-7};
[0009] Step C: Take the output data set M of each model as input, and train it by superimposing the model AdaBoost as an ensemble learning meta-model. Calculate the number of possible traffic emergencies each day, compare it with the actual number of emergencies (act), and calculate the loss value using a loss function to adjust the model parameters. When the model reaches the set number of iterations and the improvement in model accuracy is less than the set value, terminate the model training to obtain the final model. Finally, verify the accuracy and reliability of the final model using the test set R2 and the validation set R3.
[0010] Step D: Using the historical number of traffic emergencies over the past seven days (psd') as features, and extracting frame images (P) from real-time highway traffic videos (V), converting the image data P into weather data (Wea) using a ResNet101 model, and calculating the real-time percentage of bad weather on highways (rate); using the concatenated features (psd', rate), and based on the final ensemble learning model, predicting the number of possible traffic emergencies (Pre) today; based on the predicted number of traffic emergencies, adjusting the frequency of reminders via radio, billboards, and toll stations to help drivers take precautions, and sending the data to traffic and emergency departments for inspection and contingency planning to reduce traffic accidents and casualties;
[0011] Step E: Collect the camera image dataset Dc from the highway, label the license plates of all vehicles in the image data, and divide it into training, testing, and validation sets. Train and validate the YOLO v6 detector for vehicle license plate localization. Stop training when the accuracy of the validation set reaches a set value. Implement accurate vehicle license plate recognition using the open-source library PaddleOCR. Then, calculate the distance di between the detection cameras at two locations, and use this to calculate the distance set DI={di1,di2,di...} of all highway cameras. ... ,di cBased on this, calculate the minimum speed s on the two camera sections of the highway, and obtain the set of minimum speeds S={s1,s2,s3} for all sections of the highway. ... ,s c The minimum time set TI = {ti1,ti2,ti3} where the vehicle appears at two cameras is calculated using the distance set DI and the minimum speed set S. ... ,ti c Furthermore, by using real-time images captured by highway cameras and identifying the license plates of each vehicle through the YOLO v6 detector, a sudden incident may have occurred if a vehicle has not appeared within the minimum time frame specified by both cameras.
[0012] Step F: Collect one image of the highway without vehicles taken by each camera on the highway, o, to obtain a set of clean, vehicle-free images O={o1,o2,o3} captured by cameras on all sections of the highway. ... ,o all}; After this, for the e-th camera, the image without a vehicle is o. e Every ten seconds, the camera generates one image frame (Pic). e Using OpenCV to calculate image frames e With image frame Pic e Difference value Diff e ; Previous image frame Pic' e With image screen o e The calculated difference value Diff' e Then compare the difference values (Diff) at ten-second intervals. e With Diff' e The difference is that when the difference value is higher than the preset value, it indicates that there may be an abnormal vehicle in the current scene. If there is an abnormal vehicle in the camera's scene, there may be a sudden event.
[0013] Furthermore, step A specifically includes the following steps:
[0014] Step A1: Collect a set of n provinces with data boundaries. State = {state} i |i=1,2,...,n}, where there are m highways in the i-th province. i ={Road ij Given |j=1,2,...,m}, we can further obtain the historical data D of daily traffic accidents occurring on the j-th expressway in the i-th province since the previous l-day period. ij ={d ij z|z=1,2,...,l}, and simultaneously obtain the weather conditions detected by t road monitoring points on the z-th day of the historical data for the j-th highway in the i-th province. ij z ={weather ij zk |k=1,2,...,t};
[0015] Step A2: Collect the historical data on daily traffic emergencies D from Step A1. ij ={d ij z Data preprocessing is performed on |z=1,2,...,l} to remove noisy data and improve the accuracy of the machine learning model; simultaneously, missing historical data values of traffic emergencies are filled in to improve the generalization ability of the machine learning model, resulting in historical data D. ij ={d ij z |z=1,2,...,l};
[0016] Step A3: Process the historical data D from step A2. ij ={d ij z Data standardization and data augmentation are performed on |z=1,2,...,l} to obtain standardized and augmented historical data D. ij ={d ij z |z=1,2,...,l};
[0017] Step A4: Obtain the weather conditions detected by the t road monitoring points on the z-th day of the historical data obtained in Step A1 for the i-th province and j-th expressway. ij z ={weather ij zk |k=1,2,...,t}, calculate the proportion of bad weather on the z-th historical day, w. ij z Thus, we obtain the set W representing the percentage of bad road weather each day since the previous day, i.e., W = {w ij z |z=1,2,...,l};
[0018] Step A5: The enhanced historical data D obtained in step A3... ij z ={d ij z |z=1,2,...,l} is concatenated with the daily road bad weather percentage W obtained in step A4; that is, the number of road traffic accidents in the past 7 days on the z-th day is PSD.ij z ={d ij z-1 ,...,d ij z-7 The percentage of bad weather on day z in history (w) ij z By concatenating the data, we obtain the data feature of the j-th expressway in the i-th province on the z-th day as {psd}. ij z ,w ij z};
[0019] Step A6: Generate the historical data feature u for day z from the features constructed in step A5. ij z ={psd ij z ,w ij z}, and compared with the actual number of emergencies on the z-th day in history. ij z Constituting data r ij z =(u ij z ,act ij z Since it is necessary to piece together historical traffic data from the past seven days as the features for that day, we can obtain historical traffic features from day 1+7 to the present. The resulting dataset R is constructed by further integrating the data. ij ={r ij z The dataset is set to |z=1,...l-7} and divided into training set R1, test set R2, and validation set R3 in a 3:1:1 ratio, and stored in their respective folders.
[0020] Furthermore, step B specifically includes the following steps:
[0021] Step B1: Take the dataset R={r} obtained in step A. ij z |z=1,...l-7}, where r ij z =(u ij z ,act ij z ), eigenvalue u ij z This represents the characteristics of daily emergencies and the percentage of bad weather on day z for the j-th expressway in the i-th province over the past 7 days, with a target value of act. ij zThis represents the actual number of traffic accidents that occurred on the j-th expressway in the i-th province on the z-th day;
[0022] Step B2: By using a loss function, the parameters in the LR linear regression network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches the required number of iterations and the improvement in model accuracy is less than 0.05, the model training is terminated, and the trained LR linear regression network model is obtained. The model is then validated using the test set R2, and the output m1 of the LR linear regression network model is obtained.
[0023] Step B3: By using a loss function, the parameters in the KNN nearest neighbor algorithm network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches a certain number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained KNN nearest neighbor algorithm network model is obtained. The model is then validated using the test set R2, and the output m2 of the KNN nearest neighbor algorithm network model is obtained.
[0024] Step B4: By using a loss function, the parameters in the DT decision tree algorithm network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches a certain number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained DT decision tree algorithm network model is obtained. The model is then validated using the test set R2, and the output m3 of the DT decision tree algorithm network model is obtained.
[0025] Step B5: By using a loss function, the parameters in the SVM support vector machine network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches a certain number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained SVM support vector machine network model is obtained. The model is then validated using the test set R2, and the output m4 of the SVM support vector machine network model is obtained.
[0026] Step B6: By using a loss function, the parameters in the LSTM long short-term memory network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches a certain number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained LSTM long short-term memory network model is obtained. The model is then validated using the test set R2, and the output m5 of the LSTM long short-term memory network model is obtained.
[0027] Step B7: By using a loss function, the parameters in the Seasonal_decompose network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches a certain number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained Seasonal_decompose network model is obtained. The model is then validated using the test set R2, and the output m6 of the Seasonal_decompose network model is obtained.
[0028] Step B8: By using a loss function, the parameters in the AdaBoost ensemble learning network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches a certain number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained AdaBoost ensemble learning network model is obtained. The model is then validated using the test set R2, and the output m7 of the AdaBoost ensemble learning network model is obtained.
[0029] Step B9: By using a loss function, the parameters in the GBDT ensemble learning network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches a certain number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained GBDT ensemble learning network model is obtained. The model is then validated using the test set R2, and the output m8 of the GBDT ensemble learning network model is obtained.
[0030] Step B10: By using a loss function, the parameters in the RF ensemble learning network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches a certain number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained RF ensemble learning network model is obtained. The model is then validated using the test set R2, and the output m9 of the RF ensemble learning network model is obtained.
[0031] Step B11: By using a loss function, the parameters in the XgBoost ensemble learning network model are iteratively updated using backpropagation to minimize the loss function during training. When the model reaches a certain number of iterations and the improvement in model accuracy is less than 0.05, training is terminated, resulting in the trained XgBoost ensemble learning network model. The model is then validated using the test set R2, yielding the output m of the XgBoost ensemble learning network model. 10 ;
[0032] Step B12: Organize the output results obtained in steps B1 to B10 to obtain the output data set Om for day z of each base model. z = {m1 zm2 z ,...,m 10 z}, thus obtaining the data result set M={Om z |z=1,...l-7}.
[0033] Furthermore, step C specifically includes the following steps:
[0034] Step C1: Using the output data set M obtained in step B as the feature value and the actual number of traffic accidents act as the target value, we obtain data H. z =(Om z ,act z This generates the dataset H={h1,h2,...,h...}. l-7};
[0035] Step C2: Use the dataset H obtained in step C1 as the input of the AdaBoost ensemble learning network model, i.e. the meta-model of ensemble learning. By using the loss function, the parameters in the AdaBoost ensemble learning network model are continuously updated through backpropagation to minimize the loss function and train the model. When the model reaches the number of iterations and the model accuracy improvement is less than 0.03, the model training is terminated, and the trained AdaBoost ensemble learning network model is obtained.
[0036] Step C3: Validate the AdaBoost ensemble learning network model trained in step C2 using the test set R2 and the validation set R3; calculate the accuracy and mean absolute error using the predicted number of traffic accidents Pre and the actual number of traffic accidents act.
[0037] Furthermore, step D specifically includes the following steps:
[0038] Step D1: Acquire real-time road condition images through highway cameras. The set V of road condition video data captured by t road detection point cameras on each highway. ij x ={v ij x , x=1,2,...,t=;
[0039] Step D2: Iterate through all video files V from step D1 to obtain the footage of the captured road segment. Every hour on the hour, randomly extract footage from the x-th camera. To avoid errors caused by model recognition mistakes, extract any 10 footage P from the most recent 5 minutes. ij x ={p1,p2,...,p 10};
[0040] Step D3: Process the ten images P extracted in step D2 using ResNet101. ij x ={p1,p2,...,p 10 Perform weather identification; finally, use the identified weather data to make a voting decision, and obtain the real-time weather conditions (wea) for the x' segment of the j-th highway in the i-th province. x' ij ;
[0041] Step D4: Analyze the weather conditions (Wea) of all tested sections of the highway obtained in Step D3. ij ={wea x' ij The percentage of bad weather on the highway that day is calculated based on |x'=1,...,t}. ij Meanwhile, the number of traffic accidents on this highway over the past seven days was compiled into a PSD file. ij ={d ij 1 ,....,d ij 7 Feature concatenation is performed to obtain the data (psd'). ij rate ij );
[0042] Step D5: Input the data obtained in step D4 into multiple base models trained in step B, and obtain the output set Om = {m1, m2, ..., m} of each base model. 10};
[0043] Step D6: Input the data obtained in step D5 into the AdaBoost ensemble learning network model trained in step C to obtain the prediction result Pre for the sudden event on this highway.
[0044] Step D7: Based on the prediction results obtained in step D6 and the number of possible emergencies, adjust the frequency of reminders, including those from radio stations, billboards, and toll stations, to help drivers take precautions. At the same time, send the data to the transportation department and emergency response department to conduct inspections and develop contingency plans, thereby reducing the occurrence of traffic accidents and the number of traffic accident casualties.
[0045] Furthermore, step E specifically includes the following steps:
[0046] Step E1: Preprocess the image dataset Dc collected by the cameras on the highway to obtain a cropped image dataset Dc of uniform size on the highway.
[0047] Step E2: Using a data annotation tool, the positions of license plates in the image dataset Dc after image preprocessing in Step E1 are annotated to obtain the accurate position of the license plate of each vehicle in each image, and the coordinate file Fc corresponding to the image dataset Dc on the highway is generated; and the dataset is divided into training, testing and validation sets in a 3:1:1 ratio.
[0048] Step E3: Download the open-source YOLO v6 detector and its pre-trained weights. Use the training set and test set obtained in step E2 to train the YOLO v6 model. Stop training when the accuracy of the validation set reaches 95%.
[0049] Step E4: Use the YOLO v6 detector trained in step E3 for accurate license plate localization, select and outline the specific location of the license plate, and train the license plate detection using the text detection model in PaddleOCR to obtain the license plates of passing vehicles.
[0050] Step E5: Calculate the distance di between two adjacent highway cameras, and based on this, obtain the set of distances DI = {di1, di2, di3} for all adjacent highway cameras along the entire highway. ... ,di c}, di q This represents the distance between camera q and camera q+1;
[0051] Step E6: Calculate the set of minimum speeds for all road segments of all adjacent highway cameras, S = {s1, s2, s3}. ... ,s c}, where s q Indicates di q with di q+1 Minimum speed between road sections;
[0052] Step E7: The set of distances between adjacent high-speed cameras obtained in step E5, DI = {di1, di2, di...} ... ,di c The set of minimum speeds for all road segments obtained in step E6 is S={s1,s2,s...} ... ,s c} Calculations are performed to obtain the minimum time for the vehicle to travel from camera q to camera q+1, resulting in the minimum arrival time set TI={ti1,ti2,ti... ... ,ti c}; where ti q Indicates that the vehicle is from di q with di q+1 Minimum arrival time between road segments;
[0053] Step E8: Using the vehicle license plate recognition model obtained in steps E1-E4, record each vehicle that passes through the highway camera. Using the minimum arrival time of the vehicle from the section between camera q and camera q+1 obtained in step E7, if a vehicle passing through the camera does not arrive at the predetermined time and does not exit the toll station between the section between camera q and camera q+1, it indicates that the vehicle may have an anomaly in the section between camera q and camera q+1, and a sudden event may have occurred.
[0054] Furthermore, step F specifically includes the following steps:
[0055] Step F1: Collect one image O of the highway without vehicles taken by each camera on the highway, resulting in a set O={o1,o2,o3} of clean, vehicle-free images captured by cameras on all sections of the highway. ... ,o all};
[0056] Step F2: Capture image frames Pic from the highway cameras every ten seconds; where the e-th camera obtains the current image frame Pic. e And the e-th camera image without a vehicle collected in step F1. e Calculate image frame Pic using OpenCV e With image frame o e Difference value Diff e ;
[0057] Step F3: Diff, the difference value obtained in step F2 e Pic', the image frame calculated from the first ten seconds of the camera. e With image frame o e The calculated difference value Diff' e The difference between the two is calculated and compared.
[0058] Step F4: When the difference between the two calculated in step F3 is higher than the preset value and Diff e If the value is not zero, it indicates that there is an abnormal vehicle in the frame and it has not moved for ten seconds. This suggests that there may be an abnormal vehicle in the camera's field of view, and a sudden event may have occurred.
[0059] Furthermore, in step B, the specific calculation formula for the loss function is as follows:
[0060]
[0061] Among them, y i This represents the actual number of traffic accidents that occurred on day i. This is a prediction function based on the combination of eigenvalues.
[0062] The calculation formula for the LR linear regression network model is as follows:
[0063]
[0064] Where f(x) represents the prediction result, 0 represents a constant term. Indicates parameters, Indicates the independent variable;
[0065] The calculation formula for the KNN nearest neighbor algorithm network model is as follows:
[0066]
[0067] Where x represents the sample, l represents the dimension, and p represents the norm;
[0068] The calculation formula for the DT decision tree algorithm network model is as follows:
[0069]
[0070] H(D) represents the information entropy of set D, N represents the categories in the set, and P k H(D) represents the proportion of class K; the smaller H(D) is, the higher its purity and the more certain its determination.
[0071] The calculation formula for the SVM support vector machine network model is as follows:
[0072]
[0073] in, Let represent the normal vector of the hyperplane, b represent the intercept of the hyperplane, X represent the eigenvector, and y represent the category.
[0074] Furthermore, since such predicted events cannot make the accurate value equal to the predicted value, the deviation between the predicted value and the actual value is within the allowable range. "Inside" means meeting the requirements; that is... When the time is right, it means the prediction is correct; the deviation range is... The calculation formula is as follows:
[0075]
[0076] Where n represents the number of samples in the sample dataset. This represents the actual number of traffic accidents on day i in the test set samples;
[0077] The formula for calculating the mean absolute error is as follows:
[0078]
[0079] Where n represents the number of samples in the sample dataset, Let y represent the actual number of traffic accidents on day i in the test set samples. i This represents the predicted value of traffic accidents on day i in the test set samples.
[0080] The present invention also provides an integrated system for predicting and detecting high-speed traffic emergencies, including a memory, a processor, and computer program instructions stored in the memory and executable by the processor. When the processor executes the computer program instructions, it can implement the above-mentioned method steps.
[0081] Compared with existing technologies, this invention has the following beneficial effects: It provides an integrated method and system for predicting and detecting high-speed traffic emergencies. This method and system can predict the number of potential traffic emergencies based on historical data and weather conditions, providing real-time alerts to drivers and notifying relevant departments for patrol and protection. Simultaneously, it can detect potential traffic emergencies that have already occurred, with high detection efficiency and accuracy, reducing the risk of road traffic accidents. This invention can combine multi-source heterogeneous data, such as highway vehicle detector data, internet traffic data, meteorological data, signaling data, video images, toll data, checkpoint data, and gantry data, to establish a decision-level fusion method. It comprehensively considers the prediction results of different modalities to arrive at a final decision, thereby efficiently predicting and detecting real-time traffic events on highways, effectively preventing and reducing traffic accidents on highways, and improving highway traffic safety. Attached Figure Description
[0082] Figure 1 This is a flowchart of weather recognition in an embodiment of the present invention;
[0083] Figure 2 This is a flowchart of the model training and prediction process in an embodiment of the present invention;
[0084] Figure 3 This is a schematic diagram of the ensemble learning model in an embodiment of the present invention;
[0085] Figure 4 This is a flowchart of the high-speed traffic emergency prediction in an embodiment of the present invention;
[0086] Figure 5 This is a flowchart of the high-speed traffic emergency detection process in an embodiment of the present invention. Detailed Implementation
[0087] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0088] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.
[0089] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0090] like Figure 1-5 As shown in the figure, this embodiment provides an integrated method for predicting and detecting sudden traffic incidents on highways, including the following steps:
[0091] Step A: Process the collected historical data of highway traffic emergencies to obtain a standard historical emergency dataset D. Organize this dataset to obtain an emergency dataset Psd representing the past seven days of a specific historical date, and historical road weather conditions Weather, calculating the percentage of bad weather w. Construct a feature u=(psd,w), and combine it with the actual number of emergencies act to form a dataset r=(u,act). Further construct the dataset R={r z The set |z=1,...,l-7} is divided into a training set R1, a test set R2, and a validation set R3 according to a 3:1:1 ratio.
[0092] In this embodiment, step A specifically includes the following steps:
[0093] Step A1: Collect a set of n provinces with data boundaries. State = {state} i |i=1,2,...,n}, where there are m highways in the i-th province. i ={Road ij Given |j=1,2,...,m}, we can further obtain the historical data D of daily traffic accidents occurring on the j-th expressway in the i-th province since the previous l-day period. ij ={d ij z |z=1,2,...,l}, and simultaneously obtain the weather conditions detected by t road monitoring points on the z-th day of the historical data for the j-th highway in the i-th province. ij z ={weather ij zk |k=1,2,...,t}, stored in the corresponding folder.
[0094] Step A2: Collect the historical data on daily traffic emergencies D from Step A1. ij ={d ij z Data preprocessing is performed on |z=1,2,...,l} to remove noisy data and improve the accuracy of the machine learning model. Simultaneously, missing historical data values for traffic emergencies are filled in to improve the generalization ability of the machine learning model, resulting in historical data D. ij ={d ij z |z=1,2,...,l}.
[0095] Step A3: Process the historical data D from step A2. ij ={d ij z Data standardization and data augmentation are performed on |z=1,2,...,l} to obtain standardized and augmented historical data D. ij ={d ij z |z=1,2,...,l}.
[0096] Step A4: Obtain the weather conditions detected by the t road monitoring points on the z-th day of the historical data obtained in Step A1 for the i-th province and j-th expressway. ij z ={weather ij zk |k=1,2,...,t}, calculate the proportion of bad weather on the z-th day in history, w ij z Therefore, we obtain the set W of the daily percentage of bad road weather since the previous l days, i.e., W = {w ij z |z=1,2,...,l}.
[0097] Step A5: The enhanced historical data D obtained in step A3... ij z ={d ij z |z=1,2,...,l} is concatenated with the daily road bad weather percentage W obtained in step A4; that is, the number of road traffic accidents in the past 7 days on the z-th day is PSD. ij z ={d ij z-1 ,...,d ij z-7 The percentage of bad weather on day z in history (w) ij z By concatenating the data, we obtain the data feature of the j-th expressway in the i-th province on the z-th day as {psd}.ij z ,w ij z}
[0098] Step A6: Generate the historical data feature u for day z from the features constructed in step A5. ij z ={psd ij z ,w ij z}, and compared with the actual number of emergencies on the z-th day in history. ij z Constituting data r ij z =(u ij z ,act ij z Since it is necessary to piece together historical traffic data from the past seven days as the features for that day, we can obtain historical traffic features from day 1+7 to the present. The resulting dataset R is constructed by further integrating the data. ij ={r ij z The dataset is set to |z=1,...l-7} and divided into training set R1, test set R2, and validation set R3 in a 3:1:1 ratio, and stored in their respective folders.
[0099] Step B: Using LR, KNN, DT, SVM, LSTM, Seasonal, AdaBoost, GBDT, RF, and Xgboost models as base models, train each model using the training set R1 as input. Calculate the number of possible daily traffic emergencies, compare this number with the actual number of emergencies (act), and calculate the loss using a loss function to adjust the model parameters. When the model reaches a set number of iterations and the improvement in model accuracy is less than a set value, terminate the model training. This yields the trained base models and the data result set M = {Om}. z |z=1,...l-7}.
[0100] In this embodiment, step B specifically includes the following steps:
[0101] Step B1: Take the dataset R={r} obtained in step A. ij z |z=1,...l-7}, where r ij z =(u ij z ,act ij z ), eigenvalue u ijz This represents the characteristics of daily emergencies and the percentage of bad weather on day z for the j-th expressway in the i-th province over the past 7 days, with a target value of act. ij z This represents the actual number of traffic accidents that occurred on the j-th expressway in the i-th province on the z-th day.
[0102] Step B2: By using a loss function, the parameters in the LR linear regression network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches a certain number of iterations and the improvement in model accuracy is less than 0.05, the model training is terminated, resulting in a trained LR linear regression network model. The model is then validated using the test set R2. The output m1 of the LR linear regression network model is obtained.
[0103] Step B3: By using a loss function, the parameters in the KNN nearest neighbor algorithm network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches a certain number of iterations and the improvement in model accuracy is less than 0.05, the model training is terminated, resulting in the trained KNN nearest neighbor algorithm network model. The model is then validated using the test set R2. The output m2 of the KNN nearest neighbor algorithm network model is obtained.
[0104] Step B4: By using a loss function, the parameters in the DT decision tree algorithm network model are iteratively updated using backpropagation to minimize the loss function during training. When the model reaches a certain number of iterations and the improvement in model accuracy is less than 0.05, training is terminated, resulting in the trained DT decision tree algorithm network model. The model is then validated using the test set R2. The output m3 of the DT decision tree algorithm network model is obtained.
[0105] Step B5: By using a loss function, the parameters in the SVM support vector machine network model are iteratively updated using backpropagation to minimize the loss function during training. When the model reaches a certain number of iterations and the improvement in model accuracy is less than 0.05, training is terminated, resulting in a trained SVM support vector machine network model. The model is then validated using the test set R2. The output m4 of the SVM support vector machine network model is obtained.
[0106] Step B6: By using a loss function, the parameters in the LSTM (Long Short-Term Memory) network model are iteratively updated using backpropagation to minimize the loss function during training. Training is terminated when the model reaches a certain number of iterations and the accuracy improvement is less than 0.05, resulting in a trained LSTM network model. The model is then validated using the test set R2. The output m5 of the LSTM network model is obtained.
[0107] Step B7: By using a loss function, the parameters in the Seasonal_decompose network model are iteratively updated using backpropagation to minimize the loss function during training. Training is terminated when the model reaches a certain number of iterations and the accuracy improvement is less than 0.05, resulting in the trained Seasonal_decompose network model. The model is then validated using the test set R2. The output m6 of the Seasonal_decompose network model is obtained.
[0108] Step B8: By using a loss function, the parameters in the AdaBoost ensemble learning network model are iteratively updated using backpropagation to minimize the loss function during training. Training is terminated when the model reaches a certain number of iterations and the accuracy improvement is less than 0.05, resulting in a trained AdaBoost ensemble learning network model. The model is then validated using the test set R2. The output m7 of the AdaBoost ensemble learning network model is obtained.
[0109] Step B9: By using a loss function, the parameters in the GBDT ensemble learning network model are iteratively updated using backpropagation to minimize the loss function during training. Training is terminated when the model reaches a certain number of iterations and the accuracy improvement is less than 0.05, resulting in the trained GBDT ensemble learning network model. The model is then validated using the test set R2. The output m8 of the GBDT ensemble learning network model is obtained.
[0110] Step B10: By using a loss function, the parameters in the RF ensemble learning network model are iteratively updated using backpropagation to minimize the loss function during training. When the model reaches a certain number of iterations and the improvement in model accuracy is less than 0.05, training is terminated, resulting in the trained RF ensemble learning network model. The model is then validated using the test set R2. The output m9 of the RF ensemble learning network model is obtained.
[0111] Step B11: By using a loss function, the parameters of the XgBoost ensemble learning network model are iteratively updated using backpropagation to minimize the loss function during training. Training is terminated when the model reaches a certain number of iterations and the accuracy improvement is less than 0.05, resulting in a trained XgBoost ensemble learning network model. The model is then validated using the test set R2. The output m of the XgBoost ensemble learning network model is obtained. 10 .
[0112] Step B12: Organize the output results obtained in steps B1 to B10 to obtain the output data set Om for day z of each base model. z = {m1 zm2 z ,...,m 10 z}, thus obtaining the data result set M={Om z |z=1,...l-7}.
[0113] The specific formula for calculating the loss function is as follows:
[0114]
[0115] Among them, y i This represents the actual number of traffic accidents that occurred on day i. This is a prediction function based on the combination of eigenvalues.
[0116] The calculation formula for the LR linear regression network model is as follows:
[0117]
[0118] Where f(x) represents the prediction result, 0 represents a constant term. Indicates parameters, It represents the independent variable.
[0119] The calculation formula for the KNN nearest neighbor algorithm network model is as follows:
[0120]
[0121] Where x represents a sample, l represents the dimension, and p represents the norm.
[0122] The calculation formula for the DT decision tree algorithm network model is as follows:
[0123]
[0124] H(D) represents the information entropy of set D, N represents the categories in the set, and P k H(D) represents the proportion of class K. The smaller H(D) is, the higher the purity and the more certain the determination.
[0125] The calculation formula for the SVM support vector machine network model is as follows:
[0126]
[0127] in, Let represent the normal vector of the hyperplane, b represent the intercept of the hyperplane, X represent the eigenvector, and y represent the category.
[0128] Step C: Using the output dataset M of each model as input, train the model by superimposing AdaBoost as an ensemble learning meta-model to calculate the number of possible traffic emergencies each day. Compare this number with the actual number of emergencies (act), calculate the loss using a loss function, and adjust the model parameters. When the model reaches a set number of iterations and the improvement in model accuracy is less than a set value, terminate the model training to obtain the final model. Finally, verify the accuracy and reliability of the final model using the test set R2 and the validation set R3.
[0129] In this embodiment, step C specifically includes the following steps:
[0130] Step C1: Using the output data set M obtained in step B as the feature value and the actual number of traffic accidents act as the target value, we obtain data H. z =(Om z ,act z This generates the dataset H={h1,h2,...,h...}. l-7}
[0131] Step C2: Use the dataset H obtained in step C1 as the input to the AdaBoost ensemble learning network model, i.e., the meta-model of ensemble learning. By using the loss function, the parameters in the AdaBoost ensemble learning network model are continuously updated through backpropagation to minimize the loss function and train the model. When the model reaches a certain number of iterations and the model accuracy improvement is less than 0.03, the model training is terminated, and the trained AdaBoost ensemble learning network model is obtained.
[0132] Step C3: Validate the AdaBoost ensemble learning network model trained in Step C2 using the test set R2 and the validation set R3. Calculate the accuracy and mean absolute error using the predicted number of traffic accidents Pre and the actual number of traffic accidents act.
[0133] Because such predictions cannot make the exact value equal to the predicted value, the deviation between the predicted and actual values must be within the allowable range. "Inside" means meeting the requirements. When the time is right, it means the prediction is correct. The deviation range is... The calculation formula is as follows:
[0134]
[0135] Where n represents the number of samples in the sample dataset. This represents the actual number of traffic accidents on day i in the test set samples.
[0136] The formula for calculating the mean absolute error is as follows:
[0137]
[0138] Where n represents the number of samples in the sample dataset. Let y represent the actual number of traffic accidents on day i in the test set samples. i This represents the predicted value of traffic accidents on day i in the test set samples.
[0139] Step D: Using the historical number of traffic emergencies over the past seven days (psd') as features, and extracting frame images (P) from real-time highway traffic video (V), converting the image data P into weather data (Wea) using a ResNet101 model, and calculating the real-time percentage of bad weather on highways (rate). Based on the concatenated features (psd', rate) and the resulting ensemble learning model, predict the number of potential traffic emergencies (Pre) for today. Based on the predicted number of traffic emergencies, adjust the frequency of warnings (including those from radio, billboards, and toll booths) to help drivers prepare. Send the data to traffic and emergency departments for patrols and contingency planning to reduce traffic accidents and fatalities.
[0140] In this embodiment, step D specifically includes the following steps:
[0141] Step D1: Acquire real-time road condition images through highway cameras. The set V of road condition video data captured by t road detection point cameras on each highway. ij x ={v ij x , x=1,2,...,t=.
[0142] Step D2: Iterate through all video files V from step D1 to obtain the footage of the captured road segment. Every hour on the hour, randomly extract footage from the x-th camera. To avoid errors caused by model recognition mistakes, extract any 10 footage P from the most recent 5 minutes. ij x ={p1,p2,...,p 10}
[0143] Step D3: P process the ten images extracted in step D2 using ResNet101. ij x ={p1,p2,...,p 10 Perform weather identification; finally, use the identified weather data to make a voting decision, and obtain the real-time weather conditions (wea) for the x' segment of the j-th highway in the i-th province. x' ij .
[0144] Step D4: Analyze the weather conditions (Wea) of all tested sections of the highway obtained in Step D3. ij ={wea x' ij The percentage of bad weather on that road in real time on that day is calculated using the formula |x'=1,...,t}. ij At the same time, the number of traffic accidents on this highway over the past seven days was compiled into a PSD file. ij ={d ij 1 ,....,d ij 7 Feature concatenation is performed to obtain the data (psd'). ij rate ij ).
[0145] Step D5: Input the data obtained in step D4 into multiple base models trained in step B, and obtain the output set Om = {m1, m2, ..., m} of each base model. 10}
[0146] Step D6: Input the data obtained in step D5 into the AdaBoost ensemble learning network model trained in step C to obtain the prediction result Pre for the sudden event on this highway.
[0147] Step D7: Based on the prediction results obtained in Step D6 and the number of possible emergencies, adjust the frequency of reminders, including those from radio stations, billboards, and toll booths, to help drivers take precautions. Simultaneously, send the data to transportation and emergency response departments to facilitate patrols and contingency plans, thereby reducing traffic accidents and fatalities.
[0148] Step E: Collect the camera image dataset Dc from the highway, label the license plates of all vehicles in the image data, and divide it into training, testing, and validation sets. Train and validate the YOLO v6 detector for vehicle license plate localization. Stop training when the accuracy of the validation set reaches a set value. Accurate vehicle license plate recognition is achieved using the open-source library PaddleOCR. Then, calculate the distance di between the detection cameras at two locations, and use this to calculate the distance set DI = {di1, di2, di3} of all highway cameras. ... ,di c Based on this, the minimum speed *s* on the two camera-equipped sections of the highway is calculated, and the set of minimum speeds *S* = {s1, s2, s3} for all sections of the highway is obtained. ... ,s cThe minimum time set TI = {ti1,ti2,ti3} where the vehicle appears at the two cameras is calculated using the distance set DI and the minimum speed set S. ... ,ti c Furthermore, by using real-time footage captured by highway cameras and identifying the license plate of each vehicle through a YOLO v6 detector, a sudden incident may have occurred if a vehicle fails to appear within the minimum time frame specified by both cameras.
[0149] In this embodiment, step E specifically includes the following steps:
[0150] Step E1: Perform image preprocessing on the camera image dataset Dc collected on the highway to obtain a uniformly sized image dataset Dc on the highway after cropping.
[0151] Step E2: Using a data annotation tool, the locations of license plates in the image dataset Dc (after image preprocessing in Step E1) are annotated to obtain the accurate location of the license plate for each vehicle in each image, and a coordinate file Fc corresponding to the image dataset Dc on the highway is generated. The dataset is then divided into training, testing, and validation sets in a 3:1:1 ratio.
[0152] Step E3: Download the open-source YOLO v6 detector and its pre-trained weights. Use the training set and test set obtained in step E2 to train the YOLO v6 model. Stop training when the accuracy of the validation set reaches 95%.
[0153] Step E4: Use the YOLO v6 detector trained in step E3 for accurate license plate localization, select and outline the specific location of the license plate, and train the license plate detection using the text detection model in PaddleOCR to obtain the license plates of passing vehicles.
[0154] Step E5: Calculate the distance di between two adjacent highway cameras, and based on this, obtain the set of distances DI = {di1, di2, di3} for all adjacent highway cameras along the entire highway. ... ,di c}, di q This represents the distance between camera q and camera q+1.
[0155] Step E6: Calculate the set of minimum speeds for all road segments of all adjacent highway cameras, S = {s1, s2, s3}. ... ,s c}, where s q Indicates di q with di q+1 Minimum speed between road sections.
[0156] Step E7: The set of distances between adjacent high-speed cameras obtained in step E5, DI = {di1, di2, di...} ... ,di c The set of minimum speeds for all road segments obtained in step E6 is S={s1,s2,s...} ... ,s c} Calculations are performed to obtain the minimum time for the vehicle to travel from camera q to camera q+1, resulting in the minimum arrival time set TI={ti1,ti2,ti... ... ,ti c}. Among them, ti q Indicates that the vehicle is from di q with di q+1 Minimum arrival time between road segments.
[0157] Step E8: Using the vehicle license plate recognition model obtained in steps E1-E4, record each vehicle that passes through the highway camera. Using the minimum arrival time of the vehicle from the section between camera q and camera q+1 obtained in step E7, if a vehicle passing through the camera does not arrive at the scheduled time and does not exit the toll station between the section between camera q and camera q+1, it indicates that the vehicle may have an anomaly in the section between camera q and camera q+1, and a sudden event may have occurred.
[0158] Step F: Collect one image of the highway without vehicles taken by each camera on the highway, o, to obtain a set of clean, vehicle-free images O={o1,o2,o3} captured by cameras on all sections of the highway. ... ,o all}. After this, for the e-th camera, the image without a vehicle is o. e Every ten seconds, the camera generates one image frame (Pic). e Using OpenCV to calculate image frames e With image frame Pic e Difference value Diff e Previous image frame Pic' e With image screen o e The calculated difference value Diff' e Then compare the difference values (Diff) at ten-second intervals. e With Diff' e The difference is that when the difference value is higher than the preset value, it indicates that there may be an abnormal vehicle in the current scene. If there is an abnormal vehicle in the camera's scene, there may be a sudden event.
[0159] In this embodiment, step F specifically includes the following steps:
[0160] Step F1: Collect one image O of the highway without vehicles taken by each camera on the highway, resulting in a set O={o1,o2,o3} of clean, vehicle-free images captured by cameras on all sections of the highway. ... ,o all}
[0161] Step F2: Capture image frame Pic from the highway camera every ten seconds. The e-th camera obtains the current image frame Pic. e And the e-th camera image without a vehicle collected in step F1. e Calculate image frame Pic using OpenCV e With image frame o e Difference value Diff e .
[0162] Step F3: Diff, the difference value obtained in step F2 e Pic', the image frame calculated from the first ten seconds of the camera. e With image frame o e The calculated difference value Diff' e The difference between the two is calculated and compared.
[0163] Step F4: When the difference between the two calculated in step F3 is higher than the preset value and Diff e If the value is not zero, it indicates that there is an abnormal vehicle in the frame and it has not moved for ten seconds. This suggests that there may be an abnormal vehicle in the camera's field of view, and a sudden event may have occurred.
[0164] This embodiment also provides an integrated system for predicting and detecting high-speed traffic emergencies, including a memory, a processor, and computer program instructions stored in the memory and executable by the processor. When the processor executes the computer program instructions, it can implement the above-mentioned method steps.
[0165] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0166] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0167] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0168] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0169] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. An integrated method for predicting and detecting sudden traffic incidents on highways, characterized in that, Includes the following steps: Step A: Process the collected historical data of highway traffic emergencies to obtain a standard historical emergency dataset D. Organize this dataset to obtain an emergency dataset Psd for the past seven days on a specific historical date and historical road weather conditions Weather, calculating the percentage of bad weather w. Construct the feature u=(psd,w) and combine it with the actual number of emergencies act to form the dataset r=(u,act). Further construct the dataset R={r z |z=1,...,l-7}, and divide it into training set R1, test set R2 and validation set R3; Step B: Using LR, KNN, DT, SVM, LSTM, Seasonal, AdaBoost, GBDT, RF, and Xgboost models as base models, train each model using the training set R1 as input. Calculate the number of possible daily traffic emergencies, compare this number with the actual number of emergencies (act), and calculate the loss using a loss function to adjust the model parameters. When the model reaches the set number of iterations and the improvement in model accuracy is less than the set value, terminate the model training. This yields the trained base models and the data result set M = {Om}. z |z=1,...l-7}; Step C: Take the output data set M of each model as input, and train it by superimposing the model AdaBoost as an ensemble learning meta-model. Calculate the number of possible traffic emergencies each day, compare it with the actual number of emergencies (act), and calculate the loss value using a loss function to adjust the model parameters. When the model reaches the set number of iterations and the improvement in model accuracy is less than the set value, terminate the model training to obtain the final model. Finally, verify the accuracy and reliability of the final model using the test set R2 and the validation set R3. Step D: Using the historical number of traffic emergencies over the past seven days (psd') as features, and extracting frame images (P) from real-time highway traffic videos (V), converting the image data P into weather data (Wea) using a ResNet101 model, and calculating the real-time percentage of bad weather on highways (rate); using the concatenated features (psd', rate), and based on the final ensemble learning model, predicting the number of possible traffic emergencies (Pre) today; based on the predicted number of traffic emergencies, adjusting the frequency of reminders via radio, billboards, and toll stations to help drivers take precautions, and sending the data to traffic and emergency departments for inspection and contingency planning to reduce traffic accidents and casualties; Step E: Collect the camera image dataset Dc from the highway, label the license plates of all vehicles in the image data, and divide it into training, testing, and validation sets. Train and validate the YOLO v6 detector for vehicle license plate localization. Stop training when the accuracy of the validation set reaches a set value. Implement accurate vehicle license plate recognition using the open-source library PaddleOCR. Then, calculate the distance di between the detection cameras at two locations, and use this to calculate the distance set DI={di1,di2,di...} of all highway cameras. ... ,di c Based on this, calculate the minimum speed s on the two camera sections of the highway, and obtain the set of minimum speeds S={s1,s2,s3} for all sections of the highway. ... ,s c The minimum time set TI = {ti1,ti2,ti3} where the vehicle appears at two cameras is calculated using the distance set DI and the minimum speed set S. ... ,ti c Furthermore, by using real-time images captured by highway cameras and identifying the license plates of each vehicle through a YOLO v6 detector, a sudden incident may have occurred if a vehicle has not appeared within the minimum time frame specified by both cameras. Step F: Collect one image of the highway without vehicles taken by each camera on the highway, o, to obtain a set of clean, vehicle-free images O={o1,o2,o3} captured by cameras on all sections of the highway. ... ,o all }; After this, for the e-th camera, the image without a vehicle is o. e Every ten seconds, the camera generates one image frame (Pic). e Using OpenCV to calculate image frames e With image frame Pic e Difference value Diff e ; Previous image frame Pic' e With image screen o e The calculated difference value Diff' e Then compare the difference values (Diff) at ten-second intervals. e With Diff' e The difference is that when the difference value is higher than the preset value, it indicates that there may be an abnormal vehicle in the current scene. If there is an abnormal vehicle in the camera's scene, there may be a sudden event.
2. The integrated method for predicting and detecting high-speed traffic emergencies according to claim 1, characterized in that, Step A specifically includes the following steps: Step A1: Collect a set of n provinces with data boundaries. State = {state} i |i=1,2,...,n}, where there are m highways in the i-th province. i ={Road ij Given |j=1,2,...,m}, we can further obtain the historical data D of daily traffic accidents occurring on the j-th expressway in the i-th province since the previous l-day period. ij ={d ij z |z=1,2,...,l}, and simultaneously obtain the weather conditions detected by t road monitoring points on the z-th day of the historical data for the j-th highway in the i-th province. ij z ={weather ij zk |k=1,2,...,t}; Step A2: Collect the historical data on daily traffic emergencies D from Step A1. ij ={d ij z Data preprocessing is performed on |z=1,2,...,l} to remove noisy data and improve the accuracy of the machine learning model; simultaneously, missing historical data values of traffic emergencies are filled in to improve the generalization ability of the machine learning model, resulting in historical data D. ij ={d ij z |z=1,2,...,l}; Step A3: Process the historical data D from step A2. ij ={d ij z Data standardization and data augmentation are performed on |z=1,2,...,l} to obtain standardized and augmented historical data D. ij ={d ij z |z=1,2,...,l}; Step A4: Obtain the weather conditions detected by the t road monitoring points on the z-th day of the historical data obtained in Step A1 for the i-th province and j-th expressway. ij z ={weather ij zk |k=1,2,...,t}, calculate the proportion of bad weather on the z-th historical day, w. ij z Thus, we obtain the set W representing the percentage of bad road weather each day since the previous day, i.e., W = {w ij z |z=1,2,...,l}; Step A5: The enhanced historical data D obtained in step A3... ij z ={d ij z |z=1,2,...,l} is concatenated with the daily road bad weather percentage W obtained in step A4; that is, the number of road traffic accidents in the past 7 days on the z-th day is PSD. ij z ={d ij z-1 ,...,d ij z-7 The percentage of bad weather on day z in history (w) ij z By concatenating the data, we obtain the data feature of the j-th expressway in the i-th province on the z-th day as {psd}. ij z ,w ij z }; Step A6: Generate the historical data feature u for day z from the features constructed in step A5. ij z ={psd ij z ,w ij z }, and compared with the actual number of emergencies on the z-th day in history. ij z Constituting data r ij z =(u ij z ,act ij z Since it is necessary to piece together historical traffic data from the past seven days as the features for that day, we can obtain historical traffic features from day 1+7 to the present. The resulting dataset R is constructed by further integrating the data. ij ={r ij z The dataset is set to |z=1,...l-7} and divided into training set R1, test set R2, and validation set R3 in a 3:1:1 ratio, and stored in their respective folders.
3. The integrated method for predicting and detecting high-speed traffic emergencies according to claim 2, characterized in that, Step B specifically includes the following steps: Step B1: Take the dataset R={r} obtained in step A. ij z |z=1,...l-7}, where r ij z =(u ij z ,act ij z ), eigenvalue u ij z This represents the characteristics of daily emergencies and the percentage of bad weather on day z for the j-th expressway in the i-th province over the past 7 days, with a target value of act. ij z This represents the actual number of traffic accidents that occurred on the j-th expressway in the i-th province on the z-th day; Step B2: By using a loss function, the parameters in the LR linear regression network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches the required number of iterations and the improvement in model accuracy is less than 0.05, the model training is terminated, and the trained LR linear regression network model is obtained. The model is then validated using the test set R2, and the output m1 of the LR linear regression network model is obtained. Step B3: By using a loss function, the parameters in the KNN nearest neighbor algorithm network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches the required number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained KNN nearest neighbor algorithm network model is obtained. The model is then validated using the test set R2, and the output m2 of the KNN nearest neighbor algorithm network model is obtained. Step B4: By using a loss function, the parameters in the DT decision tree algorithm network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches the required number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained DT decision tree algorithm network model is obtained. The model is then validated using the test set R2, and the output m3 of the DT decision tree algorithm network model is obtained. Step B5: By using a loss function, the parameters in the SVM support vector machine network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches the required number of iterations and the improvement in model accuracy is less than 0.05, the model training is terminated, and the trained SVM support vector machine network model is obtained. The model is then validated using the test set R2, and the output m4 of the SVM support vector machine network model is obtained. Step B6: By using a loss function, the parameters in the LSTM long short-term memory network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches the required number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained LSTM long short-term memory network model is obtained. The model is then validated using the test set R2, and the output m5 of the LSTM long short-term memory network model is obtained. Step B7: By using a loss function, the parameters in the Seasonal_decompose network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches the required number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained Seasonal_decompose network model is obtained. The model is then validated using the test set R2, and the output m6 of the Seasonal_decompose network model is obtained. Step B8: By using a loss function, the parameters in the AdaBoost ensemble learning network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches the required number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained AdaBoost ensemble learning network model is obtained. The model is then validated using the test set R2, and the output m7 of the AdaBoost ensemble learning network model is obtained. Step B9: By using a loss function, the parameters in the GBDT ensemble learning network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches the required number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained GBDT ensemble learning network model is obtained. The model is then validated using the test set R2, and the output m8 of the GBDT ensemble learning network model is obtained. Step B10: By using a loss function, the parameters in the RF ensemble learning network model are iteratively updated using backpropagation to minimize the loss function and train the model. When the model reaches the required number of iterations and the model accuracy improvement is less than 0.05, the model training is terminated, and the trained RF ensemble learning network model is obtained. The model is then validated using the test set R2, and the output m9 of the RF ensemble learning network model is obtained. Step B11: By using a loss function, the parameters in the XGBoost ensemble learning network model are iteratively updated using backpropagation to minimize the loss function during training. Training is terminated when the model reaches the required number of iterations and the improvement in model accuracy is less than 0.05, resulting in a trained XGBoost ensemble learning network model. The model is then validated using the test set R2, yielding the output m of the XGBoost ensemble learning network model. 10 ; Step B12: Organize the output results obtained in steps B1 to B10 to obtain the output data set Om for day z of each base model. z = {m1 z m2 z ,...,m 10 z }, thus obtaining the data result set M={Om z |z=1,...l-7}.
4. The integrated method for predicting and detecting high-speed traffic emergencies according to claim 3, characterized in that, Step C specifically includes the following steps: Step C1: Using the output data set M obtained in step B as the feature value and the actual number of traffic accidents act as the target value, we obtain data H. z =(Om z ,act z This generates the dataset H={h1,h2,...,h...}. l-7 }; Step C2: Use the dataset H obtained in step C1 as the input of the AdaBoost ensemble learning network model, i.e. the meta-model of ensemble learning. By using the loss function, the parameters in the AdaBoost ensemble learning network model are continuously updated through backpropagation to minimize the loss function and train the model. When the model reaches the number of iterations and the model accuracy improvement is less than 0.03, the model training is terminated, and the trained AdaBoost ensemble learning network model is obtained. Step C3: Validate the AdaBoost ensemble learning network model trained in step C2 using the test set R2 and the validation set R3; calculate the accuracy and mean absolute error using the predicted number of traffic accidents Pre and the actual number of traffic accidents act.
5. The integrated method for predicting and detecting high-speed traffic emergencies according to claim 4, characterized in that, Step D specifically includes the following steps: Step D1: Acquire real-time road condition images through highway cameras. The set V of road condition video data captured by t road detection point cameras on each highway. ij x ={v ij x , x=1,2,...,t=; Step D2: Iterate through all video files V from step D1 to obtain the footage of the captured road segment. Every hour on the hour, randomly extract footage from the x-th camera. To avoid errors caused by model recognition mistakes, extract any 10 footage P from the most recent 5 minutes. ij x ={p1,p2,...,p 10 }; Step D3: Process the ten images P extracted in step D2 using ResNet101. ij x ={p1,p2,...,p 10 Perform weather identification; finally, use the identified weather data to make a voting decision, and obtain the real-time weather conditions (wea) for the x' segment of the j-th highway in the i-th province. x' ij ; Step D4: Analyze the weather conditions (Wea) of all tested sections of the highway obtained in Step D3. ij ={wea x' ij The percentage of bad weather on the highway that day is calculated based on |x'=1,...,t}. ij Meanwhile, the number of traffic accidents on this highway over the past seven days was compiled into a PSD file. ij ={d ij 1 ,....,d ij 7 Feature concatenation is performed to obtain the data (psd'). ij rate ij ); Step D5: Input the data obtained in step D4 into multiple base models trained in step B, and obtain the output set Om = {m1, m2, ..., m} of each base model. 10 }; Step D6: Input the data obtained in step D5 into the AdaBoost ensemble learning network model trained in step C to obtain the prediction result Pre for the sudden event on this highway. Step D7: Based on the prediction results obtained in step D6 and the number of possible emergencies, adjust the frequency of reminders, including those from radio stations, billboards, and toll stations, to help drivers take precautions. At the same time, send the data to the transportation department and emergency response department to conduct inspections and develop contingency plans, thereby reducing the occurrence of traffic accidents and the number of traffic accident casualties.
6. The integrated method for predicting and detecting high-speed traffic emergencies according to claim 5, characterized in that, Step E specifically includes the following steps: Step E1: Preprocess the image dataset Dc collected by the cameras on the highway to obtain a cropped image dataset Dc of uniform size on the highway. Step E2: Using a data annotation tool, the positions of license plates in the image dataset Dc after image preprocessing in Step E1 are annotated to obtain the accurate position of the license plate of each vehicle in each image, and the coordinate file Fc corresponding to the image dataset Dc on the highway is generated; and the dataset is divided into training, testing and validation sets in a 3:1:1 ratio. Step E3: Download the open-source YOLO v6 detector and its pre-trained weights. Use the training set and test set obtained in step E2 to train the YOLO v6 model. Stop training when the accuracy of the validation set reaches 95%. Step E4: Use the YOLO v6 detector trained in step E3 for accurate license plate localization, select and outline the specific location of the license plate, and train the license plate detection using the text detection model in PaddleOCR to obtain the license plates of passing vehicles. Step E5: Calculate the distance di between two adjacent highway cameras, and based on this, obtain the set of distances DI = {di1, di2, di3} for all adjacent highway cameras along the entire highway. ... ,di c }, di q This represents the distance between camera q and camera q+1; Step E6: Calculate the set of minimum speeds for all road segments of all adjacent highway cameras, S = {s1, s2, s3}. ... ,s c }, where s q Indicates di q with di q+1 Minimum speed between road sections; Step E7: The set of distances between adjacent high-speed cameras obtained in step E5, DI = {di1, di2, di...} ... ,di c The set of minimum speeds for all road segments obtained in step E6 is S={s1,s2,s...} ... ,s c The calculation is performed to obtain the minimum time for the vehicle to travel from camera q to camera q+1, resulting in the minimum time set TI={ti1,ti2,ti...} ... ,ti c }; Step E8: Using the vehicle license plate recognition model obtained in steps E1-E4, record each vehicle that passes through the highway camera. Using the minimum arrival time of the vehicle from the section between camera q and camera q+1 obtained in step E7, if a vehicle passing through the camera does not arrive at the predetermined time and does not exit the toll station between the section between camera q and camera q+1, it indicates that the vehicle may have an anomaly in the section between camera q and camera q+1, and a sudden event may have occurred.
7. The integrated method for predicting and detecting high-speed traffic emergencies according to claim 6, characterized in that, Step F specifically includes the following steps: Step F1: Collect one image O of the highway without vehicles taken by each camera on the highway, resulting in a set O={o1,o2,o3} of clean, vehicle-free images captured by cameras on all sections of the highway. ... ,o all }; Step F2: Capture image frames Pic from the highway cameras every ten seconds; where the e-th camera obtains the current image frame Pic. e And the e-th camera image without a vehicle collected in step F1. e Calculate image frame Pic using OpenCV e With image frame o e Difference value Diff e ; Step F3: Diff, the difference value obtained in step F2 e Pic', the image frame calculated from the first ten seconds of the camera. e With image frame o e The calculated difference value Diff' e The difference between the two is calculated and compared. Step F4: When the difference between the two calculated in step F3 is higher than the preset value and Diff e If the value is not zero, it indicates that there is an abnormal vehicle in the frame and it has not moved for ten seconds. This suggests that there may be an abnormal vehicle in the camera's field of view, and a sudden event may have occurred.
8. An integrated system for predicting and detecting sudden traffic incidents on highways, characterized in that, It includes a memory, a processor, and computer program instructions stored in the memory and executable by the processor, which, when executed by the processor, enable the implementation of the steps of the method as described in any one of claims 1-7.