Home

Awesome

Learn to Understand Negation in Video Retrieval

This is the official source code of our paper: Learn to Understand Negation in Video Retrieval.

Requirements

We used Anaconda to setup a deep learning workspace that supports PyTorch. Run the following script to install all the required packages.

conda create -n py37 python==3.7 -y
conda activate py37
git clone git@github.com:ruc-aimc-lab/nT2VR.git
cd nT2VR
pip install -r requirements.txt

Prepare Data

Download official video data

Download text data for Training & Evaluation in nT2V

Download data for training & evaluation in nT2V. We use the prefix "msrvtt10k" and "msrvtt1kA" to distinguish MSR-VTT3k split and MSR-VTT1k split.

Evaluation on test queries of nT2V

We provide script for evaluting zero-shot CLIP, CLIP* and CLIP-bnl on nT2V.

MSR-VTT3k

Model CheckpointOriginalNegatedComposed
$R1$$R5$$R10$$MIR$$\Delta R1$$\Delta R5$$\Delta R10$$\Delta MIR$$R1$$R5$$R10$$MIR$
CLIP20.840.349.70.3051.52.52.90.0206.924.235.60.160
CLIP*27.753.064.20.3980.51.11.10.00811.433.346.20.225
CLIP (boolean)--------18.837.546.25.916.723.90.1180.116
CLIP* (boolean)--------25.347.156.113.533.745.50.2360.243
CLIP-bnl28.453.764.60.4045.06.96.90.05715.340.053.30.274

MSR-VTT1k

Model CheckpointOriginalNegatedComposed
$R1$$R5$$R10$$MIR$$\Delta R1$$\Delta R5$$\Delta R10$$\Delta MIR$$R1$$R5$$R10$$MIR$
CLIP31.654.264.20.4221.41.41.50.01712.935.046.20.237
CLIP*41.169.879.90.5430.01.71.00.00617.346.861.20.310
CLIP (boolean)--------26.446.256.80.3546.318.425.90.129
CLIP* (boolean)--------35.959.565.20.46317.642.052.00.291
CLIP-bnl42.168.479.60.54612.211.714.40.12124.857.668.80.391

VATEX

Model CheckpointOriginalNegatedComposed
$R1$$R5$$R10$$MIR$$\Delta R1$$\Delta R5$$\Delta R10$$\Delta MIR$$R1$$R5$$R10$$MIR$
CLIP41.472.982.70.5551.92.12.20.01810.528.341.30.201
CLIP*56.888.494.40.7030.20.40.70.00414.239.253.30.266
CLIP (boolean)--------32.557.264.50.4315.018.025.60.116
CLIP* (boolean)--------25.347.156.10.35314.134.445.10.243
CLIP-bnl57.688.394.00.70814.011.78.60.12516.639.953.90.284
# use 'rootpath' to specify the path to the data folder
cd shell/test
bash clip.sh
# use 'rootpath' to specify the path to the data folder
# use 'model_path' to specify the path of model
cd shell/test
bash clipft.sh
cd shell/test
bash clip_bool.sh
cd shell/test
bash clipft_bool.sh
cd shell/test
bash clip_bnl.sh

Train CLIP-bnl from scratch

# use 'rootpath' to specify the path to the data folder
cd shell/train
bash msrvtt7k_clip_bnl.sh
cd shell/train
bash msrvtt9k_clip_bnl.sh
cd shell/train
bash vatex_clip_bnl.sh

Produce new negated & composed data

  1. install additional packages:
cd negationdata
pip install -r requirements.txt
  1. download checkpoint of negation scope detection model,which is built on NegBERT
  2. run the script prepare_data.sh
# use 'rootpath' to specify the path to the data folder
#use 'cache_dir'to specify the path to path of models used in negation scope detection model 
cd negationdata
bash prepare_data.sh

Citation

@inproceedings{mm22-nt2vr,
title = {Learn to Understand Negation in Video Retrieval},
author = {Ziyue Wang and Aozhu Chen and Fan Hu and Xirong Li},
year = {2022},
booktitle = {ACMMM},
}

Contact

If you enounter issues when running the code, please feel free to reach us.