Home

Awesome

Leveraging-Trajectory-Prediction-for-Pedestrian-Video-Anomaly-Detection

Asiegbu Miracle Kanu-Asiegbu, Ram Vasudevan, and Xiaoxiao Du

Clone Repo

git clone --recurse-submodules https://github.com/akanuasiegbu/Leveraging-Trajectory-Prediction-for-Pedestrian-Video-Anomaly-Detection.git

Installation

You can also use docker with 'docker/Dockerfile'. Note that I set the PYTHONPATH inside docker file would need to adjust that path "ENV PYTHONPATH "/mnt/roahm/users/akanu/projects/anomalous_pred/custom_functions:/home/akanu".

Step 1: Download Dataset

Step 2: Training

We used two two models for our experiments Long Short Term Memory (LSTM) Model and BiTrap model.

Training LSTM Models

Training BiTrap Model

Train on Avenue Dataset

cd bitrap_leveraging
python tools/train.py --config_file configs/avenue.yml

Train on ShanghaiTech Dataset

cd bitrap_leveraging
python  tools/train.py --config_file configs/st.yml

To train/inferece on CPU or GPU, simply add DEVICE='cpu' or DEVICE='cuda'. By default we use GPU for both training and inferencing.

Note that you must set the input and output lengths to be the same in YML file used (INPUT_LEN and PRED_LEN) and bitrap_leveraging/datasets/config_for_my_data.py (input_seq and pred_seq)

Step 3: Inference

Pretrained BiTrap Model:

Trained BiTrap models for Avenue and ShanghiTech can be found here

Pretrained LSTM Models:

Trained LSTM models for Avenue and ShanghiTech can be found here

LSTM Inference

We do not explictly save the LSTM trajectory outputs into a file (such as pkl). Therefore the inference and the AUC calcution step for the LSTM model are performed simultaneously. Please refer to LSTM AUC Calcuation section shown below.

BiTrap Inference

To obtain BiTrap PKL files containing the pedestrain trajectory use commands below. Test on Avenue dataset:

cd bitrap_leveraging
python tools/test.py --config_file configs/avenue.yml CKPT_DIR **DIR_TO_CKPT**

Test on ShanghaiTech dataset:

cd bitrap_leveraging
python tools/test.py --config_file configs/st.yml CKPT_DIR **DIR_TO_CKPT**
PKL Files

BiTrap pkl files can be found here.

Step 4: AUC Caluation

BiTrap AUC Calcuation

LSTM AUC Calcuation

If you want to run multiple LSTM/AUC refer to run_quick.py

Citation

If you found repo useful, feel free to cite.

@INPROCEEDINGS{9660004,
  author={Kanu-Asiegbu, Asiegbu Miracle and Vasudevan, Ram and Du, Xiaoxiao},
  booktitle={2021 IEEE Symposium Series on Computational Intelligence (SSCI)}, 
  title={Leveraging Trajectory Prediction for Pedestrian Video Anomaly Detection}, 
  year={2021},
  volume={},
  number={},
  pages={01-08},
  doi={10.1109/SSCI50451.2021.9660004}}