Vehicle position prediction and abnormity early warning method, system and device based on time-space state enhanced XGBoost-LSTM, and medium
By using the XGBoost-LSTM model with space-time state enhancement in vehicle position prediction, combining the time state matrix and spatial state matrix, the problems of insufficient data mining and insufficient response to dynamic changes in traffic states in the existing methods are solved, and higher prediction accuracy and abnormal event analysis and accuracy are achieved.
Patent Information
- Application Number
- CN202411890017.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-22
AI Technical Summary
The existing vehicle position prediction methods lack in-depth mining of the data itself and the correlation between the data, resulting in waste and redundancy of data, and cannot effectively reflect the dynamic changes in traffic state, resulting in insufficient prediction accuracy and inaccurate analysis and judgment of abnormal events.
The XGBoost-LSTM model based on space-time state enhancement is adopted. By constructing the time state matrix and the spatial state matrix, combining integrated learning and deep learning models, the vehicle's own data and the spatial-temporal characteristics of the road network are analyzed, and the prediction accuracy and accuracy of abnormal events are improved.
It improves the accuracy and robustness of vehicle position prediction, enhances the ability to capture dynamic changes in traffic states, improves the efficiency and accuracy of abnormal events, and expands the use scenarios of prediction methods.
Smart Images

Figure CN119862512A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of traffic prediction, and in particular to a vehicle position prediction and abnormal warning method, system, device and medium based on spatiotemporal state enhanced XGBoost-LSTM. Background Art
[0002] With the continuous development of urban transportation, problems such as traffic congestion and traffic accidents are becoming increasingly serious. The emergence of intelligent transportation systems provides new ideas and methods to solve these problems. Vehicle position prediction is one of the key technologies of intelligent transportation systems, which can provide important information support for traffic management, route planning, signal control, etc.
[0003] The continuous development of sensor technology, satellite positioning technology, communication technology, etc. has made the collection of vehicle location data and basic traffic parameters more accurate, real-time and comprehensive. However, while the amount and quality of data have increased, the existing vehicle location prediction lacks in-depth mining of the data itself and the relationship between data, resulting in data waste and redundancy. The inherent spatiotemporal properties of road network traffic are also widely used in the prediction field, but the existing prediction methods are usually limited to fixed state division modes and cannot reflect the dynamic changes of traffic conditions. In addition, the commonly used abnormal event analysis method based on static thresholds is also inconsistent with the dynamic properties of traffic, and has the problems of inaccurate event positioning and delayed analysis.
[0004] Chinese patent publication number CN111263326B discloses a vehicle position prediction method based on multiple fused convolutional GRU, which includes constructing a prediction model for vehicle position; training the prediction model for vehicle position using training set data; inputting test set data into the trained prediction model for vehicle position to calculate the predicted value of vehicle position; the prediction model includes a first fusion layer, a second fusion layer and an output layer, and each layer is connected in sequence, and the output of the previous layer is the input of the next layer; two bidirectional GRU layers are serially fused together through three convolutional layers, and the long-term dependency loss problem of GRU in time series analysis is solved by simultaneously identifying sequence features and context features in the form of fused convolution. The model has good convergence and accuracy, so that the prediction of vehicle position has higher accuracy and better performance.
[0005] Chinese patent publication number CN115099308B discloses a vehicle next position prediction method based on segmented trajectory clustering, which method includes the following steps: S1: trajectory segmentation, given a vehicle v aOriginal trajectory sequence, extract the key positions in the trajectory, that is, the trajectory turning points, to obtain piecewise linear sub-trajectories; S2: Sub-trajectory clustering, classify sub-trajectories with similar characteristics, that is, cluster sub-trajectories on the same road or in the same direction whose distance and angle are less than the preset value, and obtain the position and time information of each cluster center point; S3: Based on the above-mentioned segmented clustering results of historical trajectory data, according to the cluster center point moving time difference model, it uses the shortest moving time from the passed cluster center point to the candidate next cluster center point and its actual moving time difference to predict the next cluster center point, that is, the next position prediction.
[0006] Chinese patent publication number CN117671938A discloses a method for predicting the position of vehicles on the way on a highway, which includes obtaining the original trajectory data of the target vehicle from ETC data; performing time dimension stabilization processing on the original trajectory data of the target vehicle to obtain vehicle trajectory point data that is uniform in the time dimension; performing space dimension stabilization processing on the uniform vehicle trajectory point data so that the distance between the vehicle and the gantry is mapped to the change in the vehicle position at adjacent moments, and obtaining the data after time and space dimension stabilization processing after ADF test; constructing a vehicle position prediction model based on L1 regularization DLCNN-LSTM-Attention; using mean square error as the loss function, using Adam optimizer to train the vehicle position prediction model to obtain the optimal model; inputting the time and space dimension stabilization processing data to be predicted into the optimal model to obtain the predicted vehicle position.
[0007] In summary, most of the current research on vehicle location prediction only focuses on the vehicle data itself, ignoring the spatiotemporal operation status of the vehicle in the traffic area, and therefore lacks scalability in complex traffic scenarios. Although deep learning algorithms are considered to have good results in vehicle location prediction, pure deep learning algorithms have poor interpretability and difficulty in integrating with traffic field knowledge, which also leads to limited improvement in their prediction accuracy. In addition, many studies ignore the application value of vehicle location prediction results and lack practical connections with fields such as traffic supervision. Summary of the invention
[0008] The purpose of the present invention is to provide a vehicle position prediction and abnormal warning method, system, device and medium based on spatiotemporal state enhanced XGBoost-LSTM. The present invention can make up for the problems of single input data, shallow traffic data mining, low utilization rate and so on of traditional vehicle position prediction methods, further improve the accuracy of vehicle position prediction, lower the threshold of data collection, expand the application scenarios of prediction methods, and provide a new dynamic evaluation standard for abnormal event warning, thereby improving the intelligent level of traffic management.
[0009] To achieve the above purpose, the technical solution provided by the present invention is:
[0010] The present invention is achieved through the following technical solutions:
[0011] The first aspect of the present application provides a vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM, comprising:
[0012] S1: Construct the time state matrix:
[0013] The road network in the prediction area is divided into sections according to intersections, and the monitoring equipment obtains the historical vehicle identification data of the intersections to obtain the traffic flow sequence of the section;
[0014] Construct an EM clustering model, use the historical traffic flow sequences of each road section to classify the time periods, classify the traffic flow sequence samples in the EM clustering model, obtain the corresponding relationship between each time period and the traffic state of the road section, extract multi-scale time features based on time parameters, and construct a time state matrix;
[0015] S2: Construct the space state matrix:
[0016] Obtain the road network topology through map data and determine the physical static adjacency matrix between road sections according to the vehicle's driving direction;
[0017] Combined with historical vehicle recognition data, the ratio of traffic flow in different directions of the road section within the observation time step to the total vehicle flow is calculated to form a dynamic turn ratio adjacency matrix. At the same time, the similarity of flow change curves between different sections is calculated to form a dynamic similarity matrix of section flow.
[0018] The physical static adjacency matrix, dynamic turn ratio adjacency matrix and section flow dynamic similarity matrix are weightedly fused, and the final prediction error is used as the evaluation index to construct the spatial state matrix, and the optimal weight coefficient is selected through grid search.
[0019] S3: Model training:
[0020] Obtain the GPS history information of the sample vehicle, and determine the observation time point and prediction area based on the appearance location and time of the sample vehicle;
[0021] Construct vehicle driving training features to form a source data set for model training;
[0022] Build XGBoost model and model training, build XGBoost-LSTM model and model training;
[0023] S4: Real-time vehicle location prediction and abnormal warning:
[0024] The constructed time state matrix and space state matrix are input into the trained XGBoost-LSTM model to perform real-time vehicle position prediction and abnormal warning.
[0025] To optimize the above technical solutions, the specific measures taken also include:
[0026] The method of obtaining the road section traffic flow sequence specifically comprises: cleaning the vehicle passing data with repeated license plates in the historical vehicle passing recognition data of the intersection, and processing the historical vehicle passing recognition data into a road section traffic flow sequence with a fixed step length in units of road sections; the method of constructing the EM clustering model comprises: selecting the optimal number of clusters, treating each cluster as a Gaussian model, initializing the model parameters, and iterating the expected step processing and the maximization step processing until convergence to obtain the optimal model parameters.
[0027] Furthermore, the construction of vehicle driving training features is specifically as follows: a maximum prediction time threshold is set, and for position information pairs whose collection time difference is less than the maximum prediction time threshold, the time interval and longitude and latitude difference between the two information collection points are calculated to form a new vehicle driving feature sample, and at the same time, the time state matrix is calculated according to the observation time point, and the spatial state matrix within the prediction area is constructed, which together with the vehicle driving feature sample constitutes the source data set.
[0028] Furthermore, the construction of the XGBoost model is specifically as follows: for a given data set with n examples and m features The prediction output is the sum of K decision trees:
[0029]
[0030] in, is the space of classification and regression trees, and each f k Corresponding to an independent tree structure q and leaf weight w;
[0031] The XGBoost model is trained as:
[0032] Initialize a simple weak learner and perform multiple rounds of iterations. In each round, calculate the loss function, obtain the gradient and second-order derivative of the sample and build a new decision tree. Use a greedy algorithm to select the optimal split point to reduce the loss function as quickly as possible. Add the new decision tree to the model, linearly combine it with the previous weak learner, and update the model parameters until the stopping condition is met.
[0033] Furthermore, the construction of the XGBoost-LSTM model is specifically as follows: based on the original input features, the output result of the XGBoost model is used as an additional input of the LSTM model, and an input layer with a dimension of m+1 is defined; the appropriate number of LSTM layers and the number of units in each LSTM layer are selected; the output layer is a 2-dimensional vector, representing longitude and latitude; the final prediction output result is the weighted prediction value output by the XGBoost model and the LSTM model;
[0034] The XGBoost-LSTM model is trained as:
[0035] The training data is input into the model. The LSTM model processes the input sequence through the gating mechanism, updates the cell state and hidden state, and obtains the output prediction value; compares the predicted value with the true target value, calculates the loss function gradient, and updates the model parameters through the back propagation algorithm until the set number of rounds or performance is reached.
[0036] Furthermore, the real-time vehicle position prediction and abnormal warning are as follows:
[0037] Step (1): Use GPS equipment to obtain the time, location, and speed information of the historical information collection of the vehicle to be predicted in real time, obtain the corresponding time state matrix and space state matrix according to the time, expected prediction time interval, and historical location, and construct them into real-time input features;
[0038] Step (2): Real-time vehicle position prediction. The time state matrix, space state matrix, real-time information and expected prediction time interval are input into the trained XGBoost-LSTM model to perform real-time vehicle position prediction and obtain the next step of vehicle prediction position.
[0039] Step (3): When the target vehicle updates its actual position information, the vehicle and road conditions are analyzed based on the error between the actual position and the predicted result, and abnormal warnings are issued for abnormal vehicle driving behavior and abnormal road congestion.
[0040] The method for obtaining the source data set for model training is as follows: obtaining historical information of sample vehicles in the selected prediction area, including the information collection time, longitude and latitude, and driving speed of the vehicles, and setting a maximum prediction time threshold. For position information pairs whose collection time difference is less than the maximum prediction time threshold, the time interval and longitude and latitude difference between the two information collection points are calculated, and a new source data set is formed together with the spatiotemporal state matrix. The source data set is divided into a training set and a test set in proportion, and the XGBoost-LSTM model is trained and tested.
[0041] The second aspect of the present application provides a vehicle position prediction and abnormal warning system based on spatiotemporal state enhancement XGBoost-LSTM, including:
[0042] A spatiotemporal state matrix construction module is used to construct a time state matrix and a space state matrix;
[0043] XGBoost-LSTM model building module, used to build and train XGBoost-LSTM models;
[0044] The real-time vehicle location prediction and abnormal warning module is used to input the constructed time state matrix and space state matrix into the trained XGBoost-LSTM model to perform real-time vehicle location prediction and abnormal warning;
[0045] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM as described above is implemented.
[0046] The fourth aspect of the present application provides a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the vehicle position prediction and abnormal warning method based on spatiotemporal state enhancement XGBoost-LSTM as described above.
[0047] Compared with the prior art, the present invention has the following beneficial effects:
[0048] The present invention combines traffic field knowledge with integrated learning and deep learning models, considers the spatial and temporal characteristics of the road network where the vehicle is located while analyzing the vehicle's own data, improves the vehicle position prediction accuracy, and applies the prediction results to subsequent abnormal event analysis; specifically, firstly, the time period state is divided by EM clustering according to the intersection flow, and then the time state matrix is constructed with the aid of time characteristics; then, the physical static adjacency matrix, the dynamic turning ratio adjacency matrix and the section flow dynamic similarity matrix are constructed, and the spatial state matrix is obtained by weighted fusion; then, the vehicle driving feature samples and the spatiotemporal state matrix are calculated to form a source data set for training the XGBoost-LSTM prediction model; finally, the real-time data of the predicted vehicle is input into the model to obtain the next vehicle predicted position, and the error between the actual value and the predicted value is compared for abnormal analysis and early warning, which effectively improves the vehicle prediction accuracy and the efficiency of abnormal event analysis.
[0049] The solution of the present invention fully considers the static and dynamic adjacency relationship between roads and the multi-scale time state change law of the roads themselves on the basis of the prediction model, breaks through the limitation of physical adjacency relationship, deepens the mining of basic traffic data, and improves data utilization and vehicle position prediction accuracy. Traditional vehicle position prediction methods often take the acquired single-point position information as an independent sample, ignoring the importance of time information and time scale in prediction. This method constructs information association between points by calculating the time interval and longitude and latitude difference between information collection points within the maximum threshold, and increases the data sample size without increasing the collection cost, enriches the time scale of the model training data set, and improves the prediction accuracy of the model.
[0050] This method uses the EM clustering algorithm to divide the time state of the road section, breaking the traditional morning and evening peak division mode and realizing personalized analysis of the road section. At the same time, using the clustering method based on latent variable parameter learning, it attempts to capture the influence of other factors that are difficult to collect (such as weather, POI, etc.) from the traffic data that can be collected, thereby improving the accuracy of time state division, lowering the threshold for data collection, and expanding the use scenarios of the prediction method.
[0051] This method uses the XGBoost-LSTM model to combine the advantages of ensemble learning and recurrent neural networks. It can make full use of the potential features in multidimensional variables, capture the dependencies in time series data, and weaken the impact of outliers on the final results through weighting, further improving the accuracy and robustness of vehicle position prediction.
[0052] Traditional abnormality analysis and early warning methods often use fixed thresholds for simple judgment. This method uses real-time location prediction results as the basis for abnormal event analysis. Different times, locations, and vehicles have their own unique threshold standards, which increases the flexibility and accuracy of the analysis method. At the same time, through the behavior analysis of different vehicles on the same road section, for abnormal event points, it can be determined whether the abnormality is an individual problem (such as vehicle failure) or a group problem (such as road congestion), which helps management departments to accurately handle and dispatch. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 :A flow chart of the vehicle position prediction and abnormal warning method based on spatiotemporal state enhancement XGBoost-LSTM of the present invention.
[0054] Figure 2 : Schematic diagram of the module structure of the vehicle position prediction and abnormal warning system based on spatiotemporal state enhancement XGBoost-LSTM of the present invention. DETAILED DESCRIPTION
[0055] The above contents of the present invention are further described in detail below in the form of embodiments, but this should not be understood as the scope of the above subject matter of the present invention being limited to the following embodiments, and all technologies realized based on the above contents of the present invention belong to the scope of the present invention.
[0056] Some of the terms involved in the solution of the present invention are explained as follows:
[0057] XGBoost (eXtreme Gradient Boosting): is an efficient machine learning algorithm, a branch of the Boosting algorithm in ensemble learning. It gradually improves the performance of the model by continuously adding new weak learners (usually decision trees), can effectively fit complex data patterns, and has good predictive capabilities for various types of data.
[0058] LSTM (Long Short-Term Memory): is a common variant of recurrent neural network. LSTM has better long-term dependency modeling capabilities, can effectively process dependencies in time series data, and effectively transmit information in time series. Therefore, it is widely used in time series prediction problems.
[0059] EM clustering (Expectation-Maximization Clustering): is a clustering method based on a probability model, which usually assumes that the data obeys a Gaussian mixture model. The E step is responsible for calculating the posterior probability that each data point belongs to each cluster based on the current model parameters. The M step updates the model parameters based on the posterior probability obtained in the E step to maximize the likelihood function of the data. Repeat the E step and the M step until the model converges and the final clustering result is obtained.
[0060] In one embodiment of the present invention, a vehicle position prediction and abnormal warning method based on spatiotemporal state enhancement XGBoost-LSTM is proposed, and the flow chart is as follows: Figure 1 As shown, the following steps are included:
[0061] S1: Construct the time state matrix:
[0062] The road network in the prediction area is divided into sections according to intersections, and the monitoring equipment obtains the historical vehicle identification data of the intersections to obtain the traffic flow sequence of the section;
[0063] Construct an EM clustering model, use the historical traffic flow sequences of each road section to classify the time periods, classify the traffic flow sequence samples in the EM clustering model, obtain the corresponding relationship between each time period and the traffic state of the road section, extract multi-scale time features based on time parameters, and construct a time state matrix;
[0064] S2: Construct the space state matrix:
[0065] Obtain the road network topology through map data and determine the physical static adjacency matrix between road sections according to the vehicle's driving direction;
[0066] Combined with historical vehicle recognition data, the ratio of traffic flow in different directions of the road section within the observation time step to the total vehicle flow is calculated to form a dynamic turn ratio adjacency matrix. At the same time, the similarity of flow change curves between different sections is calculated to form a dynamic similarity matrix of section flow.
[0067] The physical static adjacency matrix, dynamic turn ratio adjacency matrix and section flow dynamic similarity matrix are weightedly fused, and the final prediction error is used as the evaluation index to construct the spatial state matrix, and the optimal weight coefficient is selected through grid search.
[0068] S3: Model training:
[0069] Obtain the GPS history information of the sample vehicle, and determine the observation time point and prediction area based on the appearance location and time of the sample vehicle;
[0070] Construct vehicle driving training features to form a source data set for model training;
[0071] Build XGBoost model and model training, build XGBoost-LSTM model and model training;
[0072] S4: Real-time vehicle location prediction and abnormal warning:
[0073] The constructed time state matrix and space state matrix are input into the trained XGBoost-LSTM model to perform real-time vehicle position prediction and abnormal warning.
[0074] The technical solution of the present invention is further described in detail below in conjunction with specific embodiments:
[0075] The scheme of the present invention includes four stages: time state matrix construction, space state matrix construction, XGBoost-LSTM model training, real-time vehicle position prediction and abnormal warning. The specific steps are as follows:
[0076] (I) Construction of time state matrix
[0077] Step 1: Prepare a vehicle passing data set. Divide the road network in the prediction area into sections according to intersections, and obtain the historical vehicle passing identification data of each intersection through checkpoint cameras or radars, including checkpoint number, license plate number, checkpoint passing time, checkpoint passing instantaneous speed, etc.
[0078] Step 2: Data cleaning and feature construction. After completing data collection, the vehicle passing data with duplicate license plates is cleaned, and the historical vehicle passing recognition data is processed into a fixed-step traffic flow sequence on a road section basis.
[0079] Step 3: Construct the EM clustering model. First, the optimal number of clusters is selected by combining the Davies-Bouldin Index, Dunn Index, and Silhouette Coefficient. Each cluster is regarded as a Gaussian model. After initializing the model parameters, the optimal model parameters are obtained by iterating the expectation step and the maximization step until convergence.
[0080] Step 4: Time state matrix construction. The historical traffic flow sequences of each road section are used to classify the time periods, and the samples are classified in the EM clustering model to obtain the corresponding relationship between each time period and the traffic state of the road section, and then multi-scale time features are extracted by combining time parameters such as day, week, month, and year.
[0081] (II) Construction of spatial state matrix
[0082] Step 1: Static matrix construction. Obtain the road network topology through map data, and determine the physical static adjacency matrix between road sections according to the vehicle driving direction.
[0083] Step 2: Dynamic matrix construction. Combined with the historical vehicle recognition data, the ratio of traffic flow in different directions of the road section within the observation time step to the total vehicle flow is calculated to form a dynamic turn ratio adjacency matrix. At the same time, the similarity of flow change curves between different sections is calculated to form a dynamic similarity matrix of section flow.
[0084] Step 3: Spatial state matrix feature fusion. The three spatial matrices in steps 1 and 2 are weighted fused, and the final prediction error is used as the evaluation index. The optimal weight coefficient is selected through grid search.
[0085] (III) XGBoost-LSTM model training
[0086] Step 1: Training data preparation. Obtain the GPS historical information of the sample vehicle, including the vehicle's information collection time, longitude and latitude, and driving speed, and determine the observation time point and prediction area based on the appearance location and time of the sample vehicle.
[0087] Step 2: Training feature construction. Set the maximum prediction time threshold, and for the location information pairs whose collection time difference is less than the maximum prediction time threshold, calculate the time interval and longitude and latitude difference between the two information collection points to form a new vehicle driving feature sample. At the same time, calculate the time state matrix based on the observation time point, construct the spatial state matrix in the prediction area, and form the source data set together with the vehicle driving feature sample.
[0088] Step 3: Build the XGBoost model. For a given dataset with n examples and m features The prediction output is the sum of K decision trees:
[0089]
[0090] in, is the space of Classification and Regression Tree, and each f k Corresponding to an independent tree structure q and leaf weight w.
[0091] Step 4: Build the XGBoost-LSTM model. Based on the original input features, the output of the XGBoost model is used as an additional input to the LSTM model, and an input layer with a dimension of m+1 is defined. Secondly, the appropriate number of LSTM layers and the number of units in each LSTM layer are selected. The output layer is a 2-dimensional vector (latitude and longitude), and the final prediction output result is the weighted prediction value output by the XGBoost model and the LSTM model.
[0092] Step 5: XGBoost model training. Initialize a simple weak learner, perform multiple rounds of iterations, calculate the loss function in each round, obtain the gradient and second-order derivative of the sample and build a new decision tree, and use the greedy algorithm to select the optimal split point to reduce the loss function as quickly as possible. Add the new decision tree to the model, linearly combine it with the previous weak learner, and update the model parameters until the stopping condition is met.
[0093] Step 6: XGBoost-LSTM model training. The training data is input into the model. The LSTM model processes the input sequence through the gating mechanism, updates the cell state and hidden state, and obtains the output prediction value. The predicted value is compared with the true target value, the loss function gradient is calculated, and the model parameters are updated through the back propagation algorithm until the set number of rounds or performance is reached.
[0094] (IV) Real-time vehicle location prediction and abnormal warning
[0095] Step 1: Real-time input feature construction. Use GPS equipment to obtain the time, location, and speed information of the historical information collection of the vehicle to be predicted in real time, and obtain the corresponding time state matrix and space state matrix according to the time, expected prediction time interval, and historical location.
[0096] Step 2: Real-time vehicle position prediction. The vehicle spatiotemporal state matrix, real-time information, and expected prediction time interval are input into the trained XGBoost-LSTM model to finally obtain the next step of vehicle prediction position.
[0097] Step 3: Abnormal warning. When the target vehicle updates its actual position information, the vehicle and road conditions are analyzed based on the error between the actual position and the predicted result, and warnings are issued for abnormal vehicle driving behavior and abnormal road congestion.
[0098] The solution of the present invention analyzes the spatiotemporal state of the road network based on the vehicle passing data and vehicle GPS data, realizes high-precision, multi-scale vehicle position prediction, and further uses the predicted value as a benchmark for abnormal event analysis, thereby realizing more flexible and accurate dynamic abnormality warning. The process of a specific embodiment is illustrated as follows:
[0099] 1. Divide the road network in the selected prediction area into sections according to intersections. Obtain the historical vehicle identification data of each intersection through checkpoint cameras or radars, including checkpoint number, license plate number, checkpoint time, instantaneous speed, etc., and process them into a total traffic flow sequence of the section with a fixed step length as the data source for time state clustering.
[0100] 2. According to the characteristics of the data source and the clustering effect, the optimal number of clusters and the training stop condition of EM clustering are determined, and the data source samples are classified in the EM clustering model to obtain the corresponding relationship between each time period and the traffic status of the road section, and then the multi-scale time features are extracted by combining time parameters such as day, week, month, and year.
[0101] 3. Obtain the topological structure of the selected road network prediction area through map data, and determine the physical static adjacency matrix between road sections according to the vehicle driving direction.
[0102] 4. Combined with the historical vehicle identification data in step 1, calculate the ratio of traffic flow in different directions of the road section within a fixed time step to the total traffic flow to form a dynamic turn ratio adjacency matrix. At the same time, calculate the similarity of flow change curves between different road sections to form a dynamic similarity matrix of road section flow.
[0103] 5. Use the grid search method to determine the optimal weight coefficient, weightedly fuse the three spatial matrices in steps 3 and 4, and obtain a new spatial state matrix as one of the inputs of the XGBoost-LSTM prediction model.
[0104] 6. XGBoost-LSTM model construction. First, build an XGBoost regression prediction model, and then use the prediction results of XGBoost as additional inputs and input them into the LSTM model together with the original features for prediction. Select the appropriate number of LSTM layers and the number of units in each LSTM layer after the input layer. The output layer is a 2D vector (latitude and longitude), and the final prediction output result is the weighted prediction value output by the XGBoost model and the LSTM model.
[0105] 7. Obtain the historical information of sample vehicles in the selected prediction area, including the vehicle information collection time, longitude and latitude, and driving speed, and set the maximum prediction time threshold. For the location information pairs whose collection time difference is less than the maximum prediction time threshold, calculate the time interval and longitude and latitude difference between the two information collection points, and form a new source data set together with the spatiotemporal state matrix. Divide the source data set into training set and test set in a ratio of 7:3, and train and test the XGBoost-LSTM model.
[0106] 8. For the vehicles that need to be predicted, use the GPS device to obtain the basic information in step 7 in real time and perform corresponding preprocessing. The preprocessed data is input into the trained XGBoost-LSTM to finally obtain the next step of vehicle position prediction results.
[0107] 9. Track the predicted vehicle in real time. When the predicted vehicle updates its actual position information, analyze the vehicle and road conditions based on the error between the actual position and the predicted result, and issue early warnings for abnormal vehicle driving behavior and abnormal road congestion.
[0108] In another embodiment of the present invention, a vehicle position prediction and abnormal warning system based on spatiotemporal state enhancement XGBoost-LSTM is proposed, such as Figure 2 As shown, including:
[0109] A spatiotemporal state matrix construction module is used to construct a time state matrix and a space state matrix;
[0110] XGBoost-LSTM model building module, used to build and train XGBoost-LSTM models;
[0111] The real-time vehicle location prediction and abnormal warning module is used to input the constructed time state matrix and space state matrix into the trained XGBoost-LSTM model to perform real-time vehicle location prediction and abnormal warning;
[0112] In another embodiment of the present invention, an electronic device is proposed, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM as described above is implemented.
[0113] In another embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program, and the computer program enables a computer to execute the vehicle position prediction and abnormal warning method based on spatiotemporal state enhancement XGBoost-LSTM as described above.
[0114] In the embodiments disclosed in the present application, the computer storage medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. The computer storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the above. More specific examples of computer storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0115] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any technician familiar with the profession, without departing from the scope of the technical solution of the present invention, according to the technical essence of the present invention, any simple modification, equivalent replacement and improvement made to the above embodiment still falls within the protection scope of the technical solution of the present invention.
Claims
1. A vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM, characterized in that: include: S1: Construct the time state matrix: The road network in the prediction area is divided into sections according to intersections, and the monitoring equipment obtains the historical vehicle identification data of the intersections to obtain the traffic flow sequence of the section; Construct an EM clustering model, use the historical traffic flow sequences of each road section to classify the time periods, classify the traffic flow sequence samples in the EM clustering model, obtain the corresponding relationship between each time period and the traffic state of the road section, extract multi-scale time features based on time parameters, and construct a time state matrix; S2: Construct the space state matrix: Obtain the road network topology through map data and determine the physical static adjacency matrix between road sections according to the vehicle's driving direction; Combined with historical vehicle recognition data, the ratio of traffic flow in different directions of the road section within the observation time step to the total vehicle flow is calculated to form a dynamic turn ratio adjacency matrix. At the same time, the similarity of flow change curves between different sections is calculated to form a dynamic similarity matrix of section flow. The physical static adjacency matrix, dynamic turn ratio adjacency matrix and section flow dynamic similarity matrix are weightedly fused, and the final prediction error is used as the evaluation index to construct the spatial state matrix, and the optimal weight coefficient is selected through grid search. S3: Model training: Obtain the GPS history information of the sample vehicle, and determine the observation time point and prediction area based on the appearance location and time of the sample vehicle; Construct vehicle driving training features to form a source data set for model training; Build XGBoost model and model training, build XGBoost-LSTM model and model training; S4: Real-time vehicle location prediction and abnormal warning: The constructed time state matrix and space state matrix are input into the trained XGBoost-LSTM model to perform real-time vehicle position prediction and abnormal warning.
2. The vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM according to claim 1 is characterized in that: The method of obtaining the road section traffic flow sequence specifically comprises: cleaning the vehicle passing data with repeated license plates in the historical vehicle passing recognition data of the intersection, and processing the historical vehicle passing recognition data into a road section traffic flow sequence with a fixed step length in units of road sections; the method of constructing the EM clustering model comprises: selecting the optimal number of clusters, treating each cluster as a Gaussian model, initializing the model parameters, and iterating the expected step processing and the maximization step processing until convergence to obtain the optimal model parameters.
3. The vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM according to claim 1 is characterized in that: The construction of vehicle driving training features is specifically as follows: a maximum prediction time threshold is set, and for position information pairs whose collection time difference is less than the maximum prediction time threshold, the time interval and longitude and latitude difference between the two information collection points are calculated to form a new vehicle driving feature sample, and at the same time, the time state matrix is calculated according to the observation time point, and the spatial state matrix in the prediction area is constructed, which together with the vehicle driving feature sample constitutes the source data set.
4. The vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM according to claim 1 is characterized in that: The construction of the XGBoost model is as follows: for a given data set with n examples and m features The prediction output is the sum of K decision trees: in, is the space of classification and regression trees, and each f k Corresponding to an independent tree structure q and leaf weight w; The XGBoost model is trained as: Initialize a simple weak learner and perform multiple rounds of iterations. In each round, calculate the loss function, obtain the gradient and second-order derivative of the sample and build a new decision tree. Use a greedy algorithm to select the optimal split point to reduce the loss function as quickly as possible. Add the new decision tree to the model, linearly combine it with the previous weak learner, and update the model parameters until the stopping condition is met.
5. The vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM according to claim 1 is characterized in that: The construction of the XGBoost-LSTM model is specifically as follows: based on the original input features, the output result of the XGBoost model is used as an additional input of the LSTM model, and an input layer with a dimension of m+1 is defined; the appropriate number of LSTM layers and the number of units in each LSTM layer are selected; the output layer is a 2-dimensional vector representing longitude and latitude; the final prediction output result is the weighted prediction value output by the XGBoost model and the LSTM model; The XGBoost-LSTM model is trained as: The training data is input into the model. The LSTM model processes the input sequence through the gating mechanism, updates the cell state and hidden state, and obtains the output prediction value; compares the predicted value with the true target value, calculates the loss function gradient, and updates the model parameters through the back propagation algorithm until the set number of rounds or performance is reached.
6. The vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM according to claim 1 is characterized in that: The real-time vehicle position prediction and abnormal warning are as follows: Step (1): Use GPS equipment to obtain the time, location, and speed information of the historical information collection of the vehicle to be predicted in real time, obtain the corresponding time state matrix and space state matrix according to the time, expected prediction time interval, and historical location, and construct them into real-time input features; Step (2): Real-time vehicle position prediction: input the time state matrix, space state matrix, real-time information and expected prediction time interval into the trained XGBoost-LSTM model to perform real-time vehicle position prediction and obtain the next step of vehicle predicted position; Step (3): When the target vehicle updates its actual position information, the vehicle and road conditions are analyzed based on the error between the actual position and the predicted result, and abnormal warnings are issued for abnormal vehicle driving behavior and abnormal road congestion.
7. The vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM according to claim 1 is characterized in that: The method for obtaining the source data set for model training is as follows: obtaining historical information of sample vehicles in the selected prediction area, including the information collection time, longitude and latitude, and driving speed of the vehicles, and setting a maximum prediction time threshold. For position information pairs whose collection time difference is less than the maximum prediction time threshold, the time interval and longitude and latitude difference between the two information collection points are calculated, and a new source data set is formed together with the spatiotemporal state matrix. The source data set is divided into a training set and a test set in proportion, and the XGBoost-LSTM model is trained and tested.
8. A vehicle position prediction and abnormal warning system based on spatiotemporal state enhancement XGBoost-LSTM, characterized in that: include: A spatiotemporal state matrix construction module is used to construct a time state matrix and a space state matrix; XGBoost-LSTM model building module, used to build and train XGBoost-LSTM models; The real-time vehicle location prediction and abnormal warning module is used to input the constructed time state matrix and space state matrix into the trained XGBoost-LSTM model to perform real-time vehicle location prediction and abnormal warning; The system is used to execute the vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM as described in any one of claims 1 to 7.
9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the vehicle position prediction and abnormal warning method based on spatiotemporal state enhanced XGBoost-LSTM as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the vehicle position prediction and abnormal warning method based on spatiotemporal state enhancement XGBoost-LSTM as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Vehicle location prediction method based on multi-fusion convolutional GRU
CN111263326B
A vehicle next position prediction method based on segmented trajectory clustering
CN115099308B
Expressway in-transit vehicle position prediction method
CN117671938A
Cited By
Traffic police law enforcement supervision method and device
CN120541674A
Road transport vehicle driving risk uncertainty prediction method and system
CN120808595A
Tidal station water level prediction method based on hybrid adaptive graph structure
CN121071615A
Tide gauge water level prediction method based on hybrid adaptive graph structure
CN121071615B
Traffic condition early warning method and system for smart expressway
CN121096170A