VisionCare is a multi-task deep learning project for automated grading of Diabetic Retinopathy (DR) and Diabetic Macular Edema (DME) from retinal fundus images.
The goal: Assist ophthalmologists and healthcare professionals in early detection and accurate classification of disease severity, improving patient outcomes and reducing vision loss.
Detailed documentation and methods are available in the docs folder.
Diabetic Retinopathy (DR) and Diabetic Macular Edema (DME) are leading causes of vision loss worldwide, especially in diabetic patients. Manual grading is:
- Time-consuming
- Subjective
- Requires expert ophthalmologists
VisionCare aims to:
- Provide an automated, reliable, and scalable solution for DR and DME grading
- Deliver fast, consistent, objective assessments
- Advance AI in medical imaging research
- Multi-task classification:
- DR: 5 severity levels
- DME: 3 severity levels
- Custom preprocessing & augmentation pipeline
- Modular PyTorch codebase
- Cosine Annealing LR Scheduler
- Gradual Layer Unfreezing strategy
- Model checkpointing and reproducibility
Using the IDRiD Dataset:
| Task | Labels |
|---|---|
| DR | 0: No DR, 1: Mild, 2: Moderate, 3: Severe, 4: Proliferative |
| DME | 0: No DME, 1: Non-clinically significant, 2: Clinically significant |
The dataset is organized as follows:
data/B. Disease Grading/1. Original Images/a. Training Set/— Training imagesdata/B. Disease Grading/1. Original Images/b. Testing Set/— Testing imagesdata/B. Disease Grading/2. Groundtruths/— Ground truth CSV files (with both DR and DME severity labels)
- Clone the repository:
git clone https://github.com/A-Ahmed-i/Vision-Care.git
cd VisionCare- Create a virtual environment (recommended):
python3 -m venv vision-care
source vision-care/bin/activate- Install dependencies:
pip install -r requirements.txtYou can run the training process using either the main pipeline script or the dedicated training pipeline:
-
Main pipeline (recommended for full workflow):
python -m src.pipeline.main
The project is organized as follows:
VisionCare/
│
├── src/ # Main source code
│ ├── config/ # Configuration files and constants
│ │ └── constants.py # Project-wide constant values
│ ├── data/ # Data loading and custom dataset classes
│ │ ├── custom_data.py # Custom PyTorch Dataset definitions
│ │ └── data_loader.py # DataLoader utilities
│ ├── entities/ # Data models and entity definitions
│ │ └── models.py # Data model classes
│ ├── loss/ # Custom loss functions
│ │ └── multitask_loss.py # Multi-task loss for DR & DME
│ ├── models/ # Model architectures
│ │ └── eyenet.py # Main neural network architecture
│ ├── pipeline/ # Training and main pipeline scripts
│ │ ├── main.py # Entry point for running the pipeline
│ │ └── training_pipeline.py # Training workflow
│ ├── preprocessing/ # Image preprocessing utilities
│ │ └── fundus_preprocessing.py # Fundus image preprocessing steps
│ ├── training/ # Training utilities
│ │ └── trainer.py # Training loop and logic
│ └── utils/ # Helper functions
│ └── helper.py # Utility functions
│
├── data/ # Dataset (images and ground truth CSVs)
│ └── B. Disease Grading/ # IDRiD dataset structure
│ ├── 1. Original Images/ # Raw images (train/test)
│ └── 2. Groundtruths/ # CSV files with DR & DME labels
│
├── checkpoint/ # Model checkpoints (saved weights)
│ └── best_model.pth # Example: best model weights
│
├── docs/ # Project documentation (Markdown files)
│ ├── 01_pipeline_overview.md
│ ├── 02_preprocessing.md
│ ├── 03_model_architecture.md
│ ├── 04_training_loss.md
│ └── 05_pipeline_results.md
│
├── requirements.txt # Python dependencies
├── setup.py # Project setup script
├── README.md # Project documentation
├── .gitignore # Git ignore rules
└── LICENSE # License file
Each folder and file is organized for clarity and modularity, making it easy to extend or modify the project.
- IDRiD Dataset
- PyTorch, NumPy, OpenCV, and other open-source libraries
- Inspired by research on multi-task learning for medical imaging
This project is licensed under the MIT License. See the LICENSE file for details.