A map matching method and system based on hidden Markov model
By introducing heading angle reduction coefficient and Viterbi algorithm in road network matching, the road network matching method of the hidden Markov model is improved, and the problems of high computational complexity and insufficient generalization ability in the existing technology are solved, and the more Efficient and accurate road network matching.
Patent Information
- Application Number
- CN202411163201.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-08-23
AI Technical Summary
The existing road network matching scheme based on the hidden Markov model has high computational complexity when processing large-scale road networks or high-frequency sampling GPS data, and the generalization ability in different road network structures is insufficient, making it difficult to improve the road network. Matching efficiency and accuracy.
By acquiring GPS trajectory data and road network data, the heading angle reduction coefficient between the direction vector of the GPS trajectory point and the direction vector of the projection point on the candidate road section in the road network is calculated, and the single-state generation probability is calculated based on heading angle information, and the heading angle information is used to calculate the probability of single-state generation, and through Viterbi algorithm calculates the matching results of GPS trajectory and road network.
The matching accuracy in special situations such as U-shaped bends and bidirectional roads has been improved, the calculation complexity has been reduced, and the efficiency and accuracy of road network matching has been improved.
Smart Images

Figure CN118670407B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of geographic information processing technology, and in particular to a map matching method and system based on a hidden Markov model. Background Art
[0002] Road network matching, also known as map matching or road matching, is a geographic information system technology used to accurately match vehicle or pedestrian trajectory points recorded by GPS to actual roads on the road network. The purpose of road network matching is to correct the error of GPS positioning, because the original GPS data may deviate from the actual road due to signal interference, multipath effect or equipment accuracy limitation. It has a wide range of applications in scenarios such as navigation and traffic management. Road network matching generally uses specific algorithms to match each trajectory point to the nearest road segment or node on the road network, such as: nearest neighbor matching algorithm, hidden Markov model (HMM), particle filter algorithm, multi-similarity metric algorithm, etc.
[0003] Although the existing road network matching scheme based on hidden Markov model has made significant progress, it still has some limitations and shortcomings. For example, when processing large-scale road networks or high-frequency sampled GPS data, the HMM road network matching algorithm may encounter high computational complexity, resulting in slow algorithm operation; the existing HMM road network matching algorithm may perform well on specific data sets, but when generalized to different road network structures, the performance may decline.
[0004] Currently, no effective solution has been proposed for the problem of how to improve the road network matching accuracy in related technologies. Summary of the invention
[0005] The embodiments of the present application provide a map matching method and system based on a hidden Markov model to at least solve the problem of how to improve the efficiency and accuracy of road network matching in the related art.
[0006] In a first aspect, an embodiment of the present application provides a map matching method based on a hidden Markov model, the method comprising:
[0007] Get GPS track data and road network data;
[0008] Based on the GPS track data and the road network data, calculating a heading angle reduction coefficient between a direction vector of a GPS track point and a direction vector of a projection point of the GPS track point on a candidate road segment in the road network;
[0009] Based on the heading angle reduction coefficient, the GPS trajectory data and the road network data, a single state generation probability of a candidate road section of a GPS trajectory point in a road network is calculated;
[0010] Based on the GPS trajectory data and the road network data, a state transition probability between candidate road sections of two consecutive GPS trajectory points is calculated;
[0011] Based on the state transition probability and the single state generation probability, the matching result between the GPS trajectory and the road network is calculated by the Viterbi algorithm.
[0012] In some embodiments, based on the GPS trajectory data and the road network data, calculating the heading angle reduction coefficient between the direction vector of the GPS trajectory point and the direction vector of the projection point of the GPS trajectory point on the candidate road segment in the road network includes:
[0013] Based on the road network data, calculating the direction vector of each road section in the road network to obtain the road network section direction vector;
[0014] Based on the GPS track data, a direction vector of each GPS track point is calculated to obtain a direction vector of the GPS track point;
[0015] Based on the road network segment direction vector and the GPS track point direction vector, a heading angle reduction coefficient between the direction vector of the GPS track point and the direction vector of the projection point of the GPS track point on the candidate segment in the road network is calculated.
[0016] In some embodiments, based on the road network segment direction vector and the GPS track point direction vector, the heading angle reduction coefficient between the direction vector of the GPS track point and the direction vector of the projection point of the GPS track point on the candidate road network is calculated, including:
[0017] Based on the road network section direction vector, determining the direction vector of the projection point of the GPS trajectory point on the candidate road section in the road network;
[0018] Calculate the angle between the direction vectors using the formula , calculate the angle between the direction vectors θ ,in, u is the direction vector of the projection point of the GPS trajectory point on the candidate road segment in the road network, v is the direction vector of the GPS track point;
[0019] Based on the preset number of intervals N , the angle between the direction vectors θ Divide and get the heading angle reduction coefficient K (< θ * N / 180>), where < x >Representative x Rounding, K (n) RepresentativeK No. n elements.
[0020] In some embodiments, based on the heading angle reduction coefficient, the GPS trajectory data and the road network data, calculating the single state generation probability of the candidate road segment of the GPS trajectory point in the road network includes:
[0021] Based on the GPS track data and the road network data, calculating the projection distance from the GPS track point to the candidate road section in the road network;
[0022] The single-state generation probability calculation formula , calculate the single-state generation probability of the candidate road section of the GPS trajectory point in the road network, where, GPS track point GPS i To candidate road section e j The projection distance, K (< * N / 180>) is the heading angle reduction coefficient, GPS track point GPS i The direction vector and the candidate road segment e j The angle between the direction vectors of the projection points on σ is the standard deviation of the observation error.
[0023] In some embodiments, based on the state transition probability and the single state generation probability, the matching result between the GPS trajectory and the road network calculated by the Viterbi algorithm includes:
[0024] Based on the state transition probability and the single state generation probability, the Viterbi algorithm is used to recursively calculate each subsequent GPS trajectory point to update F MAT and I MAT ,in, F MAT is a final state generation probability hash table used to store the final state generation probability, I MAT Generate an optimal indexed hash table for recording the probability of reaching the final state.
[0025] In some embodiments, based on the state transition probability and the single state generation probability, a recursive calculation is performed for each subsequent GPS trajectory point through the Viterbi algorithm to update F MAT and I MAT include:
[0026] By using the calculation formula based on natural logarithm:
[0027] Recursive calculation t and t index ,in, A MAT is the set of state transition probabilities, B MAT is the set of single-state generation probabilities, t is an array for temporarily storing probabilities, t index is the index of the maximum probability;
[0028] Based on recursive calculation t and t index , by updating the formula renew F MAT , by updating the formula renew I MAT .
[0029] In some embodiments, after obtaining GPS trajectory data and road network data, the method includes:
[0030] Based on the road network data, the connectivity of the road network is repaired to obtain repaired road network data.
[0031] In some embodiments, based on the road network data, repairing the connectivity of the road network includes:
[0032] For each node in the road network, based on the road network data, determining a set of edges whose distance to the node is less than a first distance threshold;
[0033] For each edge in the edge set, based on the road network data, calculate the projection point from the node to the edge; if the distance between the projection point and the endpoint of the edge is less than a second distance threshold, perform a direct connection repair between the node and the endpoint; otherwise, perform an interrupt repair between the node and the projection point.
[0034] In some embodiments, based on the GPS trajectory data and the road network data, calculating the state transition probability between candidate road segments of two consecutive GPS trajectory points includes:
[0035] Based on the GPS track data, the straight-line distance between two consecutive GPS track points is calculated.
[0036] Based on the GPS track data and the road network data, a path distance between projection points of the two GPS track points on respective candidate road sections in the road network is calculated;
[0037] The state transition probability of the candidate road section is calculated based on the straight-line distance and the path distance.
[0038] In a second aspect, an embodiment of the present application provides a map matching system based on a hidden Markov model, the system is used to execute the method described in any one of the first aspects above, the system includes a data acquisition module, a single state generation probability calculation module, a state transition probability calculation module, and a map matching module;
[0039] The data acquisition module is used to acquire GPS trajectory data and road network data;
[0040] The single state generation probability calculation module is used to calculate the heading angle reduction coefficient between the direction vector of the GPS track point and the direction vector of the projection point of the GPS track point on the candidate road section in the road network according to the GPS track data and the road network data; based on the heading angle reduction coefficient, the GPS track data and the road network data, the single state generation probability of the GPS track point in the candidate road section in the road network is calculated;
[0041] The state transition probability calculation module is used to calculate the state transition probability between candidate road sections of two consecutive GPS trajectory points based on the GPS trajectory data and the road network data;
[0042] The map matching module is used to calculate the matching result between the GPS track and the road network through the Viterbi algorithm according to the state transition probability and the single state generation probability.
[0043] Compared with the related art, the embodiment of the present application provides a map matching method and system based on a hidden Markov model. The method obtains GPS trajectory data and road network data; based on the GPS trajectory data and the road network data, calculates the heading angle reduction coefficient between the direction vector of the GPS trajectory point and the direction vector of the projection point of the GPS trajectory point on the candidate section in the road network; based on the heading angle reduction coefficient, the GPS trajectory data and the road network data, calculates the single-state generation probability of the candidate section of the GPS trajectory point in the road network; based on the GPS trajectory data and the road network data, calculates the state transition probability between the candidate sections of two consecutive GPS trajectory points; based on the state transition probability and the single-state generation probability, calculates the matching result of the GPS trajectory and the road network through the Viterbi algorithm, realizes the improvement of the traditional hidden Markov model, and calculates the single-state generation probability by integrating the heading angle information and introducing the heading angle reduction coefficient, which can more finely consider the direction consistency between the GPS trajectory point and the candidate section, thereby improving the matching accuracy of special cases such as U-shaped bends and two-way roads, and solving the problem of how to improve the road network matching accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0045] Figure 1 is a flowchart of the steps of a map matching method based on a hidden Markov model according to an embodiment of the present application;
[0046] Figure 2 is a schematic diagram of a data model of road network data according to an embodiment of the present application;
[0047] Figure 3 is a schematic diagram of the relationship between GPS track points and road networks according to an embodiment of the present application;
[0048] Figure 4a is a schematic diagram of road network connectivity repair according to an embodiment of the present application;
[0049] Figure 4b is a schematic diagram of road network connectivity repair according to an embodiment of the present application;
[0050] Figure 5 It is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0052] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.
[0053] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0054] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0055] The present application embodiment provides a map matching method based on a hidden Markov model. Figure 1 is a flowchart of the steps of the map matching method based on the hidden Markov model according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0056] Step S102, obtaining GPS trajectory data and road network data;
[0057] Specifically, step S102: Figure 2 is a schematic diagram of a data model of road network data according to an embodiment of the present application, such as Figure 2 As shown in the figure, the data model of road network data adopts a directed graph G =( V , E ),in, V ={ v 1, v 2,…, v N} represents nodes in the road network, such as intersections, starting points, end points, and road segment division points. Each node has latitude and longitude attributes to determine its location in geographic space, and the inflection point tp Different from a node, it is the middle point on a road section and is used to simulate the curved line of the road section. The road section direction vectors before and after the inflection point in the same road section are different;E = { e 1, e 2,…, e N} represents the edge (road segment) in the road network , Each edge e i Can be represented as a slave node v fromi To Node v toi The directed edge of e i =( v fromi , v toi ). Table 1 is an example table of data structure fields for storing node sets, and Table 2 is an example table of data structure fields for storing edge sets.
[0058] Table 1
[0059] Field Name Field Type Field Description node_id int The node unique code must be a positive integer greater than 0 geometry geometry Nodal Coordinate Geometry Column
[0060] Table 2
[0061] Field Name Field Type Field Description link_id int The unique code of the road section must be a positive integer greater than 0 from_node int The node number of the starting point of the road section topology, which must be a positive integer greater than 0 to_node int The node number of the topological end point of the road segment, which must be a positive integer greater than 0 length float Length of road section, in meters geometry geometry Section geometry
[0062] Figure 3 is a schematic diagram of the relationship between GPS track points and road networks according to an embodiment of the present application, such as Figure 3 As shown, the data model of GPS trajectory data is recorded as G ={ GPS 1, GPS 2,…, GPS T},in, GPS T Represents a GPS track point. GPS track data has latitude, longitude, time attributes, etc. Table 3 is an example table of data structure fields of GPS track data.
[0063] Table 3
[0064] Field Name Field Type Field Description agent_id string Unique vehicle code. To be precise, this field marks a complete trip of the vehicle. lng float longitude lat float latitude time string Positioning timestamp
[0065] Furthermore, based on the GPS track data and the road network data, the candidate sections and projection points of the GPS track points in the road network can be determined. Specifically, for the candidate sections, a circle with a radius of buffer is created with the GPS track point as the center, and the sections of the road network associated with it are the candidate sections, as shown in the figure. i GPS track points GPS i The candidate road segment set P i ={ ei1 , e i2 ,…, e iF}, including F candidate sections; for the projection point, the projection point refers to the point on the candidate section with the shortest distance from the GPS track point, such as Represents a GPS track point GPS i In the candidate section e j The projection point on .
[0066] Furthermore, based on the determination of the candidate sections and projection points of the GPS track points in the road network, the projection distance from the GPS track points to the candidate sections can be calculated using the spherical trigonometry formula and the Haversian formula (e.g. GPS track point GPS i To candidate road section e j The projection distance of the GPS track point to the candidate road section (such as GPS track point GPS i In the candidate section e j The projection point coordinates on the candidate road segment), the distance from the projection point of the GPS trajectory point to the candidate road segment to the topological starting point of the candidate road segment (such as The projection point To candidate road section e j distance from the topology starting point).
[0067] It should be noted that in step S102, an efficient data structure is used to store and index the road network data and GPS trajectory data, so as to quickly locate and access relevant information during the matching process, which can further improve the processing speed of map matching.
[0068] After step S102, the method includes step S103, repairing the connectivity of the road network based on the road network data to obtain repaired road network data.
[0069] Step S103 specifically includes the following steps:
[0070] Step S1031, for each node in the road network, based on the road network data, determine a set of edges whose distance to the node is less than a first distance threshold;
[0071] Step S1031 Specifically, for each node in the road network v i , define a detection radius buffer , calculate the edge set within the detection radius with the node as the center Candidate .
[0072] Step S1032, Figure 4a and Figure 4b is a schematic diagram of road network connectivity repair according to an embodiment of the present application, such as Figure 4a and 4b As shown, for the edge set Candidate For each edge in , based on the road network data, the projection point from the node to the edge is calculated. If the distance between the projection point and the endpoint of the edge is less than the second distance threshold, a direct connection repair between the node and the endpoint is performed; otherwise, an interruption repair between the node and the projection point is performed.
[0073] It should be noted that, by introducing a road network node connectivity repair mechanism in step S103, the road network can be checked before matching, and disconnected nodes can be automatically repaired, thereby reducing the probability of matching failure due to road network problems.
[0074] Step S104, calculating a heading angle reduction coefficient between a direction vector of a GPS track point and a direction vector of a projection point of the GPS track point on a candidate road segment in the road network based on the GPS track data and the road network data;
[0075] Step S104 specifically includes the following steps:
[0076] Step S1041, based on the road network data, calculating the direction vector of each road section in the road network to obtain the road network section direction vector;
[0077] It should be noted that, since the physical properties of the road network are relatively stable, the road network segment direction vectors can be pre-calculated and stored, thus eliminating the computational overhead of step S1041. Specifically, pre-calculating the segment direction vectors means pre-calculating the direction vectors of each segment in the road network. Define the segment direction vector set V Used to store the direction vector of each road segment in the road network. e i , since it only has a starting and ending point v starti and v endi , no inflection point tp , its direction vector can be directly obtained by calculating the coordinate difference of the two endpoints; and for a point containing multiple inflection points tp Section e j, there are multiple road section direction vectors, calculate each section direction vector, and form a nested direction vector set. In this way, when the GPS track point is projected to the candidate road section, the road section direction vector set is queried by the road section ID. V , the direction vector of the candidate road section where the GPS track point is located can be quickly determined. For straight road sections, the stored direction vector is directly used; for road sections with multiple inflection points, the path distance from the projection point to the road section topological starting point is combined to further query the corresponding sub-road section direction vector. This multi-level vector set structure not only reduces the computational overhead in the matching process, but also significantly optimizes the algorithm performance and accelerates the matching process through a fast retrieval mechanism.
[0078] Step S1042, based on the GPS track data, calculating the direction vector of each GPS track point to obtain the direction vector of the GPS track point;
[0079] It should be noted that the direction vector of the GPS trajectory point can also be pre-calculated and stored. The GPS trajectory data contains position coordinates and timestamps. The heading angle (i.e., direction vector) can be calculated and stored by the differential direction method, thereby improving the efficiency of calculating the heading angle reduction coefficient for the subsequent single-state transition probability.
[0080] Step S1043, based on the road network segment direction vector and the GPS track point direction vector, calculate the heading angle reduction coefficient between the direction vector of the GPS track point and the direction vector of the projection point of the GPS track point on the candidate road network segment.
[0081] Specifically, step S1043 determines the direction vector of the projection point of the GPS trajectory point on the candidate road segment in the road network based on the road network section direction vector;
[0082] Calculate the angle between the direction vectors using the formula , calculate the angle between the direction vectors θ ,in, u is the direction vector of the projection point of the GPS trajectory point on the candidate road segment in the road network, v is the direction vector of the GPS track point;
[0083] Based on the preset number of intervals N , the angle between the direction vectors θ Divide and get the heading angle reduction coefficient K (< θ * N / 180>), where < x >Representative x Rounding, K (n) Representative K No. n elements,K This reduction factor array can be freely defined.
[0084] Step S106, based on the heading angle reduction coefficient, the GPS trajectory data and the road network data, calculating the single state generation probability of the GPS trajectory point in the candidate road section in the road network;
[0085] Step S106 specifically, based on the GPS track data and the road network data, calculate the projection distance from the GPS track point to the candidate road section in the road network;
[0086] The single-state generation probability calculation formula , calculate the single-state generation probability of the candidate road section of the GPS trajectory point in the road network, where, GPS track point GPS i To candidate road section e j The projection distance, K (< * N / 180>) is the heading angle reduction coefficient, GPS track point GPS i The direction vector and the candidate road segment e j The angle between the direction vectors of the projection points on σ is the standard deviation of the observation error.
[0087] It should be noted that in the traditional hidden Markov model, the single-state generation probability is: the probability that a given observed GPS trajectory point is generated by each candidate road section state in the state space, which quantifies the possibility of generating observation data under a specific hidden state. In this embodiment, the calculation of the single-state generation probability of the GPS trajectory point not only considers the projection distance between the GPS trajectory point and the candidate road section, but also integrates the influence of the heading angle on the probability, and is achieved by introducing a heading angle reduction coefficient. By integrating the heading angle information and introducing the heading angle reduction coefficient, when calculating the single-state generation probability, the directional consistency between the GPS trajectory point and the candidate road section is more finely considered, thereby improving the matching accuracy of special cases such as U-shaped bends and two-way roads.
[0088] Step S108, calculating the state transition probability between candidate road sections of two consecutive GPS trajectory points based on the GPS trajectory data and the road network data;
[0089] Step S108 specifically includes the following steps:
[0090] Step S1081, based on the GPS track data, calculate the straight-line distance between two consecutive GPS track points,
[0091] Step S1081 Specifically, the GPS track data contains the longitude and latitude information of the GPS track points. The straight-line distance between two consecutive GPS track points is calculated using the spherical trigonometry formula or the Haversian formula. .
[0092] Step S1082: Based on the GPS track data and the road network data, the path distance between the projection points of the two GPS track points on their respective candidate road sections in the road network is calculated. ;
[0093] It should be noted that, since the physical properties of the road network are relatively stable, the shortest path information of the road network nodes can be pre-calculated and stored, thus eliminating the computational overhead of step S1082. Specifically, the strategy of pre-calculating the shortest path is performed on the node pairs in the road network. G =( V , E ) in each pair of nodes ( v i , v j ) Calculate the shortest path, the pre-calculated shortest path is stored in the hash table D In the example, the shortest path cost is stored in the hash table F Among them, D ij = path i->j Represents a slave node v i arrive v j The shortest path node sequence, F ij = d a->b Represents a slave node v i arrive v j The shortest path length. Furthermore, considering that the straight-line distance between adjacent GPS track points will not be too far, the corresponding path length will not be too far. For a certain node: a truncation distance parameter will be introduced when calculating the shortest path, and the node path whose path distance exceeds the truncation value will not be calculated to avoid searching too many irrelevant nodes. On the one hand, it can improve the calculation efficiency of matching, and on the other hand, it can also reduce the computer's memory usage. When the shortest path between two GPS track points needs to be calculated during the map matching process, these track points are first mapped to the starting node of the section where the projection point is located. Then through the index D and F, the shortest path length and the shortest path node sequence between the two nodes can be quickly found without recalculating during the matching process. This method reduces the computational complexity of the shortest path by O ( n 2 ) is reduced to O (1).
[0094] Step S1083, based on the straight-line distance and the path distance, the state transition probability of the candidate road segment is calculated.
[0095] Step S1083 specifically, based on the straight-line distance and path distance , through the formula The state transition probability of the candidate road section is calculated.
[0096] It should be noted that the state transition probability follows an exponential distribution, reflecting the transition probability between two consecutive states. Steps S1081 to S1083 provide a comprehensive state transition probability framework for the HMM map matching algorithm, enabling the algorithm to evaluate and select the most likely state transition sequence, thereby optimizing the matching of GPS trajectories with the road network.
[0097] In addition, during the state transition probability calculation process, there is a GPS path that does not go along the shortest path. If the above steps S1081 to S1083 are calculated based on the shortest path, it may cause GPS path recognition errors in this case. Based on this, a strategy for identifying detour situations is proposed. If it is determined that the GPS does not go along the shortest path, a larger path distance will be returned. , in order to reduce the state transition probability between two candidate road sections. The following are three strategies for identifying detour situations:
[0098] Assume there are two adjacent GPS track points (gps i , GPS i+1 ). A candidate section of the previous trajectory point is recorded as e p , a candidate section of the next trajectory point is recorded as e q , road section e p The starting point is recorded as v p1 The end node is v p2 , road section e q The starting point of v q1 The end node is v q2By pre-calculation, we can get v p1 arrive v q1 The shortest path.
[0099] ① According to the shortest path calculation, GPS i to gps i+1 It should be from v p1 Departure, via v p2 ,arrive v q1 Therefore, we can detect whether the second node of the shortest path node sequence is v p2 If not, a detour can be determined.
[0100] ② According to the shortest path calculation, GPS i to gps i+1 It should be from v p1 Departure, via v p2 ,arrive v q1 . Therefore, it is possible to detect whether the second to last node in the shortest path node sequence is v q2 , if so, a detour can be determined.
[0101] ③ The starting nodes of the candidate sections of the previous and next trajectory points overlap, but the ending nodes are inconsistent. According to the actual situation, it is impossible to e p arrive e q , then the detour can be determined.
[0102] Step S110, based on the state transition probability and the single state generation probability, the matching result between the GPS trajectory and the road network is calculated by the Viterbi algorithm.
[0103] Specifically, step S110 performs recursive calculation on each subsequent GPS trajectory point based on the state transition probability and the single state generation probability through the Viterbi algorithm to update F MAT and I MAT ,in, F MAT Generate a final state probability hash table (used to store the final state generation probability), I MAT is the optimal index hash table (used to record the optimal previous state index to achieve these probabilities);
[0104] Preferably, step S110 is performed by a calculation formula based on natural logarithm:
[0105] Recursive calculation t and t index ,in, A MAT is the set of state transition probabilities, B MAT is the set of single-state generation probabilities, t is an array for temporarily storing probabilities, t index is the index of the maximum probability
[0106] Calculated according to the recursive steps t and t index renew F MAT :
[0107]
[0108] Update the optimal index hash table at the same time I MAT :
[0109]
[0110] It should be noted that in step S110, by improving the joint probability calculation method (replacing conventional probability with logarithmic probability), the rate of numerical loss caused by probability multiplication is slowed down, thereby increasing the scale of GPS points that can be processed continuously in a single trajectory, and addition in logarithmic space is usually more stable and efficient than multiplication in probability space. Through this series of steps, the Viterbi algorithm can effectively find the most likely path in the map matching problem, that is, the path state sequence that best matches the observation data given the observation sequence. This process not only considers the consistency between the observation point and the road network state, but also the continuity between the path states.
[0111] Through the above steps in the embodiments of the present application, an improvement on the traditional hidden Markov model is achieved. By fusing the heading angle information and introducing the heading angle reduction coefficient to calculate the single-state generation probability, the direction consistency between the GPS trajectory points and the candidate road sections can be considered more finely, thereby improving the matching accuracy of special cases such as U-turns and two-way roads, and solving the problem of how to improve the road network matching accuracy.
[0112] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0113] In some embodiments, after the connectivity of the road network is repaired based on the road network data in step S103 of the above embodiment, the map matching method further includes:
[0114] The GPS trajectory data and the repaired road network data are preprocessed, wherein the preprocessing includes down-conversion and densification of GPS trajectory points and spatial hierarchical indexing of the road network.
[0115] It should be noted that ① for GPS trajectory points, frequency reduction and densification are used. In GPS trajectory data processing, in order to optimize the representation accuracy and calculation efficiency of the trajectory, frequency reduction and densification technology is often used to pre-process the original GPS data. For high-frequency, high positioning error, and GPS data containing a large amount of redundant information, the sampling frequency of the data can be reduced by selectively reducing the number of data points. The frequency reduction process is carried out through time sorting and equal-interval sampling to lower_n The frequency of data points is reduced by a factor of 2, thereby streamlining the data set and removing redundant information.
[0116] In some cases, in order to improve the resolution of trajectory data or meet specific analysis requirements, the original data may need to be densified. The densification process is based on a preset spherical distance threshold. L When this threshold is exceeded, data points are inserted. L / dense_interval )+1 is divided into equal parts to achieve local refinement of data. This strategy provides flexibility and adaptability for subsequent data analysis and processing by dynamically adjusting the distribution density of data points.
[0117] ② For road network spatial hierarchical indexing. The strategy of spatial hierarchical indexing is to improve the efficiency of spatial association between GPS trajectories and large-scale road network data. This strategy contains two key steps, aiming to optimize the mapping process from GPS trajectories to sub-road networks.
[0118] Firstly, a buffer is defined for a given GPS trajectory. The buffer is based on the geographic coordinates of the GPS trajectory points and is used to quickly extract the road network subset that is spatially adjacent to the trajectory points.
[0119] However, in the face of extremely large-scale road network data and extremely long GPS trajectories, the method that relies solely on the buffer zone may be insufficient in spatial correlation efficiency. In order to solve this problem, the second step is introduced: the research scope is divided into a series of grid cells, and the spatial correlation relationship between each grid and the overall road network is obtained through preprocessing.
[0120] When formally performing map matching, for each agent's GPS trajectory point set, we can avoid direct spatial correlation calculation between the GPS buffer and the road network. We only need to use the GPS buffer and the grid (the number of grid elements is much smaller than the number of road section elements) to perform spatial correlation to obtain the grid ID that the buffer passes through, and then screen the grid-road network correlation data table to obtain the grid ID that the buffer passes through. O The time complexity of (1) can quickly obtain the sub-region road network, thus saving a lot of computing time.
[0121] In some embodiments, in step S110 of the above embodiment, after obtaining the matching result between the GPS trajectory and the road network by using the Viterbi algorithm based on the state transition probability and the single state generation probability, the map matching method further includes:
[0122] Considering the possible sparse collection or signal loss of the original GPS trajectory data, resulting in discontinuous areas in the path, path completion fills these gaps by using the pre-calculated shortest path information of the road network nodes to ensure the continuity of the path. Specifically, by comparing whether there are more than one repeated nodes in the adjacent paths in the matching results, the missing paths are identified, and then these sections are effectively filled based on the pre-calculated shortest path information in the road network.
[0123] The embodiment of the present application provides a map matching system based on a hidden Markov model, the system comprising a data acquisition module, a single state generation probability calculation module, a state transition probability calculation module, and a map matching module;
[0124] Data acquisition module, used to obtain GPS trajectory data and road network data;
[0125] A single state generation probability calculation module is used to calculate the heading angle reduction coefficient between the direction vector of the GPS track point and the direction vector of the projection point of the GPS track point on the candidate road section in the road network according to the GPS track data and the road network data; based on the heading angle reduction coefficient, the GPS track data and the road network data, the single state generation probability of the GPS track point in the candidate road section in the road network is calculated;
[0126] A state transition probability calculation module is used to calculate the state transition probability between candidate road sections of two consecutive GPS trajectory points based on GPS trajectory data and road network data;
[0127] The map matching module is used to obtain the matching result between the GPS trajectory and the road network through the Viterbi algorithm according to the state transition probability and the single state generation probability.
[0128] Through the data acquisition module, single state generation probability calculation module, state transition probability calculation module and map matching module in the embodiments of the present application, an improvement on the traditional hidden Markov model is achieved. By integrating the heading angle information and introducing the heading angle reduction coefficient to calculate the single state generation probability, the direction consistency between the GPS trajectory points and the candidate road sections can be considered more finely, thereby improving the matching accuracy of special situations such as U-turns and two-way roads, and solving the problem of how to improve the road network matching accuracy.
[0129] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0130] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0131] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0132] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0133] In addition, in combination with the map matching method based on the hidden Markov model in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by the processor, any one of the map matching methods based on the hidden Markov model in the above embodiment is implemented.
[0134] In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a map matching method based on a hidden Markov model is implemented. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball, or touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0135] In one embodiment, Figure 5 is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application, such as Figure 5 As shown, an electronic device is provided, which may be a server, and its internal structure diagram may be as shown in Figure 5 As shown. The electronic device includes a processor, a network interface, an internal memory and a non-volatile memory connected through an internal bus, wherein the non-volatile memory stores an operating system, a computer program and a database. The processor is used to provide computing and control capabilities, the network interface is used to communicate with an external terminal through a network connection, the internal memory is used to provide an environment for the operation of the operating system and the computer program, the computer program is executed by the processor to implement a map matching method based on a hidden Markov model, and the database is used to store data.
[0136] Those skilled in the art will understand that Figure 5 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0137] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0138] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0139] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A map matching method based on a hidden Markov model, characterized in that: The method comprises: Get GPS track data and road network data; Based on the road network data, calculating the direction vector of each road section in the road network to obtain the road network section direction vector; Based on the GPS track data, a direction vector of each GPS track point is calculated to obtain a direction vector of the GPS track point; Based on the road network section direction vector, determining the direction vector of the projection point of the GPS trajectory point on the candidate road section in the road network; Calculate the angle between the direction vectors using the formula , calculate the angle between the direction vectors θ ,in, u is the direction vector of the projection point of the GPS trajectory point on the candidate road segment in the road network, v is the direction vector of the GPS track point; Based on the preset number of intervals N , the angle between the direction vectors θ Divide and get the heading angle reduction coefficient , where < x >Representative x Rounding, K (n) Representative K No. n elements; Based on the heading angle reduction coefficient, the GPS trajectory data and the road network data, a single state generation probability of a candidate road section of a GPS trajectory point in a road network is calculated; Based on the GPS trajectory data and the road network data, a state transition probability between candidate road sections of two consecutive GPS trajectory points is calculated; Based on the state transition probability and the single state generation probability, the matching result between the GPS trajectory and the road network is calculated by the Viterbi algorithm.
2. The method according to claim 1, characterized in that Calculating the single state generation probability of the candidate road section of the GPS track point in the road network based on the heading angle reduction coefficient, the GPS track data and the road network data includes: Based on the GPS track data and the road network data, calculating the projection distance from the GPS track point to the candidate road section in the road network; The single-state generation probability calculation formula , calculate the single-state generation probability of the candidate road section of the GPS trajectory point in the road network, where, GPS track point GPS i To candidate road section e j The projection distance, is the heading angle reduction factor, N is the number of preset intervals, < x >Representative x Rounding, K (n) Representative K No. n elements, GPS track point GPS i The direction vector and the candidate road segment e j The angle between the direction vectors of the projection points on σ is the standard deviation of the observation error.
3. The method according to claim 1, characterized in that Based on the state transition probability and the single state generation probability, the matching result between the GPS trajectory and the road network calculated by the Viterbi algorithm includes: Based on the state transition probability and the single state generation probability, the Viterbi algorithm is used to recursively calculate each subsequent GPS trajectory point to update F MAT and I MAT ,in, F MAT is a final state generation probability hash table used to store the final state generation probability, I MAT Generate an optimal indexed hash table for recording the probability of reaching the final state.
4. The method according to claim 3, characterized in that Based on the state transition probability and the single state generation probability, the Viterbi algorithm is used to recursively calculate each subsequent GPS trajectory point to update F MAT and I MAT include: By using the calculation formula based on natural logarithm: Recursive calculation t and t index ,in, A MAT is the set of state transition probabilities, B MAT is the set of single-state generation probabilities, t is an array for temporarily storing probabilities, t index is the index of the maximum probability; Based on recursive calculation t and t index , by updating the formula renew F MAT , by updating the formula renew I MAT .
5. The method according to claim 1, characterized in that After obtaining GPS trajectory data and road network data, the method includes: Based on the road network data, the connectivity of the road network is repaired to obtain repaired road network data.
6. The method according to claim 5, characterized in that Based on the road network data, repairing the connectivity of the road network includes: For each node in the road network, based on the road network data, determining a set of edges whose distance to the node is less than a first distance threshold; For each edge in the edge set, based on the road network data, calculate the projection point from the node to the edge; if the distance between the projection point and the endpoint of the edge is less than a second distance threshold, perform a direct connection repair between the node and the endpoint; otherwise, perform an interrupt repair between the node and the projection point.
7. The method according to claim 1, characterized in that Based on the GPS trajectory data and the road network data, calculating the state transition probability between candidate road sections of two consecutive GPS trajectory points includes: Based on the GPS track data, the straight-line distance between two consecutive GPS track points is calculated. Based on the GPS track data and the road network data, a path distance between projection points of the two GPS track points on respective candidate road sections in the road network is calculated; The state transition probability of the candidate road section is calculated based on the straight-line distance and the path distance.
8. A map matching system based on a hidden Markov model, characterized in that: The system is used to execute the method described in any one of claims 1 to 7, and the system includes a data acquisition module, a single state generation probability calculation module, a state transition probability calculation module, and a map matching module; The data acquisition module is used to acquire GPS trajectory data and road network data; The single state generation probability calculation module is used to calculate the heading angle reduction coefficient between the direction vector of the GPS track point and the direction vector of the projection point of the GPS track point on the candidate road section in the road network according to the GPS track data and the road network data; based on the heading angle reduction coefficient, the GPS track data and the road network data, the single state generation probability of the GPS track point in the candidate road section in the road network is calculated; The state transition probability calculation module is used to calculate the state transition probability between candidate road sections of two consecutive GPS trajectory points based on the GPS trajectory data and the road network data; The map matching module is used to calculate the matching result between the GPS track and the road network through the Viterbi algorithm according to the state transition probability and the single state generation probability.