Manuscript Offprint

arXiv:2611.09536

Multimodal Training with Knowledge Traction for Video Anomaly Detection

Xiao Tan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

The task of weakly supervised video anomaly detection is challenging. Existing approaches mainly model video frame features and determine whether anomalies are present based on their magnitudes. In this work, we propose a novel method that incorporates external knowledge into training to improve model performance, robustness, and generalization. We leverage textual prompts and a large language model (LLM) to establish prior information for the specific task, and employ dictionary learning to normalize and compress this information. Moreover, during experiments, we observed inconsistencies in the textual descriptions extracted from similar video frames by image caption models. To address this, we devise a method that leverages an LLM and auxiliary information to ensure consistency in the textual descriptions of similar frames within a video. Finally, we introduce a feature processing approach that incorporates prior knowledge and cross-modal attention mechanisms. This approach learns the relationships and characteristics among different modalities to construct more accurate and reliable feature representations, thereby improving the accuracy and stability of downstream tasks. Experimental results demonstrate that our method surpasses other state-of-the-art approaches.

1. Introduction

Anomaly detection in videos is a critical task with applications across many domains such as surveillance, healthcare, and autonomous driving[10, 24]. The goal is to identify irregular events that deviate from normal patterns in video data. However, annotated real-world video datasets containing anomalies are limited due to the prohibitive cost of exhaustive manual annotation. This has led to increasing interest in weakly supervised anomaly detection[13], where models are trained on videos with only video-level labels indicating the presence of anomalies instead of frame-level or pixel-level annotations.

While weakly supervised methods reduce annotation costs, modeling normal activities and detecting anomalies

Figure

Multimodal Training with Knowledge Traction for Video Anomaly Detection (Ours)

Figure 1. The overall framework of the proposed method. The blue line is the data flow of the classical method and the red line is the data flow of our method. The three modules marked with stars are the novelties of our approach.

from only video-level labels remains challenging. Existing approaches[21, 38, 39, 43] have focused on extracting discriminative features from individual frames and aggregating them to perform video-level classification. However, these methods do not explicitly model the temporal evolution of activities and often struggle to detect anomalies that persist over long durations. Recent work[29, 37] has incorporated temporal modeling using 3D ConvNets or recurrent neural networks (RNNs) over frame-level features. However, performance is still limited because these models lack sufficient supervision and tend to overfit to frequent normal activities while failing to identify infrequent anomalies effectively. Methods based solely on feature recognition or temporal information have reached a performance bottleneck. Therefore, as shown in Figure 1], we hypothesize that extracting richer information from videos and establishing prior knowledge for the targeted anomaly types, and then incorporating this knowledge as auxiliary supervision during training, would further improve the performance and generalization capability of the model.

In this work, we aim to improve weakly supervised anomaly detection by incorporating external knowledge from textual descriptions to provide richer supervision. Specifically, we leverage recent advances in large language models (LLMs) to generate textual prompts that describe normal activities and anomalies for a given dataset[46]. These prompts prime the model with high-level semantic information about the appearance and evolution of events beyond what is contained in the video-level labels.

However, directly incorporating raw prompt embeddings as additional input can be inefficient and redundant. Hence, we propose to first normalize the prompt embeddings using dictionary learning techniques[40] like Sparse Coding[17] and Dense Associative Memory[15]. This allows compressing the high-dimensional prompt embeddings into a compact dictionary of codewords that capture the essential semantic concepts. The codeword activations for a given prompt serve as its normalized representation.

More formally, let pi∈Rdp_i \in \mathbb{R}^d be the embedding for prompt ii obtained from the LLM, where dd is the dimensionality. We learn a dictionary D∈Rd×KD \in \mathbb{R}^{d \times K} with KK codewords that sparsely represents the prompt embeddings:

pi≈Dai,∥ai∥0≪K(1)p_i \approx D a_i, \quad \|a_i\|_0 \ll K \tag{1}

where ai∈RKa_i \in \mathbb{R}^K is the sparse code for prompt ii containing mostly zero activations, except for a few codewords relevant to the semantic content. We can compute the code activations efficiently using sparse coding algorithms like orthogonal matching pursuit. The code aia_i serves as the normalized prompt representation that will be provided as auxiliary input to the detection model.

Furthermore, during our experiments, we discovered a significant inconsistency issue in the scene text descriptions extracted from video frames, leading to ambiguity and distortion. This directly impacts the algorithm's ability to comprehend and recognize video content. To address this, we propose a novel consistency regularization method. For each video, we first obtain frame-level image captions using a pre-trained image captioning model such as BLIP[19, 20]. We then enforce consistency between frames with high similarity in the video by further using the LLM to generate the description from the original captions and extra supporting information generated by other models. Concretely, if ci,1,ci,2,…ci,Tc_{i,1}, c_{i,2}, \ldots c_{i,T} are the frame-level captions for video ii and di,1,di,2,…di,Td_{i,1}, d_{i,2}, \ldots d_{i,T} are extra supporting information gained by other models such as YOLO, we optimize:

