Diff-RNTraj: A Structure-Aware Diffusion Model for Road Network-Constrained Trajectory Generation

Tonglong Wei, Youfang Lin, Shengnan Guo, Yan Lin, Yiheng Huang, Chenyang Xiang, Yuqing Bai, Huaiyu Wan · DOI

Introduction: The "Off-Road" Challenge

Vehicle trajectory generation is a critical component for applications ranging from urban planning to autonomous driving simulation. Traditionally, models based on Generative Adversarial Networks (GANs) or Variational Autoencoders (VAEs) treat trajectories as sequences of independent GPS coordinates (latitude and longitude). However, this "free-space" approach often results in "off-road" points—generated locations that land in buildings or water bodies because the model lacks awareness of the underlying road network.

To rectify this, practitioners typically employ a two-stage pipeline: first generating raw GPS points and then using map-matching algorithms to snap those points to the nearest road segments. This process is not only computationally expensive but also highly sensitive to the quality of the initial generation; poor GPS points can lead to nonsensical, "teleporting" paths during the matching phase.

Comparison of traditional two-stage trajectory generation vs. the proposed end-to-end RNTraj approach.

Methodology: The Diff-RNTraj Framework

The authors propose Diff-RNTraj, an end-to-end generative framework that directly produces Road Network-constrained Trajectories (RNTraj). By shifting the representation from raw coordinates to a hybrid of discrete road segments and continuous progress, the model inherently respects the physical constraints of the urban environment.

RNTraj Representation

Instead of $(lat, lon)$ pairs, each trajectory point is represented as $(e, r)$, where $e$ denotes a discrete road segment ID and $r$ represents the "moving rate"—the percentage of the segment's length traversed by the vehicle.

Vectorization and the UTGraph

To bridge the gap between discrete road IDs and the continuous nature of diffusion models, the framework utilizes a User Trajectory Graph (UTGraph). Unlike standard road network graphs based solely on physical intersections, the UTGraph is constructed from actual transition frequencies in real-world data. This captures behavioral constraints, such as one-way streets or common traffic patterns. Road segments are then embedded into a continuous vector space using Node2vec, allowing the diffusion model to process them effectively.

The overall framework of Diff-RNTraj, including vectorization, the diffusion module, and the RNTraj decoder.

Diffusion Module and RDCL

The core of the model is a continuous diffusion process. It begins with Gaussian noise and iteratively refines it into a vectorized trajectory. The denoising network is built upon Residual Dilation Convolutional Layers (RDCL), which are specifically designed to capture the long-range temporal dependencies inherent in vehicle movement.

To further ensure physical realism, the authors introduced a Spatial Validity Loss. This loss function penalizes the generation of transitions between road segments that are unreachable in the real-world connectivity graph, effectively teaching the model the "rules of the road."

Datasets and Evaluation

Diff-RNTraj was evaluated using two large-scale, real-world taxi datasets:

  1. Porto: Data from 442 taxis in Porto, Portugal, totaling approximately 537,000 trajectories.
  2. Chengdu: Didi taxi data from Chengdu, China, comprising roughly 527,000 trajectories. Road network data for both cities was extracted from OpenStreetMap using the osmnx tool.

Key Results and Insights

The experimental results demonstrate that Diff-RNTraj significantly outperforms state-of-the-art baselines like EETG and TrajGAN.

  • Enhanced Realism: The model achieved an average improvement of 55% on the Porto dataset and 33% on the Chengdu dataset in terms of Jensen-Shannon Divergence (JSD) across distance and density metrics.
  • Superior Connectivity: A new metric, Road Segment Connectivity (RSC), was used to measure the legality of generated moves. Diff-RNTraj maintained a connectivity score of over 91%, whereas VAE and GAN-based models often struggled to exceed 30% without external map-matching.
  • Efficiency Gains: Despite the iterative nature of diffusion sampling, Diff-RNTraj is faster in a full production pipeline because it eliminates the need for the computationally intensive Hidden Markov Model (HMM)-based map-matching step.

Conclusion and Future Directions

Diff-RNTraj represents a significant step forward in trajectory generation by integrating topological constraints directly into the generative process. By moving away from free-space GPS generation, it provides a more reliable and efficient tool for downstream applications like navigation and traffic simulation.

Future work may explore conditional guidance to allow for the generation of trajectories based on specific parameters (e.g., time of day or starting location) and investigate consistency models to further reduce the number of denoising steps required for real-time generation.

Summary updated

BibTeX
@article{wei2024diff,
  author = {Tonglong Wei and Youfang Lin and Shengnan Guo and Yan Lin and Yiheng Huang and Chenyang Xiang and Yuqing Bai and Huaiyu Wan},
  title = {{Diff-RNTraj: A Structure-Aware Diffusion Model for Road Network-Constrained Trajectory Generation}},
  journal = {IEEE Trans. Knowl. Data Eng.},
  year = {2024},
  doi = {10.1109/tkde.2024.3460051},
}
Figure