A vehicle trajectory clustering method fusing density value and K-means algorithm

By integrating density values ​​and the K-means algorithm, the trajectory clustering method is optimized, solving the problems of unstable initial center selection and excessive iteration number in trajectory data, and achieving efficient and accurate trajectory clustering results.

CN116010838BActive Publication Date: 2025-12-23JILIN UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310031352.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-10
Publication Date
2025-12-23
Estimated Expiration
2043-01-10

AI Technical Summary

Technical Problem

Existing K-means clustering algorithms suffer from problems in trajectory data processing, such as unstable initial center trajectory selection, significant influence of outliers, excessive number of iterations, and poor clustering results, especially in the long computation time required for trajectory data calculation.

Method used

By fusing density values ​​and the K-means algorithm, the trajectory distance is first calculated and the density value is determined. Outliers are eliminated, and a high-density trajectory that is far from the existing center trajectory is selected as the initial center. Trajectory density is still considered during the iteration process to optimize the selection of the initial center trajectory and the iterative calculation.

Benefits of technology

It improves the accuracy and speed of trajectory clustering, ensures the accuracy of the initial center trajectory selection, reduces the number of iterations, and enhances the clustering effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116010838B_ABST
    Figure CN116010838B_ABST
Patent Text Reader

Abstract

The application discloses a vehicle trajectory clustering method fusing density value and K-means algorithm, and comprises the following steps: step one, collecting original trajectory data to obtain a trajectory set after pretreatment; step two, calculating trajectory distance between trajectories in the trajectory set in turn; step three, determining the density of all trajectories in the trajectory set, and adding the trajectory with the maximum density value as the first center trajectory to a cluster center trajectory set; step four, calculating the weight of the remaining trajectories in the trajectory set in turn, taking the remaining trajectory with the maximum weight value as the next center trajectory, and moving it into the cluster center trajectory set until the capacity of the cluster center trajectory set reaches K, and the center trajectory selection is completed; and step five, removing the trajectory with the minimum density value in the trajectory set, and performing K-means clustering again until the iteration number is reached or the elements in the trajectory cluster no longer change, and the trajectory clustering process is completed. The application has the characteristics of high clustering precision.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of trajectory data mining, and more particularly, to a vehicle trajectory clustering method fusing density value and K-means algorithm. BACKGROUND

[0002] In recent years, with the rapid development of wireless communication, GPS equipment, cloud computing and storage technology, the collection, transmission and preservation of location data have become easier and faster, thus generating a large amount of trajectory data. These data usually contain user identification, latitude and longitude, time, altitude and other information, so the trajectory data can be regarded as a time position sequence of a mobile object. By using clustering, classification and other technologies to mine and analyze the knowledge hidden in the trajectory data, solutions can be provided for the fields of city planning, location services and user recommendation.

[0003] As the most popular unsupervised learning clustering algorithm, the K-means clustering algorithm has the characteristics of simple principle, easy implementation and fast convergence speed, and is now widely used in the fields of image, text and trajectory. However, the algorithm still has certain limitations, such as difficulty in selecting K value, sensitivity to noise and outliers, inaccuracy in calculating cluster centers during the selection of initial center points and the iteration process, which causes the clustering to fall into local iteration or leads to the concentration of initial center trajectories, resulting in poor clustering effect, and the calculation process is time-consuming.

[0004] Domingo-Ferrer et al. proposed the application of K-means clustering algorithm in trajectory. This method randomly selects K initial center trajectories, then calculates the distance from the remaining N-K trajectories to the K initial center trajectories, and assigns them to the corresponding trajectory cluster. However, this method randomly selects initial center trajectories, which may cause instability of the clustering result, and does not eliminate outliers, which may lead to poor clustering effect. The initial trajectory selection method proposed by Wang et al. is to select the average trajectory of all trajectories as the first initial center trajectory, and the subsequent center trajectory is the trajectory farthest from the previous center trajectory. Then, each center trajectory and the K-1 trajectories closest to it form a trajectory cluster containing k trajectories. Although this method can maintain the stability of the clustering result, the K-1 initial center trajectories may be too scattered, causing the edge trajectories to be selected as center trajectories, resulting in high iteration times and poor clustering effect.

[0005] Outliers are a few objects deviating from the normal data set, which cannot form a cluster or even have a negative impact on the clustering results. Dubey et al. proposed to use a density-based outlier detection algorithm to filter out outliers, and combined with the maximum and minimum distance method to select the initial center on the filtered sample points, but this algorithm does not solve the trajectory clustering problem. Yu et al. proposed to remove outliers first, and then select the K longest duration trajectories as the initial center trajectory. The clustering strategy proposed by this method emphasizes the persistence of trajectory time, but the problem of over-concentration of long duration trajectories cannot be solved, and the K longest duration trajectories may be close to each other, resulting in dense distribution of initial center trajectories. SUMMARY

