Mass trajectory hierarchical parallel clustering method and system based on spatial similarity

By using grid unit division, minhash signature calculation, and barrel mapping in the trajectory clustering method, the existing method has the lack of calculation complexity and adaptability, and realizes the rapid and efficient cluster of massive trajectory data.

CN119357716AActive Publication Date: 2025-01-24YANTAI UNIV
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411918325.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-01-24
Estimated Expiration
2044-12-25

AI Technical Summary

Technical Problem

The existing trajectory clustering methods have insufficient computational complexity and adaptability, especially when processing massive trajectory data, the computational time complexity is high and it is difficult to adapt to different data sets.

Method used

Adopt a large -scale hierarchical and parallel clustering method based on space -based similarity, through the grid unit division, minhash signature calculation, signature matrix division, and barrel mapping to achieve the rapid cluster of the trajectory.

Benefits of technology

This method can divide the trajectory into several classes without having to know the number of class data sets in advance and no training in advance, improve the cluster efficiency of large -scale trajectory data sets, and effectively avoid the distance calculation of distance calculation. The high time complexity problem brings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357716A_ABST
    Figure CN119357716A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of spatio-temporal data mining, in particular to a massive trajectory hierarchical parallel clustering method and system based on spatial similarity, and the method comprises the steps: carrying out the grid cell division of a trajectory region according to obtained trajectory data; converting the trajectory data into set data based on the divided grid units; according to a set form of the set data, calculating a MinHash signature corresponding to each track, and forming a signature matrix by the MinHash signatures of all tracks; dividing the obtained signature matrix into a plurality of bands, and mapping tracks in the bands into buckets; classifying the tracks mapped into the same bucket in at least one band into the same class; according to the method, under the conditions that the number of classes in the trajectory data set does not need to be known in advance and the trajectory data set does not need to be trained, the trajectory is adaptively and rapidly divided into a plurality of classes according to the spatial similarity of the trajectory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of spatiotemporal data mining, and in particular to a method and system for hierarchical parallel clustering of massive trajectories based on spatial similarity. Background Art

[0002] Trajectory data usually comes from moving objects (such as animals, people, vehicles, etc.). These objects move in time sequence in space, forming a series of trajectory points, each of which usually includes spatial location (latitude and longitude) information. Trajectory clustering technology based on spatial similarity is designed to solve this problem. It divides a set of trajectory data sets into several classes by measuring the spatial similarity between trajectories, so that the trajectory similarity within the same class is high, while the trajectory similarity between different classes is low. This method can help us identify trajectories with similar movement patterns and extract valuable information from them. When clustering trajectories based on spatial similarity, it is often necessary to first calculate the similarity between trajectories based on a certain spatial trajectory distance measurement method. Afterwards, the trajectories are classified according to the spatial similarity between the trajectories, and the trajectories with higher similarity are classified into one class. At present, the commonly used trajectory distance measurement methods mainly include DTW, Fréchet, Hausdorff, etc. When calculating the distance between a pair of trajectories, these distance measurement methods usually take one trajectory as the benchmark and calculate the Euclidean distance between each trajectory point contained in the trajectory and the trajectory point in another trajectory. This type of method has the following shortcomings: (1) A trajectory usually contains a large number of trajectory points. Calculating the Euclidean distance between a large number of trajectory point pairs in any two trajectories requires a high time complexity, which will incur huge overhead, especially when the number of trajectories is large.

[0003] (2) Although some works have adopted trajectory compression algorithms, such as the Douglas-Peucker (DP) algorithm, to extract key points from trajectories and represent trajectories with fewer trajectory points, if the number of retained trajectory points is too small, the accuracy of subsequent clustering results will decrease. Otherwise, it will be difficult to solve the problem of high computational complexity between trajectories.

[0004] (3) Since it is impossible to know in advance which category a trajectory belongs to, a large number of unnecessary distance calculations may be required for the trajectory.

[0005] There are also some works based on end-to-end clustering models of deep neural networks to avoid point-by-point distance calculations. However, these models rely heavily on a large number of labeled training datasets, which may be difficult to obtain quickly in different fields. In addition, these models are highly dependent on their training data and are difficult to adapt to datasets with different distributions. For example, a model trained on a vehicle trajectory dataset in city A may not be well applied to a shared bicycle trajectory dataset in city B.

[0006] In summary, most of the existing trajectory clustering methods that are not based on deep learning require high computational complexity and may be limited by the scale of trajectory data when applied. Clustering algorithms based on deep learning need to rely on labeled training datasets and are difficult to be flexibly applied to different trajectory datasets when applied. Summary of the invention

[0007] In order to solve the above-mentioned problems, the present invention provides a method and system for hierarchical parallel clustering of massive trajectories based on spatial similarity.

