Home

Awesome

<div align="center"> <h2>【CVPR'2023 🌟Highlight🌟 & TPAMI】Cap4Video: What Can Auxiliary Captions Do for Text-Video Retrieval? </h2>

Conference arXiv

Wenhao Wu<sup>1,2</sup>, Haipeng Luo<sup>3</sup>, Bo Fang<sup>3</sup>, Jingdong Wang<sup>2</sup>, Wanli Ouyang<sup>4,1</sup>

<sup>1</sup>The University of Sydney, <sup>2</sup>Baidu, <sup>3</sup>UCAS, <sup>4</sup>Shanghai AI Lab

</div>

PWC PWC PWC PWC

Welcome to the official implementation of Cap4Video - an innovative framework that maximizes the utility of auxiliary captions generated by powerful LLMs (e.g., GPT) to enhance video-text matching.

<details open><summary>πŸ“£ I also have other cross-modal video projects that may interest you ✨. </summary><p>

Revisiting Classifier: Transferring Vision-Language Models for Video Recognition<br> Wenhao Wu, Zhun Sun, Wanli Ouyang <br> Conference Journal github

Bidirectional Cross-Modal Knowledge Exploration for Video Recognition with Pre-trained Vision-Language Models<br> Wenhao Wu, Xiaohan Wang, Haipeng Luo, Jingdong Wang, Yi Yang, Wanli Ouyang <br> Conference github

</p></details> <!-- I am currently traveling and may not be able to open-source the code until May. -->

News

Overview

Cap4Video leverages captions generated by large language models to improve text-video matching in three ways: (1) input data augmentation during training, (2) intermediate video-caption feature interaction for creating compact video representations, and (3) output score fusion for enhancing text-video matching. Cap4Video is compatible with both global and fine-grained matching.

Cap4Video

<!-- ## Content - [Prerequisites](#prerequisites) - [Data Preparation](#data-preparation) - [Training](#training) - [BibTeX & Citation](#bibtex) - [Acknowledgment](#acknowledgment) -->

Requirement

# From CLIP
conda install --yes -c pytorch pytorch=1.8.1 torchvision cudatoolkit=11.1
pip install ftfy regex tqdm
pip install opencv-python boto3 requests pandas

Data Preparing

All video datasets can be downloaded from respective official links. In order to improve training efficiency, we have preprocessed these videos into frames, which we have packaged and uploaded for convenient reproduction of our results.

DatasetOfficial LinkOurs
MSRVTTVideoFrames
DiDeMoVideoVideo
MSVDVideoFrames
VATEXVideoFrames

How to Run

Visualization

The text-video results on the MSR-VTT 1K-A test set. Left: The ranking results of the query-video matching model. Right: The ranking results of Cap4Video, which incorporates generated captions to enhance retrieval.

<div align="center"> <img src="docs/vis.png" width="550"> </div>

<a name="bibtex"></a>

πŸ“Œ BibTeX & Citation

If you use our code in your research or wish to refer to the results, please star 🌟 this repo and use the following BibTeX πŸ“‘ entry.

@inproceedings{cap4video,
  title={Cap4Video: What Can Auxiliary Captions Do for Text-Video Retrieval?},
  author={Wu, Wenhao and Luo, Haipeng and Fang, Bo and Wang, Jingdong and Ouyang, Wanli},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
  year={2023}
}

<a name="acknowledgment"></a>

πŸŽ—οΈ Acknowledgement

This repository is built in part on the excellent works of CLIP4Clip and DRL. We use Video ZeroCap to pre-extract captions from the videos. We extend our sincere gratitude to these contributors for their invaluable contributions.

πŸ‘« Contact

For any questions, please feel free to file an issue.