CN116186358B - Depth track clustering method, system and storage medium - Google Patents

Depth track clustering method, system and storage medium Download PDF

Info

Publication number
CN116186358B
CN116186358B CN202310100602.3A CN202310100602A CN116186358B CN 116186358 B CN116186358 B CN 116186358B CN 202310100602 A CN202310100602 A CN 202310100602A CN 116186358 B CN116186358 B CN 116186358B
Authority
CN
China
Prior art keywords
track
vector
loss
coding
model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310100602.3A
Other languages
Chinese (zh)
Other versions
CN116186358A (en
Inventor
司俊俊
羊晋
李莉
项阳
陈泽江
刘智超
刘孟奇
涂波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hezhixin Shandong Big Data Technology Co ltd
Original Assignee
Hezhixin Shandong Big Data Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hezhixin Shandong Big Data Technology Co ltd filed Critical Hezhixin Shandong Big Data Technology Co ltd
Priority to CN202310100602.3A priority Critical patent/CN116186358B/en
Publication of CN116186358A publication Critical patent/CN116186358A/en
Application granted granted Critical
Publication of CN116186358B publication Critical patent/CN116186358B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/906Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/907Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/909Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using geographical or spatial information, e.g. location
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Image Analysis (AREA)

Abstract

The application provides a depth track clustering method, a system and a storage medium, comprising the following steps: obtaining a first augmentation data set and a second augmentation data set; inputting the first augmentation data set into the trained track coding model to obtain a track coding vector, and inputting the second augmentation data set into the track momentum coding model to obtain a track momentum coding vector; determining a clustering center, a first class probability distribution and a second class probability distribution, and calculating a first target distribution and a second target distribution; calculating KL divergence contrast learning loss; determining a first projection vector and a second projection vector, and calculating a trace projection vector contrast loss; determining a first track prediction vector and a second track prediction vector, and calculating a track category contrast loss; and determining total model loss, iteratively updating the track coding model and the clustering center, and clustering track data to be clustered based on the track coding vector and the clustering center obtained in the last iteration process. The method has good track data clustering effect.

Description

Depth track clustering method, system and storage medium
Technical Field
The application relates to the technical field of big data mining, in particular to a depth track clustering method, a depth track clustering system and a storage medium.
Background
The track data is data with time and space double attributes generated by related sensor equipment (such as a mobile phone) in the moving process of people, vehicles and objects in the city. The track data can reveal the movement rule of people, vehicles and objects, and is widely applied to various fields of intelligent cities such as traffic flow prediction, real-time demographic analysis, epidemic situation close-contact person excavation and the like in recent years. Track clustering is a common technique for track pattern mining, and can be used for identifying and distinguishing different track patterns, such as periodic track pattern identification, frequent track pattern identification, and the like. Early track clustering technology is mainly based on original track similarity measurement, and a calculation result is greatly interfered by noise. With the application of the deep learning technology, students perform characterization learning on an original track sequence by using a deep learning model to obtain track expression vectors with the same length, and then clustering the tracks by using clustering algorithms such as K-means and the like. For example, fang et al propose an end-to-end deep trajectory clustering technique that learns trajectory representation vectors using a sequence-to-sequence model, clusters the trajectory representation vectors based on K-means, and synchronously optimizes the clustering penalty and the trajectory reconstruction penalty of a sequence-to-sequence model decoder that reconstructs the original trajectory sequence using the trajectory representation vectors.
However, the optimization of the clustering process by the existing track clustering method based on deep learning is only realized by strengthening the distance distribution of the track characterization vector from each clustering center, but the relation between tracks of the same type and different types and the relation between track categories are not explored, so that the track clustering performance is limited. In addition, the existing method only considers the track as a space transfer sequence, but ignores the access time characteristic of each track point, so that the characteristic of a fine track space-time movement mode, such as a group accompanying movement mode and the like, cannot be mined based on massive unmarked data. Therefore, although the existing track clustering method can realize the clustering of tracks, the existing track clustering method has the defect of poor track clustering effect; therefore, how to improve the effect of track clustering is a technical problem to be solved.
Disclosure of Invention
In view of the foregoing, the present application provides a depth trajectory clustering method, system and storage medium to solve one or more of the problems of the prior art.
According to one aspect of the application, the application discloses a depth trajectory clustering method, which comprises the following steps:
acquiring track data to be clustered, and performing data augmentation on the track data to be clustered to obtain a first augmentation data set and a second augmentation data set; each piece of track data to be clustered comprises a plurality of track points, and each track point comprises time information and position information;
inputting the first augmentation data set into a trained track coding model to obtain a track coding vector, and inputting the second augmentation data set into a track momentum coding model to obtain a track momentum coding vector;
determining a clustering center based on the track coding vectors, determining first class probability distribution corresponding to each track data in the first augmentation data set based on each track coding vector and the clustering center, calculating first target distribution based on first class probability distribution corresponding to each track data in the first augmentation data set, determining second class probability distribution corresponding to each track data in the second augmentation data set based on each track momentum coding vector and the clustering center, and calculating second target distribution based on second class probability distribution corresponding to each track data in the second augmentation data set;
calculating KL divergence contrast learning loss based on the first class probability distribution, the first target distribution, the second class probability distribution and the second target distribution;
determining a first projection vector and a second projection vector corresponding to the track coding vector and the track momentum coding vector respectively based on a first feedforward neural network, and calculating a track projection vector contrast loss based on the first projection vector and the second projection vector;
determining a first track prediction vector and a second track prediction vector corresponding to the track coding vector and the track momentum coding vector respectively based on a second feedforward neural network, and calculating track category contrast loss based on the first track prediction vector and the second track prediction vector;
determining total model loss based on the track coding model loss, the KL divergence contrast learning loss, the track projection vector contrast loss and the track category contrast loss, and iteratively updating the track coding model and the clustering center based on the total model loss;
and clustering the track data to be clustered based on the track coding vector and the clustering center obtained in the last iteration process.
In some embodiments of the application, the method further comprises:
constructing an initial track coding model;
calculating the spatial position prediction loss and the occluded track point time prediction loss of a track coding model based on a cross entropy loss function, and determining the track coding model loss based on the spatial position prediction loss and the occluded track point time prediction loss;
and updating model parameters of the initial track coding model based on the track coding model loss to obtain a trained track coding model.
In some embodiments of the application, the data augmentation comprises:
performing sparsification operation on the track data to be clustered; or (b)
Adding position noise or time noise to the track data to be clustered; or (b)
And carrying out interpolation operation on the track data to be clustered.
In some embodiments of the application, the trajectory encoding model and the trajectory momentum encoding model are both BERT models;
the parameters of the track momentum coding model are updated based on the parameters of the track momentum coding model, and the parameter calculation formula of the track momentum coding model is as follows:
θ 2 =mθ 2 +(1-m)θ 1
θ 1 、θ 2 model parameters of the track coding model and the track momentum coding model are respectively, and m is a momentum parameter.
In some embodiments of the present application, the calculation formula of the first target distribution or the second target distribution is:
wherein p is i,j Representing a first target distribution or a second target distribution, q i,j Representing the probability that track i belongs to category j, f j =∑ i q i,j ,q i,j′ Representing the probability that track i belongs to category j', f j′ Representing the sum of probabilities that each track belongs to class j', f j′ =∑ i q i,j′ Where j 'represents any category, j' =1, 2 … N, i represents the particular trajectory currently being calculated, i=1, 2 … M, j represents the particular category currently being calculated, j=1, 2 … N, N represents the total number of categories, and M represents the total number of trajectories.
In some embodiments of the present application, the calculation formula of the KL divergence versus learning loss is: l (L) kl =(KL(P 2 ||Q 1 )+KL(P 1 ||Q 2 ) -2); wherein P is 1 Represents a first class probability distribution, Q 1 Representing a first target distribution, P 2 Represent the probability distribution of the second category, Q 2 Representing a second target distribution.
In some embodiments of the application, calculating a trajectory projection vector contrast loss based on the first projection vector and the second projection vector comprises:
calculating a trace projection vector contrast loss through an InfoNCE loss function based on the first projection vector and the second projection vector;
calculating a trajectory category contrast loss based on the first trajectory prediction vector and the second trajectory prediction vector, comprising:
and calculating track category contrast loss through an InfoNCE loss function based on the first track prediction vector and the second track prediction vector.
In some embodiments of the application, the total model loss is:
L=ω 1 L bert2 L kl3 L nce_traj4 L nce_clus
wherein L is bert For track coding model loss, L kl For KL divergence contrast learning loss, L nce_traj For trace projection vector contrast loss, L nce_clus For trace category contrast loss, ω 1 、ω 3 、ω 4 Are all 1, omega 2 2.
According to another aspect of the present application there is also disclosed a deep trajectory clustering system comprising a processor and a memory, said memory having stored therein computer instructions for executing the computer instructions stored in said memory, which system when executed by the processor implements the steps of the method as described in any of the embodiments above.
According to yet another aspect of the present application, a computer-readable storage medium is also disclosed, on which a computer program is stored, which program, when being executed by a processor, carries out the steps of the method according to any of the embodiments described above.
The deep trajectory clustering method, the deep trajectory clustering system and the storage medium disclosed by the embodiment of the application realize the joint optimization of the trajectory characterization and the trajectory clustering based on the contrast learning, and make similar trajectories similar in a vector space and dissimilar trajectories far away in the vector space, thereby effectively improving the effect of the trajectory clustering and improving the accuracy of the trajectory clustering.
Additional advantages, objects, and features of the application will be set forth in part in the description which follows and in part will become apparent to those having ordinary skill in the art upon examination of the following or may be learned from practice of the application. The objectives and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings.
It will be appreciated by those skilled in the art that the objects and advantages that can be achieved with the present application are not limited to the above-described specific ones, and that the above and other objects that can be achieved with the present application will be more clearly understood from the following detailed description.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate and together with the description serve to explain the application. The components in the figures are not necessarily to scale, emphasis instead being placed upon illustrating the principles of the application. Corresponding parts in the drawings may be exaggerated, i.e. made larger relative to other parts in an exemplary device actually manufactured according to the present application, for convenience in showing and describing some parts of the present application. In the drawings:
fig. 1 is a flow chart of a depth trajectory clustering method according to an embodiment of the application.
Fig. 2 is a schematic frame structure of a deep trajectory clustering system according to an embodiment of the application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings. The exemplary embodiments of the present application and their descriptions herein are for the purpose of explaining the present application, but are not to be construed as limiting the application.
It should be noted that, in order to avoid obscuring the present application due to unnecessary details, only structures and/or processing steps closely related to the solution according to the present application are shown in the drawings, while other details not greatly related to the present application are omitted.
It should be emphasized that the term "comprises/comprising" when used herein is taken to specify the presence of stated features, elements, steps or components, but does not preclude the presence or addition of one or more other features, elements, steps or components.
Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. In the drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
Fig. 1 is a flow chart of a depth trajectory clustering method according to an embodiment of the application, as shown in fig. 1, the depth trajectory clustering method at least includes steps S10 to S70.
Step S10: acquiring track data to be clustered, and performing data augmentation on the track data to be clustered to obtain a first augmentation data set and a second augmentation data set; each piece of track data to be clustered comprises a plurality of track points, and each track point comprises time information and position information.
In the step, the track preprocessing technology is utilized to amplify the data of the track to be clustered, namely, based on an original track, a plurality of new tracks with similar space-time movement pattern characteristics to the original track are constructed. Illustratively, the original trajectory t= (p 1 ,p 2 ,…,p i ,…p n ) Wherein n represents the number of all track points of the track, p i Representing an ith track point, each track point typically containing time information and position information; such as p i Can be expressed as (t) i ,loc i ),t i Representing the corresponding time information of the track point, namely the specific time when the track point is recorded; loc i Indicating the position ID, loc corresponding to the track point i The corresponding longitude and latitude coordinate position is lat i ,lng i
In one embodiment, data augmentation includes: performing sparsification operation on the track data to be clustered; or adding position noise or time noise to the track data to be clustered; or carrying out interpolation operation on the track data to be clustered. For example, the track data augmentation process is denoted as f, D represents the original track data set, and the first augmented data set and the second augmented data set after augmentation are respectively denoted as: d (D) 1 =f(D),D 2 =f(D)。D 1 And D 2 The tracks having the same codes are positive samples, and the other samples except the positive samples can be regarded as negative samples.
Exemplary, the data to be clustered is subjected to a thinning operation for data augmentation, and the specific operation may be that according to a preset ratio r 1 Random arrangementSome of the track points in the original track are dropped, such as randomly dropping 10% of the track points in the original track to be clustered. When the track data to be clustered is noisy, the specific operation can be that according to the preset proportion r 2 Randomly selecting some track points to add position noise or time noise; for example, a method of adding temporal noise to a trace point is to record the time t for its trace point i Adding an offset delta t ,Δ t The value range of (a) is (-300, 300), and the unit is seconds; the method for adding position noise to a track point is to use the longitude and latitude coordinates lat of the original track point i ,lng i As a circle center, a pair of longitude and latitude coordinates is randomly selected in a circle with a radius of 40 meters to replace the original value. Under the condition that longitude and latitude coordinates corresponding to an original track point are unknown, 5 position IDs with highest co-occurrence frequency in all tracks with the position ID of the track point can be counted according to a known track data set, and one original position ID used for replacing the track point is randomly selected from the 5 position IDs. In addition to the data amplification by sparsifying and noising the track data to be clustered, interpolation operations can be performed on the track data to be clustered to realize the data amplification, for example, according to a preset ratio r 3 Some positions are randomly selected to add track points, the position ID of the added track points is set as the position ID of the previous track point, and the time stamp of the added track points is set as the average value of the time stamps of the track points before and after the track points.
It will be appreciated that the above-listed ways of data augmentation are just a few preferred examples, and that in actual use, the particular method of data augmentation employed may be selected according to actual needs.
Step S20: and inputting the first augmentation data set into a trained track coding model to obtain a track coding vector, and inputting the second augmentation data set into a track momentum coding model to obtain a track momentum coding vector.
In this step, the augmented trajectory data is encoded by using a deep learning model, thereby encoding the non-uniform spatio-temporal sequence data into a fixed-length numerical vector. The track momentum coding model and the track coding model may have the same architecture, but different model parameters. For example, the trajectory encoding model and the trajectory momentum encoding model may each be a BERT model, where parameters of the first BERT model (trajectory encoding model) and the second BERT model (trajectory momentum encoding model) are different, and in an iterative update process in a subsequent step, the first BERT model performs iterative update of parameters based on total model loss, and model parameters of the second BERT model perform momentum update based only on model parameters of the first BERT model.
When the track momentum coding model and the track coding model are both BERT models, the first augmentation data set is input into the trained first BERT model, and the CLS expression vector output by the last layer of the first BERT model can be used as the track coding vector H corresponding to the first augmentation data set 1 In addition, the average value of the representative vectors at all positions of the last layer of the first BERT model can be used as the track coding vector H corresponding to the first augmentation data set 1 . For the track momentum coding model, the second augmentation data set is input into the second BERT model, and the CLS expression vector output by the last layer of the second BERT model can be used as the track coding vector H corresponding to the second augmentation data set 2 Or the average value of the representation vectors at all positions of the last layer of the second BERT model can be used as the track coding vector H corresponding to the second augmentation data set 2 . In this embodiment, H 1 Dimension size is set to 256, and H 2 The dimension size is also set to 256.
In an embodiment, the parameters of the track momentum encoding model are updated based on the parameters of the track momentum encoding model, and the parameter calculation formula of the track momentum encoding model is:
θ 2 =mθ 2 +(1-m)θ 1
θ 1 、θ 2 model parameters of the track coding model and the track momentum coding model are respectively, m is a momentum parameter, and an exemplary m can take on a value of 0.999.
In an embodiment of the present application, the depth trajectory clustering method further includes the following steps: constructing an initial track coding model; calculating the spatial position prediction loss and the occluded track point time prediction loss of a track coding model based on a cross entropy loss function, and determining the track coding model loss based on the spatial position prediction loss and the occluded track point time prediction loss; and updating model parameters of the initial track coding model based on the track coding model loss to obtain a trained track coding model.
For example, when the track coding model adopts the BERT model, the dropout ratio of the BERT model may be set to 0.1, the number of layers of the transducer encoder may be set to 6, and the attention header number may be set to 6. Assuming that the number of position IDs after the trace points of all traces are de-duplicated is V, all the position IDs are set to trainable vectors of Vxd size, thereby converting the spatial position information of each trace into a computable embedded vector E1. In addition, when the time of day is divided equally by the interval of t, the access time stamp of each track point can be converted into a time index ID, and when the time index ID is set to a trainable vector of (86400/t) xd, the access time information of each track is converted into a computable embedded vector E2. Furthermore, an embedded vector E3 may be obtained from the position coding in the BERT model; the embedding vector e=e1+e2+e3 of the track is finally obtained.
Further, the application improves the training objective function of the BERT model, and the cross entropy loss of the original masking language model only calculates the prediction loss of the space position ID. In this embodiment, H is used for BERT model output of track coding 1 The dimension is 256, d is 256, t is 10 seconds, the model learning rate is 0.0001, and the iteration number is 20, so that in the pre-training process, the parameters of the track coding model are iteratively updated based on the parameters, and the trained track coding model can be obtained.
In the above embodiment, the track coding model loss is the sum of the spatial position prediction loss and the occluded track point temporal prediction loss, i.e., lbert= CrossEntropyLoss (loc) + CrossEntropyLoss (time), lbert is the track coding model loss, crossEntropyLoss (loc) is the spatial position prediction loss, and CorssEntropyLoss (time) is the occluded track point temporal prediction loss.
Step S30: determining a clustering center based on the track coding vectors, determining first class probability distribution corresponding to each track data in the first augmentation data set based on each track coding vector and the clustering center, calculating first target distribution based on the first class probability distribution corresponding to each track data in the first augmentation data set, determining second class probability distribution corresponding to each track data in the second augmentation data set based on each track momentum coding vector and the clustering center, and calculating second target distribution based on the second class probability distribution corresponding to each track data in the second augmentation data set.
In the step, firstly, initializing the track category center, namely, encoding the track vector H by using a K-Means algorithm 1 And clustering to obtain K clustering center vectors, and initializing the clustering center parameters by using the K numerical values. Further, the track data in the first augmentation data set and the second data augmentation set are clustered based on the determined K class centers, respectively, that is, probabilities that all tracks in the first augmentation data set and the second data augmentation set belong to all classes are determined.
The first class probability distribution is illustratively denoted as Q 1 Then calculate D using student's distribution model 1 Each track encoding vector H 1 Similarity with each clustering center to obtain probability distribution of each sample belonging to any categoryWherein->Representing the probability that track i in the first augmented data set belongs to category j. Similarly, the second class probability distribution may be denoted as Q 2 Calculating D by using student's distribution model 2 Each track of (a)Momentum encoding vector H 2 And the similarity of each clustering center, so as to obtain probability distribution of each track belonging to any category in the second augmentation data setWherein->Representing the probability that the trajectory i in the second augmented data set belongs to category j.
Further, to increase the confidence of the sample class distribution, a first target distribution may be determined based on the first class probability distribution and a second target distribution may be determined based on the second class probability distribution. For example, the calculation formula of the first target distribution or the second target distribution may be:
wherein p is i,j Representing a first target distribution or a second target distribution, q i,j Representing the probability that track i belongs to category j, f j =∑ i q i,j ,q i,j′ Representing the probability that track i belongs to category j', f j′ Representing the sum of probabilities that each track belongs to class j', f j′ =∑ i q i,j′ Where j 'represents any category, j' =1, 2 … N, i represents the particular trajectory currently being calculated, i=1, 2 … M, j represents the particular category currently being calculated, j=1, 2 … N, N represents the total number of categories, and M represents the total number of trajectories.
Further, the first target distribution may be denoted as P 1 Based on the first class probability distribution Q 1 Calculating to obtain a first target distribution P 1 Such as:wherein (1)> Representing the probability that track i belongs to category j in the first augmented data set, +.>Representing the probability that track i belongs to class j' in the first augmented data set, f j′ Where the sum of probabilities that each track belongs to a class j ' in the first augmented data set is represented, j ' represents any class, j ' =1, 2 … N, i=1, 2 … M, j=1, 2 … N, N represents the total number of classes, M herein represents the total number of tracks in the first augmented data, i represents the particular track currently being calculated, and j represents the particular class currently being calculated. Similarly, the second target distribution may be denoted as P 2 Based on the second class probability distribution Q 2 Calculating to obtain a first target distribution P 2 For example->Wherein (1)> Representing the probability that track i belongs to category j in the second augmented data set, +.>Representing the probability that track i belongs to class j' in the second augmented data set, f j′ Where the sum of probabilities that each track belongs to class j ' in the second augmented data set is represented, j ' represents any class, j ' =1, 2 … N, i=1, 2 … M, j=1, 2 … N, N represents the total number of classes, and M represents the total number of tracks represented in the second augmented data set. It will be appreciated that in one calculation, i and j each take a particular value, while j' takes 1,2 … N.
Step S40: and calculating KL divergence contrast learning loss based on the first class probability distribution, the first target distribution, the second class probability distribution and the second target distribution.
In this step, the class probability distribution contrast learning to which the trajectory belongs is completed based on the first class probability distribution, the first target distribution, the second class probability distribution, and the second target distribution. At the moment, the track coding vector category probability distribution, the track momentum coding vector target distribution and the track coding vector target distribution are respectively utilized to compare, and the KL divergence is utilized to measure the comparison learning loss. The calculation formula of KL divergence contrast learning loss is as follows: l (L) kl =(KL(P 2 ||Q 1 )+KL(P 1 ||Q 2 ) -2); wherein P is 1 Represents a first class probability distribution, Q 1 Representing a first target distribution, P 2 Represent the probability distribution of the second category, Q 2 Representing a second target distribution.
Step S50: and respectively determining a first projection vector and a second projection vector corresponding to the track coding vector and the track momentum coding vector based on a first feedforward neural network, and calculating a track projection vector contrast loss based on the first projection vector and the second projection vector.
In this step, a first feedforward neural network FFN is first constructed 1 The first feedforward neural network FFN 1 A first projection vector and a second projection vector corresponding to the trajectory encoding vector and the trajectory momentum encoding vector may be determined. The first projection vector may be denoted as Z 1 The second projection vector may be denoted as Z 2 Z is then 1 =FFN 1 (H 1 ),Z 2 =FFN 1 (H 2 )。
Exemplary, first feedforward neural network FFN 1 May include a first fully-connected layer, a Relu-activated function layer, and a second fully-connected layer after the Relu-activated function layer, and FFN 1 The output trajectory projection vector dimension may be 128. Further, calculating a trajectory projection vector contrast loss based on the first projection vector and the second projection vector, comprising: and calculating a trace projection vector contrast loss through an InfoNCE loss function based on the first projection vector and the second projection vector. At the positionIn an embodiment, when the trace projection vector contrast loss is calculated by using the classical InfoNCE loss function, the trace projection vector contrast loss may be specifically L nce_traj =InfoNCE(Z 1 ,Z 2 )。
Step S60: and respectively determining a first track prediction vector and a second track prediction vector corresponding to the track coding vector and the track momentum coding vector based on a second feedforward neural network, and calculating track category contrast loss based on the first track prediction vector and the second track prediction vector.
In this step, a second feedforward neural network FFN is first constructed 2 The second feedforward neural network FFN 2 A first trajectory prediction vector and a second trajectory prediction vector corresponding to the trajectory encoding vector and the trajectory momentum encoding vector may be determined. The first trajectory prediction vector may be denoted as O 1 The second trajectory prediction vector may be denoted as O 2 O is then 1 =FFN 2 (H 1 ),0 2 =FFN 2 (H 2 )。
Exemplary, a second feed forward neural network FFN 2 May also include a first fully-connected layer, a Relu-activated function layer, and a second fully-connected layer connected after the Relu-activated function layer, and FFN 2 The output trajectory prediction vector dimension may be K. Further, calculating a trajectory category contrast loss based on the first trajectory prediction vector and the second trajectory prediction vector, comprising: and calculating track category contrast loss through an InfoNCE loss function based on the first track prediction vector and the second track prediction vector.
In this embodiment, the loss of contrast for the trajectory prediction vector is also calculated using the classical InfoNCE loss function. Specifically, the prediction vector O of all tracks of the current batch is firstly calculated 1 And O 2 Performing row and column transposition to obtain K vectors respectively, wherein the K vectors can be regarded as characteristic vectors of clustering categories of the tracks, and further calculating track category contrast loss by adopting an InfoNCE loss function: l (L) nce_clus =InfoNCE(O 1 T ,O 2 T )。
Step S70: determining total model loss based on the track coding model loss, the KL divergence contrast learning loss, the track projection vector contrast loss and the track category contrast loss, iteratively updating the track coding model and the clustering center based on the total model loss, and clustering the track data to be clustered based on the track coding vector and the clustering center obtained in the last iteration process.
In this step, first, the total model loss is determined, including the track coding model loss, KL divergence contrast learning loss, track projection vector contrast loss, and track class contrast loss.
In one embodiment, the total model loss is specifically:
L=ω 1 L bert2 L kl3 L nce_traj4 L nce_clus
wherein L is bert For track coding model loss, L kl For KL divergence contrast learning loss, L nce_traj For trace projection vector contrast loss, L nce_clus For trace category contrast loss, ω 1 、ω 3 、ω 4 Are all 1, omega 2 2. When the track coding model is the first BERT model, then L bert Self-supervised training loss for BERT in a trajectory coding model.
Further, after the total model loss is determined, back propagation is performed on the total model loss based on the Adam optimizer, and the model parameters of the track encoder and the track clustering center are updated and optimized in a gradient mode. It will be appreciated that each model iteration is based on the first class probability distribution Q 1 The category to which the track belongs in the current iteration process, that is, the category of the track i is the category with the largest probability, for example:
illustratively, the Adam optimizer may include a first optimizer Op1 and a second optimizer Op2, and then the pre-trained trajectory encoding model may be fine-tuned by the first optimizer Op 1; and the trajectory clustering model can be optimized, i.e. the class center is updated, by the second optimizer Op 2. Wherein, the first optimizer Op1 learning rate may be set to 0.0001, and the second optimizer Op2 learning rate may be set to 0.0006, and the number of model iterative training times may be set to 30. It is easy to understand that in the track clustering process, the clustering result of the tracks changes along with the iterative updating of the model, and when the iteration is finished, the accurate track clustering result can be obtained. Therefore, the track data to be clustered can be clustered by adopting the track coding vector and the clustering center obtained in the last iteration process.
Accordingly, the present application also provides a deep trajectory clustering system, which comprises a processor and a memory, wherein the memory stores computer instructions, and the processor is configured to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the system implements the steps of the method according to any one of the embodiments above.
Fig. 2 is a schematic frame structure of a depth trajectory clustering system according to an embodiment of the application, and as shown in fig. 2, the depth trajectory clustering system includes a trajectory data augmentation module, a trajectory encoder module, a trajectory momentum encoder module, a trajectory sample-to-sample contrast learning module, and a trajectory category-to-category contrast learning module. The track data augmentation module utilizes a track preprocessing technology to augment track data to be predicted, namely, based on an original track, a plurality of new tracks with similar space-time movement pattern characteristics to the original track are constructed. The trajectory encoder module encodes the trajectory data using a deep learning model, encoding the variable-length, non-uniform spatio-temporal sequence data into a fixed-length numerical vector. The coding model applied by the track momentum coder module has the same structure as the coding model applied by the track momentum coder module, but different model parameters; and model parameters of the track momentum coding model are not updated according to the gradient, but are updated by utilizing the model parameters of the track momentum coding model.
The track sample-to-sample comparison learning module comprises track classification probability distribution comparison learning which only considers positive samples and track which considers positive and negative samplesAnd the characterization vector contrast learning is two parts. The track vector of a track sample, which is respectively encoded by a track encoding model and a track momentum encoding model, is compared by only considering the class probability distribution comparison learning of the track of the positive sample; the trace characterization vector contrast learning taking the positive and negative samples into consideration is to further input the trace vector into the first feedforward neural network FFN 1 And after the track projection vector is obtained, comparing positive and negative samples based on the track projection vector.
The track inter-category contrast learning module is used for inputting the track representation vector to the second feedforward neural network FFN 2 And obtaining a predictive vector with the size of K, wherein K is the preset track category number. And performing row-column transposition on a matrix formed by the prediction vectors of all tracks to obtain K clustering center vectors, and performing positive and negative sample comparison based on the clustering center vectors.
Through the embodiment, the method, the system and the storage medium for deep track clustering disclosed by the application can be found that the combined optimization of track characterization and track clustering is realized by utilizing a contrast learning technology; based on contrast learning, similar tracks are similar in vector space, dissimilar tracks are far away in vector space, and therefore track clustering effect is effectively improved; in addition, the method and the system construct the contrast learning among the track categories, so that different track categories are separated from each other, and the coupling among the track categories is reduced. In addition, the depth trajectory clustering method, the depth trajectory clustering system and the storage medium disclosed by the application can also mine the fine space-time movement pattern characteristics from the massive unsupervised data, so that the depth trajectory clustering method, the depth trajectory clustering system and the storage medium are suitable for solving the problems of accompanying movement pattern mining and the like.
In addition, the application also discloses a computer readable storage medium, on which a computer program is stored, which program, when being executed by a processor, implements the steps of the method according to any of the embodiments above.
Those of ordinary skill in the art will appreciate that the various illustrative components, systems, and methods described in connection with the embodiments disclosed herein can be implemented as hardware, software, or a combination of both. The particular implementation is hardware or software dependent on the specific application of the solution and the design constraints. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application. When implemented in hardware, it may be, for example, an electronic circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, a plug-in, a function card, or the like. When implemented in software, the elements of the application are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine readable medium or transmitted over transmission media or communication links by a data signal carried in a carrier wave. A "machine-readable medium" may include any medium that can store or transfer information. Examples of machine-readable media include electronic circuitry, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio Frequency (RF) links, and the like. The code segments may be downloaded via computer networks such as the internet, intranets, etc.
It should also be noted that the exemplary embodiments mentioned in this disclosure describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above-described steps, that is, the steps may be performed in the order mentioned in the embodiments, or may be performed in a different order from the order in the embodiments, or several steps may be performed simultaneously.
In this disclosure, features that are described and/or illustrated with respect to one embodiment may be used in the same way or in a similar way in one or more other embodiments and/or in combination with or instead of the features of the other embodiments.
The above description is only of the preferred embodiments of the present application and is not intended to limit the present application, and various modifications and variations can be made to the embodiments of the present application by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. A depth trajectory clustering method, the method comprising:
acquiring track data to be clustered, and performing data augmentation on the track data to be clustered to obtain a first augmentation data set and a second augmentation data set; each piece of track data to be clustered comprises a plurality of track points, and each track point comprises time information and position information;
inputting the first augmentation data set into a trained track coding model to obtain a track coding vector, and inputting the second augmentation data set into a track momentum coding model to obtain a track momentum coding vector;
determining a clustering center based on the track coding vectors, determining first class probability distribution corresponding to each track data in the first augmentation data set based on each track coding vector and the clustering center, calculating first target distribution based on first class probability distribution corresponding to each track data in the first augmentation data set, determining second class probability distribution corresponding to each track data in the second augmentation data set based on each track momentum coding vector and the clustering center, and calculating second target distribution based on second class probability distribution corresponding to each track data in the second augmentation data set;
calculating KL divergence contrast learning loss based on the first class probability distribution, the first target distribution, the second class probability distribution and the second target distribution;
determining a first projection vector and a second projection vector corresponding to the track coding vector and the track momentum coding vector respectively based on a first feedforward neural network, and calculating a track projection vector contrast loss based on the first projection vector and the second projection vector;
determining a first track prediction vector and a second track prediction vector corresponding to the track coding vector and the track momentum coding vector respectively based on a second feedforward neural network, and calculating track category contrast loss based on the first track prediction vector and the second track prediction vector;
determining total model loss based on the track coding model loss, the KL divergence contrast learning loss, the track projection vector contrast loss and the track category contrast loss, iteratively updating the track coding model and the clustering center based on the total model loss, and clustering the track data to be clustered based on the track coding vector and the clustering center obtained in the last iteration process.
2. The depth trajectory clustering method of claim 1, further comprising:
constructing an initial track coding model;
calculating the spatial position prediction loss and the occluded track point time prediction loss of a track coding model based on a cross entropy loss function, and determining the track coding model loss based on the spatial position prediction loss and the occluded track point time prediction loss;
and updating model parameters of the initial track coding model based on the track coding model loss to obtain a trained track coding model.
3. The depth trajectory clustering method of claim 1, wherein the data augmentation comprises:
performing sparsification operation on the track data to be clustered; or (b)
Adding position noise or time noise to the track data to be clustered; or (b)
And carrying out interpolation operation on the track data to be clustered.
4. The depth trajectory clustering method of claim 1, wherein the trajectory coding model and the trajectory momentum coding model are both BERT models;
the parameters of the track momentum coding model are updated based on the parameters of the track momentum coding model, and the parameter calculation formula of the track momentum coding model is as follows:
θ 2 =mθ 2 +(1-m)θ 1
θ 1 、θ 2 model parameters of the track coding model and the track momentum coding model are respectively, and m is a momentum parameter.
5. The depth trajectory clustering method of claim 1, wherein the first target distribution or the second target distribution has a calculation formula:
wherein p is i,j Representing a first target distribution or a second target distribution, q i,j Representing the probability that track i belongs to category j, f j =∑ i q i,j ,q i,j′ Representing the probability that track i belongs to category j', f j′ Representing the sum of probabilities that each track belongs to class j', f j′ =∑ i q i,j′ Where j 'represents any category, j' =1, 2 … N, i represents the particular trajectory currently being calculated, i=1, 2 … M, j represents the particular category currently being calculated, j=1, 2 … N, N represents the total number of categories, and M represents the total number of trajectories.
6. The depth trajectory clustering method according to claim 2, wherein the calculation formula of KL divergence versus learning loss is: l (L) kl =(KL(P 2 ||Q 1 )+KL(P 1 ||Q 2 ) -2); wherein P is 1 Represents a first class probability distribution, Q 1 Representing a first target distribution, P 2 Represent the probability distribution of the second category, Q 2 Representing a second target distribution.
7. The depth trajectory clustering method of claim 1, wherein calculating a trajectory projection vector contrast loss based on the first projection vector and the second projection vector comprises:
calculating a trace projection vector contrast loss through an InfoNCE loss function based on the first projection vector and the second projection vector;
calculating a trajectory category contrast loss based on the first trajectory prediction vector and the second trajectory prediction vector, comprising:
and calculating track category contrast loss through an InfoNCE loss function based on the first track prediction vector and the second track prediction vector.
8. The depth trajectory clustering method of claim 7, wherein the total model loss is:
L=ω 1 L bert2 L kl3 L nce_traj4 L nce_clus
wherein L is bert For track coding model loss, L kl For KL divergence contrast learning loss, L nce_traj For trace projection vector contrast loss, L nce_clus For trace category contrast loss, ω 1 、ω 3 、ω 4 Are all 1, omega 2 2.
9. A deep trajectory clustering system comprising a processor and a memory, wherein said memory has stored therein computer instructions for executing the computer instructions stored in said memory, which system, when executed by the processor, implements the steps of the method according to any one of claims 1 to 8.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 8.
CN202310100602.3A 2023-02-07 2023-02-07 Depth track clustering method, system and storage medium Active CN116186358B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310100602.3A CN116186358B (en) 2023-02-07 2023-02-07 Depth track clustering method, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310100602.3A CN116186358B (en) 2023-02-07 2023-02-07 Depth track clustering method, system and storage medium