[0008] In a first aspect, the present invention provides a massive trajectory hierarchical parallel clustering method based on spatial similarity, which adopts the following technical solution: A hierarchical parallel clustering method for massive trajectories based on spatial similarity, comprising: Get trajectory data; Divide the track area into grid cells according to the acquired track data; Convert trajectory data into set data based on divided grid cells; According to the collection form of the collection data, the MinHash signature corresponding to each trajectory is calculated and the MinHash signatures of all trajectories are combined into a signature matrix; The obtained signature matrix is ​​divided into several bands, and the trajectories in the bands are mapped into buckets; Trajectories that are mapped to the same bucket in at least one band are grouped into the same class; Determine and output the clustering results.

[0009] Furthermore, the grid unit division of the trajectory area according to the acquired trajectory data includes, for a given trajectory data set, determining its spatial coverage based on the minimum and maximum x and y coordinates of all trajectories, and then selecting a fixed grid unit size z to divide the trajectory space into m × n units.

[0010] Furthermore, the grid unit based on the division converts the trajectory data into set data, including determining the grid unit through which the trajectory path passes according to the coordinates of each point in the trajectory, wherein any trajectory t i is represented by the number of grid cells it passes through, denoted byg i = { c {x,y}}, where x∈[1, m] and y∈[1, n], encode each grid cell as the identifier of the grid, where each grid is encoded using an integer as its identifier using the Morton encoding method, and each trajectory corresponds to a set of integers consisting of the identifiers of several grid cells it passes through.

[0011] Furthermore, the MinHash signature corresponding to each trajectory is calculated and the MinHash signatures of all trajectories are combined into a signature matrix, including storing the trajectory set data in the form of a matrix to obtain a TE-matrix; using a hash function to calculate the hash value corresponding to each grid unit identifier and storing it in the form of a matrix to obtain an HV-matrix; generating a Sig-matrix based on the TE-matrix and the HV-matrix, initializing the elements in the Sig-matrix to ∞, wherein each row i in the TE-matrix is ​​traversed, and the value of each column is checked. If the value is '0', no operation is performed; if the value is '1', the hash value of the same row in the TE-matrix is ​​used to update the corresponding column in the Sig-matrix; and the rows of the HV-matrix are used to update the Sig-matrix, and finally the signature matrix is ​​obtained.

[0012] Furthermore, the obtained signature matrix is ​​divided into several bands, and the trajectories in the bands are mapped into buckets, including further dividing the rows of the Sig-matrix into multiple bands, creating a bucket array for each band, and mapping the trajectories with the same signature in the band to the same bucket. The trajectories in the same bucket indicate that the signatures have high Jaccard similarity.

[0013] Further, the trajectories mapped to the same bucket in at least one band are classified into the same class, including creating an initial class C 1 And set it to any bucket in the first band, scan the buckets in the remaining bands, and find the bucket that matches C 1 There are buckets where the trajectories in the bucket intersect. If there is such a bucket, merge the trajectories in the bucket into C 1 After scanning each bucket in the second to last band, return to the first band. C 1 The buckets with intersections are also merged. After scanning the buckets in the first band, you can confirm C 1After determining C1, the unprocessed buckets in the first band are taken as new classes in turn until all the buckets in the first band are processed. It is determined whether there is an intersection between each of the final classes. If so, the classes with intersections are also merged. The classes with no intersections are the final results of this clustering process.

[0014] Furthermore, the determining and outputting of clustering results includes determining whether each class satisfies a set condition, and if so, outputting a final clustering result; if not, repeating the clustering operation for each class in parallel, wherein when performing grid unit division, a smaller grid unit is used to divide the entire trajectory space of the trajectory in the class.

[0015] Second, a massive trajectory hierarchical parallel clustering system based on spatial similarity, including: A data acquisition module is configured to acquire trajectory data; A unit division module is configured to divide the track area into grid units according to the acquired track data; The conversion module is configured to convert the trajectory data into set data based on the divided grid units; The matrix module is configured to, according to the set form of the set data, calculate the MinHash signature corresponding to each trajectory and form the MinHash signatures of all trajectories into a signature matrix; A mapping module, configured to divide the obtained signature matrix into a number of bands and map the trajectories in the bands into buckets; A partitioning module configured to partition trajectories mapped to the same bucket in at least one band into the same class; The judgment output module is configured to judge and output the clustering result.

[0016] In a third aspect, the present invention provides a computer-readable storage medium storing a plurality of instructions, wherein the instructions are suitable for being loaded by a processor of a terminal device and executing the method for hierarchical parallel clustering of massive trajectories based on spatial similarity.

[0017] In a fourth aspect, the present invention provides a terminal device, including a processor and a computer-readable storage medium, the processor being used to implement various instructions; the computer-readable storage medium being used to store multiple instructions, the instructions being suitable for being loaded by the processor and executing the method for hierarchical parallel clustering of massive trajectories based on spatial similarity.

[0018] In summary, the present invention has the following beneficial technical effects: (1) The present invention adaptively and quickly divides trajectories into several classes based on their spatial similarity without knowing the number of classes in the trajectory dataset in advance or training the trajectory dataset. After the division, the spatial similarity between trajectories in each class is high, while the spatial similarity between trajectories in different classes is low.

