--- pretty_name: Medical-ROIs-K2.6 license: other task_categories: - visual-question-answering - image-to-text tags: - medical - radiology - pathology - roi - grounding - bounding-box - multimodal - sft size_categories: - 10K[x1,y1,x2,y2] ▼ JSONL (sft.jsonl) → stratified split │ ├── sft_train.jsonl (25,134) │ └── sft_val.jsonl (2,000) ▼ prepare_hf: join JSONL text with medix-rl-data images │ ▼ Hugging Face DatasetDict (this repo) ``` ### 1. Source VQA pool Rows come from [`MBZUAI/medix-rl-data`](https://huggingface.co/datasets/MBZUAI/medix-rl-data) (`train`, 51,335 examples) with four upstream sources: | source | role | |--------|------| | `RadGenome/PMC-VQA` | PubMed Central figure VQA | | `flaviagiammarino/path-vqa` | Pathology VQA | | `BoKelvin/SLAKE` | Radiology VQA (SLAKE) | | `flaviagiammarino/vqa-rad` | VQA-RAD | Each row provides `id`, `image`, `problem` (question), `solution` (gold answer), and `source`. ### 2. Teacher ROI annotation A multimodal teacher (`moonshotai/Kimi-K2.6`) is prompted with the image, clinical question, and gold answer, and asked to box the visual evidence that supports the answer. - **Output format** (one or more blocks): ```text caption[x1,y1,x2,y2] ``` - **BBox convention:** integers in **[0, 1000]**, top-left origin; require `x1 < x2`, `y1 < y2`. - Successful annotations are written to JSONL (`sft.jsonl`); failures are logged for repair/retry. - This release keeps the successfully annotated subset (**27,134** rows, ≈53% of the upstream train pool). ### 3. Train / validation split From `sft.jsonl`, a **source-stratified** random split (`seed=42`) produces: | split | file | count | |-------|------|------:| | train | `sft_train.jsonl` | 25,134 | | validation | `sft_val.jsonl` | 2,000 | ### 4. Hugging Face packaging `medix_seeing_sft.prepare_hf` joins each JSONL row with the matching image(s) from `MBZUAI/medix-rl-data` by `id`, and materializes a `DatasetDict` with multimodal chat fields suitable for SFT loaders. ## Splits in this repo | split | #examples | |-------|----------:| | `train` | 25,134 | | `validation` | 2,000 | ### Source mix (approx.) | source | train | validation | |--------|------:|-----------:| | RadGenome/PMC-VQA | 12,315 | 980 | | flaviagiammarino/path-vqa | 9,535 | 759 | | BoKelvin/SLAKE | 2,391 | 190 | | flaviagiammarino/vqa-rad | 893 | 71 | ## Schema | field | description | |-------|-------------| | `id` | Sample id (matches `medix-rl-data`) | | `source` | Upstream VQA dataset name | | `images` | Image list (`datasets.Image`) | | `messages` | Chat turns with string content (`` placeholders) | | `messages_mm` | JSON string of multimodal content-list messages | | `problem` / `solution` | Clinical question and gold answer | | `prompt` / `response` | User prompt and assistant ROI XML | | `seeing_regions` | Structured `{title, bbox}` list | | `seeing_json` | JSON serialization of regions | | `reasoning` | Teacher reasoning text (when available) | | `teacher_model` | `moonshotai/Kimi-K2.6` | | `teacher_provenance` | `distilled_from:moonshotai/Kimi-K2.6` | | `n_images` | Number of images | | `index` | Annotation-run index | ### Example assistant target ```text Right kidney[130,380,470,720] Left kidney[570,420,840,750] ``` ## Load ```python from datasets import load_dataset ds = load_dataset("erow/Medical-ROIs-K2.6") print(ds["train"][0]["problem"]) print(ds["train"][0]["response"]) ds["train"][0]["images"][0] # PIL.Image ``` Or from a local `save_to_disk` folder: ```python from datasets import load_from_disk ds = load_from_disk("/path/to/hf_seeing_sft") ``` ## Intended use Supervised fine-tuning / distillation of medical VLMs for **visual grounding**: predicting ROIs that evidence the answer to a clinical question (complementary to answer-only VQA). ## Limitations - ROIs are **teacher-generated**, not human-verified for every sample; some boxes may be loose, panel-misaligned, or weakly linked to the QA. - Coverage is a subset of `medix-rl-data` (annotation failures / rate limits excluded). - Not a clinical decision-support product; for research use only. ## Citation / provenance - Upstream pool: [MBZUAI/medix-rl-data](https://huggingface.co/datasets/MBZUAI/medix-rl-data) and its constituent VQA datasets (PMC-VQA, PathVQA, SLAKE, VQA-RAD). - Teacher: [Moonshot AI Kimi K2.6](https://huggingface.co/moonshotai/Kimi-K2.6) (via OpenAI-compatible inference). - Pipeline: MediX seeing-SFT (`medix_seeing_sft` generate → split → `prepare_hf`).