Method for realizing space-time similar trajectory search under non-uniform data based on domain invariant learning

By establishing a dynamic adversarial game between the spatiotemporal encoder and the adaptive domain discriminator, domain-specific information is eliminated, thus solving the problem of insufficient generalization ability in cross-domain trajectory search and achieving accuracy and robustness in cross-domain trajectory similarity search.

CN121301490APending Publication Date: 2026-01-09NORTHWESTERN POLYTECHNICAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511377823.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-25
Publication Date
2026-01-09

AI Technical Summary

Technical Problem

Existing technologies are inefficient when processing large-scale trajectory data and lack generalization ability across domains, making it difficult to effectively extract shared representations. In particular, when trajectory data in different domains has irregular sampling rates and variable sequence lengths, it is difficult to achieve spatiotemporal representation alignment across domains.

Method used

By using a spatiotemporal encoder to encode the trajectories in the source and target domains respectively to obtain hidden representations, and by employing an adversarial learning domain adaptation strategy, a dynamic adversarial training is established between the spatiotemporal encoder and the adaptive domain discriminator to eliminate domain-specific information in the feature space, thus achieving cross-domain trajectory search.

Benefits of technology

It achieves robust trajectory similarity search across multiple domains without retraining, ensuring the accuracy and generalization ability of search results, and can effectively handle spatiotemporal similarity trajectory search under non-uniform data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121301490A_ABST
    Figure CN121301490A_ABST
Patent Text Reader

Abstract

The invention particularly relates to a method for realizing space-time similar trajectory search under non-uniform data based on domain invariant learning. The method can realize generalization trajectory similar search across multiple fields. Specifically, in order to solve cross-domain distribution differences in trajectory representation, a dynamic confrontation game is established between an adaptive domain discriminator and a space-time encoder, and the space-time encoder is guided to eliminate domain specific information in a feature space, so that shared and domain-independent representation is extracted while trajectory semantics are reserved; a bidirectional gating circulation unit is adopted to map tracks of different lengths to a feature space of a fixed dimension, and feature mismatching caused by inconsistent sequence lengths in a traditional method is avoided; a bi-directional gating circulation unit and learnable Fourier features are adopted to encode a track, so that a space-time encoder supports a track sequence with irregular time intervals.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of trajectory search technology, specifically to a method for searching spatiotemporally similar trajectories under non-uniform data based on domain-invariant learning. Background Technology

[0002] The purpose of similar trajectory search is to find similar trajectories given a query trajectory. This is beneficial for a wide range of applications, such as route recommendation, traffic pattern analysis, and location-based services (e.g., ride-sharing, logistics optimization). For example, identifying frequently used routes can optimize public transportation planning, while comparing trajectory patterns can help detect abnormal movement.

[0003] Traditional similar trajectory search methods rely on point-to-point comparisons, which are inefficient when dealing with large-scale trajectory data. To address this, many advanced deep learning-based models have been proposed. However, these methods neglect temporal similarity, which is crucial for capturing time-sensitive motion patterns, such as those in ride-sharing or delivery services. Based on this, spatiotemporal trajectory search models have emerged. However, due to domain-specific differences such as different traffic patterns, urban layouts, and behavioral dynamics, these models typically require retraining for each new domain, resulting in high resource consumption and a lack of generalization ability. This means that standard models trained in one domain often cannot be generalized to other domains. Furthermore, trajectories from different domains often have irregular sampling rates and variable sequence lengths, making it difficult to effectively extract shared representations. Therefore, the following problems exist in solving cross-domain spatiotemporal representation alignment: (1) Irregular time intervals and variable trajectory sequences necessitate sequential modeling in a traditional manner; (2) Domain offset caused by differences in traffic patterns between different domains reduces the cross-domain generalization ability.

[0004] The above problems indicate the need for a more general and adaptive similar trajectory search method for arbitrary sources.

[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0006] This invention provides a method for searching spatiotemporally similar trajectories under non-uniform data based on domain-invariant learning, an electronic device, a computer-readable storage medium, and a computer program product, which can effectively overcome the defects existing in the prior art.

[0007] Other features and advantages of the invention will become apparent from the following detailed description, or may be learned in part by practice of the invention.

[0008] According to a first aspect of the present invention, a method for searching spatiotemporally similar trajectories under non-uniform data based on domain-invariant learning is provided, the method comprising: The first query trajectory in the source domain and the second query trajectory in the target domain are encoded using a spatiotemporal encoder to obtain the corresponding first hidden representation and second hidden representation respectively. Based on the first query trajectory, the first hidden representation, and the real trajectory corresponding to the first query trajectory, the predicted trajectory of the first query trajectory is reconstructed using an attention-based decoder; and, the point-to-point loss is calculated using the predicted trajectory and the real trajectory, and the representation loss is calculated using the first query trajectory and the real trajectory. Based on the first hidden representation and the second hidden representation, the adaptive neighborhood discriminator is used to determine the prediction domain labels corresponding to the first query trajectory and the second query trajectory, respectively; and the neighborhood adversarial loss is calculated using the prediction domain labels; wherein, a gradient inversion layer is integrated between the spatiotemporal encoder and the adaptive neighborhood discriminator, and adversarial training between the spatiotemporal encoder and the adaptive neighborhood discriminator is carried out by inverting gradients during backpropagation. The spatiotemporal encoder is trained by updating the point loss, representation loss, and domain adversarial loss to determine the target parameter matrix of the spatiotemporal encoder, thereby obtaining a trained domain-adaptive multi-source irregular spatiotemporal similar trajectory search model. The trained domain-adaptive multi-source irregular spatiotemporal similar trajectory search model is used to search for similar trajectories corresponding to the planned trajectory to be processed.

