Manuscript Offprint

arXiv:2610.11149

A Unified Score Matching Paradigm for Video Anomaly Detection and Anticipation

Congqi Cao, Zhenhe Liang, Hanwen Zhang, Yifan Zhao, Qinyi Lv, Lingtong Min, Yanning Zhang

Congqi Cao D◯\textcircled{D}, Member, IEEE, Zhenhe Liang D◯\textcircled{D}, Hanwen Zhang D◯\textcircled{D}, Yifan Zhao D◯\textcircled{D}, Qinyi Lv D◯\textcircled{D}, Lingtong Min D◯\textcircled{D}, Member, IEEE, and Yanning Zhang D◯\textcircled{D}, Fellow, IEEE

Abstract—Video anomaly detection (VAD) is a fundamental and safety-critical task in computer vision. Recent generative approaches detect anomalies from a distributional perspective, but remain limited by local anomaly modes. Meanwhile, video anomaly anticipation (VAA), as a proactive extension beyond post-hoc detection, introduces additional challenges. In particular, the contrastive inference paradigm in VAD, which relies on ground-truth frames, is not applicable to VAA, hindering its development. To address these challenges, we propose a unified score-driven framework, termed Uni-DSM, based on denoising score matching (DSM), which models anomaly patterns through likelihood estimation and score functions over the learned data distribution. Within this unified framework, we adopt a shared noise-conditioned score transformer backbone with scene-dependent embeddings and motion-aware weighting for distribution-level modeling. Instead of introducing separate architectures, Uni-DSM unifies VAD and VAA through different inference and supervision paradigms built upon the same score-based formulation. For VAD, we instantiate an autoregressive denoising score matching (ADSM) mechanism, which progressively accumulates anomalous evidence via autoregressive denoising, enabling enhanced perception of local modes beyond visual cues. For VAA, we extend the same architecture by incorporating a lightweight auxiliary decoder and a novel self-distilled denoising score matching (SDSM) mechanism. By constructing supervision from output discrepancies instead of relying on unavailable future ground truth, our method achieves efficient training suitable or early anomaly anticipation. Extensive experiments on multiple benchmark datasets demonstrate state-of-the-art performance in both VAD and VAA while maintaining high efficiency, establishing a unified and scalable pipeline from anomaly detection to anticipation.

Index Terms—Scene-dependent anomaly, video anomaly detection and anticipation, unified framework, denoising score matching.

I. INTRODUCTION

VIDEO anomaly detection (VAD) and video anomaly anticipation (VAA) are core tasks in intelligent surveillance. Compared to VAD, which detects anomalies after oc-

Figure

Fig. 1. An illustration of the local modes of anomalies. We explore two regions in which the anomalies are residing. The likelihood-based method is highly sensitive to regions of anomalies with inherently low probability likelihood while blind to anomalies located in local modes near the learned distribution.

currence, VAA forecasts near-future risks to enable proactive response, which is particularly critical in high-risk scenarios.

Due to the rarity and unpredictability of anomalous events, existing approaches generally adopt a semi-supervised paradigm trained solely on normal data [1], [2], [3], [4]. In this setting, reconstruction-based methods [5], [6], [7], [8], [9], [10], [11] and prediction-based methods [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22] have emerged as two dominant paradigms. Their core assumption is that anomalous samples are more difficult to accurately reconstruct and predict than normal ones [8], [14]. However, these methods primarily rely on low-level visual contrastive errors, which makes them prone to misclassifying samples with significant appearance variations but normal semantics as anomalies.

