DSANet
Learning to Tell Apart: Weakly Supervised Video Anomaly Detection via Disentangled Semantic Alignment (AAAI 2026)
Install / Use
/learn @lessiYin/DSANetREADME
[!NOTE] Our paper has been accepted by AAAI 2026! This is the official PyTorch implementation for DSANet.
📖 Abstract
Recent advancements in weakly-supervised video anomaly detection have achieved remarkable performance by applying the multiple instance learning paradigm based on multimodal foundation models such as CLIP to highlight anomalous instances and classify categories. However, their objectives may tend to detect the most salient response segments, while neglecting to mine diverse normal patterns separated from anomalies, and are prone to category confusion due to similar appearance, leading to unsatisfactory fine-grained classification results. Therefore, we propose a novel Disentangled Semantic Alignment Network (DSANet) to explicitly separate abnormal and normal features from coarse-grained and fine-grained aspects, enhancing the distinguishability. Specifically, at the coarse-grained level, we introduce a self-guided normality modeling branch that reconstructs input video features under the guidance of learned normal prototypes, encouraging the model to exploit normality cues inherent in the video, thereby improving the temporal separation of normal patterns and anomalous events. At the fine-grained level, we present a decoupled contrastive semantic alignment mechanism, which first temporally decomposes each video into event-centric and background-centric components using frame-level anomaly scores and then applies visual-language contrastive learning to enhance class-discriminative representations. Comprehensive experiments on two standard benchmarks, namely XD-Violence and UCF-Crime, demonstrate that DSANet outperforms existing state-of-the-art methods.
<div align="center"> <img src="assets/framework.png" width="100%" alt="Framework of DSANet"/> </div>🛠️ Environment
The code is developed and tested on a single NVIDIA RTX 4090 GPU.
To set up the environment, please run:
conda env create -f environment.yml
conda activate dsanet
📂 Data Preparation
Features
We utilize the pre-extracted CLIP features provided by VadCLIP. Please download the features for UCF-Crime and XD-Violence datasets from their official repository:
- VadCLIP Repository: GitHub - nwpu-zxr/VadCLIP
Directory Structure
After downloading, please organize the features and update the paths in the csv files located in the list/ directory:
- Open
list/ucf_CLIP_rgb.csv(or similar .csv files) and replace the feature paths with your local directory paths. - Ensure the annotations match the feature files.
🚀 Training
To train the model on a specific dataset, ensure you have updated the feature paths in the csv files first.
UCF-Crime:
python ucf_train.py
XD-Violence:
python xd_train.py
🧪 Testing
We provide the pre-trained model weights to reproduce our results.
- Download Weights: Download the
.pthfiles from Google Drive. - Placement: Place the downloaded weights into the
model/folder.
Evaluate on UCF-Crime:
python ucf_test.py
Evaluate on XD-Violence:
python xd_test.py
📊 Results
| Method | UCF-Crime (AUC/%) | XD-Violence (AP/%) | | :--- | :---: | :---: | | DSANet (Ours) | 89.44 | 86.95 |
Note: Please refer to our paper for the detailed performance comparison.
🙏 Acknowledgement
We thank the authors of the following repositories for their valuable work and codebases:
📜 Citation
If you find this repository useful for your research, please consider citing our paper:
@inproceedings{yin2026learning,
title={Learning to Tell Apart: Weakly Supervised Video Anomaly Detection via Disentangled Semantic Alignment},
author={Yin, Wenti and Zhang, Huaxin and Wang, Xiang and Lu, Yuqing and Zhang, Yicheng and Gong, Bingquan and Zuo, Jialong and Yu, Li and Gao, Changxin and Sang, Nong},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
volume={40},
number={14},
pages={12027--12035},
year={2026}
}
Related Skills
qqbot-channel
345.4kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
100.0k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
345.4kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
ddd
Guía de Principios DDD para el Proyecto > 📚 Documento Complementario : Este documento define los principios y reglas de DDD. Para ver templates de código, ejemplos detallados y guías paso