[0009] In some exemplary embodiments, the method further includes: performing dimensionality upscaling on the first query trajectory to obtain a high-dimensional feature representation of the first query trajectory, including:

[0010] in, This represents a custom dimension parameter. This represents the spatiotemporal information of the first query trajectory, and || represents vector concatenation. This represents the learnable parameter matrix, which determines the orientation and wavelength of the Fourier basis; The embedding vector sequence of the first query trajectory is determined using its high-dimensional feature representation. The embedding vector of each trajectory point in the first query trajectory includes:

[0011] in, Represents a timestamp. Represents trajectory points Spatial coordinates; By recursively modeling the embedded vector sequence using the bidirectional gated cyclic unit in the spatiotemporal encoder, a first hidden representation containing temporal order dependencies is generated.

[0012] In some exemplary embodiments, the step of reconstructing a predicted trajectory of the first query trajectory using an attention-based decoder based on the first query trajectory, the first hidden representation, and the ground truth trajectory corresponding to the first query trajectory; and calculating a point-to-point loss using the predicted trajectory and the ground truth trajectory, and calculating a representation loss using the first query trajectory and the ground truth trajectory, includes: The attention module is used to extract information from the first hidden representation and the ground truth trajectory, resulting in the attention module output, including:

[0013] in, This represents the first hidden representation. The MLP represents the multilayer perceptron layer, representing the actual trajectory. The first hidden representation and the output of the attention module are input into the decoder, and the predicted trajectory of the first query trajectory is reconstructed using the bidirectional gated recurrent unit in the decoder, including:

[0014] in, This represents the predicted trajectory of the first query trajectory. Indicates a bidirectional gated loop unit; Calculate the point-to-point loss using the predicted trajectory and the actual trajectory, and calculate the representation loss using the first query trajectory and the actual trajectory; Wherein, the loss function is defined as:

[0015] and These represent the actual trajectories processed by the spatiotemporal encoder. and negative trajectory The encoding representation, Indicates the boundary hyperparameters; The point-to-point loss function is defined as:

[0016] n represents the true trajectory The number of points on the trajectory.

[0017] In some exemplary embodiments, the step of determining the predicted domain labels corresponding to the first query trajectory and the second query trajectory respectively using an adaptive neighborhood discriminator based on the first hidden representation and the second hidden representation; and calculating the neighborhood adversarial loss using the predicted domain labels, includes: Based on the forward propagation of the gradient inversion layer, the first hidden representation and the second hidden representation are passed to the bidirectional gated recurrent unit; The sequence lengths of the first hidden representation and the second hidden representation are adjusted using a bidirectional gated loop unit to obtain the corresponding first aligned representation and second aligned representation, respectively. Inputting the first and second alignment representations into the domain classifier yields the predicted domain labels for the first and second alignment representations, including:

[0018] in, and Indicates learnable parameters, This indicates either the first alignment or the second alignment. The label representing the prediction domain of the i-th trajectory; The domain adversarial loss is calculated using the predicted domain labels, where the domain adversarial loss function is defined as:

[0019] The real domain label indicates whether the first and second query trajectories belong to the source domain or the target domain. Indicates the first query trajectory. Indicates the second query trajectory; By utilizing a gradient inversion layer to invert the gradient of the domain adversarial loss during backpropagation, the spatiotemporal encoder generates cross-domain indistinguishable feature representations, including:

[0020] in, λ>0 indicates a hyperparameter. The weight parameters represent the adaptive neighborhood discriminator. This represents the weight parameters of the spatiotemporal encoder.

[0021] In some exemplary embodiments, the forward propagation based on the gradient inversion layer, which passes the first hidden representation and the second hidden representation to the bidirectional gated recurrent unit, includes: In the forward propagation, the gradient reversal layer acts as an identity function, including:

[0022] in, λ represents the first hidden representation or the second hidden representation, and λ>0 represents the hyperparameter.

[0023] In some exemplary embodiments, a bidirectional gated loop unit is used to adjust the sequence lengths of the first hidden representation and the second hidden representation respectively, thereby obtaining the corresponding first aligned representation and the second aligned representation respectively, including: Nonlinear transformations are applied to each time step of the first and second hidden representations to perform feature enhancement processing, resulting in enhanced feature representations, including:

[0024] This represents the activation function. and These are learnable parameters. This represents each time step of the first hidden representation or each time step of the second hidden representation; The enhanced feature representation is used to generate sequence-level features, including:

[0025] Where |T| represents the trajectory length, which varies between trajectories; The forward hidden state of sequence-level features is captured by forward propagation using a bidirectional gated recurrent unit; and the backward hidden state of sequence-level features is captured by backward path using a bidirectional gated recurrent unit. By concatenating the forward hidden state and the backward hidden state, we obtain the corresponding first alignment representation and second alignment representation.

