Datasets:
license: cc-by-nc-sa-4.0
task_categories:
- zero-shot-image-classification
configs:
- config_name: multipanel
data_files:
- split: train
path: multipanel/train-*.tar
- config_name: singlepanel
data_files:
- split: train
path: singlepanel/train-*.tar
- config_name: subfigure
data_files:
- split: train
path: subfigure/train-*.tar
MedPMC WebDataset
MedPMC is a large-scale medical image-text dataset curated from articles in the PubMed Central (PMC) collection. This release contains approximately 11 million image-text pairs collected from the June 2024 PMC baseline. MedPMC is an ongoing effort, and future releases will continue to expand the dataset with newly published literature, improved annotations, and additional resources.
This dataset is presented in the paper MedPMC: A Systematic Framework for Scaling High-Fidelity Medical Multimodal Data for Foundation Models.
Code: GitHub - Yale-BIDS-Chen-Lab/MedPMC
Compared with raw PMC resources, MedPMC introduces two major improvements.
(1) Medical image curation
MedPMC focuses on clinically relevant visual content by filtering out non-medical figures such as charts, plots, tables, workflow diagrams, and other non-image materials. The dataset covers a broad range of medical specialties and imaging modalities, including radiology, pathology, ophthalmology, dermatology, endoscopy, microscopy, and clinical photography.
(2) Multi-panel figure processing
Biomedical publications often combine multiple related images into a single figure. Unlike most medical AI datasets, which treat figures as individual images, MedPMC preserves these original multi-panel figures while also providing individual panels and their associated subcaptions when available. This allows users to work with either complete figures or panel-level image-text pairs.
The dataset is organized into three subsets:
| Subset | Description |
|---|---|
multipanel |
Medical multipanel figures with figure-level captions. |
singlepanel |
Medical single-panel figures with figure-level captions. |
subfigure |
Medical subfigures extracted from multipanel figures, paired with subcaptions. |
Each sample is stored as an image file and a corresponding JSON metadata file inside .tar shards.
medpmc_webdataset/
multipanel/
train-000000.tar
train-000001.tar
...
singlepanel/
train-000000.tar
train-000001.tar
...
subfigure/
train-000000.tar
train-000001.tar
...
Data format
Multi-panel Figures
Each multi-panel sample contains a full multipanel figure and its figure-level caption.
{
"source_type": "multipanel",
"pmcid": "PMCxxxxx",
"image_id": "PMCxxxxx_xxxxxx-fig002",
"figure_label": "Figure 2",
"caption": "Muscle tissue significantly increased ...",
"references": [
"Loss of muscle tissue is ..."
]
}
Single-panel Figures
Each single-panel sample contains a single-panel medical figure and its figure-level caption.
{
"source_type": "singlepanel",
"pmcid": "PMCxxxxx",
"image_id": "PMC..._<graphic_id>",
"figure_label": "Figure ...",
"caption": "...",
"references": [
"..."
]
}
Subfigures
Each subfigure sample contains an extracted subfigure and its corresponding subcaption. The parent_image_id links the subfigure back to its source multipanel figure.
{
"source_type": "subfigure",
"pmcid": "PMCxxxxx",
"image_id": "PMC..._<graphic_id>_<subfigure_index>",
"parent_image_id": "PMC..._<graphic_id>",
"subfigure_index": 0,
"caption": "(a) Occlusal view showing abnormal supernumerary teeth...",
"parent_caption": "(a) Occlusal view showing abnormal supernumerary teeth...; (b) ..."
}
Installation
pip install huggingface_hub webdataset pillow tqdm
Download the full dataset
huggingface-cli download Yale-BIDS-Chen/medpmc-11m-dataset_jun24_baseline \
--repo-type dataset \
--local-dir ./MedPMC-11M-Jun24
This downloads all subsets:
./MedPMC/
multipanel/
singlepanel/
subfigure/
Download one subset
Multipanel only
huggingface-cli download Yale-BIDS-Chen/medpmc-11m-dataset_jun24_baseline \
--repo-type dataset \
--include "multipanel/*.tar" \
--local-dir ./MedPMC
Singlepanel only
huggingface-cli download Yale-BIDS-Chen/medpmc-11m-dataset_jun24_baseline \
--repo-type dataset \
--include "singlepanel/*.tar" \
--local-dir ./MedPMC
Subfigure only
huggingface-cli download Yale-BIDS-Chen/medpmc-11m-dataset_jun24_baseline \
--repo-type dataset \
--include "subfigure/*.tar" \
--local-dir ./MedPMC
Stream a subset with WebDataset
import webdataset as wds
REPO_ID = "Yale-BIDS-Chen/medpmc-11m-dataset_jun24_baseline"
urls = f"hf://datasets/{REPO_ID}/multipanel/train-{{000000..000010}}.tar"
dataset = (
wds.WebDataset(urls)
.decode("pil")
.to_tuple("jpg;png;jpeg;webp", "json")
)
for image, metadata in dataset:
print(image)
print(metadata)
break
To stream singlepanel or subfigure, replace the subset name in the URL:
urls = f"hf://datasets/{REPO_ID}/singlepanel/train-{{000000..000010}}.tar"
or:
urls = f"hf://datasets/{REPO_ID}/subfigure/train-{{000000..000010}}.tar"
Stream all subsets
import webdataset as wds
REPO_ID = "Yale-BIDS-Chen/medpmc-11m-dataset_jun24_baseline"
urls = [
f"hf://datasets/{REPO_ID}/multipanel/train-{{000000..000010}}.tar",
f"hf://datasets/{REPO_ID}/singlepanel/train-{{000000..000010}}.tar",
f"hf://datasets/{REPO_ID}/subfigure/train-{{000000..000010}}.tar",
]
dataset = (
wds.WebDataset(urls)
.decode("pil")
.to_tuple("jpg;png;jpeg;webp", "json")
)
for image, metadata in dataset:
print(metadata["source_type"], metadata["pmcid"], metadata["image_id"])
break
Load with datasets
from datasets import load_dataset
dataset = load_dataset(
"Yale-BIDS-Chen/medpmc-11m-dataset_jun24_baseline",
name="multipanel",
split="train",
streaming=True,
)
sample = next(iter(dataset))
print(sample.keys())
print(sample)
Other available configs:
dataset = load_dataset(
"Yale-BIDS-Chen/medpmc-11m-dataset_jun24_baseline",
name="singlepanel",
split="train",
streaming=True,
)
dataset = load_dataset(
"Yale-BIDS-Chen/medpmc-11m-dataset_jun24_baseline",
name="subfigure",
split="train",
streaming=True,
)
Download samples by PMCID
We provide a metadata index that maps each sample to its shard, so users can download only the shards that contain the target PMCID(s).
Example: download all samples from PMCIDs
import json
import tarfile
from pathlib import Path
import pandas as pd
from huggingface_hub import hf_hub_download
REPO_ID = "Yale-BIDS-Chen/medpmc-11m-dataset_jun24_baseline"
TARGET_PMCIDS = ["PMCxxxxxx"] # you can specify multiple PMCIDs
WORK_DIR = Path("./MedPMC_pmcid_download")
DATA_DIR = WORK_DIR / "data"
OUT_DIR = WORK_DIR / "extracted"
DATA_DIR.mkdir(parents=True, exist_ok=True)
OUT_DIR.mkdir(parents=True, exist_ok=True)
# 1. Download metadata index only
index_path = hf_hub_download(
repo_id=REPO_ID,
repo_type="dataset",
filename="metadata/medpmc_index.parquet",
local_dir=DATA_DIR,
)
index = pd.read_parquet(index_path)
# 2. Find rows and shards for the target PMCID(s)
rows = index[index["pmcid"].isin(TARGET_PMCIDS)].copy()
if rows.empty:
raise ValueError(f"No samples found for PMCID(s): {TARGET_PMCIDS}")
needed_shards = sorted(rows["shard"].unique())
print(f"Found {len(rows)} samples from {len(TARGET_PMCIDS)} PMCID(s)")
print(f"Need to download {len(needed_shards)} shard(s):")
for shard in needed_shards:
print(" ", shard)
# 3. Download only the required shards
local_shard_paths = {}
for shard in needed_shards:
local_path = hf_hub_download(
repo_id=REPO_ID,
repo_type="dataset",
filename=shard,
local_dir=DATA_DIR,
)
local_shard_paths[shard] = Path(local_path)
# 4. Extract matching samples from the downloaded shards
target_keys_by_shard = {
shard: set(group["key"].tolist())
for shard, group in rows.groupby("shard")
}
num_saved = 0
for shard, target_keys in target_keys_by_shard.items():
shard_path = local_shard_paths[shard]
subset = shard.split("/", 1)[0]
with tarfile.open(shard_path, "r:") as tar:
members = tar.getmembers()
member_map = {m.name: m for m in members if m.isfile()}
for key in target_keys:
json_name = f"{key}.json"
if json_name not in member_map:
print(f"[WARN] Missing JSON member: {json_name} in {shard}")
continue
json_member = member_map[json_name]
metadata = json.loads(tar.extractfile(json_member).read().decode("utf-8"))
image_member = None
for ext in [".jpg", ".jpeg", ".png", ".webp", ".tif", ".tiff"]:
candidate = f"{key}{ext}"
if candidate in member_map:
image_member = member_map[candidate]
break
if image_member is None:
print(f"[WARN] Missing image member for key={key} in {shard}")
continue
pmcid = metadata["pmcid"]
sample_out_dir = OUT_DIR / pmcid / subset
sample_out_dir.mkdir(parents=True, exist_ok=True)
image_bytes = tar.extractfile(image_member).read()
image_out_path = sample_out_dir / image_member.name
json_out_path = sample_out_dir / json_member.name
image_out_path.write_bytes(image_bytes)
json_out_path.write_text(
json.dumps(metadata, ensure_ascii=False, indent=2),
encoding="utf-8",
)
num_saved += 1
print(f"Saved {num_saved} samples to {OUT_DIR}")
Notes on identifiers
pmcid: PubMed Central article identifier.image_id: unique figure-level identifier constructed fromPMCIDand the figure graphic identifier.parent_image_id: for subfigures, theimage_idof the source multipanel figure.figure_label: original figure label in the article, such as"Figure 2".caption: caption paired with the current image sample.parent_caption: for subfigures, the full caption of the source multipanel figure.references: text passages in the article that refer to the figure.
Citation
If you use MedPMC, please cite:
@article{kim2026medpmc,
title={MedPMC: A Systematic Framework for Scaling High-Fidelity Medical Multimodal Data for Foundation Models},
author={Hyunjae Kim and Dain Kim and Pan Xiao and Serina S. Applebaum and Younjoon Chung and Xuguang Ai and Yu Yin and Roy Jiang and Yuexi Du and Yawen Wei and Yiming Kong and Tuo Guo and Zhiyuan Cao and Mengmeng Du and Yuelei Fu and Yan Hu and Rui Shi and Gui Yang and Kevin W. Jin and Yuntian Liu and Yuxuan Tian and Jonathan Marquez and Zhen Chen and Sheng Zhang and Hoifung Poon and Hua Xu and Jaewoo Kang and Qingyu Chen},
journal={arXiv preprint arXiv:2607.07673},
year={2026}
}
License and usage
The MedPMC dataset is distributed under CC BY-NC-SA 4.0 for non-commercial research use. Users are responsible for complying with the licenses and terms.
Questions?
For questions or feedback, please contact Hyunjae Kim at hyunjae.kim@yale.edu.