Instructions to use GimhanSathsara843/cataract-severity-efficientnetb0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use GimhanSathsara843/cataract-severity-efficientnetb0 with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://GimhanSathsara843/cataract-severity-efficientnetb0") - Notebooks
- Google Colab
- Kaggle
Leakage-free retrain + evaluation
Browse files- .gitattributes +3 -0
- README.md +63 -0
- best_finetune.keras +3 -0
- best_head.keras +3 -0
- cataract_final.keras +3 -0
- evaluation.json +95 -0
- log_finetune.csv +12 -0
- log_head.csv +17 -0
- serving_config.json +28 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
best_finetune.keras filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
best_head.keras filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
cataract_final.keras filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags: [image-classification, medical-imaging, ophthalmology, cataract]
|
| 3 |
+
library_name: keras
|
| 4 |
+
pipeline_tag: image-classification
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# Cataract Severity Classification
|
| 8 |
+
|
| 9 |
+
EfficientNetB0 with a squeeze-excitation attention block, fine-tuned to grade
|
| 10 |
+
anterior-segment eye images into four severity levels: Normal, Mild, Moderate,
|
| 11 |
+
Severe.
|
| 12 |
+
|
| 13 |
+
NeuroGSD group project, Faculty of Information Technology, University of Moratuwa.
|
| 14 |
+
|
| 15 |
+
## Intended use
|
| 16 |
+
|
| 17 |
+
Research and academic evaluation only. **Not a medical device.** Not clinically
|
| 18 |
+
validated, no regulatory clearance, must not inform decisions about real patients.
|
| 19 |
+
|
| 20 |
+
## Results (leakage-free held-out test set, n=54)
|
| 21 |
+
|
| 22 |
+
| Metric | Value | 95% CI |
|
| 23 |
+
|---|---|---|
|
| 24 |
+
| Accuracy | 0.833 | 0.741–0.926 |
|
| 25 |
+
| Balanced accuracy | 0.721 | 0.554–0.862 |
|
| 26 |
+
| Quadratic weighted kappa | 0.697 | 0.321–0.921 |
|
| 27 |
+
| Macro AUC | 0.971 | — |
|
| 28 |
+
| Within-one-grade agreement | 0.981 | — |
|
| 29 |
+
|
| 30 |
+
## Data and splitting
|
| 31 |
+
|
| 32 |
+
357 unique images. The source export applied augmentation *before* splitting, so
|
| 33 |
+
several augmented copies of one photograph existed. Splits are therefore grouped
|
| 34 |
+
by original image ID: training keeps all augmented copies, while validation and
|
| 35 |
+
test keep one representative per group. This eliminates train/test leakage that
|
| 36 |
+
would otherwise inflate every metric substantially.
|
| 37 |
+
|
| 38 |
+
## Input
|
| 39 |
+
|
| 40 |
+
224x224 RGB, raw 0-255 float (EfficientNet normalisation is inside the graph).
|
| 41 |
+
Preprocessing must match training exactly:
|
| 42 |
+
|
| 43 |
+
1. Median blur, kernel 3
|
| 44 |
+
2. CLAHE on the LAB L channel, clip 2.0, 8x8 tiles
|
| 45 |
+
3. Resize to 224x224, INTER_AREA
|
| 46 |
+
|
| 47 |
+
No ROI crop and no circular mask — these images are rectangular anterior-segment
|
| 48 |
+
photographs, and a circular mask removes roughly 29% of real content.
|
| 49 |
+
|
| 50 |
+
## Limitations
|
| 51 |
+
|
| 52 |
+
- Only 357 unique images; the Normal grade has just 29, so its metrics rest on a
|
| 53 |
+
handful of test cases and the confidence intervals are wide.
|
| 54 |
+
- Single-source dataset; other cameras, lighting and populations are unverified.
|
| 55 |
+
- Labels were graded by the student team and reviewed by a domain expert, not
|
| 56 |
+
independently double-graded.
|
| 57 |
+
- Grade 2 accounts for the majority of unique images; apparent class balance in
|
| 58 |
+
the raw file counts was an artefact of augmentation.
|
| 59 |
+
|
| 60 |
+
## Citation
|
| 61 |
+
|
| 62 |
+
NeuroGSD (2026). AI Based Early Detection System for Common Eye Diseases Using
|
| 63 |
+
Medical Image Analysis. University of Moratuwa.
|
best_finetune.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8a112d0353a7b203caf07ce64079ee15dedbc428e98f459fac21fba659347366
|
| 3 |
+
size 44753233
|
best_head.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4c6885dbdbc65914e048ec28d622e6d081ab234679389188a9ae04ae1a178f30
|
| 3 |
+
size 23539113
|
cataract_final.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:55ef340bc7f3bcb31d84b089ee569fbbba569aeb240f3ee08a906ab2223af4b9
|
| 3 |
+
size 44753233
|
evaluation.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"n_test": 54,
|
| 3 |
+
"tta": true,
|
| 4 |
+
"leakage_free": true,
|
| 5 |
+
"accuracy": 0.8333333333333334,
|
| 6 |
+
"balanced_accuracy": 0.7214285714285713,
|
| 7 |
+
"qwk": 0.6974291364535268,
|
| 8 |
+
"mcc": 0.6764422721683907,
|
| 9 |
+
"macro_auc": 0.9705007198848183,
|
| 10 |
+
"mae_grades": 0.2037037037037037,
|
| 11 |
+
"within_one_grade": 0.9814814814814815,
|
| 12 |
+
"log_loss": 0.579186409720307,
|
| 13 |
+
"bootstrap_ci": {
|
| 14 |
+
"accuracy": {
|
| 15 |
+
"mean": 0.8360277777777778,
|
| 16 |
+
"lo": 0.7407407407407407,
|
| 17 |
+
"hi": 0.9259259259259259
|
| 18 |
+
},
|
| 19 |
+
"balanced_accuracy": {
|
| 20 |
+
"mean": 0.7190323405395228,
|
| 21 |
+
"lo": 0.5544188428059396,
|
| 22 |
+
"hi": 0.8618421052631579
|
| 23 |
+
},
|
| 24 |
+
"qwk": {
|
| 25 |
+
"mean": 0.6890407941887947,
|
| 26 |
+
"lo": 0.32109167143522915,
|
| 27 |
+
"hi": 0.9207563769158413
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"confusion_matrix": [
|
| 31 |
+
[
|
| 32 |
+
4,
|
| 33 |
+
0,
|
| 34 |
+
0,
|
| 35 |
+
1
|
| 36 |
+
],
|
| 37 |
+
[
|
| 38 |
+
0,
|
| 39 |
+
6,
|
| 40 |
+
1,
|
| 41 |
+
0
|
| 42 |
+
],
|
| 43 |
+
[
|
| 44 |
+
0,
|
| 45 |
+
2,
|
| 46 |
+
33,
|
| 47 |
+
0
|
| 48 |
+
],
|
| 49 |
+
[
|
| 50 |
+
0,
|
| 51 |
+
0,
|
| 52 |
+
5,
|
| 53 |
+
2
|
| 54 |
+
]
|
| 55 |
+
],
|
| 56 |
+
"per_class": {
|
| 57 |
+
"0": {
|
| 58 |
+
"precision": 1.0,
|
| 59 |
+
"recall": 0.8,
|
| 60 |
+
"f1-score": 0.8888888888888888,
|
| 61 |
+
"support": 5.0
|
| 62 |
+
},
|
| 63 |
+
"1": {
|
| 64 |
+
"precision": 0.75,
|
| 65 |
+
"recall": 0.8571428571428571,
|
| 66 |
+
"f1-score": 0.8,
|
| 67 |
+
"support": 7.0
|
| 68 |
+
},
|
| 69 |
+
"2": {
|
| 70 |
+
"precision": 0.8461538461538461,
|
| 71 |
+
"recall": 0.9428571428571428,
|
| 72 |
+
"f1-score": 0.8918918918918919,
|
| 73 |
+
"support": 35.0
|
| 74 |
+
},
|
| 75 |
+
"3": {
|
| 76 |
+
"precision": 0.6666666666666666,
|
| 77 |
+
"recall": 0.2857142857142857,
|
| 78 |
+
"f1-score": 0.4,
|
| 79 |
+
"support": 7.0
|
| 80 |
+
},
|
| 81 |
+
"accuracy": 0.8333333333333334,
|
| 82 |
+
"macro avg": {
|
| 83 |
+
"precision": 0.8157051282051282,
|
| 84 |
+
"recall": 0.7214285714285713,
|
| 85 |
+
"f1-score": 0.7451951951951952,
|
| 86 |
+
"support": 54.0
|
| 87 |
+
},
|
| 88 |
+
"weighted avg": {
|
| 89 |
+
"precision": 0.8246676163342829,
|
| 90 |
+
"recall": 0.8333333333333334,
|
| 91 |
+
"f1-score": 0.8159381603826048,
|
| 92 |
+
"support": 54.0
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
}
|
log_finetune.csv
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
epoch,acc,learning_rate,loss,val_acc,val_loss,val_qwk
|
| 2 |
+
0,0.930656909942627,9.999999747378752e-06,0.3946684002876282,0.8888888955116272,0.6446592807769775,0.893491124260355
|
| 3 |
+
1,0.953441321849823,9.999999747378752e-06,0.36877989768981934,0.8888888955116272,0.6242743730545044,0.893491124260355
|
| 4 |
+
2,0.953441321849823,9.999999747378752e-06,0.37556153535842896,0.8703703880310059,0.6032083034515381,0.8771929824561403
|
| 5 |
+
3,0.9331983923912048,9.999999747378752e-06,0.3719872236251831,0.8703703880310059,0.5901629328727722,0.8771929824561403
|
| 6 |
+
4,0.9655870199203491,9.999999747378752e-06,0.35033589601516724,0.8703703880310059,0.5708237290382385,0.8771929824561403
|
| 7 |
+
5,0.9615384340286255,9.999999747378752e-06,0.35351890325546265,0.8703703880310059,0.5533149838447571,0.8771929824561403
|
| 8 |
+
6,0.9676113128662109,9.999999747378752e-06,0.3405035436153412,0.8703703880310059,0.5340921878814697,0.8771929824561403
|
| 9 |
+
7,0.9676113128662109,9.999999747378752e-06,0.34166622161865234,0.8703703880310059,0.5190687775611877,0.8771929824561403
|
| 10 |
+
8,0.9635627269744873,9.999999747378752e-06,0.33416253328323364,0.8703703880310059,0.507893443107605,0.8771929824561403
|
| 11 |
+
9,0.9595141410827637,9.999999747378752e-06,0.352279394865036,0.8518518805503845,0.4947706162929535,0.861271676300578
|
| 12 |
+
10,0.9554656147956848,9.999999747378752e-06,0.345771849155426,0.8888888955116272,0.48168063163757324,0.893491124260355
|
log_head.csv
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
epoch,acc,learning_rate,loss,val_acc,val_loss,val_qwk
|
| 2 |
+
0,0.7206477522850037,0.0010000000474974513,0.9701550602912903,0.48148149251937866,1.0439261198043823,0.5194805194805194
|
| 3 |
+
1,0.862348198890686,0.0010000000474974513,0.5114316940307617,0.7407407164573669,0.8778523802757263,0.6101694915254237
|
| 4 |
+
2,0.931174099445343,0.0010000000474974513,0.44203224778175354,0.8333333134651184,0.7314485907554626,0.713375796178344
|
| 5 |
+
3,0.9210526347160339,0.0010000000474974513,0.40995514392852783,0.8703703880310059,0.7296186089515686,0.8203592814371257
|
| 6 |
+
4,0.9251012206077576,0.0010000000474974513,0.4605046808719635,0.8888888955116272,0.6689417362213135,0.8867924528301887
|
| 7 |
+
5,0.9473684430122375,0.0010000000474974513,0.391880601644516,0.8888888955116272,0.6693353056907654,0.893491124260355
|
| 8 |
+
6,0.9352226853370667,0.0010000000474974513,0.39837750792503357,0.7592592835426331,0.7415996193885803,0.6815642458100559
|
| 9 |
+
7,0.9331983923912048,0.0010000000474974513,0.4036140739917755,0.7962962985038757,0.6897245049476624,0.718232044198895
|
| 10 |
+
8,0.9615384340286255,0.0010000000474974513,0.3714412450790405,0.7407407164573669,0.7293246388435364,0.679144385026738
|
| 11 |
+
9,0.9696356058120728,0.0010000000474974513,0.34637898206710815,0.7592592835426331,0.6768876314163208,0.6918918918918919
|
| 12 |
+
10,0.9635627269744873,0.0003000000142492354,0.33492517471313477,0.7962962985038757,0.6475585699081421,0.772972972972973
|
| 13 |
+
11,0.9655870199203491,0.0003000000142492354,0.3481481075286865,0.7962962985038757,0.6218593120574951,0.772972972972973
|
| 14 |
+
12,0.9655870199203491,0.0003000000142492354,0.32996681332588196,0.8148148059844971,0.5797955989837646,0.7257142857142858
|
| 15 |
+
13,0.9797570705413818,0.0003000000142492354,0.3153730630874634,0.8333333134651184,0.5787845849990845,0.850828729281768
|
| 16 |
+
14,0.9615384340286255,0.0003000000142492354,0.3239787220954895,0.7777777910232544,0.5722655653953552,0.6983240223463687
|
| 17 |
+
15,0.9676113128662109,0.0003000000142492354,0.31934496760368347,0.8333333134651184,0.5348048806190491,0.7966101694915254
|
serving_config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class_names": [
|
| 3 |
+
"0",
|
| 4 |
+
"1",
|
| 5 |
+
"2",
|
| 6 |
+
"3"
|
| 7 |
+
],
|
| 8 |
+
"img_size": 224,
|
| 9 |
+
"backbone": "efficientnetb0",
|
| 10 |
+
"attention": "se",
|
| 11 |
+
"ordinal": true,
|
| 12 |
+
"preprocess": {
|
| 13 |
+
"median_blur": 3,
|
| 14 |
+
"clahe_clip": 2.0,
|
| 15 |
+
"clahe_grid": [
|
| 16 |
+
8,
|
| 17 |
+
8
|
| 18 |
+
],
|
| 19 |
+
"crop_roi": false,
|
| 20 |
+
"circle_mask": false
|
| 21 |
+
},
|
| 22 |
+
"risk_band": {
|
| 23 |
+
"0": "None",
|
| 24 |
+
"1": "Low",
|
| 25 |
+
"2": "Medium",
|
| 26 |
+
"3": "High"
|
| 27 |
+
}
|
| 28 |
+
}
|