Anomaly Detection with Prototype-Guided Discriminative Latent Embeddings

Yuandu Lai, Yahong Han, Yaowei Wang

Abstract

Unsupervised video anomaly detection (VAD) typically relies on deep autoencoders trained on normal data. However, these models often generalize too well, reconstructing anomalies with low error and failing to trigger alerts. We present a novel two-branch autoencoder architecture featuring a prototype-guided memory module. This module constrains the latent space to a learned dictionary of normal patterns, ensuring that anomalies are poorly reconstructed and thus easily detected. By utilizing RGB differences instead of expensive optical flow, our method achieves state-of-the-art accuracy while maintaining real-time processing speeds of 42 fps.

Introduction

Video Anomaly Detection (VAD) is a critical task in automated surveillance, aimed at identifying rare and diverse events such as accidents, fights, or unauthorized vehicles. Because anomalies are infrequent, the standard approach is unsupervised: training a deep autoencoder (AE) exclusively on normal video frames. The expectation is that the model will fail to reconstruct unseen abnormal events, leading to high reconstruction errors that serve as anomaly scores.

A significant challenge is the "over-generalization" of deep AEs, which often reconstruct abnormal inputs perfectly. Furthermore, capturing temporal regularity usually requires optical flow, which is computationally prohibitive for real-time applications. This paper addresses these issues by introducing a discriminative memory module and an efficient motion representation.

Methodology

The proposed architecture consists of three core components designed for accuracy and efficiency:

Two-Branch Autoencoder

The model employs a shared U-Net encoder that feeds into two distinct decoders. One decoder predicts the future video frame to capture spatial appearance. The second decoder generates a stacked RGB difference, which serves as a "cheap" alternative to optical flow for capturing temporal motion. This design significantly reduces computational overhead.

Prototype-Guided Memory Module

Positioned between the encoder and decoders, this module acts as a bottleneck. It replaces encoded latent features with a weighted average of the closest "memory items"—learned prototypes representing normal data patterns. This forces the decoders to reconstruct frames using only known normal features, effectively distorting any anomalous input.

Discriminative Loss

To ensure the memory bank captures a diverse and representative set of normal patterns, a novel discriminative loss function is introduced. Based on cluster assessment, it minimizes within-class scatter while maximizing between-class scatter among the prototypes. This prevents the memory items from collapsing into redundant representations.

Experimental Results

The model was evaluated on three benchmark datasets: UCSD Ped2, CUHK Avenue, and ShanghaiTech.

Examples of anomaly detection on the UCSD Ped2 (top) and CUHK Avenue (bottom) datasets. Red boxes indicate detected anomalies.

As shown in the qualitative results above, the model successfully identifies various anomalies, such as vehicles on pedestrian paths and unusual human actions. Quantitatively, the method achieved state-of-the-art Frame-level Area Under the Curve (AUC) scores:

  • UCSD Ped2: 97.6%
  • CUHK Avenue: 87.8%
  • ShanghaiTech: 74.5%

Notably, the system operates at 42 frames per second (fps) on a standard GPU, outperforming optical-flow-based methods in both speed and accuracy. Ablation studies confirmed that both the RGB difference branch and the discriminative loss are vital for these performance gains.

Conclusion

By constraining the latent space of an autoencoder through a discriminative prototype-guided memory module, we effectively mitigate the over-generalization problem in video anomaly detection. The use of RGB differences provides a high-speed temporal representation, enabling real-time surveillance. While the model requires tuning the number of prototypes, performance remains stable once a sufficient size is reached. Future work may explore more complex motion dynamics to further enhance detection in highly cluttered scenes.

Summary updated

BibTeX
@inproceedings{lai2021anomaly,
  author = {Yuandu Lai and Yahong Han and Yaowei Wang},
  title = {{Anomaly Detection with Prototype-Guided Discriminative Latent Embeddings}},
  booktitle = {ICDM},
  year = {2021},
  url = {https://openreview.net/forum?id=vhoXTHKvXVf},
}
Figure