Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,103 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
tags:
|
| 6 |
+
- medical
|
| 7 |
+
- vision
|
| 8 |
+
- image-classification
|
| 9 |
+
- multi-label
|
| 10 |
+
- fundus-imaging
|
| 11 |
+
- ophthalmology
|
| 12 |
+
- efficientnet
|
| 13 |
+
datasets:
|
| 14 |
+
- ODIR-5K
|
| 15 |
+
- RFMiD
|
| 16 |
+
metrics:
|
| 17 |
+
- f1
|
| 18 |
+
- map
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# OcuNet v4 - Multi-Label Retinal Disease Classification
|
| 22 |
+
|
| 23 |
+
OcuNet v4 is an advanced multi-label deep learning model designed for ophthalmic disease screening using retinal fundus images. Based on the **EfficientNet-B3** architecture, it classifies images into 30 distinct categories, including 28 specific diseases, a general “Disease Risk” class, and a “Normal” class. The model serves as a robust clinical decision support tool capable of detecting concurring pathologies in a single image.
|
| 24 |
+
|
| 25 |
+
## Model Details
|
| 26 |
+
|
| 27 |
+
- **Model Type:** Multi-Label Image Classifier
|
| 28 |
+
- **Architecture:** EfficientNet-B3 (Pre-trained on ImageNet)
|
| 29 |
+
- **Input Resolution:** 384x384 RGB
|
| 30 |
+
- **Loss Function:** Asymmetric Loss (Optimized for heavily imbalanced multi-label datasets)
|
| 31 |
+
- **Framework:** PyTorch
|
| 32 |
+
- **Version:** OcuNet Phase 2 (v4.2.0)
|
| 33 |
+
|
| 34 |
+
## Intended Use
|
| 35 |
+
|
| 36 |
+
- **Primary Use Case:** Automated screening and diagnosis support of ophthalmic conditions from retinal fundus imagery.
|
| 37 |
+
- **Target Audience:** Ophthalmologists, medical practitioners, and researchers in medical imaging.
|
| 38 |
+
- **Out of Scope:** This model is intended for clinical *decision support only* and should not replace professional medical diagnosis.
|
| 39 |
+
|
| 40 |
+
## Dataset
|
| 41 |
+
|
| 42 |
+
The model was trained on a comprehensive compilation of datasets comprising **23,659 images** in total:
|
| 43 |
+
1. **Phase 1 Dataset:** ODIR-5K (Ocular Disease Intelligent Recognition)
|
| 44 |
+
2. **Phase 2 Dataset:** RFMiD (Retinal Fundus Multi-Disease Image Dataset)
|
| 45 |
+
3. **Phase 3 Dataset:** Proprietary Augmented Dataset addressing class imbalances
|
| 46 |
+
|
| 47 |
+
**Data Splits:**
|
| 48 |
+
- **Train:** 16,240 images
|
| 49 |
+
- **Validation:** 3,709 images
|
| 50 |
+
- **Test:** 3,710 images
|
| 51 |
+
|
| 52 |
+
## Class Distribution (30 Labels)
|
| 53 |
+
The model predicts the following conditions:
|
| 54 |
+
* `Disease_Risk`, `DR` (Diabetic Retinopathy), `ARMD` (Age-related Macular Degeneration), `MH` (Macular Hole), `DN` (Diabetic Neuropathy), `MYA` (Myopia), `BRVO`, `TSLN`, `ERM`, `LS`, `MS`, `CSR`, `ODC` (Optic Disc Cupping), `CRVO`, `AH`, `ODP`, `ODE`, `AION`, `PT`, `RT`, `RS`, `CRS`, `EDN`, `RPEC`, `MHL`, `CATARACT`, `GLAUCOMA`, `NORMAL`, `RD` (Retinal Detachment), `RP` (Retinitis Pigmentosa)
|
| 55 |
+
|
| 56 |
+
## Training Configuration
|
| 57 |
+
- **Batch Size:** 16 (Gradient Accumulation Steps = 1)
|
| 58 |
+
- **Epochs:** 200 (Early stopping triggered at Epoch 104)
|
| 59 |
+
- **Optimizer Learning Rate:** 1.00e-07 to 3.00e-04 (Peak)
|
| 60 |
+
- **Warmup:** 5 epochs
|
| 61 |
+
- **Hardware Profile:** Trained on NVIDIA GeForce RTX 4050 Laptop GPU (6GB VRAM) using advanced training techniques such as EMA (Exponential Moving Average) and class-specific threshold tuning (Calibration mapping).
|
| 62 |
+
|
| 63 |
+
## Preprocessing & Augmentation
|
| 64 |
+
- **Preprocessing:** Fundus ROI Crop (removes black borders) and CLAHE (Contrast Limited Adaptive Histogram Equalization) applied to the green channel.
|
| 65 |
+
- **Augmentation:** RandAugment, Random Erasing, Color Jittering, and Geometric transformations (tuned specifically to avoid unrealistic medical artifacts).
|
| 66 |
+
|
| 67 |
+
## Evaluation Results (Validation Set)
|
| 68 |
+
|
| 69 |
+
The model's optimal performance was achieved at **Epoch 74**:
|
| 70 |
+
- **Best Validation mean Average Precision (mAP):** 0.4914
|
| 71 |
+
- **Best Validation F1-Score:** 0.2517 (Macro)
|
| 72 |
+
|
| 73 |
+
*(Note: Multi-label classification with 30 classes containing extremely rare and concurrent pathologies typically yields lower raw F1/mAP metric scales compared to binary classification. Per-class metrics showcase higher reliability on prevalent diseases like DR, Glaucoma, and Myopia).*
|
| 74 |
+
|
| 75 |
+
## How to run inference
|
| 76 |
+
|
| 77 |
+
You can use the model with the customized prediction pipeline included in the OcuNet repository:
|
| 78 |
+
|
| 79 |
+
```python
|
| 80 |
+
from predict import ImprovedMultiLabelClassifier
|
| 81 |
+
|
| 82 |
+
# Initialize the model with confidence thresholds
|
| 83 |
+
classifier = ImprovedMultiLabelClassifier(
|
| 84 |
+
checkpoint_path="models/ocunetv4.pth",
|
| 85 |
+
config_path="config/config.yaml"
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
# Run Inference
|
| 89 |
+
result = classifier.predict("path/to/retinal_image.jpg")
|
| 90 |
+
|
| 91 |
+
# Print detected diseases
|
| 92 |
+
print(f"Detected: {result['detected_diseases']}")
|
| 93 |
+
for disease, prob in result['probabilities'].items():
|
| 94 |
+
print(f"{disease}: {prob:.2%}")
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
## Limitations and Bias
|
| 98 |
+
- **Class Imbalance:** Despite using Asymmetric Loss and augmentation, extremely rare anomalies (e.g., MHL, ERM, RT) have fewer representations, which may lead to varying thresholds of sensitivity.
|
| 99 |
+
- **Image Quality Reliance:** Performance may degrade significantly if input images exhibit uncorrected poor illumination or lack proper fundus anatomical visibility.
|
| 100 |
+
- **Generalization:** Model is trained on adult fundus images; efficacy on pediatric patient populations is untested.
|
| 101 |
+
|
| 102 |
+
## Disclaimer
|
| 103 |
+
This model is developed for research and educational purposes. It must thoroughly undergo clinical trials and obtain appropriate regulatory approval before deployment in real-world clinical environments.
|