File size: 8,194 Bytes
e2f75d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22e8b44
 
 
 
 
 
 
 
 
 
e2f75d1
22e8b44
 
 
 
 
 
e2f75d1
22e8b44
 
 
 
e2f75d1
22e8b44
 
 
 
 
 
 
 
 
 
 
e2f75d1
22e8b44
 
 
 
 
 
e2f75d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
---
license: other
license_name: ophthalmology-mixed
license_link: https://github.com/mayberichard/zju-eye-pretrain/blob/main/LICENSE
task_categories:
- image-classification
- image-segmentation
- image-to-image
- text-to-image
- unconditional-image-generation
language:
- en
- zh
tags:
- ophthalmology
- retina
- oct
- fundus
- slo
- medical-imaging
- segmentation
- pretraining
size_categories:
- 1M<n<10M
pretty_name: ZJU Eye-Pretrain (Private Shanghai Topcon + 25 public cohorts)
configs:
- config_name: private_topcon
  data_files:
  - split: train
    path: data/private_topcon/*.parquet
- config_name: public_fundus
  data_files:
  - split: train
    path: data/public_fundus/*.parquet
- config_name: public_oct
  data_files:
  - split: train
    path: data/public_oct/*.parquet
- config_name: drive_vessel
  data_files:
  - split: train
    path: data/public_fundus/public_drive_vessel-*.parquet
- config_name: eyepacs_combo_dr_aug
  data_files:
  - split: train
    path: data/public_fundus/public_eyepacs_combo_dr_aug-*.parquet
- config_name: gamma_multimodal
  data_files:
  - split: train
    path: data/public_fundus/public_gamma_multimodal-*.parquet
- config_name: idrid
  data_files:
  - split: train
    path: data/public_fundus/public_idrid-*.parquet
- config_name: messidor2_dr
  data_files:
  - split: train
    path: data/public_fundus/public_messidor2_dr-*.parquet
- config_name: amd_sd
  data_files:
  - split: train
    path: data/public_oct/public_oct_amd_sd-*.parquet
- config_name: areds2
  data_files:
  - split: train
    path: data/public_oct/public_oct_areds2-*.parquet
- config_name: aroi
  data_files:
  - split: train
    path: data/public_oct/public_oct_aroi-*.parquet
- config_name: c8
  data_files:
  - split: train
    path: data/public_oct/public_oct_c8-*.parquet
- config_name: chiu_dme_2015
  data_files:
  - split: train
    path: data/public_oct/public_oct_chiu_dme_2015-*.parquet
- config_name: glaucoma
  data_files:
  - split: train
    path: data/public_oct/public_oct_glaucoma-*.parquet
- config_name: kermany
  data_files:
  - split: train
    path: data/public_oct/public_oct_kermany-*.parquet
- config_name: neh_ut_2021
  data_files:
  - split: train
    path: data/public_oct/public_oct_neh_ut_2021-*.parquet
- config_name: nyu_poag
  data_files:
  - split: train
    path: data/public_oct/public_oct_nyu_poag-*.parquet
- config_name: octa500
  data_files:
  - split: train
    path: data/public_oct/public_oct_octa500-*.parquet
- config_name: octdl
  data_files:
  - split: train
    path: data/public_oct/public_oct_octdl-*.parquet
- config_name: octid
  data_files:
  - split: train
    path: data/public_oct/public_oct_octid-*.parquet
- config_name: oimhs
  data_files:
  - split: train
    path: data/public_oct/public_oct_oimhs-*.parquet
- config_name: olives
  data_files:
  - split: train
    path: data/public_oct/public_oct_olives-*.parquet
- config_name: retouch
  data_files:
  - split: train
    path: data/public_oct/public_oct_retouch-*.parquet
- config_name: sparsity_sdoct_2012
  data_files:
  - split: train
    path: data/public_oct/public_oct_sparsity_sdoct_2012-*.parquet
- config_name: srinivasan_2014
  data_files:
  - split: train
    path: data/public_oct/public_oct_srinivasan_2014-*.parquet
- config_name: thoct1800
  data_files:
  - split: train
    path: data/public_oct/public_oct_thoct1800-*.parquet
- config_name: uestc
  data_files:
  - split: train
    path: data/public_oct/public_oct_uestc-*.parquet
- config_name: refuge2_disc_cup
  data_files:
  - split: train
    path: data/public_fundus/public_refuge2_disc_cup-*.parquet
- config_name: private
  data_files:
  - split: train
    path: data/private_topcon/shanghai_drioct_triton-*.parquet
---

# ZJU Eye-Pretrain Dataset

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

**1.1M images** spanning **26 cohorts** with a **strict 41-column unified manifest schema**.

## Composition

| Source | Images | Modalities | Cohorts |
|---|---:|---|---|
| Private Shanghai DRI OCT Triton (SS-OCT) | 419,042 | oct_bscan + fundus_color + slo_gray | 1 |
| Public Fundus | 198,629 | fundus_color (+ GAMMA OCT) | 6 |
| Public OCT | 488,705 | oct_bscan | 19 |
| **Total** | **1,106,376** | | **26** |

See [DATASET_OVERVIEW.md](DATASET_OVERVIEW.md) for full details per cohort (devices, regions, masks, demographics).

## Quick Start

```python
from datasets import load_dataset, concatenate_datasets, Image

# === Load by batch ===
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")

# === Load by single cohort (28 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 3 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()),
])
# 1.1M images total, mask cols dropped (use per-batch load if you need masks)

# === Streaming for big training runs (avoids downloading all 287 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

Each image has 5 captions (4 L1 variants + 1 L3 derived). Total 5.5M captions in `captions/`.

```python
from datasets import load_dataset
caps = load_dataset("mayberichard/zju-eye-pretrain", "captions_oct")
# join on image_id with the images config
```

## Licensing

This dataset aggregates multiple sources with mixed licenses. See [LICENSE](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>/`. Schema migrations preserve old `*_v1.parquet` alongside new versions.