Terminal space-time trajectory data retrieval method and device, equipment and storage medium
By constructing a spatiotemporal trajectory embedding vector database and a spatiotemporal trajectory retrieval model, the problems of semantic understanding and query flexibility of spatiotemporal trajectory data in existing technologies are solved, and efficient and flexible retrieval of spatiotemporal trajectory data is realized.
Patent Information
- Application Number
- CN202610397945.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-30
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies lack an understanding of the complex and implicit semantics of spatiotemporal trajectory data, and users lack the flexibility to query spatiotemporal trajectory data, making it impossible to use natural language for queries.
By constructing a spatiotemporal trajectory embedding vector database, and using a spatiotemporal trajectory retrieval model and user-input natural language query requests, retrieval is performed to obtain candidate spatiotemporal trajectory embedding vectors. These vectors are then fused with sequence paths, temporal dynamics, and contextual embedding vectors to achieve efficient retrieval of spatiotemporal trajectory data.
It enables complex semantic understanding and flexible querying of spatiotemporal trajectory data, allowing users to directly search using natural language, thus improving the efficiency and accuracy of queries.
Smart Images

Figure CN121935392A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data retrieval technology, specifically relating to a method, apparatus, device, and storage medium for retrieving terminal spatiotemporal trajectory data. Background Technology
[0002] Currently, with the widespread adoption of Global Positioning System (GPS), mobile communications, and Internet of Things (IoT) devices, massive amounts of spatiotemporal trajectory data have been generated globally. This data records the spatiotemporal dynamics of moving objects such as people, vehicles, and goods, providing valuable analytical data for fields such as urban planning, traffic management, logistics optimization, public safety, and business intelligence. However, efficiently extracting deep semantic knowledge from this vast amount of spatiotemporal trajectory data, most of which is unlabeled, remains a significant challenge.
[0003] Existing technologies can calculate the similarity between spatiotemporal trajectory data by constructing spatiotemporal relationship graphs and using pre-defined loss functions. However, they lack the ability to understand the complex and implicit semantics of spatiotemporal trajectory data and cannot comprehend its behavioral aspects. Moreover, existing technologies lack flexibility in user queries of spatiotemporal trajectory data. Users cannot use natural language to query; they must transform ambiguous semantics into precise, feature-based rules or labels that the system can understand. This is extremely difficult or even impossible in practical applications, creating a significant semantic gap between user intent and system capabilities. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for retrieving spatiotemporal trajectory data of a terminal, which solves the problems of lack of understanding of the complex and implicit semantics of spatiotemporal trajectory data and lack of flexibility in user querying of spatiotemporal trajectory data in the prior art.
[0005] Firstly, a method for retrieving terminal spatiotemporal trajectory data is provided, including: Based on the spatiotemporal trajectory retrieval model and the user's input natural language query request, a retrieval is performed in a pre-built spatiotemporal trajectory embedding vector database to obtain k candidate spatiotemporal trajectory embedding vectors, where k is an integer greater than or equal to 1; The spatiotemporal trajectory retrieval model is trained on a tag pair dataset, which includes multiple tag pair data. Each tag pair data includes a spatiotemporal trajectory sample and a text description sample that matches the spatiotemporal trajectory sample.
[0006] Optionally, the terminal spatiotemporal trajectory data retrieval method further includes, before retrieving k candidate spatiotemporal trajectory embedding vectors from a pre-constructed spatiotemporal trajectory embedding vector database based on the spatiotemporal trajectory retrieval model and the user's input natural language query request, the method further includes: The mobile communication signaling data of the terminal is processed to obtain a spatiotemporal trajectory dataset, which includes multiple spatiotemporal trajectory data, each of which includes a timestamp and a geographic grid identifier corresponding to the timestamp. Feature extraction is performed on the spatiotemporal trajectory data to obtain the sequence path embedding vector, time dynamic embedding vector, and context embedding vector corresponding to the spatiotemporal trajectory data; The sequence path embedding vector, the time dynamic embedding vector, and the context embedding vector are fused to obtain a spatiotemporal trajectory embedding vector corresponding to the spatiotemporal trajectory data. The spatiotemporal trajectory embedding vector database is constructed based on the spatiotemporal trajectory embedding vector corresponding to each spatiotemporal trajectory data in the spatiotemporal trajectory dataset.
[0007] Optionally, the method for retrieving terminal spatiotemporal trajectory data includes processing the terminal's mobile communication signaling data to obtain a spatiotemporal trajectory dataset, comprising: Map the initial user identifier in the mobile communication signaling data of the terminal to a user identifier; The mobile communication signaling data is divided into multiple first spatiotemporal trajectory point sequences based on the user's stop point. Each first spatiotemporal trajectory point sequence includes a timestamp, latitude and longitude coordinates corresponding to the timestamp, and the user identifier. Multiple first spatiotemporal trajectory point sequences are smoothed to obtain multiple second spatiotemporal trajectory point sequences; The latitude and longitude coordinates of the spatiotemporal trajectory points in multiple second spatiotemporal trajectory point sequences are mapped to geographic grid identifiers to obtain multiple third spatiotemporal trajectory point sequences; The third spatiotemporal trajectory point sequence is divided according to the user identifier to obtain a spatiotemporal trajectory dataset.
[0008] Optionally, the terminal spatiotemporal trajectory data retrieval method includes, in which, feature extraction is performed on the spatiotemporal trajectory data to obtain a sequence path embedding vector corresponding to the spatiotemporal trajectory data, including: Based on the sequence path encoder, the geographic grid identifiers in the spatiotemporal trajectory data are feature extracted to obtain the sequence path embedding vector corresponding to the spatiotemporal trajectory data; The sequence path encoder includes a bidirectional gated loop unit. Each geographic grid identifier in the spatiotemporal trajectory dataset corresponds to a time step. The bidirectional gated loop unit is used to output the concatenation result of the forward hidden state vector and the reverse hidden state vector corresponding to the geographic grid identifier of the first time step, based on the hidden state corresponding to the geographic grid identifier of the first time step and the geographic grid identifier of the second time step. The sequence path embedding vector includes the concatenation result.
[0009] Optionally, the terminal spatiotemporal trajectory data retrieval method includes, in which, feature extraction is performed on the spatiotemporal trajectory data to obtain a time-dynamic embedding vector corresponding to the spatiotemporal trajectory data, including: Based on the spatiotemporal trajectory dataset, temporal dynamic features are obtained, including time intervals, instantaneous distances, and accelerations. An attention score is obtained by employing a time-interval-aware self-attention mechanism and the aforementioned time-dynamic features; Based on the attention score, a time dynamic embedding vector corresponding to the spatiotemporal trajectory data is obtained.
[0010] Optionally, the terminal spatiotemporal trajectory data retrieval method includes, in which, feature extraction is performed on the spatiotemporal trajectory data to obtain a context embedding vector corresponding to the spatiotemporal trajectory data, including: Obtain contextual features associated with geographic grid identifiers in the spatiotemporal trajectory data. The contextual features include at least one of the following: the density of regions of interest at a preset distance from the location corresponding to the geographic grid identifier; the road network level of the road where the geographic grid identifier is located; and the type of functional zone to which the geographic grid identifier belongs. The input vector is obtained by concatenating the embedding vector corresponding to the geographic grid identifier and the embedding vector corresponding to the context feature. Based on the input vector and the context encoder, a context embedding vector corresponding to the spatiotemporal trajectory data is obtained.
[0011] Optionally, the method for retrieving terminal spatiotemporal trajectory data further includes: A training dataset is generated by applying trajectory enhancement and / or text enhancement strategies to the label pair dataset, wherein the size of the training dataset is larger than that of the label pair dataset. The trajectory enhancement strategy is used to instruct at least one of the following processing methods for spatiotemporal trajectory samples in the label pair dataset: time warping, point discarding, point interpolation, subsequence sampling, and spatial perturbation. The text enhancement strategy is used to instruct at least one of the following processing methods for text description samples in the label pair dataset: back-translation, synonym replacement, and template filling. The initial spatiotemporal trajectory retrieval model is trained based on the training dataset to obtain the spatiotemporal trajectory retrieval model.
[0012] Optionally, in the terminal spatiotemporal trajectory data retrieval method, the spatiotemporal trajectory retrieval model is trained using a multi-objective contrast loss function, which includes a cross-modal contrast loss function, a fine-grained alignment loss function, and a uniformity loss function. The cross-modal contrastive loss function is used to indicate that the training objective of the spatiotemporal trajectory retrieval model is to maximize the cosine similarity between the spatiotemporal trajectory sample and the corresponding text description sample. The fine-grained alignment loss function is used to indicate how to align the temporal dynamic embedding vector output by the temporal dynamic encoder in the spatiotemporal trajectory retrieval model with the embedding vector corresponding to the behavior-related words in the text description sample. The uniformity loss function is used to indicate minimizing the average pairwise Gaussian potential between the spatiotemporal trajectory sample and the corresponding text description sample.
[0013] Optionally, the method for retrieving terminal spatiotemporal trajectory data further includes: Generate the index corresponding to the spatiotemporal trajectory embedding vector in the spatiotemporal trajectory embedding vector database; Based on the spatiotemporal trajectory retrieval model and the user's natural language query request, a search is performed in a pre-built spatiotemporal trajectory embedding vector database to obtain k candidate spatiotemporal trajectory embedding vectors, including: Based on the language encoder in the spatiotemporal trajectory retrieval model and the natural language query request input by the user, the query embedding vector corresponding to the natural language query request is obtained; Based on the index corresponding to the query embedding vector and the spatiotemporal trajectory embedding vector in the pre-built spatiotemporal trajectory embedding vector database, a search is performed in the spatiotemporal trajectory embedding vector database to obtain the k candidate spatiotemporal trajectory embedding vectors with the highest cosine similarity to the query embedding vector.
[0014] Optionally, the method for retrieving terminal spatiotemporal trajectory data further includes: According to the filtering rules, k candidate spatiotemporal trajectory embedding vectors are filtered to obtain n target spatiotemporal trajectory embedding vectors; n is an integer greater than or equal to 1; the filtering rules include at least one of the following: based on the cosine similarity between the candidate spatiotemporal trajectory embedding vectors and the query embedding vectors corresponding to the natural language query request, the k candidate spatiotemporal trajectory embedding vectors are sorted in descending order, and the top n candidate spatiotemporal trajectory embedding vectors are determined as the target spatiotemporal trajectory embedding vectors; the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vectors is within the target time range; the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vectors is within the target geographical region; The spatiotemporal trajectory data corresponding to the n target spatiotemporal trajectory embedding vectors are visualized using geographic information and / or lists.
[0015] Optionally, the method for retrieving terminal spatiotemporal trajectory data further includes: Cluster analysis is performed on the k candidate spatiotemporal trajectory embedding vectors to obtain clusters; Obtain the user behavior pattern corresponding to the cluster.
[0016] Optionally, the method for retrieving terminal spatiotemporal trajectory data further includes: Based on the semantic distance between the candidate spatiotemporal trajectory embedding vector and the query embedding vector corresponding to the natural language query request, anomaly detection is performed on the k candidate spatiotemporal trajectory embedding vectors to obtain abnormal spatiotemporal trajectory embedding vectors.
[0017] Secondly, a device for retrieving terminal spatiotemporal trajectory data is also provided, comprising: The retrieval module is used to retrieve k candidate spatiotemporal trajectory embedding vectors from a pre-built spatiotemporal trajectory embedding vector database based on the spatiotemporal trajectory retrieval model and the natural language query request input by the user, where k is an integer greater than or equal to 1. The spatiotemporal trajectory retrieval model is trained on a tag pair dataset, which includes multiple tag pair data. Each tag pair data includes a spatiotemporal trajectory sample and a text description sample that matches the spatiotemporal trajectory sample.
[0018] Thirdly, a device for retrieving terminal spatiotemporal trajectory data is also provided, comprising: a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the processor executes the program or instructions to implement the terminal spatiotemporal trajectory data retrieval method as described in the first aspect.
[0019] Fourthly, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the terminal spatiotemporal trajectory data retrieval method as described in the first aspect.
[0020] Fifthly, a computer program product is also provided, including computer instructions, which, when executed by a processor, implement the terminal spatiotemporal trajectory data retrieval method as described in the first aspect.
[0021] Compared with existing technologies, embodiments of this application provide a method, apparatus, device, and storage medium for retrieving terminal spatiotemporal trajectory data. Based on a spatiotemporal trajectory retrieval model and a user-input natural language query request, a retrieval is performed in a pre-constructed spatiotemporal trajectory embedding vector database to obtain k candidate spatiotemporal trajectory embedding vectors, where k is an integer greater than or equal to 1. The spatiotemporal trajectory retrieval model is trained on a tag pair dataset, which includes multiple tag pairs. Each tag pair includes a spatiotemporal trajectory sample and a text description sample matching the spatiotemporal trajectory sample. Thus, the user does not need to consider fuzzy semantic conversion and can flexibly input the natural language query request for retrieval. Furthermore, since the spatiotemporal trajectory retrieval model is trained on spatiotemporal trajectory samples and corresponding text descriptions, it can fully understand the complex and implicit semantics of spatiotemporal trajectory data, achieving efficient retrieval of terminal spatiotemporal trajectory data based on the spatiotemporal trajectory retrieval model. Attached Figure Description
[0022] Figure 1 This is a flowchart illustrating the terminal spatiotemporal trajectory data retrieval method described in an embodiment of this application; Figure 2 This is a flowchart illustrating one implementation of the terminal spatiotemporal trajectory data retrieval method described in the embodiments of this application; Figure 3 This is a schematic diagram of the module of the terminal spatiotemporal trajectory data retrieval device described in the embodiments of this application; Figure 4 This is a hardware block diagram of the terminal spatiotemporal trajectory data retrieval device described in the embodiments of this application. Detailed Implementation
[0023] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0024] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and are not used to describe a specified order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same class, not limited in number; for example, a first object can be one or more. Furthermore, in the specification and claims, "and" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0025] See Figure 1 This application provides a method for retrieving terminal spatiotemporal trajectory data, including: Step 101: Based on the spatiotemporal trajectory retrieval model and the natural language query request input by the user, perform a retrieval in the pre-built spatiotemporal trajectory embedding vector database to obtain k candidate spatiotemporal trajectory embedding vectors, where k is an integer greater than or equal to 1. The spatiotemporal trajectory retrieval model is trained on a tag pair dataset, which includes multiple tag pair data. Each tag pair data includes a spatiotemporal trajectory sample and a text description sample that matches the spatiotemporal trajectory sample.
[0026] In this embodiment of the application, the user can flexibly input natural language query requests without having to convert the fuzzy semantic natural language query requests into understandable, precise, feature-based rules or labels.
[0027] Moreover, the spatiotemporal trajectory retrieval model is trained based on the spatiotemporal trajectory samples and the text description samples that match the spatiotemporal trajectory samples. It can map the spatiotemporal trajectory samples and the text description samples to the same semantic space, enabling the understanding of the complex and implicit semantics of spatiotemporal trajectory data.
[0028] In one implementation, optionally, before step 101 above, such as Figure 2 As shown, the method further includes: The mobile communication signaling data of the terminal is processed to obtain a spatiotemporal trajectory dataset, which includes multiple spatiotemporal trajectory data, each of which includes a timestamp and a geographic grid identifier corresponding to the timestamp. Feature extraction is performed on the spatiotemporal trajectory data to obtain the sequence path embedding vector, time dynamic embedding vector, and context embedding vector corresponding to the spatiotemporal trajectory data; The sequence path embedding vector, the time dynamic embedding vector, and the context embedding vector are fused to obtain a spatiotemporal trajectory embedding vector corresponding to the spatiotemporal trajectory data. The spatiotemporal trajectory embedding vector database is constructed based on the spatiotemporal trajectory embedding vector corresponding to each spatiotemporal trajectory data in the spatiotemporal trajectory dataset.
[0029] In this embodiment of the application, the spatiotemporal trajectory dataset is obtained by preprocessing the mobile communication signaling data of the terminal. The preprocessing includes, but is not limited to, at least one of the following: data desensitization and user ID (UID) mapping; data reconstruction; data denoising and smoothing; geographic gridding and sequence generation.
[0030] The spatiotemporal trajectory dataset can be represented as... ,in, This represents a spatiotemporal trajectory data point within the aforementioned spatiotemporal trajectory dataset. Since each of the aforementioned spatiotemporal trajectory data includes a timestamp and a geographic grid identifier corresponding to the timestamp, the spatiotemporal trajectory dataset can be understood as a sequence of geographic grid identifiers and timestamps.
[0031] For each spatiotemporal trajectory data in the spatiotemporal trajectory dataset, hierarchical feature extraction is performed to obtain the sequence path embedding vector, time dynamic embedding vector, and context embedding vector corresponding to the spatiotemporal trajectory data, respectively. The sequence path embedding vector is represented as follows: , used to represent the temporal dependency and chronological order of the spatiotemporal trajectory data; the time dynamic embedding vector is represented as , used to represent the temporal dynamic features of the spatiotemporal trajectory data, is obtained using a cross-attention mechanism; the context embedding vector is represented as , used to represent the spatial shape and geographic environment semantics of the spatiotemporal trajectory data.
[0032] Each of the aforementioned spatiotemporal trajectory data can be represented by an embedding vector, which can be called a spatiotemporal trajectory embedding vector. The spatiotemporal trajectory embedding vector is obtained by fusing the sequence path embedding vector, the time dynamic embedding vector, and the context embedding vector corresponding to the spatiotemporal trajectory data, and is expressed by the following formula (1): (1); in, This represents the spatiotemporal trajectory embedding vector; This represents a fusion operation that can use a cross-attention mechanism.
[0033] A model based on cross-attention mechanism is used to fuse the sequence path embedding vector, the temporal dynamic embedding vector, and the context embedding vector. As shown in formulas (2) to (4) below, this model uses... As a query vector, and The concatenation of these vectors serves as both a key vector and a value vector, enabling the model to learn how to selectively extract important information from the sequence path embedding vector and the temporal dynamic embedding vector based on the contextual embedding vector of the spatiotemporal trajectory data. (2); (3); (4); in, Represents the query vector; Represents the key vector; Represents a value vector.
[0034] Next, the spatiotemporal trajectory embedding vector of the model fusion output based on the cross-attention mechanism is obtained using the following formula (5): (5); in, This represents the dimension of the key vector.
[0035] All spatiotemporal trajectory embedding vectors corresponding to the spatiotemporal trajectory dataset are stored in a preset vector database (such as FAISS, Milvus, or Pinecone) to construct the spatiotemporal trajectory embedding vector database.
[0036] In one implementation method, optionally, the mobile communication signaling data of the terminal is processed to obtain a spatiotemporal trajectory dataset, including: Step (a): Map the initial user identifier in the mobile communication signaling data of the terminal to a user identifier; Step (b): Divide the mobile communication signaling data into multiple first spatiotemporal trajectory point sequences according to the user's dwell point. Each first spatiotemporal trajectory point sequence includes a timestamp, latitude and longitude coordinates corresponding to the timestamp, and the user identifier. Step (c): Smooth the multiple first spatiotemporal trajectory point sequences to obtain multiple second spatiotemporal trajectory point sequences; Step (d) involves mapping the latitude and longitude coordinates of the spatiotemporal trajectory points in the multiple second spatiotemporal trajectory point sequences to geographic grid identifiers to obtain multiple third spatiotemporal trajectory point sequences; Step (e): Divide the multiple third spatiotemporal trajectory point sequences according to the user identifier to obtain a spatiotemporal trajectory dataset.
[0037] Specifically, step (a) involves data anonymization and UID mapping of the terminal's mobile communication signaling data. Since the initial user identifier in the terminal's mobile communication signaling data is encrypted, in step (a), salted hashing can be used to map the initial user identifier to an irreversible, anonymous UID. The initial user identifier includes, but is not limited to, the International Mobile Subscriber Identity (IMSI). In step (a), a secure mapping table is also established and maintained to ensure that the same terminal corresponds to the same UID across different time periods.
[0038] Step (b) involves reconstructing the mobile communication signaling data of the terminal. Since the mobile communication signaling data of the terminal under the same base station has continuous recording duration and spatial proximity, in step (b), a spatiotemporal clustering algorithm, such as ST-DBSCAN (a variant of Density-Based Spatial Clustering of Applications with Noise, DBSCAN), can be first used to identify user dwell points. Then, the continuously recorded mobile communication signaling data is divided according to the user dwell points to obtain multiple first spatiotemporal trajectory point sequences. It is understood that each first spatiotemporal trajectory point sequence is an independent and meaningful trajectory segment, for example, a complete mobile trajectory segment from home to the office. Each first spatiotemporal trajectory point sequence includes multiple spatiotemporal trajectory points, and each spatiotemporal trajectory point includes a timestamp, the latitude and longitude coordinates corresponding to the timestamp, and the UID.
[0039] Step (c) involves denoising and smoothing the mobile communication signaling data of the terminal. To address the ping-pong effect that may arise from base station positioning—where mobile communication signaling data jumps back and forth between multiple base stations in overlapping coverage areas—step (c) employs a Kalman filter or moving average method to smooth the multiple first spatiotemporal trajectory point sequences, correcting abnormal drift points and generating multiple second spatiotemporal trajectory point sequences that better reflect actual physical movement. It is understood that each second spatiotemporal trajectory point sequence also includes multiple spatiotemporal trajectory points, each including a timestamp, the corresponding latitude and longitude coordinates, and the UID.
[0040] Step (d) involves geographic gridding and sequence generation of the mobile communication signaling data of the terminal. In step (d), a hierarchical geographic grid system (such as Geohash) is introduced to map the latitude and longitude coordinates (lon, lat) of the spatiotemporal trajectory points in the multiple second spatiotemporal trajectory point sequences obtained in step (c) to a hierarchical grid identifier (Grid ID, GID). Here, GID can be referred to as the geographic grid identifier, resulting in multiple third spatiotemporal trajectory sequences. It is understood that each third spatiotemporal trajectory point sequence includes multiple spatiotemporal trajectory points, and each spatiotemporal trajectory point includes a timestamp, a geographic grid identifier corresponding to the timestamp, and the UID. Each third spatiotemporal trajectory point sequence is represented as a triple consisting of UID, GID, and timestamp, thus forming a massive spatiotemporal triple dataset. It should be noted that step (d) can discretize the spatiotemporal trajectory points in the multiple third spatiotemporal trajectory point sequences that conform to continuous space, reducing data sparsity.
[0041] Finally, in step (e), the multiple third spatiotemporal trajectory point sequences are divided based on the UIDs in the multiple third spatiotemporal trajectory point sequences to form a spatiotemporal trajectory dataset. The spatiotemporal trajectory dataset includes multiple spatiotemporal trajectory data, and each spatiotemporal trajectory data includes a timestamp and a geographic grid identifier corresponding to the timestamp. It should be noted that, while dividing the multiple third spatiotemporal trajectory point sequences based on the UIDs in the third spatiotemporal trajectory point sequences, the multiple third spatiotemporal trajectory point sequences can also be sorted in ascending order according to the timestamps in the third spatiotemporal trajectory point sequences to form the spatiotemporal trajectory dataset.
[0042] In one implementation, optionally, feature extraction is performed on the spatiotemporal trajectory data to obtain a sequence path embedding vector corresponding to the spatiotemporal trajectory data, including: Based on the sequence path encoder, the geographic grid identifiers in the spatiotemporal trajectory data are feature extracted to obtain the sequence path embedding vector corresponding to the spatiotemporal trajectory data; The sequence path encoder includes a bidirectional gated loop unit. Each geographic grid identifier in the spatiotemporal trajectory dataset corresponds to a time step. The bidirectional gated loop unit is used to output the concatenation result of the forward hidden state vector and the reverse hidden state vector corresponding to the geographic grid identifier of the first time step, based on the hidden state vector corresponding to the geographic grid identifier of the first time step and the geographic grid identifier of the second time step. The sequence path embedding vector includes the concatenation result.
[0043] The second time step is the time step preceding the first time step.
[0044] In this embodiment of the application, a sequence path encoder is used to capture the temporal dependency and sequence of spatiotemporal trajectory data.
[0045] The sequence path encoder includes a bidirectional gated recurrent unit (Bi-GRU) that takes the geographic grid identifier sequence from the spatiotemporal trajectory dataset as input. The Bi-GRU can learn the evolution patterns of the spatiotemporal trajectory data simultaneously from both forward and reverse directions, outputting a sequence path embedding vector. For example, it can understand that moving from A to B and then to C is a different behavioral pattern than moving from C to B and then to A.
[0046] Specifically, the bidirectional gated loop unit includes a reset gate and an update gate as shown in formulas (6) and (7), and is based on the vector output by the reset gate. and the vector output by the update gate The candidate hidden state vector corresponding to the geographic grid identifier at the first time step is obtained as shown in formulas (8) and (9). and hidden state vector : (6); (7); (8); (9); in, The geographic grid identifier represents the first time step; This represents the hidden state vector corresponding to the geographic grid identifier at the second time step; This indicates element-wise multiplication.
[0047] Next, based on the candidate hidden state vector corresponding to the geographic grid identifier in the first time step... and hidden state vector Obtain the positive hidden state vector corresponding to the geographic grid identifier at the first time step. With the reverse hidden state vector and the forward hidden state vector With the reverse hidden state vector The concatenation result yields the sequence path embedding vector. .
[0048] In one implementation, optionally, feature extraction is performed on the spatiotemporal trajectory data to obtain a time-dynamic embedding vector corresponding to the spatiotemporal trajectory data, including: Based on the spatiotemporal trajectory dataset, temporal dynamic features are obtained, including time intervals, instantaneous distances, and accelerations. An attention score is obtained by employing a time-interval-aware self-attention mechanism and the aforementioned time-dynamic features; Based on the attention score, a time dynamic embedding vector corresponding to the spatiotemporal trajectory data is obtained.
[0049] In this embodiment of the application, for the spatiotemporal trajectory dataset, the time interval, instantaneous distance, and acceleration are calculated point by point. A time-interval-aware self-attention mechanism is employed, as shown in the following formula (10), where the time dynamic features are used as a bias term or an additional input channel and incorporated into the calculation of the attention score to obtain the attention score: (10); in, Represents the query vector; Represents the key vector; Represents a value vector; Indicates the dimension of the key vector; This indicates the bias term.
[0050] Furthermore, based on the attention score, the temporal dynamic embedding vector corresponding to the spatiotemporal trajectory data is obtained. .
[0051] It should be noted that, since the temporal dynamic embedding vector fusion attention score in the embodiments of this application uses temporal dynamic features as a bias term or an additional input channel, it is able to focus on time trajectory data of distance changes or long-term stays.
[0052] In one implementation, optionally, feature extraction is performed on the spatiotemporal trajectory data to obtain a context embedding vector corresponding to the spatiotemporal trajectory data, including: Obtain contextual features associated with geographic grid identifiers in the spatiotemporal trajectory data. The contextual features include at least one of the following: the density of regions of interest at a preset distance from the location corresponding to the geographic grid identifier; the road network level of the road where the geographic grid identifier is located; and the type of functional zone to which the geographic grid identifier belongs. The input vector is obtained by concatenating the embedding vector corresponding to the geographic grid identifier and the embedding vector corresponding to the context feature. Based on the input vector and the context encoder, a context embedding vector corresponding to the spatiotemporal trajectory data is obtained.
[0053] In this embodiment of the application, the context embedding vector is represented as The context encoder is used to represent the spatial shape and geographic semantics of the spatiotemporal trajectory data, and is unaffected by geometric transformations such as translation or rotation. The context encoder employs a self-attention mechanism layer based on the Transformer model architecture. Unlike sequence models such as Bi-GRU, the self-attention mechanism can process all spatiotemporal trajectory data in the spatiotemporal trajectory dataset in parallel. By calculating the attention weight between any two spatiotemporal trajectory data i and j in the dataset, it directly captures long-distance dependencies. This allows the context encoder to transcend local order and perceive the overall spatial geometry of the spatiotemporal trajectory dataset (such as U-shaped, S-shaped, or circular routes), thereby achieving robustness to geometric transformations such as translation and rotation.
[0054] It should be noted that, in order for the context encoder to fully understand the environment in which the spatiotemporal trajectory data is located, each spatiotemporal trajectory data in the spatiotemporal trajectory dataset needs to be enhanced before entering the context encoder. This enhancement process includes, but is not limited to, at least one of the following: feature association; context embedding; and constructing an input vector.
[0055] Specifically, feature association includes: obtaining contextual features associated with geographic grid identifiers in the spatiotemporal trajectory data from an external geographic information system. The contextual features include, but are not limited to, at least one of the following: the density of regions of interest at a preset distance from the location corresponding to the geographic grid identifier; the road network level of the road where the geographic grid identifier is located (e.g., the road network level is expressway, arterial road, or branch road); and the type of functional area to which the geographic grid identifier belongs (e.g., residential area, commercial area, or industrial area).
[0056] Context embedding involves mapping the embedding vectors corresponding to discrete context features into a dense feature vector through corresponding, independent embedding layers.
[0057] Input vector construction includes: embedding the vector corresponding to the geographic grid identifier. ( This indicates that the first [item] in the spatiotemporal trajectory embedding dataset is [the [item]]. The geographic grid identifier of each spatiotemporal trajectory data point is concatenated with the embedding vector corresponding to the context feature to form an enhanced, more information-rich input vector. As shown in the following formula (11): (11); in, An embedding vector representing the density of regions of interest located at a preset distance from the location corresponding to the geographic grid identifier; This represents the embedding vector corresponding to the road network level of the road where the geographic grid identifier is located; The embedding vector represents the type of the functional area to which the geographic grid identifier belongs.
[0058] The input vector The context encoder is input, and the context encoder processes the data through a self-attention mechanism to obtain a context embedding vector corresponding to the spatiotemporal trajectory data.
[0059] One possible implementation method is, for example... Figure 2 As shown, the method further includes: A training dataset is generated by applying trajectory enhancement and / or text enhancement strategies to the label pair dataset, wherein the size of the training dataset is larger than that of the label pair dataset. The trajectory enhancement strategy is used to instruct at least one of the following processing methods for spatiotemporal trajectory samples in the label pair dataset: time warping, point discarding, point interpolation, subsequence sampling, and spatial perturbation. The text enhancement strategy is used to instruct at least one of the following processing methods for text description samples in the label pair dataset: back-translation, synonym replacement, and template filling. The initial spatiotemporal trajectory retrieval model is trained based on the training dataset to obtain the spatiotemporal trajectory retrieval model.
[0060] It should be noted that the amount of data in the label pair dataset is less than the first quantity, which is used to indicate that the amount of data in the label pair dataset is small, for example, the first quantity is 500. Each label pair is essentially data that matches spatiotemporal trajectory samples with text description samples.
[0061] For example, the spatiotemporal trajectory sample is: a spatiotemporal trajectory data belonging to a food delivery driver, who drives at low speed for a long time in a large residential area during the weekday lunch rush hour, repeatedly passing through the same road segment, making frequent turns and making short stops; the text description sample is: the trajectory of a delivery driver who seems to be lost or inefficiently detouring in the residential area.
[0062] In this embodiment of the application, the label pair dataset is first applied to a data augmentation strategy, including a trajectory augmentation strategy and / or a text augmentation strategy, to generate a training dataset. The amount of data in the training dataset is greater than a second quantity, which is greater than the first quantity mentioned above. The second quantity is used to indicate that the amount of data in the training dataset is massive and that the amount of data in the training dataset is much greater than the amount of data in the label pair dataset. For example, the second quantity is 50,000.
[0063] Specifically, the trajectory enhancement strategy includes, but is not limited to, at least one of the following: Time Warping: The spatiotemporal trajectory sample is nonlinearly warped to simulate the changes in speed in the real world; Point Dropping / Interpolation Processing: Randomly remove a portion of the spatiotemporal trajectory samples from the labeled dataset to simulate the loss of Global Positioning System (GPS) signals; Point interpolation processing: Linear interpolation is performed between two spatiotemporal trajectory samples in the label pair dataset to increase data density; Sub-sequence sampling: Multiple shorter sub-spatiotemporal trajectory samples are randomly sampled from a long spatiotemporal trajectory sample. Each sub-spatiotemporal trajectory sample inherits the text description sample of the parent spatiotemporal trajectory sample. Spatial jittering: A small amount of Gaussian noise is added to the coordinates of the trajectory points of the spatiotemporal trajectory sample to simulate positioning error.
[0064] The text enhancement strategies include, but are not limited to, at least one of the following: Back-translation processing: Translate the Chinese text description sample into English, then translate it back into Chinese, and use the differences in expression between the two languages to generate new text description samples; Synonym Replacement Processing: Randomly replace keywords in the text description sample, for example, replace "delivery driver" with "food delivery person", and "congestion" with "traffic jam"; Template Filling Process: Design templates such as "a [profession]'s [behavioral pattern] trajectory in [time period] and [location type]", and generate a large number of text description samples by filling in different elements.
[0065] Therefore, this application proposes a few-shot learning paradigm based on data augmentation. Data augmentation strategies are applied to a small number of labeled datasets to obtain a massive training dataset, which is then used to train a well-trained spatiotemporal trajectory retrieval model.
[0066] In one embodiment, optionally, the spatiotemporal trajectory retrieval model is trained using a multi-objective contrast loss function, which includes a cross-modal contrast loss function, a fine-grained alignment loss function, and a uniformity loss function. The cross-modal contrastive loss function is used to indicate that the training objective of the spatiotemporal trajectory retrieval model is to maximize the cosine similarity between the spatiotemporal trajectory sample and the corresponding text description sample. The fine-grained alignment loss function is used to indicate how to align the temporal dynamic embedding vector output by the temporal dynamic encoder in the spatiotemporal trajectory retrieval model with the embedding vector corresponding to the behavior-related words in the text description sample. The uniformity loss function is used to indicate minimizing the average pairwise Gaussian potential between the spatiotemporal trajectory sample and the corresponding text description sample.
[0067] In this embodiment, the spatiotemporal trajectory retrieval model is trained using a multi-target contrastive loss function to optimize the quality of the embedding space. As shown in the following formula (12): (12); in, and This represents the weighting coefficient.
[0068] This represents the cross-modal contrastive loss function, for a dataset containing N spatiotemporal trajectory samples. With text description samples The matching training dataset is used to indicate that the training objective of the spatiotemporal trajectory retrieval model is to maximize the cosine similarity between N correctly matched spatiotemporal trajectory samples and text description samples, while minimizing... The cosine similarity between the mismatched spatiotemporal trajectory samples and the text description samples. The cross-modal contrast loss function includes a contrast term from the text description sample to the spatiotemporal trajectory sample, and a contrast term from the spatiotemporal trajectory sample to the text description sample, to achieve cross-modal contrast, as shown in the following formula (13): (13);
[0069] in, and Represents the first in the training dataset The first spatiotemporal trajectory sample and the first One text description sample; and Represents the first in the training dataset The first spatiotemporal trajectory sample and the first One text description sample; The cosine similarity function; This is a temperature coefficient used to adjust the smoothness of the distribution of a normalized indicator function (such as Softmax).
[0070] It should be noted that a correct match indicates that the spatiotemporal trajectory sample corresponds to the text description sample; an incorrect match indicates that the spatiotemporal trajectory sample does not correspond to the text description sample. A mismatched spatiotemporal trajectory sample and text description sample include, for a spatiotemporal trajectory sample, a text description sample that does not correspond to that spatiotemporal trajectory sample; and for a text description sample, a spatiotemporal trajectory sample that does not correspond to that text description sample.
[0071] This represents the fine-grained alignment loss function, used to indicate the temporal dynamic embedding vector output by the temporal dynamic encoder in the spatiotemporal trajectory retrieval model. Embedded vectors corresponding to behavior-related words (such as wandering, congestion, high-speed driving) in the text description sample Alignment is performed, and the context embedding vector output by the context encoder in the spatiotemporal trajectory retrieval model is used. Embedding vectors corresponding to spatial morphology-related words (such as U-turns and circular routes) in the text description samples Alignment is performed. The fine-grained alignment loss function is shown in the following formula (14): (14).
[0072] The uniformity loss function is used to minimize the average pairwise Gaussian potential between the spatiotemporal trajectory sample and the corresponding text description sample. This ensures that the embedding vectors corresponding to the spatiotemporal trajectory sample and the text description sample are distributed as uniformly as possible on the unit hypersphere. This prevents the spatiotemporal trajectory retrieval model from mapping the embedding vectors corresponding to the spatiotemporal trajectory sample and the text description sample to a small region of the embedding space, which would cause the model to collapse. It also maximizes the information capacity and expressive power of the embedding space.
[0073] Therefore, by training the initial spatiotemporal trajectory retrieval model using the training dataset and the multi-objective contrastive loss function, a well-trained spatiotemporal trajectory retrieval model can be obtained that can map spatiotemporal trajectory data and natural language descriptions to the same high-quality semantic space.
[0074] One possible implementation method is, for example... Figure 2 As shown, the method further includes: Generate the index corresponding to the spatiotemporal trajectory embedding vector in the spatiotemporal trajectory embedding vector database; Based on the spatiotemporal trajectory retrieval model and the user's natural language query request, a search is performed in a pre-built spatiotemporal trajectory embedding vector database to obtain k candidate spatiotemporal trajectory embedding vectors, including: Based on the language encoder in the spatiotemporal trajectory retrieval model and the natural language query request input by the user, the query embedding vector corresponding to the natural language query request is obtained; Based on the query embedding vector and the index corresponding to the spatiotemporal trajectory embedding vector in the pre-built spatiotemporal trajectory embedding vector database, a search is performed in the spatiotemporal trajectory embedding vector database to obtain the k candidate spatiotemporal trajectory embedding vectors with the highest cosine similarity to the query embedding vector.
[0075] It should be noted that after constructing the spatiotemporal trajectory embedding vector database, this embodiment generates an index corresponding to the spatiotemporal trajectory embedding vectors in the database. Optionally, this embodiment utilizes an Approximate Nearest Neighbor (ANN) algorithm, such as HNSW (Hierarchical Navigable Small World), to construct an efficient similarity search index. HNSW can achieve fast sublinear time retrieval in massive spatiotemporal trajectory embedding vectors, improving the guarantee for real-time queries for candidate users.
[0076] Next, based on the user's input natural language query request, the pre-established spatiotemporal trajectory embedding vector database, and the trained spatiotemporal trajectory retrieval model, the online inference and analysis phase is executed. Specifically, the user can input a natural language query request (such as finding commuter vehicles heading to the shopping district on a weekend afternoon) through an interface. The language encoder in the spatiotemporal trajectory retrieval model encodes the user's input natural language query request into a single vector, obtaining the query embedding vector corresponding to the natural language query request. .
[0077] Using the query embedding vector as a query instruction, the k-Nearest Neighbor (KNN) algorithm is executed in the pre-built spatiotemporal trajectory embedding vector database. By utilizing the index of the spatiotemporal trajectory embedding vector, this embodiment of the application can find the k candidate spatiotemporal trajectory embedding vectors with the highest cosine similarity to the query embedding vector from a massive amount of spatiotemporal trajectory embedding vectors within milliseconds.
[0078] In one embodiment, optionally, the method further includes: According to the filtering rules, k candidate spatiotemporal trajectory embedding vectors are filtered to obtain n target spatiotemporal trajectory embedding vectors; n is an integer greater than or equal to 1; the filtering rules include at least one of the following: based on the cosine similarity between the candidate spatiotemporal trajectory embedding vectors and the query embedding vectors corresponding to the natural language query request, the k candidate spatiotemporal trajectory embedding vectors are sorted in descending order, and the top n candidate spatiotemporal trajectory embedding vectors are determined as the target spatiotemporal trajectory embedding vectors; the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vectors is within the target time range; the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vectors is within the target geographical region; The spatiotemporal trajectory data corresponding to the n target spatiotemporal trajectory embedding vectors are visualized using geographic information and / or lists.
[0079] In this embodiment of the application, optionally, k candidate spatiotemporal trajectory embedding vectors are filtered according to the filtering rules to obtain n target spatiotemporal trajectory embedding vectors, where n≤k. The filtering rules include, but are not limited to, at least one of the following: sorting the k candidate spatiotemporal trajectory embedding vectors in descending order of cosine similarity between the candidate spatiotemporal trajectory embedding vectors and the query embedding vectors corresponding to the natural language query request, and determining the top n candidate spatiotemporal trajectory embedding vectors as the target spatiotemporal trajectory embedding vectors; the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vectors is within the target time range; the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vectors is within the target geographical region.
[0080] Optionally, based on the cosine similarity between the candidate spatiotemporal trajectory embedding vectors and the query embedding vectors corresponding to the natural language query request, the k candidate spatiotemporal trajectory embedding vectors are sorted in descending order to obtain the sorted k candidate spatiotemporal trajectory embedding vectors; the sorted k candidate spatiotemporal trajectory embedding vectors are then filtered according to filtering rules to obtain n target spatiotemporal trajectory embedding vectors, wherein the filtering rules include, but are not limited to, at least one of the following: the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vector is within the target time range; the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vector is within the target geographical region.
[0081] It should be noted that the target time range and target geographical area mentioned above can be determined based on information selected by the user or information entered by the user, and are not restricted here.
[0082] This application embodiment can visualize n spatiotemporal trajectory data corresponding to n target spatiotemporal trajectory embedding vectors through geographic information visualization. Specifically, n spatiotemporal trajectory data are drawn on the geographic information using different colors or animation effects, and key points (such as highway sections and user stop points) in the n spatiotemporal trajectory data are drawn using a highlighting method.
[0083] This application embodiment can also visualize n spatiotemporal trajectory data corresponding to n target spatiotemporal trajectory embedding vectors through a list. Specifically, the UID of the n spatiotemporal trajectory data and the cosine similarity between them and the query embedding vector are displayed in list form, and tags or summaries (such as suspected commuting or shopping behavior) can be generated based on the target spatiotemporal trajectory embedding vectors.
[0084] In one implementation, optionally, after step 101 above, as follows: Figure 2 As shown, the method further includes: Cluster analysis is performed on the k candidate spatiotemporal trajectory embedding vectors to obtain clusters; Obtain the user behavior pattern corresponding to the cluster.
[0085] In this embodiment, cluster analysis can be performed on all k candidate spatiotemporal trajectory embedding vectors of a specific user group (such as all users in a certain region) to obtain clusters. Optionally, K-means clustering algorithm or DBSCAN (Density-Based Spatial Clustering of Applications with Noise) clustering algorithm can be used to perform cluster analysis on the k candidate spatiotemporal trajectory embedding vectors to obtain clusters.
[0086] It is understandable that the resulting clusters correspond to different user behavior patterns. For example, it can automatically discover groups of commuters during morning and evening rush hours, groups of weekend shoppers, and groups of ride-hailing drivers active late at night, thereby forming accurate user profiles.
[0087] In one embodiment, optionally, after step 101 above, the method further includes: Based on the semantic distance between the candidate spatiotemporal trajectory embedding vector and the query embedding vector corresponding to the natural language query request, anomaly detection is performed on the k candidate spatiotemporal trajectory embedding vectors to obtain abnormal spatiotemporal trajectory embedding vectors.
[0088] In this embodiment of the application, if the natural language query request conforms to a normal or expected behavior pattern, such as an efficient freight route from a warehouse to a distribution station, anomaly detection can be performed on the k candidate spatiotemporal trajectory embedding vectors based on the semantic distance between the candidate spatiotemporal trajectory embedding vectors and the query embedding vectors corresponding to the natural language query request, thereby obtaining the abnormal spatiotemporal trajectory embedding vectors among the k candidate spatiotemporal trajectory embedding vectors.
[0089] The greater the semantic distance between the candidate spatiotemporal trajectory embedding vector and the query embedding vector, the greater the semantic deviation of the candidate spatiotemporal trajectory embedding vector from the query embedding vector, i.e., the further it deviates from the normal or expected behavioral pattern. Here, a detection threshold can be set. If the semantic distance between the candidate spatiotemporal trajectory embedding vector and the query embedding vector is greater than this detection threshold, the candidate spatiotemporal trajectory embedding vector is determined to be an abnormal spatiotemporal trajectory embedding vector, such as abnormal detours or unexpected long-term stops along the way.
[0090] In summary, the method for retrieving and analyzing spatiotemporal trajectory data using terminal spatiotemporal data as described in this application is essentially a method for retrieval and analysis of spatiotemporal trajectory data based on cross-modal semantic alignment. Instead of allowing users to query spatiotemporal trajectory data through fixed rules or tags, it first uses a specialized, hierarchical encoder to deeply represent the path dependency, temporal dynamics, and global morphology of each spatiotemporal trajectory data, forming an information-rich spatiotemporal trajectory embedding vector. Based on this, cross-modal contrastive learning is used to align the semantic space of the spatiotemporal trajectory vector with that of the query embedding vector. This constructs a unified semantic space, allowing users to directly retrieve data using natural language queries. Through efficient vector similarity retrieval, the spatiotemporal trajectory data that best matches the query embedding vector can be found, fundamentally solving the problems of rigid query methods and the inability to understand complex and implicit semantics in existing technologies.
[0091] Furthermore, this application proposes a few-shot learning paradigm based on data augmentation. It generates a massive and diverse training dataset by applying trajectory augmentation and / or text augmentation strategies to a very small number of labeled datasets. This strategy of learning from a small sample allows the spatiotemporal trajectory retrieval model to grasp the abstract correspondence between trajectory physical features and high-level human semantic concepts, rather than simply memorizing specific patterns. Ultimately, it can understand and process entirely new semantic queries never seen in training, achieving true zero-shot generalization and ensuring the long-term effectiveness and scalability of the framework in the face of endless and ever-changing analytical needs in the real world. This represents a paradigm shift from similarity calculation to semantic understanding. By constructing a unified semantic space, it can directly handle natural language queries such as finding delivery vehicles that linger in a specific business district, elevating the analysis level from the data layer to the behavioral intent layer. When handling such complex semantic queries, it achieves an order-of-magnitude improvement in recall and precision.
[0092] Furthermore, in this embodiment, users can define entirely new, temporary user groups for queries through natural language query requests without any model retraining, such as identifying user groups with similar weekend leisure travel patterns. This flexibility can adapt to endless ad-hoc analysis needs, extending application scenarios from fixed classification tasks to dynamic exploratory analysis. Moreover, this embodiment can handle natural language query requests that are completely independent of social or communication information, such as discovering abnormal driving patterns in logistics fleets that may cause delays or locating areas in a city where ambulance response times may be too long. This makes the application scope of this embodiment far exceed social network analysis, and it can be widely applied to urban planning, traffic management, logistics optimization, and many other fields.
[0093] See Figure 3 This application also provides a device for retrieving terminal spatiotemporal trajectory data, comprising: The retrieval module 301 is used to retrieve k candidate spatiotemporal trajectory embedding vectors from a pre-built spatiotemporal trajectory embedding vector database based on the spatiotemporal trajectory retrieval model and the natural language query request input by the user, where k is an integer greater than or equal to 1. The spatiotemporal trajectory retrieval model is trained on a tag pair dataset, which includes multiple tag pair data. Each tag pair data includes a spatiotemporal trajectory sample and a text description sample that matches the spatiotemporal trajectory sample.
[0094] Optionally, the terminal spatiotemporal trajectory data retrieval device further includes: The processing module is used to process the mobile communication signaling data of the terminal to obtain a spatiotemporal trajectory dataset. The spatiotemporal trajectory dataset includes multiple spatiotemporal trajectory data, and each spatiotemporal trajectory data includes a timestamp and a geographic grid identifier corresponding to the timestamp. The extraction module is used to extract features from the spatiotemporal trajectory data to obtain the sequence path embedding vector, time dynamic embedding vector, and context embedding vector corresponding to the spatiotemporal trajectory data. The fusion module is used to fuse the sequence path embedding vector, the time dynamic embedding vector, and the context embedding vector to obtain a spatiotemporal trajectory embedding vector corresponding to the spatiotemporal trajectory data. The construction module is used to construct the spatiotemporal trajectory embedding vector database based on the spatiotemporal trajectory embedding vector corresponding to each spatiotemporal trajectory data in the spatiotemporal trajectory dataset.
[0095] Optionally, in the terminal spatiotemporal trajectory data retrieval device, the processing module is specifically used for: Map the initial user identifier in the mobile communication signaling data of the terminal to a user identifier; The mobile communication signaling data is divided into multiple first spatiotemporal trajectory point sequences based on the user's stop point. Each first spatiotemporal trajectory point sequence includes a timestamp, latitude and longitude coordinates corresponding to the timestamp, and the user identifier. Multiple first spatiotemporal trajectory point sequences are smoothed to obtain multiple second spatiotemporal trajectory point sequences; The latitude and longitude coordinates of the spatiotemporal trajectory points in multiple second spatiotemporal trajectory point sequences are mapped to geographic grid identifiers to obtain multiple third spatiotemporal trajectory point sequences; The multiple third spatiotemporal trajectory point sequences are divided according to the user identifier to obtain a spatiotemporal trajectory dataset.
[0096] Optionally, in the terminal spatiotemporal trajectory data retrieval device, the extraction module is specifically used for: Based on the sequence path encoder, the geographic grid identifiers in the spatiotemporal trajectory data are feature extracted to obtain the sequence path embedding vector corresponding to the spatiotemporal trajectory data; The sequence path encoder includes a bidirectional gated loop unit. Each geographic grid identifier in the spatiotemporal trajectory dataset corresponds to a time step. The bidirectional gated loop unit is used to output the concatenation result of the forward hidden state vector and the reverse hidden state vector corresponding to the geographic grid identifier of the first time step, based on the hidden state corresponding to the geographic grid identifier of the first time step and the geographic grid identifier of the second time step. The sequence path embedding vector includes the concatenation result.
[0097] Optionally, in the terminal spatiotemporal trajectory data retrieval device, the extraction module is specifically used for: Based on the spatiotemporal trajectory dataset, temporal dynamic features are obtained, including time intervals, instantaneous distances, and accelerations. An attention score is obtained by employing a time-interval-aware self-attention mechanism and the aforementioned time-dynamic features; Based on the attention score, a time dynamic embedding vector corresponding to the spatiotemporal trajectory data is obtained.
[0098] Optionally, in the terminal spatiotemporal trajectory data retrieval device, the extraction module is specifically used for: Obtain contextual features associated with geographic grid identifiers in the spatiotemporal trajectory data. The contextual features include at least one of the following: the density of regions of interest at a preset distance from the location corresponding to the geographic grid identifier; the road network level of the road where the geographic grid identifier is located; and the type of functional zone to which the geographic grid identifier belongs. The input vector is obtained by concatenating the embedding vector corresponding to the geographic grid identifier and the embedding vector corresponding to the context feature. Based on the input vector and the context encoder, a context embedding vector corresponding to the spatiotemporal trajectory data is obtained.
[0099] Optionally, the terminal spatiotemporal trajectory data retrieval device further includes: A generation module is used to apply trajectory enhancement and / or text enhancement strategies to the label pair dataset to generate a training dataset, wherein the size of the training dataset is larger than that of the label pair dataset; the trajectory enhancement strategy is used to instruct at least one of the following processing methods for spatiotemporal trajectory samples in the label pair dataset: time warping, point discarding, point interpolation, subsequence sampling, and spatial perturbation; the text enhancement strategy is used to instruct at least one of the following processing methods for text description samples in the label pair dataset: back-translation, synonym replacement, and template filling. The training module is used to train the initial spatiotemporal trajectory retrieval model based on the training dataset to obtain the spatiotemporal trajectory retrieval model.
[0100] Optionally, in the terminal spatiotemporal trajectory data retrieval device, the spatiotemporal trajectory retrieval model is trained using a multi-objective contrast loss function, which includes a cross-modal contrast loss function, a fine-grained alignment loss function, and a uniformity loss function. The cross-modal contrastive loss function is used to indicate that the training objective of the spatiotemporal trajectory retrieval model is to maximize the cosine similarity between the spatiotemporal trajectory sample and the corresponding text description sample. The fine-grained alignment loss function is used to indicate how to align the temporal dynamic embedding vector output by the temporal dynamic encoder in the spatiotemporal trajectory retrieval model with the embedding vector corresponding to the behavior-related words in the text description sample. The uniformity loss function is used to indicate minimizing the average pairwise Gaussian potential between the spatiotemporal trajectory sample and the corresponding text description sample.
[0101] Optionally, the terminal spatiotemporal trajectory data retrieval device further includes: The second generation module is used to generate the index corresponding to the spatiotemporal trajectory embedding vector in the spatiotemporal trajectory embedding vector database. The retrieval module 301 is specifically used for: Based on the language encoder in the spatiotemporal trajectory retrieval model and the natural language query request input by the user, the query embedding vector corresponding to the natural language query request is obtained; Based on the query embedding vector and the index corresponding to the spatiotemporal trajectory embedding vector in the pre-built spatiotemporal trajectory embedding vector database, a search is performed in the spatiotemporal trajectory embedding vector database to obtain the k candidate spatiotemporal trajectory embedding vectors with the highest cosine similarity to the query embedding vector.
[0102] Optionally, the terminal spatiotemporal trajectory data retrieval device further includes: A filtering module is used to filter k candidate spatiotemporal trajectory embedding vectors according to filtering rules to obtain n target spatiotemporal trajectory embedding vectors; n is an integer greater than or equal to 1; the filtering rules include at least one of the following: sorting the k candidate spatiotemporal trajectory embedding vectors in descending order according to the cosine similarity between the candidate spatiotemporal trajectory embedding vectors and the query embedding vectors corresponding to the natural language query request, and determining the top n candidate spatiotemporal trajectory embedding vectors as the target spatiotemporal trajectory embedding vectors; the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vectors is within the target time range; the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vectors is within the target geographical region; The display module uses geographic information and / or lists to visualize the n spatiotemporal trajectory data corresponding to the n target spatiotemporal trajectory embedding vectors.
[0103] Optionally, the terminal spatiotemporal trajectory data retrieval device further includes: The analysis module is used to perform cluster analysis on the k candidate spatiotemporal trajectory embedding vectors to obtain clusters; The acquisition module is used to obtain the user behavior pattern corresponding to the cluster.
[0104] Optionally, the terminal spatiotemporal trajectory data retrieval device further includes: The detection module is used to perform anomaly detection on k candidate spatiotemporal trajectory embedding vectors based on the semantic distance between the candidate spatiotemporal trajectory embedding vectors and the query embedding vectors corresponding to the natural language query request, and obtain abnormal spatiotemporal trajectory embedding vectors.
[0105] It should be noted that the device provided in this application embodiment can implement all the method steps implemented in the above-mentioned terminal spatiotemporal trajectory data retrieval method embodiment, and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.
[0106] This application also provides a device for retrieving terminal spatiotemporal trajectory data, such as... Figure 4 As shown, it includes: The processor 401, memory 402, transceiver 403, and programs or instructions stored in the memory 402 and executable on the processor 401; when the processor 401 executes the programs or instructions, it implements the various processes of the above-described embodiment of the terminal spatiotemporal trajectory data retrieval method and achieves the same technical effect. To avoid repetition, these will not be described again here.
[0107] The transceiver 403 is used to receive and send data under the control of the processor 401.
[0108] Among them, Figure 4 In this context, the bus architecture can include any number of interconnected buses and bridges, specifically connecting various circuits of one or more processors represented by processor 401 and memory represented by memory 402. The bus architecture can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface. Transceiver 403 can be multiple elements, including transmitters and receivers, providing a unit for communicating with various other devices over a transmission medium. For different user equipment, the user interface 404 can also be an interface capable of connecting external or internal devices, including but not limited to keypads, displays, speakers, microphones, joysticks, etc.
[0109] The processor 401 is responsible for managing the bus architecture and general processing, while the memory 402 can store the data used by the processor 401 when performing operations.
[0110] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the various processes of the above-described terminal spatiotemporal trajectory data retrieval method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0111] This application also provides a computer program product, including computer instructions. When the computer instructions are executed by a processor, they implement the various processes of the above-described terminal spatiotemporal trajectory data retrieval method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0112] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0113] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0114] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A method for retrieving terminal spatiotemporal trajectory data, characterized in that, include: Based on the spatiotemporal trajectory retrieval model and the user's input natural language query request, a retrieval is performed in a pre-built spatiotemporal trajectory embedding vector database to obtain k candidate spatiotemporal trajectory embedding vectors, where k is an integer greater than or equal to 1; The spatiotemporal trajectory retrieval model is trained on a tag pair dataset, which includes multiple tag pair data. Each tag pair data includes a spatiotemporal trajectory sample and a text description sample that matches the spatiotemporal trajectory sample.
2. The method according to claim 1, characterized in that, Before retrieving k candidate spatiotemporal trajectory embedding vectors from a pre-built spatiotemporal trajectory embedding vector database based on the spatiotemporal trajectory retrieval model and the user's natural language query request, the method further includes: The mobile communication signaling data of the terminal is processed to obtain a spatiotemporal trajectory dataset, which includes multiple spatiotemporal trajectory data, each of which includes a timestamp and a geographic grid identifier corresponding to the timestamp. Feature extraction is performed on the spatiotemporal trajectory data to obtain the sequence path embedding vector, time dynamic embedding vector, and context embedding vector corresponding to the spatiotemporal trajectory data; The sequence path embedding vector, the time dynamic embedding vector, and the context embedding vector are fused to obtain a spatiotemporal trajectory embedding vector corresponding to the spatiotemporal trajectory data. The spatiotemporal trajectory embedding vector database is constructed based on the spatiotemporal trajectory embedding vector corresponding to each spatiotemporal trajectory data in the spatiotemporal trajectory dataset.
3. The method according to claim 2, characterized in that, The mobile communication signaling data of the terminal is processed to obtain a spatiotemporal trajectory dataset, including: Map the initial user identifier in the mobile communication signaling data of the terminal to a user identifier; The mobile communication signaling data is divided into multiple first spatiotemporal trajectory point sequences based on the user's stop point. Each first spatiotemporal trajectory point sequence includes a timestamp, latitude and longitude coordinates corresponding to the timestamp, and the user identifier. Multiple first spatiotemporal trajectory point sequences are smoothed to obtain multiple second spatiotemporal trajectory point sequences; The latitude and longitude coordinates of the spatiotemporal trajectory points in multiple second spatiotemporal trajectory point sequences are mapped to geographic grid identifiers to obtain multiple third spatiotemporal trajectory point sequences; The multiple third spatiotemporal trajectory point sequences are divided according to the user identifier to obtain a spatiotemporal trajectory dataset.
4. The method according to claim 2, characterized in that, Feature extraction is performed on the spatiotemporal trajectory data to obtain a sequence path embedding vector corresponding to the spatiotemporal trajectory data, including: Based on the sequence path encoder, the geographic grid identifiers in the spatiotemporal trajectory data are feature extracted to obtain the sequence path embedding vector corresponding to the spatiotemporal trajectory data; The sequence path encoder includes a bidirectional gated loop unit. Each geographic grid identifier in the spatiotemporal trajectory dataset corresponds to a time step. The bidirectional gated loop unit is used to output the concatenation result of the forward hidden state vector and the reverse hidden state vector corresponding to the geographic grid identifier of the first time step, based on the hidden state corresponding to the geographic grid identifier of the first time step and the geographic grid identifier of the second time step. The sequence path embedding vector includes the concatenation result.
5. The method according to claim 2, characterized in that, Feature extraction is performed on the spatiotemporal trajectory data to obtain a time-dynamic embedding vector corresponding to the spatiotemporal trajectory data, including: Based on the spatiotemporal trajectory dataset, temporal dynamic features are obtained, including time intervals, instantaneous distances, and accelerations. An attention score is obtained by employing a time-interval-aware self-attention mechanism and the aforementioned time-dynamic features; Based on the attention score, a time dynamic embedding vector corresponding to the spatiotemporal trajectory data is obtained.
6. The method according to claim 2, characterized in that, Feature extraction is performed on the spatiotemporal trajectory data to obtain a context embedding vector corresponding to the spatiotemporal trajectory data, including: Obtain contextual features associated with geographic grid identifiers in the spatiotemporal trajectory data. The contextual features include at least one of the following: the density of regions of interest at a preset distance from the location corresponding to the geographic grid identifier; the road network level of the road where the geographic grid identifier is located; and the type of functional zone to which the geographic grid identifier belongs. The input vector is obtained by concatenating the embedding vector corresponding to the geographic grid identifier and the embedding vector corresponding to the context feature. Based on the input vector and the context encoder, a context embedding vector corresponding to the spatiotemporal trajectory data is obtained.
7. The method according to claim 1, characterized in that, The method further includes: A training dataset is generated by applying trajectory enhancement and / or text enhancement strategies to the label pair dataset, wherein the size of the training dataset is larger than that of the label pair dataset. The trajectory enhancement strategy is used to instruct at least one of the following processing methods for spatiotemporal trajectory samples in the label pair dataset: time warping, point discarding, point interpolation, subsequence sampling, and spatial perturbation. The text enhancement strategy is used to instruct at least one of the following processing methods for text description samples in the label pair dataset: back-translation, synonym replacement, and template filling. The initial spatiotemporal trajectory retrieval model is trained based on the training dataset to obtain the spatiotemporal trajectory retrieval model.
8. The method according to claim 1 or 7, characterized in that, The spatiotemporal trajectory retrieval model is trained using a multi-objective contrast loss function, which includes a cross-modal contrast loss function, a fine-grained alignment loss function, and a uniformity loss function. The cross-modal contrastive loss function is used to indicate that the training objective of the spatiotemporal trajectory retrieval model is to maximize the cosine similarity between the spatiotemporal trajectory sample and the corresponding text description sample. The fine-grained alignment loss function is used to indicate how to align the temporal dynamic embedding vector output by the temporal dynamic encoder in the spatiotemporal trajectory retrieval model with the embedding vector corresponding to the behavior-related words in the text description sample. The uniformity loss function is used to indicate minimizing the average pairwise Gaussian potential between the spatiotemporal trajectory sample and the corresponding text description sample.
9. The method according to claim 1, characterized in that, The method further includes: Generate the index corresponding to the spatiotemporal trajectory embedding vector in the spatiotemporal trajectory embedding vector database; Based on the spatiotemporal trajectory retrieval model and the user's natural language query request, a search is performed in a pre-built spatiotemporal trajectory embedding vector database to obtain k candidate spatiotemporal trajectory embedding vectors, including: Based on the language encoder in the spatiotemporal trajectory retrieval model and the natural language query request input by the user, the query embedding vector corresponding to the natural language query request is obtained; Based on the query embedding vector and the index corresponding to the spatiotemporal trajectory embedding vector in the pre-built spatiotemporal trajectory embedding vector database, a search is performed in the spatiotemporal trajectory embedding vector database to obtain the k candidate spatiotemporal trajectory embedding vectors with the highest cosine similarity to the query embedding vector.
10. The method according to claim 1, characterized in that, The method further includes: According to the filtering rules, k candidate spatiotemporal trajectory embedding vectors are filtered to obtain n target spatiotemporal trajectory embedding vectors; n is an integer greater than or equal to 1; the filtering rules include at least one of the following: based on the cosine similarity between the candidate spatiotemporal trajectory embedding vectors and the query embedding vectors corresponding to the natural language query request, the k candidate spatiotemporal trajectory embedding vectors are sorted in descending order, and the top n candidate spatiotemporal trajectory embedding vectors are determined as the target spatiotemporal trajectory embedding vectors; the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vectors is within the target time range; the spatiotemporal trajectory data corresponding to the target spatiotemporal trajectory embedding vectors is within the target geographical region; The spatiotemporal trajectory data corresponding to the n target spatiotemporal trajectory embedding vectors are visualized using geographic information and / or lists.
11. The method according to claim 1, characterized in that, The method further includes: Cluster analysis is performed on the k candidate spatiotemporal trajectory embedding vectors to obtain clusters; Obtain the user behavior pattern corresponding to the cluster.
12. The method according to claim 1, characterized in that, The method further includes: Based on the semantic distance between the candidate spatiotemporal trajectory embedding vector and the query embedding vector corresponding to the natural language query request, anomaly detection is performed on the k candidate spatiotemporal trajectory embedding vectors to obtain abnormal spatiotemporal trajectory embedding vectors.
13. A device for retrieving terminal spatiotemporal trajectory data, characterized in that, include: The retrieval module is used to retrieve k candidate spatiotemporal trajectory embedding vectors from a pre-built spatiotemporal trajectory embedding vector database based on the spatiotemporal trajectory retrieval model and the natural language query request input by the user, where k is an integer greater than or equal to 1. The spatiotemporal trajectory retrieval model is trained on a tag pair dataset, which includes multiple tag pair data. Each tag pair data includes a spatiotemporal trajectory sample and a text description sample that matches the spatiotemporal trajectory sample.
14. A device for retrieving terminal spatiotemporal trajectory data, characterized in that, include: A processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the processor executes the program or instructions to implement a method for retrieving terminal spatiotemporal trajectory data as described in any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the method for retrieving terminal spatiotemporal trajectory data as described in any one of claims 1 to 12.
16. A computer program product, characterized in that, It includes computer instructions, which, when executed by a processor, implement the method for retrieving terminal spatiotemporal trajectory data as described in any one of claims 1 to 12.
Citation Information
Patent Citations
Method of identifying hot tourist route based on mobile signaling
CN105956951A
Track data query method and device, electronic equipment and medium
CN117056446A
Ship traffic flow prediction method and device, electronic equipment and storage medium
CN119989016A
Track retrieval method and device, computer equipment and storage medium
CN121071207A
Track data coding and query method and system, terminal equipment and medium
CN121301495A