GitPedia

PDVC

End-to-End Dense Video Captioning with Parallel Decoding (ICCV 2021)

From ttengwang·Updated April 9, 2026·View on GitHub·

Official implementation for End-to-End Dense Video Captioning with Parallel Decoding (ICCV 2021) The project is written primarily in Python, distributed under the MIT License license, first published in 2021. Key topics include: activitynet-captions, dense-video-captioning, video-paragraph-captioning, youcook2.

PDVC

Official implementation for End-to-End Dense Video Captioning with Parallel Decoding (ICCV 2021)

[paper] [valse论文速递(Chinese)]

This repo supports:

  • two video captioning tasks: dense video captioning and video paragraph captioning
  • two datasets: ActivityNet Captions and YouCook2
  • video features containing C3D, TSN, and TSP.
  • visualization of the generated captions of your own videos

Table of Contents:

Updates

  • (2021.11.19) add code for running PDVC on raw videos and visualize the generated captions (support Chinese and other non-English languages)
  • (2021.11.19) add pretrained models with TSP features. It achieves 9.03 METEOR(2021) and 6.05 SODA_c, a very competitive result on ActivityNet Captions without self-critical sequence training.
  • (2021.08.29) add TSN pretrained models and support YouCook2

Introduction

PDVC is a simple yet effective framework for end-to-end dense video captioning with parallel decoding (PDVC), by formulating the dense caption generation as a set prediction task. Without bells and whistles, extensive experiments on ActivityNet Captions and YouCook2 show that PDVC is capable of producing high-quality captioning results, surpassing the state-of-the-art methods when its localization accuracy is on par with them.
pdvc.jpg

Preparation

Environment: Linux, GCC>=5.4, CUDA >= 9.2, Python>=3.7, PyTorch>=1.5.1

  1. Clone the repo
bash
git clone --recursive https://github.com/ttengwang/PDVC.git
  1. Create virtual environment by conda
bash
conda create -n PDVC python=3.7 source activate PDVC conda install pytorch==1.7.1 torchvision==0.8.2 cudatoolkit=10.1 -c pytorch conda install ffmpeg pip install -r requirement.txt
  1. Compile the deformable attention layer (requires GCC >= 5.4).
bash
cd pdvc/ops sh make.sh

Running PDVC on Your Own Videos

Download a pretrained model (GoogleDrive) with TSP features and put it into ./save. Then run:

bash
video_folder=visualization/videos output_folder=visualization/output pdvc_model_path=save/anet_tsp_pdvc/model-best.pth output_language=en bash test_and_visualize.sh $video_folder $output_folder $pdvc_model_path $output_language

check the $output_folder, you will see a new video with embedded captions.
Note that we generate non-English captions by translating the English captions by GoogleTranslate.
To produce Chinese captions, set output_language=zh-cn.
For other language support, find the abbreviation of your language at this url, and you also may need to download a font supporting your language and put it into ./visualization.

demo.gifdemo.gif

Training and Validation

Download Video Features

bash
cd data/anet/features bash download_anet_c3d.sh # bash download_anet_tsn.sh # bash download_i3d_vggish_features.sh # bash download_tsp_features.sh

The preprocessed C3D features have been uploaded to baiduyun drive

Dense Video Captioning

  1. PDVC with learnt proposals
# Training
config_path=cfgs/anet_c3d_pdvc.yml
python train.py --cfg_path ${config_path} --gpu_id ${GPU_ID}
# The script will evaluate the model for every epoch. The results and logs are saved in `./save`.

# Evaluation
eval_folder=anet_c3d_pdvc # specify the folder to be evaluated
python eval.py --eval_folder ${eval_folder} --eval_transformer_input_type queries --gpu_id ${GPU_ID}
  1. PDVC with ground-truth proposals
# Training
config_path=cfgs/anet_c3d_pdvc_gt.yml
python train.py --cfg_path ${config_path} --gpu_id ${GPU_ID}

# Evaluation
eval_folder=anet_c3d_pdvc_gt
python eval.py --eval_folder ${eval_folder} --eval_transformer_input_type gt_proposals --gpu_id ${GPU_ID}

Video Paragraph Captioning

  1. PDVC with learnt proposals
bash
# Training config_path=cfgs/anet_c3d_pdvc.yml python train.py --cfg_path ${config_path} --criteria_for_best_ckpt pc --gpu_id ${GPU_ID} # Evaluation eval_folder=anet_c3d_pdvc # specify the folder to be evaluated python eval.py --eval_folder ${eval_folder} --eval_transformer_input_type queries --gpu_id ${GPU_ID}
  1. PDVC with ground-truth proposals
# Training
config_path=cfgs/anet_c3d_pdvc_gt.yml
python train.py --cfg_path ${config_path} --criteria_for_best_ckpt pc --gpu_id ${GPU_ID}

# Evaluation
eval_folder=anet_c3d_pdvc_gt
python eval.py --eval_folder ${eval_folder} --eval_transformer_input_type gt_proposals --gpu_id ${GPU_ID}

Performance

Dense video captioning (with learnt proposals)

ModelFeaturesconfig_pathUrlRecallPrecisionBLEU4METEOR2018METEOR2021CIDErSODA_c
PDVC_lightC3Dcfgs/anet_c3d_pdvcl.ymlGoogle Drive55.3058.421.557.137.6624.805.23
PDVCC3Dcfgs/anet_c3d_pdvc.ymlGoogle Drive55.2057.361.827.488.0928.165.47
PDVC_lightTSNcfgs/anet_tsn_pdvcl.ymlGoogle Drive55.3457.971.667.417.9727.235.51
PDVCTSNcfgs/anet_tsn_pdvc.ymlGoogle Drive56.2157.461.928.008.6329.005.68
PDVC_lightTSPcfgs/anet_tsp_pdvcl.ymlGoogle Drive55.2457.781.777.948.5528.255.95
PDVCTSPcfgs/anet_tsp_pdvc.ymlGoogle Drive55.7957.392.178.379.0331.146.05

Notes:

Video paragraph captioning (with learnt proposals)

ModelFeaturesconfig_pathBLEU4METEORCIDEr
PDVCC3Dcfgs/anet_c3d_pdvc.yml9.6714.7416.43
PDVCTSNcfgs/anet_tsn_pdvc.yml10.1815.9620.66
PDVCTSPcfgs/anet_tsp_pdvc.yml10.4616.4220.91

Notes:

  • Paragraph-level scores are evaluated on the ActivityNet Entity ae-val set.

Citation

If you find this repo helpful, please consider citing:

@inproceedings{wang2021end,
  title={End-to-End Dense Video Captioning with Parallel Decoding},
  author={Wang, Teng and Zhang, Ruimao and Lu, Zhichao and Zheng, Feng and Cheng, Ran and Luo, Ping},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={6847--6857},
  year={2021}
}
@ARTICLE{wang2021echr,
  author={Wang, Teng and Zheng, Huicheng and Yu, Mingjing and Tian, Qian and Hu, Haifeng},
  journal={IEEE Transactions on Circuits and Systems for Video Technology}, 
  title={Event-Centric Hierarchical Representation for Dense Video Captioning}, 
  year={2021},
  volume={31},
  number={5},
  pages={1890-1900},
  doi={10.1109/TCSVT.2020.3014606}}

Acknowledgement

The implementation of Deformable Transformer is mainly based on Deformable DETR.
The implementation of the captioning head is based on ImageCaptioning.pytorch.
We thanks the authors for their efforts.

Contributors

Showing top 1 contributor by commit count.

View all contributors on GitHub →

This article is auto-generated from ttengwang/PDVC via the GitHub API.Last fetched: 6/19/2026