Exploring the Magnitude-Shape Plot Framework for Anomaly Detection in Crowded Video Scenes

Z. Jane Wang, Fouzi Harrou, Ying Sun, Marc G. Genton

TL;DR

This paper introduces a statistically principled approach to video anomaly detection by treating reconstruction errors as "functional data." By applying the Magnitude-Shape (MS) Plot framework, the researchers can detect anomalies not just by the size of the error, but by the specific pattern or shape of the deviation, leading to state-of-the-art results on major benchmarks.

What Problem Does This Paper Address?

Detecting unusual behavior in crowded video—like a cyclist on a pedestrian path or a sudden crowd dispersal—is a massive challenge for computer vision. Most current systems use "reconstruction-based" deep learning: an autoencoder learns what "normal" looks like and tries to rebuild every frame. If it fails (high reconstruction error), we flag an anomaly.

The gap lies in how we analyze that error. Most methods simply collapse the error into a single number (like Mean Squared Error) and set a threshold. This is a blunt instrument. A frame might have a low average error but a very strange spatial pattern of error that indicates a subtle anomaly. Conversely, a normal frame might have a high average error due to lighting changes. This paper argues we need to look at the "shape" of the error across the frame, not just its magnitude.

Methods

The authors propose a two-stage framework that marries deep learning with Functional Data Analysis (FDA):

  1. Residual Generation: They use two types of reconstruction models: a standard Autoencoder (AE) and a more advanced model called MAMA (Making Anomalies More Anomalous). These models are trained only on "normal" video. When they encounter an anomaly during testing, they produce a "residual matrix" (the difference between the original and the reconstructed frame).
  2. The MS-Plot Framework: Instead of averaging the residual matrix, they treat it as multivariate functional data. They apply the Magnitude-Shape (MS) Plot, which decomposes the error into two components:
  3. Mean Directional Outlyingness (MO): Measures the overall "size" or intensity of the deviation (Magnitude).
  4. Variation of Directional Outlyingness (VO): Measures how much the pattern of the error deviates from the norm (Shape).
  5. Detection: They combine these into a single metric, Functional Directional Outlyingness (FO). By plotting MO against VO, they can statistically identify outliers that fall outside a principled threshold (calculated using the Mahalanobis distance and a Fisher’s F-distribution).

Datasets

The methodology was evaluated on two gold-standard benchmarks in the field:

  • UCSD Ped2: Focuses on pedestrian walkways where anomalies include bicycles, skateboards, and small vehicles.
  • CUHK Avenue: Contains more complex "behavioral" anomalies like people running, loitering, throwing objects, or walking in the wrong direction.

Key Insights and Ideas

  • Error as a Function: The "aha moment" is treating a 2D grid of error pixels as a continuous function. This allows the use of FDA tools that are far more sensitive to subtle structural changes than simple scalar statistics.
  • Shape Matters: By looking at the "shape" (VO), the model can distinguish between a global increase in error (like a cloud passing over the sun) and a localized, patterned error (like a person running).
  • Principled Thresholding: Rather than "eyeballing" a threshold for an anomaly, the MS-Plot uses a robust statistical foundation (the Minimum Covariance Determinant), making the system more reliable and interpretable.
  • Synergy with SOTA: The framework isn't a replacement for deep learning; it’s an enhancement. When paired with the MAMA model, the MS-Plot analysis significantly boosted performance over the base model's original thresholding method.

Key Results

The proposed MAMA-MS-Plot achieved impressive numbers, outperforming several state-of-the-art (SOTA) methods:

  • UCSD Ped2: Reached an AUC of 98.74%, beating the original MAMA model (98.20%) and other popular models like MemAE and ConvLSTM.
  • CUHK Avenue: Achieved an AUC of 91.43%, setting a new benchmark by slightly edging out the previous high of 91.30% (SD-MAE).
  • Vs. Univariate Methods: The MS-Plot significantly outperformed traditional functional detectors like the Functional Boxplot (FBPlot) and Outliergram, which often failed to reach even 60% AUC on the same data.

Limitations and Future Work

While the results are strong, the authors note a few hurdles:

  • Complex Overlaps: The AE-MS-Plot (the simpler version) still struggled in scenarios where cyclists and skaters moved in different directions simultaneously, leading to higher false-positive rates.
  • Reliance on "Normal" Data: The current models require a clean, anomaly-free training set. The authors suggest that future work should focus on developing unsupervised methods that can learn to detect anomalies without needing a curated "normal" dataset first.
  • Computational Complexity: Treating every frame as a multivariate function and calculating directional outlyingness is computationally more intensive than simple MSE, which might impact real-time performance on edge devices.

Summary updated

Abstract

Detecting anomalies in crowded video scenes is critical for public safety, enabling timely identification of potential threats. This study explores video anomaly detection within a Functional Data Analysis framework, focusing on the application of the Magnitude-Shape (MS) Plot. Autoencoders are used to learn and reconstruct normal behavioral patterns from anomaly-free training data, resulting in low reconstruction errors for normal frames and higher errors for frames with potential anomalies. The reconstruction error matrix for each frame is treated as multivariate functional data, with the MS-Plot applied to analyze both magnitude and shape deviations, enhancing the accuracy of anomaly detection. Using its capacity to evaluate the magnitude and shape of deviations, the MS-Plot offers a statistically principled and interpretable framework for anomaly detection. The proposed methodology is evaluated on two widely used benchmark datasets, UCSD Ped2 and CUHK Avenue, demonstrating promising performance. It performs better than traditional univariate functional detectors (e.g., FBPlot, TVDMSS, Extremal Depth, and Outliergram) and several state-of-the-art methods. These results highlight the potential of the MS-Plot-based framework for effective anomaly detection in crowded video scenes.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
CUHK AvenueMAMA-MS-PlotAUC91.43%+0.13 vs baselineAUC comparison on the CUHK Avenue dataset.
Source quote
L505: MAMA-MS-Plot │ 91.43
Reported baseline / comparator measurements (2)
BenchmarkMethodMetricScoreProtocol / Evidence
UCSD Ped2MAMA baselineAUC98.20%AUC comparison on UCSD Ped2; reported as the original MAMA approach.
Source quote
L467: MAMA~\cite{hong2024making} │ 98.20
CUHK AvenueSD-MAE baselineAUC91.30%Previous highest reported AUC on CUHK Avenue, as identified in the comparison discussion.
Source quote
L476: We compare the proposed MS-Plot-based methods with several state-of-the-art anomaly detection techniques in the CUHK Avenue dataset, as detailed in Table~\ref{tab:comparison_state_of_art_cuhk}. The MAMA-MS-Plot approach achieves an AUC of 91.43%, demonstrating its strong competitiveness among SOTA methods. In particular, the previous highest reported AUC was 91.30%, achieved by SD-MAE~\cite{ristea2024self}. The MAMA-MS-Plot exceeds this by a small but meaningful margin of 0.13%, setting a new benchmark for anomaly detection performance in this data set.
BibTeX
@misc{wang2024exploring,
  author = {Z. Jane Wang and Fouzi Harrou and Ying Sun and Marc G. Genton},
  title = {{Exploring the Magnitude-Shape Plot Framework for Anomaly Detection in Crowded Video Scenes}},
  year = {2024},
  eprint = {2412.20363},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.20363},
}
Figure