In recent years, advances in generative models [23], [24], [25], [26], [27], [28] have offered new perspectives for video anomaly modeling: anomalous events inherently lie in low-probability density regions [29] of the normal data distribution and can be characterized via likelihoods or their gradients. Although prior studies have explored leveraging likelihood information for auxiliary visual pretraining [30], [31] or density estimation [32], [33], [34], they have not fully exploited its potential for direct anomaly modeling. However, directly relying on log-likelihoods or their gradients (i.e., the Stein score [35]) for anomaly detection remains challenging. As shown in Fig. 1, the Stein score tends to vanish at extrema and saddle points of the distribution, making anomalies within local modes difficult to distinguish effectively [33]. More fundamentally, we attribute this limitation to several gaps between likelihood-based measures and visual perception, including a scene gap that is insensitive to semantic context [12], [13], a motion gap due to insufficient modeling of dynamic patterns, and an appearance gap stemming from limited capability to

This work is supported by National Natural Science Foundation of China (No. 62376217, 62301434, 62576279), the Joint Research Project for Meteorological Capacity Improvement (Grants 24NLTSZ003) and Young Elite Scientists Sponsorship Program by CAST (No. 2023QNRC001).

Congqi Cao, Zhenhe Liang, Hanwen Zhang, Yifan Zhao, and Yanning Zhang are with the National Engineering Laboratory for Integrated Aero-Space-Ground-Ocean Big Data Application Technology, School of Computer Science, Northwestern Polytechnical University, Xi'an 710129, China. Qinyi Lv and Lingtong Min are with the School of Electronics and Information, Northwestern Polytechnical University, Xi'an 710129, China. (e-mail: congqi.cao@nwpu.edu.cn; zhenheliang@mail.nwpu.edu.cn; zhwww@mail.nwpu.edu.cn; yfzhao@mail.nwpu.edu.cn; lvqinyi@nwpu.edu.cn; minlingtong@nwpu.edu.cn; ynzhang@nwpu.edu.cn).

Figure

(a) Semantic memory bank method

(b) Bidirectional frame prediction framework

(c) Self-distilled score matching framework (ours)

Fig. 2. An illustration of three video anomaly anticipation frameworks, where GT denotes ground truth. Compared with semantic memory bank and bidirectional frame prediction frameworks, our self-distilled DSM (SDSM) within Uni-DSM adopts a lightweight unidirectional main-auxiliary architecture, enabling efficient video anomaly anticipation with lower GPU memory consumption and faster inference speed.

capture fine-grained visual variations.

Meanwhile, as a proactive anticipation task, VAA poses even greater challenges. The primary difficulty lies in the lack of future ground truth, which renders contrastive-objective-based VAD inference paradigms unsuitable. As shown in Fig. 2, prior work addresses this using semantic memory banks [36] or forward-backward prediction frameworks [9], [12]. While bidirectional architectures better capture spatiotemporal context and achieve strong generalization, surpassing semantic-based methods, they significantly increase computational complexity. This limits their applicability in real-world deployment.

To address these challenges, as shown in Fig. 3, we propose a unified score-driven framework, termed Uni-DSM, based on denoising score matching (DSM), which models video anomaly detection and anticipation from a distributional perspective. In this framework, anomalies are characterized as low-likelihood regions under the learned normal distribution, and score functions are leveraged to quantify such distributional deviations. Unlike conventional methods relying on pixel-level contrastive errors, our approach directly operates on the intrinsic data distribution. Building upon this formulation, we formulate a unified score matching paradigm that supports both detection and anticipation through task-aligned inference and supervision mechanisms. Within the Uni-DSM framework, we adopt a shared noise-conditioned score transformer (NCST) as the backbone to approximate the Stein score of noisy data under multiple noise levels. The NCST embeds denoising score matching into a diffusion transformer, enabling effective modeling of complex spatiotemporal dependencies. On top of this shared formulation, we further introduce a scene-dependent and motion-aware score by incorporating scene-conditioned embeddings and motion weights derived from key-frame discrepancies, which strengthens temporal consistency and improves robustness under varying contexts.

For the VAD task, we instantiate an autoregressive denoising score matching (ADSM) mechanism. Specifically, we develop an autoregressive denoising strategy during inference that progressively injects intensifying noise and accumulates anomalous context across steps. Meanwhile, discrepancies between denoised outputs and original inputs are integrated to enhance appearance perception and suppress local modes, leading to more reliable anomaly discrimination.