[0006] The purpose of the present application is to design and develop a vehicle trajectory clustering method combining density value and K-means algorithm, to determine the sparse distribution characteristics of the trajectory data set as a whole through trajectory density, accurately remove outliers, and combine K-means clustering algorithm to make the trajectory have the characteristics of large density value and uniform distribution, improve the iteration accuracy and clustering speed.

[0007] The technical scheme provided by the present application is:

[0008] A vehicle trajectory clustering method combining density value and K-means algorithm, comprising the following steps:

[0009] Step one, after collecting and preprocessing the trajectory data of vehicle movement, a trajectory set TS={T1, T2, …Tn} is obtained. i j n};

[0010] Wherein, T i is the i-th trajectory, T j is the j-th trajectory, and i=1~n, j=1~n, T i ={i,p1,p2…p t ,…p m}, T j =(j,q1,q2…q t ,…q l ), p t is the trajectory point (x1, y1, t) of trajectory T i at time stamp t, q t is the trajectory point (x2, y2, t) of trajectory T j at time stamp t;

[0011] Step two, the trajectory distance between each two trajectories in the trajectory set is calculated in turn, and the trajectory distance between all trajectories in the trajectory set is saved to the trajectory distance matrix. ​​

[0012] wherein the trajectory distance satisfies:

[0013] D(T i ,T j )=D(p t ,q t );

[0014] wherein D(T i ,T j ) is the distance between the trajectory T i and the trajectory T j , D(p t ,q t ) is the transformation distance between the trajectory point p t and the trajectory point q t , and the transformation distance between the trajectory point p t and the trajectory point q t satisfies:

[0015]

[0016] wherein d(p t ,q t ) is the actual distance between the trajectory point p t and the trajectory point q t , and min{d(p t-1 ,q t-1 ),d(p t-1 ,q t ),d(p t ,q t-1 )} is the minimum distance of the aligned point pair between the trajectory T i and the trajectory T j ;

[0017] Step three, determining the density of all trajectories in the trajectory set, and adding the trajectory with the maximum density value as the first center trajectory to the cluster center trajectory set TScen={T c1 ,T c2 ,…,T cz …,T ck};

[0018] wherein the density of the trajectory satisfies:

[0019]

[0020]

[0021] wherein p(T i ) is the density of the trajectory T i , u(x) is the function value, Eps is the neighborhood distance, and T czthe zth central trajectory, z = 1 ~ k;

[0022] Step four, calculate the weight of each remaining trajectory in the trajectory set being selected as a central trajectory in turn, take the remaining trajectory with the maximum weight value in the trajectory set as the next central trajectory, and move it into the cluster central trajectory set until the capacity of the cluster central trajectory set reaches K, and the central trajectory selection is completed;

[0023] wherein,

[0024] Step five, remove the trajectory with the lowest density value in the trajectory set, and perform K-means clustering again until the iteration number is reached or the elements in the trajectory cluster no longer change, and the trajectory clustering process is ended.

[0025] Preferably, the preprocessing includes trajectory selection, trajectory segment segmentation and / or trajectory filling.

[0026] Preferably, the step two further includes:

[0027] If there is no overlapping time between the trajectories in the trajectory set, the trajectory distance is INF, and the distance of the trajectory itself is INF.

[0028] Preferably, the determination of the overlapping time between the trajectories includes:

[0029] If , there is no overlapping time between the two trajectories, and when there is an overlapping time between the two trajectories, [a, b] is the overlapping time between the two trajectories.

[0030] wherein, start i is the start time of the trajectory T i , end i is the end time of the trajectory T i , start j is the start time of the trajectory T j , end j is the end time of the trajectory T j , a = max(start i , start j ), and b = min(end i , end j ).

[0031] Preferably, the neighborhood distance satisfies:

[0032]

[0033] wherein, is the average value of the distance array.

[0034] Preferably, the distance array satisfies:

[0035] Dη= {d(x iη )};

[0036] wherein Dηis the distance array, d(x iη ) is the distance parameter, and the distance parameter is the ηth-smallest value of each row in the trajectory distance matrix, i is the trajectory number, and η is the Eps-neighborhood parameter.

[0037] Preferably, the Eps-neighborhood parameter satisfies:

[0038]

[0039] wherein n is the number of trajectories in the trajectory set.

[0040] Preferably, the weight of the trajectory selected as the center trajectory satisfies:

[0041] ω(T i ) = d min (T i , TScen) * p(T i );

[0042] wherein ω(T i ) is the weight of the trajectory T i selected as the center trajectory, d min (T i , TScen) is the minimum center trajectory distance of the trajectory T i to the cluster center trajectory set TScen.

[0043] Preferably, the minimum center trajectory distance of the trajectory T i to the cluster center trajectory set TScen satisfies:

[0044] d min (T i , TScen) = min(D(T i , T cz ))(T cz ∈ TScen, z ∈ [1, k]);

[0045] wherein D(T i , T cz ) is the trajectory distance of the trajectory T i to the center trajectory T cz in the cluster center trajectory set TScen.

[0046] The beneficial effects of the present application are:

