A Deep Learning-Based Trajectory Sequence Clustering Method

Through the deep learning trajectory sequence clustering method, the loss function is optimized using the sequence-to-sequence autoencoder and the K-Means clustering algorithm, which solves the accuracy of the trajectory clustering algorithm and achieves more efficient nonlinear feature representation and clustering effects.

CN113988203BActive Publication Date: 2025-07-08ZHEJIANG LAB +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111298174.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-01
Publication Date
2025-07-08
Estimated Expiration
2041-11-01

AI Technical Summary

Technical Problem

The existing trajectory clustering algorithms are insufficient in terms of trajectory similarity measurement, making it difficult to effectively cluster nonlinear feature representation.

Method used

Using the deep learning-based trajectory sequence clustering method, the low-dimensional feature representation of trajectory data is learned through the pre-training layer. Combining the sequence-to-sequence autoencoder model and the K-Means clustering algorithm, the loss function is optimized to obtain more suitable clustering results.

Benefits of technology

It realizes that the clustering results with higher accuracy are obtained in the end-to-end trajectory clustering process, and can effectively process non-uniform, low sampling rate and noise trajectory data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113988203B_ABST
    Figure CN113988203B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data mining, and specifically relates to a trajectory sequence clustering method based on deep learning, including the following steps: Step 1, pre-training layer: Use a sequence-to-sequence autoencoder model to learn the low-dimensional feature representation of trajectory data; Step 2, initial clustering layer: Perform the K-Means clustering algorithm multiple times on the trajectory feature representation obtained by the pre-training layer, and select the cluster centers in the optimal clustering result as the initial cluster centers. Step 3, joint training optimization layer: Combine the trajectory clustering and deep feature extraction methods, propose an optimized loss function that combines the reconstruction error and clustering error of the sequence-to-sequence autoencoder model, and map the trajectory feature representation to a feature space more suitable for clustering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data mining, and particularly to a trajectory sequence clustering method based on deep learning. Background Art

[0002] The similarity measurement between trajectories is the basis of spatio-temporal trajectory clustering methods. Most trajectory clustering algorithms split the complete trajectory into segments or groups, and use point matching methods or customized strategies to compare the similarity between trajectories, and then use widely popular clustering algorithms to cluster similar trajectory objects into clusters. The accuracy of this clustering method needs to be improved. The development of deep learning makes it possible to learn the feature representation of complex input sequences, which can be applied to the field of trajectory clustering to learn more suitable non-linear feature representations for clustering and obtain more accurate clustering results. Summary of the Invention

[0003] In order to solve the above technical problems existing in the prior art, the present invention proposes a trajectory sequence clustering method based on deep learning, and its specific technical solution is as follows:

[0004] A trajectory sequence clustering method based on deep learning includes the following steps:

[0005] Step 1, pre-training layer: Use a sequence-to-sequence autoencoder model to learn the low-dimensional feature representation of trajectory data;

[0006] Step 2, initial clustering layer: Perform the K-Means clustering algorithm multiple times on the trajectory feature representation obtained by the pre-training layer, and select the cluster centers in the optimal clustering result as the initial cluster centers;

[0007] Step 3, joint training and optimization layer: Combine the trajectory clustering and deep feature extraction methods, propose an optimized loss function that combines the reconstruction error and clustering error of the sequence-to-sequence autoencoder model, map the trajectory feature representation to a more suitable feature space for clustering, and obtain the clustering result end-to-end.

[0008] Further, step 1 specifically includes the following steps:

[0009] Step 1.1, first, map the trajectory data points to equal-sized spatial grids, and regard each grid as a discrete label;

[0010] Step 1.2, then, use a sequence-to-sequence autoencoder model to embed the trajectory sequence into a feature space that can reflect its potential path information, and extract a low-dimensional vector representing the true path of the trajectory data. The vector learning method is robust to non-uniform, low-sampling-rate, and noisy trajectory data sets.

