This code was inspired in: https://github.com/harvitronix/five-video-classification-methods
This code requires you have Keras 2 and TensorFlow 2 or greater installed. Please see the requirements.txt
file. To ensure you're up to date, run:
pip install -r requirements.txt
You must also have ffmpeg
installed in order to extract the video files.
First, download the dataset from UCF into the data
folder:
cd data && wget http://crcv.ucf.edu/data/UCF101/UCF101.rar
Then extract it with unrar e UCF101.rar
.
Next, create folders (still in the data folder) with mkdir train && mkdir test && mkdir sequences && mkdir checkpoints
.
Now you can run the scripts in the data folder to move the videos to the appropriate place, extract their frames and make the CSV file the rest of the code references. You need to run these in order. Example:
python 1_move_files.py
python 2_extract_files.py
The CNN-only method is run from train_cnn.py
.
The rest of the models are run from train.py
. There are configuration options you can set in that file to choose which model you want to run.
The models are all defined in models.py
. Reference that file to see which models you are able to run in train.py
.
Khurram Soomro, Amir Roshan Zamir and Mubarak Shah, UCF101: A Dataset of 101 Human Action Classes From Videos in The Wild., CRCV-TR-12-01, November, 2012.