--- 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.0 num_examples: 532 - name: test num_bytes: 34229290.0 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 **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`](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`](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` ```python 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 ```bash pip install -r requirements.txt python build.py # regenerate data/ + audit/ python loader.py --split train --limit 3 ``` [`loader.py`](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`](../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`](LICENSE) and [`ATTRIBUTION.md`](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`](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/ 7. *Diabetic retinopathy in Dakar and review of African literature: epidemiologic elements.* 2000. https://pubmed.ncbi.nlm.nih.gov/11011227/ 10. *Epidemiology of diabetic retinopathy and maculopathy in Africa: a systematic review.* 2015. https://pmc.ncbi.nlm.nih.gov/articles/PMC4463765/ 11. *APTOS 2019 Blindness Detection.* Kaggle. https://www.kaggle.com/competitions/aptos2019-blindness-detection 13. Gebru et al. *Datasheets for Datasets.* Communications of the ACM, 2021. *(Reference numbers are shared across the DR-Africa family for cross-consistency.)* --- ## Citation ```bibtex @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} } ```