[0047] (1), a vehicle trajectory clustering method fusing density value and K-means algorithm is designed and developed, trajectory density is determined through trajectory distance, and then outlier trajectory is determined, and the trajectory clustering effect is improved.

[0048] (2), a vehicle trajectory clustering method fusing density value and K-means algorithm is designed and developed, when selecting initial K center trajectories, the following two conditions must be met at the same time, that is, the trajectory with high density and far distance from the existing center trajectory will be selected as the initial center trajectory, so that the selection of the initial trajectory is more accurate.

[0049] (3), a vehicle trajectory clustering method fusing density value and K-means algorithm is designed and developed, when the new cluster center trajectory is iteratively calculated, the influence of trajectory density is still considered, the trajectory with the maximum trajectory density value in the cluster is still selected as the center trajectory. In this way, the iteration speed is accelerated, the requirement of trajectory with large density value as center trajectory is met, and the clustering accuracy is improved. BRIEF DESCRIPTION OF DRAWINGS

[0050] Figure 1 The flowchart of the vehicle trajectory clustering method fusing density value and K-means algorithm is shown.

[0051] Figure 2 The three-dimensional space-time trajectory diagram of trajectory T1 and trajectory T2 is shown.

[0052] Figure 3 The clustering flowchart of step five is shown.

[0053] Figure 4 The trajectory space-time three-dimensional diagram of the synthetic data set is shown.

[0054] Figure 5 The trajectory space two-dimensional diagram of the synthetic data set is shown.

[0055] Figure 6 The trajectory space-time three-dimensional diagram in the first trajectory cluster of the synthetic data set is shown.

[0056] Figure 7 The trajectory space-time three-dimensional diagram in the second trajectory cluster of the synthetic data set is shown.

[0057] Figure 8 The trajectory space-time three-dimensional diagram in the third trajectory cluster of the synthetic data set is shown.

[0058] Figure 9 The trajectory space-time three-dimensional diagram in the fourth trajectory cluster of the synthetic data set is shown.

[0059] Figure 10 Trajectory spatio-temporal 3D plot in the 5th cluster of trajectories of the synthetic dataset of the present invention.

[0060] Figure 11 Trajectory spatio-temporal 3D plot in the 6th cluster of trajectories of the synthetic dataset of the present invention.

[0061] Figure 12 Trajectory spatio-temporal 3D plot in the 7th cluster of trajectories of the synthetic dataset of the present invention.

[0062] Figure 13 Trajectory spatio-temporal 3D plot in the 8th cluster of trajectories of the synthetic dataset of the present invention.

[0063] Figure 14 Trajectory spatio-temporal 3D plot in the 9th cluster of trajectories of the synthetic dataset of the present invention.

[0064] Figure 15 Trajectory spatio-temporal 3D plot of the real dataset of the present invention.

[0065] Figure 16 Trajectory spatial 2D plot of the real dataset of the present invention.

[0066] Figure 17 Trajectory spatio-temporal 3D plot in the 1st cluster of trajectories of the real dataset of the present invention.

[0067] Figure 18 Trajectory spatio-temporal 3D plot in the 2nd cluster of trajectories of the real dataset of the present invention.

[0068] Figure 19 Trajectory spatio-temporal 3D plot in the 3rd cluster of trajectories of the real dataset of the present invention.

[0069] Figure 20 Trajectory spatio-temporal 3D plot in the 4th cluster of trajectories of the real dataset of the present invention.

[0070] Figure 21 Trajectory spatio-temporal 3D plot in the 5th cluster of trajectories of the real dataset of the present invention.

[0071] Figure 22 Trajectory spatio-temporal 3D plot in the 6th cluster of trajectories of the real dataset of the present invention.

[0072] Figure 23 Bar plot of the silhouette coefficient as a function of K (number of clusters) on the synthetic dataset of the present invention.

[0073] Figure 24 Bar plot of the silhouette coefficient as a function of K (number of clusters) on the real dataset of the present invention. DETAILED DESCRIPTION

[0074] The application will be further described in detail below, so that those skilled in the art can implement the application according to the description.

[0075] As Figure 1 shown, the application provides a vehicle trajectory clustering method combining density value and K-means algorithm, which first determines Eps neighborhood and counts the density information of trajectories; then filters out outlier trajectories through density value, eliminating the influence of outliers on overall clustering; then selects the trajectory with the maximum density in the trajectory data set as the first initial center trajectory, based on trajectory density and the minimum distance between trajectories and existing center trajectories; finally, through the calculation of trajectory weight, the trajectory with high density and far distance from the existing center trajectory will be selected as the new initial center trajectory; in the iteration process, the trajectory with the maximum density value in the cluster is still used as the center trajectory in the next round of clustering. The application improves the effect of trajectory clustering from three aspects of outlier monitoring filtering, initial center trajectory selection and iterative calculation of cluster center trajectory strategy. Specifically, the steps include:

[0076] Step one, after the trajectory data (original trajectory) of vehicle movement is collected and preprocessed, a trajectory set TS = {T1, T2, … Tn} composed of a plurality of trajectories is obtained. i ,…T j ,…T n};

