Skip to content
AI.info

Research

MovSemCL: Movement-Semantics Contrastive Learning for Trajectory Similarity (Extension)

Overview Research area: Spatio-temporal data mining and representation learning, specifically self-supervised trajectory similarity computation over GPS data (filed under Computer Vision on arXiv, arX

arXiv
2511.12061
Published
2025-11-15
Authors
Zhichen Lai, Hua Lu, Huan Li, Jialiang Li, Christian S. Jensen

AI summary

Overview

Research area: Spatio-temporal data mining and representation learning, specifically self-supervised trajectory similarity computation over GPS data (filed under Computer Vision on arXiv, arXiv:2511.12061v2).

Technical level: Advanced. The paper assumes familiarity with Transformer attention, contrastive learning (MoCo), Node2Vec graph embeddings, and classical trajectory distance measures (EDR, EDwP, Hausdorff, Fréchet).

Scope (one sentence): This paper introduces MovSemCL, a contrastive learning framework that converts raw GPS trajectories into movement-semantics features, encodes them hierarchically with patch-based attention, and augments them with a curvature-guided masking strategy for faster and more accurate trajectory similarity computation.

What This Paper Is About

Trajectory similarity computation — quantifying how alike two GPS trajectories are — underpins clustering, prediction, anomaly detection, similarity search, route recommendation, and mobility prediction. Existing learning-based methods treat trajectories as flat sequences of raw coordinates, which means they miss movement dynamics and multi-scale structure, scale poorly when trajectories contain hundreds of points, and rely on augmentations (random masking, uniform sampling) that produce physically impossible trajectories with spatial jumps. The goal is a framework that captures movement semantics at multiple scales, runs efficiently on long trajectories, and augments data in a way that respects how vehicles actually move.

Key Contributions

  1. The MovSemCL framework — a movement-semantics contrastive learning framework for trajectory similarity computation that captures movement dynamics rather than only raw coordinates.

  2. Three interlocking components. Movement-semantics encoding captures rich movement semantics (addressing L1); hierarchical patch-based encoding reduces computational complexity from quadratic to near-linear (addressing L1 and L2); and curvature-guided augmentation (CGA) generates physically plausible, semantics-aware augmented views for robust learning (addressing L3).

  3. An extensive empirical evaluation on real-world data that the authors report shows up to 72.6% more accurate similarity search and 43.4% faster inference compared to state-of-the-art baselines (as stated in the introduction's contributions list).

  4. A public code release at https://github.com/ryanlaics/MovSemCL.

Main Findings

  • Near-ideal retrieval ranks (RQ1): Across database sizes from 20K to 100K, MovSemCL achieves the best mean rank on both datasets. On Porto it reports 1.002, 1.004, 1.005, 1.005, and 1.005; on Germany it reports 1.002, 1.003, 1.003, 1.005, and 1.008. The ideal rank is 1. For comparison, TrajCL reports 1.005/1.006/1.006/1.007/1.010 on Porto and 1.012/1.022/1.034/1.040/1.045 on Germany. CSTRM is marked OOM (out of memory) on all Germany settings.

  • Robustness to down-sampling (RQ2): With random point masking at rates ρ_s in [0.1, 0.5] and |D| = 100,000, MovSemCL reports the best results in most settings (Porto: 1.018, 1.098, 1.682, 1.961, 9.951; Germany: 1.001, 1.008, 1.080, 1.151, 1.265). TrajCL deteriorates sharply at higher rates (36.352 at 0.5 on Porto), and CLEAR is stable on Porto but degrades on Germany.

  • Robustness to distortion (RQ2): Under random coordinate shifts applied to a proportion ρ_d in [0.1, 0.5] of points, MovSemCL stays very close to rank 1 on both datasets — for example 1.004 to 1.006 on Porto and 1.007 to 1.008 on Germany.

  • Strong heuristic approximation (RQ3): After fine-tuning with a two-layer MLP head predicting EDR, EDwP, Hausdorff, and Fréchet distances, MovSemCL achieves an average rank of 1 across all measures. The paper reports improvements over TrajCL of 20.3% on EDR, 1.7% on Hausdorff, and 1.8% on Fréchet for HR@5. R5@20 scores exceed 0.95 for Hausdorff and Fréchet. Supervised baselines TrajSimVec, TrajGAT, and T3S rank lower on average.

  • Efficiency gains (RQ4): Under identical settings (embedding size 256, batch size 128, same hardware), MovSemCL cuts FLOPs from 158.69M to 93.34M (41.2%), reduces latency from 6.08 ms to 3.44 ms (43.4%), and raises throughput from 164.46 to 290.41 samples/s (76.6%) versus TrajCL. Per-sample latency stays stable at approximately 3.4 ms regardless of dataset size.

  • Ablation hierarchy (RQ5): Removing movement-semantics encoding (MSE) causes the largest degradation (Porto 20K: 1.521 vs. 1.002; Porto 100K: 3.045 vs. 1.005; Germany 20K: 1.595 vs. 1.002; Germany 100K: 4.122 vs. 1.008). Removing curvature-guided augmentation (CGA) gives moderate degradation (1.033, 1.098, 1.180, 1.234), while removing hierarchical semantics encoding (HSE) gives the smallest but still meaningful degradation (1.005, 1.012, 1.010, 1.039).

  • Hyperparameter guidance (RQ6): The model converges rapidly within 10 epochs and stays stable to 20 epochs without overfitting; gains plateau around 20K training trajectories; optimal embedding dimensionality falls in the 256–512 range; and patch size 4 performs best — smaller patches lack context and larger patches dilute movement semantics.

Methodology in Plain English

The framework has three stages.

Stage 1 — Turning GPS points into meaningful features. Raw longitude/latitude points are projected from WGS84 onto a plane using the Mercator projection and then normalized to the map region. For each point the method computes a displacement vector (how far and in which direction it moved from the previous point) and a heading angle. Separately, the map is divided into a grid (100 m cells for Porto, 1000 m for Germany), and a directed graph is built in which grid cells are nodes and edges represent observed transitions between consecutive cells, weighted by how often each transition occurs. Node2Vec is applied to this graph to learn a spatial embedding per cell. Each point's final representation concatenates the displacement components, the heading angle, and its cell embedding (d_in = 3 + d_se).

Stage 2 — Encoding at two scales. The feature sequence is cut into patches of length P (M = ⌈L/P⌉ patches). Self-attention runs inside each patch to capture local maneuvers, and masked average pooling summarizes each patch into a single vector. A second self-attention layer then runs across patch-level vectors to capture long-range/global trajectory intent. The final trajectory embedding is a masked average over patch outputs. This restructuring changes the attention complexity from O(L²) to O(L·P + M²): when L < P³ the O(L·P) term dominates and scaling is near-linear in length, otherwise the O(M²) term dominates. Padding and binary masks handle variable-length trajectories.

Stage 3 — Contrastive learning with sensible augmentations. Two augmented views of each trajectory form a positive pair, and other trajectories in the batch serve as negatives, following the MoCo framework with a dynamic queue of negative embeddings and an exponential moving average key encoder. The augmentation, curvature-guided augmentation (CGA), computes the turning angle at each interior point, normalizes those angles to [0, 1], and assigns each point a retention weight that combines a high endpoint weight (to preserve boundaries), a base weight (to keep some continuity), and a direction weight scaled by normalized curvature. Points are then sampled for masking with probability inversely proportional to their retention weight, so sharp turns and intersections are preferentially kept and straight, redundant stretches are preferentially dropped. CGA runs in linear time O(L).

Training setup. Patch size 4, embedding dimension 256, hidden dimension 256, 20 epochs with early stopping, Adam optimizer at learning rate 1e-4, batch size 128, temperature τ = 0.05, on NVIDIA RTX A6000 GPUs. The Porto evaluation uses a 200-thousand-trajectory subset and the full Germany dataset, split 70%/10%/20%, with trajectories outside 20–200 points excluded; 10 thousand test samples are reserved for heuristic approximation.

Why This Matters

Research impact. The paper reframes trajectory similarity as behavioral similarity rather than geometric alignment, and shows that semantics-aware augmentation matters more than augmentation volume. It also demonstrates that hierarchical patching can cut quadratic attention costs in a domain where long sequences are the norm, offering a template for other long-sequence spatio-temporal learning problems. The ablation ordering — movement semantics matters most, then augmentation, then hierarchy — is an actionable design signal for follow-up work.

Real-world applications (applications named in the paper):

  • Ride-sharing and logistics, where matching riders or shipments to routes depends on route similarity.
  • Urban analytics and urban planning, using similarity for clustering and pattern discovery over city-scale mobility.
  • Route recommendation, suggesting paths similar to routes a user or fleet has previously favored.
  • Mobility prediction and anomaly detection, where similar historical trajectories inform forecasts and flag unusual movements.

Industry relevance. Any organization that stores large GPS archives — mapping and navigation providers, delivery and ride-hailing fleets, telematics and insurance firms — faces the cost of point-wise encoding and quadratic attention on trajectories that often contain hundreds of points. Reported gains of 41.2% fewer FLOPs, 43.4% lower latency, and 76.6% higher throughput at higher accuracy translate directly into cheaper retrieval at scale. The paper's finding that gains plateau around 20K training trajectories also lowers the barrier for organizations with limited labeled data.

Future Directions

  • Testing the patch-based hierarchy on longer and higher-frequency sequences. The paper notes the complexity is near-linear only when L < P³, so how the method behaves on very long or densely sampled trajectories remains an open question explored only through the reported scalability analysis.

  • Examining whether curvature-guided augmentation transfers to other augmentation budgets and modalities. The paper reports results for one masking strategy versus random point masking in the ablation; how CGA interacts with other view-generation schemes is not reported.

  • Extending the approach beyond the two evaluated datasets. All results come from Porto and Germany, so generalization to other regions, transport modes (pedestrians, vessels, bikes), and sampling densities is not reported.

  • Investigating deployment properties more fully. The paper reports inference latency, throughput, and scaling with the number of trajectories, but does not report training cost, memory footprint, or index structures for retrieval at production scale, leaving these as open questions.

Target Audience

Researchers and graduate students working on spatio-temporal data mining, trajectory representation learning, and self-supervised contrastive learning; practitioners in mobility, logistics, and location-based services who need scalable trajectory retrieval; and engineers building similarity search or route-matching systems over large GPS archives. Readers should be comfortable with Transformer attention, contrastive objectives, and classical trajectory distance measures to get the most from the paper.

Authors’ abstract

Trajectory similarity computation is fundamental functionality that is used for, e.g., clustering, prediction, and anomaly detection. However, existing learning-based methods exhibit three key limitations: (1) insufficient modeling of trajectory semantics and hierarchy, lacking both movement dynamics extraction and multi-scale structural representation; (2) high computational costs due to point-wise encoding; and (3) use of physically implausible augmentations that distort trajectory semantics. To address these issues, we propose MovSemCL, a movement-semantics contrastive learning framework for trajectory similarity computation. MovSemCL first transforms raw GPS trajectories into movement-semantics features and then segments them into patches. Next, MovSemCL employs intra- and inter-patch attentions to encode local as well as global trajectory patterns, enabling efficient hierarchical representation and reducing computational costs. Moreover, MovSemCL includes a curvature-guided augmentation strategy that preserves informative segments (e.g., turns and intersections) and masks redundant ones, generating physically plausible augmented views. Experiments on real-world datasets show that MovSemCL is capable of outperforming state-of-the-art methods, achieving mean ranks close to the ideal value of 1 at similarity search tasks and improvements by up to 20.3% at heuristic approximation, while reducing inference latency by up to 43.4%.

Read the original paper