Skip to content

vt-le/DualAnomaly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

DualAnomaly

This is the code for DualAnomaly: A Dual Spatio-Temporal Cross-Attention Framework for Robust Video Anomaly Detection.

Related Works

HSTforU: See HSTforU: Anomaly Detection in Aerial and Ground-based Videos with Hierarchical Spatio-Temporal Transformer for U-net.

ASTNet: See Attention-based Residual Autoencoder for Video Anomaly Detection.

Updates

Setup

The code can be run under any environment with Python 3.7 and above. (It may run with lower versions, but we have not tested it).

Install the required packages:

pip install -r requirements.txt

Clone this repo:

git clone https://github.com/vt-le/DualAnomaly.git
cd DualAnomaly/

We evaluate DualAnomaly on:

Dataset Link
UCSD Ped2 Google drive
CUHK Avenue Google drive
ShanghaiTech Google drive

Training

To train DualAnomaly on a dataset, run:

 python -m torch.distributed.launch --nproc_per_node <num-of-gpus-to-use> --master_port 12345  train.py --cfg <config-file>

Evaluation

Please first download the pre-trained model

Dataset Pretrained Model
UCSD Ped2 Google drive
CUHK Avenue Google drive
ShanghaiTech Google drive

To evaluate a pretrained DualAnomaly on a dataset, run:

 python test.py \
    --cfg <path/to/config/file> \
    --pretrained </path/to/pre-trained/model> \
    [--batch-size <batch-size> --tag <job-tag>]

For example, to evaluate DualAnomaly on Ped2:

python test.py \
    --cfg config/scripts/ped2/ped2_pvt2_hst.yaml \
    --model-file output/DualAnomaly/ped2_pvt2_hst/ckpt_ped2.pth

Configuration

  • We use YAML for configuration.
  • We provide a couple preset configurations.
  • Please refer to config.py for documentation on what each configuration does.

Citing

If you find our work useful, please consider citing:

@Article{le2025dualanomaly,
author={Le, Viet-Tuan
and Kim, Yong-Guk},
title={DualAnomaly: A Dual Spatio-Temporal Cross-Attention Framework for Robust Video Anomaly Detection},
}

Contact

For any question, please file an issue or contact:

Viet-Tuan Le: [email protected]

About

DualAnomaly: Dual Cross-Attention Prediction for Video Anomaly Detection

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published