Skip to main content

Benchmarking and Improving Detail Image Caption

License

All code and data will be released soon.

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.

Overview

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.

Detail Image Caption Benchmark

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 $5000$ $25,010$ $10.59$ $61,448$
Nocapsval Openimages Human $4500$ $45,000$ $11.49$ $116,969$
DetailCaps-100 COCO, SAM, LAION, CC, SBU GPT-4V&Human $100$ $100$ $175.96$ $10,858$
DetailCaps-4870 COCO, SAM, LAION, CC, SBU, Coyo, Flickr GPT-4V&Gemini-1.5-Pro $4870$ $9740$ $122.06$ $377,184$

The evaluation dataset will soon be available on Huggingface. Please download the dataset and put it under the datasets folder.

Detail Image Caption Evaluation Metric: CAPTURE

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 $\rho$ $\uparrow$ $1-R^2$ $\downarrow$ Kendall's $\tau$ $\uparrow$ Sample $\tau$ $\uparrow$
BLEU $0.2625$ $60.57$ $0.1879$ $0.2488$
ROUGE-L $0.2923$ $138.06$ $0.2127$ $0.3312$
CIDEr $0.1024$ $1.99e^7$ $0.1034$ $0.0756$
METEOR $0.4015$ $289.02$ $0.2922$ $0.4075$
SPICE $0.4368$ $128.85$ $0.3230$ $0.4687$
CLIPScore $0.3498$ $32.46$ $0.2423$ $0.3519$
CAPTURE $0.5051$ $8.20$ $0.3822$ $0.5927$

Improving Detail Image Caption

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 $51.23$ $51.27$ $51.25$
LLaVA-1.5-7B syn $57.11$ $56.18$ $56.64$
LLaVA-1.5-13B self $51.76$ $51.45$ $51.61$
LLaVA-1.5-13B syn $57.36$ $56.83$ $57.09$
LLaVA-NEXT-7B self $61.48$ $59.86$ $60.67$
LLaVA-NEXT-7B syn $62.24$ $60.10$ $61.17$
Mini-Gemini-7B-HD self $59.51$ $57.68$ $58.59$
Mini-Gemini-7B-HD syn $60.44$ $58.64$ $59.54$

Quick Start

Environment

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

Detail Image Caption Evaluation

To evaluate the performance of a LVLM on DetailCaps-4870, run the following scripts.

bash evaluate.sh <model_prediction>

<model_prediction> is the path of the model-generated caption file. Please organize your results in the following format:

{
    'id': '0001',
    'caption': 'A man is walking on the street.'
}, 
......

Detail Image Caption Construction

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>

Citation

@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}
}

Metadata

Release files for capture-metric 0.1.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for capture-metric 0.1.13
File Size Uploaded Provenance Actions
capture_metric-0.1.13.tar.gz 14.4 kB Without provenance Details for capture_metric-0.1.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for capture-metric 0.1.13
File Interpreter ABI Platform Actions
capture_metric-0.1.13-py3-none-any.whl Python 3 none any Details for capture_metric-0.1.13-py3-none-any.whl

Total release size: 26.1 kB

Release files / capture_metric-0.1.13.tar.gz

Download URL capture_metric-0.1.13.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
28b7b73db782c60a931dd06132f5cbbf11fc205552504f471a5c079d641d4938
BLAKE2b-256 checksum
How to use checksums
6a33082ae2d83024e73969a77032d1acc4743719e1c76432f6a92f6f3b96ccc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.2

Release files / capture_metric-0.1.13-py3-none-any.whl

Download URL capture_metric-0.1.13-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8f39b010ca97f15df3679db9c6f20930ad5641a9ba7133f86a3a490f054c6a8
BLAKE2b-256 checksum
How to use checksums
c97bf463a30b358072065d437aba497eb142655c5365633d6bcbcbbea0abf3fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.2

Security for capture-metric 0.1.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page