This is a PyTorch implementation of Future Frame Prediction for Anomaly Detection – A New Baseline.
![]() |
![]() |
---|---|
Input image | result |
- PyTorch
- tqdm
- Albumentations
- NumPy
- imageio
- For training, you should get a sequence of video frames which contains 'normal' situations.
- It is a good way to see UCSD Anomaly Detection Dataset to get more details.
- Put a sequence and set your training phase at train.py
class args():
# Dataset setting
channels = 3
size = 256
frames_dir = 'datasets/train'
time_steps = 5
where time_steps denotes each of size using the sliding window technique.
- Download a pretrained FlowNet model from Google Drive and write its location as follows
class args():
# optical flow setting
flownet_pretrained = 'pretrained/FlowNet2-SD.pth'
- Run the command below
python train.py
- Just run the command below
python demo.py
- Then, you can get GIF files(results/heatmap.gif) for anomalies.
- Add evaluation codes
- For architectures in this repository, I refered to great works such FlowNet, UNet and PatchDiscriminator
- You can see same results with TensorFlow in official repository, and another PyTorch implementation