cdi,1,…,cdi,T=LLMθ(ci,1,…,ci,T,di,1,…,di,T)(2)c_{d_{i,1}}, \ldots, c_{d_{i,T}} = \mathrm{LLM}_{\theta}(c_{i,1}, \ldots, c_{i,T}, d_{i,1}, \ldots, d_{i,T}) \tag{2}

where cdi,Tc_{d_{i,T}} is the textual description after LLM correction and θ\theta denotes the LLM parameters. This regularization method corrects erroneous raw text descriptions with additional information.

For modeling, we propose a novel cross-modal architecture that leverages the normalized prompt embeddings. Our model consists of three branches: an RGB stream, an optical flow stream[9], and a text stream. The RGB and flow

streams extract spatio-temporal features from frame sequences using pre-trained visual models[4]. The text stream encodes the prompt representation aia_i and cdi,Tc_{d_{i,T}} through an embedding layer followed by modeling with BART[18].

We introduce cross-modal attention mechanisms that allow bi-directional interaction between the modalities. The text stream attends to relevant normal and anomalous patterns in the video streams using a text-visual attention. Conversely, the video streams focus on regions described in the text using a visual-text attention. This multi-stage attention exchange enables deeply fused integration of the complementary modalities. After that, the prior knowledge further optimizes the fused features by increasing or suppressing the expressiveness of different regions.

Finally, the fused features are passed through classification layers to predict frame-level anomalies. The cross-modal architecture is trained end-to-end using the video labels only. We empirically demonstrate significant gains over state-of-the-art approaches on multiple benchmark datasets.

In summary, our key contributions are:

  • Leveraging LLMs to generate informative textual prompts as external knowledge and normalizing textual prompts via dictionary learning for efficient modeling
  • Enforcing caption consistency using LLMs and extra supporting information
  • Cross-modal neural architecture with bi-directional attentive fusion
  • Demonstrating improved anomaly detection on two benchmark datasets

References (47)

  • K-svd: An algorithm for designing overcomplete dictionaries for sparse representation
  • Advances in neural information processing systems, 33:1877–1901, 2020
  • Unsupervised learning of visual features by contrasting cluster assignments
  • Quo vadis, action recognition? a new model and the kinetics dataset
  • Unsupervised anomaly detection of industrial robots using sliding-window convolutional variational autoencoder
  • Mgfn: Magnitude-contrastive glance-and-focus network for weakly-supervised video anomaly detection
  • BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
  • Mist: Multiple instance self-training framework for video anomaly detection
  • Optical flow modeling and computation: A survey
  • An overview of video anomaly detection techniques: A comprehensive survey
  • Memorizing normality to detect anomaly: Memory-augmented deep autoencoder for unsupervised anomaly detection
  • Parameter-efficient transfer learning for nlp
  • Weakly supervised anomaly detection: A survey (opens arXiv in a new tab)
  • Adversarial attacks and defenses on graphs
  • Dense associative memory for pattern recognition
  • Curl: Contrastive unsupervised representations for reinforcement learning
  • Efficient sparse coding algorithms
  • BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension
  • Blip: Bootstrapping language-image pre-training for unified vision-language understanding and generation
  • BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models
  • Self-training multi-sequence learning with transformer for weakly supervised video anomaly detection
  • Weakly-supervised high-resolution segmentation of mammography images for breast cancer diagnosis
  • Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing
  • Deep video anomaly detection: A survey
  • Abnormal event detection at 150 fps in matlab
  • A revisit of sparse coding based anomaly detection in stacked rnn framework
  • Unbiased multiple instance learning for weakly supervised video anomaly detection
  • Learning regularity in skeleton trajectories for anomaly detection in videos
  • Efficient anomaly detection in surveillance videos based on multi layer perception recurrent neural network
  • Anomaly detection with multiple-hypotheses predictions
  • Learning memory-guided normality for anomaly detection
  • Locality-aware attention network with discriminative dynamics learning for weakly supervised anomaly detection
  • OpenAI Technical Report, 2018
  • Exploring the limits of transfer learning with a unified text-to-text transformer
  • Real-time flying object detection with yolov8 (opens arXiv in a new tab)
  • Ssdl: Self-supervised dictionary learning
  • 3d-convolutional neural network with generative adversarial network and autoencoder for robust anomaly detection in video surveillance
  • Real-world anomaly detection in surveillance videos
  • Weakly-supervised video anomaly detection with robust temporal feature magnitude learning
  • Dictionary learning
  • Attention is all you need
  • Weakly supervised video anomaly detection via center-guided discriminative learning
  • Self-supervised sparse representation for video anomaly detection
  • Learning causal temporal relation and feature discrimination for anomaly detection
  • Claws: Clustering assisted weakly supervised learning with normalcy suppression for anomalous event detection
  • A Survey of Large Language Models
  • Graph convolutional label noise cleaner: Train a plug-and-play action classifier for anomaly detection