Video Anomaly Detection via Sequentially Learning Multiple Pretext Tasks

Chenrui Shi, Che Sun, Yuwei Wu, Yunde JiaICCV 2023

Abstract

Learning multiple pretext tasks is a popular approach to tackle the nonalignment problem in unsupervised video anomaly detection. However, the conventional learning method of simultaneously learning multiple pretext tasks is prone to sub-optimal solutions, incurring sharp performance drops. In this paper, we propose to sequentially learn multiple pretext tasks according to their difficulties in an ascending manner to improve the performance of anomaly detection. The core idea is to relax the learning objective by starting with easy pretext tasks in the early stage and gradually refine it by involving more challenging pretext tasks later on. In this way, our method is able to reduce the difficulties of learning and avoid converging to sub-optimal solutions. Specifically, we design a tailored sequential learning order for three widely-used pretext tasks: frame prediction, frame reconstruction, and frame-order classification. We further introduce a new contrastive loss which makes the learned representations of normality more discriminative by pushing normal and pseudo-abnormal samples apart. Extensive experiments on three datasets demonstrate the effectiveness of our method.

Introduction

Video Anomaly Detection (VAD) is the "needle in a haystack" problem of computer vision: identifying unusual events, such as a bike on a pedestrian path or a person running, within a sea of normal surveillance footage. Since anomalies are rare, models are typically trained on "normal" data using self-supervised pretext tasks—challenges like predicting the next frame. If a model fails a task on a new video, it flags it as an anomaly.

While using multiple pretext tasks should theoretically improve performance, current approaches often rely on simultaneous learning. This can lead to "nonalignment," where the model gets stuck in Pareto-optimal points—mathematical dead-ends where improving one task degrades another. This prevents the model from reaching its full potential for anomaly detection.

Methodology

The authors propose a Sequential Learning framework that introduces tasks one by one in an ascending order of difficulty. This approach allows the model to build a robust foundation before tackling more complex challenges.

Architecture of the proposed multi-task learning framework showing the shared encoder and task-specific heads.

The framework consists of three phases:

  1. Phase 1: Frame Prediction (Pre): The model learns to predict a middle frame based on surrounding frames, capturing coarse-scale temporal patterns.
  2. Phase 2: Frame Reconstruction (Rec): Building on the prediction knowledge, the model learns to reconstruct the input exactly, forcing it to encode fine-grained spatial details.
  3. Phase 3: Frame Order Classification (Cls): The model learns to distinguish between normal sequences and "pseudo-abnormal" ones (e.g., shuffled or accelerated clips).

To enhance discriminative power, a new contrastive loss ($L_{con}$) is introduced during the classification phase. This loss explicitly pushes the latent representations of normal and pseudo-abnormal videos further apart, sharpening the decision boundary.

Experimental Results

The method was evaluated on three standard benchmarks: Avenue, ShanghaiTech, and UCSD Ped2. The sequential approach consistently outperformed simultaneous learning across all tests.

AUC performance comparison on Avenue and Ped2 datasets showing the advantage of sequential learning over simultaneous methods.

Key results include:

  • Avenue: Achieved 90.9% AUC, outperforming previous multi-task methods.
  • ShanghaiTech: Reached 78.8% AUC, a significant improvement over single-task methods.
  • Ped2: Reached 97.6% AUC.

As illustrated in Figure 1, the performance of the sequential method steadily improves as more tasks are added, whereas simultaneous learning often results in performance plateaus or drops.

Discussion and Conclusion

By evolving the learning objective over time, the model avoids the sub-optimal solutions common in multi-task learning. The use of pseudo-anomalies as "teachers" provides a robust definition of normality. Notably, this method achieves competitive results using only raw RGB frames, avoiding the computational expense of optical flow.

Future work will address current limitations, such as contextual blindness in crowded scenes where object detectors might fail, by designing new scene-level pretext tasks to better handle complex environmental contexts.

Summary updated

BibTeX
@inproceedings{shi2023video,
  author = {Chenrui Shi and Che Sun and Yuwei Wu and Yunde Jia},
  title = {{Video Anomaly Detection via Sequentially Learning Multiple Pretext Tasks}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
  url = {https://openreview.net/forum?id=aefBpLOSiT},
}
Figure