[0011] Further, step 1.1 is specifically as follows: Divide the research area into spatial grids of equal size and regard each grid as a discrete label. Trajectory points falling into the same grid can be represented by the same label. These grids are regarded as tokens in natural language processing. Each grid has a unique identifier, and the set of all grids constitutes the vocabulary V.

[0012] Further, step 1.2 is specifically as follows: The pre-training layer uses a sequence-to-sequence autoencoder model to learn the low-dimensional feature representation of the trajectory data. The training of this model is equivalent to minimizing the KL divergence between the reconstructed trajectory feature distribution P y and the original trajectory distribution P r , that is, KL(P r ||P y ). For a given trajectory, the training objective function is as follows:

[0013]

[0014] where, is the distribution of the reconstructed trajectory feature y t after the trajectory is input into the model, is the spatial proximity distribution of the original trajectory r t for the decoding process of y t . ||·||2 represents the Euclidean distance between the grid centroid coordinates, and θ is the distance ratio parameter that controls the distribution of the original trajectory r;

[0015] Therefore, for a given dataset, the total reconstruction loss is the sum of the errors of all trajectory objects in the dataset in formula (2), denoted as where N is the size of the dataset.

[0016] Further, step 2 is specifically as follows:

[0017] The loss function of the K-Means clustering algorithm is expressed as:

[0018]

[0019] In the formula, z i is the trajectory feature learned through the pre-training stage, μ k is the cluster center, s ik is a boolean variable. If μ k is the cluster center closest to z i , then s ik is 1, otherwise s ik is 0; The softmax function is selected to make the formula (3) continuous. For a given feature z i , the clustering loss function is expressed in the following form, and all parameters are differentiable:

[0020]

[0021] Among them, ||·||2 represents the Euclidean distance, and σ determines whether the clustering is hard assignment or soft assignment. Specifically, when σ is 0, the weights of z i to all cluster centers are equal, belonging to soft assignment clustering. When σ is +∞, it is equivalent to performing the K-Means algorithm in the embedding space, belonging to hard assignment clustering. Considering that a certain distance should be maintained between cluster centers, a cluster center distance loss function is proposed and defined as:

[0022]

[0023] In the formula, μ i and μ j represent different cluster centers, and usually the normalized values are calculated;

[0024] Therefore, the final clustering loss function for all trajectory data in the dataset is:

[0025]

[0026] is the sum of the errors of formulas (4) and (5) weighted by the parameter γ, and N is the total number of trajectories in the dataset.

[0027] Furthermore, the objective function for the joint training optimization in step 3 is:

[0028] L = αL r + βL c (7)

[0029] In the formula, L r is the error between the reconstructed trajectory features output by the sequence-to-sequence autoencoder model and the original trajectory data, and L c is the K-Means clustering loss in the embedding space. α and β are proportionality factors that balance the reconstruction error and the clustering error, and determine whether the learned trajectory feature representation is closer to the original trajectory data or more suitable for clustering. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 is the overall process schematic diagram of the trajectory sequence clustering method based on deep learning of the present invention;

[0031] Figure 2 is the pseudo-code schematic diagram of step 3 of the trajectory sequence clustering method based on deep learning of the present invention;

[0032] Figures 3(a)-3(c) is the original data graph used to prove the effectiveness of the trajectory sequence clustering method based on deep learning of the present invention;

[0033] Figure 4 It is a comparison graph of the clustering results of the trajectory sequence clustering method based on deep learning of the present invention and related methods. Detailed implementation manners

[0034] In order to make the objectives, technical solutions and technical effects of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the accompanying drawings of the specification and embodiments.

[0035] As Figure 1 shown, a trajectory sequence clustering method based on deep learning of the present invention uses the non-linear feature extraction ability of deep learning to learn the feature representation of trajectory data and uses it as the clustering object. Without using a paired point matching method to calculate the similarity between trajectories, not only can a trajectory feature representation with a fixed length and suitable for clustering be obtained, but also the clustering result can be obtained end-to-end in the same framework. Specifically, the method includes the following steps:

