Datasets:
File size: 21,741 Bytes
3c366de | 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 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Build a single self-contained HTML report of the benchmark.
4 modules (Myopia / AMD / Glaucoma / DR). Each dataset card shows:
- 采集背景 (acquisition background: FOV / device / source / resolution)
- 类别分布 (class distribution by split: table + grouped bar chart)
- 模型性能 (metrics table + grouped bar chart, 3 models)
- 可展开的混淆矩阵 / ROC 图
All images are embedded as base64 -> works offline, one file.
"""
import os, json, base64, io, csv
from collections import defaultdict
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
PROJ = "/mnt/tidal-alsh-share2/dataset/qinshengqian/research/c3/GPT-Image"
RESULTS = f"{PROJ}/results"
DSROOT = f"{PROJ}/Dataset"
OUT = f"{RESULTS}/report.html"
MODELS = ["retfound", "resnet", "vit"]
MLABEL = {"retfound": "RetFound (ViT-L, CFP)", "resnet": "ResNet-50", "vit": "ViT-B/16"}
MCOLOR = {"retfound": "#4C72B0", "resnet": "#55A868", "vit": "#C44E52"}
SPLIT_COLOR = {"train": "#4C72B0", "val": "#DD8452", "test": "#55A868"}
CATS = [
("近视 · Myopic Maculopathy", "#2563eb", [("mmac", "MMAC 2023", "5-class grade 0–4")]),
("AMD · Age-related Macular Degeneration", "#16a34a", [("adam", "ADAM", "binary AMD / Non-AMD")]),
("青光眼 · Glaucoma", "#d97706", [("airogs", "AIROGS (EyePACS-AIROGS-light)", "binary RG / NRG"),
("papila", "PAPILA", "binary glaucoma / healthy")]),
("DR · Diabetic Retinopathy", "#dc2626", [("idrid", "IDRiD", "5-class grade 0–4"),
("aptos", "APTOS-2019", "5-class grade 0–4"),
("deepdrid", "DeepDRiD", "5-class grade 0–4")]),
]
SPLITS = {"mmac": "973/139/279", "adam": "280/40/80", "airogs": "5000/540/1000",
"papila": "294/42/84", "idrid": "318/45/92", "aptos": "2930/366/366",
"deepdrid": "1200/400/400"}
DSPATH = {"mmac": "Myopia/Classification_of_Myopic_Maculopathy", "adam": "AMD/adamdataset",
"airogs": "Glaucoma/eyepacs-airogs-light", "papila": "Glaucoma/papila-retinal-fundus-images",
"idrid": "DR/idrid-dataset", "aptos": "DR/aptos2019", "deepdrid": "DR/deepdrid"}
# 采集背景(已核实来源;不确定处据实标注)
BG = {
"mmac": "彩色眼底照(非散瞳)|FOV:45°(设备标称,论文正文未印)|设备:Topcon TRC-NW400(单一设备)|来源:上海健康医学中心 + 上海市第六人民医院(中国,均为中国人群)|分辨率:未公开|标注:META-PM 5 级,双医师分级(κ=0.91),单设备单人群为其局限。",
"adam": "彩色眼底照|FOV:未标注(仅说明取景中心为视盘 / 黄斑 / 两者中点)|设备:Zeiss Visucam 500(2124×2056,824 张)+ Canon CR-2(1444×1444,376 张)|来源:中山眼科中心(中国·广州)|Training400:89 AMD / 311 非 AMD(AMD 被刻意过采样,非真实患病率)。",
"airogs": "彩色眼底照,源自 EyePACS 远程筛查平台(美国约 500 个点、60071 人、多种族)|设备:多相机混用(Optovue iCam100≈26%、Topcon NW200/400≈20%、Canon CR1/CR2/DGI、Centervue、Nidek、Crystalvue,约 21% 未知)|FOV / 分辨率:因多设备未统一|原为糖网筛查图后重标青光眼;全集 RG 仅约 3%(极不平衡),本「light」子集已平衡为 3270/3270。",
"papila": "彩色眼底照,以视盘为中心|FOV:30°|设备:Topcon TRC-NW400(非散瞳)|分辨率:2576×1934 JPEG|来源:Reina Sofía 大学医院(西班牙·Murcia,2018–2020)|244 人双眼共 488 张(healthy/glaucoma/suspect,本项目已剔除 suspect → 420)|附临床数据与视盘/视杯分割。",
"idrid": "彩色眼底照|FOV:50°|设备:Kowa VX-10α(散瞳,托吡卡胺 0.5%)|分辨率:4288×2848 JPG|来源:印度 Nanded(Maharashtra)眼科诊所,2009–2017|全集 516 张(本项目有标签 455 张)|DR 0–4(ICDR)+ 黄斑水肿风险分级。",
"aptos": "彩色眼底照|设备 / FOV / 分辨率:均未公开(多诊所、多相机、跨时间采集,异质性大)|来源:Aravind 眼科医院(印度),乡村远程筛查|训练集 3662 张,DR 0–4(ICDR)|真实世界噪声明显(伪影 / 失焦 / 过曝欠曝 / 标签噪声)。",
"deepdrid": "彩色眼底照(常规,非超广角)|设备:Topcon 非散瞳(具体型号未公开)|FOV≈45–60°、分辨率≈1956×1934(来自补充材料,中等可信)|来源:上海市第六人民医院(中国)糖尿病筛查队列|2000 张 / 500 人,每眼双视野(视盘中心 + 黄斑中心)|DR 0–4 + 图像质量标注。",
}
BIN_COLS = [("accuracy", "Accuracy"), ("auroc", "AUROC"), ("auprc", "AUPRC"), ("f1_macro", "F1"),
("sensitivity", "Sensitivity"), ("specificity", "Specificity"), ("cohen_kappa", "Kappa"), ("mcc", "MCC")]
MUL_COLS = [("accuracy", "Accuracy"), ("balanced_accuracy", "Bal-Acc"), ("auroc_macro_ovr", "macro-AUROC"),
("quadratic_weighted_kappa", "QWK"), ("f1_macro", "F1-macro"), ("precision_macro", "Prec-macro"),
("recall_macro", "Rec-macro"), ("cohen_kappa", "Kappa")]
BIN_BAR = [("accuracy", "Acc"), ("auroc", "AUROC"), ("auprc", "AUPRC"), ("f1_macro", "F1"),
("sensitivity", "Sens"), ("specificity", "Spec")]
MUL_BAR = [("accuracy", "Acc"), ("auroc_macro_ovr", "AUROC"), ("quadratic_weighted_kappa", "QWK"),
("f1_macro", "F1"), ("balanced_accuracy", "Bal-Acc")]
def load(dsk, model):
try:
return json.load(open(os.path.join(RESULTS, dsk, model, "metrics.json")))
except Exception:
return None
def read_dist(dsk):
"""Return ordered [(label,class_name)], counts[split][label], total."""
rows = list(csv.DictReader(open(os.path.join(DSROOT, DSPATH[dsk], "labels.csv"))))
classes = sorted(set((r["label"], r.get("class_name", "")) for r in rows), key=lambda x: int(x[0]))
cnt = defaultdict(lambda: defaultdict(int))
for r in rows:
cnt[r["split"]][r["label"]] += 1
return classes, cnt, len(rows)
def b64_img(path):
try:
return "data:image/png;base64," + base64.b64encode(open(path, "rb").read()).decode()
except Exception:
return ""
def fig_b64(fig):
buf = io.BytesIO()
fig.savefig(buf, format="png", dpi=110, bbox_inches="tight")
plt.close(fig)
return "data:image/png;base64," + base64.b64encode(buf.getvalue()).decode()
def grouped_bar(labels, series, colors, ylabel, intlabels=False):
"""series: list of (name, [values]) aligned to labels."""
x = np.arange(len(labels))
w = 0.8 / max(1, len(series))
fig, ax = plt.subplots(figsize=(7.2, 3.6))
for i, (name, vals) in enumerate(series):
bars = ax.bar(x + (i - (len(series) - 1) / 2) * w, vals, w, label=name, color=colors[name])
for b, v in zip(bars, vals):
if v:
ax.text(b.get_x() + b.get_width() / 2, v, (f"{int(v)}" if intlabels else f"{v:.2f}"),
ha="center", va="bottom", fontsize=6.3)
ax.set_xticks(x); ax.set_xticklabels(labels, fontsize=8.5)
ax.set_ylabel(ylabel)
ax.legend(fontsize=7.5, ncol=len(series), loc="lower center", bbox_to_anchor=(0.5, 1.0), frameon=False)
ax.grid(axis="y", ls=":", alpha=0.4); ax.set_axisbelow(True)
if not intlabels:
ax.set_ylim(0, 1.08)
for s in ("top", "right"):
ax.spines[s].set_visible(False)
return fig_b64(fig)
def perf_bar(metrics, bar_keys):
keys = [k for k, _ in bar_keys]
series = [(MLABEL[m], [(metrics.get(m) or {}).get(k) if isinstance((metrics.get(m) or {}).get(k), (int, float)) else 0
for k in keys]) for m in MODELS]
colors = {MLABEL[m]: MCOLOR[m] for m in MODELS}
return grouped_bar([l for _, l in bar_keys], series, colors, "score", intlabels=False)
def dist_bar(classes, cnt):
labels = [f"{l}·{cn}" for l, cn in classes]
series = [(sp, [cnt[sp].get(l, 0) for l, _ in classes]) for sp in ("train", "val", "test")]
return grouped_bar(labels, series, SPLIT_COLOR, "images", intlabels=True)
def perf_table(metrics, cols):
keys = [k for k, _ in cols]
best = {}
for k in keys:
vals = [(metrics[m].get(k) if metrics.get(m) and isinstance(metrics[m].get(k), (int, float)) else None) for m in MODELS]
vals = [v for v in vals if v is not None]
best[k] = max(vals) if vals else None
h = ['<table class="metrics"><thead><tr><th>Model</th>'] + [f"<th>{lab}</th>" for _, lab in cols] + ["</tr></thead><tbody>"]
for m in MODELS:
mm = metrics.get(m) or {}
h.append(f'<tr><td class="model"><span class="dot" style="background:{MCOLOR[m]}"></span>{MLABEL[m]}</td>')
for k, _ in cols:
v = mm.get(k)
if isinstance(v, (int, float)):
cls = "best" if (best[k] is not None and abs(v - best[k]) < 1e-9) else ""
h.append(f'<td class="{cls}">{v:.4f}</td>')
else:
h.append("<td>—</td>")
h.append("</tr>")
h.append("</tbody></table>")
return "".join(h)
def dist_table(classes, cnt):
h = ['<table class="metrics"><thead><tr><th>Split</th>'] + [f"<th>{l}·{cn}</th>" for l, cn in classes] + ["<th>合计</th></tr></thead><tbody>"]
coltot = {l: 0 for l, _ in classes}
for sp in ("train", "val", "test"):
h.append(f'<tr><td class="model">{sp}</td>')
s = 0
for l, _ in classes:
v = cnt[sp].get(l, 0); s += v; coltot[l] += v
h.append(f"<td>{v}</td>")
h.append(f"<td><b>{s}</b></td></tr>")
h.append('<tr><td class="model">合计</td>')
for l, _ in classes:
h.append(f"<td><b>{coltot[l]}</b></td>")
h.append(f'<td><b>{sum(coltot.values())}</b></td></tr></tbody></table>')
return "".join(h)
def perclass_table(metrics, classes):
"""Per-class Recall / F1 / AUROC for each model + shared support. Best F1 per class highlighted."""
def fmt(v):
return f"{v:.3f}" if isinstance(v, (int, float)) else "—"
h = ['<table class="metrics pc"><thead><tr><th rowspan="2">Class</th><th rowspan="2">Support</th>']
for m in MODELS:
h.append(f'<th colspan="3" class="grp">{MLABEL[m]}</th>')
h.append("</tr><tr>")
for m in MODELS:
h.append('<th class="grp">Recall</th><th>F1</th><th>AUROC</th>')
h.append("</tr></thead><tbody>")
for l, cn in classes:
sup = None
for m in MODELS:
pc = (metrics.get(m) or {}).get("per_class", {})
if str(l) in pc:
sup = int(pc[str(l)].get("support", 0)); break
f1s = [(metrics.get(m) or {}).get("per_class", {}).get(str(l), {}).get("f1-score") for m in MODELS]
bf = max([v for v in f1s if isinstance(v, (int, float))], default=None)
h.append(f'<tr><td class="model">{l}·{cn}</td><td>{sup if sup is not None else "—"}</td>')
for m in MODELS:
mm = metrics.get(m) or {}
pc = mm.get("per_class", {}).get(str(l), {})
au = (mm.get("auroc_per_class") or {}).get(str(l))
f1 = pc.get("f1-score")
f1cls = "best" if (isinstance(f1, (int, float)) and bf is not None and abs(f1 - bf) < 1e-9) else ""
h.append(f'<td class="grp">{fmt(pc.get("recall"))}</td><td class="{f1cls}">{fmt(f1)}</td><td>{fmt(au)}</td>')
h.append("</tr>")
h.append("</tbody></table>")
return "".join(h)
def perclass_f1_bar(metrics, classes):
labels = [f"{l}·{cn}" for l, cn in classes]
series = []
for m in MODELS:
pc = (metrics.get(m) or {}).get("per_class", {})
vals = [pc.get(str(l), {}).get("f1-score") if isinstance(pc.get(str(l), {}).get("f1-score"), (int, float)) else 0
for l, _ in classes]
series.append((MLABEL[m], vals))
return grouped_bar(labels, series, {MLABEL[m]: MCOLOR[m] for m in MODELS}, "per-class F1", intlabels=False)
def gallery_html(dsk):
rows = []
for kind, title in [("confusion_matrix", "混淆矩阵"), ("roc", "ROC")]:
cells = []
for m in MODELS:
img = b64_img(os.path.join(RESULTS, dsk, m, f"{kind}.png"))
if img:
cells.append(f'<figure><img src="{img}"><figcaption>{MLABEL[m]}</figcaption></figure>')
rows.append(f'<div class="grow"><h4>{title}</h4><div class="imgrow">{"".join(cells)}</div></div>')
return f'<details><summary>详细图:混淆矩阵 / ROC 曲线</summary><div class="gallery">{"".join(rows)}</div></details>'
def downsample_block(dsk):
"""Per-dataset data-scarcity: for each fraction, a card with table + bar chart of all 4 metrics."""
if dsk not in ("adam", "airogs", "papila"):
return ""
DS = os.path.join(RESULTS, "downsample")
frac_show = [100, 50, 25, 10, 5]
dnames = {"adam": "ADAM", "airogs": "AIROGS", "papila": "PAPILA"}
train_counts = {"adam": {100:280,50:140,25:70,10:28,5:14},
"airogs": {100:5000,50:2500,25:1250,10:500,5:250},
"papila": {100:294,50:146,25:73,10:29,5:15}}
metrics_keys = [("accuracy", "Acc"), ("auroc", "AUROC"), ("auprc", "AUPRC"), ("f1_macro", "F1"), ("sensitivity", "Sens"), ("specificity", "Spec")]
# load per-fraction metrics
frac_data = {}
for f in frac_show:
frac_data[f] = {}
for m in MODELS:
p = os.path.join(DS, dsk, f"{f:03d}", m, "metrics.json")
if os.path.isfile(p):
frac_data[f][m] = json.load(open(p))
cards = []
for f in frac_show:
labels = [kn for _, kn in metrics_keys]
series = []
for m in MODELS:
mm = frac_data[f].get(m)
vals = []
for k, _ in metrics_keys:
v = mm.get(k) if mm else None
vals.append(v if isinstance(v, (int, float)) else 0)
series.append((MLABEL[m], vals))
bar = grouped_bar(labels, series, {MLABEL[m]: MCOLOR[m] for m in MODELS}, "score", intlabels=False)
# table
th = ['<table class="metrics"><thead><tr><th>Model</th>']
for _, kn in metrics_keys:
th.append(f'<th>{kn}</th>')
th.append("</tr></thead><tbody>")
best_map = {}
for k, _ in metrics_keys:
bv = None
for m in MODELS:
mm = frac_data[f].get(m)
if mm:
v = mm.get(k)
if isinstance(v, (int, float)):
if bv is None or v > bv:
bv = v
best_map[k] = bv
for m in MODELS:
mm = frac_data[f].get(m)
th.append(f'<tr><td class="model"><span class="dot" style="background:{MCOLOR[m]}"></span>{m}</td>')
for k, _ in metrics_keys:
v = mm.get(k) if mm else None
cls = "best" if (isinstance(v, (int, float)) and best_map[k] is not None and abs(v - best_map[k]) < 1e-9) else ""
vs = f"{v:.4f}" if isinstance(v, (int, float)) else "—"
th.append(f'<td class="{cls}">{vs}</td>')
th.append("</tr>")
th.append("</tbody></table>")
cards.append(f"""
<div style="border:1px solid #eef0f3;border-radius:8px;margin:12px 20px;overflow:hidden">
<div class="card-h" style="background:#fafbfc"><h4 style="font-size:14px;margin:0">{f}% · {train_counts[dsk][f]} 训练样本</h4><span class="meta">val/test 保持完整</span></div>
<div class="content" style="padding:10px 20px">
<div class="tbl">{"".join(th)}</div>
<div class="chart"><img src="{bar}"></div>
</div>
</div>""")
return f"""
<h4 class="sec">数据稀缺性分析 · Data-scarcity experiment</h4>
<div class="bg" style="font-size:12px;color:#6b21a8">训练数据按类别分层抽样至 100/50/25/10/5%,保持 val/test 完整。<b>PAPILA 随数据量下降最快</b>,最适合作合成数据增广实验。</div>
{''.join(cards)}"""
def main():
parts = []
for cat_name, color, dsets in CATS:
cards = []
for dsk, title, desc in dsets:
metrics = {m: load(dsk, m) for m in MODELS}
if not any(metrics.values()):
continue
task = next(v for v in metrics.values() if v)["task"]
cols = BIN_COLS if task == "binary" else MUL_COLS
bar = BIN_BAR if task == "binary" else MUL_BAR
ntest = next(v for v in metrics.values() if v).get("n_test")
classes, cnt, total = read_dist(dsk)
perclass_block = "" if task == "binary" else f"""
<h4 class="sec">每类指标 · Per-class metrics</h4>
<div class="content">
<div class="tbl">{perclass_table(metrics, classes)}</div>
<div class="chart"><img src="{perclass_f1_bar(metrics, classes)}"></div>
</div>"""
cards.append(f"""
<div class="card">
<div class="card-h"><h3>{title}</h3>
<span class="meta">{desc} · 划分 train/val/test = {SPLITS.get(dsk,'?')} · 总计 {total} 张</span></div>
<div class="bg"><b>📷 采集背景:</b>{BG.get(dsk,'')}</div>
<h4 class="sec">类别分布 · Class distribution(按 split)</h4>
<div class="content">
<div class="tbl">{dist_table(classes, cnt)}</div>
<div class="chart"><img src="{dist_bar(classes, cnt)}"></div>
</div>
<h4 class="sec">模型性能 · Performance</h4>
<div class="content">
<div class="tbl">{perf_table(metrics, cols)}</div>
<div class="chart"><img src="{perf_bar(metrics, bar)}"></div>
</div>{perclass_block}
{downsample_block(dsk)}
{gallery_html(dsk)}
</div>""")
parts.append(f'\n <section class="module" style="--accent:{color}">\n <h2>{cat_name}</h2>\n {"".join(cards)}\n </section>')
html = f"""<!doctype html><html lang="zh"><head><meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>眼底图像分类 Benchmark</title>
<style>
:root{{font-family:-apple-system,"Segoe UI",Roboto,"PingFang SC","Microsoft YaHei",sans-serif}}
body{{margin:0;background:#f5f6f8;color:#1f2430;line-height:1.5}}
header{{background:linear-gradient(135deg,#1e293b,#334155);color:#fff;padding:32px 40px}}
header h1{{margin:0 0 6px;font-size:26px}} header p{{margin:2px 0;opacity:.85;font-size:14px}}
.wrap{{max-width:1180px;margin:0 auto;padding:24px 20px 60px}}
.module{{margin:34px 0}}
.module h2{{border-left:7px solid var(--accent);padding:6px 0 6px 14px;font-size:21px;margin:0 0 16px;color:var(--accent)}}
.card{{background:#fff;border-radius:12px;box-shadow:0 1px 4px rgba(0,0,0,.08);margin:0 0 20px;overflow:hidden}}
.card-h{{padding:14px 20px;border-bottom:1px solid #eef0f3;display:flex;align-items:baseline;gap:14px;flex-wrap:wrap}}
.card-h h3{{margin:0;font-size:17px}} .card-h .meta{{color:#788196;font-size:12.5px}}
.bg{{margin:14px 20px 4px;padding:10px 14px;background:#f8fafc;border:1px solid #eef0f3;border-radius:8px;font-size:12.5px;color:#475569;line-height:1.8}}
.bg b{{color:#334155}}
h4.sec{{margin:16px 20px 2px;font-size:13.5px;color:#334155;border-left:3px solid var(--accent);padding-left:9px}}
.content{{display:flex;gap:18px;padding:8px 20px 14px;flex-wrap:wrap;align-items:flex-start}}
.tbl{{flex:1 1 440px;overflow-x:auto}} .chart{{flex:1 1 480px;text-align:center}} .chart img{{max-width:100%;height:auto}}
table.metrics{{border-collapse:collapse;width:100%;font-size:13px}}
table.metrics th,table.metrics td{{padding:6px 8px;text-align:center;border-bottom:1px solid #eef0f3}}
table.metrics thead th{{background:#f8f9fb;color:#5b6472;font-weight:600;font-size:11.5px}}
table.metrics td.model{{text-align:left;white-space:nowrap;font-weight:600}}
.dot{{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:7px;vertical-align:middle}}
table.metrics td.best{{background:#fff7e6;color:#b45309;font-weight:700}}
table.metrics .grp{{border-left:2px solid #e2e6ea}}
details{{border-top:1px solid #eef0f3;padding:10px 20px 16px}} summary{{cursor:pointer;color:#475569;font-size:13px;font-weight:600}}
.grow h4{{margin:14px 0 8px;font-size:13px;color:#5b6472}}
.imgrow{{display:flex;gap:12px;flex-wrap:wrap}}
.imgrow figure{{margin:0;flex:1 1 300px;max-width:360px;text-align:center}}
.imgrow img{{width:100%;border:1px solid #eef0f3;border-radius:6px}} .imgrow figcaption{{font-size:11.5px;color:#788196;margin-top:4px}}
footer{{text-align:center;color:#9aa3b2;font-size:12px;padding:20px}}
</style></head><body>
<header>
<h1>眼底图像分类 Benchmark · RetFound vs ResNet vs ViT</h1>
<p>7 个数据集 · 4 个疾病方向 · 三模型(RetFound ViT-L / ResNet-50 / ViT-B/16,均预训练后全参数微调)</p>
<p>每个数据集含:采集背景(FOV/设备/来源/分辨率)· 类别分布(按 split)· 模型性能(指标表 + 柱状图)· 混淆矩阵/ROC</p>
<p>评估协议:输入 224 · 官方划分优先(否则 7:1:2 分层)· val 选最优→测 test · 指标由统一脚本计算</p>
</header>
<div class="wrap">
{''.join(parts)}
<footer>采集背景均据权威来源整理,不确定处已标注「设备标称/未公开/补充材料」· 单文件离线可用</footer>
</div></body></html>"""
open(OUT, "w").write(html)
print(f"wrote {OUT} ({len(html)/1024:.0f} KB)")
if __name__ == "__main__":
main()
|