A hidden markov-based vehicle trajectory map matching method
By introducing turning cost calculation and comprehensive analysis function into the hidden Markov model and optimizing the path score, the problem of not considering path smoothness in existing methods is solved, and the accuracy and consistency of trajectory matching are improved.
Patent Information
- Application Number
- CN202410959100.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-07-17
AI Technical Summary
Existing trajectory matching methods based on hidden Markov models fail to consider the impact of path smoothness on driving, resulting in matching results that are inconsistent with the consistency of actual road driving.
By introducing turning cost calculation into the hidden Markov model, evaluating the turning points and turning distances of the path, combining spatial, temporal and directional analysis functions, the optimal path is selected, the path selection preference of the driver is considered, and the path score is optimized.
The accuracy of trajectory matching results is improved, the consistency is consistent with actual road driving, and the quality of path reconstruction is enhanced.
Smart Images

Figure CN118758322B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of trajectory matching, and more particularly, relates to a vehicle trajectory map matching method based on hidden Markov. BACKGROUND
[0002] With the wide use of global positioning system (GPS) on vehicles and mobile terminals, these devices are recording the moving position sequence of vehicles, i.e., the GPS trajectory of vehicles, uninterruptedly every day. With the development of positioning technology, part of the trajectory data also covers the direction, speed or height information of motion, etc. These data contain rich traffic information and user behavior, and can realize real-time understanding of the spatiotemporal variation of vehicle demand on the road network and the relevant information of travel.
[0003] The existing trajectory map matching method can be mainly divided into a method based on a geometric map, a method considering a topological structure and an algorithm using probability statistics. When the hidden Markov (HMM) algorithm is used for global matching, the HMM algorithm usually performs probability calculation of trajectory matching based on the shortest path.
[0004] In actual driving, the driver usually pays more attention to the road travel time, and in addition to choosing the shortest path for driving, the smoothness of the road also plays an important role in the route selection of the user, but the trajectory matching based on hidden Markov (HMM) does not consider the influence of the smoothness of the path on driving. SUMMARY
[0005] The present application provides a vehicle trajectory map matching method based on hidden Markov, aiming at improving the above problems.
[0006] The present application is realized in this way, a vehicle trajectory map matching method based on hidden Markov, the method comprises the following steps:
[0007] (1) pre-processing the trajectory T to form a trajectory T', and extracting each trajectory point from the trajectory T' in turn to obtain the candidate point of each trajectory point;
[0008] (2) matching the k optimal paths of the trajectory T' based on the probability matching model of hidden Markov;
[0009] (3) calculating the path score of the corresponding path based on the turning cost of the k optimal paths, and taking the path with the highest path score as the optimal matching path of the trajectory T.
[0010] Further, the path score acquisition method of the path is as follows:
[0011] The turning point in the current path is found, the total turning cost C of the corresponding turning point is determined based on the turning angle and turning distance of the turning point, and the path score of the corresponding path is calculated based on the total turning cost of all turning points.
[0012] Further, the calculation formula of the path score Fc(P) of the path P is specifically as follows:
[0013]
[0014] wherein, dis(p ) represents the shortest path distance from the candidate point to the candidate point i-1 dis(p i ) represents the Euclidean distance from the trajectory point p i-1 to p C dis(p ) represents the total turning cost from the candidate point
[0015] Further, if there is no turning corner point between the candidate road segment wherein the candidate point is located and the candidate road segment wherein the candidate point is located, then
[0016] Further, if there is a turning corner point between the candidate road segment wherein the candidate point is located and the candidate road segment wherein the candidate point is located, then the total cost C of the turning behavior corresponding to the turning point is calculated according to the following formula:
[0017]
[0018] wherein ω is a balance factor, C turn is the turning score of the turning angle corresponding to the turning point, and C traj is the cost of the turning action corresponding to the turning point.
[0019] Further, the calculation of the turning score C turn is specifically as follows:
[0020]
[0021] Further, the calculation formula of the cost C traj of the turning action corresponding to the turning point is specifically as follows:
[0022] C traj = min(dis(e.p),maxC traj ).
[0023] wherein dis(e.p) represents the perpendicular distance from the trajectory point p i to the corresponding candidate road segment in the path P , maxC traj is the maximum threshold value of C traj .
[0024] Further, the method for identifying the turning point in the path is as follows:
[0025] Calculate the turning angle θ i between the previous road segment e i+1 and the next road segment e i in the current path.
[0026] If the turning angle θ i is greater than or equal to the set turning angle threshold θ m , the endpoint of the segment e i is taken as the turning point or the starting point of e i+1 is taken as the turning point.
[0027] Further, the preprocessing of the trajectory T includes the removal of abnormal trajectory points and the interpolation of trajectory points.
[0028] Further, the interpolation method of the trajectory points is as follows:
[0029] (111) Calculate the time difference dt and the distance dd between the i-th trajectory point p i and the i+1-th trajectory point p i+1 in the trajectory T.
[0030] (112) If the time difference dt is greater than the time threshold T max or the distance dd is greater than the distance threshold D max .
[0031] (113) Calculate the number of interpolation points num_inter, num_inter = int(max(dt / Tmax, dd / Dmax)).
[0032] (114) Calculate the time step dt_step and the distance step dd_step of each interpolation point, wherein dt_step = dt / (num_inter+1), dd_step = dd / (num_inter+1).
[0033] (115) Calculate the time and distance of each interpolation point from the current trajectory point p i , and further determine the coordinates and timestamps of each interpolation point, and insert all interpolation points between the trajectory point p i and the trajectory point p i+1 .
[0034] (116) Let i = i + 1, and execute step (111) until all adjacent trajectory points in trajectory T are traversed;
[0035] (117) The distances of all interpolation trajectory points are extracted, the distances are smoothed by Gaussian filtering, and the interpolation points are updated to form the trajectory T′.
[0036] Drivers tend to choose paths with fewer turning points, which means they are more likely to follow straight paths or roads with fewer turns. When matching maps, considering the driver's path preference makes the matching results more consistent with the consistency of actual road driving, improves the quality of path reconstruction, and improves the accuracy of matching results. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A flowchart of a vehicle trajectory map matching method based on Hidden Markov provided in an embodiment of the present invention;
[0038] Figure 2 Example diagrams of candidate road segments and candidate points on candidate road segments corresponding to trajectory points provided in an embodiment of the present invention, where (a) is a candidate road segment for a trajectory point, (b) is a candidate point on a candidate path, and (c) is a turning road segment;
[0039] Figure 3 This is an example diagram of spatial analysis provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The specific implementation methods of the present invention will be further explained in detail below by describing the embodiments with reference to the accompanying drawings, so as to help those skilled in the art to have a more complete, accurate and in-depth understanding of the inventive concept and technical solution of the present invention.
[0041] Trajectory: Trajectory point p i =(x i ,y i ,t i ), where (x i ,y i ) represents the longitude and latitude of the i-th track point recorded by the GPS positioning device, t i represents the timestamp of the i-th trajectory point, and the trajectory T is composed of the trajectory point sequence, T==(p1,p2,...,p n );
[0042] Road network: A road network is denoted as G = (V, E) and is a directed graph. V represents the set of nodes in the directed graph, corresponding to the start points, intersections, and end points of real-world road segments, while E represents the set of edges between nodes.
[0043] Road segment: A road segment e belongs to the edge set E, each road segment e has a unique number e.id and an agreed travel speed constraint e.v, a length value e.l, a starting point e.start, an ending point e.end, a Boolean value indicating whether the road segment is a two-way street, and a list of intermediate points located on the road segment, Figure 2 An example graph of a road segment is given. If the direction of the edge is e i →e j , the edge is denoted as Otherwise, it is denoted as
[0044] Path: A path P is composed of a set of connected road segments, the starting vertex of a path is denoted as v.i, and the ending vertex is denoted as v.j, which can be described as follows, taking path P as an example: P: e1->e2->e3->…->e n , the start and end e1.strat=v.i, e n .end=v.j, and wherein e k .end=e k+1 .start.
[0045] Figure 1 The flowchart of the vehicle trajectory map matching method based on hidden Markov provided by the embodiment of the application, the method specifically comprises the following steps:
[0046] (1) In the pre-processing of the trajectory T, the trajectory T' is formed, and each trajectory point is extracted from the trajectory T' in turn to obtain the candidate point of each trajectory point;
[0047] (11) The trajectory T collected by the GPS positioning device is pre-processed, which includes the removal of abnormal trajectory points and the insertion of missing trajectory points in turn;
[0048] The positioning error of the GPS is usually derived from the communication between the space satellite, the user device and the signal, and some trajectory points that do not conform to the real logic will be generated in the process, such as drift data, invalid data, repeated data, etc. These data are called abnormal data and need to be removed in the pre-processing stage. Then the trajectory points are interpolated.
[0049] In the embodiment of the application, the interpolation method of the trajectory point is specifically as follows:
[0050] (111) Calculate the time difference dt and the distance dd between the i-th trajectory point p i and the i+1-th trajectory point p i+1 in the trajectory;
[0051] (112) If the time difference dt is greater than the time threshold T max or the distance dd is greater than the distance threshold D max ;
[0052] (113) Calculate the number of interpolation points num_inter, num_inter = int(max(dt / Tmax, dd / Dmax));
[0053] (114) Calculate the time step dt_step and distance step dd_step of each interpolation point, where dt_step = dt / (num_inter+1), dd_step = dd / (num_inter+1);
[0054] (115) Calculate the time and distance of each interpolation point to the current trajectory point p i , and then determine the coordinates and timestamp of each interpolation point, and insert all interpolation points between the trajectory point p i and the trajectory point p i+1 ;
[0055] (116) Let i = i + 1, execute step (111) until all adjacent trajectory points in the trajectory are traversed;
[0056] (117) Extract the distance of all interpolated trajectory points, perform Gaussian filtering smoothing processing on the distance, update the interpolation points, and form the trajectory T'. The interpolation method of the trajectory point is as follows:
[0057]
[0058] (12) Determination of candidate points of trajectory points
[0059] In the case of large-scale road network or a large amount of trajectory data, it is very time-consuming to directly match the entire road network. In order to narrow the search range in the map matching process and improve the accuracy and efficiency of matching, the candidate road segments and candidate points on the candidate road segments need to be determined by comprehensively considering the road network topology and the circular error area (confidence circle). For the trajectory point p i , the process of obtaining the candidate points is as follows:
[0060] A confidence circle with the trajectory point p i as the center and r as the radius is constructed in the road network G = (V, E); the roads contained in or intersecting with the circular area of the confidence circle are the candidate road segments of the trajectory point p i , as shown in Figure 2 (a), the trajectory point p exists in the four road segments e1, e2, e3, e4 in the centroid circle. The four road segments e1, e2, e3, e4 are the candidate road segments of the trajectory point p.
[0061] Take the trajectory point p i as an observation point, and project the observation point p i onto each candidate road segment to obtain the observation point pi A candidate point c, a trajectory point p i There can be multiple candidate road segments, trajectory point p i The jth candidate road segment is The corresponding candidate points are like Figure 2 As shown in (b), the candidate point on the candidate road section corresponding to the trajectory point p1 is
[0062] If the trajectory point p i The projection point on the candidate road segment is between its starting point and end point, and the projection point is selected as the candidate point; if the trajectory point p i The projection point that is not on the candidate road segment is between its starting point and end point. The intersection point of the candidate road segment is selected from the trajectory point p. i The nearest road intersection is used as a candidate point. If there are few candidate points near the vehicle location, the search radius needs to be increased until a reasonable number of candidates are found. The maximum search radius (100m) and the maximum number of candidates (5) are defined to limit the computational complexity.
[0063] (2) Match k optimal paths of trajectory T′ based on the hidden Markov probability matching model;
[0064] (21) Spatial analysis functions;
[0065] In the hidden Markov hypothesis, time and state space are considered discrete, based on two important assumptions: First, the probability of an observation depends only on the state it produced, not on any other states or observations. Second, the process is assumed to satisfy the Markov property, according to which the probability of a particular state depends only on the previous state, not on the state before it. In the map matching process, the trajectory points directly recorded by the sensor are defined as the observed states, and the candidate points matched with them are the hidden states.
[0066] Although there is a certain error between the trajectory point located by GPS and the actual position point, the projection point on the road section within a certain error range can still be regarded as a candidate point of the current trajectory point. The farther the distance between the candidate point and the trajectory point, the lower the possibility that the candidate point is the correct matching result. Therefore, the observation probability can be regarded as a zero-mean normal distribution with a standard deviation σ, which represents the observed state trajectory point p i Mapping to hidden state candidate points The observation probability The details are as follows:
[0067]
[0068] Among them, μ and σ represent the two parameters of the standard normal distribution, and their values are generally taken as 20m; Represents the trajectory point p i To the candidate point The Euclidean distance between .
[0069] When transferring between two points, the default driver prefers to take the shortest route rather than going around one or more blocks. The definition is as follows:
[0070]
[0071] in, is the trajectory point p i-1 On the candidate road Candidate points on is the trajectory point p i On the candidate road Candidate points on the i-1 ,p i ) represents two adjacent trajectory points p i-1 ,p i The Euclidean distance between Represents two candidate points calculated using the Dijkstra algorithm From formula (2), it can be seen that when the Euclidean distance and the shortest path distance between two points are closer to 1, the possibility that the candidate road segment corresponding to the candidate point is the correct road segment is greater.
[0072] The combined observation probability formula (1) and transition probability formula (2) define the spatial analysis function between the candidate points corresponding to two adjacent trajectory points: for:
[0073]
[0074] (22) Time analysis function;
[0075] Spatial analysis functions can solve most problems in geometric and topological structures. However, in the case of complex road network distribution, for example, when the distance between highways and ordinary roads is close, it is impossible to determine whether the vehicle is on the highway or the ordinary road by using only spatial analysis functions. Figure 3 shown.
[0076] Therefore, we consider the speed constraint of the road segment to solve this problem. We calculate the cosine similarity between the average speed of the shortest road segment between the candidate points and the road network speed constraint. The formula is as follows:
[0077]
[0078] in, Indicates that from the candidate point to the candidate point r e .v represents the average speed of the candidate point road segment speed constraint.
[0079] (23) Direction analysis function;
[0080] For cross sections and Y-shaped intersections, further consider the relationship between the direction of the point and the direction of the road on the basis of the time analysis function and the space analysis function, and the similarity between the real-time moving direction and the road segment direction can be calculated. The angle difference is used to measure the possibility of selecting each candidate road segment. When there are multiple candidate road segments within the confidence circle range, the candidate road segment that is closest to the moving direction of the trajectory point is more likely to be the real road segment of the trajectory point. Calculate the angle difference between the real-time moving direction of the trajectory point and the angle of the candidate road segment, that is, the matching degree of the direction of the trajectory point and the direction of the road segment. When the angle difference is smaller, the weight and probability of assigning the road segment are larger. The direction analysis function The calculation formula is as follows:
[0081]
[0082] wherein, the direction of the candidate road segment β pi represents the direction of the trajectory point p i , wherein, The calculation formula is as follows:
[0083]
[0084] wherein, represents the kth candidate road segment of the trajectory point p i , respectively. respectively represent the starting point latitude and the ending point latitude of the candidate road segment . respectively represent the starting point longitude and the ending point longitude of the candidate road segment .
[0085]
[0086] wherein, p i .lat and p i .lng respectively represent the latitude and the longitude of the trajectory point p i , and p i-1 .lat and p i-1 .lng respectively represent the latitude and the longitude of the trajectory point p i-1 .
[0087] Based on the above spatial analysis function Fs, time analysis function Ft, and direction analysis function Fd, the matching probability F of each path is calculated. Probability F = Fs*Ft*Fd, and the path with the highest matching probability k is selected.
[0088] (3) Calculate the path scores of the corresponding paths based on the turning costs of the k optimal paths, and take the path with the highest path score as the optimal matching path of trajectory T.
[0089] In map matching, it is generally assumed that drivers will choose the shortest path and calculate the probability of trajectory matching based on this. In addition to paying attention to road travel time and generally preferring shorter paths, the degree of road tortuosity also plays an important role in users' route selection. Therefore, the present invention makes an assumption based on this, and believes that in the process of path selection, drivers will tend to choose paths with fewer turning points in addition to the shortest path. For example, Figure 2 As shown in (c), although both routes between GPS points are shorter, for safety reasons, they are shorter than those passing through The driver is more likely to choose a route that passes This path contains only one 90-degree turn, while the previous path contained three.
[0090] In an embodiment of the present invention, the method for calculating the turning cost of a path is as follows: find the turning point in the current path, determine the turning cost of the corresponding turning point based on the turning angle and turning distance of the turning point, and the sum of the turning costs of all turning points constitutes the turning cost of the path.
[0091] In an embodiment of the present invention, the method for extracting turning points in a path is specifically as follows:
[0092] Calculate the previous segment e in the current path i and the next road segment e i+1 Steering angle θ i , if the steering angle θ i Greater than or equal to the set steering angle threshold θ m ,θ i ≥θ m , segment e i The end point of e i+1 The starting point is used as the turning point.
[0093] In the embodiment of the present invention, the driver needs to perform a steering action at a turning point. The steering cost corresponding to each turning point is described below. The details are as follows:
[0094] First, determine the steering score C based on the steering angle corresponding to the steering point turn , turn to score C turn The calculation formula is as follows:
[0095]
[0096] Secondly, considering the particularity of the driver's steering behavior, the cost of the steering action corresponding to the steering point is C traj =min(dis(ep),maxC traj ), where dis(ep) represents the vertical distance from the trajectory point p to the segment e in the path, and segment e is the end segment of the turning behavior. If the turning point is segment e i The end of section e i+1 The starting point of the turning behavior is the end section of the road e i+1 , and maxC traj Is the limit C traj The maximum value threshold is limited to 50 meters, and the cost of the road segment before and after the turning point is set to a constant value maxC traj Because when the distance dis(ep) grows much larger than the GPS accuracy, the information provided by the trajectory segment is limited, that is, the cost estimate of the turning point is only valid for the nearby road segments. Finally, the total cost C of the turning behavior corresponding to the turning point is calculated as follows:
[0097] C=C traj *ωC turn (9)
[0098] where ω is the trade-off between road length and transition angle.
[0099] The path scores of the k optimal paths are calculated based on the turning costs. The path with the highest path score is the optimal matching path for trajectory T. The calculation formula for the path score Fc(P) of path P is as follows:
[0100]
[0101] The closer the distance between the candidate road segment is to the shortest path distance between two trajectory points, the greater the probability that the path will be selected. Indicates candidate points To the candidate point The shortest path distance, dis(p i-1 ,p i ) represents the trajectory point p i-1 The Euclidean distance to p, Indicates candidate points To the candidate point The total cost of the steering behavior.
[0102] If the candidate point Candidate road section To the candidate point Candidate road section If there is no corner point between the two, then If there is, then calculate the road segment between the candidate road segment and the corner point, determine the turning score based on formula (8), calculate the vertical distance between the trajectory point p i and the candidate road segment , and further determine the turning cost C traj , calculate the total turning cost of the candidate point to the candidate point based on formula (9).
[0103] The present application performs timing analysis on the matching candidate points on the basis of the traditional HMM probability matching method, and considers the driver's path selection preference in the process of analyzing the matching result. The vehicle trajectory map matching method provided by the present application has the following beneficial effects:
[0104] (1) The map format used in urban map matching usually contains a large amount of road segment information and complex topological structure, which can help to more accurately capture the position of the trajectory point in the selection of candidate road segments, for fast search and positioning and to reduce matching errors.
[0105] (2) The trajectory is predicted and decoded by establishing a hidden Markov model, and then the candidate points are analyzed by using the trajectory features for road segment selection and matching. The geometric features, attribute information of the road segment and the timing features of the trajectory are comprehensively utilized to determine the candidate road segment, and the most possible matching path can be selected by comparing different hidden trajectory state sequences.
[0106] (3) Drivers tend to choose paths with fewer turning points, which means they are more likely to follow straight paths or roads with fewer turns. When map matching, considering the driver's path preference makes the matching result more consistent with the actual road driving, improves the quality of path reconstruction, and improves the accuracy of the matching result.
[0107] The present application is described by way of example, and it is obvious that the specific implementation of the present application is not limited by the above method. Any non-essential improvement or direct application of the inventive concept and technical solution to other occasions without improvement is within the scope of protection of the present application.
Claims
1. A vehicle trajectory map matching method based on Hidden Markov, characterized in that: The method comprises the following steps: (1) After preprocessing the trajectory T to form a trajectory T′, each trajectory point is extracted from the trajectory T′ in sequence to obtain a candidate point for each trajectory point; (2) Match k optimal paths of trajectory T′ based on the hidden Markov probability matching model; (3) Calculate the path score of the corresponding path based on the turning costs of the k optimal paths, and take the path with the highest path score as the optimal matching path of trajectory T; The path score of a path is obtained as follows: Find the turning points in the current path, determine the total turning cost C of the corresponding turning point based on the turning angle and turning distance of the turning point, and calculate the path score of the corresponding path based on the total turning cost of all turning points; The calculation formula of the path score Fc(P) of path P is as follows: in, Indicates candidate points To the candidate point The shortest path distance, dis(p i-1 ,p i ) represents the trajectory point p i-1 to p i The Euclidean distance, Indicates candidate points To the candidate point Total steering cost; If the candidate point Candidate road section To the candidate point Candidate road section There is no corner point between If the candidate point Candidate road section To the candidate point Candidate road section If there is a turning point between them, the turning point corresponds to the total cost of the turning behavior The calculation formula is as follows: Where ω is the balance factor, C turn is the steering score of the steering point corresponding to the steering angle, C traj is the cost of the turning action corresponding to the turning point.
2. The vehicle trajectory map matching method based on Hidden Markov Model as claimed in claim 1, characterized in that: Steering score C turn The calculation is as follows: Among them, θ i The previous segment e in the current path i and the next road segment e i+1 steering angle.
3. The vehicle trajectory map matching method based on Hidden Markov Model as claimed in claim 1, characterized in that: The cost C of the turning action corresponding to the turning point traj The calculation formula is as follows: C traj =min(dis(ep),maxC traj ); Among them, dis(ep) represents the trajectory point p i Distance from the corresponding candidate road segment in path P Vertical distance, maxC traj C traj The maximum threshold value.
4. The vehicle trajectory map matching method based on Hidden Markov Model as claimed in claim 1, characterized in that: The method for identifying turning points in a path is as follows: Calculate the previous segment e in the current path i and the next road segment e i+1 Steering angle θ i ; If the steering angle θ i Greater than or equal to the set steering angle threshold θ m , segment e i The end point of e i+1 The starting point is used as the turning point.
5. The vehicle trajectory map matching method based on Hidden Markov Model as claimed in claim 1, characterized in that: The preprocessing of the trajectory T includes the removal of abnormal trajectory points and the interpolation of trajectory points.
6. The vehicle trajectory map matching method based on Hidden Markov Model as claimed in claim 5, characterized in that: The interpolation method of trajectory points is as follows: (111) Calculate the i-th trajectory point p in the trajectory i and the i+1th trajectory point p i+1 The time difference dt and distance dd between them; (112) If the time difference dt is greater than the time threshold T max Or the distance dd is greater than the distance threshold D max ; (113) Calculate the number of interpolation points num_inter, num_inter = int(max(dt / T max ,dd / D max )); (114) Calculate the time step dt_step and distance step dd_step of each interpolation point, where dt_step=dt / (num_inter+1), dd_step=dd / (num_inter+1); (115) Calculate the distance between each interpolation point and the current trajectory point p i The time and distance are calculated to determine the coordinates and timestamp of each interpolation point, and all interpolation points are inserted into the trajectory point p. i With trajectory point p i+1 between; (116) Let i = i + 1, and execute step (111) until all adjacent trajectory points in the trajectory are traversed; (117) The distances of all interpolation trajectory points are extracted, the distances are smoothed by Gaussian filtering, and the interpolation points are updated to form the trajectory T′.
Citation Information
Patent Citations
Map matching method and apparatus, server, and storage medium
CN110375753A
Road optimal matching method for three-dimensional urban traffic network
CN115841749A