Vehicle driving track prediction method based on Markov algorithm
By preprocessing the historical trajectory data and building a trajectory prediction model based on the higher-order Markov algorithm, the problem of insufficient prediction accuracy of vehicle driving trajectory in the prior art is solved, and higher prediction accuracy and more flexible response capabilities are achieved.
Patent Information
- Application Number
- CN202510128920.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-05
- Publication Date
- 2025-03-11
AI Technical Summary
The existing vehicle driving trajectory prediction methods cannot effectively capture the long-term dependence and complex motion patterns in vehicle movement, resulting in a decrease in the accuracy of the prediction results, especially when there are obvious inertia or regular changes in the vehicle trajectory.
By preprocessing the historical trajectory data and building a trajectory prediction model based on the higher-order Markov algorithm, considering environmental factors and driving behavior, the calculation model order is carried out using an information theory algorithm to construct a state transfer matrix to achieve more accurate trajectory prediction.
Effectively capture the complex laws of vehicle movement, flexibly respond to dynamic changes in the traffic environment, improve prediction accuracy, enhance the ability to capture long-term dependencies of data, avoid overfitting, and achieve more reliable prediction results.
Smart Images

Figure CN119600817A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent transportation technology, and more specifically, to a vehicle driving trajectory prediction method based on a Markov algorithm. Background Art
[0002] With the continuous development of intelligent transportation systems, vehicle trajectory prediction has become an important research direction for improving traffic management efficiency, optimizing road use and improving driving safety. Traditional trajectory prediction methods mostly rely on simple analysis of historical data and are difficult to adapt to complex traffic environments and dynamic changes. As an effective statistical model, the Markov algorithm can model vehicle motion through state transition probabilities, taking into full account driving environment, driving behavior and other influencing factors. Therefore, a vehicle trajectory prediction method based on the Markov algorithm came into being.
[0003] By establishing a Markov model of the vehicle's motion state, the vehicle's future driving path can be accurately predicted, helping the traffic management system to grasp the traffic flow situation in real time, thereby optimizing traffic signal control and reducing traffic congestion; for example, the patent with publication number CN111009126A discloses a vehicle driving trajectory prediction method, system and equipment based on checkpoint capture data; including: obtaining vehicle historical trajectory data; aggregating the vehicle historical trajectory data to obtain trajectory data of each vehicle; aggregating the vehicle historical trajectory data to obtain a vehicle trajectory data set for each time interval; constructing a Markov state transfer matrix of road network vehicles based on the vehicle trajectory data set for each time interval; constructing a Markov state transfer matrix of individual vehicles based on the trajectory data of each vehicle; predicting the probability of passing through each checkpoint based on the Markov state transfer matrix of the individual vehicle and the Markov state transfer matrix of the road network vehicle; this invention can make up for the defect that the current vehicle trajectory prediction method cannot perform personalized prediction.
[0004] However, although the above technology realizes the prediction of vehicle driving trajectory, the Markov model adopted only relies on the current checkpoint state to predict the next checkpoint state of the vehicle, and cannot capture the long-term dependencies and complex motion patterns in the vehicle's driving path, resulting in reduced accuracy of the prediction results, especially when there is obvious inertia or regular changes in the vehicle trajectory; at the same time, the accumulated information of historical data is not fully utilized, which increases the model's sensitivity to abnormal or random changes, thereby affecting the overall prediction effect of the model.
[0005] In view of this, the present invention proposes a vehicle driving trajectory prediction method based on Markov algorithm to solve the above problems. Summary of the invention
[0006] In order to overcome the above-mentioned defects of the prior art and achieve the above-mentioned purpose, the present invention provides the following technical solution: a vehicle driving trajectory prediction method based on Markov algorithm, comprising: S1: Get historical trajectory data; S2: pre-process the historical trajectory data and obtain historical processing data; S3: Build trajectory prediction model based on historical processing data; S4: Collect current trajectory data S5: Input the current trajectory data into the trajectory prediction model to predict the vehicle's driving trajectory.
[0007] Furthermore, the historical trajectory data is m groups of vehicle trajectory data collected at historical moments, the vehicle trajectory data includes license plate information, passing time, checkpoint location and vehicle type, and m is an integer greater than 1; The method for obtaining historical processing data includes: Perform anomaly detection on all data in the historical trajectory data, and determine whether to mark them as abnormal data. Delete the vehicle trajectory data corresponding to the abnormal data from the historical trajectory data to obtain historical normal data; treat the vehicle trajectory data with the same license plate information in the historical normal data as a group of analysis sets, and the analysis set corresponds to the license plate information one by one; sort the vehicle trajectory data in each group of analysis sets from large to small according to the corresponding passing time, and generate a corresponding time sorting table; according to each time sorting table, take two adjacent passing times as a group of time sets in turn, and mark the passing time ranked first in each time sorting table as the end time, and mark the passing time ranked last as the start time; subtract one passing time from another passing time in each group of time sets in turn and take the absolute value to obtain the time difference; A time threshold is preset, and each time difference is compared with the time threshold in turn; if the time difference is greater than or equal to the time threshold, the passing time with a larger value in the time set corresponding to the time difference is marked as the start time, and the passing time with a smaller value is marked as the end time; if the time difference is less than the time threshold, the passing time corresponding to the corresponding time difference is not marked; in each time sorting table, the adjacent start time and end time, as well as all the passing times included in the middle, are taken as a set of trajectory sets in reverse order; the passing time in each set of trajectory sets is replaced with the corresponding vehicle trajectory data, and a set of trajectory sets corresponds to the running trajectory of a vehicle; all trajectory sets are used as historical processing data.
[0008] Furthermore, the method for determining whether to mark as abnormal data includes: Different digital labels are set for different vehicle types and marked as type labels; a data set is preset, the data set includes a checkpoint set and a type set, the checkpoint set includes the numbers corresponding to all checkpoints, and the type set includes the type labels corresponding to all vehicle types; Replace the vehicle type in the historical trajectory data with the corresponding type label; compare each type label in the historical trajectory data with each type label in the type set. If all type labels in the type set are inconsistent with the type labels in the historical trajectory data, the corresponding type label is marked as abnormal data; if there is a type label in the type set that is consistent with the type label in the historical trajectory data, the corresponding type label is not marked; compare each checkpoint position in the historical trajectory data with each checkpoint position in the checkpoint set. If all checkpoint positions in the checkpoint set are inconsistent with the checkpoint positions in the historical trajectory data, the corresponding checkpoint position is marked as abnormal data; if there is a checkpoint position in the checkpoint set that is consistent with the checkpoint position in the historical trajectory data, the corresponding checkpoint position is not marked; Get the timestamp corresponding to the current time point and mark it as the current time; compare the current time with all the passing times in the historical trajectory data in turn; mark the passing times with values greater than or equal to the current time as abnormal data, and do not mark the passing times with values less than the current time.
[0009] Furthermore, the step of constructing a trajectory prediction model includes: Step 1: Define the state space; Step 2: Construct the state transfer matrix; Step 3: Evaluate the trajectory prediction model.
[0010] Furthermore, in step 1, the method of defining the state space includes: Obtain the environmental data corresponding to each set of vehicle trajectory data in the historical processing data; the environmental data includes weather data and road data; the weather data is the information of the meteorological conditions at the location of the vehicle, and the road data is the type of road at the location of the vehicle; set different digital labels for different weather data and mark them as weather labels; set different road labels for different road data and mark them as road labels; replace the weather data in the environmental data with the corresponding weather labels, replace the road data with the corresponding road labels, and mark the replaced environmental data as label data; add each set of label data to the corresponding vehicle trajectory data, mark them as comprehensive trajectory data, and replace the vehicle trajectory data in each set of trajectory sets with the corresponding comprehensive trajectory data; Calculating model order , in each set of trajectories The continuous comprehensive trajectory data is taken as a state set in the state space, and the time corresponding to the comprehensive trajectory data with the largest passing time in each state set is marked as the current time; the state set ;in, is the current state, For the front The state at a moment; ,in, is the license plate information at the current moment, is the passing time at the current moment, is the bayonet position at the current moment, is the type label of the current moment, is the weather label for the current moment, is the road label at the current moment.
[0011] Furthermore, the calculation model order The methods include: Count the number of groups of all comprehensive trajectory data in the historical processing data and mark them as the total number of data; regard the same comprehensive trajectory data in the historical processing data as a group of information sets, and the information sets correspond to the comprehensive trajectory data one by one; count the number of comprehensive trajectory data in each information set and mark them as the number of data sets; calculate the information entropy corresponding to each information set based on the total number of data and the number of data sets; regard the information sets corresponding to the comprehensive trajectory data in the same trajectory set as a group of related sets; regard every two information sets in each related set as a group of associated sets, count the number of all associated sets and mark them as the total number of associated sets, count the number corresponding to each different associated set and mark them as the number of associated sets; calculate the joint entropy of each associated set based on the total number of associated sets and the number of associated sets; According to the information entropy and the joint entropy, the information correlation value of each group of associated sets is calculated; a correlation threshold is preset, and each relevant information value is compared with the correlation threshold; if the relevant information value is greater than or equal to the relevant threshold, the corresponding two groups of information sets are marked as a group of strongly associated sets; if the relevant information value is less than the relevant threshold, the corresponding two groups of information sets are not marked; Count the number of strongly correlated sets in each group of related sets, and mark the smallest number of strongly correlated sets as N; initially set the model order to 1, and gradually increase the model order until the model order is N, count the total number of strong correlations corresponding to each order, and take the order with the largest total number of strong correlations as the model order .
[0012] Further, ; In the formula, is the information entropy corresponding to the i-th information set, is the number of data sets corresponding to the i-th information set, is the total number of data, , is the number of information sets; ; In the formula, is the joint entropy corresponding to the jth group of associated sets, is the number of associations corresponding to the jth association set, is the total number of associations, , that is, the jth association set includes the ith information set and the Group information collection, , is the number of associated sets, ; The expression of information-related value is: ; In the formula, is the information correlation value corresponding to the jth association set, For the The information entropy corresponding to the group information set; The statistical method for the total number of strong correlations is: when the model order is n, , mark a random group of information sets as the current set, and determine whether the n groups of information sets before the current set in the related sets corresponding to the current set are all marked as strongly associated sets with the current set; if so, mark the current set as a statistical set, if not, do not mark the current set; and so on, mark each group of information sets in each group of related sets as the current set in turn, and determine whether it is marked as a statistical set; count the number of statistical sets in all related sets, and mark them as the total number of strong associations.
[0013] Furthermore, in step 2, the method for constructing a state transfer matrix includes: According to each set of trajectories, obtain the state of each state set corresponding to the next moment and mark it as ; The state at the next moment is the comprehensive trajectory data in the corresponding trajectory set, which is adjacent to the comprehensive trajectory data corresponding to the maximum passing time in the state set and is not located in the state set; the state of each next moment and the corresponding state set are taken as the state transfer set; State transition set ; Count the number of each different state set in the state space and mark it as the state frequency; count the number of all state sets in the state space and mark it as the total number of sets; count the number of each different state transition set in all trajectory sets and mark it as the transition frequency; calculate the transition probability corresponding to each state transition set based on the state frequency and transition frequency; the expression of the transition probability is: ; In the formula, For the The transition probability corresponding to the group state transition set, For the The transition frequency corresponding to the group state transition set, For the The state frequency of the group state transition set corresponding to the state set, , is the number of state transition sets, is the smoothing factor, , is the total number of sets; construct the state transfer matrix according to the transition probabilities corresponding to all state transfer sets.
[0014] Furthermore, in step 3, the method for evaluating the trajectory prediction model includes: Re-obtain M groups of vehicle trajectory data and mark them as evaluation data. ; The method of obtaining evaluation data is consistent with the method of obtaining historical trajectory data; Based on the evaluation data, construct The group state collection is marked as an evaluation collection. is an integer greater than 1; based on the evaluation data and the evaluation set, a state transition set corresponding to the evaluation set is constructed and marked as the evaluation transition set; The state sets of each group are input into the trajectory prediction model, and the corresponding state at the next moment is predicted and marked as the predicted state; according to the evaluation transfer set, the state at the next moment corresponding to each state set is obtained and marked as the actual state; the mean square error between each predicted state and the actual state is calculated, and the mean of all mean square errors is used as the loss function value; the optimization algorithm is used to smooth the factor Make multiple adjustments and calculate the corresponding loss function value after each adjustment; set the smoothing factor corresponding to the minimum loss function value As the smoothing factor of the trajectory prediction model; the mean square error between the predicted state and the actual state is the mean square error between the bayonet position in the predicted state and the bayonet position in the actual state; the trajectory prediction model is a Markov model.
[0015] Furthermore, the method for collecting current trajectory data includes: The vehicle whose driving trajectory needs to be predicted is marked as a predicted vehicle; the corresponding license plate information is obtained according to the predicted vehicle, and the corresponding analysis set is obtained according to the license plate information; the vehicle trajectory data with the longest travel time is obtained from the obtained analysis set, and marked as the latest data; and the adjacent vehicles to the latest data are obtained from the obtained analysis set. The vehicle trajectory data is grouped and combined with the latest data to form the current vehicle data; the corresponding environmental data is obtained according to each group of vehicle trajectory data in the current vehicle data; each group of environmental data is added to the corresponding vehicle trajectory data in the current vehicle data to obtain the current trajectory data; According to the current trajectory data, a corresponding state set is constructed and marked as the current state set; the current state set is input into the trajectory prediction model to predict the corresponding predicted state; the state with the smallest travel time in the current state set is replaced with the predicted state, and the replaced current state set is marked as the replacement state set; the replacement state set is then input into the trajectory prediction model to predict the corresponding predicted state again; and so on, a total of D groups of predicted states are predicted, and the checkpoint positions in the D groups of predicted states are obtained to form the vehicle driving trajectory.
[0016] Technical effects and advantages of the vehicle driving trajectory prediction method based on Markov algorithm of the present invention: By preprocessing the historical trajectory data and building a trajectory prediction model based on a high-order Markov algorithm, the complex laws of vehicle movement can be effectively captured, and the dynamic changes of the traffic environment can be flexibly responded to in real-time predictions. Environmental factors and driving behaviors are fully considered to overcome the defects of poor adaptability of traditional prediction methods to complex traffic environments, providing effective technical support for intelligent traffic management. In addition, in the process of building the trajectory prediction model, the information theory algorithm is used to accurately calculate the model order, which can effectively improve the prediction accuracy of the model, enhance the ability to capture long-term data dependencies, avoid overfitting, and ensure that in complex traffic environments, the trajectory prediction model can more accurately reflect the dynamic changes of vehicle driving trajectories, thereby achieving more reliable prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a flow chart of a vehicle driving trajectory prediction method based on a Markov algorithm according to Embodiment 1 of the present invention; Figure 2 This is a flow chart of a trajectory prediction model construction method according to Embodiment 1 of the present invention. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] Example 1 See also Figure 1 As shown, the vehicle driving trajectory prediction method based on the Markov algorithm described in this embodiment includes: S1: Get historical trajectory data.
[0020] The historical trajectory data is m sets of vehicle trajectory data collected at historical moments. The vehicle trajectory data includes license plate information, passing time, checkpoint location and vehicle type, and m is an integer greater than 1.
[0021] The license plate information is the license plate number of the vehicle. Through the license plate information, the driving trajectory of a specific vehicle can be tracked, the behavior pattern of the vehicle can be analyzed, illegal behavior can be investigated or data support can be provided for traffic management. The passing time is the time when the vehicle passes through the checkpoint, and the passing time is expressed in the form of a timestamp, and the format of the timestamp is a UNIX timestamp. The passing time helps to analyze traffic flow and peak hours, and thus provide a basis for traffic scheduling and congestion management. The checkpoint location is the number corresponding to the checkpoint that the vehicle passes through, and each checkpoint corresponds to a unique number. The checkpoint location helps to analyze the traffic status of different sections of the road and optimize traffic management strategies. The vehicle type is the classification information of the vehicle, such as small cars, buses, trucks, etc. Through the vehicle type, the driving behavior and road occupation ratio of different types of vehicles can be understood, which is helpful for traffic planning, optimizing road design and improving traffic management. Among them, the checkpoint is a monitoring point or checkpoint set up on the traffic road to monitor the traffic conditions of vehicles, usually set up in important locations such as urban roads, highways, and intersections. Historical trajectory data is obtained through the data warehouse; the data warehouse architecture adopts a distributed storage system to ensure efficient data storage and query; vehicle trajectory data is obtained through checkpoint cameras installed on traffic roads, and the vehicle trajectory data is integrated into the data warehouse through the ELT (Extract, Transform, Load) process to provide high-quality data support for subsequent analysis.
[0022] S2: Preprocess the historical trajectory data to obtain historical processing data.
[0023] Methods for obtaining historical processing data include: Perform anomaly detection on all data in the historical trajectory data, and determine whether to mark them as abnormal data. Delete the vehicle trajectory data corresponding to the abnormal data from the historical trajectory data to obtain historical normal data; treat the vehicle trajectory data with the same license plate information in the historical normal data as a group of analysis sets, and the analysis set corresponds to the license plate information one by one; sort the vehicle trajectory data in each group of analysis sets from large to small according to the corresponding passing time, and generate a corresponding time sorting table; according to each time sorting table, take two adjacent passing times as a group of time sets in turn, and mark the passing time ranked first in each time sorting table as the end time, and mark the passing time ranked last as the start time; subtract one passing time from another passing time in each group of time sets in turn and take the absolute value to obtain the time difference; A preset time threshold is preset, and the time threshold is preset by those skilled in the art according to actual conditions. In this embodiment, the preferred time threshold is 10800s; each time difference is compared with the time threshold in turn; if the time difference is greater than or equal to the time threshold, the passing time with a larger value in the time set corresponding to the corresponding time difference is marked as the start time, and the passing time with a smaller value is marked as the end time; if the time difference is less than the time threshold, the passing time corresponding to the corresponding time difference is not marked; in each time sorting table, the adjacent start time and end time, as well as all the passing times included in the middle, are taken in reverse order as a group of trajectory sets; the passing time in each group of trajectory sets is replaced with the corresponding vehicle trajectory data, and a group of trajectory sets corresponds to the running trajectory of a vehicle; all trajectory sets are used as historical processing data.
[0024] For example, the passing times in the time sorting table are 100000, 98930, 97030, 78300 and 78000 respectively; 78000 is marked as the start time and 100000 is marked as the end time; the calculated time differences are 1070, 1900, 18730 and 300 respectively; Therefore, 97030 is marked as the start time and 78300 is marked as the end time; according to the reverse order, 78000 and 78300 are a set of trajectories, and 97030, 98930 and 100000 are a set of trajectories.
[0025] Methods for determining whether to mark data as abnormal include: Different digital labels are set for different vehicle types and marked as type labels; a data set is preset, the data set includes a checkpoint set and a type set, the checkpoint set includes the numbers corresponding to all checkpoints, and the type set includes the type labels corresponding to all vehicle types; the data set is preset by a person skilled in the art through research on checkpoint numbers and vehicle types; Replace the vehicle type in the historical trajectory data with the corresponding type label; compare each type label in the historical trajectory data with each type label in the type set. If all type labels in the type set are inconsistent with the type labels in the historical trajectory data, the corresponding type label is marked as abnormal data; if there is a type label in the type set that is consistent with the type label in the historical trajectory data, the corresponding type label is not marked; compare each checkpoint position in the historical trajectory data with each checkpoint position in the checkpoint set. If all checkpoint positions in the checkpoint set are inconsistent with the checkpoint positions in the historical trajectory data, the corresponding checkpoint position is marked as abnormal data; if there is a checkpoint position in the checkpoint set that is consistent with the checkpoint position in the historical trajectory data, the corresponding checkpoint position is not marked.
[0026] Get the timestamp corresponding to the current time point and mark it as the current time; compare the current time with all the passing times in the historical trajectory data in turn; mark the passing times with values greater than or equal to the current time as abnormal data, and do not mark the passing times with values less than the current time.
[0027] S3: Build a trajectory prediction model based on historical processing data.
[0028] like Figure 2 As shown, the steps of building a trajectory prediction model include: Step 1: Define the state space; Step 2: Construct the state transfer matrix; Step 3: Evaluate the trajectory prediction model.
[0029] In the above step 1, the method of defining the state space includes: Obtain the environmental data corresponding to each set of vehicle trajectory data in the historical processing data; the environmental data includes weather data and road data; the weather data is information about the meteorological conditions at the location of the vehicle, such as sunny days, rainy days, snowy days, etc.; the weather data is obtained through the website of the Meteorological Bureau according to the location of the vehicle; the road data is the type of road at the location of the vehicle, such as highways, urban roads, rural roads, etc.; the road data is obtained through the relevant website of the traffic management department according to the location of the vehicle; the location of the vehicle is determined according to the checkpoint position in the corresponding vehicle trajectory data; different digital labels are set for different weather data and marked as weather labels; different road labels are set for different road data and marked as road labels; the weather data in the environmental data is replaced with the corresponding weather label, the road data is replaced with the corresponding road label, and the replaced environmental data is marked as label data; each set of label data is added to the corresponding vehicle trajectory data, and marked as comprehensive trajectory data, and the vehicle trajectory data in each set of trajectory sets is replaced with the corresponding comprehensive trajectory data; Calculating model order , in each set of trajectories The continuous comprehensive trajectory data is taken as a state set in the state space, and the time corresponding to the comprehensive trajectory data with the largest passing time in each state set is marked as the current time; the state set ;in, is the current state, For the front The state at a moment; ,in, is the license plate information at the current moment, is the passing time at the current moment, is the current position of the bayonet, is the type label of the current moment, is the weather label for the current moment, is the road label at the current moment.
[0030] Calculating model order The methods include: Count the number of groups of all comprehensive trajectory data in the historical processing data and mark them as the total number of data; take the same comprehensive trajectory data in the historical processing data as a group of information sets, and the information set corresponds to the comprehensive trajectory data one by one; count the number of comprehensive trajectory data in each information set and mark them as the number of data sets; calculate the information entropy corresponding to each information set based on the total number of data and the number of data sets; the expression of information entropy is: ; In the formula, is the information entropy corresponding to the i-th information set, is the number of data sets corresponding to the i-th information set, is the total number of data, , is the number of information sets; the information sets corresponding to the comprehensive trajectory data in the same set of trajectory sets are regarded as a set of related sets, wherein multiple sets of related sets include the same set of information sets; every two sets of information sets in each set of related sets are regarded as a set of associated sets, the number of all associated sets is counted and marked as the total number of associated sets, the number corresponding to each different set of associated sets is counted and marked as the number of associated sets; the joint entropy of each set of associated sets is calculated based on the total number of associated sets and the number of associated sets; the expression of the joint entropy is: ; In the formula, is the joint entropy corresponding to the jth group of associated sets, is the number of associations corresponding to the jth association set, is the total number of associations, , that is, the jth association set includes the ith information set and the Group information collection, , is the number of associated sets, .
[0031] According to the information entropy and joint entropy, the information relevance value of each set of associations is calculated; the expression of the information relevance value is: ; In the formula, is the information correlation value corresponding to the jth association set, For the The information entropy corresponding to the group information set; presetting a relevant threshold, which is preset by a person skilled in the art according to actual conditions; comparing each relevant information value with the relevant threshold; if the relevant information value is greater than or equal to the relevant threshold, marking the corresponding two groups of information sets as a group of strongly associated sets; if the relevant information value is less than the relevant threshold, not marking the corresponding two groups of information sets.
[0032] Count the number of strongly correlated sets in each group of related sets, and mark the smallest number of strongly correlated sets as N; initially set the model order to 1, and gradually increase the model order until the model order is N, count the total number of strong correlations corresponding to each order, and take the order with the largest total number of strong correlations as the model order ; The statistical method for the total number of strong correlations is: when the model order is n, , mark a random group of information sets as the current set, and determine whether the n groups of information sets before the current set in the related sets corresponding to the current set are all marked as strongly associated sets with the current set; if so, mark the current set as a statistical set, if not, do not mark the current set; and so on, mark each group of information sets in each group of related sets as the current set in turn, and determine whether it is marked as a statistical set; count the number of statistical sets in all related sets, and mark them as the total number of strong associations.
[0033] In the above step 2, the method of constructing the state transfer matrix includes: According to each set of trajectories, obtain the state of each state set corresponding to the next moment and mark it as ; The state at the next moment is the comprehensive trajectory data in the corresponding trajectory set, which is adjacent to the comprehensive trajectory data corresponding to the maximum passing time in the state set and is not located in the state set; the state of each next moment and the corresponding state set are taken as the state transfer set; State transition set ; Count the number of each different state set in the state space and mark it as the state frequency; count the number of all state sets in the state space and mark it as the total number of sets; count the number of each different state transition set in all trajectory sets and mark it as the transition frequency; calculate the transition probability corresponding to each state transition set based on the state frequency and transition frequency; the expression of the transition probability is: ; In the formula, For the The transition probability corresponding to the group state transition set, For the The transition frequency corresponding to the group state transition set, For the The state frequency of the group state transition set corresponding to the state set, , is the number of state transition sets, is the smoothing factor, , is the total number of sets; the smoothing factor is preset by those skilled in the art according to actual conditions; and a state transfer matrix is constructed according to the transition probabilities corresponding to all state transfer sets.
[0034] In the above step 3, the method for evaluating the trajectory prediction model includes: Re-obtain M groups of vehicle trajectory data and mark them as evaluation data. ; The method of obtaining evaluation data is consistent with the method of obtaining historical trajectory data; Based on the evaluation data, construct The group state collection is marked as an evaluation collection. is an integer greater than 1; based on the evaluation data and the evaluation set, a state transition set corresponding to the evaluation set is constructed and marked as the evaluation transition set; The state sets of each group are input into the trajectory prediction model, and the corresponding state at the next moment is predicted and marked as the predicted state; the state of each state set corresponding to the next moment is obtained according to the evaluation transfer set, and marked as the actual state; the mean square error (MSE) between each predicted state and the actual state is calculated, and the mean of all mean square errors is used as the loss function value; an optimization algorithm (such as a grid search algorithm, a random search algorithm, etc.) is used to optimize the smoothing factor Make multiple adjustments and calculate the corresponding loss function value after each adjustment; set the smoothing factor corresponding to the minimum loss function value As the smoothing factor of the trajectory prediction model; the mean square error between the predicted state and the actual state is the mean square error between the checkpoint position in the predicted state and the checkpoint position in the actual state; the trajectory prediction model is specifically a Markov model; it should be understood that after the state set is input into the trajectory prediction model, the trajectory prediction model obtains the transition probabilities corresponding to all state transfer sets corresponding to the state set according to the state transfer matrix, and outputs the state at the next moment in the state transfer set with the highest transfer probability.
[0035] S4: Collect current trajectory data; Methods for collecting current trajectory data include: The vehicle whose driving trajectory needs to be predicted is marked as a predicted vehicle; the corresponding license plate information is obtained according to the predicted vehicle, and the corresponding analysis set is obtained according to the license plate information; the vehicle trajectory data with the longest travel time is obtained from the obtained analysis set, and marked as the latest data; and the adjacent vehicles to the latest data are obtained from the obtained analysis set. The method comprises the following steps: obtaining a set of vehicle trajectory data, and forming the current vehicle data with the latest data; obtaining corresponding environmental data according to each set of vehicle trajectory data in the current vehicle data; and adding each set of environmental data to the corresponding vehicle trajectory data in the current vehicle data to obtain the current trajectory data.
[0036] S5: input the current trajectory data into the trajectory prediction model to predict the vehicle's driving trajectory; According to the current trajectory data, a corresponding state set is constructed and marked as the current state set; the current state set is input into the trajectory prediction model to predict the corresponding predicted state; the state with the smallest travel time in the current state set is replaced with the predicted state, and the replaced current state set is marked as the replacement state set; the replacement state set is then input into the trajectory prediction model to predict the corresponding predicted state again; and so on, a total of D groups of predicted states are predicted, and the checkpoint positions in the D groups of predicted states are obtained to form the vehicle driving trajectory.
[0037] This embodiment preprocesses historical trajectory data and constructs a trajectory prediction model based on a high-order Markov algorithm, which can effectively capture the complex laws of vehicle movement and flexibly respond to dynamic changes in the traffic environment in real-time predictions; fully considers environmental factors and driving behaviors, overcomes the defects of poor adaptability of traditional prediction methods to complex traffic environments, and provides effective technical support for intelligent traffic management; in addition, in the process of constructing the trajectory prediction model, the information theory algorithm is used to accurately calculate the model order, which can effectively improve the prediction accuracy of the model, enhance the ability to capture long-term data dependencies, avoid overfitting, and ensure that in a complex traffic environment, the trajectory prediction model can more accurately reflect the dynamic changes of the vehicle's driving trajectory, thereby achieving more reliable prediction results.
[0038] Example 2 The present application also provides an electronic device. The electronic device may include one or more processors and one or more memories. The memories store computer-readable codes, and when the computer-readable codes are executed by one or more processors, the vehicle driving trajectory prediction method based on the Markov algorithm as described above may be executed.
[0039] The method or system according to the implementation mode of the present application can also be implemented with the aid of the architecture of the electronic device shown in the present application. The electronic device may include a bus, one or more CPUs, ROM, RAM, a communication port connected to a network, input / output, a hard disk, etc. A storage device in the electronic device, such as a ROM or a hard disk, can store the vehicle driving trajectory prediction method based on the Markov algorithm provided in the present application. Furthermore, the electronic device may also include a user interface. Of course, the architecture shown in the present application is only exemplary. When implementing different devices, one or more components in the electronic device shown in the present application may be omitted according to actual needs.
[0040] Example 3 As shown, one embodiment of the present application discloses a computer-readable storage medium. Computer-readable instructions are stored on the computer-readable storage medium. When the computer-readable instructions are executed by the processor, the vehicle driving trajectory prediction method based on the Markov algorithm according to the embodiment of the present application described with reference to the above figures can be executed. The storage medium includes, but is not limited to, for example, volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and cache memory (cache). Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc.
[0041] In addition, according to the implementation of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the present application provides a non-transitory machine-readable storage medium, which stores machine-readable instructions, and the machine-readable instructions can be executed by a processor to execute instructions corresponding to the method steps provided by the present application, such as: a vehicle driving trajectory prediction method based on a Markov algorithm. When the computer program is executed by a central processing unit (CPU), the above functions defined in the method of the present application are executed.
[0042] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0043] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A vehicle driving trajectory prediction method based on Markov algorithm, characterized in that: include: S1: Get historical trajectory data; S2: pre-process the historical trajectory data to obtain historical processing data; S3: Build trajectory prediction model based on historical processing data; S4: Collect current trajectory data S5: Input the current trajectory data into the trajectory prediction model to predict the vehicle's driving trajectory.
2. The vehicle driving trajectory prediction method based on Markov algorithm according to claim 1 is characterized in that: The historical trajectory data is m groups of vehicle trajectory data collected at historical moments, and the vehicle trajectory data includes license plate information, passing time, checkpoint location and vehicle type, and m is an integer greater than 1; The method for obtaining historical processing data includes: Perform anomaly detection on all data in the historical trajectory data, and determine whether to mark them as abnormal data. Delete the vehicle trajectory data corresponding to the abnormal data from the historical trajectory data to obtain historical normal data; treat the vehicle trajectory data with the same license plate information in the historical normal data as a group of analysis sets, and the analysis set corresponds to the license plate information one by one; sort the vehicle trajectory data in each group of analysis sets from large to small according to the corresponding passing time, and generate a corresponding time sorting table; according to each time sorting table, take two adjacent passing times as a group of time sets in turn, and mark the passing time ranked first in each time sorting table as the end time, and mark the passing time ranked last as the start time; subtract one passing time from another passing time in each group of time sets in turn and take the absolute value to obtain the time difference; A time threshold is preset, and each time difference is compared with the time threshold in turn; if the time difference is greater than or equal to the time threshold, the passing time with a larger value in the time set corresponding to the time difference is marked as the start time, and the passing time with a smaller value is marked as the end time; if the time difference is less than the time threshold, the passing time corresponding to the corresponding time difference is not marked; in each time sorting table, the adjacent start time and end time, as well as all the passing times included in the middle, are taken as a set of trajectory sets in reverse order; the passing time in each set of trajectory sets is replaced with the corresponding vehicle trajectory data, and a set of trajectory sets corresponds to the running trajectory of a vehicle; all trajectory sets are used as historical processing data.
3. The vehicle driving trajectory prediction method based on Markov algorithm according to claim 2 is characterized in that: The method for determining whether to mark as abnormal data includes: Different digital labels are set for different vehicle types and marked as type labels; a data set is preset, the data set includes a checkpoint set and a type set, the checkpoint set includes the numbers corresponding to all checkpoints, and the type set includes the type labels corresponding to all vehicle types; Replace the vehicle type in the historical trajectory data with the corresponding type label; compare each type label in the historical trajectory data with each type label in the type set. If all type labels in the type set are inconsistent with the type labels in the historical trajectory data, the corresponding type label is marked as abnormal data; if there is a type label in the type set that is consistent with the type label in the historical trajectory data, the corresponding type label is not marked; compare each checkpoint position in the historical trajectory data with each checkpoint position in the checkpoint set. If all checkpoint positions in the checkpoint set are inconsistent with the checkpoint positions in the historical trajectory data, the corresponding checkpoint position is marked as abnormal data; if there is a checkpoint position in the checkpoint set that is consistent with the checkpoint position in the historical trajectory data, the corresponding checkpoint position is not marked; Get the timestamp corresponding to the current time point and mark it as the current time; compare the current time with all the passing times in the historical trajectory data in turn; mark the passing times with values greater than or equal to the current time as abnormal data, and do not mark the passing times with values less than the current time.
4. The vehicle driving trajectory prediction method based on Markov algorithm according to claim 3 is characterized in that: The step of constructing a trajectory prediction model comprises: Step 1: Define the state space; Step 2: Construct the state transfer matrix; Step 3: Evaluate the trajectory prediction model.
5. The vehicle driving trajectory prediction method based on Markov algorithm according to claim 4 is characterized in that: In step 1, the method of defining the state space includes: Obtain the environmental data corresponding to each set of vehicle trajectory data in the historical processing data; the environmental data includes weather data and road data; the weather data is the information of the meteorological conditions at the location of the vehicle, and the road data is the type of road at the location of the vehicle; set different digital labels for different weather data and mark them as weather labels; set different road labels for different road data and mark them as road labels; replace the weather data in the environmental data with the corresponding weather labels, replace the road data with the corresponding road labels, and mark the replaced environmental data as label data; add each set of label data to the corresponding vehicle trajectory data, mark them as comprehensive trajectory data, and replace the vehicle trajectory data in each set of trajectory sets with the corresponding comprehensive trajectory data; Calculating model order , in each set of trajectories The continuous comprehensive trajectory data is taken as a state set in the state space, and the time corresponding to the comprehensive trajectory data with the largest passing time in each state set is marked as the current time; the state set ;in, is the current state, For the front The state at a moment; ,in, is the license plate information at the current moment, is the passing time at the current moment, is the bayonet position at the current moment, is the type label of the current moment, is the weather label for the current moment, is the road label at the current moment.
6. The vehicle driving trajectory prediction method based on Markov algorithm according to claim 5 is characterized in that: The calculation model order The methods include: Count the number of groups of all comprehensive trajectory data in the historical processing data and mark them as the total number of data; regard the same comprehensive trajectory data in the historical processing data as a group of information sets, and the information sets correspond to the comprehensive trajectory data one by one; count the number of comprehensive trajectory data in each information set and mark them as the number of data sets; calculate the information entropy corresponding to each information set based on the total number of data and the number of data sets; regard the information sets corresponding to the comprehensive trajectory data in the same trajectory set as a group of related sets; regard every two information sets in each related set as a group of associated sets, count the number of all associated sets and mark them as the total number of associated sets, count the number corresponding to each different associated set and mark them as the number of associated sets; calculate the joint entropy of each associated set based on the total number of associated sets and the number of associated sets; According to the information entropy and the joint entropy, the information correlation value of each group of associated sets is calculated; a correlation threshold is preset, and each relevant information value is compared with the correlation threshold; if the relevant information value is greater than or equal to the relevant threshold, the corresponding two groups of information sets are marked as a group of strongly associated sets; if the relevant information value is less than the relevant threshold, the corresponding two groups of information sets are not marked; Count the number of strongly correlated sets in each group of related sets, and mark the smallest number of strongly correlated sets as N; initially set the model order to 1, and gradually increase the model order until the model order is N, count the total number of strong correlations corresponding to each order, and take the order with the largest total number of strong correlations as the model order .
7. The vehicle driving trajectory prediction method based on Markov algorithm according to claim 6 is characterized in that: ; In the formula, is the information entropy corresponding to the i-th information set, is the number of data sets corresponding to the i-th information set, is the total number of data, , is the number of information sets; ; In the formula, is the joint entropy corresponding to the jth group of associated sets, is the number of associations corresponding to the jth association set, is the total number of associations, , that is, the jth association set includes the ith information set and the Group information collection, , is the number of associated sets, ; The expression of information-related value is: ; In the formula, is the information correlation value corresponding to the jth association set, For the The information entropy corresponding to the group information set; The statistical method for the total number of strong correlations is: when the model order is n, , mark a random group of information sets as the current set, and determine whether the n groups of information sets before the current set in the related sets corresponding to the current set are all marked as strongly associated sets with the current set; if so, mark the current set as a statistical set, if not, do not mark the current set; and so on, mark each group of information sets in each group of related sets as the current set in turn, and determine whether it is marked as a statistical set; count the number of statistical sets in all related sets, and mark them as the total number of strong associations.
8. The vehicle driving trajectory prediction method based on Markov algorithm according to claim 7 is characterized in that: In step 2, the method for constructing a state transfer matrix includes: According to each set of trajectories, obtain the state of each state set corresponding to the next moment and mark it as ; The state at the next moment is the comprehensive trajectory data in the corresponding trajectory set, which is adjacent to the comprehensive trajectory data corresponding to the maximum passing time in the state set and is not located in the state set; the state of each next moment and the corresponding state set are taken as the state transfer set; State transition set ; Count the number of each different state set in the state space and mark it as the state frequency; count the number of all state sets in the state space and mark it as the total number of sets; count the number of each different state transition set in all trajectory sets and mark it as the transition frequency; calculate the transition probability corresponding to each state transition set based on the state frequency and transition frequency; the expression of the transition probability is: ; In the formula, For the The transition probability corresponding to the group state transition set, For the The transition frequency corresponding to the group state transition set, For the The state frequency of the group state transition set corresponding to the state set, , is the number of state transition sets, is the smoothing factor, , is the total number of sets; construct the state transfer matrix according to the transition probabilities corresponding to all state transfer sets.
9. The vehicle driving trajectory prediction method based on Markov algorithm according to claim 8 is characterized in that: In step 3, the method for evaluating the trajectory prediction model includes: Re-obtain M groups of vehicle trajectory data and mark them as evaluation data. ; The method of obtaining evaluation data is consistent with the method of obtaining historical trajectory data; Based on the evaluation data, construct The group state collection is marked as an evaluation collection. is an integer greater than 1; based on the evaluation data and the evaluation set, a state transition set corresponding to the evaluation set is constructed and marked as the evaluation transition set; The state sets of each group are input into the trajectory prediction model, and the corresponding state at the next moment is predicted and marked as the predicted state; according to the evaluation transfer set, the state at the next moment corresponding to each state set is obtained and marked as the actual state; the mean square error between each predicted state and the actual state is calculated, and the mean of all mean square errors is used as the loss function value; the optimization algorithm is used to smooth the factor Make multiple adjustments and calculate the corresponding loss function value after each adjustment; set the smoothing factor corresponding to the minimum loss function value As the smoothing factor of the trajectory prediction model; the mean square error between the predicted state and the actual state is the mean square error between the bayonet position in the predicted state and the bayonet position in the actual state; the trajectory prediction model is a Markov model.
10. The vehicle driving trajectory prediction method based on Markov algorithm according to claim 9 is characterized in that: The method for collecting current trajectory data includes: The vehicle whose driving trajectory needs to be predicted is marked as a predicted vehicle; the corresponding license plate information is obtained according to the predicted vehicle, and the corresponding analysis set is obtained according to the license plate information; the vehicle trajectory data with the longest travel time is obtained from the obtained analysis set, and marked as the latest data; and the adjacent vehicles to the latest data are obtained from the obtained analysis set. The vehicle trajectory data is grouped and combined with the latest data to form the current vehicle data; the corresponding environmental data is obtained according to each group of vehicle trajectory data in the current vehicle data; each group of environmental data is added to the corresponding vehicle trajectory data in the current vehicle data to obtain the current trajectory data; According to the current trajectory data, a corresponding state set is constructed and marked as the current state set; the current state set is input into the trajectory prediction model to predict the corresponding predicted state; the state with the smallest travel time in the current state set is replaced with the predicted state, and the replaced current state set is marked as the replacement state set; the replacement state set is then input into the trajectory prediction model to predict the corresponding predicted state again; and so on, a total of D groups of predicted states are predicted, and the checkpoint positions in the D groups of predicted states are obtained to form the vehicle driving trajectory.
Citation Information
Patent Citations
Vehicle track incremental modeling and on-line abnormity detection method of intelligent traffic system
CN103473540A
Vehicle driving track prediction method and system based on checkpoint snapshot data and equipment
CN111009126A
Vehicle automatic driving track prediction system and prediction method
CN116702617A
Online self-learning Markov vehicle speed prediction method
CN116901981A
Signal lamp intersection interconnected automobile acceleration trajectory planning method
CN117334065A