Skip to content
/ ECAM Public

Official code for "ECAM: A Contrastive Learning Approach to Avoid Environmental Collision in Trajectory Forecasting" (IJCNN 2025)

License

Notifications You must be signed in to change notification settings

CVML-CFU/ECAM

Repository files navigation

ECAM: A Contrastive Learning Approach to Avoid Environmental Collision in Trajectory Forecasting

Giacomo Rosin · Muhammad Rameez Ur Rahman · Sebastiano Vascon
IJCNN 2025
Paper

ECAM (Environmental Collision Avoidance Module) is a contrastive learning-based module to enhance environmental collision avoidance ability of trajectory forecasting models. It can be integrated into existing models, improving their ability to generate collision-free trajectories, with zero overhead during inference.


ECAM qualitative comparison
ECAM diagram

Setup

Clone the repository

git clone https://github.com/CVML-CFU/ECAM.git
cd ECAM

Install the required packages

First create a virtual environment with Python 3.11, eg. with uv:

uv venv --python 3.11
source .venv/bin/activate

Then install the required packages. We provide two different requirements files, one for CPU only and one for GPU (CUDA). Choose the one that fits your setup.

CPU only

pip install -r requirements-cpu.txt

GPU (cuda)

pip install -r requirements-cuda.txt

Download the additional data

Download the additional data required for the experiments.

./SingularTrajectory/script/download_extra.sh

Run the model

First, change into the SingularTrajectory directory:

cd SingularTrajectory

Train

To train the model, run the following command:

./script/train.sh -p CONFIG_PREFIX -t TAG -d {eth|hotel|univ|zara1|zara2|sdd|pfsd|thor} -v {orig|map|ecam} -g {cpu|gpu}"

Example:

./script/train.sh -p stochastic/singulartrajectory -t SingularTrajectory-stochastic -d "eth" -v ecam -g gpu

Test

To test the model, run the following command:

./script/test.sh -p CONFIG_PREFIX -t TAG -d {eth|hotel|univ|zara1|zara2|sdd|pfsd|thor} -v {orig|map|ecam} -g {cpu|gpu}"

Example:

./script/test.sh -p stochastic/singulartrajectory -t SingularTrajectory-stochastic -d "eth" -v ecam -g gpu

Acknowledgements

This work builds upon code from the SingularTrajectory, EigenTrajectory, Social-NCE, and AgentFormer repositories. We sincerely thank the respective authors for making their implementations and models available.

About

Official code for "ECAM: A Contrastive Learning Approach to Avoid Environmental Collision in Trajectory Forecasting" (IJCNN 2025)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •