Kossisoroyce's picture
Upload README.md with huggingface_hub
59ef01d verified
|
Raw
History Blame Contribute Delete
16.6 kB
metadata
dataset_info:
  features:
    - name: image
      dtype: image
    - name: image_id
      dtype: string
    - name: image_path
      dtype: string
    - name: dr_grade
      dtype: int64
    - name: dr_grade_name
      dtype: string
    - name: age
      dtype: float64
    - name: sex
      dtype: string
    - name: duration_years
      dtype: float64
    - name: synthetic
      dtype: bool
    - name: image_population
      dtype: string
    - name: ehr_params_version
      dtype: string
    - name: split
      dtype: string
  splits:
    - name: train
      num_bytes: 157322831.407
      num_examples: 2487
    - name: validation
      num_bytes: 34207443
      num_examples: 532
    - name: test
      num_bytes: 34229290
      num_examples: 535
  download_size: 227010357
  dataset_size: 225759564.407
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
      - split: validation
        path: data/validation-*
      - split: test
        path: data/test-*
source_datasets:
  - aptos2019-blindness-detection
pretty_name: >-
  DR-Grading: Fundus Diabetic-Retinopathy Grading with Africa-Grounded Synthetic
  Context
language:
  - en
task_categories:
  - image-classification
tags:
  - medical
  - healthcare
  - ophthalmology
  - diabetic-retinopathy
  - fundus
  - retinal-imaging
  - multimodal
  - synthetic-data
  - africa
  - global-health
size_categories:
  - 1K<n<10K
annotations_creators:
  - machine-generated
license: apache-2.0

DR-Grading — Fundus Diabetic-Retinopathy Grading with Africa-Grounded Synthetic Clinical Context

A dataset for cross-sectional 5-class diabetic-retinopathy grading, pairing resized colour fundus photographs with minimal, epidemiology-grounded synthetic point-of-care context (age, sex, diabetes duration).

Version 1.0.0 · core dr_synth 1.0.0 · part of the DR-Africa dataset family (see also dr-progression and dr-africa-benchmark).


Abstract

Diabetic retinopathy (DR) is a leading cause of preventable blindness, and its burden is rising fastest in low- and middle-income settings, including much of Sub-Saharan Africa (SSA), where an estimated 35% of people living with diabetes have some DR and ~10% have vision-threatening disease [1]. Most publicly available DR-grading datasets, however, are collected in South Asian, North American, or European populations and provide images only — with no clinical context to support the multimodal models that modern screening increasingly relies on. DR-Grading is a methods-development dataset that pairs 3,554 colour fundus photographs, each labelled with the five-stage international DR scale, with a minimal synthetic clinical context (age, sex, diabetes duration) whose statistical structure is grounded in published SSA diabetes epidemiology. The dataset is designed for cross-sectional grading: predicting DR stage from a fundus image, optionally conditioned on the limited information available at the point of grading. We document the construction, the grounding literature, and a reproducible distribution audit that validates the synthetic context against its source effect sizes. Two boundaries should be clear: the images are not African, and the clinical context is synthetic and not patient-linked. The dataset is meant for building and testing grading pipelines and for teaching, not as a source of clinical or epidemiological findings.


1. Introduction

Automated DR grading from colour fundus photography is among the most mature applications of medical computer vision, with regulator-cleared systems already deployed for screening. Yet the datasets that underpin this progress are geographically narrow. The two largest open corpora — EyePACS (United States) and APTOS 2019 (India) — together dominate the literature, and downstream models inherit their populations' fundus pigmentation, comorbidity patterns, camera hardware, and care-seeking behaviour. When such models are evaluated on African populations they frequently degrade, a manifestation of dataset shift that is both a scientific and an equity problem.

The DR-Africa family addresses this gap. Its first objective is a multimodal resource: DR research is moving beyond the image alone toward models that combine retinal imaging with systemic clinical variables (glycaemic control, diabetes duration, blood pressure, renal function), which are the main drivers of incidence and progression. Real linked image–EHR cohorts from Africa are scarce, so we start with epidemiology-grounded synthetic clinical data: synthetic records whose marginal distributions and conditional structure are taken from published SSA cohort studies and meta-analyses.

This repository, DR-Grading, is the entry point of the family and the narrowest in scope (separation of concerns). It exposes only the inputs realistically available at the moment of grading — the image plus three context fields — and the grade label. The richer systemic record lives in dr-progression; screening-prevalence evaluation lives in dr-africa-benchmark.

Contributions.

  1. A clean, split, audited 5-class DR-grading dataset with a minimal synthetic clinical context grounded in SSA epidemiology.
  2. A transparent, reproducible generation procedure (seeded; all parameters cited).
  3. A built-in distribution audit that gates every release on explicit checks.

2. Background and Related Datasets

