Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,71 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: cc-by-nc-4.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
datasets:
|
| 4 |
+
- aptos2019-blindness-detection
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- diabetic-retinopathy
|
| 9 |
+
- resnet50
|
| 10 |
+
- deep-learning
|
| 11 |
+
- medical-imaging
|
| 12 |
+
base_model:
|
| 13 |
+
- microsoft/resnet-50
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Diabetic Retinopathy Detection Model
|
| 17 |
+
|
| 18 |
+
## Overview
|
| 19 |
+
|
| 20 |
+
This model is a deep learning-based classifier designed to detect and classify diabetic retinopathy (DR) from retinal fundus images. It is built on the ResNet50 architecture and trained on the **APTOS 2019 Blindness Detection dataset**, which includes five DR severity classes:
|
| 21 |
+
|
| 22 |
+
- **0**: No DR
|
| 23 |
+
- **1**: Mild DR
|
| 24 |
+
- **2**: Moderate DR
|
| 25 |
+
- **3**: Severe DR
|
| 26 |
+
- **4**: Proliferative DR
|
| 27 |
+
|
| 28 |
+
The model aims to assist in early diagnosis and grading of diabetic retinopathy, reducing the workload for ophthalmologists and improving accessibility to screening.
|
| 29 |
+
|
| 30 |
+
## Usage
|
| 31 |
+
You can use this model via the Hugging Face `transformers` or `torch` library for inference.
|
| 32 |
+
|
| 33 |
+
### Installation
|
| 34 |
+
Ensure you have the required dependencies installed:
|
| 35 |
+
```bash
|
| 36 |
+
pip install torch torchvision transformers opencv-python pandas
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
### Loading the Model
|
| 40 |
+
```python
|
| 41 |
+
import torch
|
| 42 |
+
from torchvision import transforms
|
| 43 |
+
from PIL import Image
|
| 44 |
+
from transformers import AutoModel
|
| 45 |
+
|
| 46 |
+
# Load model
|
| 47 |
+
model = AutoModel.from_pretrained("your-huggingface-username/model-name")
|
| 48 |
+
model.eval()
|
| 49 |
+
|
| 50 |
+
# Define image preprocessing
|
| 51 |
+
transform = transforms.Compose([
|
| 52 |
+
transforms.Resize((224, 224)),
|
| 53 |
+
transforms.ToTensor(),
|
| 54 |
+
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
| 55 |
+
])
|
| 56 |
+
|
| 57 |
+
# Load and preprocess image
|
| 58 |
+
image = Image.open("path/to/image.jpg")
|
| 59 |
+
image = transform(image).unsqueeze(0)
|
| 60 |
+
|
| 61 |
+
# Perform inference
|
| 62 |
+
with torch.no_grad():
|
| 63 |
+
output = model(image)
|
| 64 |
+
prediction = torch.argmax(output, dim=1).item()
|
| 65 |
+
print(f"Predicted DR severity: {prediction}")
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## License
|
| 69 |
+
This model is released under the **CC-BY-NC 4.0** license.
|
| 70 |
+
|
| 71 |
+
|