Future Frame Prediction for Anomaly Detection - A New Baseline

Wen Liu, Weixin Luo, Dongze Lian, Shenghua Gao

Abstract: Anomaly detection in videos refers to the identification of events that do not conform to expected behavior. However, almost all existing methods tackle the problem by minimizing the reconstruction errors of training data, which cannot guarantee a larger reconstruction error for an abnormal event. In this paper, we propose to tackle the anomaly detection problem within a video prediction framework. To the best of our knowledge, this is the first work that leverages the difference between a predicted future frame and its ground truth to detect an abnormal event. To predict a future frame with higher quality for normal events, other than the commonly used appearance (spatial) constraints on intensity and gradient, we also introduce a motion (temporal) constraint in video prediction by enforcing the optical flow between predicted frames and ground truth frames to be consistent, and this is the first work that introduces a temporal constraint into the video prediction task. Such spatial and motion constraints facilitate the future frame prediction for normal events, and consequently facilitate to identify those abnormal events that do not conform the expectation. Extensive experiments on both a toy dataset and some publicly available datasets validate the effectiveness of our method in terms of robustness to the uncertainty in normal events and the sensitivity to abnormal events.

Introduction

Anomaly detection in surveillance is a critical yet challenging task because "abnormal" events are inherently unbounded and rare. Traditionally, researchers have relied on reconstruction-based methods, such as Auto-Encoders, under the assumption that a model trained only on normal data will fail to reconstruct anomalies. However, deep neural networks often possess enough capacity to reconstruct even unseen abnormal events with high fidelity, leading to missed detections.

This work argues that future frame prediction is a more sensitive proxy for anomaly detection than simple reconstruction. While normal activities follow predictable patterns, abnormal events—such as a fight or a vehicle entering a pedestrian zone—violate the learned dynamics of the scene, resulting in significant prediction errors.

Comparison of prediction quality for normal and abnormal events. Normal events are predicted with high fidelity, while abnormal events (e.g., a bicycle or a person running) result in blurry, high-error predictions.

Methodology

The proposed framework utilizes a Generative Adversarial Network (GAN) to predict the next frame $I_{t+1}$ given a sequence of previous frames $I_1, \dots, I_t$.

Architecture

The system consists of a U-Net generator and a Patch Discriminator. The U-Net architecture, with its skip connections, is well-suited for preserving spatial details during the prediction process. The discriminator facilitates adversarial training, ensuring that the predicted frames are sharp and reside on the manifold of real video frames.

Loss Functions and Constraints

To ensure high-quality predictions for normal events, the model is trained using a combination of four loss functions:

  1. Intensity Loss: Minimizes the pixel-wise $\ell_2$ distance to maintain color and lighting consistency.
  2. Gradient Loss: Minimizes differences in image gradients to prevent the common "blurring" effect in frame prediction.
  3. Adversarial Loss: Employs a Least Squares GAN (LSGAN) objective to improve the realism of the output.
  4. Motion Constraint: This is the primary innovation of the paper. Using a pre-trained FlowNet, the model calculates the optical flow between the predicted frame and the previous frame. It then enforces that this flow matches the ground truth flow, ensuring the predicted movement is physically plausible.
The overall architecture of the proposed future frame prediction framework, highlighting the integration of the U-Net generator, FlowNet for motion constraints, and the discriminator.

Experimental Results

The model was evaluated on several benchmark datasets, including UCSD Ped1/Ped2, CUHK Avenue, and the ShanghaiTech Campus dataset.

Performance Metrics

At inference time, the "normality" of a frame is determined by the Peak Signal-to-Noise Ratio (PSNR) between the prediction and the ground truth. A sudden drop in PSNR indicates a potential anomaly. The method achieved state-of-the-art results at the time of publication:

  • UCSD Ped2: 95.4% AUC (Area Under the Curve).
  • CUHK Avenue: 85.1% AUC.
  • ShanghaiTech: 72.8% AUC.

Insights on Motion and Uncertainty

The inclusion of the optical flow loss proved crucial for identifying anomalies defined by movement, such as a fast-moving bicycle in a pedestrian crowd. Furthermore, experiments on a custom toy dataset revealed that while normal uncertainty (e.g., a person pausing at a crossroad) causes brief spikes in error, actual anomalies cause sustained high errors, allowing for effective differentiation.

Conclusion

By framing anomaly detection as a future frame prediction task and introducing a novel temporal motion constraint, this work provides a robust new baseline for video surveillance. The system is computationally efficient, running at approximately 25 FPS on a single GPU, making it viable for real-time applications. Future work may explore multi-frame prediction horizons to further enhance temporal context.

Summary updated

BibTeX
@inproceedings{liu2018future,
  author = {Wen Liu and Weixin Luo and Dongze Lian and Shenghua Gao},
  title = {{Future Frame Prediction for Anomaly Detection - A New Baseline}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2018},
  url = {https://openreview.net/forum?id=HyWz-abuWB},
}
Figure