Meta-learning guided weakly supervised video anomaly detection with dual memory and temporal attention
Weakly supervised video anomaly detection (WSAD) aims to localise anomalous events in untrimmed videos using only video-level labels. Existing multiple instance learning (MIL) methods often suffer from poor generalisation to unseen anomaly types, unstable temporal attention, and limited adaptability when only a few labelled examples are available. To address these challenges, we propose a meta-learning framework that combines Model-Agnostic Meta-Learning (MAML) with a dual-memory, transformer-based architecture. The model incorporates a dual-branch temporal attention module that captures both long-range semantic dependencies and local temporal proximity, separate memory banks for normal and abnormal prototypes with gated inhibition, metric-learning constraints, and variational latent regularisation. MAML explicitly trains the model for rapid adaptation across heterogeneous anomaly distributions, forcing it to acquire task-invariant representations rather than memorising static training statistics. Extensive experiments on two standard benchmarks yield competitive frame-level AUC of 93.60% on XD-Violence and 86.10% on UCF-Crime. One of our main contributions is the demonstration of very good metrics for zero and few-shot cross dataset transfer experiments, using only a handful of weakly labelled videos. We thus provide a useful proof of concept where MAML has been shown to learn generalized anomaly and non-anomaly representations with a transformer based architecture and a dual memory backbone. A t-SNE analysis of the memory prototypes confirms that MAML produces well-separated normal and abnormal clusters, while without meta-learning the memory banks collapse into entangled representations. The model is also shown to be computationally efficient, confirming its practical value for real-world surveillance deployment.