[0077] Wherein, T i is the ith trajectory, n is the number of trajectories in the trajectory set, T j is the jth trajectory, and i, j represent the number of trajectories, i = 1 ~ n, j = 1 ~ n;

[0078] The trajectory is an ordered sequence of trajectory points, T i = {i, p1, p2…p t ,…p m}, T j = (j, q1, q2…q t ,…q l ), p t is the trajectory point of trajectory T i at timestamp t, q t is the trajectory point of trajectory T j at timestamp t, and the trajectory point is a time-space three-tuple, i.e. p t = (x1, y1, t), q t = (x2, y2, t), indicating that the position coordinates of the moving object at time t are (x1, y1) and (x2, y2) respectively, wherein the x-axis coordinate is the position longitude and the y-axis coordinate is the position latitude.

[0079] The preprocessing includes: trajectory selection, trajectory segment division and / or trajectory filling, etc. The trajectory selection is to select trajectories with more than 20 trajectory points in the original trajectory; the trajectory segment division is to cut off the trajectory at the place where the trajectory has a large time interval (i.e. the difference between two adjacent time stamps) to form multiple sub-trajectories, specifically, the trajectory is segmented according to the time interval, if the time interval of two adjacent trajectory points in the trajectory is greater than a specified time threshold, the trajectory is cut off between the two points to obtain two sub-trajectories; the trajectory filling is to add several trajectory points to the trajectory by using linear interpolation method, and the number of points of each trajectory is interpolated to a set maximum number of trajectory points, so as to achieve the purpose of consistent number of trajectory points.

[0080] The adding of several trajectory points to the trajectory means adding new trajectory points between the two trajectory points with the largest time interval on the trajectory, and repeatedly adding trajectory points until the number of trajectory points of the two trajectories is the same. Taking trajectory T1 and trajectory T2 as an example, T1 = {1, p1, p2…p t ,…p m}, T2 = (2, q1, q2…q t ,…q l ), the number of trajectory points in trajectory T1 is m, the number of trajectory points in trajectory T2 is l, and m < l, then (l-m) trajectory points need to be inserted into trajectory T1 to keep the number of trajectory points of the two trajectories the same. The method of inserting points is as follows: first find the two points with the largest time interval in trajectory T1, which are p1 = (x3, y3, t1) and p2 = (x4, y4, t2), then according to the linear interpolation method, the three-dimensional coordinates of the inserted point are p tm =(x tm ,y tm ,t t ), where t t =(t1+t2) / 2, x tm =(x3+x4) / 2, y tm =(y3+y4) / 2, so the number of points of trajectory T1 is increased to (m+1); then continue to find the two points with the largest time interval in trajectory T1, and insert the trajectory points according to the previous steps; this way, the trajectory points are inserted in a loop until the number of points of trajectory T1 and trajectory T2 is the same.

[0081] In this embodiment, the time threshold is 3 minutes, and the set maximum number of trajectory points is 320 points.

[0082] Step two, trajectory similarity is a standard for measuring the degree of similarity between trajectories, which directly determines the effect of trajectory clustering. The distance between trajectories represents the trajectory similarity, therefore, the alignment points and alignment points between trajectories are determined:

[0083] Taking the trajectory T1 and the trajectory T2 as examples, T1={1, p1, p2…p t ,…p m}, T2=(2, q1, q2…q t ,…q l ), the trajectory point p t and the trajectory point q t are points of the trajectories T1 and T2 at the time stamp t respectively, and the two points are an alignment point pair at the time stamp t, as shown in Figure 2 , the trajectory T1 and the trajectory T2 are two time-aligned trajectories, so that the alignment point of the trajectory point p2 on the trajectory T1 is the trajectory point q2 on the trajectory T2, the alignment point of the trajectory point p2 on the trajectory T1 is the trajectory point q1 on the trajectory T2, and the alignment point of the trajectory point q2 on the trajectory T2 is the trajectory point p2 on the trajectory T1, and the alignment point of the trajectory point q2 on the trajectory T2 is the trajectory point p1 on the trajectory T1, that is, the alignment point of a certain trajectory point on one trajectory is the previous point of the alignment point of the point on the other trajectory.

[0084] The inter-trajectory distance of the trajectory T i and the trajectory T j is calculated:

