Consistency-Based Self-supervised Learning for Temporal Anomaly Localization

Aniello Panariello, Angelo Porrello, Simone Calderara, Rita Cucchiara

Introduction

Video Anomaly Detection (VAD) is a critical task in computer vision, focused on identifying unusual events such as fights, accidents, or thefts within surveillance footage. While the ideal training scenario involves dense, frame-level annotations, the labor-intensive nature of such labeling makes it impractical for large-scale applications. Consequently, researchers have turned to Weakly Supervised Anomaly Detection (WSAD), where models are trained using only video-level labels—indicating whether an anomaly exists somewhere in a clip, but not precisely when.

The primary challenge in WSAD is Temporal Anomaly Localization: pinpointing the exact start and end times of an event based on a single "yes/no" label for a multi-minute video. Existing methods often suffer from noisy predictions or fail to capture the full duration of an anomalous event. This paper introduces a novel consistency-based regularization term designed to improve the precision of these temporal localizations through self-supervised learning.

Methodology

The proposed framework enhances standard deep learning architectures for VAD by introducing a clever self-supervised "Alignment Loss." The pipeline consists of several key stages:

1. Feature Extraction and Attention

The model utilizes a pre-trained I3D network, a standard architecture for video action recognition, to convert 16-frame video segments into high-dimensional feature vectors. These features are then passed through an attention mechanism that assigns an "attention weight" ($\lambda_t$) to each segment, representing the likelihood that the specific segment is anomalous.

2. The Alignment Loss

The core contribution of this research is the Alignment Loss, a self-supervised consistency constraint. The process works as follows:

  • Temporal Blocking: The video is divided into small temporal blocks (e.g., three segments per block).
  • Sub-sampling: Two distinct versions of the video ($X_A$ and $X_B$) are created by randomly selecting one segment from each block.
  • Consistency Training: The model is trained to ensure that the attention weights generated for $X_A$ and $X_B$ are as similar as possible.

The underlying logic is that a robust anomaly detector should be invariant to minor temporal perturbations. If a video contains a violent act, slightly different sub-samplings of that video should still consistently highlight the same anomalous moments.

3. Refinement and Inference

During the inference phase, the model employs a Temporal Class Activation Map (T-CAM). This helps smooth out the predicted scores and groups adjacent high-scoring segments into a single, cohesive "proposal" for where the anomaly occurred, reducing fragmented or jittery predictions.

Experimental Setup: The XD-Violence Dataset

To validate the approach, the researchers utilized the XD-Violence Dataset, one of the most comprehensive benchmarks in the field.

  • Scale: 4,754 videos totaling 217 hours.
  • Diversity: The dataset includes a wide array of events (explosions, riots, fighting) captured from diverse sources, including CCTV, car driving recorders, and handheld cameras.
  • Complexity: Unlike older datasets, XD-Violence is multi-modal (audio and video) and features significant environmental variety, making it a realistic test for localization algorithms.

Key Results and Insights

The integration of the Alignment Loss yielded significant performance gains across multiple metrics on the XD-Violence benchmark:

  • Localization Precision: The model achieved a notable 5 percentage point increase in AUC (Area Under Curve) and a 4 point increase in AP (Average Precision) for temporal proposals compared to the baseline without consistency training.
  • Frame-Level Accuracy: The frame-level AUC improved from 85.14% to 90.23%.
  • Competitive Performance: While the model did not surpass the most complex state-of-the-art weakly supervised methods (like RTFM), it outperformed all unsupervised methods and demonstrated that consistency-based SSL is a powerful, lightweight addition that can boost the performance of existing architectures.

Invariance as a Teacher

A central takeaway from this work is that temporal consistency serves as a powerful proxy for ground-truth labels. By forcing the model to find consistencies across wider temporal windows, the Alignment Loss allows the model to ignore "noise"—such as sudden camera movements or lighting changes—that might otherwise be mistaken for anomalies.

Limitations and Future Directions

Despite the improvements, the authors noted two primary hurdles:

  1. The Uncertainty Regime: Qualitative analysis revealed that while the model correctly identifies anomalous regions, the scores often hover around 0.5 rather than reaching a confident 1.0. The model identifies that "something is wrong" but lacks the certainty required for high-stakes automated intervention.
  2. Visual Noise: Sudden changes, such as a new character entering the frame, can still trigger false positives. This suggests that without segment-level labels, the model still struggles to distinguish between "unusual but normal" visual shifts and actual anomalies.

Future research will likely explore integrating this consistency loss into more sophisticated Multiple Instance Learning (MIL) architectures to determine if the benefits of self-supervised alignment can be compounded with more complex bag-based learning strategies.

Summary updated

BibTeX
@inproceedings{panariello2022consistency,
  author = {Aniello Panariello and Angelo Porrello and Simone Calderara and Rita Cucchiara},
  title = {{Consistency-Based Self-supervised Learning for Temporal Anomaly Localization}},
  booktitle = {Workshops @ ECCV},
  year = {2022},
  doi = {10.1007/978-3-031-25072-9\_22},
}
Figure