[0026] In some exemplary embodiments, the method further includes: Multiple trajectories are selected based on the target geographic space; where the target geographic space is used to represent the geographic space within a preset range corresponding to the planned trajectory. The target geographic space is divided into grids according to latitude and longitude, and the grid sequence number is obtained; The latitude and longitude of the trajectory points of multiple trajectories are mapped to the sequence number of the grid to obtain the grid number sequence of multiple trajectories, and the grid number sequence of multiple trajectories is configured as a trajectory set; The planned trajectory and trajectory set are encoded by a trained domain-adaptive multi-source irregular spatiotemporal similar trajectory search model, and the corresponding third and fourth hidden representations are obtained respectively. The similarity between the planned trajectory and each trajectory in the trajectory set is calculated based on the third and fourth hidden representations, and the similarity is ranked to obtain the similarity ranking. The trajectory with the highest similarity to the planned trajectory in the trajectory set is obtained based on the similarity ranking.

[0027] According to a second aspect of the present invention, an electronic device is provided, comprising: Processor; and Memory for storing the executable instructions of the processor; The processor is configured to implement the above-described method for searching spatiotemporal similar trajectories under non-uniform data based on domain-invariant learning when executing the executable instructions.

[0028] According to a third aspect of the present invention, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device where the storage medium is located to execute the above-described method for searching spatiotemporal similar trajectories under non-uniform data based on domain-invariant learning.

[0029] According to a fourth aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the above-described method for searching spatiotemporal similar trajectories under non-uniform data based on domain-invariant learning.

[0030] The domain-invariant learning-based method for searching spatiotemporally similar trajectories under non-uniform data provided in the embodiments of the present invention can achieve generalized trajectory similarity search across multiple domains. To address cross-domain distribution differences in trajectory representation, a dynamic adversarial game is established between the adaptive domain discriminator and the spatiotemporal encoder. This guides the spatiotemporal encoder to eliminate domain-specific information in the feature space, thereby extracting shared and domain-independent representations while preserving trajectory semantics. A bidirectional gated recurrent unit is used to map trajectories of different lengths to a fixed-dimensional feature space, avoiding feature mismatch caused by inconsistent sequence lengths in traditional methods. Furthermore, bidirectional gated recurrent units and learnable Fourier features are used to encode the trajectories, enabling the spatiotemporal encoder to support trajectory sequences with irregular time intervals.

[0031] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0032] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention. It is obvious that the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0033] Figure 1 A schematic diagram illustrating trajectories in the source and target domains in the prior art; Figure 2 The illustration shows a schematic diagram of an exemplary embodiment of the present invention, which is a method for searching spatiotemporal similar trajectories based on domain invariant learning under non-uniform data. Figure 3 This illustration shows a schematic diagram of model training in an exemplary embodiment of the present invention, which is a method for searching spatiotemporal similar trajectories under non-uniform data based on domain-invariant learning. Figure 4 The diagram illustrates the composition of an electronic device according to an exemplary embodiment of the present invention. Detailed Implementation

[0034] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that the invention will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0035] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0036] In existing technologies, such as Figure 1 As shown, the trajectories collected from Xi'an (source) and Hong Kong (destination) exhibit different motion behaviors. The Xi'an trajectory shows straight-line travel within a grid-like road network, while the Hong Kong trajectory displays highly curved paths due to the mountainous terrain, reflecting fundamental differences in urban layout and travel patterns. Furthermore, trajectories from different domains (source and destination domains) typically have irregular sampling rates and variable sequence lengths, making it difficult to effectively extract shared representations. Figure 1 In the analysis, the Xi'an trajectory shows sparse and irregular sampling, while the Hong Kong trajectory shows a denser and more consistent trajectory. The difference between the source and destination trajectories indicates a challenge in aligning cross-domain spatiotemporal representations when searching for similar trajectories. The aforementioned source domain is used to represent a domain with abundant trajectory data and annotation information, for training or pre-learning models. Its contained trajectory data features, distribution patterns, and task results can provide knowledge for new scenarios. For example, taxi trajectory data from a city can serve as a source domain.

[0037] The target domain, as described above, represents the area where similar trajectory retrieval or prediction is needed, often lacking sufficient data or annotation information. The target domain and source domain may differ in environment, data distribution, or trajectory characteristics. Utilizing source domain knowledge helps to perform trajectory similarity calculation or retrieval more efficiently and accurately within the target domain. For example, consider taxi trajectory data in the source domain, which contains rich road networks, traffic features, and numerous well-annotated trajectory patterns. The target domain is taxi trajectory data from Hong Kong, with limited data volume. Trajectory similarity measurement methods learned from the source domain can be transferred to the target domain, still effectively capturing the spatial-temporal similarity between trajectories when searching for similar trajectories in Hong Kong.

[0038] To address the shortcomings and deficiencies of existing technologies, this example implementation provides a method for searching spatiotemporally similar trajectories under non-uniform data based on domain-invariant learning. (Reference) Figure 2 As shown, it can specifically include: Step S10: Encode the first query trajectory in the source domain and the second query trajectory in the target domain using a spatiotemporal encoder to obtain the corresponding first hidden representation and second hidden representation respectively. Specifically, a spatiotemporal encoder is used to capture the spatiotemporal features of irregular trajectories from non-uniform trajectories in the source and target domains, thereby obtaining the first hidden representation corresponding to the first query trajectory and the second hidden representation corresponding to the second query trajectory.

