We present a simple training script that can be used for replicating the result of resenet-based video models. All models are trained on Kinetics400 dataset, a benchmark dataset for human-action recognition. The accuracy is reported on the traditional validation split.
To download videos, one can use https://github.com/Showmax/kinetics-downloader. Please note that the dataset can take up upwards of 400GB, depending on the quality setting during download.
Training
We assume the training and validation AVI videos are stored at /data/kinectics400/train and
/data/kinectics400/val. For training we suggest starting with the hyperparameters reported in the paper, in order to match the performance of said models. Clip sampling strategy is a particularly important parameter during training, and we suggest using random temporal jittering during training - in other words sampling multiple training clips from each video with random start times during at every epoch. This functionality is built into our training script, and optimal hyperparameters are set by default.
Note: all our models were trained on 8 nodes with 8 V100 GPUs each for a total of 64 GPUs. Expected training time for 64 GPUs is 24 hours, depending on the storage solution.
Note 2: hyperparameters for exact replication of our training can be found on the section below. Some hyperparameters such as learning rate must be scaled linearly in proportion to the number of GPUs. The default values assume 64 GPUs.
Single GPU
Note: training on a single gpu can be extremely slow.
Input data augmentations at training time (with optional parameters):
1. ConvertImageDtype
2. Resize (resize size value above)
3. Random horizontal flip (0.5)
4. Normalization (mean, std, see values above)
5. Random Crop (crop size value above)
6. Convert BCHW to CBHW
Input data augmentations at validation time (with optional parameters):
1. ConvertImageDtype
2. Resize (resize size value above)
3. Normalization (mean, std, see values above)
4. Center Crop (crop size value above)
5. Convert BCHW to CBHW
This translates in the following set of command-line arguments. Please note that --batch-size parameter controls the
batch size per GPU. Moreover, note that our default --lr is configured for 64 GPUs which is how many we used for the
Video resnet models:
# number of frames per clip
--clip_len16 \
--frame-rate15 \
# allow for temporal jittering
--clips_per_video5 \
--batch-size24 \
--epochs45 \
--lr0.64 \
# we use 10 epochs for linear warmup
--lr-warmup-epochs10 \
# learning rate is decayed at 20, 30, and 40 epoch by a factor of 10
--lr-milestones20, 30, 40 \
--lr-gamma0.1 \
--train-resize-size128171 \
--train-crop-size112112 \
--val-resize-size128171 \
--val-crop-size112112
S3D
The S3D model was trained similarly to the above but with the following changes on the default configuration:
[0] _D. Tran, H. Wang, L. Torresani, J. Ray, Y. LeCun and M. Paluri_: A Closer Look at Spatiotemporal Convolutions for Action Recognition. _CVPR 2018_ (paper)
[1] _W. Kay, J. Carreira, K. Simonyan, B. Zhang, C. Hillier, S. Vijayanarasimhan, F. Viola, T. Green, T. Back, P. Natsev, M. Suleyman, A. Zisserman_: The Kinetics Human Action Video Dataset (paper)