VideoPatchCore: An Effective Method to Memorize Normality for Video Anomaly Detection

Sunghyun Ahn, Youngwan Jo, Kijung Lee, Sanghyun Park

TL;DR

VideoPatchCore (VPC) is a novel, training-free method for video anomaly detection that adapts the successful PatchCore image algorithm to the temporal domain. By leveraging a pre-trained CLIP encoder and a specialized three-bank memory system (spatial, temporal, and semantic), VPC achieves state-of-the-art performance with a tiny memory footprint and high processing speeds.

What Problem Does This Paper Address?

Video Anomaly Detection (VAD) is the "needle in a haystack" problem of computer vision: identifying rare, unpredictable events (like a person running in a mall or a car on a sidewalk) within hours of normal surveillance footage.

Most current deep learning approaches use One-Class Classification (OCC). They train an autoencoder to reconstruct "normal" video; the idea is that the model will fail to reconstruct "abnormal" events, leading to a high error score. However, these models often suffer from "over-generalization"—they become so good at reconstructing images that they accidentally reconstruct the anomalies perfectly, too.

Existing memory-augmented methods try to fix this by storing "normal" features to help reconstruction, but they are notoriously difficult to optimize, complex to implement, and sensitive to memory size.

Methods

The authors introduce VideoPatchCore (VPC), which moves away from complex end-to-end training in favor of a robust memory-retrieval architecture.

1. The Two-Stream Architecture

VPC processes video through two parallel paths:

  • Local Stream: Uses YOLOv5 to detect individual objects and extracts features using a pre-trained CLIP (ResNet-101) encoder. This stream focuses on what is in the frame and how it is moving.
  • Global Stream: Analyzes the entire frame to understand the context and interactions between multiple objects (e.g., a crowd dispersing suddenly).

2. The Three Memory Banks

Instead of one giant memory, VPC splits "normality" into three distinct categories:

  • Spatial Memory (SM): Stores appearance features to identify "wrong objects" (e.g., a motorcycle on a pedestrian path).
  • Temporal Memory (TM): Stores motion features (differences between consecutive frames) to identify "wrong actions" (e.g., jumping vs. walking).
  • High-level Semantic Memory (HSM): Stores global context to identify scene-level anomalies (e.g., walking the wrong way down a one-way street).

3. Mismatched Pooling

One of the paper's cleverest innovations is Mismatched Pooling. During the "memorization" phase, they use Average Pooling to store the general motion of normal objects. During "inference" (testing), they use Max Pooling. Because anomalies often involve sudden, extreme movements, the Max Pooled features of an anomaly will look significantly different from the Average Pooled features in the memory, making the anomaly easier to spot.

4. Coreset Subsampling

To keep the system fast, VPC uses "greedy coreset subsampling." This technique selects a small, highly representative subset of features to store in memory, reducing the search space without sacrificing accuracy.

Datasets

The model was evaluated on three standard VAD benchmarks:

  • CUHK Avenue: 16 training and 21 testing videos; contains anomalies like running or throwing items.
  • ShanghaiTech (SHTech): A large, complex dataset with 13 different scenes and various anomaly types (vehicles, fighting).
  • IITB Corridor: Features "unseen" anomalies like protesting or playing with a ball in a hallway.

Key Insights and Ideas

  • Training is Optional: By using a powerful pre-trained encoder (CLIP), the authors prove that you don't need to train a model from scratch on "normal" data to detect anomalies effectively.
  • Context Matters: The jump in performance when adding the "Global Stream" suggests that many anomalies aren't about a single object acting weirdly, but about the relationship between objects and their environment.
  • The Power of "Mismatch": The Mismatched Pooling strategy is a fascinating "aha moment." It exploits the statistical difference between the "average" behavior of normal events and the "peak" behavior of anomalies.
  • Efficiency via Coreset: The authors found that using only 1% to 10% of the available memory via coreset subsampling resulted in almost no performance loss while significantly boosting FPS.

Key Results

VPC achieves state-of-the-art (SOTA) or near-SOTA results across the board:

  • Avenue: 92.8% AUROC (matching the best existing methods).
  • ShanghaiTech: 85.1% AUROC.
  • IITB Corridor: 76.4% AUROC (outperforming previous methods).
  • Speed: On an NVIDIA RTX 3090, the system can process up to 170.9 FPS (at a 1% subsampling ratio), making it highly suitable for real-time surveillance applications.

Limitations and Future Work

  • Object Detector Dependency: The Local Stream relies on YOLOv5. If the object detector fails to see an object (e.g., due to extreme occlusion or poor lighting), the spatial and temporal memories for that object cannot be utilized.
  • Hyperparameter Sensitivity: While training-free, the model still requires setting weights ($\delta$ and $\gamma$) to balance the local and global anomaly scores, which may vary slightly between different types of environments.
  • Future Directions: The authors suggest that VPC could be made even more accessible for real-world applications due to its straightforward implementation and lack of a heavy training phase.

Reference: Ahn, S., Jo, Y., Lee, K., & Park, S. (2024). VideoPatchCore: An Effective Method to Memorize Normality for Video Anomaly Detection. Presented at ACCV 2024. arXiv:2409.16225v5

Summary updated

BibTeX
@inproceedings{ahn2024videopatchcore,
  author = {Sunghyun Ahn and Youngwan Jo and Kijung Lee and Sanghyun Park},
  title = {{VideoPatchCore: An Effective Method to Memorize Normality for Video Anomaly Detection}},
  booktitle = {ACCV},
  year = {2024},
  doi = {10.1007/978-981-96-0908-6\_18},
}

Loading related content...

Figure