| --- |
| license: mit |
| library_name: pytorch |
| pipeline_tag: image-segmentation |
| base_model: facebook/dinov2-base |
| tags: |
| - medical-imaging |
| - diabetic-foot-ulcer |
| - wound-segmentation |
| - image-classification |
| - image-segmentation |
| - dinov2 |
| - clinical-ai |
| --- |
| |
| # DiaFoot.AI — Diabetic Foot Ulcer Triage & Wound Segmentation |
|
|
| Cascaded multi-task model for diabetic foot images: it **triages** a foot photo into |
| `Healthy` / `Non-DFU` / `DFU`, **segments** the wound when present, and **measures** wound |
| area in mm². Both stages use a frozen **DINOv2 ViT-B/14** backbone with a trainable head |
| (classifier) / UPerNet decoder (segmenter). |
|
|
| Code: <https://github.com/Ruthvik-Bandari/DiaFoot.AI> |
|
|
| > **Honesty note.** Every number below is from leakage-audited clean-split evaluation |
| > (`results/*.json` in the repo). They are lower than an earlier headline (Dice 85.89%) that |
| > was a DFU-only subgroup measured before a data-leakage fix. These are the honest numbers. |
| |
| ## Files |
| |
| | File | Stage | Backbone | |
| |---|---|---| |
| | `dinov2_classifier.pt` | 3-class triage (Healthy/Non-DFU/DFU) | DINOv2 ViT-B/14 + linear head | |
| | `dinov2_segmenter.pt` | Binary wound segmentation | DINOv2 ViT-B/14 + UPerNet decoder | |
| |
| ## Results (leakage-audited test set, n = 1,161) |
| |
| ### Triage classification |
| | Metric | Value | |
| |---|---| |
| | Accuracy | 0.984 | |
| | Macro F1 | 0.981 | |
| | Macro AUROC | 0.999 | |
| | DFU sensitivity | 0.966 | |
| | Healthy specificity | 0.995 | |
| | ECE (after temperature scaling) | 0.007 | |
| | Defer @ 0.95 confidence | 93.5% coverage, 99.7% accuracy on kept | |
| |
| ### Wound segmentation |
| | Slice | Dice | IoU | HD95 (px) | |
| |---|---|---|---| |
| | DFU wounds only (n = 263) | 0.891 | 0.829 | 11.3 | |
| | Full mixed test set, mean | 0.718 | 0.673 | 66.1 | |
| | Full mixed test set, median | 0.929 | 0.868 | 5.0 | |
| | 5-fold CV (DFU) | 0.853 ± 0.009 | 0.785 ± 0.010 | — | |
| |
| The mixed-set mean is far below the median because healthy/non-DFU images have empty masks |
| (any false-positive pixel scores Dice ≈ 0). Judge wound quality from the DFU-only / median rows. |
| |
| ## Intended use |
| |
| Research and education on diabetic-foot-ulcer imaging. **Not a medical device**; no regulatory |
| clearance. Do not use for diagnosis or treatment. |
| |
| ## Limitations (read before use) |
| |
| - **The triage classifier does not generalize across image sources.** On unseen datasets, |
| external accuracy drops to ~21% and DFU sensitivity to 0%. Re-validate on any new source |
| before use. The segmenter transfers well (external DFU Dice 0.893). |
| - **Fairness is under-powered by the test split** (effectively one ITA skin-tone group); the |
| DFU-only fairness gap is 0.00, but broad skin-tone fairness is unproven. |
| - Clinical wound-area agreement was measured on only n = 3 (indicative, not validated). |
| |
| ## How to use |
| |
| ```python |
| import torch |
| from huggingface_hub import hf_hub_download |
| |
| repo = "Ruthvik-Bandari/DiaFoot.AI" |
| clf = hf_hub_download(repo, "dinov2_classifier.pt") |
| seg = hf_hub_download(repo, "dinov2_segmenter.pt") |
| # Load with the model definitions in src/models/ from the GitHub repo: |
| # DINOv2Classifier(backbone="dinov2_vitb14"), DINOv2Segmenter(backbone="dinov2_vitb14") |
| # Or run the end-to-end CLI: |
| # python scripts/predict.py --image foot.jpg \ |
| # --classifier-checkpoint dinov2_classifier.pt \ |
| # --segmenter-checkpoint dinov2_segmenter.pt --device cpu |
| ``` |
| |
| Input size 518×518 (DINOv2). See the GitHub repo for the full inference pipeline, FastAPI |
| service, and ONNX export. |
| |
| ## Training data |
| |
| ~8,105 images across three categories (2,119 DFU incl. AZH · 3,300 healthy · 2,686 non-DFU), |
| aggregated from FUSeg, AZH, Kaggle, and Mendeley sources. Splits are 70/15/15, doubly |
| stratified by ITA skin tone and class, and audited to zero train/test leakage |
| (`has_any_leakage: False`). The raw images are **not** redistributed here (third-party |
| licenses + patient privacy). |
| |
| ## Citation |
| |
| Bandari, R. *DiaFoot.AI v2: Diabetic Foot Ulcer Detection, Segmentation & Wagner Staging.* 2026. |
| <https://github.com/Ruthvik-Bandari/DiaFoot.AI> |
|
|
| Built on DINOv2 (Meta AI, Apache-2.0). Fine-tuned weights released under MIT. |
|
|