CrowdNav with Social-NCE

This is an official implementation for the paper

Social NCE: Contrastive Learning of Socially-aware Motion Representations
by Yuejiang Liu, Qi Yan, Alexandre Alahi at EPFL
to appear at ICCV 2021

TL;DR: Contrastive Representation Learning + Negative Data Augmentations ­čí▓ Robust Neural Motion Models

Please check out our code for experiments on different models as follows:
Social NCE + CrowdNav | Social NCE + Trajectron | Social NCE + STGCNN


Setup environments follwoing the

Training & Evaluation

  • Behavioral Cloning (Vanilla)

    python --contrast_weight=0.0 --gpu
    python --policy='sail' --circle --model_file=data/output/imitate-baseline-data-0.50/policy_net.pth
  • Social-NCE + Conventional Negative Sampling (Local)

    python --contrast_weight=2.0 --contrast_sampling='local' --gpu
    python --policy='sail' --circle --model_file=data/output/imitate-local-data-0.50-weight-2.0-horizon-4-temperature-0.20-nboundary-0-range-2.00/policy_net.pth
  • Social-NCE + Safety-driven Negative Sampling (Ours)

    python --contrast_weight=2.0 --contrast_sampling='event' --gpu
    python --policy='sail' --circle --model_file=data/output/imitate-event-data-0.50-weight-2.0-horizon-4-temperature-0.20-nboundary-0/policy_net.pth
  • Method Comparison

    bash script/ && bash script/ && bash script/
    python utils/

Basic Results

Results of behavioral cloning with different methods.

Averaged results from the 150th to 200th epochs.

collision reward
Vanilla 12.7% ┬▒ 3.8% 0.274 ┬▒ 0.019
Local 19.3% ┬▒ 4.2% 0.240 ┬▒ 0.021
Ours 2.0% ┬▒ 0.6% 0.331 ┬▒ 0.003


If you find this code useful for your research, please cite our papers:

  title   = {Social NCE: Contrastive Learning of Socially-aware Motion Representations},
  author  = {Yuejiang Liu and Qi Yan and Alexandre Alahi},
  journal = {arXiv preprint arXiv:2012.11717},
  year    = {2020}
    title={Crowd-Robot Interaction: Crowd-aware Robot Navigation with Attention-based Deep Reinforcement Learning},
    author={Changan Chen and Yuejiang Liu and Sven Kreiss and Alexandre Alahi},