Learning Memory-Guided Normality for Anomaly Detection

Hyunjong Park, Jongyoun Noh, Bumsub Ham

Abstract

We address the problem of anomaly detection, that is, detecting anomalous events in a video sequence. Anomaly detection methods based on convolutional neural networks (CNNs) typically leverage proxy tasks, such as reconstructing input video frames, to learn models describing normality without seeing anomalous samples at training time, and quantify the extent of abnormalities using the reconstruction error at test time. The main drawbacks of these approaches are that they do not consider the diversity of normal patterns explicitly, and the powerful representation capacity of CNNs allows to reconstruct abnormal video frames. To address this problem, we present an unsupervised learning approach to anomaly detection that considers the diversity of normal patterns explicitly, while lessening the representation capacity of CNNs. To this end, we propose to use a memory module with a new update scheme where items in the memory record prototypical patterns of normal data. We also present novel feature compactness and separateness losses to train the memory, boosting the discriminative power of both memory items and deeply learned features from normal data. Experimental results on standard benchmarks demonstrate the effectiveness and efficiency of our approach, which outperforms the state of the art.

Introduction: The Capacity Paradox in Anomaly Detection

In video surveillance, anomaly detection is typically framed as an unsupervised learning task. Models are trained to reconstruct or predict "normal" video frames. At test time, a high reconstruction error serves as a signal for an anomaly. However, standard Convolutional Neural Networks (CNNs) often suffer from a "capacity paradox": they are so powerful that they can generalize to reconstruct abnormal events (e.g., a person on a bike) using patterns learned from normal events (e.g., people walking). When the model reconstructs anomalies too well, the detection signal disappears.

This research addresses this by introducing a memory-guided framework that explicitly limits the model's representation capacity, forcing it to reconstruct frames using only a small, discrete set of learned "normal" prototypes.

Proposed Framework: Memory-Guided Normality

The proposed architecture consists of three main components: an Encoder, a Memory Module, and a Decoder.

The proposed framework featuring an Encoder, a Memory Module with Read and Update operations, and a Decoder for frame reconstruction/prediction.

The Memory Bottleneck

Instead of a direct connection between the encoder and decoder, the model introduces a memory module containing $M$ items ($p_1, ..., p_M$). These items act as prototypical patterns of normality. The encoder's output serves as a query to retrieve the most relevant items from memory. This "bottleneck" prevents the model from improvising new representations for unseen anomalies.

Optimization via Compactness and Separateness

To ensure the memory effectively captures the diversity of normal patterns, two novel losses are introduced:

  1. Feature Compactness Loss: This encourages the encoder to produce features that are close to their nearest memory items, minimizing intra-class variation.
  2. Feature Separateness Loss: This pushes different memory items away from each other, ensuring they represent distinct normal patterns (e.g., walking vs. standing) and preventing the memory from collapsing into a single average representation.

Dynamic Memory Update

The memory is not static; it includes an update scheme to adapt to changing environmental conditions. To prevent anomalies from corrupting the memory during testing, a "regular score" is used to gate the update process, ensuring only likely normal frames contribute to memory refinement.

Experimental Results

The model was evaluated on three major benchmarks: UCSD Ped2, CUHK Avenue, and ShanghaiTech.

Qualitative results showing input frames (left), reconstruction error maps (middle), and final anomaly detections (right) across different datasets.

Performance and Efficiency

The "Prediction" variant of the model (Ours-P) achieved state-of-the-art results, with an Area Under the Curve (AUC) of 97.0% on UCSD Ped2 and 88.5% on CUHK Avenue.

Beyond accuracy, the model is highly efficient. It operates at 67 frames per second (fps) on a standard GPU, making it significantly faster than many competing methods that rely on computationally expensive optical flow estimation. This speed makes the approach highly suitable for real-time surveillance applications.

Conclusion

By constraining the representation capacity of CNNs through a memory module, this approach significantly improves the discriminative power of anomaly detection models. While it performs exceptionally well on most benchmarks, future work may explore more efficient ways to integrate explicit motion cues to further improve performance on highly complex scenes like those in the ShanghaiTech dataset.

Summary updated

BibTeX
@inproceedings{park2020learning,
  author = {Hyunjong Park and Jongyoun Noh and Bumsub Ham},
  title = {{Learning Memory-Guided Normality for Anomaly Detection}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  url = {https://openreview.net/forum?id=SW1EMpQYXM2},
}
Figure