For the VAA task, we extend the same score-driven formulation and propose a self-distilled denoising score matching (SDSM) mechanism. Instead of relying on unavailable future ground-truth frames, SDSM constructs supervision from output discrepancies under a lightweight main-auxiliary architecture with unidirectional temporal inference. This design maintains architectural consistency with ADSM while introducing a self-distillation paradigm tailored for anticipation, enabling efficient training and practical predictive anomaly warning with reduced computational overhead.

In summary, we present the first unified framework that introduces denoising score matching into both video anomaly detection and anticipation under a consistent score-driven formulation. The proposed Uni-DSM framework integrates a shared noise-conditioned score transformer, a scene-dependent and motion-aware score function, and two task-specific mechanisms (e.g., autoregressive DSM for detection and self-distilled DSM for anticipation). Extensive experimental results demonstrate that the proposed methods consistently outperform state-of-the-art approaches on multiple benchmark datasets, including Avenue [37], ShanghaiTech [38], and NWPU Campus [12]. Our contributions are as follows:

  • A unified score-driven framework, Uni-DSM, based on denoising score matching (DSM), representing the first formulation that models anomalies as low-likelihood patterns under the learned normal distribution for both video anomaly detection and anticipation.

  • A shared score-based modeling strategy with a noise-conditioned score transformer, integrating scene-dependent embeddings and motion-aware weighting to mitigate scene, motion, and appearance gaps and align likelihood estimation with structured visual dynamics.

• An autoregressive DSM (ADSM) mechanism for VAD, enhancing sensitivity to local anomalies by progressively injecting Gaussian noise and aggregating discrepancies between denoised and original data via the score function.

  • A self-distilled DSM (SDSM) mechanism for VAA, extending the architecture with a lightweight auxiliary decoder to enable ground-truth-free anticipation via self-distillation and unidirectional temporal inference.

• Extensive experiments on multiple benchmarks demonstrate state-of-the-art performance in both detection and anticipation, confirming the effectiveness and generalization of the unified framework.

This paper is an extension of our previous work [39]. We extend the preliminary version in the following aspects: (1) We generalize the framework from video anomaly detection to video anomaly anticipation under the same unified denoising score matching formulation, establishing a coherent

Figure

Fig. 3. An overview of the Uni-DSM framework, a unified score-driven architecture based on denoising score matching (DSM). The red flow represents autoregressive denoising score matching (ADSM) for video anomaly detection, while the purple flow denotes self-distilled score matching (SDSM) for video anomaly anticipation.

pipeline for both tasks. (2) We introduce a self-distilled DSM (SDSM) mechanism to address the absence of future ground-truth frames by leveraging output discrepancy. (3) We design a lightweight main-auxiliary architecture with unidirectional temporal inference, which replaces bidirectional paradigms and significantly reduces model complexity. (4) We conduct more comprehensive experiments with thorough analyses, demonstrating consistent improvements in both performance and efficiency, especially in predictive anomaly warning scenarios.