[0036] Step 1, first map the trajectory data points to a spatial grid, then regard these grids as discrete tokens in a sequence-to-sequence autoencoder model, and convert them into vectors through an embedding layer; then, use the sequence-to-sequence autoencoder model to embed the trajectory sequence into a feature space that can reflect its potential path information.

[0037] Specifically, first divide the research area into spatial grids of equal size and regard each grid as a discrete token. Trajectory points falling into the same grid can be represented by the same token. These grids are regarded as tokens in natural language processing, and each grid has a unique identifier. The set of all grids constitutes the vocabulary V.

[0038] Next, learn the low-dimensional feature representation of the trajectory data based on the sequence-to-sequence autoencoder model. For a given trajectory x, in order to find its most likely true path r and thus learn the feature representation of the low sampling rate and noisy trajectory, it is expected that the model should maximize the conditional probability P(r|x).

[0039] The present invention uses a high sampling rate trajectory to replace the true trajectory and uses the low sampling rate trajectory as the model input. Specifically, assume x a and x b are two sampling trajectories of the true trajectory r, where x a has a lower sampling rate, while x b has a higher sampling rate. The trajectory x b with a relatively higher sampling rate is closer to their true trajectory r. Therefore, the objective of maximizing P(r|x) can be replaced by maximizing P(x b |x a ), and the encoder is used to learn x based on the sequence-to-sequence autoencoder model.a The embedded representation v, and then use a decoder to attempt to recover its corresponding higher-sampling-rate trajectory x based on the feature v b . Based on the above analysis, given the acquired set of sampled trajectories For each sampled trajectory x b Perform downsampling to create a pair of {x a , x b} combinations, and use a sequence-to-sequence autoencoder model to maximize the joint probability of all {x a , x b} groups:

[0040]

[0041] Since the KL divergence function can represent the difference between two probability distributions, the present invention uses KL divergence to compare the gap between the reconstructed trajectory feature y and the true trajectory r. The pre-training layer based on the training of the sequence-to-sequence autoencoder model can be equivalent to minimizing the KL divergence between the reconstructed trajectory feature distribution P y and the original trajectory distribution P r , that is, KL(P r ||F p ). For a given trajectory x, the training objective function is as follows:

[0042]

[0043] Wherein, is the distribution of the reconstructed trajectory feature y after the trajectory x is input into the model t , is the spatial proximity distribution of r t for the decoding process of y t . Assume that the grid g belongs to the vocabulary V, and its weight is inversely proportional to its spatial distance to the target grid y t . Therefore, the grids closer to y t are assigned greater weights. In addition, since most grids are far from r t , only have small weights, so only need to calculate in advance the weights of the K grids closest to r t to reduce the cost of network training, denoted as N K (r t ). ||·||2 represents the Euclidean distance between the centroid coordinates of the grids, and θ is the distance ratio parameter that controls the distribution of r. For a given data set, the total reconstruction loss is the sum of the errors of all trajectory objects in the data set in formula (2), denoted as where N is the size of the data set.

[0044] Step 2: Perform the K-Means clustering algorithm multiple times on the trajectory features obtained from the pre-training layer, and select the cluster centers in the optimal clustering result as the initial cluster centers. The loss function of the K-Means clustering algorithm is expressed as:

[0045]

[0046] where z i are the trajectory features learned through the pre-training stage, μ k are the cluster centers, and s ik is a boolean variable. If μ k is the cluster center closest to z i , then s ik is 1, otherwise s ik is 0. The present invention selects the softmax function to represent formula (3) continuously. For a given feature z i , the clustering loss function can be represented in the following form, and all parameters are differentiable:

[0047]

[0048] where ||·||2 represents the Euclidean distance, and σ determines whether the clustering is a hard assignment or a soft assignment. Specifically, when σ is 0, the weights of z i to all cluster centers are equal, belonging to soft assignment clustering. When σ is +∞, it is equivalent to performing the K-Means algorithm in the embedding space, belonging to hard assignment clustering. Considering that there should be a certain distance between cluster centers, the present invention proposes a cluster center distance loss function, defined as:

[0049]

[0050] where μ i and μ j represent different cluster centers, and usually the normalized values are calculated. The final clustering loss function of all trajectory data in the dataset is shown in formula (6), which is the sum of the errors of formula (4) and (5) weighted by the parameter γ, and N is the total number of trajectories in the dataset.

[0051]

[0052] Step 3: Utilize the ability of deep learning technology to extract the feature representation of complex sequence data, combine the advantages of the sequence-to-sequence autoencoder model and the K-Means clustering algorithm, and optimize and train the initial trajectory features obtained in the pre-training stage to learn a more suitable trajectory feature representation for clustering. The objective function of the joint training optimization is defined as:

[0053] L = αL r + βL c(7)

[0054] where L r is the error between the reconstructed trajectory features output by the sequence-to-sequence autoencoder model and the original trajectory data, and L c is the K-Means clustering loss in the embedding space. α and β are scaling factors that balance the reconstruction error and the clustering error, determining whether the learned trajectory feature representation is closer to the original trajectory data or more suitable for clustering. During the training process, the backpropagation algorithm is used to effectively solve the result optimization problem. After the training is completed, a trajectory feature representation with a fixed length and more suitable for clustering and the corresponding cluster centers can be obtained.

[0055] The pseudocode for the joint training optimization is as Figure 2 shown. The inputs to the algorithm in step 3 include: the weights of the sequence-to-sequence autoencoder model network obtained in the pre-training stage, i.e., the initial parameters w0 of the autoencoder network in the joint training; performing the K-Means clustering algorithm on the trajectory feature vectors learned in the pre-training stage, and using the cluster centers of the clustering results as the initial cluster centers μ0; the number of training iterations (Epoch) M; and the batch size (Mini-batch) N of the stochastic gradient descent. The outputs of the algorithm are: the trained weights w of the sequence-to-sequence autoencoder model, the cluster centers μ, and the clustering assignment.

[0056] The present invention uses three datasets to verify the effectiveness of the proposed deep trajectory clustering method, including the simulated dataset D1, as shown in Fig. 3(a), the trajectory data of a public transportation intersection in the Computer Vision Robotics Research (CVRR) dataset, i.e., dataset D2, as shown in Fig. 3(b), and the human walking trajectory data in the CVRR dataset, i.e., dataset D3, as shown in Fig. 3(c).

[0057] To quantitatively compare the quality of the clustering results of the method proposed in the present invention and other algorithms, two metrics, namely the Normalized Mutual Information (NMI) and the Adjusted Rand Index (ARI), are used for evaluation. The values of the metrics range from [0, 1], and the closer to 1, the more accurate the clustering results. To verify the effectiveness of the proposed algorithm, representative algorithms for deep trajectory feature extraction, T2VEC, and widely popular traditional trajectory clustering methods, LCSS, EDR, and DTW, are selected as comparison models. The present invention uniformly performs clustering 10 times using the K-Means clustering algorithm on the obtained trajectory similarity matrix or the learned trajectory features, and calculates the mean and standard deviation of the NMI and ARI metrics. For the method proposed in the present invention, the clustering results can be directly obtained end-to-end after the network training is completed. As shown in Table 1, the method proposed in the present invention obtains the highest NMI and ARI indices on all three datasets, indicating the highest clustering quality.

[0058] Table 1 Clustering Results of the Method Proposed in the Present Invention and Related Methods

[0059]

[0060] Taking the dataset D1 as an example to illustrate the differences in the clustering results between the method proposed in the present invention and other comparison methods, as Figure 4 shown, it can be seen that the method proposed in the present invention makes a more accurate distinction among the 10 clusters.