[0019] (2) In order to improve the clustering efficiency of large-scale trajectory datasets, a method is proposed to convert trajectory data into set data and cluster them based on the locality sensitive hashing method, which effectively avoids the high time complexity problem caused by the distance calculation between trajectory pairs. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 A schematic diagram of a massive trajectory hierarchical parallel clustering method based on spatial similarity according to Embodiment 1 of the present invention; Figure 1 (a) is a flow chart of a method for hierarchical parallel clustering of massive trajectories based on spatial similarity according to Embodiment 1 of the present invention; Figure 1 (b) is a flow chart of a classification method based on bucket mapping according to Embodiment 1 of the present invention; Figure 2 This is an example diagram of dividing the trajectory space into grid units according to Embodiment 1 of the present invention; Figure 3 This is an example diagram of encoding a grid unit according to Embodiment 1 of the present invention; Figure 4 The grid unit is divided and encoded based on the embodiment 1 of the present invention. Figure 2 An example diagram of converting trajectory data into collection data; Figure 5 Schematic diagram of the TE-matrix and HV matrix calculation process of Example 1 of the present invention; Figure 5 (a) is a schematic diagram of a trajectory encoding matrix (TE-matrix) according to Embodiment 1 of the present invention; Figure 5 (b) is a matrix (HV-matrix) obtained by the trajectory encoding of Example 1 of the present invention according to the hash function; Figure 5 (c) is the hash function and trajectory encoding of Example 1 of the present invention; Figure 6 This is an example diagram of the MinHash signature matrix calculation of Example 1 of the present invention; Figure 7 This is a schematic diagram of MinHash signature matrix clustering based on Example 1 of the present invention; Figure 7(a) is an example diagram of dividing the obtained MinHash signature matrix into several bands according to Embodiment 1 of the present invention; Figure 7 (b) is an example diagram of mapping the tracks in the band to the buckets according to Embodiment 1 of the present invention; Figure 7 (c) is an example diagram of trajectory classification based on bucket mapping results according to Embodiment 1 of the present invention; Figure 8 This is a schematic diagram of the effect of the number of hash functions on the performance of the HPTC algorithm according to Example 1 of the present invention; Figure 8 (a) is a display of the effect of the number of hash functions on the computation time of the HPTC algorithm when clustering four trajectory data sets in Example 1 of the present invention; Figure 8 (b) shows the effect of the number of hash functions of Example 1 of the present invention on the accuracy of the HPTC algorithm when clustering four trajectory data sets (with the DBI index as a reference); Figure 8 (c) is a display of the effect of the number of hash functions of Example 1 of the present invention on the accuracy of the HPTC algorithm when clustering four trajectory data sets (with the SC index as a reference); Fig. 9 Schematic diagram of the effect of the grid unit size on the performance of the HPTC algorithm according to Example 1 of the present invention; Fig. 9 (a) shows the effect of the grid cell size on the computational time and accuracy of the HPTC algorithm when clustering on the LABOMNI dataset (with the DBI index as a reference) in Example 1 of the present invention; Fig. 9 (b) is a display of the effect of the grid cell size on the computational time and accuracy of the HPTC algorithm when clustering on the LABOMNI dataset (with the DBI index as a reference) in Example 1 of the present invention; Fig.10 It is a schematic diagram of the effect of the DP algorithm on the performance of the HPTC algorithm according to Example 1 of the present invention; Fig.10 (a) shows the influence of the DP algorithm of Example 1 of the present invention on the accuracy of the HPTC algorithm when clustering four trajectory data sets (with the SC index as a reference); Fig.10 (b) shows the effect of the DP algorithm of Example 1 of the present invention on the accuracy of the HPTC algorithm when clustering four trajectory data sets (with the DBI index as a reference); Fig.10(c) is a display of the effect of the DP algorithm of Example 1 of the present invention on the computational time of the HPTC algorithm when clustering four trajectory data sets; Fig.11 Schematic diagram of performance comparison between the HPTC algorithm of Example 1 of the present invention and a benchmark algorithm; Fig.11 (a) is a comparative display of the computation time of the HPTC algorithm of Example 1 of the present invention and three benchmark methods when clustering on four trajectory data sets; Fig.11 (b) is a comparative display of the accuracy of the clustering results of the HPTC algorithm of Example 1 of the present invention and three benchmark methods on four trajectory data sets (with the DBI index as a reference); Fig.11 (c) is a comparative display of the accuracy of the clustering results of the HPTC algorithm of Example 1 of the present invention and three benchmark methods on four trajectory data sets (with the SC index as a reference). DETAILED DESCRIPTION

[0021] The present invention is further described in detail below in conjunction with the accompanying drawings.

[0022] Example 1 Terminology explanation: (1) Trajectory: a trajectory t i is defined as a finite sequence of points with x and y coordinates, represented by t i ={P1, P2,... , P z}, where P j Representation trajectory t i No. j points.