Publications (2)

Publication Number Publication Date
CN116186358A CN116186358A (en) 2023-05-30
CN116186358B true CN116186358B (en) 2023-08-15

Family

ID=86443892

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310100602.3A Active CN116186358B (en) 2023-02-07 2023-02-07 Depth track clustering method, system and storage medium

Country Status (1)

Country Link
CN (1) CN116186358B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116956098A (en) * 2023-09-21 2023-10-27 四川吉利学院 Long-tail track prediction method based on perception distributed comparison learning framework
CN117688257B (en) * 2024-01-29 2024-07-05 东北大学 Long-term track prediction method for heterogeneous user behavior mode
CN118332342A (en) * 2024-06-12 2024-07-12 杭州昊清科技有限公司 Industrial flow data augmentation and generation method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113378074A (en) * 2021-06-10 2021-09-10 电子科技大学 Social network user trajectory analysis method based on self-supervision learning
WO2022156333A1 (en) * 2021-01-25 2022-07-28 浙江师范大学 Multi-modal adaptive fusion depth clustering model and method based on auto-encoder
CN115374375A (en) * 2022-10-24 2022-11-22 北京数业专攻科技有限公司 Track clustering method, system and storage medium based on deep learning
CN115544070A (en) * 2022-09-27 2022-12-30 沈阳航空航天大学 Similarity query optimization method based on trajectory representation learning

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022156333A1 (en) * 2021-01-25 2022-07-28 浙江师范大学 Multi-modal adaptive fusion depth clustering model and method based on auto-encoder
CN113378074A (en) * 2021-06-10 2021-09-10 电子科技大学 Social network user trajectory analysis method based on self-supervision learning
CN115544070A (en) * 2022-09-27 2022-12-30 沈阳航空航天大学 Similarity query optimization method based on trajectory representation learning
CN115374375A (en) * 2022-10-24 2022-11-22 北京数业专攻科技有限公司 Track clustering method, system and storage medium based on deep learning

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于自编码器的旅行同伴挖掘;李小昌;陈贝;董启文;陆雪松;;华东师范大学学报(自然科学版)(第05期);全文 *