[0085] (1) The minimum distance min{d(p t-1 ,q t-1 ), d(p t-1 ,q t ), d(p t ,q t-1 ) of the alignment point pairs between the two trajectories is calculated, then the actual distance between the trajectory point p t and the trajectory point q t at the same time stamp is calculated, and then the transformation distance between the trajectory point p t and the trajectory point q t is obtained:

[0086]

[0087] In the formula, d(p t ,q t ) is the actual distance between the trajectory point p t and the trajectory point q t , and D(p t ,q t ) is the transformation distance between the trajectory point p t and the trajectory point q t .

[0088] The trajectory distance between trajectories in the trajectory set is calculated in pairs:

[0089] D(T i ,T j) = D (p t , q t ) ;

[0090] where D (T i , T j ) is the distance between trajectory T i and trajectory T j .

[0091] In the above distance calculation, the time similarity of trajectories is implicitly considered, but because of the time factor, there is also the possibility that there is no time overlap between two trajectories. In order to simplify the calculation later, the value of the distance between trajectories that does not exist (i.e., trajectories that do not overlap in time) is set to infinity INF, and the distance between the same trajectories (i.e., including the trajectory itself) is also set to infinity INF, which does not participate in the size ordering of the trajectory distance.

[0092] where, for each trajectory T i , the overlap time with the remaining trajectories T j in the trajectory set is calculated, if there is no overlap time between two trajectories, the distance value is INF, if there is overlap time between two trajectories, after determining the overlap time period, the trajectory distance is calculated according to the trajectory distance formula, and the distance between the trajectory and the trajectory itself is INF.

[0093] Specifically, the calculation of the overlap time of each trajectory and the remaining trajectories T j in the trajectory set includes:

[0094] Extract the start time and end time of each trajectory, let the start time and end time of trajectory T i be start i and end i , and the start time and end time of trajectory T j be start j and end j , if , it means that there is no overlap time between the two trajectories, otherwise, it means that there is overlap time between the two trajectories, and when there is overlap time between the two trajectories, [a, b] is the overlap time between the two trajectories, a = max(start i , start j ), b = min(end i , end j ).

[0095] (2) For all trajectories in the trajectory set TS, the distance between all trajectory pairs can be calculated, and the distance between all trajectory pairs is saved to the trajectory distance matrix M:

[0096] Mn*n = {D(T i , T j ) | i ∈ [1, n], j ∈ [1, n]}.

[0097] where n*n is the size of trajectory, and the element in the i-th row and j-th column of trajectory distance matrix represents the distance value between trajectory T i and trajectory T j .

[0098] The greater the distance between trajectories, the smaller the similarity between trajectories, and the smaller the distance between trajectories, the greater the similarity between trajectories.

[0099] The calculated trajectory distance comprehensively considers the spatio-temporal characteristics of the trajectory and the similarity of the trajectory segment, laying a foundation for the similarity measurement of the trajectory clustering algorithm.

[0100] Step three, after calculating the trajectory distance matrix M, it is necessary to select K initial center trajectories. The process of selecting initial center trajectories by fusing density value and K-means algorithm (DBK-means) is as follows: first, the Eps neighborhood is determined based on the t-neighbor distance, so as to calculate the density value of each trajectory and store it in the density array; then, the outliers with low density value are removed, and the trajectory with the largest density is selected as the first initial center trajectory; finally, by calculating the density value and Eps neighborhood distance, the trajectory with high density and farthest distance from the existing cluster center point is most likely to be selected as the remaining center trajectory. The specific process includes:

[0101] (1) Calculate the Eps neighborhood parameter:

[0102]

[0103] where η is the Eps neighborhood parameter, and n is the number of trajectories in the trajectory set.

[0104] (2) Sort each row in the trajectory distance matrix, and take the η-th smallest value as the distance parameter d(x iη ), to obtain the distance array:

[0105]

[0106] where Dη is the distance array.

[0107] (3) Calculate the Eps neighborhood distance:

[0108]

[0109] (4) Taking trajectory T i as the research object, and taking the Eps neighborhood distance as the radius, the density of trajectory T i is calculated:

[0110]

[0111]

[0112] In the formula, ρ(T) i ) is the trajectory T i The density, u(x) is the value of the function.

[0113] (5) Calculate the density value of each trajectory in the trajectory set using the above steps and save it to the trajectory density array Den. Then, select the trajectory with the highest density value as the first center trajectory and add it to TScen, where TScen = {T c1 ,T c2 ,…,T cz …,T ck} represents the set of cluster center trajectories selected by the clustering algorithm of the trajectory set TS, and TScen is initially an empty set;

[0114] (6) Calculate the minimum distance from each remaining trajectory in the trajectory set to the center trajectory in turn:

[0115] d min (T i ,TScen)=min(D(T i ,T cz ))(T cz ∈TScen,z∈[1,k]);

[0116] In the formula, d min (T i ,TScen) is the trajectory T i The minimum center trajectory distance to the cluster center trajectory set TScen.

[0117] (7) Based on d min (T i ,TScen) calculates the remaining trajectory T for each trajectory in the trajectory set. i The probability of being selected as the center trajectory:

[0118] ω(T i )=d min (T i ,TScen)*ρ(T i );

[0119] In the formula, ω(T) i ) represents the trajectory weight, i.e., the trajectory T in the trajectory set. i The weight of the selected center trajectory is used to determine the next initial center trajectory, which is then moved into TScen = {T}.c1 ,T c2 ,…,T cz …,T ck}middle.

[0120] (8) When the capacity of TScen is equal to K, it means that K initial center trajectories have been selected;

[0121] Where the value of K is preset, In practice, the best value for K should be selected from the range of possible values.