[0039] Step S12: Based on the first query trajectory, the first hidden representation, and the real trajectory corresponding to the first query trajectory, reconstruct the predicted trajectory of the first query trajectory using an attention-based decoder; and calculate the point-to-point loss using the predicted trajectory and the real trajectory, and calculate the representation loss using the first query trajectory and the real trajectory. Step S14: Based on the first hidden representation and the second hidden representation, the adaptive neighborhood discriminator is used to determine the prediction domain labels corresponding to the first query trajectory and the second query trajectory respectively; and the neighborhood adversarial loss is calculated using the prediction domain labels; wherein, a gradient inversion layer is integrated between the spatiotemporal encoder and the adaptive neighborhood discriminator, and adversarial training between the spatiotemporal encoder and the adaptive neighborhood discriminator is performed by inverting the gradient during backpropagation. Specifically, to address cross-domain distribution discrepancies in trajectory representation, a domain adaptation strategy based on adversarial learning is employed. Specifically, a dynamic adversarial game is established between the adaptive domain discriminator and the spatiotemporal encoder, guiding the spatiotemporal encoder to eliminate domain-specific information in the feature space. This process implicitly aligns cross-domain feature distributions, thereby enhancing cross-domain generalization capability.

[0040] Step S16: Train the spatiotemporal encoder by updating the point loss, representation loss, and domain adversarial loss to determine the target parameter matrix of the spatiotemporal encoder, thereby obtaining the trained domain-adaptive multi-source irregular spatiotemporal similar trajectory search model; wherein, the trained domain-adaptive multi-source irregular spatiotemporal similar trajectory search model is used to search for similar trajectories corresponding to the planned trajectory to be processed.

[0041] This invention addresses the shortcomings of existing trajectory search technologies in cross-domain applications, namely insufficient generalization ability and difficulty in achieving cross-domain spatiotemporal representation alignment. Through the aforementioned technical solution, this invention enables robust trajectory similarity search across multiple domains without retraining, ensuring the accuracy and generalization of search results.

[0042] The following will describe in more detail each step of the method for searching spatiotemporal similar trajectories under non-uniform data based on domain-invariant learning in this exemplary embodiment, with reference to the accompanying drawings and embodiments.

[0043] For example, the domain-invariant learning method for searching spatiotemporally similar trajectories under non-uniform data further includes: Step S101: Perform dimensionality upscaling on the first query trajectory to obtain a high-dimensional feature representation of the first query trajectory, including:

[0044] in, This represents a custom dimension parameter. This represents the spatiotemporal information of the first query trajectory, and || represents vector concatenation. Represents the learnable parameter matrix; Step S102: Determine the embedding vector sequence of the first query trajectory using the high-dimensional feature representation of the first query trajectory, wherein the embedding vector of each trajectory point in the first query trajectory includes:

[0045] in, Represents a timestamp. Represents trajectory points Spatial coordinates; Step S103: The embedded vector sequence is recursively modeled using the bidirectional gated cyclic unit in the spatiotemporal encoder to generate a first hidden representation containing temporal order dependencies.

[0046] Specifically, the embedded vector sequence is input into a bidirectional gated recurrent unit (BiGRU) for recursive modeling to capture the order dependencies of the first query trajectory, thereby obtaining the first hidden representation. Spatiotemporal encoders enable the learning of meaningful representations from trajectories at arbitrary time intervals, thus effectively handling trajectories with non-uniform sampling rates.

[0047] For example, in step S12, based on the first query trajectory, the first hidden representation, and the real trajectory corresponding to the first query trajectory, a predicted trajectory of the first query trajectory is reconstructed using an attention-based decoder; and, a point-to-point loss is calculated using the predicted trajectory and the real trajectory, and a representation loss is calculated using the first query trajectory and the real trajectory, including: Step S121: Extract information from the first hidden representation and the real trajectory using the attention module to obtain the output of the attention module, including:

[0048] in, This represents the first hidden representation. The MLP represents the multilayer perceptron layer, representing the actual trajectory. Specifically, the attention module also utilizes the hidden state of the first query trajectory obtained from BiGRU. and the actual trajectory The attention module here is used to focus on the most useful information in the first query trajectory.

[0049] Step S122: Input the output of the first hidden representation and attention module into the decoder, and reconstruct the predicted trajectory of the first query trajectory using the bidirectional gated recurrent unit in the decoder, including:

[0050] in, This represents the predicted trajectory of the first query trajectory, and BiGRU represents a bidirectional gated loop unit. Step S123: Calculate the point-to-point loss using the predicted trajectory and the actual trajectory, and calculate the representation loss using the first query trajectory and the actual trajectory; Wherein, the loss function is defined as:

[0051] and These represent the actual trajectories processed by the spatiotemporal encoder. and negative trajectory The encoding representation, This represents the boundary hyperparameters, which control the separation between positive and negative pairs; The point-to-point loss function is defined as:

[0052] n represents the true trajectory The number of points on the trajectory.

[0053] Specifically, The smaller the value, the higher the reconstruction accuracy.