[0023] (2) Trajectory clustering: Given a set of trajectories T = { t 1 , t 2 , ... , t n}, trajectory clustering is based on a specific similarity measure to divide T into k Clusters C 1 , C 2 , ... , C k , satisfying the following conditions: each cluster C i is a subset of the trajectories in T, namely C i ⊆T; (2) Each trajectoryt i Belongs to only one cluster, satisfying and = (when i ≠ j (3) The same cluster C i The trajectories within a cluster have higher similarity, while the trajectories in different clusters have lower similarity.

[0024] like Figure 1 As shown, this embodiment discloses a method for hierarchical parallel clustering of massive trajectories based on spatial similarity, including: Step 1: Read trajectory data from the trajectory database in sequence; Step 2: Determine the trajectory space where the trajectory data in the trajectory dataset is located, and then divide the entire space into grid cells of the same size; Specifically, for a given trajectory dataset, we first determine the spatial coverage of all trajectories based on their minimum and maximum x and y coordinates. Then, we choose a fixed grid cell size z to divide the trajectory space into m × n cells. Figure 2 Shows an example of using a grid to partition the trajectory space.

[0025] Step 3: Convert the trajectory data into set data based on the identifiers of the grid cell sequence that the trajectory passes through; Step 301: The grid cells that the trajectory path passes through can be determined based on the coordinates of each point in the trajectory. t i is represented by the number of grid cells it passes through, denoted by g i = { c {x,y}}, where x∈[1, m] and y∈[1, n]. Figure 4 The second column shows a Figure 2 The trajectory data in is reformulated as a specific example of the sequence of grid cells it traverses.

[0026] Step 302: To simplify the representation, each grid cell is encoded as an identifier of the grid. Specifically, Figure 3 Shows an example of Morton coding, which uses an integer as the identifier for each grid.

[0027] Step 303: Each trajectory corresponds to an integer set consisting of identifiers of several grid cells that it passes through. Figure 4 The third column shows a Figure 2A specific example of converting trajectory data into collection data.

[0028] Step 4: According to the trajectories in the form of a collection, based on a certain number of hash functions, calculate the MinHash signature corresponding to each trajectory and combine the MinHash signatures of all trajectories into a signature matrix; The generation process of the MinHash signature matrix includes: Step 401: Store the trajectory set in the form of a matrix, and the obtained matrix is ​​called a "TE-matrix".

[0029] Figure 5 (a) shows Figure 4 The "TE-matrix" of the trajectories in , where each trajectory corresponds to a column and each grid cell identifier is a row. Let represents the number of trajectories, and I represents the set of grid cell identifiers that all trajectories pass through. t i (i∈[1, ]) contains the grid cell identifier c j ( c j ∈I), then the corresponding element e i,j Set to 1, otherwise 0. The "TE-matrix" describes the relationship between a trace and the identifiers it contains, thus simplifying the process of computing signatures using MinHash.

[0030] Step 402: Use a certain number of hash functions to calculate the hash value corresponding to each grid unit identifier and store it in the form of a matrix, called "HV-matrix". Figure 5 (b) in Figure 1 shows an example of an “HV-matrix”, introducing four hash functions, such as Figure 5 As shown in (c) in the figure. The hash value corresponding to each hash function is calculated for each unit identifier in turn and stored in the "HV-matrix". The general format of these hash functions is: .in, a , b and c is a random variable, j The code representing the grid cell c j ( c j ∈I), 2 c -1 represents a sequence of prime numbers.

[0031] Step 403: Generate a signature matrix for the "TE-matrix", called the "Sig-matrix". The columns of the "Sig-matrix" correspond to the trajectories, and the rows correspond to the L hash functions. h1 (x) , h 2 (x) , ... , h L (x) .

[0032] Figure 6 Demonstrated based on Figure 5 The process of generating the "Sig-matrix" from the "TE-matrix" and "HV-matrix". To simplify the explanation, assume sig (j,z) ( j ∈[1,l], z ∈[1, ]) represents the first j The specific generation process of the "Sig-matrix" is as follows: Step 4031: Initialize the elements in the "Sig-matrix" to ∞.

[0033] Step 4032: Traverse each row i in the "TE-matrix" and check the value of each column. If the value is '0', do nothing; if the value is '1', use the hash value of the same row in the "TE-matrix" to update the corresponding column in the "Sig-matrix". Since the number of columns in the "HV-matrix" is equal to the number of rows in the "Sig-matrix", the "Sig-matrix" can be directly updated with the rows of the "HV-matrix". Specifically, if the hash value in the "HV-matrix" is h j (r) Less than the current value sig (j,z) , then sig (j,z) Updated to h j (r) .

[0034] Step 5: Divide the obtained signature matrix into several bands, use an independent bucket array for each band, and map the trajectories with the same signature in each band to the same bucket.

[0035] like Figure 7 As shown in (a) and (b) in Figure 2, in order to group the trajectories based on the determined “Sig-matrix”, the following steps are performed: Step 501: Figure 7 As shown in (a) in FIG. 5 , the rows of the “Sig-matrix” are further divided into multiple bands.

[0036] Step 502: Figure 7As shown in (b) in the figure, for each band, a bucket array is created and the trajectories with the same signature in the band are mapped to the same bucket. The trajectories in the same bucket indicate that their signatures may have a high Jaccard similarity, indicating that they may have strong similarities in space.

[0037] Step 6: Classify the trajectories that are mapped to the same bucket in at least one band into the same class; Figure 1 (b) in Figure 2 shows a detailed flowchart of this step. Figure 7 (c) in Figure 1 shows a specific example based on the following steps: Step 601: Create an initial class C 1 and set it to any bucket in the first band.

[0038] Step 602: Scan the buckets in the remaining bands to find C 1 There are buckets where the trajectories in the bucket intersect. If there is such a bucket, merge the trajectories in the bucket into C 1 middle.

[0039] Step 603: Although buckets in the same stripe do not share trajectories, C 1 After the first band has been merged with some of the buckets in other bands, there may be an intersection with the unprocessed buckets in the first band. After scanning each bucket in the second to last band, return to the first band. C 1 The buckets with intersections are also merged. After scanning the buckets in the first band, you can confirm C 1 .

[0040] Step 604: Confirm C 1 After that, the unprocessed buckets in the first band are taken as new classes in turn, and the process of steps 602-603 is repeated until all the buckets in the first band are processed.

[0041] Step 605: Determine whether there is any intersection between each of the finally obtained classes. If so, the classes with intersection are also merged. The finally obtained classes without any intersection are the final results of this clustering process.

[0042] Step 7: Determine whether each class meets the conditions. If so, output the final clustering result. If not, repeat steps 1-6 for each class in parallel, where smaller grid units are used to divide the entire trajectory space of the trajectories in the class when performing step 2.

[0043] The specific condition here is that after further clustering, the trajectories in this class are not divided into more classes. In order to strike a balance between accuracy and efficiency, HPTC initially converts the trajectory data into a set of several grid identifiers based on larger grid cells, so that fewer identifiers are used to represent the trajectory, which can reduce the amount of calculation when calculating the similarity between trajectories later. This process produces coarse-grained clustering results, which may result in low similarity within some classes and require further refinement. To achieve finer clustering, the system re-divides the trajectory space in these classes using grid cells that are half the size of the original grid cells, further refines the trajectory representation, and increases the length of each trajectory representation to capture more spatial features. Then, further clustering is performed on this class, resulting in more subclusters with high cohesion. If further refinement is required, the process will continue. If a cluster cannot be split into more cohesive subclusters, it is considered that the cluster has achieved sufficient intra-cluster similarity and no further clustering is required.

[0044] The effectiveness of the present invention is demonstrated by experiments below.

[0045] The experiments of the present invention were conducted on a computer equipped with an Intel Core i5 2.5 GHz processor, a 64-bit Windows 10 operating system, and 8 GB RAM. All algorithms were implemented in Java.

[0046] 1. Experimental setup and dataset.

[0047] Dataset. This experiment mainly uses four trajectory datasets, namely: LABOMNI, T-Drive, Geolife, and NGSIM. Specifically, LABOMNI contains 209 trajectories and provides standardized clustering results, forming a total of 15 standard clusters. Geolife includes data from 182 users, a total of 17,621 trajectories, covering approximately 1.2 million kilometers, and a total duration of more than 48,000 hours. T-Drive contains trajectories of 10,357 taxis from Beijing, totaling 15 million GPS coordinates, covering more than 9 million kilometers. After data cleaning, the final dataset contains 207,966 trajectories. NGSIM contains 9,525 trajectories from Highway 101 in the United States from 7:50 to 8:05 in the morning.

[0048] Baseline algorithm. Improved DBSCAN, K -Swaps and LSH-ED are used as benchmark algorithms. These four benchmark algorithms are briefly introduced below.

[0049] Improved DBSCAN algorithm is a compression and density-based clustering method based on Douglas-Peucker (DP). The method is mainly divided into two main steps, trajectory compression and grouping. In order to improve the efficiency and accuracy of DTW similarity measurement, the DP algorithm is used to compress the trajectory, and then the similarity between the compressed trajectories is calculated. In the grouping stage, the density-based spatial clustering application with noise (DBSCAN) algorithm is used and the DBSCAN parameters are determined using statistical methods.

[0050] The K-Swaps algorithm is first applied K -Set algorithm gets the initial solution and performs a swap by replacing the histogram of a randomly selected cluster with a random data object. Then, apply K -Set algorithm and calculate the objective function SDH (the sum of the minimum distances to the histogram). If the new SDH is smaller than the previous result, the new solution is accepted and used in the next iteration. This process is repeated for a fixed number of iterations, which is the only parameter given by the user. K The -Set algorithm consists of two steps: allocation and update. First, randomly select K data objects as initial representatives. At this stage, the representative is just the histogram of the selected data object. In the assignment step, each data object is assigned to its nearest histogram. In our algorithm design, the trajectory data can be converted into a set form in the preprocessing stage. Therefore, we can use the trajectory data we converted into a set form K -Swaps algorithm for clustering calculations.

[0051] The LSH-ED algorithm proposes a clustering based on LSH in Euclidean space. The condition that LSH-ED needs to meet when applied to trajectory data is that all trajectories must be of the same length. To overcome this problem, the DP algorithm is improved in this paper to compress the trajectory to a fixed length and minimize the loss as much as possible. Then the trajectories are mapped to different buckets by using a set of hash functions.

[0052] 2. HPTC performance evaluation.

[0053] In this embodiment, the influence of different parameters of HPTC, such as the number of hash functions L, the grid unit size Δd, and the DP algorithm on the clustering efficiency and accuracy of HPTC is analyzed; and then the clustering efficiency and accuracy of the HPTC are compared with those of the baseline algorithm.

[0054] 1) Trajectory clustering evaluation indicators.

