BehroozMansouri commited on
Commit
c718736
Β·
verified Β·
1 Parent(s): f6e6206

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +55 -15
README.md CHANGED
@@ -3,7 +3,10 @@ configs:
3
  - config_name: default
4
  data_files:
5
  - split: train
6
- path: "images.zip"
 
 
 
7
  task_categories:
8
  - image-to-text
9
  - text-retrieval
@@ -24,7 +27,7 @@ size_categories:
24
 
25
  πŸ† **Best Resource Paper Award** β€” *2025 ACM/IEEE Joint Conference on Digital Libraries (JCDL)*
26
 
27
- Official Hugging Face dataset repository for **MAT-VB**, a benchmark built on Wikipedia math images designed to advance research in multi-modal mathematical tasks, including visual-text retrieval and math image captioning.
28
 
29
  ---
30
 
@@ -35,26 +38,63 @@ Official Hugging Face dataset repository for **MAT-VB**, a benchmark built on Wi
35
 
36
  ---
37
 
38
- ## πŸ“ Dataset Contents
39
 
40
- MAT-VB provides a curated collection of mathematical visual data from Wikipedia for evaluating multimodal AI models:
 
 
 
 
 
 
41
 
42
- * **`images.zip`**: Contains all ~4,000 Wikipedia math image files (216 MB uncompressed archive).
43
- * **Metadata & Annotations**: Includes descriptive captions, query-image mappings, and split indexes for training and evaluation pipelines.
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  ---
46
 
47
- ## πŸš€ Usage with Python `datasets`
48
 
49
- Hugging Face automatically extracts and parses `images.zip` when loading through the `datasets` library:
50
 
51
  ```python
52
- from datasets import load_dataset
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
- # Load the dataset directly
55
- dataset = load_dataset("AIIRLab/MATVB")
56
 
57
- # Access a sample
58
- example = dataset["train"][0]
59
- image = example["image"]
60
- caption = example.get("caption", "")
 
3
  - config_name: default
4
  data_files:
5
  - split: train
6
+ path:
7
+ - "MATVB_train.json"
8
+ - "MATVB_query_nl.json"
9
+ - "MATVB_query_caption.json"
10
  task_categories:
11
  - image-to-text
12
  - text-retrieval
 
27
 
28
  πŸ† **Best Resource Paper Award** β€” *2025 ACM/IEEE Joint Conference on Digital Libraries (JCDL)*
29
 
30
+ 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.
31
 
32
  ---
33
 
 
38
 
39
  ---
40
 
41
+ ## πŸ“ Dataset Files Overview
42
 
43
+ | File Name | Format | Description |
44
+ | :--- | :--- | :--- |
45
+ | `images.zip` | Archive (`.zip`) | Contains all ~4,000 Wikipedia math images (216 MB uncompressed). |
46
+ | `MATVB_train.json` | JSON | Training annotations. Maps `image_id` (key) to its ground-truth `caption` (value). |
47
+ | `MATVB_query_nl.json` | JSON | Natural language query set for text-to-image search (human-authored intent queries). |
48
+ | `MATVB_query_caption.json` | JSON | Caption query set for text-to-image search (original Wikipedia captions). |
49
+ | `MATVB_qrel.qrel` | TREC format | Evaluation relevance file mapping query IDs to target image IDs. |
50
 
51
+ ---
52
+
53
+ ## 🎯 Task Definitions & Splits
54
+
55
+ ### 1. Mathematical Image Captioning
56
+ * **Training Set:** Use all entries in `MATVB_train.json` (3,600 image-caption pairs).
57
+ * **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.
58
+
59
+ ### 2. Text-to-Image Retrieval
60
+ The benchmark provides 400 test evaluation queries under two modalities sharing identical query IDs:
61
+ * **Natural Language Queries (`MATVB_query_nl.json`):** Human-authored search queries representing intent-based user searches.
62
+ * **Caption Queries (`MATVB_query_caption.json`):** Queries built using original, detailed Wikipedia captions.
63
+ * **Ground Truth (`MATVB_qrel.qrel`):** Use standard TREC evaluation tools (e.g., `trec_eval`) to score retrieval runs against this relevance file.
64
 
65
  ---
66
 
67
+ ## πŸš€ How to Load and Use
68
 
69
+ You can download and parse the dataset files directly using `huggingface_hub` and standard Python libraries:
70
 
71
  ```python
72
+ import json
73
+ import zipfile
74
+ from huggingface_hub import hf_hub_download
75
+
76
+ # 1. Download dataset files
77
+ repo_id = "AIIRLab/MATVB"
78
+
79
+ train_path = hf_hub_download(repo_id=repo_id, filename="MATVB_train.json", repo_type="dataset")
80
+ query_nl_path = hf_hub_download(repo_id=repo_id, filename="MATVB_query_nl.json", repo_type="dataset")
81
+ query_cap_path = hf_hub_download(repo_id=repo_id, filename="MATVB_query_caption.json", repo_type="dataset")
82
+ qrel_path = hf_hub_download(repo_id=repo_id, filename="MATVB_qrel.qrel", repo_type="dataset")
83
+ images_zip_path = hf_hub_download(repo_id=repo_id, filename="images.zip", repo_type="dataset")
84
+
85
+ # 2. Extract image archive
86
+ with zipfile.ZipFile(images_zip_path, 'r') as zip_ref:
87
+ zip_ref.extractall("./images")
88
+
89
+ # 3. Load JSON annotations
90
+ with open(train_path, "r") as f:
91
+ train_data = json.load(f) # dict: {image_id: caption}
92
+
93
+ with open(query_nl_path, "r") as f:
94
+ queries_nl = json.load(f) # dict: {query_id: query_text}
95
 
96
+ with open(query_cap_path, "r") as f:
97
+ queries_caption = json.load(f) # dict: {query_id: query_text}
98
 
99
+ print(f"Loaded {len(train_data)} training samples.")
100
+ print(f"Loaded {len(queries_nl)} NL retrieval queries.")