Home

Awesome

NExT-QA <img src="images/logo.png" height="64" width="128">

We reproduce some SOTA VideoQA methods to provide benchmark results for our NExT-QA dataset accepted to CVPR2021. NExT-QA is a VideoQA benchmark targeting the explanation of video contents. It challenges QA models to reason about the causal and temporal actions and understand the rich object interactions in daily activities. We set up both multi-choice and open-ended QA tasks on the dataset. <strong>This repo. provides resources for multi-choice QA</strong>; open-ended QA is found in NExT-OE. For more details, please refer to our dataset page.

Todo

  1. Raw videos for train/val/test are available. You can git clone https://github.com/doc-doc/NExT-QA.git to get the QA annotations under the /dataset folder.
  2. Relation annotations are available.
  3. <s>Open evaluation server</s> and release test data.
  4. Release spatial feature (valid for 2 weeks from 2020/9/23).
  5. Release RoI feature(tensor shape (vid_num, clip_per_vid, frame_per_clip, region_per_frame, feat_dim).

Environment

Anaconda 4.8.4, python 3.6.8, pytorch 1.6 and cuda 10.2. For other libs, please refer to the file requirements.txt.

Install

Please create an env for this project using anaconda (should install anaconda first)

>conda create -n videoqa python==3.6.8
>conda activate videoqa
>git clone https://github.com/doc-doc/NExT-QA.git
>pip install -r requirements.txt #may take some time to install

Data Preparation

Please download the pre-computed features and QA annotations from here. There are 4 zip files:

After downloading the data, please create a folder ['data/feats'] at the same directory as ['NExT-QA'], then unzip the video and QA features into it. You will have directories like ['data/feats/vid_feat/', 'data/feats/qas_bert/' and 'NExT-QA/'] in your workspace. Please unzip the files in ['nextqa.zip'] into ['NExT-QA/dataset/nextqa'] and ['models.zip'] into ['NExT-QA/models/'].

(You are also encouraged to design your own pre-computed video features. In that case, please download the raw videos from NExTVideo. As NExT-QA's videos are sourced from VidOR, you can easily link the QA annotations with the corresponding videos according to the key 'video' in the ['nextqa/.csv'] files, during which you may need the map file ['nextqa/map_vid_vidorID.json']).

Usage

Once the data is ready, you can easily run the code. First, to test the environment and code, we provide the prediction and model of the SOTA approach (i.e., HGA) on NExT-QA. You can get the results reported in the paper by running:

>python eval_mc.py

The command above will load the prediction file under ['results/'] and evaluate it. You can also obtain the prediction by running:

>./main.sh 0 val #Test the model with GPU id 0

The command above will load the model under ['models/'] and generate the prediction file. If you want to train the model, please run

>./main.sh 0 train # Train the model with GPU id 0

It will train the model and save to ['models']. (The results may be slightly different depending on the environments)

Results on Val. Set

MethodsText Rep.Acc@CAcc@TAcc@DAccText Rep.Acc@CAcc@TAcc@DAcc
BlindQAGloVe26.8930.8332.6030.60BERT-FT42.6245.5343.8943.76
EVQAGloVe28.6931.2741.4431.51BERT-FT42.6446.3445.8244.24
STVQA (CVPR17)GloVe36.2536.2955.2139.21BERT-FT44.7649.2655.8647.94
CoMem (CVPR18)GloVe35.1037.2850.4538.19BERT-FT45.2249.0755.3448.04
HME (CVPR19)GloVe37.9736.9151.8739.79BERT-FT46.1848.2058.3048.72
HCRN (CVPR20)GloVe39.0940.0149.1640.95BERT-FT45.9149.2653.6748.20
HGA (AAAI20)GloVe35.7138.4055.6039.67BERT-FT46.2650.7459.3349.74
Human-87.6188.5690.4088.38-87.6188.5690.4088.38

(For comparison, please refer to the results on val/test sets in our paper.)

Multi-choice QA vs. Open-ended QA

vis mc_oe

Citation

@InProceedings{xiao2021next,
    author    = {Xiao, Junbin and Shang, Xindi and Yao, Angela and Chua, Tat-Seng},
    title     = {NExT-QA: Next Phase of Question-Answering to Explaining Temporal Actions},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2021},
    pages     = {9777-9786}
}

Acknowledgement

Our reproduction of the methods is based on the respective official repositories, we thank the authors to release their code. If you use the related part, please cite the corresponding paper commented in the code.