Convolutional Transformer based Dual Discriminator Generative Adversarial Networks for Video Anomaly Detection

Xinyang Feng, Dongjin Song, Yuncong Chen, Zhengzhang Chen, Jingchao Ni, Haifeng Chen

TL;DR

CT-D2GAN is a novel unsupervised framework for video anomaly detection that uses a Convolutional Transformer to predict future video frames. By combining temporal self-attention with a dual discriminator strategy (one for image quality and one for temporal flow), the model identifies anomalies based on high prediction errors, achieving state-of-the-art performance on major benchmarks while running at real-time speeds.

What Problem Does This Paper Address?

Detecting "abnormal" activities in surveillance footage—like a bicycle on a pedestrian path or someone throwing an object—is notoriously difficult. Anomalies are rare, diverse, and often context-dependent, making it nearly impossible to collect a representative labeled dataset for supervised learning.

Current unsupervised methods typically try to learn "normal" patterns and flag anything that deviates. However, existing approaches like Convolutional Autoencoders (Conv-AE) often ignore temporal dynamics, while Recurrent Neural Networks (like ConvLSTMs) can be computationally expensive and difficult to interpret. Furthermore, many models fail to balance local consistency (does the predicted frame look like a real image?) with global coherence (does the movement make sense over time?).

Methods

The authors introduce CT-D2GAN, which stands for Convolutional Transformer based Dual Discriminator Generative Adversarial Networks. The architecture consists of two main parts:

1. The Convolutional Transformer Generator

Instead of relying on recurrence (RNNs), this generator uses a transformer-based architecture to predict the next frame ($t+1$) based on the previous $T$ frames.

  • Convolutional Encoder: Extracts spatial features from each input frame.
  • Temporal Self-Attention Module: This is the core innovation. It uses Global Average Pooling (GAP) and positional encodings to calculate how much each historical frame should contribute to the prediction of the next one.
  • Spatial Selective Gate (SSG): Since GAP loses fine-grained spatial details, the SSG acts as a spatial attention mechanism to re-integrate high-resolution information before the final decoding.
  • Convolutional Decoder: Reconstructs the predicted future frame.
The CT-D2GAN architecture showing the generator (top) and dual discriminators (bottom).

2. Dual Discriminator GAN

To ensure the predicted frame is both high-quality and temporally logical, the authors use two discriminators:

  • 2D Image Discriminator: Critiques a single frame to ensure local consistency and sharpness.
  • 3D Video Discriminator: Critiques a sequence of frames to ensure the predicted frame fits the global temporal dynamics of the video.

Anomalies are detected during inference by calculating the Regularity Score. If the model (which was only trained on "normal" data) produces a large prediction error for a frame, that frame is flagged as abnormal.

Datasets

The model was evaluated on three standard public benchmarks:

  • UCSD Ped2: Pedestrian walkways with anomalies like bikers, skaters, and small vehicles.
  • CUHK Avenue: A campus setting featuring anomalies like running, loitering, and throwing objects.
  • ShanghaiTech: A large-scale, multi-scene dataset that is significantly more challenging due to its complexity and diverse viewpoints.

Key Insights and Ideas

  • Attention vs. Recurrence: The shift to a transformer architecture allows the model to capture long-range temporal dependencies more efficiently than LSTMs, while also being easier to parallelize.
  • Robustness to Noise: The self-attention mechanism is remarkably robust. When the authors intentionally perturbed input frames with noise or distorted frame rates, the attention weights for those frames dropped significantly, showing the model "knows" to ignore unreliable data.
  • The Power of Two: Ablation studies showed that while the video discriminator is the most critical for performance, the dual-discriminator setup provides the most stable training and the highest accuracy.
Visualization of attention weights dropping when frames are perturbed with noise or distortion.

Key Results

CT-D2GAN achieved state-of-the-art (SOTA) results on two of the three datasets and performed competitively on the third:

  • UCSD Ped2: 97.2% AUC (Area Under the Curve).
  • ShanghaiTech: 77.7% AUC (a significant jump over previous baselines).
  • Efficiency: The model runs at 45 FPS on a single NVIDIA GeForce 1080 Ti, making it suitable for real-time surveillance applications.
Comparison of CT-D2GAN against baseline methods across three datasets.

Qualitatively, the model shows a sharp drop in regularity scores exactly when an anomaly (like a cyclist) enters the frame, as shown in the line graphs below.

Examples of anomaly detection results. Blue lines show regularity scores; red shaded areas indicate ground-truth anomalies.

Limitations and Future Work

While the model performs well, the authors note that the ShanghaiTech dataset remains a challenge due to its multi-scene nature and unbalanced training data. Generalizing to scenes with very few training examples is still an open problem.

The authors suggest that future work could involve integrating memory modules or clustering-enhanced methods, which are complementary to their transformer approach and could further boost the model's ability to represent complex "normal" patterns.

Summary updated

BibTeX
@inproceedings{feng2021convolutional,
  author = {Xinyang Feng and Dongjin Song and Yuncong Chen and Zhengzhang Chen and Jingchao Ni and Haifeng Chen},
  title = {{Convolutional Transformer based Dual Discriminator Generative Adversarial Networks for Video Anomaly Detection}},
  booktitle = {ACM Multimedia},
  year = {2021},
  url = {https://openreview.net/forum?id=xtP0h31n-Rq},
}
Figure