[0054] For example, in step S14, based on the first hidden representation and the second hidden representation, an adaptive neighborhood discriminator is used to determine the prediction domain labels corresponding to the first query trajectory and the second query trajectory, respectively; and, the neighborhood adversarial loss is calculated using the prediction domain labels, including: Step S141: Based on the forward propagation of the gradient inversion layer, the first hidden representation and the second hidden representation are passed to the bidirectional gated recurrent unit. Step S142: The sequence lengths of the first hidden representation and the second hidden representation are adjusted using a bidirectional gated loop unit to obtain the corresponding first aligned representation and second aligned representation respectively. Specifically, to address the inherent misalignment in feature representations caused by variations in trajectory length between the source and target domains, a BiGRU-based sequence modeling method is employed. Traditional fixed-dimensional encoders cannot adapt to changes in sequence length, exacerbating cross-domain representation discrepancies. BiGRU, however, dynamically encodes variable-length sequences by learning forward and backward time dependencies, thereby mitigating feature misalignment in the latent space.

[0055] Step S143: Input the first alignment representation and the second alignment representation into the domain classifier to obtain the predicted domain labels of the first alignment representation and the second alignment representation, including:

[0056] in, and Indicates learnable parameters, This indicates either the first alignment or the second alignment. The label representing the prediction domain of the i-th trajectory; Specifically, a lightweight domain classifier is employed to distinguish whether a query trajectory originates from the source or target domain, thereby guiding the spatiotemporal encoder to learn representations of obfuscated domain boundaries. Formally, the classifier will... As input, the trajectory is transformed using an MLP layer, from which the domain label can be obtained.

[0057] Step S144: Calculate the domain adversarial loss using the predicted domain labels, where the domain adversarial loss function is defined as:

[0058] The real domain label indicates whether the first and second query trajectories belong to the source domain or the target domain. Indicates the first query trajectory. Indicates the second query trajectory; Step S145 involves using a gradient inversion layer to invert the gradient of the domain adversarial loss during backpropagation, enabling the spatiotemporal encoder to generate cross-domain indistinguishable feature representations, including:

[0059] in, λ>0 indicates a hyperparameter. The weight parameters represent the adaptive neighborhood discriminator. This represents the weight parameters of the spatiotemporal encoder.

[0060] Specifically, to guide the encoder to generate domain-invariant representations, a gradient reversal layer (GRL) is integrated between the spatiotemporal encoder and the domain classifier. GRL achieves adversarial training by reversing gradients during backpropagation, thereby forcing the spatiotemporal encoder to confuse the classification results of the domain classifier and learn domain-invariant feature representations.

[0061] For example, in step S141, based on the forward propagation of the gradient reversal layer, the first hidden representation and the second hidden representation are passed to the bidirectional gated recurrent unit, including: In the forward propagation, the gradient reversal layer acts as an identity function, including:

[0062] in, λ represents the first or second hidden representation, and λ>0 represents a hyperparameter, which is mainly used in the backpropagation stage to control the magnitude of gradient reversal in order to achieve domain adaptation.

[0063] For example, in step S142, the sequence lengths of the first hidden representation and the second hidden representation are adjusted using a bidirectional gated loop unit to obtain the corresponding first aligned representation and second aligned representation, respectively, including: Step S21: Apply nonlinear transformations to perform feature enhancement processing on each time step representation of the first and second hidden representations respectively, to obtain the enhanced feature representations, including:

[0064] This represents the activation function. and These are learnable parameters. This represents each time step of the first hidden representation or each time step of the second hidden representation; Specifically, let These represent the time-step feature representations corresponding to the first hidden representation and the second hidden representation, respectively, where each... It is a variable-length sequence, where |T| varies between trajectories. The core of solving the inherent misalignment problem in feature representations caused by the variation in trajectory length between the source and target domains lies in learning a mapping function. , making It is independent of the trajectory length |T|. Therefore, we need to first represent each time step... A nonlinear transformation is applied to enhance the feature representation capability.

[0065] Step S22, generating sequence-level features using the enhanced feature representation, including:

[0066] Where |T| represents the trajectory length, which varies between trajectories; Step S23: Capture the forward hidden state of sequence-level features using the forward propagation of the bidirectional gated recurrent unit; and capture the backward hidden state of sequence-level features using the backward path of the bidirectional gated recurrent unit. Specifically, to hide the first representation corresponding to Taking the input into a BiGRU as an example, this BiGRU processes the sequence in two temporal directions. The historical patterns captured by forward propagation are as follows:

[0067]

[0068]

[0069]

[0070] in, This indicates that the gate vector is updated forward. This represents the sigmoid function. , Represents the weight matrix. This represents the bias vector. Indicates the previous hidden state; This represents the forward reset gate vector. , Represents the weight matrix. Represents the bias vector; Indicates the forward candidate hidden state, and ⊙ represents element-wise multiplication. , Represents the weight matrix. Represents the bias vector; This represents the forward hidden state of the first hidden representation at time t.

[0071] Backward path captures future scenarios:

[0072]

[0073]

[0074]

[0075] in, This indicates that the gate vector is updated backward. This represents the sigmoid function. , Represents the weight matrix. This represents the bias vector. Indicates the previous hidden state; This represents the backward reset gate vector. , Represents the weight matrix. Represents the bias vector; Represents the backward candidate hidden state, and ⊙ represents element-wise multiplication. , Represents the weight matrix. Represents the bias vector; This represents the backward hiding state of the first hidden representation at time t.

[0076] It should be noted that the weight matrices of the forward GRU and the backward GRU are different, and each learns the temporal patterns in its own direction independently, thereby generating bidirectional hidden representations.

[0077] Step S24: Concatenate the forward hidden state and the backward hidden state to obtain the corresponding first alignment representation and second alignment representation.

