[Paper] [Project Page] [Poster]
This is the official code release for our NeurIPS 2025 paper "Towards Predicting Any Human Trajectory In Context".
Predicting accurate future trajectories requires adaptability, yet fine-tuning for each new scenario is often impractical for edge deployment. To address this, we introduce TrajICL, an In-Context Learning (ICL) framework for pedestrian trajectory prediction that enables robust adaptation to diverse environments at inference time without requiring weight updates.
Our TrajICL implementation includes the following key features:
- Spatio-Temporal Similarity-based Example Selection (STES): Selects relevant examples from observed trajectories by identifying similar motion patterns at corresponding locations within the same scene.
- Prediction-Guided Example Selection (PG-ES): Refines example selection by utilizing both past and predicted future trajectories to account for long-term dynamics.
- Superior Adaptation & Generalization: Leverages large-scale synthetic training to achieve remarkable adaptation, outperforming even fine-tuned approaches across in-domain and cross-domain benchmarks.
bash bash scripts/donwnload.shbash bash scripts/preprocess.shVTP checkpoints are saved in results/TrajICL.
python train.pyFor load_model.model_path, please specify the relative path (inside the results/TrajICL directory) to the checkpoint saved during VTP training.
Example: If the full path is results/TrajICL/robust-sunset-33/best_val_checkpoint.pth.tar, you should set load_model.model_path to robust-sunset-33/best_val_checkpoint.pth.tar.
python train.py -m training.epochs=400 training.warmup_steps=12 dataset.num_example=8 load_model.model_path=robust-sunset-33/best_val_checkpoint.pth.tar
⚠️ Note: The pathrobust-sunset-33/best_val_checkpoint.pth.tarshown in the -m option above is just an example. Please modify this value to match the actual checkpoint path generated after running the VTP training (Step 1).
python eval.pyWe sincerely thank the authors of Social-Transmotion for providing their source code, which has been invaluable to our work. We are immensely grateful for their contribution.
If you use this code for your research, please cite our paper.
@inproceedings{
fujii2026towards,
title={Towards Predicting Any Human Trajectory In Context},
author={Ryo Fujii and Hideo Saito and Ryo Hachiuma},
booktitle={The Thirty-ninth Annual Conference on Neural Information Processing Systems},
year={2026},
url={https://openreview.net/forum?id=qB1UKvjO0N}
}