Zewei Zhang1 Jia Jun Cheng Xian2,3 Kaiwen Liu2,3 Ming Liang4 Hang Chu4 Jun Chen1 Renjie Liao2,3,5
A CUDA-capable GPU is recommended for training, inference, and benchmarking.
bash install_env.shIf you prefer manual installation, use
install_env.shas the source of truth for dependencies and environment setup.
The data and model checkpoints can be downloaded from the Hugging Face links above. After downloading them locally, update the paths in the three config files below.
configs/trajloom_vae_config.json: VAE configconfigs/trajloom_generator_config.json: future-trajectory generator configconfigs/vis_predictor_config.json: visibility predictor config
If you build your own cached trajectory latents, also recompute the latent statistics and update configs/vae_latent_stats.json accordingly.
Use the VAE reconstruction script first to verify that your trajectory data, visibility masks, and latent statistics are configured correctly. Replace the placeholder paths below with your local paths.
python "/path/to/TrajLoom/run_trajloom_vae_recon.py" \
--config "/path/to/TrajLoom/configs/trajloom_vae_config.json" \
--video_dir "/path/to/videos/" \
--video_glob "*.mp4" \
--gt_dir "/path/to/ground_truth/tracks/" \
--out_dir "/path/to/output/" \
--pred_len 81 \
--save_videoExpected output: reconstructed trajectories and/or visualizations saved to the output directory specified in the config.
Once the VAE setup is working, run the generator to predict future trajectories from observed history. Replace the placeholder paths below with your local paths.
python "/path/to/TrajLoom/run_trajloom_generator.py" \
--gen_config "/path/to/TrajLoom/configs/trajloom_generator_config.json" \
--gen_ckpt "/path/to/checkpoints/trajloom_generator.pt" \
--vis_config "/path/to/TrajLoom/configs/vis_predictor_config.json" \
--vis_ckpt "/path/to/checkpoints/visibility_predictor.pt" \
--video_dir "/path/to/videos/" \
--video_glob "*.mp4" \
--gt_dir "/path/to/ground_truth/tracks/" \
--out_dir "/path/to/output/" \
--pred_len 81Expected output: predicted future trajectories, visibility predictions, and rendered visualizations in the configured output directory.
After running the inference commands above, you can use the saved outputs in --out_dir to render qualitative results and compute benchmark metrics.
python -m benchmark.render_trajectory \
--root_dir "/path/to/benchmark_outputs/" \
--video_id <video_id> \
--out_dir "/path/to/render_outputs/<video_id>"python -m benchmark.compute_vae_recon_metrics \
--runs_root "/path/to/vae_recon_runs/" \
--out_json "/path/to/vae_recon_metrics.json"python -m benchmark.compute_trajectory_quality_metrics \
--runs_root "/path/to/trajectory_runs/" \
--use_visibility \
--out_json "/path/to/trajectory_quality_metrics.json"And compute FVMD with:
python -m benchmark.compute_fvmd_from_trajectory \
--runs_root "/path/to/fvmd_runs/" \
--clip_len 24 --clip_stride 1 \
--use_gt_visibility \
--out_json "/path/to/fvmd_tracks.json"TODO: training code will be released later.
Planned public training components:
- TrajLoom-VAE training
- TrajLoom-Flow training
We gratefully acknowledge What Happens Next? Anticipating Future Motion by Generating Point Trajectories (WHN) as the most important baseline for this work. Parts of our model implementation are adapted from their open-source code.
We thank AllTracker for providing the dense tracking system used to extract trajectories in our pipeline.
We also acknowledge FVMD: Fréchet Video Motion Distance for the motion-consistency metric formulation used in our evaluation.
@misc{zhang2026trajloomdensefuturetrajectory,
title={TrajLoom: Dense Future Trajectory Generation from Video},
author={Zewei Zhang and Jia Jun Cheng Xian and Kaiwen Liu and Ming Liang and Hang Chu and Jun Chen and Renjie Liao},
year={2026},
eprint={2603.22606},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2603.22606},
}