Also Published As

Publication number Publication date
CN116186358A (en) 2023-05-30

Similar Documents

Publication Publication Date Title
CN116186358B (en) Depth track clustering method, system and storage medium
CN111400620B (en) User trajectory position prediction method based on space-time embedded Self-orientation
CN110889546B (en) Attention mechanism-based traffic flow model training method
CN109086805B (en) Clustering method based on deep neural network and pairwise constraints
CN113792113A (en) Visual language model obtaining and task processing method, device, equipment and medium
CN115374375B (en) Track clustering method, system and storage medium based on deep learning
CN111814844B (en) Intensive video description method based on position coding fusion
Jin et al. Transformer-based map-matching model with limited labeled data using transfer-learning approach
CN109063771A (en) A kind of method, device and equipment finding vehicle suspicious actions
CN115730637A (en) Multi-mode vehicle trajectory prediction model training method and device and trajectory prediction method
CN111027681B (en) Time sequence data processing model training method, data processing method, device and storage medium
CN116611442A (en) Interest point recommendation method based on deep semantic extraction
CN117036760A (en) Multi-view clustering model implementation method based on graph comparison learning
CN116776014B (en) Multi-source track data representation method and device
Zhang et al. Mode recognition of multifunction radars for few-shot learning based on compound alignments
CN108122613B (en) Health prediction method and device based on health prediction model
CN114998731A (en) Intelligent terminal navigation scene perception identification method
CN113360772B (en) Interpretable recommendation model training method and device
CN113128607B (en) Track similarity calculation method
CN111506691B (en) Track matching method and system based on depth matching model
CN114492165A (en) Parameter optimization method and system based on genetic breeding method
CN115512693A (en) Audio recognition method, acoustic model training method, device and storage medium
Gök Semantic and goal-oriented signal processing: semantic extraction
Shen et al. DMM: A Deep Reinforcement Learning based Map Matching Framework for Cellular Data
Reichhuber et al. Evolving Gaussian Mixture Models for Classification.

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant