/MNAD

An official implementation of "Learning Memory-guided Normality for Anomaly Detection" (CVPR 2020) in PyTorch.

Primary LanguagePython

PyTorch implementation of "Learning Memory-guided Normality for Anomaly Detection"

no_imageno_image

This is the implementation of the paper "Learning Memory-guided Normality for Anomaly Detection (CVPR 2020)".

For more information, checkout the project site [website] and the paper [PDF].

Dependencies

  • Python 3.6
  • PyTorch 1.1.0
  • Numpy
  • Sklearn

Datasets

These datasets are from an official github of "Future Frame Prediction for Anomaly Detection - A New Baseline (CVPR 2018)".

Download the datasets into dataset folder, like ./dataset/ped2/

Training

  • The training and testing codes are based on prediction method
git clone https://github.com/cvlab-yonsei/projects
cd projects/MNAD/code
python Train.py # for training
  • You can freely define parameters with your own settings like
python Train.py --gpus 1 --dataset_path 'your_dataset_directory' --dataset_type avenue --exp_dir 'your_log_directory'

Pre-trained model and memory items

  • Download our pre-trained model and memory items
    Link: [model and items]
  • Note that, these are from training with the Ped2 dataset

Evaluation

  • Test the model with our pre-trained model and memory items
python Evaluate.py --dataset_type ped2 --model_dir pretrained_model.pth --m_items_dir m_items.pt
  • Test your own model
  • Check your dataset_type (ped2, avenue or shanghai)
python Evaluate.py --dataset_type ped2 --model_dir your_model.pth --m_items_dir your_m_items.pt

Bibtex

@inproceedings{park2020learning,
  title={Learning Memory-guided Normality for Anomaly Detection},
  author={Park, Hyunjong and Noh, Jongyoun and Ham, Bumsub},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={14372--14381},
  year={2020}
}