Git Product home page Git Product logo

srnn_tsc_anomaly_detection's Introduction

A revisit of sparse coding based anomaly detection in stacked rnn framework

This repo is the official open source of [A revisit of sparse coding based anomaly detection in stacked rnn framework, ICCV 2017]

It is implemented on tensorflow. Please follow the instructions to run the code.

1. Installation (Anaconda with python3.6 installation is recommended)

  • Install 3rd-package dependencies of python (listed in requirements.txt)
numpy==1.15.4
matplotlib==2.2.2
scikit_image==0.13.1
six==1.11.0
opencv_python==3.4.3.18
h5py==2.7.1
scipy==1.1.0
tensorflow_gpu==1.11.0
seaborn==0.8.1
skimage==0.0
scikit_learn==0.20.2
tensorflow==1.12.0
PyYAML==3.13
pip install -r requirements.txt

pip install tensorflow-gpu==1.11.0

2. Download datasets

cd into Data folder of project and run the shell scripts (ped1.sh, ped2.sh, avenue.sh, shanghaitech.sh) under the Data folder.

cd dataset/anomaly_detection

Please manually download all datasets ped2.tar.gz, avenue.tar.gz and shanghaitech.tar.gz and tar -xv each tar.gz file. Folders will be like dataset/anomaly_detection/avenue/....

3. Extracting feature

cd extract_feature
git clone https://github.com/feichtenhofer/twostreamfusion.git

Please infer the instructions of the twostreamfusion model and download pretrained models.

cd extract_feature/extract_feature_twostream

Modidy the root/dataset/res_type/gpu_id in extract_feature.m

run extract_feature.m using MATLAB

4. Training

For the ICCV version:

python run_anomaly_detection.py config/anomaly_detection.yaml 0

For the TPAMI version:

python run_anomaly_detection_coherence.py config/anomaly_detection_coherence.yaml 0

5. Testing

For the ICCV version:

python run_anomaly_detection.py config/anomaly_detection.yaml 1

For the TPAMI version:

python run_anomaly_detection_coherence.py config/anomaly_detection_coherence.yaml 1

6. Evaluation

After running the testing scripts, you also need to run the evaluation.py to calculate AUC

python evaluate.py --file=results/ad_coherence/info_avenue_\* --type=compute_auc

Citation

If you find this useful, please cite our work as follows:

@article{luo2017revisit,
  title={A revisit of sparse coding based anomaly detection in stacked rnn framework},
  author={Luo, Weixin and Liu, Wen and Gao, Shenghua},
  journal={ICCV, Oct},
  volume={1},
  number={2},
  pages={3},
  year={2017}
}
@article{luo2019video,
  title={Video Anomaly Detection With Sparse Coding Inspired Deep Neural Networks},
  author={Luo, Weixin and Liu, Wen and Lian, Dongze and Tang, Jinhui and Duan, Lixin and Peng, Xi and Gao, Shenghua},
  journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
  year={2019},
  publisher={IEEE}
}

srnn_tsc_anomaly_detection's People

Contributors

stevenliuwen avatar zachluo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.