[0122] Step 5, as follows Figure 3 As shown, trajectory clustering is implemented based on the K-means clustering algorithm:

[0123] (1) According to the trajectory density array Den, remove the trajectory with the lowest trajectory density. Generally, the lower the density value of the trajectory, the more the trajectory deviates from the overall trajectory cluster, indicating that such a trajectory is an outlier and does not have a positive effect on trajectory clustering.

[0124] (2) Using the trajectory distance matrix M, find the distances from the nK remaining trajectories to the K initial center trajectories respectively, and then classify the remaining trajectory into the trajectory cluster to which the nearest initial center trajectory belongs.

[0125] (3) Using the trajectory density array Den, find the trajectory with the largest density value among the K trajectory clusters in turn as the center trajectory of the current cluster, and carry out the next round of clustering process.

[0126] (4) Repeat process (2) and process (3). When the number of iterations is reached or the elements in the trajectory cluster no longer change, the trajectory clustering process ends.

[0127] Example

[0128] This embodiment conducted experiments on two datasets to evaluate the clustering performance of the algorithm. The hardware environment for the experiment was: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz 2.59GHz, 8.00GB RAM. The operating system was Microsoft Windows 10, and the algorithm was written in Java using IDEA as the programming environment.

[0129] (1) Synthetic dataset:

[0130] The synthetic data set is generated by the Thomas Brinkhoff moving object generator based on the map of the city of Oldenburg, Germany, and the trajectory set of the moving object can be obtained by setting the parameters of the generator. In order to repeat the experiment, the related parameters are as follows: 10 moving objects and 1 external object are generated per timestamp; the moving object refers to a car, and the external object refers to the weather condition (or other factors) of a region, which affects the speed of the moving object and whether to choose a new path to move; 100 timestamps; the moving speed of the moving object is 250; the 'probability' is 1000, and the trajectory point is generated in continuous time. Through the setting of the above parameters, a total of 1000 synthetic trajectories are generated, the number of locations on each trajectory ranges from [1, 100], and a total of 45929 locations in the city of Oldenburg are accessed. At the same time, in order to make the simulation experiment closer to the experiment under the real data set, the trajectories with a point number of less than 20 are removed, that is, the number of locations of all trajectories is between [21, 100], and after the removal operation, the number of trajectories is 786, and the average number of locations of each trajectory is 55.6.

[0131] (2) Real data set:

[0132] The real trajectory data set is composed of 536 files, including the spatio-temporal information of 536 taxis collected in the San Francisco Bay Area from May to June 2008 for a total of 30 days, each file is the complete information of a taxi, that is, the latitude and longitude of the sampling point, the timestamp, and whether to carry passengers. Since the continuous trajectory information of a taxi in a month is difficult to be identified as a single trajectory, it is necessary to set a time interval threshold to divide the trajectory. Because the number of trajectory points between 12:04 on May 25, 2008 and 12:04 on May 26, 2008 is the most, it is used as the trajectory set for the experiment. The average time interval between consecutive positions in the data set is 88 seconds, so 3 minutes is set as the time threshold for trajectory segmentation, and if the time interval between consecutive positions is greater than 3 minutes, the trajectory is truncated between the two positions, indicating the end of the previous trajectory and the beginning of the next trajectory, and a total of 482 trajectories are obtained.

[0133] In the algorithm described in the application, in order to ensure that the clustering result is as little as possible affected by the low frequency iteration number, the iteration number is set to 100.

[0134] The trajectory clustering algorithm can be observed by a visual software to observe the final experimental effect, and in this embodiment, the visualization process is completed by using the python language.

[0135] The algorithm described in the application is used to cluster the synthetic data set, and by comparing the clustering results when different K values are set, K = 9 is better, such as Figure 4As shown in the figure, the trajectory clustering of the synthetic data set is a three-dimensional space-time graph, and since the time length of a trajectory is at most 100, the spatial length of a trajectory can only occupy a local part of the city and cannot span the entire Oldenburg city; as shown in the figure, Figure 5 As shown in the figure, the two-dimensional space graph can see that the influencing factor of the trajectory clustering is more the spatial factor, that is, the x and y coordinates; in combination with Figures 6-14 As shown in the figure, the entire trajectory is too concentrated in time, that is, the average trajectory time length accounts for more than 50% of the maximum time length, so more trajectory clustering is presented in the spatial layer.

[0136] The algorithm of the present application is used to cluster the real data set, and by comparing the clustering results when different K values are set, K = 6 is better, as shown in the figure, Figure 15 As shown in the figure, the trajectory of the real data set has an average time span of more than 3 hours, and a taxi can span the entire San Francisco Bay Area in 3 hours. Because the time span of the real data set used in the experiment is 24 hours, the average time span of each trajectory accounts for only 1 / 8 of the total time span, which is much lower than the time span of the synthetic data set trajectory; as shown in the figure, Figure 16 As shown in the figure, it is shown that each trajectory covers the entire city, and the latitude and longitude coordinates are not the main factors affecting the clustering effect; in combination with Figures 17-22 As shown in the figure, the main influencing factor of the trajectory clustering is the time factor, that is, the t coordinate, rather than the latitude and longitude coordinates. The entire trajectory is too concentrated in space, so more trajectory clustering is presented in the time layer. The trajectory has its own clustering effect at different times.

