Code and data for paper:
Benchmarking and Improving Detail Image Caption. Hongyuan Dong*, Jiawen Li*, Bohong Wu, Jiacong Wang, Yuan Zhang, Haoyuan Guo (* Equal Contribution)
Our paper is now available on arXiv.
Image captioning has long been regarded as a fundamental task in visual understanding. Recently, however, few large vision-language model (LVLM) research discusses model's image captioning performance because of the outdated short-caption benchmarks and unreliable evaluation metrics. In this work, we propose to benchmark detail image caption task by curating high-quality evaluation datasets annotated by human experts, GPT-4V and Gemini-1.5-Pro. We also design a more reliable caption evaluation metric called CAPTURE (CAPtion evaluation by exTracting and coUpling coRE information). CAPTURE extracts visual elements, e.g., objects, attributes and relations from captions, and then matches these elements through three stages, achieving the highest consistency with expert judgements over other rule-based or model-based caption metrics. The proposed benchmark and metric provide reliable evaluation for LVLM's detailed image captioning ability. Guided by this evaluation, we further explore to unleash LVLM's detail caption capabilities by synthesizing high-quality data through a five-stage data construction pipeline. Our pipeline only uses a given LVLM itself and other open-source tools, without any human or GPT-4V annotation in the loop. Experiments show that the proposed data construction strategy significantly improves model-generated detail caption data quality for LVLMs with leading performance, and the data quality can be further improved in a self-looping paradigm.
We release the DetailCaps-4870 benchmark, which contains 4870 images with high-quality reference captions annotated by GPT-4V&Gemini-1.5-Pro. The statistics of DetailCaps-4870 compared with other image caption benchmarks of comparables sizes is shown below:
Benchmark | Data source | Annt. expert | Img num | ref num | Avg len | Uni. 2-gram |
---|---|---|---|---|---|---|
COCOtest | COCO | Human | ||||
Nocapsval | Openimages | Human | ||||
DetailCaps-100 | COCO, SAM, LAION, CC, SBU | GPT-4V, Human | ||||
DetailCaps-4870 | COCO, SAM, LAION, CC, SBU, Coyo, Flickr | GPT-4V, GPT4O, Gemini-1.5-Pro |
The evaluation dataset will soon be available on Huggingface.
Please download the dataset and put it under the datasets
folder.
The proposed metric CAPTURE (CAPtion evaluation by exTracting and coUpling coRE information) achieves the highest consistency with expert judgements on DetailCaps benchmarks. We show the average consistency scores on DetailCaps-100 and DetailCaps-4870 benchmarks in the table below.
Caption metric | PCC |
|
Kendall's |
Sample |
---|---|---|---|---|
BLEU | ||||
ROUGE-L | ||||
CIDEr | ||||
METEOR | ||||
SPICE | ||||
CLIPScore | ||||
CAPTURE |
We evaluate SOTA open-source LVLMs' detail captioning abilities with our benchmark and metric. The results are listed below.
Model | Language Model | Caption Data | Resolution | CAPTURE |
---|---|---|---|---|
CogVLM | Vicuna-7B | Human Annt. | ||
ShareCaptioner-7B | Vicuna-7B | GPT-4V Annt. | ||
LLaVA-1.5-7B | Vicuna-7B | Synthesized | ||
LLaVA-1.5-13B | Vicuna-13B | Synthesized | ||
LLaVA-NEXT-7B | Vicuna-7B | GPT-4V Annt. |
|
|
LLaVA-NEXT-13B | Vicuna-13B | GPT-4V Annt. |
|
|
LLaVA-NEXT-34B | Hermes-2-Yi-34B | GPT-4V Annt. |
|
|
Mini-Gemini-HD-7B | Vicuna-7B | GPT-4V Annt. |
|
|
Mini-Gemini-HD-13B | Vicuna-13B | GPT-4V Annt. |
|
|
Intern-XComposerV2 | Vicuna-7B | GPT-4V Annt. | ||
InternVL-V1.2-PLUS-40B | Hermes-2-Yi-34B | GPT-4V Annt. | ||
InternVL-V1.5-26B | InternLM-20B | GPT-4V Annt. |
|
We construct a data construction pipeline to unleash LVLM's detail image captioning ability with open-source vision and language tools. We show the performance of the performance of the proposed data construction pipeline with different LVLM bachbones below.
Caption | DetailCaps-100 | DetailCaps-4870 | Average |
---|---|---|---|
LLaVA-1.5-7B self | |||
LLaVA-1.5-7B syn | |||
LLaVA-1.5-13B self | |||
LLaVA-1.5-13B syn | |||
LLaVA-NEXT-7B self | |||
LLaVA-NEXT-7B syn | |||
Mini-Gemini-7B-HD self | |||
Mini-Gemini-7B-HD syn |
Run the following scripts to prepare the environment for CAPTURE and the data construction pipeline.
conda create -n detailcaption python=3.9
conda activate detailcaption
bash prepare.sh
We have wrapped the proposed CAPTURE evaluation metric into pip package, and you can install it as follows:
pip3 install capture_metric
After installation, CAPTURE metric can be used in the same way as other caption evaluation metrics implemented in pycocoevalcap, such as BLEU, CIDEr, METEOR, ROUGE, etc. Here is an example:
from capture_metric.capture import CAPTURE
refs = {
<sample_key>: [ref_0, ref_1, ...],
...
}
preds = {
<sample_key>: [pred_caption],
...
}
evaluator = CAPTURE()
score = evaluator.compute_score(refs, preds)
print(f"CAPTURE score: {score}")
You can now use lmms_eval to evaluate you LVLM's detail image caption performance on the DetailCaps-4870 benchmark with CAPTURE metric. We refer to lmms detailcaps for more details.
For detail image caption construction, first download SAM, Owlv2, LLaVA-v1.5 (or other LVLM), LLaMA-2 and place them under ckpt
folder:
ckpt
├─sam
| ├─sam_vit_h_4b8939.pth
| └─sam_vit_l_0b3195.pth
├─owlv2-large-patch14-ensemble
├─llava-v1.5-13b
├─llava-v1.5-7b
├─llava-v1.5-13b
├─Llama-2-7b-chat-hf
└─Llama-2-13b-chat-hf
Then organize your image data in .parquet
format with binary image stored in the frame
field.
Run the followig script to generate annotations for your parquet data files stored in <source_path>
.
<model_size>
should be set as either 7b
or 13b
, corresponding to pipelines for different model size.
bash generate_all_annotations.sh <model_size> <source_path>
@article{dong2024benchmarking,
title={Benchmarking and Improving Detail Image Caption},
author={Dong, Hongyuan and Li, Jiawen and Wu, Bohong and Wang, Jiacong and Zhang, Yuan and Guo, Haoyuan},
journal={arXiv preprint arXiv:2405.19092},
year={2024}
}