[0078] Specifically, the final representation at each time step is obtained by concatenating the forward and backward hidden states:

[0079] in, This indicates vector concatenation.

[0080] This fusion representation is able to capture bidirectional temporal context at each trajectory point.

[0081] For example, the method further includes: Step S31: Select multiple trajectories based on the target geographic space; wherein, the target geographic space is used to represent the geographic space within a preset range corresponding to the planned trajectory; Step S32: Divide the target geographic space into grids according to latitude and longitude to obtain the grid sequence number; Step S33: Match the latitude and longitude of the trajectory points of multiple trajectories with the sequence number of the grid to obtain the grid number sequence of multiple trajectories, and configure the grid number sequence of multiple trajectories as a trajectory set; Step S34: Encode the planned trajectory and trajectory set using the trained domain-adaptive multi-source irregular spatiotemporal similar trajectory search model, and obtain the corresponding third hidden representation and fourth hidden representation respectively; Step S35: Calculate the similarity between the planned trajectory and each trajectory in the trajectory set based on the third and fourth hidden representations, and rank them according to the similarity to obtain the similarity ranking; Step S36: Based on the similarity ranking, obtain the trajectory with the highest similarity to the planned trajectory in the trajectory set.

[0082] Specifically, when using a domain-adaptive multi-source irregular spatiotemporal similarity trajectory search model in traffic analysis scenarios, after determining that the user has selected a planned trajectory, multiple trajectories are first selected within a preset geographical area corresponding to the planned trajectory. The target geographical space is then gridded according to latitude and longitude, resulting in grid sequence numbers. Next, the latitude and longitude of the trajectory points of the multiple trajectories are mapped to the grid sequence numbers, resulting in a grid number sequence for the multiple trajectories. This grid number sequence is then configured as a trajectory set. The planned trajectory and the trajectory set are then input into the trained domain-adaptive multi-source irregular spatiotemporal similarity trajectory search model. The model encodes both the planned trajectory and the trajectory set, obtaining the third hidden representation for the planned trajectory and the fourth hidden representation for each planned trajectory in the trajectory set. Based on this, the similarity between the planned trajectory and each trajectory in the trajectory set is calculated using the third and fourth hidden representations, and ranked according to the similarity. Finally, the trajectory with the highest similarity to the planned trajectory in the trajectory set is obtained based on the similarity ranking.

[0083] For example, this invention consists of three steps: data preprocessing, model training, and model validation. For data preprocessing: the geospatial of the dataset is divided into a 500×500 meter grid. To reduce the impact of erroneous records, extremely short or extremely long trajectories are removed. Note that the time interval between consecutive points within each trajectory is non-uniform. Since true labels for similar trajectory search are not readily available, we synthesize true labels in accordance with the method described in the paper (Similar trajectory search with spatio-temporal deep representation learning. ACM Transactions on Intelligent Systems and Technology (TIST), 12(6): 1–26). To construct the query trajectories for evaluation and their corresponding true trajectories, the original trajectories are downsampled and spatially warped. This process produces degraded versions as query trajectories, while the original, undamaged trajectories serve as their true trajectories. The trajectory database includes both these ground-based true trajectories and an additional set of trajectories selected to support comprehensive retrieval evaluation.

[0084] For model training, the processed data is fed into the model for training to optimize the model.

[0085] For model performance validation: N ground truth trajectories in the target domain are downsampled and spatially distorted to reduce trajectory quality, resulting in query trajectories. Additionally, M unrelated trajectories are found and connected to the N ground truth trajectories to form a trajectory database. The N query trajectories and the M+N database trajectories are fed into a trained spatiotemporal encoder to obtain high-dimensional feature representations of the corresponding trajectories. For each query trajectory, its similarity to the M+N database trajectories is calculated, and the M+N database trajectories are ranked according to similarity. The ranking of the ground truth trajectories for each query trajectory is used as its rank. The evaluation metric used is Mean Rank (MR), which is the average ranking of the ground truth trajectories. The smaller this value, the better the model performance.

[0086] The expression for MR is:

[0087] The method provided in the embodiments of the present invention is referred to Figure 3As shown, trajectory sets from two locations are used as the source and target domain trajectory sets, respectively. For example, Xi'an is used as the source domain and Hong Kong as the target domain. The source and target domain trajectory sets, after quality degradation processing, are fed into a spatiotemporal encoder to obtain high-dimensional feature representations of the source and target domain trajectories. To improve the trajectory representation quality, a similar trajectory retrieval optimization module is designed. Specifically, the obtained high-dimensional features from the source domain are fed into an attention-based decoder for trajectory reconstruction, and the representation loss is calculated. and point-to-point loss To improve the accuracy of the similar trajectory retrieval module in the model, a cross-domain model was designed to enhance its cross-domain capability. High-dimensional feature representations of the source and target domains are fed into the cross-domain module. Specifically, the feature representations of the source and target domains are first aligned using an alignment module. Then, the aligned source and target domain feature representations are fed into a domain classifier to obtain predicted domain labels. The predicted domain labels are then compared with the true domain labels to obtain the domain classification loss. By reducing the loss value, the spatiotemporal encoder generates trajectory representations that cannot distinguish the trajectory source from the domain classification, thus enabling the spatiotemporal encoder to gain cross-domain capabilities. This is achieved by integrating a gradient inversion layer between the spatiotemporal encoder and the cross-domain module, and conducting adversarial training between the spatiotemporal encoder and the cross-domain module during backpropagation by inverting gradients. Finally, by updating... , and The spatiotemporal encoder is trained to determine the target parameter matrix of the spatiotemporal encoder, thereby obtaining a trained domain-adaptive multi-source irregular spatiotemporal similar trajectory search model.

