This repository contains Pytorch code for the WCPA ECCV22 paper "Consistency-based Self-Supervised Learning for Temporal Anomaly Localization" [arXiv]
@inproceedings{panariello2022consistency,
title = {Consistency-based Self-supervised Learning for Temporal Anomaly Localization},
author = {Panariello, Aniello and Porrello, Angelo and Calderara, Simone and Cucchiara, Rita},
booktitle = {Proceedings of the European Conference on Computer Vision (ECCV) Workshops},
month = {October},
year = {2022},
}
Tested with Python 3.8.13 on Ubuntu (22.04).
- Setup an empty pip environment
- Install packages using
pip install -r requirements.txt
- Place dataset in
./data/
Download Link - Run main.py
Please note that if you're running the code from Pycharm (or another IDE) you may need to manually set the working path to PROJECT_PATH
Run python main.py
to train the model.
- Removed smoothness loss as it was in conflict with the alignment loss. This leads to better and more stable results.
- Add support for gated attention [1] leading to a +3% improvement in AP frame-level.
To replicate the results of the paper, run:
python main.py --batch-size 8 --alpha 2e-8 --gamma 0.5 --no-gated-attention
[1] Ilse, Maximilian and Tomczak, Jakub and Welling, Max. Attention-based deep multiple instance learning. International conference on machine learning. PMLR, 2018.