MATVB / README.md
BehroozMansouri's picture
Update README.md
77fe8f7 verified
|
Raw History Blame Contribute Delete
3.81 kB
metadata
configs:
  - config_name: default
    data_files:
      - split: train
        path:
          - MATVB_train.json
          - MATVB_query_nl.json
          - MATVB_query_caption.json
task_categories:
  - image-to-text
  - image-retrieval
language:
  - en
tags:
  - image-captioning
  - image-text-retrieval
  - mathematics
  - multimodal
  - benchmark
  - wikipedia
size_categories:
  - 1K<n<10K

MAT-VB: MAthematical Text-Vision Benchmark

πŸ† Best Resource Paper Award β€” 2025 ACM/IEEE Joint Conference on Digital Libraries (JCDL)

Official Hugging Face repository for MAT-VB, a multimodal benchmark constructed from Wikipedia mathematical content designed to evaluate mathematical image captioning and text-to-image retrieval models.


πŸ”— Links


πŸ“ Dataset Files Overview

File Name Format Description
images.zip Archive (.zip) Contains all ~4,000 Wikipedia math images (216 MB uncompressed).
MATVB_train.json JSON Training annotations. Maps image_id (key) to its ground-truth caption (value).
MATVB_query_nl.json JSON Natural language query set for text-to-image search (human-authored intent queries).
MATVB_query_caption.json JSON Caption query set for text-to-image search (original Wikipedia captions).
MATVB_qrel.qrel TREC format Evaluation relevance file mapping query IDs to target image IDs.

🎯 Task Definitions & Splits

1. Mathematical Image Captioning

  • Training Set: Use all entries in MATVB_train.json (3,600 image-caption pairs).
  • Test Set: Any image in images.zip whose ID is not present in MATVB_train.json serves as a test sample (400 test images). Models generate captions for these test images during evaluation.

2. Text-to-Image Retrieval

The benchmark provides 400 test evaluation queries under two modalities sharing identical query IDs:

  • Natural Language Queries (MATVB_query_nl.json): Human-authored search queries representing intent-based user searches.
  • Caption Queries (MATVB_query_caption.json): Queries built using original, detailed Wikipedia captions.
  • Ground Truth (MATVB_qrel.qrel): Use standard TREC evaluation tools (e.g., trec_eval) to score retrieval runs against this relevance file.

πŸš€ How to Load and Use

You can download and parse the dataset files directly using huggingface_hub and standard Python libraries:

import json
import zipfile
from huggingface_hub import hf_hub_download

# 1. Download dataset files
repo_id = "AIIRLab/MATVB"

train_path = hf_hub_download(repo_id=repo_id, filename="MATVB_train.json", repo_type="dataset")
query_nl_path = hf_hub_download(repo_id=repo_id, filename="MATVB_query_nl.json", repo_type="dataset")
query_cap_path = hf_hub_download(repo_id=repo_id, filename="MATVB_query_caption.json", repo_type="dataset")
qrel_path = hf_hub_download(repo_id=repo_id, filename="MATVB_qrel.qrel", repo_type="dataset")
images_zip_path = hf_hub_download(repo_id=repo_id, filename="images.zip", repo_type="dataset")

# 2. Extract image archive
with zipfile.ZipFile(images_zip_path, 'r') as zip_ref:
    zip_ref.extractall("./images")

# 3. Load JSON annotations
with open(train_path, "r") as f:
    train_data = json.load(f)  # dict: {image_id: caption}

with open(query_nl_path, "r") as f:
    queries_nl = json.load(f)  # dict: {query_id: query_text}

with open(query_cap_path, "r") as f:
    queries_caption = json.load(f)  # dict: {query_id: query_text}

print(f"Loaded {len(train_data)} training samples.")
print(f"Loaded {len(queries_nl)} NL retrieval queries.")