-
Install SlowFast (https://github.com/facebookresearch/SlowFast).
-
Prepare the pre-trained model.
- Download the SlowFast Network pre-trained on Kinetics-400 dataset.
See1-prepare_model/model_urls.txt
. PutSLOWFAST_8x8_R50.pkl
inpretrainings/
. - Put
slowfast_installation_dir/configs/Kinetics/SLOWFAST_8x8_R50.yaml
inpretrainings/
. - Convert '.pkl' format checkpoint to '.pth' file.
Cd1-prepare_model/
and runcvt_pkl2pth.sh
. ThenSLOWFAST_8x8_R50.pth
is generated inpretrainings/
.
- Download the SlowFast Network pre-trained on Kinetics-400 dataset.
-
Prepare datasets.
- Download Avenue, ShanghaiTech and Corridor datasets.
See2-prepare_data/dataset_urls.txt
. - Cd
2-prepare_data/
and runextract_frames.py
to extract frames for videos. Use '--help' to see the usage.
ST: only need to do this for the training videos.
Avenue: extract frames for both training & testing videos.
Corridor: usemvfile_corridor.py
to put all the training/testing videos in one directory first, and then extract frames (use--skip_first
option to skip the first black frame). - Convert the frame-level labels to '.npz' file.
We have done this cumbersome step. The '.npz' files can be seen ingroundtruths/
.
'.npz' file: keys=video names; values=arrays, 0 for normality, 1 for anomaly.
- Download Avenue, ShanghaiTech and Corridor datasets.
-
Extract features.
- ShanghaiTech & Avenue
Cd3-extract_features/for_ST_Avenue/
. Modify and runrun.sh
to extract features for ST and Avenue datasets. - Corridor
Cd3-extract_features/for_Corridor/
.
Runrecrop.py
first to extract 3 crops of each frame. Use '--help' to see the usage.
Then runrun.sh
to extract features for Corridor dataset. - Generate snippet-level-packaged features for all the datasets.
Step 1) and step 2) generated video-level-packaged features. However, snippet-level-packaged features will also be used afterwards.
For all the training & testing datasets, cd3-extract_features/
and runsnippet_level_packaged.py
to convert video-level-packaged features to snippet-level-packaged features.
- ShanghaiTech & Avenue
Now, for each dataset, we have got 1) video-level-packaged features, 2) snippet-level-packaged features, and 3) frame-level lables. We will use these features and lables in the training and testing codes.