Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: keras
|
| 3 |
+
license: mit
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
pipeline_tag: image-classification
|
| 7 |
+
tags:
|
| 8 |
+
- cnn
|
| 9 |
+
- medical-imaging
|
| 10 |
+
- diabetic-retinopathy
|
| 11 |
+
- transfer-learning
|
| 12 |
+
- efficientnet
|
| 13 |
+
- keras
|
| 14 |
+
- tensorflow
|
| 15 |
+
- deep-learning
|
| 16 |
+
datasets:
|
| 17 |
+
- diagnosis-of-diabetic-retinopathy
|
| 18 |
+
metrics:
|
| 19 |
+
- accuracy
|
| 20 |
+
- precision
|
| 21 |
+
- recall
|
| 22 |
+
- f1
|
| 23 |
+
base_model:
|
| 24 |
+
- google/efficientnet-b3
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
# Model Card for TransferLearningDR: Diabetic Retinopathy Detector
|
| 28 |
+
|
| 29 |
+
**TransferLearningDR** is a convolutional neural network (CNN) model built on **EfficientNetB3** and trained to classify retinal fundus images into two categories: **No DR** and **Diabetic Retinopathy (DR)**. The model leverages **transfer learning** from ImageNet weights to accelerate training and improve generalization.
|
| 30 |
+
|
| 31 |
+
> ⚠️ **Disclaimer:** This model is intended **for research and educational purposes only**. It is **not a substitute for professional medical diagnosis**. Always consult a licensed healthcare provider for medical decisions.
|
| 32 |
+
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
## **Model Details**
|
| 36 |
+
|
| 37 |
+
**Key Features:**
|
| 38 |
+
- Binary classification of retinal images (**No DR vs DR**)
|
| 39 |
+
- Transfer learning using **EfficientNetB3** pretrained on ImageNet
|
| 40 |
+
- Input size: 224x224 RGB images, normalized
|
| 41 |
+
- Custom dense head with batch normalization, dropout, and L1/L2 regularization
|
| 42 |
+
- Evaluated on separate validation and test sets with high accuracy
|
| 43 |
+
|
| 44 |
+
**Skills & Technologies Used:**
|
| 45 |
+
- TensorFlow / Keras for model design & training
|
| 46 |
+
- ImageDataGenerator for preprocessing and optional augmentation
|
| 47 |
+
- EfficientNetB3 for feature extraction
|
| 48 |
+
- Matplotlib & Seaborn for visualization
|
| 49 |
+
- Hugging Face Hub for model hosting
|
| 50 |
+
- Kaggle for dataset and training environment
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
- **Developed by:** [Rawan Alwadeya](https://www.linkedin.com/in/rawan-alwadeya-17948a305/)
|
| 55 |
+
- **Model type:** Convolutional Neural Network (CNN) with Transfer Learning
|
| 56 |
+
- **Language(s):** N/A (Image model)
|
| 57 |
+
- **License:** MIT
|
| 58 |
+
|
| 59 |
+
---
|
| 60 |
+
|
| 61 |
+
## **Uses**
|
| 62 |
+
|
| 63 |
+
This model can be used for:
|
| 64 |
+
- Research in **diabetic retinopathy detection** and AI-assisted diagnosis
|
| 65 |
+
- Educational demonstrations of transfer learning on medical images
|
| 66 |
+
- Portfolio projects showcasing preprocessing, model training, and deployment
|
| 67 |
+
|
| 68 |
+
---
|
| 69 |
+
|
| 70 |
+
### **Example Usage**
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
import numpy as np
|
| 74 |
+
from keras.models import load_model
|
| 75 |
+
from PIL import Image
|
| 76 |
+
import requests
|
| 77 |
+
from io import BytesIO
|
| 78 |
+
from huggingface_hub import hf_hub_download
|
| 79 |
+
|
| 80 |
+
# Load the model from Hugging Face Hub
|
| 81 |
+
model_path = hf_hub_download(repo_id="RawanAlwadeya/TransferLearningDR", filename="TransferLearningDR.h5")
|
| 82 |
+
model = load_model(model_path)
|
| 83 |
+
|
| 84 |
+
# Preprocess an example image
|
| 85 |
+
def preprocess_image(image):
|
| 86 |
+
IMG_SIZE = (224, 224)
|
| 87 |
+
image = image.convert("RGB")
|
| 88 |
+
image = image.resize(IMG_SIZE)
|
| 89 |
+
img_array = np.array(image) / 255.0
|
| 90 |
+
img_array = np.expand_dims(img_array, axis=0) # add batch dimension
|
| 91 |
+
return img_array
|
| 92 |
+
|
| 93 |
+
# Example: load an image from URL
|
| 94 |
+
url = "https://example.com/sample_fundus.jpg"
|
| 95 |
+
response = requests.get(url)
|
| 96 |
+
image = Image.open(BytesIO(response.content))
|
| 97 |
+
|
| 98 |
+
img_array = preprocess_image(image)
|
| 99 |
+
prediction = model.predict(img_array)[0][0]
|
| 100 |
+
|
| 101 |
+
if prediction >= 0.5:
|
| 102 |
+
print("⚠️ Diabetic Retinopathy likely detected")
|
| 103 |
+
else:
|
| 104 |
+
print("✅ Likely No DR")
|