dendorferpatrick / GoalGAN

MIT License
47 stars 15 forks source link

GoalGAN

This repository provides the official PyTorch Lightning implementation of Goal-GAN, presented at ACCV 2020(Oral)

Goal-GAN: Multimodal Trajectory Prediction Based on Goal Position Estimation
Patrick Dendorfer, Aljoša Ošep, Laura Leal-Taixé

Motivation

In this paper, we present Goal-GAN, an interpretable and end-to-end trainable model for human trajectory prediction. We model the task of trajectory prediction as an intuitive two-stage process: (i) goal estimation, which predicts the most likely target positions of the agent, followed by a (ii) routing module, which estimates a set of plausible trajectories that route towards the estimated goal. We leverage information about the past trajectory and visual context of the scene to estimate a multimodal probability distribution over the possible goal positions, which is used to sample a potential goal during the inference.

Model

Our model consists of three key components: Motion Encoder (ME), Goal Module (GM), and Routing Module (RM).

The model is trained with an adversarial loss for which the discriminator classifies the predictions as 'real/fake' by considering input trajectory, prediction, and visual input of the scene.

Visualizing Multimodality

Below we show an examples of predictions made by our model in multimodal scenarios. We demontrate the probability map as heatmap and the sampled intermediate goal. The decoder is conditioned on the estitimated goal and generates the trajectory denotey by triangles.

Reference

If you use this code for your research, please cite our work:

@inproceedings{dendorfer2020accv,
  title={Goal-GAN: Multimodal Trajectory Prediction Based on Goal Position Estimation}, 
  author={Patrick Dendorfer and Aljoša Ošep and Laura Leal-Taixé},
  year={2020},
  booktitle={Asian Conference on Computer Vision},
  }

Setup

All code was developed and tested with Python 3.6.3, PyTorch 1.6.0., and PyTorch-Lightning 0.9.0.

You can setup a virtual environment and install the required packages:

pip install -r requirements.txt   # Install dependencies

Training Models

To train your models set up the config yaml files in the config folder, adjusting the Hyperparameters. To start the training run:

python run.py

You can also change the configuration by directly typing into the command line, e.g.:

python run.py batch_size=64 lr_scheduler_G=1e-4

The training process and models are saved and logged with tensorboard. The final model performance is evaluated on the test set and save in 'results.pt'. You can use this script writing all results into a csv in resultCSV.

Synthetic Dataset

Trajectories in Dataset Feasible Area

To train our model and demonstrate its ability to learn a distribution of feasible goal positions we create a synthetic dataset. We generate trajectories using the Social Force Model (Helbing & Molar, 98) in the hyang 4 scene of the SDD dataset. To ensure the feasibility of the generated trajectories, we use a two-class (manually labeled) semantic map, that distinguishes between feasible (walking paths) from unfeasible (grass) areas. We simulate 1300 trajectories approaching and passing the two crossroads in the scene and split them into train (800), validation (200), and test (300) sets. We use the pixel-world correspondences data provided by the authors of SoPhie.

Data Format

To run or re-train the model with new data provide the trajectories in a txt file with the following format:

<frame_id>, <ped_id>, <x>, <y>

As well as RGB images of the corresponding scene in the dataset folder.

Contact

If you find any bugs or have any questions, please open an issue or contact me via mail (patrick.dendorfer@tum.de).