Dataset Viewer
Auto-converted to Parquet Duplicate

The dataset viewer should be available soon. Please retry later.

ZJU Eye-Pretrain Dataset

Unified multi-source ophthalmological imaging dataset for foundation model pretraining and downstream tasks.

1.18M images spanning 57 cohorts with a strict 41-column unified manifest schema.

Composition

1,179,458 images · 57 cohorts · 8 modalities, under one strict 41-column unified manifest schema. Stored as HF parquet shards in data/{private_topcon, public_fundus, public_oct, public_new}/; loadable by batch or by single cohort (57 configs, see YAML above).

modality images cohorts
OCT B-scan (oct_bscan) 839,729 22
color fundus (fundus_color) 284,685 28
SLO (slo_gray) 36,027 2
ultra-widefield fundus (uwf_fundus) 13,321 4
OCT-angiography en-face (octa_enface) 1,500 1
en-face OCT (oct_enface) 1,500 1
fluorescein angiography (fluorescein_angiography) 1,376 1
slit-lamp (slit_lamp) 1,320 1

Two cohorts are multi-modal and are counted under each modality they contribute: shanghai_topcon (private; OCT + SLO + fundus) and gamma_multimodal (OCT + fundus). Per-modality cohort counts therefore sum to 60 over 57 unique cohorts.

See DATASET_OVERVIEW.md for per-cohort devices, regions, masks and demographics.

OCT B-scan — 839,729 (22 cohorts)

cohort images cohort images
shanghai_topcon (private) 352,343 srinivasan_2014 3,231
octa500 119,600 aroi 3,072
kermany 109,309 amd_sd 3,049
olives 63,489 rvome_oct 3,012
gamma_multimodal 51,200 mmrdr_oct 2,936
areds2 38,382 octdl 1,877
uestc 35,280 chiu_dme_2015 610
c8 24,000 octid 572
neh_ut_2021 16,810 thoct1800 96
retouch 6,936 glaucoma 49
oimhs 3,859 sparsity_sdoct_2012 17

Color fundus — 284,685 (28 cohorts)

cohort images cohort images
eyepacs_combo_dr_aug 143,668 g1020_glaucoma 1,020
mfiddr_dr 34,452 fives_vessel 800
shanghai_topcon (private) 30,714 acrima_glaucoma 705
brset_multidisease 16,266 origa_glaucoma 650
ddr_dr 12,522 idrid 597
mmrdr_cfp 11,112 papila_glaucoma 488
airogs_glaucoma 9,540 rimone_glaucoma 485
odir_multidisease 6,392 adam_amd 400
lag_glaucoma 4,854 gamma_multimodal 200
rfmid_multidisease 3,200 drishti_glaucoma 101
fgadr_dr 1,842 hrf_vessel 45
messidor2_dr 1,744 stare_vessel 40
deepdrid_dr 1,600 chasedb1_vessel 28
refuge2_disc_cup 1,200 drive_vessel 20

Ultra-widefield fundus — 13,321 (4 cohorts)

cohort images task
mmrdr_uwf 10,388 DR + 7 lesions
uwf_tumor 2,031 retinal tumor
uwf_disease 700 7-class (AMD / DR / PM / RD / RVO / uveitis / normal)
deepdrid_uwf 202 DR grading

SLO — 36,027 (2 cohorts)

Confocal scanning-laser ophthalmoscopy, en-face grayscale (both near-infrared).

  • shanghai_topcon (private) — 35,985 — Topcon DRI OCT Triton near-IR SLO localizer.
  • ravir_av — 42 — Heidelberg Spectralis IR-SLO (815 nm), with artery/vein segmentation masks.

Smaller modalities (1 cohort each)

modality images cohort task
OCT-angiography en-face 1,500 octa500_octa_enface vascular maps (3 depth projections) + FAZ/vessel masks
en-face OCT 1,500 octa500_oct_enface OCT depth projections
fluorescein angiography 1,376 iovs_fa leakage (DME) + late-phase masks
slit-lamp 1,320 nuclear_cataract nuclear cataract

OCT-public quality screen: B-scans with height < 256 px were removed — the nyu_poag cohort entirely (56,576) plus 1,891 sub-256px from thoct1800/octdl.

Quick Start

from datasets import load_dataset, concatenate_datasets, Image

# === Load by batch (4 batches) ===
ds_priv = load_dataset("mayberichard/zju-eye-pretrain", "private_topcon")
ds_fun  = load_dataset("mayberichard/zju-eye-pretrain", "public_fundus")
ds_oct  = load_dataset("mayberichard/zju-eye-pretrain", "public_oct")
ds_new  = load_dataset("mayberichard/zju-eye-pretrain", "public_new")   # 32 cohorts, 8 modalities

# === Load by single cohort (57 available, see configs in YAML above) ===
ds = load_dataset("mayberichard/zju-eye-pretrain", "kermany")    # 109k
ds = load_dataset("mayberichard/zju-eye-pretrain", "octa500")    # 120k

# === IMPORTANT: cast binary columns to Image for auto-decode ===
ds = ds.cast_column("image", Image())
# For cohorts with masks (DRIVE/IDRiD/REFUGE2/AROI/OIMHS/AMD-SD/Chiu/Glaucoma/OCTA500/RETOUCH):
for col in ds["train"].features:
    if col.endswith("_mask") and str(ds["train"].features[col]) == "Value('binary')":
        ds = ds.cast_column(col, Image())