References (76)

  • Anomaly detection: A survey
  • Robust real-time unusual event detection using multiple fixed-location monitors
  • Video anomaly identification
  • A survey of single-scene video anomaly detection
  • Memorizing normality to detect anomaly: Memory-augmented deep autoencoder for unsupervised anomaly detection
  • Anomaly detection in video sequence with appearance-motion correspondence
  • Old is gold: Redefining the adversarially learned one-class classifier training paradigm
  • Learning temporal regularity in video sequences
  • Context recovery and knowledge retrieval: A novel two-stream framework for video anomaly detection
  • Video anomaly detection by solving decoupled spatio-temporal jigsaw puzzles
  • Object-centric auto-encoders and dummy anomalies for abnormal event detection in video
  • A new comprehensive benchmark for semi-supervised video anomaly detection and anticipation
  • Scene-dependent prediction in latent space for video anomaly detection and anticipation
  • Future frame prediction for anomaly detection—a new baseline
  • Appearance-motion memory consistency network for video anomaly detection
  • A hybrid video anomaly detection framework via memory-augmented flow reconstruction and flow-guided frame prediction
  • Variational abnormal behavior detection with motion consistency
  • Multitimescale trajectory prediction for abnormal human activity detection
  • Anomaly detection in video via self-supervised and multitask learning
  • Learning memory-guided normality for anomaly detection
  • Self-distilled masked auto-encoders are efficient video anomaly detectors
  • Learning normal dynamics in videos with meta prototype network
  • Denoising diffusion probabilistic models
  • Generative modeling by estimating gradients of the data distribution
  • Score-Based Generative Modeling through Stochastic Differential Equations
  • Variational diffusion models
  • Diffusion models beat gans on image synthesis
  • Image super-resolution via iterative refinement
  • Deep autoencoding gaussian mixture model for unsupervised anomaly detection
  • Multimodal motion conditioned diffusion model for skeleton-based video anomaly detection
  • Feature prediction diffusion model for video anomaly detection
  • Normalizing flows for human pose anomaly detection
  • Multiscale score matching for out-of-distribution detection (opens arXiv in a new tab)
  • Mulde: Multiscale log-density estimation via denoising score matching for video anomaly detection
  • A kernelized stein discrepancy for goodness-of-fit tests
  • Anomaly warning: Learning and memorizing future semantic patterns for unsupervised ex-ante potential anomaly prediction
  • Abnormal event detection at 150 fps in matlab
  • A revisit of sparse coding based anomaly detection in stacked rnn framework
  • Autoregressive denoising score matching is a good video anomaly detector
  • Real-world anomaly detection in surveillance videos
  • Graph convolutional label noise cleaner: Train a plug-and-play action classifier for anomaly detection
  • Motion-aware feature for improved video anomaly detection (opens arXiv in a new tab)
  • Spatial-temporal convolutional neural networks for anomaly detection and localization in crowded scenes
  • Deep appearance features for abnormal behavior detection in video
  • Learnable locality-sensitive hashing for video anomaly detection
  • Clustering driven deep autoencoder for video anomaly detection
  • A deep one-class neural network for anomalous event detection in complex scenes
  • Learning deep representations of appearance and motion for anomalous event detection (opens arXiv in a new tab)
  • Anomaly detection and localization in crowded scenes
  • Joint detection and recounting of abnormal events by learning deep generic knowledge
  • Anomaly detection with bidirectional consistency in videos
  • Future frame prediction network for video anomaly detection
  • Learning normal patterns via adversarial attention-based autoencoder for abnormal event detection in videos
  • Cloze test helps: Effective video anomaly detection via learning to complete video events
  • Effectiveness assessment of recent large vision-language models
  • A connection between score matching and denoising autoencoders
  • Estimation of non-normalized statistical models by score matching
  • Attention is all you need
  • Scalable diffusion models with transformers
  • Latte: Latent diffusion transformer for video generation (opens arXiv in a new tab)
  • Hierarchical semantic contrast for scene-aware video anomaly detection
  • Key frame extraction from mpeg video stream
  • Video event restoration based on keyframes for video anomaly detection
  • Deep multi-scale video prediction beyond mean square error (opens arXiv in a new tab)
  • Ubnormal: New benchmark for supervised open-set video anomaly detection
  • Ssmtl++: Revisiting self-supervised multi-task learning for video anomaly detection
  • A background-agnostic framework with adversarial training for abnormal event detection in video
  • Attribute-based representations for accurate and interpretable video anomaly detection (opens arXiv in a new tab)
  • Bytetrack: Multi-object tracking by associating every detection box
  • Mmtracking: Openmmlab video perception toolbox and benchmark
  • Adam: A Method for Stochastic Optimization
  • Pytorch: An imperative style, high-performance deep learning library
  • High-resolution image synthesis with latent diffusion models
  • All are worth words: A vit backbone for diffusion models
  • One transformer fits all distributions in multi-modal diffusion at scale
  • Microsoft coco: Common objects in context