File size: 3,806 Bytes
b5eb0da
 
 
 
 
c718736
 
 
 
b5eb0da
f6e6206
77fe8f7
b5eb0da
 
 
f6e6206
 
b5eb0da
 
 
 
 
 
 
 
 
 
 
 
c718736
b5eb0da
 
 
 
 
 
 
 
 
 
c718736
b5eb0da
c718736
 
 
 
 
 
 
b5eb0da
c718736
 
 
 
 
 
 
 
 
 
 
 
 
b5eb0da
 
 
c718736
b5eb0da
c718736
b5eb0da
 
c718736
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b5eb0da
c718736
 
b5eb0da
c718736
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
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

* **GitHub Repository:** [AIIRLab/MATVB](https://github.com/AIIRLab/MATVB)
* **Paper (IEEE Xplore):** [MAT-VB: MAthematical Text-Vision Benchmark](https://ieeexplore.ieee.org/abstract/document/11363711)

---

## ๐Ÿ“ 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:

```python
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.")