# Social GAN: Socially Acceptable Trajectories with Generative Adversarial Networks

Social GAN learns several socially acceptable pedestrian paths with adversarial training

Agrim Gupta, Justin Johnson, Li Fei-Fei, Silvio Savarese, Alexandre Alahi · arXiv · 2018-3-29

- **Problem** Pedestrian path forecasts must cover several plausible futures for everyone in a scene. Standard L2 training pulls predictions toward an average behavior, so the forecasts blur together.
- **Method** Social GAN trains an encoder-decoder generator against a recurrent discriminator. It pools information across people with an MLP and max-pooling module, and a variety loss penalizes only the closest of k sampled futures.
- **Results** With 20 samples, SGAN 20V-20 reaches an AVG ADE of 0.39 at 8 time steps, against 0.45 for S-LSTM, in leave-one-out evaluation on ETH and UCY.

## Why averaged pedestrian forecasts fall short

Forecasting a pedestrian's path is hard because the path depends on the people nearby, and one observed history rarely fixes a single future. Some paths are physically possible yet socially unacceptable, so a forecast has to respect norms that are hard to write down.

Earlier work covered parts of this problem. Hand-crafted interaction models captured the influence of other people, and recurrent networks were later used to learn social acceptability. The existence of several futures was mostly studied as a choice of route through a fixed scene.

The authors identify two shortcomings in existing methods: each person is modeled only within a local neighborhood, and the usual Euclidean training loss drives predictions toward an average behavior. The study asks whether a generative adversarial model can produce several acceptable futures for all people in a scene at once.

## Casting forecasting as a GAN problem

A GAN trains two networks against each other: a generator maps a latent variable z to a sample, and a discriminator estimates whether a sample came from the training data. The two networks play a min-max game with the following objective: \\\[ \\min\_G \\max\_D V(G,D) = \\mathbb{E}\_{x\\sim p\_{data}(x)}\[\\log D(x)\] + \\mathbb{E}\_{z\\sim p(z)}\[\\log(1-D(G(z)))\] \\\] The generator is minimized over and the discriminator is maximized over.

In Social GAN the discriminator is meant to learn social interaction rules and to label trajectories that are not socially acceptable as fake.

The adversarial term is what lets the model go beyond an L2 objective, since it can learn a distribution of behaviors that the discriminator cannot separate from the data. Generation is conditioned on the observed past, so the samples are meant to stay consistent with what was already seen rather than being unconstrained motion.

The model has three parts: an encoder-decoder generator, a pooling module that links the encoder and decoder hidden states, and a discriminator with its own recurrent encoder. The discriminator receives either the observed past with the ground-truth future, or the observed past with the predicted future, and returns a real or fake decision.

## How the generator encodes and decodes histories

Each person's coordinates are embedded by a single-layer MLP with ReLU, and the embedding is fed to an LSTM encoder whose weights are shared across all people in the scene. The encoder recurrence is \\\[ e\_i^t = \\phi(x\_i^t, y\_i^t; W\_{ee}), \\quad h\_{ei}^t = LSTM(h\_{ei}^{t-1}, e\_i^t; W\_{encoder}) \\\] where phi is the embedding function with ReLU and W\_ee its weights.

Sharing the encoder weights keeps one recurrent model for every person, and the pooling step runs after the observation window to produce a pooled tensor P\_i for each person. The decoder starts from the pooled context and a latent sample: \\\[ c\_i^t = \\gamma(P\_i, h\_{ei}^t; W\_c), \\quad h\_{di} = \[c\_i^t, z\] \\\] where gamma is an MLP with ReLU.

The authors depart from prior work in two places. Earlier models predicted the parameters of a bivariate Gaussian, which makes training harder because the sampling step is not differentiable. Here the coordinates are predicted directly. The pooled context enters the decoder once instead of being given to the LSTM at every step, which lets pooling run at chosen time steps and gives the 16x speed-up over S-LSTM in Table 2.

At each prediction step the decoder embeds the previous position, recomputes the pooled vector from the decoder states, and updates its LSTM before an MLP returns the new coordinates. The decoder update is \\\[ h\_{di}^t = LSTM(\\gamma(P\_i, h\_{di}^{t-1}), e\_i^t; W\_{decoder}), \\quad (\\hat{x}\_i^t, \\hat{y}\_i^t) = \\gamma(h\_{di}^t) \\\]

## Sharing information across people

Two requirements shape the design: the number of people varies and may be large, and people far away can still matter, so the network needs a view of the whole configuration.

Social pooling from prior work answers the first requirement with a grid, which the authors describe as hand-crafted, slow and unable to capture global context. The replacement passes each person's hidden state, concatenated with relative positions to the person being predicted, through an MLP, and then combines the results with element-wise max-pooling.

The authors use relative coordinates for translation invariance and add each person's relative position with respect to person i to the module input. Because the module does not restrict interactions to a grid, it can relate every pair of people in the scene.

## Sampling several futures and keeping the closest

