Giter Site home page Giter Site logo

jackyccl / astnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vt-le/astnet

0.0 0.0 0.0 44.89 MB

This is an official implementation for "Attention-based Residual Autoencoder for Video Anomaly Detection".

License: MIT License

JavaScript 1.52% Python 80.70% CSS 0.49% HTML 17.29%

astnet's Introduction

ASTNet: Attention-based Residual Autoencoder for Video Anomaly Detection

This is the official implementation of Attention-based Residual Autoencoder for Video Anomaly Detection.

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

Updates

  • [6/01/2023] Training script of ASTNet is released.
  • [5/25/2022] ASTNet is available online.
  • [4/21/2022] Code of ASTNet is released!

Prerequisites

  • Linux or macOS
  • Python 3
  • PyTorch 1.7.0

Setup

The code can be run with Python 3.6 and above.

Install the required packages:

pip install -r requirements.txt

Clone this repo:

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

Data preparation

We evaluate ASTNet on:

A dataset is a directory with the following structure:

$ tree data
ped2/avenue
├── training
│   └── frames
│       ├── ${video_1}$
│       │   ├── 000.jpg
│       │   ├── 001.jpg
│       │   └── ...
│       ├── ${video_2}$
│       │   ├── 00.jpg
│       │   └── ...
│       └── ...
├── testing
│   └── frames
│       ├── ${video_1}$
│       │   ├── 000.jpg
│       │   ├── 001.jpg
│       │   └── ...
│       ├── ${video_2}$
│       │   ├── 000.jpg
│       │   └── ...
│       └── ...
└── ped2/avenue.mat

shanghaitech
├── training
│   └── frames
│       ├── ${video_1}$
│       │   ├── 000.jpg
│       │   ├── 001.jpg
│       │   └── ...
│       ├── ${video_2}$
│       │   ├── 00.jpg
│       │   └── ...
│       └── ...
├── testing
│   └── frames
│       ├── ${video_1}$
│       │   ├── 000.jpg
│       │   ├── 001.jpg
│       │   └── ...
│       ├── ${video_2}$
│       │   ├── 000.jpg
│       │   └── ...
│       └── ...
└── test_frame_mask
    ├── 01_0014.npy
    ├── 01_0015.npy
    └── ...

Evaluation

Please first download the pre-trained model

Dataset Pretrained Model
UCSD Ped2 github / drive
CUHK Avenue github / drive
ShanghaiTech github / drive

To evaluate a pretrained ASTNet on a dataset, run:

 python test.py \
    --cfg <path/to/config/file> \
    --model-file </path/to/pre-trained/model>

For example, to evaluate ASTNet on Ped2:

python test.py \
    --cfg config/ped2_wresmet.yaml \
    --model-file pretrained.ped2.ptn

Training from scratch

To train ASTNet on a dataset, run:

python train.py \
    --cfg <path/to/config/file>

For example, to train ASTNet on Ped2:

python train.py \
    --cfg config/ped2_wresmet.yaml

Notes:

  • To change other options, see <config/config_file.yaml>.

Citing

If you find our work useful for your research, please consider citing:

@article{le2023attention,
  title={Attention-based residual autoencoder for video anomaly detection},
  author={Le, Viet-Tuan and Kim, Yong-Guk},
  journal={Applied Intelligence},
  volume={53},
  number={3},
  pages={3240--3254},
  year={2023},
  publisher={Springer}
}

Contact

For any question, please file an issue or contact:

Viet-Tuan Le: [email protected]

astnet's People

Contributors

vt-le 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.