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

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

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 and several state-of-the-art methods, highlighting the potential of the MS-Plot-based framework for effective anomaly detection in crowded video scenes.

Introduction

Detecting anomalies in crowded video—such as a vehicle entering a pedestrian zone or sudden crowd dispersal—remains a significant challenge in computer vision. Crowded environments are inherently high-dimensional, noisy, and characterized by complex interactions. Most contemporary methods utilize deep learning models, specifically autoencoders, to learn "normal" behavior. These models are trained to reconstruct anomaly-free scenes; when presented with an anomaly, they fail to reconstruct the image accurately, resulting in a high "reconstruction error."

However, many existing systems rely solely on the total magnitude of this error. A simple threshold often fails to capture subtle anomalies or triggers false alarms due to environmental noise like lighting changes. This research addresses the lack of statistical rigor in interpreting these errors by introducing a framework that combines deep learning with Functional Data Analysis (FDA).

Methodology: Bridging Deep Learning and Statistics

The proposed pipeline transitions from raw video data to statistically grounded anomaly scores through three primary stages:

  1. Reconstruction: The system employs an Autoencoder (AE)—testing both standard convolutional architectures and the state-of-the-art MAMA (Making Anomalies More Anomalous) model. These models are trained exclusively on "normal" video sequences to establish a baseline of expected behavior.
The autoencoder architecture processes input data (x) to produce a reconstruction (x̂), with the difference defining the reconstruction error.
  1. Residual Generation: For every test frame, the model generates a reconstruction. The difference between the original frame and its reconstruction forms a "residual matrix," representing the spatial distribution of error.
  2. The MS-Plot Framework: Instead of collapsing the error matrix into a single scalar, the framework treats it as multivariate functional data. The Magnitude-Shape (MS) Plot is applied to decompose the error into two critical components:
  3. Mean Directional Outlyingness (MO): Measures the overall magnitude or shift of the error.
  4. Variation of Directional Outlyingness (VO): Measures the "shape" or structural pattern of the error.

By combining these into a Functional Outlyingness (FO) score, the system identifies anomalies based on both the intensity and the spatial pattern of the deviation.

Experimental Setup and Datasets

The framework was rigorously evaluated on two gold-standard benchmarks for video anomaly detection, summarized in the table below:

Benchmark datasets UCSD Ped2 and CUHK Avenue provide varying complexities and resolutions for testing.
  • UCSD Ped2: Focuses on pedestrian walkways where anomalies include unauthorized vehicles or skaters.
  • CUHK Avenue: A complex campus scene featuring diverse anomalies like running, throwing objects, or wrong-way movement.

Key Insights and Results

The Importance of "Shape"

A central finding of this study is that anomalies are characterized not just by "more error," but by a different kind of error. While lighting changes might increase the error magnitude (MO), a person running in a restricted area creates a distinct spatial pattern (VO). The MS-Plot captures both, providing a more nuanced detection mechanism than traditional magnitude-based thresholds.

Statistical Interpretability

Unlike "black-box" deep learning thresholds, the MS-Plot provides a statistically grounded definition of an outlier. It utilizes the squared robust Mahalanobis distance (SRMD) to flag frames that deviate significantly from the expected distribution of normal behavior. This allows for 3D visualizations (Magnitude vs. Shape vs. Time) where anomalies clearly cluster away from normal data points.

Performance Benchmarks

The MAMA-MS-Plot approach demonstrated superior performance across datasets:

  • UCSD Ped2: Achieved an AUC of 98.74%, outperforming the base MAMA model (98.20%) and traditional methods like MPPCA (77%).
  • CUHK Avenue: Reached a new record AUC of 91.43%, surpassing previous state-of-the-art models like SD-MAE (91.30%).
  • Functional Superiority: The MS-Plot-based method significantly outperformed univariate statistical detectors (e.g., FBPlot, Outliergram), proving that treating video as a continuous function is more effective than simple vector analysis.

Conclusion and Future Work

This research demonstrates that integrating Functional Data Analysis with deep learning provides a robust, interpretable framework for video anomaly detection. While the results are promising, the authors identify future challenges, including the current dependency on curated "clean" training data and the computational complexity of real-time functional analysis. Future research will focus on unsupervised methods that can filter anomalies during the training phase, further enhancing the system's autonomy and real-world applicability.

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