Shadow0482 commited on
Commit
bb9025f
·
verified ·
1 Parent(s): c90b3ad

Add model card

Browse files
Files changed (1) hide show
  1. README.md +22 -24
README.md CHANGED
@@ -1,26 +1,25 @@
1
- # ResNet50-APTOS-DR (ONNX)
2
 
3
- **5-class Diabetic Retinopathy classifier** converted to ONNX for edge devices.
4
 
5
  **Original model**: sakshamkr1/ResNet50-APTOS-DR
6
- **Format**: ONNX (exported from PyTorch)
7
- **Input**: RGB fundus image 224×224
8
  **Output**: 5 classes (APTOS 2019)
9
 
10
  ### Classes
11
- - **0**: No DR
12
- - **1**: Mild DR
13
- - **2**: Moderate DR
14
- - **3**: Severe DR
15
- - **4**: Proliferative DR
16
 
 
 
 
 
17
 
18
-
19
- ### How to use this model
20
-
21
- ```bash
22
- pip install onnxruntime pillow torchvision
23
- ```
24
 
25
  ```python
26
  import onnxruntime as ort
@@ -28,7 +27,8 @@ import numpy as np
28
  from PIL import Image
29
  import torchvision.transforms as transforms
30
 
31
- session = ort.InferenceSession("iris.onnx", providers=["CPUExecutionProvider"])
 
32
 
33
  transform = transforms.Compose([
34
  transforms.Resize((224, 224)),
@@ -36,19 +36,17 @@ transform = transforms.Compose([
36
  transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
37
  ])
38
 
39
- img = Image.open("your_photo.jpg").convert("RGB")
40
  input_tensor = transform(img).unsqueeze(0).numpy().astype(np.float32)
41
 
42
  output = session.run(None, {"input": input_tensor})[0][0]
43
  probs = np.exp(output) / np.sum(np.exp(output))
44
- pred = np.argmax(probs)
45
 
46
- class_names = ["No DR", "Mild DR", "Moderate DR", "Severe DR", "Proliferative DR"]
47
- print(f"Prediction: {class_names[pred]} ({probs[pred]*100:.1f}%)")
48
  ```
49
 
50
- ### License
51
- MIT
52
- **Feel free to use in any project (research / commercial)**
53
 
54
- Made with ❤️ for low-resource DR screening.
 
1
+ # ResNet50-APTOS-DR (ONNX) - Single Clean File
2
 
3
+ **5-class Diabetic Retinopathy classifier** ready for Raspberry Pi 5 and edge devices.
4
 
5
  **Original model**: sakshamkr1/ResNet50-APTOS-DR
6
+ **Format**: ONNX (single file - no external .data)
7
+ **Input shape**: (batch, 3, 224, 224) RGB fundus image
8
  **Output**: 5 classes (APTOS 2019)
9
 
10
  ### Classes
11
+ - 0: No DR
12
+ - 1: Mild DR
13
+ - 2: Moderate DR
14
+ - 3: Severe DR
15
+ - 4: Proliferative DR
16
 
17
+ ### Perfect
18
+ - Model size: ~105 MB (single file)
19
+ - RAM usage: ~150-220 MB
20
+ - Speed: ~0.8–1.5 seconds per image on CPU
21
 
22
+ ### Quick test code for Pi 5
 
 
 
 
 
23
 
24
  ```python
25
  import onnxruntime as ort
 
27
  from PIL import Image
28
  import torchvision.transforms as transforms
29
 
30
+ session = ort.InferenceSession("iris-vit.onnx",
31
+ providers=["CPUExecutionProvider"])
32
 
33
  transform = transforms.Compose([
34
  transforms.Resize((224, 224)),
 
36
  transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
37
  ])
38
 
39
+ img = Image.open("DR1.jpg").convert("RGB")
40
  input_tensor = transform(img).unsqueeze(0).numpy().astype(np.float32)
41
 
42
  output = session.run(None, {"input": input_tensor})[0][0]
43
  probs = np.exp(output) / np.sum(np.exp(output))
44
+ pred_idx = np.argmax(probs)
45
 
46
+ classes = ["No DR", "Mild DR", "Moderate DR", "Severe DR", "Proliferative DR"]
47
+ print(f"✅ Predicted: {classes[pred_idx]} ({probs[pred_idx]*100:.1f}%)")
48
  ```
49
 
50
+ **License**: MIT
51
+ Made for low-resource diabetic retinopathy screening ❤️
 
52