Official PyTorch implementation of "Synthetic Temporal Anomaly Guided End-to-End Video Anomaly Detection"
This is the implementation of the paper "Synthetic Temporal Anomaly Guided End-to-End Video Anomaly Detection" (ICCV Workshops 2021: RSL-CV).
- Python 3.6
- PyTorch = 1.7.0
- Numpy
- Sklearn
Download the datasets into dataset folder, like ./dataset/ped2/, ./dataset/avenue/, ./dataset/shanghai/
git clone https://github.com/aseuteurideu/STEAL- Training baseline
python train.py --dataset_type ped2- Training STEAL Net
python train.py --dataset_type ped2 --pseudo_anomaly_jump 0.01 --jump 2 3 4 5Select --dataset_type from ped2, avenue, or shanghai.
For more details, check train.py
| Model | Dataset | AUC | Weight |
|---|---|---|---|
| Baseline | Ped2 | 92.5% | [ drive ] |
| Baseline | Avenue | 81.5% | [ drive ] |
| Baseline | ShanghaiTech | 71.3% | [ drive ] |
| STEAL Net | Ped2 | 98.4% | [ drive ] |
| STEAL Net | Avenue | 87.1% | [ drive ] |
| STEAL Net | ShanghaiTech | 73.7% | [ drive ] |
- Test the model
python evaluate.py --dataset_type ped2 --model_dir path_to_weight_file.pth- Test the model and save result image
python evaluate.py --dataset_type ped2 --model_dir path_to_weight_file.pth --img_dir folder_path_to_save_image_results- Test the model and generate demonstration video frames
python evaluate.py --dataset_type ped2 --model_dir path_to_weight_file.pth --vid_dir folder_path_to_save_video_resultsThen compile the frames into video. For example, to compile the first video in ubuntu:
ffmpeg -framerate 10 -i frame_00_%04d.png -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p video_00.mp4@InProceedings{Astrid_2021_ICCV,
author = {Astrid, Marcella and Zaheer, Muhammad Zaigham and Lee, Seung-Ik},
title = {Synthetic Temporal Anomaly Guided End-to-End Video Anomaly Detection},
booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV) Workshops},
month = {October},
year = {2021},
pages = {207-214}
}
The code is built on top of code provided by Park et al. [ github ] and Gong et al. [ github ]