[0055] The silhouette coefficient (SC) is an evaluation metric used to evaluate the distance between the target trajectory and other trajectories in its cluster and the clustering with the nearest trajectories in other classes. The result is presented as a ratio in the range of [-1,1]. A higher SC value indicates a better clustering effect.

[0056] Davies-Bouldin Index (DBI) is another evaluation metric that also uses the ratio of inter-class distance to intra-class distance. A lower DBI value indicates a better clustering effect.

[0057] 2) Clustering efficiency of HPTC algorithm under different parameters.

[0058] (1) We first evaluate the clustering accuracy and efficiency of HPTC with different numbers of hash functions L. Figure 8 (b) and Figure 8 (c) in Figure 2 shows the effects of clustering accuracy measured using DBI and SC indicators on all datasets. A higher SC value indicates better clustering accuracy, while a lower DBI value reflects a better clustering performance. Figure 8 As shown in (c) in the figure, as L increases, the SC value gradually increases, which indicates that the clustering performance of HPTC is improved by increasing the number of hash functions. However, when L exceeds a certain threshold (for example, when L=75 in the T-Drive dataset), the SC value tends to stabilize and does not show a significant increase. This shows that even if more hash functions are added, the clustering performance will not be further improved. The reason for this phenomenon is that when L is small, the number of rows in each band is small, which may cause dissimilar trajectories to be mapped to the same bucket, thereby reducing the clustering accuracy. Increasing the value of L at this stage will increase the number of rows in each band, thereby reducing the possibility of dissimilar trajectories being classified into the same cluster and improving the accuracy. However, if L is too large, it may cause similar trajectories to be scattered into different buckets, thereby weakening the distinction between clusters, and ultimately resulting in no significant improvement in clustering accuracy. For the same reason, as L increases, the clustering accuracy measured using DBI also shows a similar trend on various datasets, such as Figure 8 As shown in (b) in .

