Datasets:

Modalities:
Image
Text
Formats:
parquet
Languages:
English
ArXiv:
DOI:
Libraries:
Datasets
Dask
License:
VCR-wiki-en-easy / README.md
TianyuZhang's picture
Update README.md
1a54537 verified
|
raw
history blame
11.2 kB
metadata
dataset_info:
  features:
    - name: image
      dtype: image
    - name: caption
      dtype: string
    - name: stacked_image
      dtype: image
    - name: only_it_image
      dtype: image
    - name: only_it_image_small
      dtype: image
    - name: crossed_text
      sequence: string
  splits:
    - name: test
      num_bytes: 906218066.4872956
      num_examples: 5000
    - name: validation
      num_bytes: 907941880.8999181
      num_examples: 5000
    - name: train
      num_bytes: 380560752376.80554
      num_examples: 2095733
  download_size: 380674831567
  dataset_size: 382374912324.19275
configs:
  - config_name: default
    data_files:
      - split: test
        path: data/test-*
      - split: validation
        path: data/validation-*
      - split: train
        path: data/train-*
license: cc-by-sa-4.0
source_datasets:
  - wikimedia/wit_base
task_categories:
  - visual-question-answering
language:
  - en
pretty_name: VCR
arxiv: 2406.06462
size_categories:
  - 1M<n<10M

The VCR-Wiki Dataset for Visual Caption Restoration (VCR)

๐Ÿ  Paper | ๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ป GitHub | ๐Ÿค— Huggingface Datasets | ๐Ÿ“ Evaluation with lmms-eval

This is the official Hugging Face dataset for VCR-Wiki, a dataset for the Visual Caption Restoration (VCR) task.

VCR is designed to measure vision-language models' capability to accurately restore partially obscured texts using pixel-level hints within images. text-based processing becomes ineffective in VCR as accurate text restoration depends on the combined information from provided images, context, and subtle cues from the tiny exposed areas of masked texts.

image/jpg

We found that OCR and text-based processing become ineffective in VCR as accurate text restoration depends on the combined information from provided images, context, and subtle cues from the tiny exposed areas of masked texts. We develop a pipeline to generate synthetic images for the VCR task using image-caption pairs, with adjustable caption visibility to control the task difficulty. However, this task is generally easy for native speakers of the corresponding language. Initial results indicate that current vision-language models fall short compared to human performance on this task.

Dataset Description

Model Evaluation

Method 1 (recommended): use the evaluation script

git clone https://github.com/tianyu-z/VCR.git

Open-source evaluation

We support open-source model_id:

["openbmb/MiniCPM-Llama3-V-2_5",
"OpenGVLab/InternVL-Chat-V1-5",
"internlm/internlm-xcomposer2-vl-7b",
"HuggingFaceM4/idefics2-8b",
"Qwen/Qwen-VL-Chat",
"THUDM/cogvlm2-llama3-chinese-chat-19B",
"THUDM/cogvlm2-llama3-chat-19B",
"echo840/Monkey-Chat",]

For the models not on list, they are not intergated with huggingface, please refer to their github repo to create the evaluation pipeline.

# We use HuggingFaceM4/idefics2-8b and vcr_wiki_en_easy as an example
# Inference from the VLMs and save the results to {model_id}_{difficulty}_{language}.json
cd src/evaluation
python3 inference.py --dataset_handler "vcr-org/VCR-wiki-en-easy-test" --model_id "HuggingFaceM4/idefics2-8b" --device "cuda" --dtype "bf16" --save_interval 50 --resume True

# Evaluate the results and save the evaluation metrics to {model_id}_{difficulty}_{language}_evaluation_result.json
python3 evaluation_metrics.py --model_id HuggingFaceM4/idefics2-8b --output_path . --json_filename "HuggingFaceM4_idefics2-8b_en_easy.json" --dataset_handler "vcr-org/VCR-wiki-en-easy-test"

# To get the mean score of all the `{model_id}_{difficulty}_{language}_evaluation_result.json` in `jsons_path` (and the std, confidence interval if `--bootstrap`) of the evaluation metrics
python3 gather_results.py --jsons_path .

Close-source evaluation

We provide the evaluation script for the close-source model: GPT-4o, GPT-4-Turbo, Claude-3-Opus in the evaluation folder.

You need an API Key, a pre-saved testing dataset and specify the path of the data saving the paper

cd src/evaluation
# save the testing dataset to the path
python3 save_image_from_dataset.py --output_path .

# Inference Put your API key and Image Path in the evaluation script (e.g. gpt-4o.py)
python3 gpt-4o.py

# Evaluate the results and save the evaluation metrics to {model_id}_{difficulty}_{language}_evaluation_result.json
python3 evaluation_metrics.py --model_id gpt4o --output_path . --json_filename "gpt4o_en_easy.json" --dataset_handler "vcr-org/VCR-wiki-en-easy-test"

# To get the mean score of all the `{model_id}_{difficulty}_{language}_evaluation_result.json` in `jsons_path` (and the std, confidence interval if `--bootstrap`) of the evaluation metrics
python3 gather_results.py --jsons_path .

Method 2: use lmms-eval framework

You may need to incorporate the inference method of your model if the lmms-eval framework does not support it. For details, please refer to here