[0088] The beneficial effects of this invention are as follows: (1) Cross-domain robustness: By using a gradient inversion layer (GRL) and an adaptive neighborhood discriminator, the trajectory feature distributions of the source and target domains are effectively aligned, solving the distribution offset problem caused by differences in urban structure and traffic rules, and improving the neighborhood adaptation capability. (2) Non-uniform data processing capability: Dynamic spatiotemporal dependency modeling: Using BiGRU and learnable Fourier feature encoding, it supports trajectory sequences with irregular time intervals (such as sparse sampling or variable time intervals). Variable-length sequence alignment: BiGRU maps trajectories of different lengths to a fixed-dimensional feature space, avoiding feature mismatch caused by inconsistent sequence lengths in traditional methods.

[0089] (3) Efficient spatiotemporal semantic preservation: Joint attention mechanism: The decoder combines spatial-temporal attention to focus on key spatiotemporal nodes when reconstructing the trajectory, thereby improving the fine-grainedness of similarity calculation.

[0090] Multi-task loss function: It integrates representation loss, point-to-point loss and domain adversarial loss to ensure domain-invariant features while preserving the spatiotemporal patterns of the original trajectory.

[0091] It should be noted that the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Furthermore, it is readily understood that these processes may, for example, be executed synchronously or asynchronously in multiple modules.

[0092] Furthermore, Figure 4 A schematic diagram of an electronic device suitable for implementing embodiments of the present invention is shown.

[0093] It should be noted that, Figure 4 The illustrated electronic device 1000 is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0094] like Figure 4 As shown, the electronic device 1000 includes a Central Processing Unit (CPU) 1001, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 1002 or programs loaded from storage section 1008 into Random Access Memory (RAM) 1003. The RAM 1003 also stores various programs and data required for system operation. The CPU 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An Input / Output (I / O) interface 1005 is also connected to the bus 1004. Furthermore, the electronic device 1000 also includes an FPGA device and a System-on-a-Chip (SoC) device.

[0095] The following components are connected to I / O interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to I / O interface 1005 as needed. Removable media 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1010 as needed so that computer programs read from them can be installed into storage section 1008 as needed.

[0096] For example, the aforementioned electronic device could be a host computer.

[0097] In particular, according to embodiments of the present invention, the processes described below with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a storage medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1009, and / or installed from removable medium 1011. When the computer program is executed by central processing unit (CPU) 1001, it performs various functions defined in the system of this application.

[0098] Specifically, the aforementioned electronic devices can be airborne intelligent electronic devices, such as airborne video processing equipment.

[0099] It should be noted that the storage medium shown in the embodiments of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, wherein computer-readable program code is carried. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any storage medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the storage medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0100] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0101] The units described in the embodiments of the present invention can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0102] It should be noted that, as another aspect, this application also provides a storage medium, which may be included in an electronic device or may exist independently without being assembled into the electronic device. The aforementioned storage medium carries one or more programs, which, when executed by an electronic device, cause the electronic device to perform the methods described in the following embodiments. For example, the electronic device may perform... Figure 1 The steps of the method shown.

[0103] In one embodiment, this application provides a computer program product including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0104] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0105] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.

[0106] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A method for searching spatiotemporally similar trajectories under non-uniform data based on domain-invariant learning, characterized in that, The method includes: The first query trajectory in the source domain and the second query trajectory in the target domain are encoded using a spatiotemporal encoder to obtain the corresponding first hidden representation and second hidden representation respectively. Based on the first query trajectory, the first hidden representation, and the real trajectory corresponding to the first query trajectory, the predicted trajectory of the first query trajectory is reconstructed using an attention-based decoder; and, the point-to-point loss is calculated using the predicted trajectory and the real trajectory, and the representation loss is calculated using the first query trajectory and the real trajectory. Based on the first hidden representation and the second hidden representation, the adaptive neighborhood discriminator is used to determine the prediction domain labels corresponding to the first query trajectory and the second query trajectory, respectively; and the neighborhood adversarial loss is calculated using the prediction domain labels; wherein, a gradient inversion layer is integrated between the spatiotemporal encoder and the adaptive neighborhood discriminator, and adversarial training between the spatiotemporal encoder and the adaptive neighborhood discriminator is carried out by inverting gradients during backpropagation. The spatiotemporal encoder is trained by updating the point loss, representation loss, and domain adversarial loss to determine the target parameter matrix of the spatiotemporal encoder, thereby obtaining a trained domain-adaptive multi-source irregular spatiotemporal similar trajectory search model. The trained domain-adaptive multi-source irregular spatiotemporal similar trajectory search model is used to search for similar trajectories corresponding to the planned trajectory to be processed.