[0059] Figure 8 (a) in Figure 2 shows that as the number of hash functions L increases, the processing time increases significantly. This is because using more hash functions will undoubtedly increase the number of hash values ​​that need to be processed, resulting in greater computational overhead. In this test, it was found that the trends of clustering accuracy and efficiency on different datasets are similar, so the following evaluation will focus on LABOMNI and NGSIM, the two smallest and largest test datasets, respectively.

[0060] (2) The effect of cell size (Δd) on clustering accuracy and time cost was evaluated. The cell size depends on the spatial coverage of the dataset where the trajectory is located. Specifically, the spatial coverage of each dataset is defined as a rectangular area, where the length of the rectangle is calculated by calculating the difference between the maximum x-coordinate and the minimum x-coordinate of all trajectory points, and the width is determined by the same calculation method of the y-coordinate. According to this method, the rectangular space of the LABOMNI dataset is approximately 150×150, while the spatial coverage of the NGSIM dataset is approximately 2700×2400. Therefore, we choose a smaller cell size for LABOMNI and a relatively larger cell size for NGSIM.

[0061] like Fig. 9 As shown, we initially set the cell size of LABOMNI and NGSIM to 35 and 100, respectively. Subsequently, we halved the cell size in subsequent steps and measured the DBI values. In order to better observe the effect of cell size on the performance of the HPTC algorithm, no iterations were performed during the clustering process. In both datasets, the DBI values ​​decreased significantly as the cell size decreased, indicating that the clustering performance was improved. This supports our conclusion that smaller cells enhance the Jaccard similarity between trajectory encodings, thereby improving the similarity of trajectories within each cluster. However, when the cell size (Δd) is further reduced and exceeds a certain threshold, the DBI value tends to stabilize, indicating that further reducing the cell size has limited improvement on clustering performance. In addition, continuously reducing the cell size will significantly increase the clustering cost. Therefore, the cell size should be appropriately selected to balance clustering accuracy and computational efficiency.