DR grading scale. The international clinical DR severity scale defines five stages: no DR, mild non-proliferative DR (NPDR), moderate NPDR, severe NPDR, and proliferative DR (PDR). These map to the five source folders used here (No_DR, Mild, Moderate, Severe, Proliferate_DR).

Existing DR image datasets. EyePACS, APTOS 2019, Messidor / Messidor-2, IDRiD, DDR, and DeepDRiD are the most widely used. They differ in grading protocol, image quality, and population. None ships paired structured clinical data, and none is African in origin.

Epidemiology of DR in Africa. Pooled SSA estimates place any-DR prevalence around 30–35% of people with diabetes and PDR at ~1% in population-based studies [1, 10]. Strong, consistent risk factors include diabetes duration, poor glycaemic control, and hypertension [2]. Late presentation is a defining feature of African DR services and correlates with severity at first contact [10]. These findings are the empirical backbone of the synthetic context here and in the sibling datasets.


3. Dataset Construction

3.1 Image source

The fundus images are the resized colour photographs from the APTOS 2019 Blindness Detection corpus (Aravind Eye Hospital, India) [11], reorganised into five class folders. All images are 224×224 RGB PNGs. The class counts are deliberately referral/clinic-skewed (see §4) rather than screening-distributed.

The images are not African. They function as a transfer-learning source. Models trained here will face domain shift on African fundi, which are more pigmented (darker background, altered contrast) and are increasingly captured on smartphone-based fundus cameras. See §8 and §9.

3.2 Synthetic clinical context

For each image we generate three context fields — age, sex, and duration_years (diabetes duration) — using a seeded generator (dr_synth.generate). These are the fields plausibly available to a grader and were chosen to keep the grading task realistic without leaking the label.

Each record is produced from a per-image deterministic seed (a hash of the image id and the global seed), so a given image always yields the same context regardless of iteration order, machine, or how many records precede it. The global generation seed is 42.

3.3 Grounding and conditioning

Demographics are drawn grade-independently (age and sex are not significant DR predictors in the SSA meta-analysis [2]). Diabetes duration is conditioned on DR grade, because duration is the single strongest and most consistent predictor of DR severity in African cohorts. We use the per-stage duration gradient reported in the Dakar study [7] — mean duration rising from ~5.3 years at no-DR to ~16.8 years at proliferative DR — with wide standard deviations that preserve realistic overlap between adjacent grades. All parameters and their citations live in dr_synth/params.yaml.

3.4 Splits

A stratified 70/15/15 train/validation/test split is provided in the split column and as separate parquet files (data/train.parquet, data/validation.parquet, data/test.parquet). Stratification is on dr_grade; the split seed is 7. Splits are assigned at the image level, and the audit verifies that no image id appears in more than one split.


4. Dataset Statistics

Field Type Description
image_id string APTOS image identifier (filename stem)
image_path string path relative to images_root (e.g. No_DR/xxxx.png)
dr_grade int (0–4) label: 0 No_DR · 1 Mild · 2 Moderate · 3 Severe · 4 PDR
dr_grade_name string human-readable grade
age float years (synthetic)
sex string F/M (synthetic)
duration_years float diabetes duration, years (synthetic, grade-conditioned)
split string train/val/test
synthetic, image_population, ehr_params_version provenance

Label distribution (n = 3,554).

Grade Count Proportion
No_DR 968 27.2%
Mild 527 14.8%
Moderate 395 11.1%
Severe 575 16.2%
Proliferate_DR 1,089 30.6%

Splits. train 2,487 (70.0%) · validation 532 (15.0%) · test 535 (15.1%).

Context summary. age mean 55.8 (SD 12.0, range 18–90); duration mean 10.9 y (SD 7.4); sex ~52% female. Mean duration by grade rises monotonically: 5.9 → 7.4 → 8.6 → 12.7 → 16.9 years (Spearman ρ = 0.60 with grade, p < 10⁻³⁰⁰).


5. Distribution Audit (Validation)

Every build regenerates audit/AUDIT.md (plus CSV tables and PNG figures) by running dr_synth.audit. Each check reports PASS / WARN / FAIL against an explicit threshold, so the audit can gate a release. The current verdict is PASS. Checks for this dataset:

  • Label distribution documented against the SSA screening-prevalence target (the curated set is intentionally not screening-distributed; see dr-africa-benchmark for prevalence-corrected evaluation).
  • Split integrity — no cross-split image-id leakage; unique row ids; stratification drift between per-split and overall label proportions < 0.03.
  • Numeric validation — zero out-of-range values for age and duration_years; zero unexpected missing values.
  • Grade conditioning — Spearman monotonic-trend test confirms duration_years increases with grade (ρ = 0.60, p ≈ 0).

Figures: audit/figures/label_distribution.png, audit/figures/conditioning_duration_years.png.


6. Loading and Usage

