To understand the world, we humans constantly need to relate the present to the past, and put events in context. In this paper, we enable existing video models to do the same. We propose a long-term feature bank---supportive information extracted over the entire span of a video---to augment state-of-the-art video models that otherwise would only view short clips of 2-5 seconds. Our experiments demonstrate that augmenting 3D convolutional networks with a long-term feature bank yields state-of-the-art results on three challenging video datasets: AVA, EPIC-Kitchens, and Charades.
@inproceedings{gu2018ava,
title={Ava: A video dataset of spatio-temporally localized atomic visual actions},
author={Gu, Chunhui and Sun, Chen and Ross, David A and Vondrick, Carl and Pantofaru, Caroline and Li, Yeqing and Vijayanarasimhan, Sudheendra and Toderici, George and Ricco, Susanna and Sukthankar, Rahul and others},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
pages={6047--6056},
year={2018}
}
@inproceedings{wu2019long,
title={Long-term feature banks for detailed video understanding},
author={Wu, Chao-Yuan and Feichtenhofer, Christoph and Fan, Haoqi and He, Kaiming and Krahenbuhl, Philipp and Girshick, Ross},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={284--293},
year={2019}
}
Model | Modality | Pretrained | Backbone | Input | gpus | Resolution | mAP | log | json | ckpt |
---|---|---|---|---|---|---|---|---|---|---|
lfb_nl_kinetics_pretrained_slowonly_r50_4x16x1_20e_ava_rgb.py | RGB | Kinetics-400 | slowonly_r50_4x16x1 | 4x16 | 8 | short-side 256 | 24.11 | log | json | ckpt |
lfb_avg_kinetics_pretrained_slowonly_r50_4x16x1_20e_ava_rgb.py | RGB | Kinetics-400 | slowonly_r50_4x16x1 | 4x16 | 8 | short-side 256 | 20.17 | log | json | ckpt |
lfb_max_kinetics_pretrained_slowonly_r50_4x16x1_20e_ava_rgb.py | RGB | Kinetics-400 | slowonly_r50_4x16x1 | 4x16 | 8 | short-side 256 | 22.15 | log | json | ckpt |
:::{note}
slowonly_r50_4x16x1
instead of I3D-R50-NL
in the original paper as the backbone of LFB, but we have achieved the similar improvement: (ours: 20.1 -> 24.11 vs. author: 22.1 -> 25.8).lfb_prefix_path
.:::
Before train or test lfb, you need to infer long-term feature bank first.
Specifically, run the test on the training, validation, testing dataset with the config file lfb_slowonly_r50_ava_infer (The config file will only infer the feature bank of training dataset and you need set dataset_mode = 'val'
to infer the feature bank of validation dataset in the config file.), and the shared head LFBInferHead will generate the feature bank.
A long-term feature bank file of AVA training and validation datasets with float32 precision occupies 3.3 GB. If store the features with float16 precision, the feature bank occupies 1.65 GB.
You can use the following command to infer feature bank of AVA training and validation dataset and the feature bank will be stored in lfb_prefix_path/lfb_train.pkl
and lfb_prefix_path/lfb_val.pkl
.
# set `dataset_mode = 'train'` in lfb_slowonly_r50_ava_infer.py
python tools/test.py configs/detection/lfb/lfb_slowonly_r50_ava_infer.py \
checkpoints/YOUR_BASELINE_CHECKPOINT.pth --eval mAP
# set `dataset_mode = 'val'` in lfb_slowonly_r50_ava_infer.py
python tools/test.py configs/detection/lfb/lfb_slowonly_r50_ava_infer.py \
checkpoints/YOUR_BASELINE_CHECKPOINT.pth --eval mAP
We use slowonly_r50_4x16x1 checkpoint from slowonly_kinetics_pretrained_r50_4x16x1_20e_ava_rgb to infer feature bank.
You can use the following command to train a model.
python tools/train.py ${CONFIG_FILE} [optional arguments]
Example: train LFB model on AVA with half-precision long-term feature bank.
python tools/train.py configs/detection/lfb/lfb_nl_kinetics_pretrained_slowonly_r50_4x16x1_20e_ava_rgb.py \
--validate --seed 0 --deterministic
For more details and optional arguments infos, you can refer to Training setting part in getting_started.
Before train or test lfb, you also need to infer long-term feature bank first. If you have generated the feature bank file, you can skip it.
The step is the same with Infer long-term feature bank for training part in Train.
You can use the following command to test a model.
python tools/test.py ${CONFIG_FILE} ${CHECKPOINT_FILE} [optional arguments]
Example: test LFB model on AVA with half-precision long-term feature bank and dump the result to a csv file.
python tools/test.py configs/detection/lfb/lfb_nl_kinetics_pretrained_slowonly_r50_4x16x1_20e_ava_rgb.py \
checkpoints/SOME_CHECKPOINT.pth --eval mAP --out results.csv
For more details, you can refer to Test a dataset part in getting_started.