[0062] (3) The performance of the HPTC algorithm was tested under two conditions: one was to use the original unsimplified trajectory, and the other was to use the trajectory simplified by the DP algorithm for clustering. Fig.10 As shown in , clustering trajectories after extracting key points does not reduce accuracy; in fact, on some datasets (such as LABOMNI and Geolife), clustering performance improves, such as Fig.10 (a) and Fig.10 The reason for this improvement is that the extracted key feature points are more representative of the spatial characteristics of the trajectory, thus helping to eliminate the negative impact of unimportant points during clustering. In addition, the trajectory processed by the DP algorithm significantly reduces the computational time when clustering. This reduction is particularly evident in larger datasets, such as the NGSIM dataset, where the computational time is reduced by about an order of magnitude, as shown in (b). Fig.10 As shown in (c) in .

[0063] 3. Comparison with benchmark algorithms.

[0064] Fig.11 (a) in the figure shows the clustering time cost of the HPTC algorithm and the baseline method on various datasets. Obviously, in all datasets, the HPTC algorithm outperforms the Improved DBSCAN and K-Swaps algorithms in terms of running efficiency. In larger datasets (such as Geolife and T-Drive), the running time of HPTC is significantly reduced compared to the Improved DBSCAN and K-Swaps algorithms, reducing by about two orders of magnitude. This is because HPTC converts trajectories into integer sets and does not need to spend a lot of time calculating pairwise distances between trajectories in similarity evaluation. Although the running time of HPTC is slightly longer than that of the LSH-ED algorithm, Fig.11 (b) and Fig.11 As shown in (c), HPTC’s clustering accuracy on all datasets is significantly better than LSH-ED.

[0065] First, the DBI index is used to evaluate the clustering accuracy of different algorithms on various data sets. A lower DBI value indicates better clustering performance. The results are shown in Fig.11 As shown in (b) in the figure. It can be seen that the HPTC method achieves the smallest DBI value on the LABOMNI dataset, and the clustering results are highly consistent with the true labels. On the T-Drive, Geolife, and NGSIM datasets, the performance of HPTC is significantly better than LSH-ED and K-Swaps, and only slightly worse than Improved DBSCAN. However, from the perspective of clustering cost, as shown in Fig.11 As shown in (b) in Figure 1, HPTC performs much better than ImprovedDBSCAN on the T-Drive, Geolife, and NGSIM datasets, with an efficiency improvement of nearly two orders of magnitude. Therefore, our HPTC algorithm exhibits superior overall performance. Especially when processing large-scale datasets, HPTC can significantly speed up clustering while maintaining high clustering accuracy.

[0066] Then, the clustering accuracy was compared using the SC index as the clustering accuracy evaluation standard. The results are as follows: Fig.11 As shown in (c), a larger SC value indicates a higher clustering accuracy. Basically consistent with the conclusion drawn using DBI as the evaluation metric, our algorithm outperforms all baseline algorithms on the Geolife dataset, and is only slightly inferior to the Improved DBSCAN algorithm on the other three datasets.

[0067] Example 2 This embodiment provides a massive trajectory hierarchical parallel clustering system based on spatial similarity, including: A data acquisition module is configured to acquire trajectory data; A unit division module is configured to divide the track area into grid units according to the acquired track data; The conversion module is configured to convert the trajectory data into set data based on the divided grid units; The matrix module is configured to, according to the set form of the set data, calculate the MinHash signature corresponding to each trajectory and form the MinHash signatures of all trajectories into a signature matrix; A mapping module, configured to divide the obtained signature matrix into a number of bands and map the trajectories in the bands into buckets; A partitioning module configured to partition trajectories mapped to the same bucket in at least one band into the same class; The judgment output module is configured to judge whether each class meets the conditions and output the clustering results.

[0068] A computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor of a terminal device and executing the method for hierarchical parallel clustering of massive trajectories based on spatial similarity.

[0069] A terminal device includes a processor and a computer-readable storage medium, wherein the processor is used to implement various instructions; and the computer-readable storage medium is used to store multiple instructions, wherein the instructions are suitable for being loaded by the processor and executing a method for hierarchical parallel clustering of massive trajectories based on spatial similarity.

[0070] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A hierarchical parallel clustering method for massive trajectories based on spatial similarity, characterized in that: include: Get trajectory data; Divide the track area into grid cells according to the acquired track data; Convert trajectory data into set data based on divided grid cells; According to the collection form of the collection data, the MinHash signature corresponding to each trajectory is calculated and the MinHash signatures of all trajectories are combined into a signature matrix; The obtained signature matrix is ​​divided into several bands, and the trajectories in the bands are mapped into buckets; Trajectories that are mapped to the same bucket in at least one band are grouped into the same class; Determine and output the clustering results.

2. The method for hierarchical parallel clustering of massive trajectories based on spatial similarity according to claim 1, characterized in that: The grid unit division of the trajectory area according to the acquired trajectory data includes, for a given trajectory data set, determining its spatial coverage based on the minimum and maximum x and y coordinates of all trajectories, and then selecting a fixed grid unit size z to divide the trajectory space into m×n units.