pip install git+https://github.com/EvolvingLMMs-Lab/lmms-eval.git
# We use HuggingFaceM4/idefics2-8b and vcr_wiki_en_easy as an example
python3 -m accelerate.commands.launch --num_processes=8 -m lmms_eval --model idefics2 --model_args pretrained="HuggingFaceM4/idefics2-8b" --tasks vcr_wiki_en_easy --batch_size 1 --log_samples --log_samples_suffix HuggingFaceM4_idefics2-8b_vcr_wiki_en_easy --output_path ./logs/

lmms-eval supports the following VCR --tasks settings:

  • English
    • Easy
      • vcr_wiki_en_easy (full test set, 5000 instances)
      • vcr_wiki_en_easy_500 (first 500 instances in the vcr_wiki_en_easy setting)
      • vcr_wiki_en_easy_100 (first 100 instances in the vcr_wiki_en_easy setting)
    • Hard
      • vcr_wiki_en_hard (full test set, 5000 instances)
      • vcr_wiki_en_hard_500 (first 500 instances in the vcr_wiki_en_hard setting)
      • vcr_wiki_en_hard_100 (first 100 instances in the vcr_wiki_en_hard setting)
  • Chinese
    • Easy
      • vcr_wiki_zh_easy (full test set, 5000 instances)
      • vcr_wiki_zh_easy_500 (first 500 instances in the vcr_wiki_zh_easy setting)
      • vcr_wiki_zh_easy_100 (first 100 instances in the vcr_wiki_zh_easy setting)
    • Hard
      • vcr_wiki_zh_hard (full test set, 5000 instances)
      • vcr_wiki_zh_hard_500 (first 500 instances in the vcr_wiki_zh_hard setting)
      • vcr_wiki_zh_hard_100 (first 100 instances in the vcr_wiki_zh_hard setting)

Dataset Statistics

We show the statistics of the original VCR-Wiki dataset below:

image/png

Dataset Construction

image/png

  • Data Collection and Initial Filtering: The original data is collected from wikimedia/wit_base. Before constructing the dataset, we first filter out the instances with sensitive content, including NSFW and crime-related terms, to mitigate AI risk and biases.

  • N-gram selection: We first truncate the description of each entry to be less than 5 lines with our predefined font and size settings. We then tokenize the description for each entry with spaCy and randomly mask out 5-grams, where the masked 5-grams do not contain numbers, person names, religious or political groups, facilities, organizations, locations, dates and time labeled by spaCy, and the total masked token does not exceed 50% of the tokens in the caption.

  • Create text embedded in images: We create text embedded in images (TEI) for the description, resize its width to 300 pixels, and mask out the selected 5-grams with white rectangles. The size of the rectangle reflects the difficulty of the task: (1) in easy versions, the task is easy for native speakers but open-source OCR models almost always fail, and (2) in hard versions, the revealed part consists of only one to two pixels for the majority of letters or characters, yet the restoration task remains feasible for native speakers of the language.

  • Concatenate Images: We concatenate TEI with the main visual image (VI) to get the stacked image.

  • Second-round Filtering: We filter out all entries with no masked n-grams or have a height exceeding 900 pixels.

Data Fields

  • question_id: int64, the instance id in the current split.
  • image: PIL.Image.Image, the original visual image (VI).
  • stacked_image: PIL.Image.Image, the stacked VI+TEI image containing both the original visual image and the masked text embedded in image.
  • only_id_image: PIL.Image.Image, the masked TEI image.
  • caption: str, the unmasked original text presented in the TEI image.
  • crossed_text: List[str], the masked n-grams in the current instance.

Disclaimer for the VCR-Wiki dataset and Its Subsets

The VCR-Wiki dataset and/or its subsets are provided under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. This dataset is intended solely for research and educational purposes in the field of visual caption restoration and related vision-language tasks.

Important Considerations:

  1. Accuracy and Reliability: While the VCR-Wiki dataset has undergone filtering to exclude sensitive content, it may still contain inaccuracies or unintended biases. Users are encouraged to critically evaluate the dataset's content and applicability to their specific research objectives.

  2. Ethical Use: Users must ensure that their use of the VCR-Wiki dataset aligns with ethical guidelines and standards, particularly in avoiding harm, perpetuating biases, or misusing the data in ways that could negatively impact individuals or groups.

  3. Modifications and Derivatives: Any modifications or derivative works based on the VCR-Wiki dataset must be shared under the same license (CC BY-SA 4.0).

  4. Commercial Use: Commercial use of the VCR-Wiki dataset is permitted under the CC BY-SA 4.0 license, provided that proper attribution is given and any derivative works are shared under the same license.

By using the VCR-Wiki dataset and/or its subsets, you agree to the terms and conditions outlined in this disclaimer and the associated license. The creators of the dataset are not liable for any direct or indirect damages resulting from its use.

Citation

If you find VCR useful for your research and applications, please cite using this BibTeX:

@article{zhang2024vcr,
  title   = {VCR: Visual Caption Restoration},
  author  = {Tianyu Zhang and Suyuchen Wang and Lu Li and Ge Zhang and Perouz Taslakian and Sai Rajeswar and Jie Fu and Bang Liu and Yoshua Bengio},
  year    = {2024},
  journal = {arXiv preprint arXiv: 2406.06462}
}