# Each row after cast:
#   image: PIL.Image                                  (auto-decoded)
#   {vessel|fov|layer|lesion|disc_cup|...}_mask: PIL.Image or None
#   image_id, study_id, patient_hash, modality, anatomy, severity, diagnosis_group, ...

# === Concat all 4 batches manually if needed ===
# Note: schemas differ across batches (mask column sets), so use only shared cols:
shared = ["image_id", "cohort", "study_id", "patient_hash", "modality",
          "anatomy", "device_vendor", "device_model", "severity",
          "diagnosis_group", "image", "bscan_index"]
all_ds = concatenate_datasets([
    ds_priv["train"].select_columns(shared).cast_column("image", Image()),
    ds_fun["train"].select_columns(shared).cast_column("image", Image()),
    ds_oct["train"].select_columns(shared).cast_column("image", Image()),
    ds_new["train"].select_columns(shared).cast_column("image", Image()),
])
# 1.18M images total, mask cols dropped (use per-batch load if you need masks)

# === Streaming for big training runs (avoids downloading all ~340 GB) ===
ds = load_dataset("mayberichard/zju-eye-pretrain", "public_oct", streaming=True)
ds = ds.cast_column("image", Image())
for row in ds["train"]:
    img = row["image"]   # PIL Image, lazy-decoded
    ...

Schema (41-column manifest, identical across all batches)

cohort, study_id, patient_hash, visit_date, eye,
device_vendor, device_model, device_serial_hash, device_software_version,
hospital_domain, ethnicity,
image_quality_score, image_quality_band,
diagnosis_group, lesion_tags, lesion_location, layer_involvement, severity,
diagnosis_source, label_confidence, schema_version,
image_id, file_path, file_format,
modality, anatomy, device_technology, scan_protocol,
scan_x_mm, bscan_index,
image_height_px, image_width_px, axial_resolution_um,
has_segmentation, n_layers_visible,
fovea_x_norm, crt_um, choroid_thickness_um,
oct_footprint_bbox_fundus, oct_footprint_bbox_slo,
is_valid

Plus per-image image bytes and per-cohort mask columns.

Captions (v2 — disease/lesion-centric)

Captions were redesigned (2026-06, replacing v1) to be disease/lesion-centric and EyeDiff-style, after early training showed the old metadata-heavy captions hurt prompt-following. Text structure (comma-separated):

{modality}, {region}, {diagnosis[+severity]}, {lesions...}

Each image has 1–3 captions at increasing specificity (level column), de-duplicated:

level example
short OCT B-scan, diabetic macular edema
medium color fundus, moderate non-proliferative diabetic retinopathy
dense OCT B-scan, macula, neovascular age-related macular degeneration, choroidal neovascularization
  • Disease/severity/lesion terms are standardized through a controlled vocabulary (code/disease_dict.py).
  • Acquisition metadata (device, dataset name, quality score, slice index, bbox, µm thickness, eye) is kept out of the prompt — it lives in the image manifest.
  • Training tip: sample one tier per image per step, and replace the caption with "" ~10% of the time for classifier-free guidance (dropout is a loader concern; empty captions are not stored).
  • Private Topcon OCT currently carries only modality, region (no disease label yet) — disease pseudo-labels are pending.

Files in captions/: captions_v2.parquet (private), public_captions_v2.parquet, oct_public_captions_v2.parquet, public_new_captions_v2.parquet, plus per-cohort *_captions_v2.parquet. Total ~2.25M caption rows (100% image coverage; short on every image, medium/dense conditional by modality). Join on image_id.

import pandas as pd
caps = pd.read_parquet("hf://datasets/MaybeRichard/zju-eye-pretrain/captions/oct_public_captions_v2.parquet")
# join on image_id with the images config

Denoising / Super-resolution test set (separate — NOT part of pretraining)

A standalone paired OCT denoising test set lives under denoising_test/, kept separate from the pretraining cohorts (its own config, split=test). It is 1,735 paired 640×640 grayscale OCT B-scans (noisy input ↔ clean target; original .tif bytes). Do not mix it into the pretraining configs.

column type note
id int pair id (1–1735)
noisy bytes noisy OCT B-scan (.tif)
clean bytes clean ground-truth (.tif)
noisy_filename / clean_filename str original names
from datasets import load_dataset
from datasets import Image
ds = load_dataset("MaybeRichard/zju-eye-pretrain", "denoising_test", split="test")
ds = ds.cast_column("noisy", Image()).cast_column("clean", Image())  # PIL decodes the TIFF bytes

Licensing

This dataset aggregates multiple sources with mixed licenses. See LICENSE for per-cohort license terms. Users are responsible for compliance with the original license of each cohort.

Private Shanghai Topcon data is included for research convenience. Commercial use is prohibited.

Citation

If you use this dataset, please cite the original source for each cohort used (see DATASET_OVERVIEW.md).

Versioning & Updates

This dataset supports incremental updates. New cohorts can be added without touching existing data via additional shards in data/<batch>/. Captions were upgraded to v2 (disease/lesion-centric) in 2026-06; the old v1 caption files were replaced.

Quality screening (2026-06): OCT-public images with width or height < 256 px were removed (58,467 imgs): the nyu_poag cohort entirely (56,576, all 64×128), most of thoct1800 (1,704, height 149) and 187 from octdl. A full pure-black scan found 0 (low-mean "dark" frames are normal OCT and were kept). OCT-public is now 18 cohorts / 430,238 images (was 19 / 488,705); private and fundus unchanged.

Downloads last month
760