[0137] Clustering takes distance as a measure, and the samples in the data set are divided into several disjoint clusters by distance. The purpose is to make the objects in the same cluster as similar as possible, and the objects between different clusters as different as possible. The silhouette index is a measure of the similarity of an object to the cluster it belongs to compared to other clusters. It combines cohesion and separation, so it can more comprehensively evaluate the effect of trajectory clustering. The value range of the silhouette index is [-1, 1], and the larger the value is, the better the clustering effect is.

[0138] As shown in the figure, Figure 23 For the synthetic data set, it can be seen that the size of the silhouette index decreases as the number of clusters increases, which is more in line with common sense. Since the number of clusters K increases, more trajectory clusters are formed, causing trajectories that belong to the same trajectory cluster to be divided into different trajectory clusters, which will inevitably cause overcrowding between different clusters, resulting in a significant increase in separation and a decrease in cohesion, and the silhouette index decreases.

[0139] From Figure 23As can be seen from the figure, the silhouette coefficient of the DBK-means of the application is higher than those of the other three algorithms. The mdav algorithm is based on the K-means framework, but uses a random selection method for the initial trajectory and does not remove outliers, and the initial center trajectory is randomly selected in the iteration process. The gcdm algorithm selects the trajectory farthest from the previous center trajectory as the center trajectory of this round of iteration, but does not consider the influence of the trajectory distance factor on the selection of the initial center trajectory. The tc_mftsm algorithm selects the K longest trajectories as the initial center trajectory, and uses the average trajectory of the trajectory cluster as the center trajectory in the iterative clustering process. The above three algorithms all cause different degrees of redundancy in the clustering results, which reduces the silhouette coefficient. As can be seen from the results, the silhouette coefficient of the above-mentioned method of the application is higher than that of the other three comparison algorithms, indicating that the method of the application based on the calculation of the trajectory density value can always select the initial center trajectory from the trajectories that are far apart and have high trajectory density, which is better than the other three methods, and the clustering effect obtained is more effective.

[0140] As Figure 24 can be seen from the trend of the silhouette coefficient under the real data set, the trajectory clustering algorithm of the application has a positive effect on trajectory clustering: by setting the definition of trajectory density, the sparsity of each trajectory is quantitatively obtained, and the outlier trajectories with low trajectory density values are selectively removed, and the probability of each trajectory being selected is calculated by referring to the trajectory neighborhood distance and trajectory density value, and then the clustering process is completed.

[0141] Specifically, as can be seen from the figure, when K is small, the results of the mdav algorithm, the gcdm algorithm, the tc_mftsm algorithm and the DBK-means of the application are not much different. When K is 10 and 15, the silhouette coefficient obtained by the DBK-means of the application is higher than that of the other three algorithms, and the clustering effect obtained is better than that of the other three algorithms. This is mainly because the algorithm of the application can filter out outliers by using the pre-calculated trajectory density, optimize the clustering effect, and at the same time, make full use of the distance factor between the trajectory density and the center trajectory when selecting the initial center trajectory, so that the trajectories with high trajectory density and uniform distribution can be selected as the initial center trajectory. In the trajectory iteration process, the influence of trajectory density on trajectory cluster is always considered, so that the center trajectory of the next iteration has the characteristics of high density, which has a positive effect on the clustering effect.

[0142] The application discloses a vehicle trajectory clustering method fusing density value and K-means algorithm, and solves the framework optimization problem when the K-means clustering algorithm is applied to the trajectory field. In the case of a large amount of trajectory data such as pedestrian trajectories, vehicle trajectories and the like, trajectory clustering needs to be performed on a large amount of disordered trajectories to generate a plurality of trajectory clusters, so that the trajectory similarity in the same trajectory cluster is high, and the trajectory similarity between different trajectory clusters is low. The trajectory cluster formed by the trajectory clustering algorithm can know the trajectory flow in the cluster, thereby obtaining the distribution of hot traffic routes and cold routes in the city, providing data support for traffic flow monitoring of the traffic control department, and providing an improvement idea for city bus route planning. Meanwhile, the application can also provide a location-based service (LBS) for users, because the formed trajectory cluster is mostly attached to hot routes and hot areas, which has a positive effect on user destination prediction and trajectory recommendation.

[0143] Although the embodiments of the present application have been disclosed as above, they are not limited to the application listed in the specification and the embodiments, and can be fully applied to various fields suitable for the present application, and other modifications can be easily realized by those skilled in the art, and therefore the present application is not limited to specific details and the embodiments shown and described herein, without departing from the general concept defined by the claims and the equivalent scope.

Claims

