This repository contains a Jupyter Notebook that implements a deep learning pipeline to classify retinal fundus images into four categories: Cataract, Diabetic Retinopathy, Glaucoma, and Normal.
fundus-disease-classification/
├── notebook.ipynb # Main Jupyter Notebook
├── requirements.txt # Python dependencies
├── .gitignore # Files to ignore in Git
└── split/ # Dataset folder (download manually)
├── train/ # Training images
├── val/ # Validation images
└── test/ # Test images
-
Download the dataset from:
https://www.kaggle.com/datasets/drskprabhakar/cataract-dr-normal-glaucoma-fundus-images-dataset
-
Unzip or extract so that the top-level folder is named
split
, containingtrain/
,val/
, andtest/
subfolders. -
Place the entire
split/
folder at the root of this repository, alongsidenotebook.ipynb
.
-
Clone this repository
git clone https://github.com/Amaan-developpeur/fundus-disease-classification.git cd fundus-disease-classification
-
Create a virtual environment (optional but recommended)
python -m venv venv source venv/bin/activate # macOS/Linux venv\Scripts\activate # Windows
-
Install dependencies
pip install -r requirements.txt
-
Verify dataset placement Ensure the
split/
folder (withtrain/
,val/
,test/
) lives here:ls # you should see: # notebook.ipynb requirements.txt split/
-
Launch Jupyter Lab or Notebook:
jupyter notebook
-
Open
notebook.ipynb
and run cells from top to bottom.
- Step 1: Data Setup — Verify folder structure and list classes.
- Step 2: Data Inspection — Image counts, sample viewing, blur & quality checks.
- Step 3: Data Generators — Define
ImageDataGenerator
for train/val/test. - Step 4: Baseline CNN — Build & train a custom CNN from scratch.
- Step 5: Transfer Learning — Feature extraction and fine-tuning with MobileNetV2.
- Step 6: Logistic Regression Head — Frozen backbone + logistic classifier.
- Step 7: Evaluation & Interpretation — Confusion matrices, classification reports, Grad-CAM.
- Step 8: Conclusion & Future Work
Contents of requirements.txt
:
tensorflow>=2.10
keras
numpy
pandas
matplotlib
scikit-learn
opencv-python
Pillow
(Adjust versions as needed.)
This notebook and the resulting model are for academic and research purposes only.This is a prototype model to assist the domain experts but not diagnostic tool.