This is the official PyTorch implementation of the paper "Efficient Action Counting with Dynamic Queries". It provides a novel perspective to tackle the Temporal Repetition Counting problem using a simple yet effective representation for action cycles, reducing the computational complexity from quadratic to linear with SOTA performance.
We build our code based on the MMaction2 project (1.3.10 version). See here for more details if you are interested. MMCV is needed before install MMaction2, which can be install with:
pip install mmcv-full-f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
# For example, to install the latest mmcv-full with CUDA 11.1 and PyTorch 1.9.0, use the following command:
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
For other CUDA or pytorch version, please refer to mmcv.
Then, our code can be built by
cd DeTRC
pip3 install -e .
Then, Install the 1D Grid Sampling and RoI Align operators.
cd DeTRC/model
python setup.py build_ext --inplace
We use the TSN feature of RepCountA and UCFRep datasets. Please refer to the guidance here.
Our model can be trained with
python tools/train.py DeTRC/configs/repcount_tsn_feature_enc_contrastive.py --validate
We recommend to set the --validate
flag to monitor the training process.
If you want to test the pretrained model, please use the following code. We provide the pretrained model here.
python tools/test.py DeTRC/configs/repcount_tsn_feature_enc_contrastive.py PATH_TO_CHECKPOINT
Comparison with SOTA:
If you find our work useful for your project, please cite the paper as below:
@article{li2024efficient,
title={Efficient Action Counting with Dynamic Queries},
author={Li, Zishi and Ma, Xiaoxuan and Shang, Qiuyan and Zhu, Wentao and Ci, Hai and Qiao, Yu and Wang, Yizhou},
journal={arXiv preprint arXiv:2403.01543},
year={2024}
}