3. The method for hierarchical parallel clustering of massive trajectories based on spatial similarity according to claim 2, characterized in that: The method converts the trajectory data into set data based on the divided grid units, including determining the grid units that the trajectory path passes through according to the coordinates of each point in the trajectory, wherein any trajectory t i is represented by the number of grid cells it passes through, denoted by g i = { c {x,y} }, where x∈[1, m] and y∈[1, n], encode each grid cell as the identifier of the grid, where each grid is encoded using an integer as its identifier using the Morton encoding method, and each trajectory corresponds to a set of integers consisting of the identifiers of several grid cells it passes through.

4. The method for hierarchical parallel clustering of massive trajectories based on spatial similarity according to claim 3 is characterized in that: The method calculates the MinHash signature corresponding to each trajectory and forms a signature matrix with the MinHash signatures of all trajectories, including storing the trajectory set data in the form of a matrix to obtain a TE-matrix; using a hash function to calculate the hash value corresponding to each grid unit identifier and storing it in the form of a matrix to obtain an HV-matrix; generating a Sig-matrix based on the TE-matrix and the HV-matrix, initializing the elements in the Sig-matrix to ∞, wherein each row i in the TE-matrix is ​​traversed, and the value of each column is checked. If the value is '0', no operation is performed; if the value is '1', the hash value of the same row in the TE-matrix is ​​used to update the corresponding column in the Sig-matrix; and the Sig-matrix is ​​updated with the rows of the HV-matrix, and finally the signature matrix is ​​obtained.

5. The method for hierarchical parallel clustering of massive trajectories based on spatial similarity according to claim 4, characterized in that: The obtained signature matrix is ​​divided into several bands, and the trajectories in the bands are mapped into buckets, including further dividing the rows of the Sig-matrix into multiple bands, creating a bucket array for each band, and mapping the trajectories with the same signature in the band to the same bucket. The trajectories in the same bucket indicate that the signatures have high Jaccard similarity.

6. The method for hierarchical parallel clustering of massive trajectories based on spatial similarity according to claim 5, characterized in that: The method of classifying the tracks mapped to the same bucket in at least one band into the same class includes creating an initial class C 1 And set it to any bucket in the first band, scan the buckets in the remaining bands, and find the bucket that matches C 1 There are buckets where the trajectories in the bucket intersect. If there is such a bucket, merge the trajectories in the bucket into C 1 After scanning each bucket in the second to last band, return to the first band. C 1 If there are intersecting buckets, merge them as well. After scanning the buckets in the first band, you can confirm C 1 After determining C1, the unprocessed buckets in the first band are taken as new classes in turn until all the buckets in the first band are processed. It is determined whether there is an intersection between each of the final classes. If so, the classes with intersections are also merged. The classes with no intersections are the final results of this clustering process.

7. The method for hierarchical parallel clustering of massive trajectories based on spatial similarity according to claim 6, characterized in that: The determining and outputting the clustering result includes determining whether each class satisfies a set condition, and outputting the final clustering result if the set condition is satisfied; If not, the clustering operation is repeated for each class in a parallel manner, where smaller grid cells are used to divide the entire trajectory space of the trajectories in the class when performing grid cell division.

8. A massive trajectory hierarchical parallel clustering system based on spatial similarity, characterized by: include: A data acquisition module is configured to acquire trajectory data; A unit division module is configured to divide the track area into grid units according to the acquired track data; The conversion module is configured to convert the trajectory data into set data based on the divided grid units; The matrix module is configured to, according to the set form of the set data, calculate the MinHash signature corresponding to each trajectory and form the MinHash signatures of all trajectories into a signature matrix; A mapping module, configured to divide the obtained signature matrix into a number of bands and map the trajectories in the bands into buckets; A partitioning module configured to partition trajectories mapped to the same bucket in at least one band into the same class; The judgment output module is configured to judge and output the clustering result.

9. A computer-readable storage medium storing a plurality of instructions, characterized in that: The instructions are suitable for being loaded by a processor of a terminal device and executing the method according to claim 1 .

10. A terminal device, comprising a processor and a computer-readable storage medium, wherein the processor is used to implement each instruction; and the computer-readable storage medium is used to store multiple instructions, characterized in that: The instructions are suitable for being loaded by a processor and executing the method as claimed in claim 1 .

Citation Information

Patent Citations

  • Trajectory clustering method and device, and storage medium

    CN110826594A

  • Unmanned formula car multi-sensor fusion sensing decision and tracking control method

    CN112578673A

  • Track clustering method

    CN116881750A

  • SYSTEM AND METHOD FOR PROCESSING VEHICLE EVENT DATA FOR IMPROVED ROAD SEGMENT POINT SCAPING

    DE102022128022A1

  • Method for clustering similar trajectories of moving objects in road network databases

    KR1020080084504A