For each scene, k latent samples are drawn from N(0,1), each sample gives one candidate future, and only the candidate closest in L2 distance to the ground truth is penalized. The loss is \\\[ L\_{variety} = \\min\_k \\lVert Y\_i - \\hat{Y}\_i^{(k)} \\rVert\_2 \\\] so the minimum runs over the k candidates for person i, and the L2 distance is taken between the ground-truth future and each candidate.

The other candidates receive no penalty, so they can take other plausible paths instead of collapsing onto one average path. The authors argue that this spreads the output distribution. The authors note that the loss resembles a minimum-over-N loss from prior work, and say that to their knowledge it had not been used with GANs to encourage diverse samples.

The variant notation SGAN-kVP-N records k, whether the variety loss and the pooling module were used, and N, the number of samples drawn at test time, from which the best candidate in L2 sense is kept for scoring.

## Training and evaluation setup

Experiments use ETH and UCY, which give 5 sets across 4 scenes with 1536 pedestrians in crowded settings. Trajectories were converted to real-world coordinates and interpolated to values every 0.4 seconds.

Evaluation is leave-one-out: four sets are used for training and the remaining set for testing. The model observes 8 time steps (3.2 seconds) and is scored on predictions of 8 steps (3.2 seconds) and 12 steps (4.8 seconds).

ADE is the average L2 distance between ground truth and prediction over all predicted time steps, and FDE is the distance between the predicted and true final positions at the end of the prediction period. The baselines are a linear regressor fit by least squares, an LSTM without a pooling mechanism, and S-LSTM, in which each person's LSTM hidden states are pooled at every time step.

## Accuracy on ETH and UCY

The linear baseline is limited to straight paths and degrades most for the 12-step predictions. In the AVG ADE row, the LSTM scores 0.43 and 0.70 and the S-LSTM 0.45 and 0.72 for 8 and 12 steps, in meters, with the Linear baseline at 0.54 and 0.79. The authors say S-LSTM does not outperform the LSTM in their runs, even after they tried to reproduce the original S-LSTM results.

The authors note that the original S-LSTM was trained on synthetic data and then fine-tuned on real data, and that none of their own models use synthetic data.

The one-sample variant SGAN 1V-1 has AVG ADE 0.49 and 0.74, which is worse than the LSTM, and the authors explain this by each sample being only one of several possible futures. With 20 samples and the variety loss, SGAN 20V-20 reaches AVG ADE 0.39 and 0.58 and AVG FDE 0.78 and 1.18 at 8 and 12 steps, against 0.45 and 0.72 ADE and 0.91 and 1.54 FDE for S-LSTM.

The pooling variant SGAN 20VP-20 scores AVG ADE 0.41 and 0.61 and AVG FDE 0.81 and 1.21, so SGAN is slightly ahead of SGAN-P on these averages.

In the Figure 4 comparison on ETH, ZARA1 and ZARA2, models trained with the variety loss are reported as 33% better at k = 100 than models that draw more samples without it. Drawing more samples from a model trained without the variety loss does not lead to better accuracy.

## Prediction time against S-LSTM

At 8 time steps SGAN-P takes 0.12 seconds and S-LSTM 1.79 seconds, and at 12 steps 0.15 and 2.61 seconds, on a Tesla P100 GPU. Under the same timing table, the LSTM takes 0.02 and 0.03 seconds and SGAN takes 0.04 and 0.05 seconds.

The authors attribute the gap to S-LSTM pooling at every time step and computing an occupancy grid for each pedestrian, while their module is an MLP followed by max-pooling. The timing table gives a 16x speed-up for SGAN-P over S-LSTM.

These timings are a separate measurement from the accuracy comparison in Table 1, and they were taken on one GPU.

## Pooling against no pooling in interaction scenarios

The authors add a qualitative test because the average scores of SGAN and SGAN-P are close. They build four synthetic scenarios: two people meeting, one person meeting a group, one person behind another, and two people meeting at an angle. For each setup they draw 300 samples from the model and plot their density and mean.

When two people head in the same direction, SGAN-P yields to the right while SGAN predicts a collision. SGAN-P also keeps a couple walking together while avoiding a group, which SGAN does not do. In the behind-another case, SGAN-P has person G overtaking from the right, while SGAN gives no acceptable path, and in the angled meeting person B is predicted to slow for person G.

Three real-world situations in Figure 6 cover merging people, groups avoiding each other and person following, and the samples are shown for inspection rather than scored. In the latent space, certain directions are associated with direction of travel and with speed.

## Limitations

The qualitative pooling evidence rests on four scenarios the authors constructed synthetically, although the models were trained on real-world data. Social GAN is trained on real-world trajectories only, without synthetic pretraining.

The quantitative scores take the best of several samples against the ground truth at test time, so they measure the best candidate rather than a single draw. The single-sample variant did not capture all possible scenarios, which the authors connect to mode collapse, where the generator produces a few high-scoring samples.

The ADE and FDE values are single numbers per dataset and horizon, with no variance reported. Speed was measured on one GPU, a Tesla P100.

