Trajectory matching method based on layered map model
Through the trajectory matching method based on the hierarchical map model, using spectral clustering and implicit Markov model for trajectory matching, the problem of huge time consumption of trajectory matching calculation in the existing technology is solved, and efficient indoor positioning is achieved.
Patent Information
- Application Number
- CN202410454648.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-16
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2044-04-16
AI Technical Summary
The existing trajectory matching method consumes huge calculation time in large-scale indoor scenarios, resulting in insufficiency in positioning.
The trajectory matching method based on the hierarchical map model is adopted to construct a hierarchical map through spectral clustering, and the trajectory is matched to the map model in a thick to thin way, and the trajectory matching is performed using the implicit Markov model and the Vitbit algorithm.
The calculation time of the matching process is significantly reduced, and the positioning efficiency is improved while maintaining positioning accuracy.
Smart Images

Figure CN118347511B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of trajectory matching technology, and more specifically to a trajectory matching method based on a layered map model. Background Technology
[0002] Location is a crucial foundation for human life and development. Accurate, reliable, and ubiquitous indoor location information is urgently needed for public safety, emergency rescue, and monitoring of vulnerable populations, and is a key support for the Internet of Things, mobile social networking, and intelligent manufacturing. However, compared to open outdoor spaces, indoor spaces are more complex, characterized by enclosure and spatial constraints, making GPS and other global navigation satellite systems and cellular network positioning solutions unsuitable for this environment. Although numerous indoor positioning technologies, including PDR and Wi-Fi, have been proposed, issues such as trajectory drift and location jumps persist. Map matching, utilizing the constraints of indoor spatial structure information to correct initial positioning results, is an effective method to improve positioning accuracy.
[0003] Typical map matching methods optimize trajectories by limiting the spatial extent of adjacent estimated locations, for example:
[0004] 1) Particle filtering methods sample particles based on the current orientation and step size, ignoring particles that penetrate obstacles. The current position is estimated using a weighted average of the remaining particles. The accuracy of this type of method largely depends on the number of particles. To achieve satisfactory performance, a large number of particles need to be involved in the calculation, resulting in significant time consumption.
[0005] 2) Shape-based methods treat trajectories and indoor map models as point sets and match them using traditional shape descriptors. However, when these methods are applied on a large scale, the computation time increases dramatically with the number of nodes in the map model, reducing the practicality of the methods in real-world scenarios and making them difficult to operate. Summary of the Invention
[0006] This invention proposes a trajectory matching method based on a layered map model to solve the technical problems of huge computational resource consumption and excessively long matching time in existing trajectory matching methods.
[0007] To address the aforementioned technical problems, this invention provides a trajectory matching method based on a layered map model, comprising the following steps:
[0008] A hierarchical map is constructed using spectral clustering. The nodes of the first layer of the hierarchical map are used as the hidden states of the Hidden Markov Model. The state transition matrix of the Hidden Markov Model is constructed. The trajectory is divided into several trajectory segments according to the time sequence, and trajectory matching is performed using the Dimension Bit algorithm. The nodes corresponding to the trajectory segments are assigned to the corresponding next layer map model for node matching until all matching results reach the leaf nodes. The matching results are merged according to the timestamp to obtain the final matching result.
[0009] Preferably, the state transition matrix is calculated using the distance between the cluster center coordinates.
[0010] Preferably, the element P(z) in the state transition matrix i |z j The expression for ) is:
[0011]
[0012] In the formula, P(z) i |z j ) represents node z i To node z j The transition probability, exp represents an exponential function with base e as the natural constant, d i,j For node z i and z j The path distance between them is δ, where δ is the variance of the path distance.
[0013] Preferably, the method for trajectory matching using the Dimension Bit algorithm includes:
[0014] 1) Set the initial probability p(z1) of each node to the same value;
[0015] 2) For the final state z i The joint probability of the hidden state sequence is updated;
[0016] 3) Set the state at time point n+1 to z i The state of the sequence at time point n is recorded in table τ(z). i (n+1);
[0017] 4) When the end of the sequence is reached, calculate the final state as z. i The maximum joint probability of the hidden state sequence is used to determine the optimal matching node at the endpoint.
[0018] 5) Through table τ(z) i (n+1) Calculate the optimal matching node at the previous time point.
[0019] Preferably, for the final state z i The joint probability δ of the hidden state sequence n+1 (zi The expression for updating is:
[0020]
[0021] In the formula, δ n (z) represents the joint probability of the sequence at time n, p(z) i |z) represents the distance from other nodes to node z. i The transition probability, Z represents the set of nodes, p(x) n+1 |z i () represents the trajectory x at time point n+1. n+1 Corresponding node z i The probability of divergence.
[0022] Preferably, the joint probability δ N The expression is:
[0023]
[0024] In the formula, N represents the number of trajectory points, p(z n |z n-1 p(x) represents the transition probability. n |z n ) represents the divergence probability between the trajectory point and the reference point.
[0025] Preferably, the transition probability includes the transition probability between two reference points, the transition probability from the reference point to other point sets, and the transition probability between two point sets.
[0026] Preferably, table τ(z) i The expression for (n+1) is:
[0027]
[0028] Preferably, the endpoint optimal matching node The expression is:
[0029]
[0030] Preferably, the optimal matching node at the previous time point The expression is:
[0031]
[0032] In the formula, This indicates that the state at time point N is The state corresponding to time point N-1.
[0033] The beneficial effects of this invention include at least the following: Addressing the problem of excessive computation time in positioning calculations for existing map matching methods in large-scale indoor scenes, this invention proposes a trajectory matching method based on a layered map. By matching trajectories to the map model in a coarse-to-fine manner using a layered model, the computation time of the matching process is greatly reduced. Significant acceleration is achieved while maintaining positioning accuracy. Attached Figure Description
[0034] Figure 1 This is a schematic diagram of the method flow according to an embodiment of the present invention;
[0035] Figure 2 This is a schematic diagram of a layered map model construction method according to an embodiment of the present invention;
[0036] Figure 3 This is a schematic diagram of the trajectory recursive matching method for layered maps according to an embodiment of the present invention;
[0037] Figure 4 This is a schematic diagram of the test map plan according to an embodiment of the present invention;
[0038] Figure 5 This is a CDF diagram comparing the positioning errors of an embodiment of the present invention;
[0039] Figure 6 This is a schematic diagram comparing the efficiency of the positioning methods in this embodiment of the invention;
[0040] Figure 7 This is a schematic diagram illustrating the impact of parameter configuration on positioning accuracy in an embodiment of the present invention;
[0041] Figure 8 This is a schematic diagram illustrating the effect of parameter configuration on positioning speed according to an embodiment of the present invention;
[0042] Figure 9 This is a schematic diagram of the control experiment results of an embodiment of the present invention. Detailed Implementation
[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present invention.
[0044] like Figure 1The embodiment of the present invention provides a trajectory matching method based on a hierarchical map model, including the following steps: constructing a hierarchical map using spectral clustering; using the nodes of the first layer of the hierarchical map as the hidden states of a hidden Markov model; constructing the state transition matrix of the hidden Markov model; dividing the trajectory into several trajectory segments according to time sequence, and performing trajectory matching using the Dimension Bit algorithm; assigning the nodes of the corresponding trajectory segments to the corresponding next layer of the map model for node matching, until all matching results reach the leaf nodes; merging the matching results according to timestamps to obtain the final matching result.
[0045] Specifically, in this embodiment of the invention, the hierarchical map model is the foundation for accelerating trajectory matching inference. A predefined map graph model with nodes and edges is used as input and constructed using a hierarchical clustering method. The predefined map can be created through manual collection or automatic information gathering with the aid of other devices. Since this embodiment of the invention focuses on accelerating the method, the method for creating the predefined map will not be elaborated upon here, but will be briefly described as follows: Figure 2 As shown.
[0046] This invention constructs a distance matrix using the distances between nodes in a predefined map, and employs spectral clustering for analysis. Since spectral clustering requires calculating the similarity between nodes, this invention chooses to construct a similarity matrix by transforming the distance matrix with a Gaussian kernel as input. The spectral clustering method essentially analyzes the min-max cut algorithm to determine the index of a node. After the first node grouping, a tree model is constructed to continue generating maps as branch nodes for the next layer. Based on the path distance matrix of the grouped nodes, the spectral clustering method is used to further divide the subgroup nodes in the same way. The map tree growth stops when it reaches the pre-set number of clusters per layer and the minimum number of nodes per cluster.
[0047] This invention employs a Hidden Markov Model (HMM) to describe the inference process, where map reference points are set as hidden states and input trajectory points are used as observation variables. The goal of HMM inference is to find the sequence of hidden states with the maximum joint probability, defined as follows:
[0048]
[0049] p(z1), p(z) n |z n-1 ), p(x n |z n Let p(z1) be the initial probability, transition probability, and divergence probability. Since there are no prior knowledge assumptions about each hidden state in this embodiment of the invention, the initial probability p(z1) of each node is the same. The transition probability p(z2) is... n |z n-1The probability p(x) represents the likelihood of transitioning from one node to another. This invention calculates this probability using the path distance between the two nodes. n |z n The relationship between trajectory points and reference points is represented by the distance between their positions. In this embodiment of the invention, the hidden state includes not only the reference points but also the center of the reference point cluster. Based on the definitions of three probabilities, the trajectory matching result can be calculated using a typical dynamic programming algorithm, where the transition probability is defined as follows.
[0050] 1) Transition probability between two reference points
[0051] For a predefined map model, this embodiment of the invention calculates the path distance between nodes using the Dijkstra algorithm and calculates the transition probability using the Gaussian kernel function. The calculation method for the transition probability between two reference points is as follows:
[0052]
[0053] d i,j For node z i and z j The path distance between them, δ is the variance of the path distance, which needs to be adjusted according to the characteristics of the data in the experiment, and represents an exponential function with the base being the natural constant e.
[0054] 2) From z j The probability of going to other point sets
[0055] From z j The probability of going to other point sets is determined by the conditional probability P(z1,…,z). N |z j By definition, since P(z) i |z j Conditionally independent, P(z1,…,z) N |z j The calculation can be performed by multiplication, as follows:
[0056]
[0057] Transition from other sets of points to point z. j The probability can be calculated using Bayes' theorem, as follows:
[0058]
[0059] Since there is no prior information, the prior probability of each node in the map model is the same, and the probability P(z) of each node is... i They can be considered to be the same.
[0060] 3) Transition probability between two point sets
[0061] Combining the two formulas above, the transition probability between two point sets can be defined, and the calculation method is as follows:
[0062]
[0063] Based on the above definitions, we can obtain the transition probabilities between points, point sets, and point sets in the layered map, which can be used for subsequent reasoning processes.
[0064] Specifically, if Figure 3 As shown, during map matching, this embodiment of the invention uses Hidden Markov Model (HMM) and Viterbi algorithm for modeling and inference at each layer of the hierarchical map. The results are then passed to the next layer of the map, and modeling and inference are performed recursively. The specific steps are as follows:
[0065] 1) The nodes of the first layer of the layered map are used as the hidden states of the HMM model. The state transition matrix is obtained by using the distance of the cluster center coordinates through formula (2). The input trajectory is matched by the Viterbi algorithm. The trajectory points are divided into several segments according to the temporal relationship, and each segment corresponds to the node of the layer.
[0066] 2) Based on the matching nodes of the previous layer, the corresponding trajectory segment nodes are assigned to the next layer map model corresponding to the node. Similarly, an HMM model is constructed through the state transition matrix, and the Viterbi algorithm is used to match the input trajectory, divide the trajectory, and assign the corresponding matching result nodes.
[0067] 3) If the current node is not a leaf node, proceed to step two. If it is, then proceed with the same steps as constructing the HMM model and using the Viterbi algorithm to match the trajectory, recording the matching results of the current node's coordinates and the timestamp of the trajectory point.
[0068] 4) Combine the matching results on all leaf nodes and merge them according to the timestamp to obtain the final matching result of the trajectory.
[0069] Among them, the Viterbi algorithm is a typical dynamic programming method that can be used to solve the decoding problem of hidden state sequence prediction under the condition of maximum joint probability of HMM.
[0070] Formula (1) is the joint probability expression defined in the embodiments of the present invention. For the sake of simplification, the joint probability P(x1,…,x) is expressed as follows: N ,z1,…,z N Rewritten as δ N δ N (z i ) represents the final state as z iThe joint probability of the hidden state sequence. Combining the transition probability and the divergence probability, the Viterbi algorithm defines the joint probability δ at time point n+1. n+1 (z i The update method is as follows.
[0071]
[0072]
[0073] Where p(z) i |z) represents the distance from other nodes to node z. i The transition probability, p(x) n+1 |z i ) represents the node z corresponding to the observation at time point n+1. i The divergence probability, τ(z) i (n+1) represents the state z at time point n+1. i The sequence is recorded in a table at time n. When the update process reaches the end of the sequence, δ can be calculated using formula (7). N The maximum value of (z) is first used to determine the final optimal matching node, and then the table τ(z) is used to determine the optimal matching node. i The optimal matching node at the previous time point is calculated as follows (n+1), and the specific calculation method is as shown in formula (8).
[0074]
[0075]
[0076] In the formula, This indicates that the state at time point N is The state corresponding to time point N-1.
[0077] By using the above-described hierarchical iteration method, the final trajectory matching result can be obtained.
[0078] The effectiveness of the present invention is illustrated below by comparing it with other existing methods.
[0079] This invention selects the second floor of a museum as the experimental site. The floor plan of the experimental scene is shown below. Figure 4As shown. The scene area is 87x57 square meters, and the floor plan is divided into 543 grids, each 1 meter in size, as the initial floor plan. The grids are connected in one-dimensional form in corridors or narrow spaces, and in two-dimensional form in open spaces such as halls, ensuring coverage. The center position of the grid is estimated using laser ranging, and the coordinates are described in meters. Two people walk at a constant speed along three pre-defined paths at a frequency of 15 Hz, and trajectory information is collected using two smartphones: a Samsung Galaxy Note 4 and a Google Nexus 6. Each path is over 200 meters long, and collecting sensor readings for each path takes approximately 5 minutes. The time to reach the marker points is recorded, and the true coordinates of other points are calculated by interpolating the times of adjacent marker points.
[0080] Figure 5 The cumulative density function (CDF) of the embodiments of this invention and other methods is compared to improve positioning accuracy. KNN and Hclustering show similar positioning error distributions. While Hclustering aims to accelerate positioning through hierarchical map partitioning, its accuracy is limited due to the increased probability of errors from multiple predictions for a single location; therefore, over half of the errors are less than 4 meters, and approximately 75% are less than 6 meters. Htrack, PDMatching, and the present invention outperform other methods because they utilize sequential trajectory information and perform location prediction based on a map model of indoor environmental spatial information. Figure 5 It can be seen that PDMatching performs slightly better than Htrack, but both have over 70% of the errors less than 4m and nearly 90% of the errors less than 6m. Although Htrack proposes to use heading information to help find the correct prediction result, the excessive jumps between Wi-Fi trajectory points cause the predicted position of the trajectory to be far from the actual position, rendering the heading information ineffective in this situation and easily leading to the method's localization failure. PDMatching considers non-adjacent reference points to construct a path distance matrix, which can correctly predict the matching results of long-distance trajectory point changes, improving the localization accuracy of the results. The results show that almost 70% of the errors are less than 4m and approximately 85% of the errors are less than 6m. Because multiple estimates of a position are less accurate and produce larger errors, the localization accuracy of the method in this invention is slightly lower than that of Htrack and PDMatching. However, because our method utilizes the sequence information of the trajectory to predict the trajectory position, its performance is still better than KNN and Hclustering, and similar to that of Htrack and PDMatching.
[0081] To demonstrate the efficiency and effectiveness of the method, map models were generated under different configurations to test the invented method and Hclustering, and their runtime at each step was compared. The results are as follows: Figure 6 As shown, the average error of KNN was used as a baseline for comparison. The results show that the running time of the Hclustering method is mostly less than 0.02ms, while the running time of the embodiments of this invention is mainly between 0.06 and 0.08ms. This is primarily because when the treemap model is deep, the time for calling the prediction function dominates the runtime. Therefore, several runtimes of Hclustering can be compared with the method of this invention. For the method of this invention, it is worth noting that two runtimes are significantly longer than the others, at 0.18ms and 0.2ms respectively, but their average errors are the lowest. This is because, in certain configurations, the regions segmented from the environment are large and located at the top level of the map model tree, making the inference time for long trajectory portions longer. For Htrack and PDMatching, the running time of the method of this invention is significantly faster. It is noteworthy that all average errors of Hclustering are higher than the performance of KNN, meaning that this method sacrifices accuracy for efficiency, while the method of this invention improves the average localization error in most configurations.
[0082] Figure 7 It is a visualization of the impact of parameter configuration on positioning accuracy. Figure 7 The left side shows the impact of the number of clusters per layer on localization accuracy. The results indicate that as the number of clusters per layer increases, the average error only increases when the number of nodes per layer is 500; otherwise, the error fluctuates. This is because more nodes create a more complex structure, which is beneficial for using the sequence information of the trajectories for localization inference. When the sub-region is small, the localization process is similar to single-point prediction from global to local without using sequence information. Under different numbers of clusters, the method consistently exhibits the worst average error with 100 nodes. For smaller cluster numbers, a larger number of nodes limits the depth growth of the tree, resulting in similar map model generation outcomes under this configuration. Figure 7 As can be seen on the right, the average error decreases as the minimum number of nodes specified for each layer increases. This is because the sequence information of the trajectory is useful when there are more nodes and a more complex spatial structure. The prediction under the configuration with a small number of minimum nodes is similar to the Hclustering method, which ignores the sequence information. When the minimum number of nodes is greater than 300, the results under each cluster number configuration are almost convergent. This means that if the indoor environment is divided into appropriately sized sections, the present invention can make successful predictions using the sequence information. Therefore, the results show that the entire environment contains redundant information for the localization method, proving the feasibility of the present invention for layered map processing.
[0083] Figure 8 The left side of the graph shows the impact of the number of clusters per layer on localization efficiency. As the number of clusters increases, almost all runtimes decrease because, according to computational complexity analysis, more sub-regions divide the area into smaller parts, accelerating prediction. It's worth noting that when the number of clusters is 2 and the minimum number of nodes in each cluster is 500, the localization time is significantly different compared to other configurations. This is because the tree map model generated in this configuration has a larger area and more nodes, requiring more time to infer trajectory matching results. As the number of clusters increases, the reduction in runtime becomes less significant as the time consumed by calling recursive functions becomes increasingly dominant. Figure 8 The right side shows that our method takes more time as the number of reference points increases, because the computational complexity of each trajectory part is O(N). 2 T), where N is the number of reference points in the sub-region. It's important to note that a minimum of 50 nodes will take more time because recursive function calls consume more time. Furthermore, with 50 nodes and 2 clusters per layer, localization will take even longer because the map model's tree structure is deeper, resulting in more recursive function calls and increased time consumption. When the configuration generates a map with 500 nodes and 2 clusters per layer, the indoor map is divided into two regions, one of which is larger, leading to decreased efficiency and a sharp increase in localization time.
[0084] Therefore, to demonstrate the necessity of using spectral clustering in the embodiments of the present invention, it was compared with bottom-up clustering implemented in Matlab software, and the experimental results are as follows. Figure 9 As shown. Since the reasoning process is the same, the time costs of the two methods are basically similar, but the time costs vary slightly due to the different map models constructed by the two methods. The mean positioning error indicates that the spectral clustering method used in this invention is superior to the bottom-up clustering method. This is because the bottom-up clustering method groups reference points according to distance, while the sampling distance of the input graphical model reference points is almost always 1m, leading to chaotic grouping of adjacent reference points, resulting in map division errors and decreased positioning accuracy. Since spectral clustering considers a similarity matrix containing global information to group nodes, the map model construction is more reasonable. Using the results of spectral clustering as evidence for region division achieves significant acceleration while maintaining positioning accuracy.
[0085] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described; only preferred embodiments of the present invention are illustrated. The descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. As long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0086] It should be noted that those skilled in the art can make various modifications and improvements without departing from the inventive concept, and these all fall within the scope of protection of this invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A trajectory matching method based on a layered map model, characterized in that: The following steps are involved: A hierarchical map is constructed by spectral clustering. The nodes in the first layer of the hierarchical map are used as the hidden states of the hidden Markov model. Construct the state transfer matrix of the hidden Markov model; divide the trajectory into several segments according to the time sequence, and perform trajectory matching through the Vibit algorithm; assign the nodes corresponding to the trajectory segments to the corresponding next-layer map model for node matching until all matching results reach the leaf node; Merge the matching results by timestamp to get the final matching result; The method for constructing a hierarchical map includes: constructing a distance matrix using the distances between nodes in a predefined map, and selecting a similarity matrix as input by transforming the distance matrix through a Gaussian kernel; After the first node grouping, the map is continued to be generated as the branch nodes of the previous layer map by constructing a tree model; the subgroup nodes are divided by the spectral clustering method according to the path distance matrix of the grouped nodes; the map tree growth stops when it reaches the pre-set conditions of the number of clusters per layer and the minimum number of nodes per cluster to obtain a hierarchical map.
2. The trajectory matching method based on the layered map model according to claim 1, characterized in that: The state transfer matrix is calculated using the distance of cluster center coordinates.
3. The trajectory matching method based on the layered map model according to claim 2, characterized in that: The element P(z i |z j ) is: In the formula, P(z i |z j ) represents node z i To node z j The transition probability, exp represents the exponential function with the base being the natural constant e, d i,j For node z i and z j , and δ is the variance of the path distance.
4. The trajectory matching method based on a layered map model according to claim 1, characterized in that: Methods for trajectory matching using the Vibit algorithm include: 1) Set the initial probability p(z1) of each node to the same value; 2) For the final state z i The joint probability of the hidden state sequence is updated; 3) Record the state at time point n+1 as z i The table τ(z i ,n+1); 4) When reaching the end of the sequence, calculate the final state as z i The maximum value of the joint probability of the hidden state sequence determines the optimal matching node of the end point; 5) Through the table τ(z i ,n+1) calculates the optimal matching node at the previous time point.
5. The trajectory matching method based on the layered map model according to claim 4 is characterized in that: For the final state z i The joint probability of the hidden state sequence δ n (z) The updated expression is: In the formula, δ n (z) represents the joint probability, p(z i |z) is other nodes to node z i The transition probability, Z represents the set of nodes, p(x n+1 |z i ) represents the trajectory x at time point n+1 n+1 Corresponding node z i The probability of divergence.
6. The trajectory matching method based on the layered map model according to claim 5, characterized in that: The joint probability δ N The expression is: Where N represents the number of trajectory points, p(z n |z n-1 ) represents the transition probability, p(x n |z n ) represents the divergence probability between the trajectory point and the reference point.
7. The trajectory matching method based on the layered map model according to claim 6 is characterized in that: The transition probability includes the transition probability between two reference points, the transition probability from a reference point to other point sets, and the transition probability between two point sets.
8. The trajectory matching method based on a layered map model according to claim 5, characterized in that: Table τ(z i ,n+1) is:
9. The trajectory matching method based on the layered map model according to claim 8, characterized in that: The best matching node at the end point The expression is:
10. The trajectory matching method based on the layered map model according to claim 9, characterized in that: The best matching node at the previous time point The expression is: In the formula, Indicates that the state at time point N is , the state corresponding to the N-1 time point.
Citation Information
Patent Citations
Positioning method based on layered hidden Markov model (HMM)
CN106371064A
Method for matching and positioning of indoor maps
CN110345935A