Hugging Face datasets

from datasets import load_dataset
ds = load_dataset("macular/diabetic-retinopathy-grading-africa")   # 3 splits
print(ds["train"][0])
# {'image_id': ..., 'image_path': 'No_DR/xxxx.png', 'dr_grade': 0, ...}

The fundus images are bundled as a datasets.Image feature, so each example includes the decoded image alongside its label and context — the dataset is self-contained and renders in the Hub viewer.

Local / PyTorch

pip install -r requirements.txt
python build.py                       # regenerate data/ + audit/
python loader.py --split train --limit 3

loader.py provides a torch.utils.data.Dataset returning (image_tensor, context_tensor, grade).


7. Intended Uses and Benchmarks

Intended. Cross-sectional DR-grading models (image-only or image+context); data augmentation studies; transfer-learning and domain-adaptation baselines toward African deployment; teaching.

Suggested protocol. Train on train, tune on validation, report on test using quadratic-weighted kappa (the APTOS metric) and per-class recall. For a screening-realistic estimate, additionally evaluate with the prevalence weights from dr-africa-benchmark.

Out of scope. Clinical decision support; epidemiological inference; any claim about real African patients.


8. Limitations

  1. Non-African images. The fundus photographs originate from an Indian population; performance here does not transfer directly to African fundi.
  2. Synthetic, non-linked context. The context fields are generated, not measured, and are not tied to the real patient behind each image. A model can exploit the encoded association between duration and grade, but this is a property of the generator, not evidence about patients.
  3. Referral-skewed labels. The class balance reflects a clinic/referral population, not screening; uncorrected accuracy overstates screening utility.
  4. Minimal context. Labs and comorbidities are not included here (they belong to dr-progression).

9. Ethical Considerations and Data Governance

  • Synthetic data are flagged. Every record carries synthetic = True. No attempt should be made to interpret a synthetic record as a real individual.
  • Representation. Calling a dataset "Africa-grounded" while the imagery is non-African could mislead, so we state the provenance plainly and treat the images only as a transfer-learning source.
  • Data sovereignty. The move toward real African imaging and linked records must follow local consent, ethics approval, and data-sovereignty principles. This synthetic dataset is a placeholder, not a substitute.
  • Purpose. The dataset exists to support DR research relevant to Africa by making multimodal work easier to start, not to replace real-world data collection.

10. Licensing, Access, and Provenance

  • Images: derived from APTOS 2019 (Aravind Eye Hospital, India), which is released under the Apache License 2.0 — redistribution is permitted with attribution. The bundled images are provided under Apache-2.0; see LICENSE and ATTRIBUTION.md. Users should verify the source license on the APTOS distribution they rely on [11].
  • Synthetic context, code, and audit: generated locally and fully reproducible from dr_synth/params.yaml with the fixed seeds above; released under Apache-2.0.
  • Provenance fields: image_population = "APTOS-2019-India", ehr_params_version, and the generation seed are recorded on every row.

11. Maintenance and Versioning

The dataset is fully regenerable: python build.py. The grounding parameters and the shared generator/audit core (dr_synth) are version-stamped; any change bumps dr_synth.__version__ and params.yaml meta.version, which propagate to the ehr_params_version recorded in the data. Issues and corrections to the grounding literature are welcome.


12. References

  1. Diabetic retinopathy in Sub-Saharan Africa: prevalence and regional variations — a systematic review and meta-analysis. BMC Ophthalmology, 2025. https://link.springer.com/article/10.1186/s12886-025-04589-5
  2. Prevalence of diabetic retinopathy and its associated risk factors among adults in Ethiopia — a systematic review and meta-analysis. Scientific Reports, 2024. https://pmc.ncbi.nlm.nih.gov/articles/PMC11569147/
  3. Diabetic retinopathy in Dakar and review of African literature: epidemiologic elements. 2000. https://pubmed.ncbi.nlm.nih.gov/11011227/
  4. Epidemiology of diabetic retinopathy and maculopathy in Africa: a systematic review. 2015. https://pmc.ncbi.nlm.nih.gov/articles/PMC4463765/
  5. APTOS 2019 Blindness Detection. Kaggle. https://www.kaggle.com/competitions/aptos2019-blindness-detection
  6. Gebru et al. Datasheets for Datasets. Communications of the ACM, 2021.

(Reference numbers are shared across the DR-Africa family for cross-consistency.)


Citation

@misc{drafrica_grading_2026,
  title        = {DR-Grading: Fundus Diabetic-Retinopathy Grading with
                  Africa-Grounded Synthetic Clinical Context},
  author       = {DR-Africa dataset family},
  year         = {2026},
  note         = {Version 1.0.0. Images derived from APTOS 2019 (India);
                  clinical context is epidemiology-grounded synthetic data.},
  howpublished = {Hugging Face Datasets}
}