NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Exploring Diffusion Models for Unsupervised Video Anomaly Detection

Anil Osman Tur, Nicola Dall'Asen, Cigdem Beyan, Elisa Ricci

Abstract

Video Anomaly Detection (VAD) is a critical task in automated surveillance, traditionally handled through one-class classification or weakly supervised learning. This paper, presented at ICIP 2023, introduces a novel approach using diffusion models for fully unsupervised VAD. By training on raw, unlabeled video data containing both normal and abnormal events, the proposed method leverages the generative power of $k$-diffusion on spatio-temporal features. Through a partial denoising process, the model identifies anomalies based on reconstruction error. Experimental results on the UCF-Crime and ShanghaiTech datasets demonstrate that this diffusion-based approach significantly outperforms traditional autoencoders and existing unsupervised state-of-the-art methods.

1. Introduction

The rapid growth of surveillance infrastructure has created an urgent need for automated systems capable of identifying rare and unexpected events, such as accidents, crimes, or security breaches. Video Anomaly Detection (VAD) aims to address this need. However, traditional methodologies face significant hurdles. One-class classification requires an exhaustive and clean dataset of "normal" behavior, which is often impossible to define in dynamic environments. Weakly supervised learning, while effective, relies on video-level labels that are labor-intensive to produce.

This research explores Unsupervised VAD, the most challenging and scalable scenario. In this setting, the model is trained on a heterogeneous mix of unlabeled video clips. The core hypothesis is that "normal" events are more frequent and temporally consistent, allowing a powerful generative model to learn their distribution while treating rare anomalies as outliers.

2. Methodology

The authors adapt the $k$-diffusion framework, originally designed for high-quality image generation, to the domain of video feature reconstruction. The pipeline consists of five primary stages:

2.1 Feature Extraction

To manage computational complexity and capture temporal dynamics, the model does not operate on raw pixels. Instead, it utilizes a pre-trained 3D-CNN (such as ResNet3D) to transform video clips into high-dimensional spatio-temporal feature vectors.

2.2 The Diffusion Process

The model learns to reverse a Gaussian noise process applied to these features. By training the model to recover the original features from various levels of noise, it effectively learns the underlying probability distribution of the training data, which is dominated by "normal" patterns.

2.3 Partial Denoising (The SDEdit Trick)

During the inference (testing) phase, the model employs a technique inspired by SDEdit. Rather than starting from pure noise, the system takes a feature vector from a test clip and adds a specific amount of noise, controlled by a timestep $t$. The diffusion model then attempts to reconstruct the original feature from this noisy version.

  • The Logic: If a clip is normal, the model—having seen similar patterns during training—can reconstruct it with high fidelity. If the clip contains an anomaly, the model will struggle to recreate the specific anomalous features, instead attempting to "correct" them toward the learned normal distribution.

2.4 Anomaly Scoring and Thresholding

The anomaly score is defined as the Mean Squared Error (MSE) between the original feature and its reconstruction. A high MSE indicates a significant deviation from the learned norm. To finalize the detection, the system uses a data-driven dynamic threshold based on the mean and standard deviation of the MSE within a processing batch.

3. Experimental Results

The proposed method was evaluated on two benchmark datasets: UCF-Crime, which contains 13 classes of real-world anomalies in CCTV footage, and ShanghaiTech, known for its complex lighting and diverse campus-based anomalies.

3.1 Performance Metrics

The diffusion-based model demonstrated superior performance compared to previous generative approaches:

  • ShanghaiTech: Achieved an AUC of 76.10% (using a ResNet18 backbone), surpassing the previous unsupervised state-of-the-art (SOTA) of 71.20%.
  • UCF-Crime: Achieved an AUC of 65.22%, representing a nearly 9% improvement over the previous best unsupervised generative method (56.86%).

3.2 Comparison with Autoencoders

A key finding of the study is the inherent superiority of diffusion models over standard Autoencoders (AEs) for VAD. While AEs are common in this field, they often suffer from "over-generalization," where they become too proficient at reconstructing everything, including the anomalies they are meant to flag. Diffusion models, through their iterative denoising process, maintain a much clearer "reconstruction gap," leading to improvements in AUC ranging from 6% to 14% across various tests.

4. Discussion

4.1 The Role of Timestep $t$

The choice of the starting timestep $t$ is critical. It represents a trade-off between realism (the model's ability to generate a valid "normal" feature) and faithfulness (the model's adherence to the original input). If $t$ is too small, the noise is insufficient to disrupt the anomaly; if $t$ is too large, the model loses the structural context of the video clip. The authors found that an intermediate $t$ is optimal for maximizing the reconstruction gap.

4.2 Backbone Sensitivity

Interestingly, the research found that a simpler 3D-ResNet18 backbone often outperformed the more complex 3D-ResNext101 in the unsupervised setting. This suggests that for unsupervised tasks, more robust and less complex feature representations may prevent the model from overfitting to noise in the unlabeled training set.

5. Conclusion

This paper demonstrates that diffusion models are highly effective tools for unsupervised video anomaly detection. By shifting the focus from pixel generation to feature reconstruction via $k$-diffusion, the authors achieved significant performance gains on major benchmarks. While challenges remain regarding computational costs and hyperparameter sensitivity, this work establishes a new generative paradigm for identifying rare events in complex video data. Future research will likely explore cross-dataset generalization to further enhance the utility of these models in real-world, unseen environments.

Summary updated

BibTeX
@inproceedings{tur2023exploring,
  author = {Anil Osman Tur and Nicola Dall'Asen and Cigdem Beyan and Elisa Ricci},
  title = {{Exploring Diffusion Models for Unsupervised Video Anomaly Detection}},
  booktitle = {ICIP},
  year = {2023},
  doi = {10.1109/icip49359.2023.10222594},
}
Figure