Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,26 +1,169 @@
|
|
| 1 |
---
|
|
|
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
| 3 |
task_categories:
|
| 4 |
-
- question-answering
|
| 5 |
-
- image-to-text
|
| 6 |
-
language:
|
| 7 |
-
- en
|
| 8 |
tags:
|
| 9 |
-
-
|
| 10 |
-
-
|
| 11 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
size_categories:
|
| 13 |
-
- 100K<n<1M
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
---
|
| 15 |
|
| 16 |
-
#
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
pretty_name: MedOptm Surgical VQA (polished)
|
| 3 |
license: apache-2.0
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
task_categories:
|
| 7 |
+
- visual-question-answering
|
| 8 |
+
- image-to-text
|
|
|
|
|
|
|
| 9 |
tags:
|
| 10 |
+
- medical
|
| 11 |
+
- biomedical
|
| 12 |
+
- surgical
|
| 13 |
+
- vqa
|
| 14 |
+
- visual-question-answering
|
| 15 |
+
- multimodal
|
| 16 |
+
- biomedica
|
| 17 |
size_categories:
|
| 18 |
+
- 100K<n<1M
|
| 19 |
+
configs:
|
| 20 |
+
- config_name: default
|
| 21 |
+
data_files:
|
| 22 |
+
- split: train
|
| 23 |
+
path: data/train-*.parquet
|
| 24 |
---
|
| 25 |
|
| 26 |
+
# MedOptm Surgical VQA (polished)
|
| 27 |
|
| 28 |
+
A biomedical **visual-question-answering (VQA)** dataset: each example is a
|
| 29 |
+
medical/surgical figure paired with a natural-language **question** and a short
|
| 30 |
+
**answer**. It was used to train
|
| 31 |
+
[**MedOptm**](https://github.com/Devpatel1012/MedOptm-VLM), a compact medical
|
| 32 |
+
vision-language model (CvT / CLIP-ViT + Llama-3.2-1B).
|
| 33 |
|
| 34 |
+
> **This VQA dataset is derived from the **BIOMEDICA** vision–caption data.**
|
| 35 |
+
> The questions and answers were **generated from BIOMEDICA figure captions** —
|
| 36 |
+
> the images and their captions come from BIOMEDICA (itself built from PubMed
|
| 37 |
+
> Central Open Access), and each `(question, answer)` pair was derived from the
|
| 38 |
+
> figure's caption. The original caption is kept in every row (`original_caption`)
|
| 39 |
+
> so the derivation stays auditable.
|
| 40 |
|
| 41 |
+
> ⚠️ **Research use only — not for clinical use.** Answers are derived from figure
|
| 42 |
+
> captions, not written or reviewed by clinicians, and can be incomplete or
|
| 43 |
+
> wrong. Do not use this dataset to make or support medical decisions.
|
| 44 |
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
## Where the code lives
|
| 48 |
+
|
| 49 |
+
Everything that loads, cleans, inspects and consumes this dataset is open-source
|
| 50 |
+
in the MedOptm repository:
|
| 51 |
+
|
| 52 |
+
- **GitHub repo:** <https://github.com/Devpatel1012/MedOptm-VLM>
|
| 53 |
+
- **Data pipeline code:** [`src/medoptm/data/`](https://github.com/Devpatel1012/MedOptm-VLM/tree/main/src/medoptm/data)
|
| 54 |
+
- [`dataset.py`](https://github.com/Devpatel1012/MedOptm-VLM/blob/main/src/medoptm/data/dataset.py) — loads these parquet files, decodes the images, and builds the train/val/test DataLoaders.
|
| 55 |
+
- [`preprocessing.py`](https://github.com/Devpatel1012/MedOptm-VLM/blob/main/src/medoptm/data/preprocessing.py) — the `light_scrub()` text cleaner that removed demographics/measurements from the answer text.
|
| 56 |
+
- [`sampling.py`](https://github.com/Devpatel1012/MedOptm-VLM/blob/main/src/medoptm/data/sampling.py) — pulls small random samples out for inspection.
|
| 57 |
+
- **BIOMEDICA → VQA inspection notebooks:**
|
| 58 |
+
[`01_biomedica_data_inspection.ipynb`](https://github.com/Devpatel1012/MedOptm-VLM/blob/main/notebooks/01_biomedica_data_inspection.ipynb)
|
| 59 |
+
and [`02_biomedica_vqa_inspection.ipynb`](https://github.com/Devpatel1012/MedOptm-VLM/blob/main/notebooks/02_biomedica_vqa_inspection.ipynb)
|
| 60 |
+
show the BIOMEDICA caption data and the derived VQA side by side.
|
| 61 |
+
|
| 62 |
+
---
|
| 63 |
+
|
| 64 |
+
## Dataset structure
|
| 65 |
+
|
| 66 |
+
A single `train` split, stored as parquet shards under `data/`. Each row:
|
| 67 |
+
|
| 68 |
+
| Column | Type | Description |
|
| 69 |
+
|---|---|---|
|
| 70 |
+
| `image` | image (bytes) | The biomedical/surgical figure from BIOMEDICA. With 🤗 `datasets` this is cast to a PIL image automatically. |
|
| 71 |
+
| `question` | string | A question about the image. ~56 characters on average. |
|
| 72 |
+
| `answer` | string | The answer, derived from the figure caption. ~77 characters on average. |
|
| 73 |
+
| `original_caption` | string | The BIOMEDICA figure caption the Q&A was derived from. ~219 characters on average. Kept for provenance and for caption-style training. |
|
| 74 |
+
| `original_filename` | string | The BIOMEDICA parquet shard this row came from. |
|
| 75 |
+
| `original_row_index` | int64 | The row index within that shard (`-1` where unknown). |
|
| 76 |
+
|
| 77 |
+
The dataset is **not pre-split** — MedOptm splits it at load time (80/10/10
|
| 78 |
+
train/val/test, `seed=42`).
|
| 79 |
+
|
| 80 |
+
### Example
|
| 81 |
+
|
| 82 |
+
```text
|
| 83 |
+
question: "Where in the spine were pedicle screws placed?"
|
| 84 |
+
answer: "The pedicle screws were placed in the lumbar spine."
|
| 85 |
+
original_caption: "The pedicle screws were placed percutaneously (A). The positions of
|
| 86 |
+
the screws are shown in the X-ray lateral view (B), and the
|
| 87 |
+
intervertebral ..."
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
## Usage
|
| 93 |
+
|
| 94 |
+
```python
|
| 95 |
+
from datasets import load_dataset
|
| 96 |
+
|
| 97 |
+
ds = load_dataset("devpatel1012/polished-vlm-dataset", split="train")
|
| 98 |
+
|
| 99 |
+
row = ds[0]
|
| 100 |
+
print(row["question"], "->", row["answer"])
|
| 101 |
+
row["image"] # a PIL image
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
Reproduce MedOptm's exact split:
|
| 105 |
+
|
| 106 |
+
```python
|
| 107 |
+
split = ds.shuffle(seed=42).train_test_split(test_size=0.2)
|
| 108 |
+
train = split["train"]
|
| 109 |
+
val_test = split["test"].train_test_split(test_size=0.5)
|
| 110 |
+
val, test = val_test["train"], val_test["test"]
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
## How it was built
|
| 116 |
+
|
| 117 |
+
1. **Source.** Figures and their captions from **BIOMEDICA** (derived from
|
| 118 |
+
PubMed Central Open Access).
|
| 119 |
+
2. **Q&A generation.** For each figure, a `(question, answer)` pair was generated
|
| 120 |
+
from its BIOMEDICA caption. The caption is retained as `original_caption` so
|
| 121 |
+
each answer can be traced back to its source text.
|
| 122 |
+
3. **Light scrubbing.** Answer text was passed through `light_scrub()`
|
| 123 |
+
([`preprocessing.py`](https://github.com/Devpatel1012/MedOptm-VLM/blob/main/src/medoptm/data/preprocessing.py))
|
| 124 |
+
to remove demographic details and measurements.
|
| 125 |
+
|
| 126 |
+
---
|
| 127 |
+
|
| 128 |
+
## Provenance & licensing
|
| 129 |
+
|
| 130 |
+
This is a **derived** dataset. Its images and captions come from **BIOMEDICA**,
|
| 131 |
+
which is built from **PubMed Central Open Access (PMC-OA)**. PMC-OA is a *mixture*
|
| 132 |
+
of Creative Commons licences — some articles allow redistribution with
|
| 133 |
+
attribution, others carry non-commercial or no-derivatives terms. **A derived
|
| 134 |
+
dataset cannot be more permissive than its source.**
|
| 135 |
+
|
| 136 |
+
Before making this public:
|
| 137 |
+
|
| 138 |
+
- Read BIOMEDICA's dataset terms and licence, and PMC-OA's reuse terms.
|
| 139 |
+
- Set the `license:` field in the metadata block above to match.
|
| 140 |
+
- Keep the attribution to BIOMEDICA and PMC-OA intact.
|
| 141 |
+
|
| 142 |
+
## Limitations
|
| 143 |
+
|
| 144 |
+
- Answers are **caption-derived**, not clinician-authored or clinically validated.
|
| 145 |
+
- Figures come from published literature, so they skew toward notable/illustrative
|
| 146 |
+
cases rather than a representative clinical distribution.
|
| 147 |
+
- Multi-panel figures (A/B/C …) are kept whole, so a question may refer to only
|
| 148 |
+
one panel.
|
| 149 |
+
- De-identification of the image **pixels** has not been exhaustively verified —
|
| 150 |
+
published figures are normally de-identified, but spot-check before relying on it.
|
| 151 |
+
|
| 152 |
+
## Citation
|
| 153 |
+
|
| 154 |
+
Please cite **BIOMEDICA** (the upstream source) and this derived release.
|
| 155 |
+
|
| 156 |
+
```bibtex
|
| 157 |
+
@misc{medoptm_surgical_vqa,
|
| 158 |
+
title = {MedOptm Surgical VQA (polished)},
|
| 159 |
+
author = {Dev Patel},
|
| 160 |
+
year = {2026},
|
| 161 |
+
url = {https://huggingface.co/datasets/devpatel1012/polished-vlm-dataset},
|
| 162 |
+
note = {Derived from the BIOMEDICA vision--caption dataset (PubMed Central Open Access).}
|
| 163 |
+
}
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
## Links
|
| 167 |
+
|
| 168 |
+
- 🧠 **Model & code:** <https://github.com/Devpatel1012/MedOptm-VLM>
|
| 169 |
+
- 🗂️ **Upstream data:** BIOMEDICA
|