/Code-Future-Frame-Prediction

[CVPR 2018] Future Frame Prediction for Anomaly Detection (pytorch implementation)

Primary LanguagePython

Future Frame Prediction

Pytorch implementation of video anomaly detection paper for CVPR 2018: Future Frame Prediction for Anomaly Detection – A New Baseline.
Most codes were obtained from the following GitHub page: [Link]
To understand the code, please refer to the Google Colab page (Korean): [Link]

I only trained the ped2 dataset, the result:

AUC USCD Ped2
original implementation 95.4%
this implementation 95.5%

The network pipeline.

ffp_pipe

Environments

PyTorch >= 1.1.
Python >= 3.6.
opencv
sklearn
Other common packages.

Prepare

  • Download the ped2 dataset and put it under the data folder.
USCD Ped2
Google Drive
  • Download the FlowNet2-SD weight and put it under the flownet/pretrained folder.
FlowNet2-SD.pth
Google Drive
  • Download the trained model and put it under the weights folder.
best_model_ped2.pth
Google Drive

Train

# default option.
python train.py --dataset=ped2 
# change 'seed'.
python train.py --dataset=ped2 --manualseed=50
# change 'max iteration'.
python train.py --dataset=ped2 --iters=60000
# change 'model save interval'.
python train.py --dataset=ped2 --save_interval=10000
# change 'validation interval'.
python train.py --dataset=ped2 --val_interval=1000
# Continue training with latest model
python train.py --dataset=ped2 --resume=latest_ped2

Evalution

# default option.
python eval.py --dataset=ped2 --trained_model=best_model_ped2
# change 'show heatmap'.
python eval.py --dataset=ped2 --trained_model=best_model_ped2 --show_heatmap=True
# change 'show roc_curve'.
python eval.py --dataset=ped2 --trained_model=best_model_ped2 --show_curve=True

Results

Validation results can be found on the path resultsby AUC graph.

AUC graph (ped2)
auc_graph

Evaluation results can be found on the path results/ped2/{best_iter} by ROC Curve, Anomaly Score, etc.

ROC Curve with AUC (ped2)
toal_auc_curve
Anomaly Score (ped2-04)
score_graph
Frame Comparison (ped2-04)
ffp_comparision

📖 Lecture Note

  • Frame-Prediction lecture note: [Link] (24.04.18)