The authors' case for pooling rests mainly on the qualitative scenarios, since the 20VP-20 variant is slightly behind 20V-20 on the averages. The authors also note that the model has access to the ground-truth positions of all people at pooling time, which a real pedestrian does not.

## Paper info

- **Authors**: Agrim Gupta, Justin Johnson, Li Fei-Fei, Silvio Savarese, Alexandre Alahi
- **Venue**: arXiv · Preprint
- **First published**: 2018-3-29
- **Added**: 2026-11-12
- **Updated**: 2018-3-29
- **Version**: v1
- **arXiv**: 1803.10892
- **Category**: cs.CV
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1803.10892v1) · [PDF ↗](https://arxiv.org/pdf/1803.10892v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Agrim Gupta, Justin Johnson, Li Fei-Fei, Silvio Savarese, Alexandre Alahi (2018). Social GAN: Socially Acceptable Trajectories with Generative Adversarial Networks. arXiv:1803.10892v1. https://arxiv.org/abs/1803.10892v1

**BibTeX**

```
@misc{gupta2018social,
  title = {{Social GAN: Socially Acceptable Trajectories with Generative Adversarial Networks}},
  author = {Agrim Gupta and Justin Johnson and Li Fei-Fei and Silvio Savarese and Alexandre Alahi},
  year = {2018},
  eprint = {1803.10892},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1803.10892v1}
}
```

## Other paper commentary

- [Unsupervised Anomaly Detection with Generative Adversarial Networks to Guide Marker Discovery](https://refivu.com/en/papers/62959e97-b421-4e00-897e-8709c817c9fb-unsupervised-anomaly-detection-with-generative-adversarial.md)
- [Generative Adversarial Text to Image Synthesis](https://refivu.com/en/papers/e3b168a4-0572-44b9-b18e-ca2f31dfdc4a-generative-adversarial-text-to-image-synthesis.md)
- [Adversarial Autoencoders](https://refivu.com/en/papers/8e20edb4-f017-4781-86f9-478c6059260f-adversarial-autoencoders.md)
- [Stable Video Diffusion: Scaling Latent Video Diffusion Models to Large Datasets](https://refivu.com/en/papers/82291bd9-5c41-4b81-bfde-a025a948f4b9-stable-video-diffusion-scaling-latent-video-diffusion-models.md)
- [Ensemble Adversarial Training: Attacks and Defenses](https://refivu.com/en/papers/c363c126-7d65-4e0a-aa01-0b7a02e39200-ensemble-adversarial-training-attacks-and-defenses.md)
- [Virtual Adversarial Training: A Regularization Method for Supervised and Semi-Supervised Learning](https://refivu.com/en/papers/e553048e-8e0b-413a-97b2-7c98f997c30c-virtual-adversarial-training-a-regularization-method-for.md)
- [CatBoost: gradient boosting with categorical features support](https://refivu.com/en/papers/8cd656c3-e110-48b3-a81f-5afaaf394ed3-catboost-gradient-boosting-with-categorical-features-support.md)
- [Deep Reinforcement Learning for Autonomous Driving: A Survey](https://refivu.com/en/papers/83c5fd0f-2d6a-46a6-9cf3-2c713669425c-deep-reinforcement-learning-for-autonomous-driving-a-survey.md)
- [Hyperparameters and Tuning Strategies for Random Forest](https://refivu.com/en/papers/bd438638-5e53-476f-bacd-11a4982c1650-hyperparameters-and-tuning-strategies-for-random-forest.md)
- [NLTK: The Natural Language Toolkit](https://refivu.com/en/papers/26e265b2-45d0-4d0e-b6a7-a161ecf1fe09-nltk-the-natural-language-toolkit.md)
- [One pixel attack for fooling deep neural networks](https://refivu.com/en/papers/d5d76088-1786-441c-91fa-bf247a220946-one-pixel-attack-for-fooling-deep-neural-networks.md)
- [Self-training with Noisy Student improves ImageNet classification](https://refivu.com/en/papers/57e759e6-5034-4019-9e65-3fac466f7c21-self-training-with-noisy-student-improves-imagenet.md)

## Terms in this paper

- [LSTM](https://refivu.com/en/terms/ba10547646d9-lstm)
- [generator](https://refivu.com/en/terms/2935313c9c21-generator)
- [discriminator](https://refivu.com/en/terms/4e47ae7741de-discriminator)
- [adversarial loss](https://refivu.com/en/terms/6ecebb64a13d-adversarial-loss)
- [max-pooling](https://refivu.com/en/terms/c2bc224c5125-max-pooling)
- [generative adversarial network](https://refivu.com/en/terms/86597eed7832-generative-adversarial-network)
- [mode collapse](https://refivu.com/en/terms/e27d78160694-mode-collapse)
- [latent variable](https://refivu.com/en/terms/6dc3c308357f-latent-variable)
- [Linear](https://refivu.com/en/terms/de137eb99670-linear)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/134b8b94-f72a-441a-8ec1-4b871085c3e5-social-gan-socially-acceptable-trajectories-with-generative)