2. The method according to claim 1, characterized in that, The method further includes: The first query trajectory is subjected to dimensionality upscaling to obtain a high-dimensional feature representation of the first query trajectory, including: in, This represents a custom dimension parameter. This represents the spatiotemporal information of the first query trajectory, and || represents vector concatenation. Represents the learnable parameter matrix; The embedding vector sequence of the first query trajectory is determined using its high-dimensional feature representation, wherein the embedding vector of each trajectory point in the first query trajectory includes: in, Represents a timestamp. Represents trajectory points Spatial coordinates; By recursively modeling the embedded vector sequence using the bidirectional gated cyclic unit in the spatiotemporal encoder, a first hidden representation containing temporal order dependencies is generated.

3. The method according to claim 1, characterized in that, The predicted trajectory of the first query trajectory is reconstructed using an attention-based decoder based on the first query trajectory, the first hidden representation, and the real trajectory corresponding to the first query trajectory. Furthermore, the point-to-point loss is calculated using the predicted trajectory and the actual trajectory, and the representation loss is calculated using the first query trajectory and the actual trajectory, including: The attention module is used to extract information from the first hidden representation and the ground truth trajectory, resulting in the attention module output, including: in, This represents the first hidden representation. The MLP represents the multilayer perceptron layer, representing the actual trajectory. The first hidden representation and the output of the attention module are input into the decoder, and the predicted trajectory of the first query trajectory is reconstructed using the bidirectional gated recurrent unit in the decoder, including: in, Bi represents the predicted trajectory of the first query trajectory. Indicates a bidirectional gated loop unit; Calculate the point-to-point loss using the predicted trajectory and the actual trajectory, and calculate the representation loss using the first query trajectory and the actual trajectory; Wherein, the loss function is defined as: and These represent the actual trajectories processed by the spatiotemporal encoder. and negative trajectory The encoding representation, Indicates the boundary hyperparameters; The point-to-point loss function is defined as: n represents the true trajectory The number of points on the trajectory.

4. The method according to claim 1, characterized in that, The first hidden representation and the second hidden representation are used to determine the prediction domain labels corresponding to the first query trajectory and the second query trajectory respectively using an adaptive neighborhood discriminator. And, using prediction domain labels to calculate domain adversarial loss, including: Based on the forward propagation of the gradient inversion layer, the first hidden representation and the second hidden representation are passed to the bidirectional gated recurrent unit; The sequence lengths of the first hidden representation and the second hidden representation are adjusted using a bidirectional gated loop unit to obtain the corresponding first aligned representation and second aligned representation, respectively. Inputting the first and second alignment representations into the domain classifier yields the predicted domain labels for the first and second alignment representations, including: in, and Indicates learnable parameters, This indicates either the first alignment or the second alignment. The label representing the prediction domain of the i-th trajectory; The domain adversarial loss is calculated using the predicted domain labels, where the domain adversarial loss function is defined as: The real domain label indicates whether the first and second query trajectories belong to the source domain or the target domain. Indicates the first query trajectory. Indicates the second query trajectory; By utilizing a gradient inversion layer to invert the gradient of the domain adversarial loss during backpropagation, the spatiotemporal encoder generates cross-domain indistinguishable feature representations, including: Where λ>0 represents a hyperparameter. The weight parameters represent the adaptive neighborhood discriminator. This represents the weight parameters of the spatiotemporal encoder.

5. The method according to claim 4, characterized in that, The forward propagation based on the gradient inversion layer passes the first hidden representation and the second hidden representation to the bidirectional gated recurrent unit, including: In the forward propagation, the gradient reversal layer acts as an identity function, including: in, λ represents the first hidden representation or the second hidden representation, and λ>0 represents the hyperparameter.

6. The method according to claim 4, characterized in that, The step of adjusting the sequence length of the first hidden representation and the second hidden representation using a bidirectional gated loop unit to obtain the corresponding first aligned representation and second aligned representation includes: Nonlinear transformations are applied to each time step of the first and second hidden representations to perform feature enhancement processing, resulting in enhanced feature representations, including: This represents the activation function. and These are learnable parameters. This represents each time step of the first hidden representation or each time step of the second hidden representation; The enhanced feature representation is used to generate sequence-level features, including: Where |T| represents the trajectory length, which varies between trajectories; The forward hidden state of sequence-level features is captured by forward propagation using a bidirectional gated recurrent unit; and the backward hidden state of sequence-level features is captured by backward path using a bidirectional gated recurrent unit. By concatenating the forward hidden state and the backward hidden state, we obtain the corresponding first alignment representation and second alignment representation.

7. The method according to claim 1, characterized in that, The method further includes: Multiple trajectories are selected based on the target geographic space; where the target geographic space is used to represent the geographic space within a preset range corresponding to the planned trajectory. The target geographic space is divided into grids according to latitude and longitude, and the grid sequence number is obtained; The latitude and longitude of the trajectory points of multiple trajectories are mapped to the sequence number of the grid to obtain the grid number sequence of multiple trajectories, and the grid number sequence of multiple trajectories is configured as a trajectory set; The planned trajectory and trajectory set are encoded by a trained domain-adaptive multi-source irregular spatiotemporal similar trajectory search model, and the corresponding third and fourth hidden representations are obtained respectively. The similarity between the planned trajectory and each trajectory in the trajectory set is calculated based on the third and fourth hidden representations, and the similarity is ranked to obtain the similarity ranking. The trajectory with the highest similarity to the planned trajectory in the trajectory set is obtained based on the similarity ranking.

8. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to implement the method according to any one of claims 1 to 7 when executing the executable instructions.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device on which the storage medium is located to perform the method according to any one of claims 1 to 7.

10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 7.