[0061] As described above, the above are only the preferred embodiments of the present invention and do not impose any form of limitation on the present invention. Although the implementation process of the present invention has been described in detail above, for those familiar with the art, they can still modify the technical solutions recorded in the foregoing examples or perform equivalent replacements on some of the technical features. Any modifications, equivalent replacements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A trajectory sequence clustering method based on deep learning, characterized in that, It includes the following steps: Step 1, pre-training layer: Use a sequence-to-sequence autoencoder model to learn the low-dimensional feature representation of trajectory data; Step 2, initial clustering layer: Execute the K-Means clustering algorithm multiple times on the trajectory feature representation obtained by the pre-training layer, and select the cluster centers in the optimal clustering result as the initial cluster centers; Step 3, joint training optimization layer: Combine the trajectory clustering and deep feature extraction methods, propose an optimized loss function that combines the reconstruction error and clustering error of the sequence-to-sequence autoencoder model, map the trajectory feature representation to a feature space more suitable for clustering, and obtain the clustering result end-to-end; The specific steps of Step 1 include the following: Step 1.1, First, map the trajectory data points to spatial grids of equal size, and regard each grid as a discrete token; Step 1.2, Then, use a sequence-to-sequence autoencoder model to embed the trajectory sequence into a feature space that can reflect its potential path information, and extract the low-dimensional vector representing the true path of the trajectory data; The specific content of Step 1.1 is: Divide the research area into spatial grids of equal size and regard each grid as a discrete token. The trajectory points falling into the same grid can be represented by the same token. These grids are regarded as tokens in natural language processing, and each grid has a unique identifier. The set of all grids constitutes the vocabulary V; The specific content of step 1.2 is as follows: The pre-training layer uses a sequence-to-sequence autoencoder model to learn the low-dimensional feature representation of trajectory data, and the training of this model is equivalent to minimizing the KL divergence between the reconstructed trajectory feature distribution P y and the original trajectory distribution P r , that is, KL(P r ||P y ). For a given trajectory, the objective function for training is as follows: Among them, is the trajectory feature y reconstructed after the trajectory input model t distribution, is the spatial proximity distribution of the original trajectory r t for the decoding process of y t ‖·‖2 represents the Euclidean distance between the grid centroid coordinates, and θ is the distance ratio parameter that controls the distribution of the original trajectory r; Therefore, for a given dataset, the total reconstruction loss is the sum of the errors of all trajectory objects in the dataset according to formula (2), denoted as where N is the size of the dataset; The specific content of Step 2 is: The loss function of the K-Means clustering algorithm is expressed as: where z i is the trajectory feature learned through the pre-training stage, μ k is the cluster center, s ik is a boolean variable. If μ k is the cluster center closest to z i , then s ik is 1, otherwise s ik is 0; The softmax function is selected to represent formula (3) continuously. For the given feature z i , the clustering loss function is represented in the following form, and all parameters are differentiable: Among them, ‖·‖2 represents the Euclidean distance, and σ determines whether the clustering is hard assignment or soft assignment. Specifically, when σ is 0, the weights of z i to all cluster centers are equal, which belongs to soft assignment clustering. When σ is +∞, it is equivalent to performing the K-Means algorithm in the embedding space, which belongs to hard assignment clustering. Considering that a certain distance should be maintained between cluster centers, a cluster center distance loss function is proposed and defined as: where μ i and μ j represent different cluster centers and calculate the normalized values; Therefore, the final clustering loss function of all trajectory data in the dataset is: It is the error sum of formulas (4) and (5) weighted by the parameter γ, and N is the total number of trajectories in the dataset; The function of the joint training optimization in Step 3 is: L = αL r + βL c (7) where, L r is the error between the reconstructed trajectory feature output by the sequence-to-sequence autoencoder model and the original trajectory data, and L c is the K-Means clustering loss in the embedding space. α and β are scale factors that balance the reconstruction error and the clustering error, determining whether the learned trajectory feature representation is closer to the original trajectory data or more suitable for clustering.

Citation Information

Patent Citations

  • Deep clustering method and system based on data co-occurrence relationship

    CN111160437A

  • Multi-modal adaptive fusion depth clustering model and method based on auto-encoder

    CN112884010A