1. A vehicle trajectory clustering method fusing density value and K-means algorithm, characterized in that, The method comprises the following steps: Step 1: After collecting and preprocessing the vehicle movement trajectory data, obtain the trajectory set TS = {T1, T2, ... T}. i ,…T j ,…T n }; Wherein, T i is the i-th track, T j is the j-th track, and i = 1 ~ n, j = 1 ~ n, T i = {i, p1, p2…p t ,…p m}, T j = (j, q1, q2…q t ,…q l ), p t is a track point (x1, y1, t) of track T i at time stamp t, q t is a track point (x2, y2, t) of track T j at time stamp t; Step two, calculating the trajectory distance between trajectories in the trajectory set in turn, and saving the trajectory distance between all trajectories in the trajectory set into a trajectory distance matrix; Wherein, the trajectory distance satisfies: D(T i ,T j ) = D(p t ,q t ); where D(T i ,T j ) is the distance between the trajectory T i and the trajectory T j , D(p t ,q t ) is the transformed distance between the trajectory point p t and the trajectory point q t , and the transformed distance between the trajectory point p t and the trajectory point q t satisfies: where d(p t , q t ) is the actual distance between the trajectory point p t and the trajectory point q t , and min{d(p t-1 , q t-1 ), d(p t-1 , q t ), d(p t , q t-1 )} is the minimum distance of the aligned point pairs between the trajectory T i and the trajectory T j . Step three, determine the density of all trajectories in the trajectory set, and add the trajectory with the maximum density value as the first center trajectory to the cluster center trajectory set TScen={T c1 ,T c2 ,…,T cz …,T ck} Wherein, the density of the trajectory satisfies: where p(T i ) is the density of trajectory T i , u(x) is the function value, Eps is the neighborhood distance, T cz is the zth central trajectory, z = 1 ~ k; Step four, calculating the weight of each remaining trajectory in the trajectory set being selected as the center trajectory in turn, taking the remaining trajectory with the maximum weight value in the trajectory set as the next center trajectory, and moving it into the cluster center trajectory set until the capacity of the cluster center trajectory set reaches K, and the center trajectory selection is completed; wherein Step five, removing the trajectory with the lowest density value in the trajectory set, and performing K-means clustering again until the iteration number is reached or the elements in the trajectory cluster no longer change, and the trajectory clustering process is ended. 2.The vehicle trajectory clustering method of fusion density value and K-means algorithm according to claim 1, wherein, The preprocessing comprises trajectory selection, trajectory segment segmentation and / or trajectory filling. 3.The vehicle trajectory clustering method of fusion density value and K-means algorithm according to claim 2, wherein, The step two further comprises: If there is no overlapping time between the trajectories in the trajectory set, the trajectory distance is INF, and the distance of the trajectory itself is INF. 4.The vehicle trajectory clustering method of fusion density value and K-means algorithm according to claim 3, wherein, The determination of the overlapping time between trajectories in pairs specifically comprises: If then there is no overlapping time between the two trajectories, and if there is overlapping time between the two trajectories, then [a, b] is the overlapping time between the two trajectories. wherein start i is the start time of the trajectory T i , end i is the end time of the trajectory T i , start j is the start time of the trajectory T j , end j is the end time of the trajectory T j , a = max(start i , start j ), b = min(end i , end j ). 5.The vehicle trajectory clustering method of fusion density value and K-means algorithm according to claim 4, wherein, The neighborhood distance satisfies: In the formula, is the average of the distance array. 6.The vehicle trajectory clustering method of fusion density value and K-means algorithm according to claim 5, wherein, The distance array satisfies: Dη= {d(x iη )}; where Dηis a distance array, d(x iη ) is a distance parameter, and the distance parameter is the ηth-smallest value of each row in the trajectory distance matrix, i is a trajectory number, and η is an Eps neighborhood parameter.

7. The fusion density value and K-means algorithm based vehicle trajectory clustering method of claim 6, wherein, The Eps neighborhood parameter satisfies: In the formula, n is the number of trajectories in the trajectory set. 8.The vehicle trajectory clustering method of fusion density value and K-means algorithm according to claim 7, wherein, The weight of the trajectory being selected as the center trajectory satisfies: ω(T i ) = d min (T i , TScen) * p(T i ); where ω(T i ) is the weight of the trajectory T i chosen as the center trajectory, d min (T i , TScen) is the minimum center trajectory distance of the trajectory T i to the set of cluster center trajectories TScen. 9.The vehicle trajectory clustering method of fusion density value and K-means algorithm according to claim 8, wherein, The trajectory T i The minimum center trajectory distance to the cluster center trajectory set TScen satisfies: d min (T i ,TScen)=min(D(T i ,T cz ))(T cz ∈TScen,z∈[1,k]); where D(T i ,T cz ) is the trajectory distance of trajectory T i to the center trajectory T cz in the set of center trajectories TScen.

Citation Information

Patent Citations

  • Vehicle trajectory clustering method based on band outlier removal

    CN112906812A

  • Determining driving trajectory of intelligent driving vehicle

    WO2021052185A1