This project aims to develop a machine learning model capable of detecting diabetic retinopathy from retinal images.
The repository contains the following files and directories:
label-rule.json
: Contains labeling rules for the dataset.preprocess.py
: Script for preprocessing images.seperate-dataset.py
: Script to separate the dataset into training and validation sets.train.py
: Script to train the machine learning model.utility
: Directory containing utility functions and modules:model.py
: Defines the machine learning model architecture and training functions.
To set up the project on your local machine, follow these steps:
git clone https://github.com/abiwinanda/diabetic-retinopathy-detection.git
cd diabetic-retinopathy-detection
It is recommended to use a virtual environment to manage dependencies.
python3 -m venv venv
source venv/bin/activate # On Windows, use venv\Scripts\activate
Ensure you have the required Python packages installed. Since the repository doesn't provide a requirements.txt
, you may need to install the dependencies manually based on the imports in the scripts.
For example:
pip install numpy pandas tensorflow opencv-python
The project involves three main steps: data preprocessing, dataset separation, and model training.
Run the preprocess.py
script to preprocess the retinal images. This may include resizing, normalization, and other image enhancement techniques.
python preprocess.py
Ensure that the script points to the correct directory containing your raw images.
Separate the dataset into training and validation sets using the seperate-dataset.py
script.
python seperate-dataset.py
This script organizes your data into appropriate directories for training and validation.
Train the machine learning model using the train.py
script.
python train.py
The training script utilizes the model architecture defined in utility/model.py
.
The utility/
directory contains helper functions and modules. Below is an overview of the most important module:
model.py
- Defines the model architecture.
- Includes training-related functions such as:
train_model()
: Handles the training loop, including forward propagation, loss calculation, and backpropagation.get_trainable_params()
: Identifies and returns the parameters of the model that should be updated during training.
Refer to model.py
for details.