This project implements a Convolutional Neural Network (CNN) for classifying MRI scans into various stages of Alzheimer's Disease using the Best Alzheimer's MRI Dataset.
The dataset comprises high-quality MRI scans labeled for Alzheimer's Disease progression. It can be downloaded from Kaggle.
The task is a classification problem to predict the stage of Alzheimer's Disease.
The dataset includes the following classes:
- Mild Impairment
- Moderate Impairment
- No Impairment
- Very Mild Impairment
The CNN model comprises two convolutional blocks followed by a fully connected classifier; influenced by TinyVGG16 architecture.
The model was evaluated on both training and test datasets. Below are the key metrics:
- Loss: 0.0039
- Accuracy: 99.90%
- Precision: 0.9990
- Recall: 0.9990
- F1-Score: 0.9990
- Loss: 0.1574
- Accuracy: 95.47%
- Precision: 0.9563
- Recall: 0.9547
- F1-Score: 0.9548
git clone https://github.com/Recker-Dev/alzheimer-cnn-tinyVGG16.git
cd alzheimer-cnn
Follow these steps to set up and run the project:
-
Create a Conda environment
Run the following command to create a new environment namedalz_torch_cnn
with Python 3.10:conda create --name alz_torch_cnn python=3.10 -y
-
Activate the environment
conda activate alz_torch_cnn
-
Install dependencies
pip install -r requirements.txt
-
Deactivate the environment
conda deactivate
You can interact with the model in two ways:
-
Using Jupyter Notebooks
There are notebooks provided under thenotebooks
section. These notebooks allow you to experiment with the model, visualize predictions, and understand its workings in a step-by-step manner. -
Using the Streamlit Application
For users without much coding background, an application (app.py
) is provided for easy inference. Follow these steps to use the app:- Activate the environment:
conda activate alz_torch_cnn
- Run the Streamlit app:
streamlit run app.py
- Activate the environment:
-
Testing Images
Testing images are provided in theSample Testing Alzheimer Dataset
folder. Use these images to test the model's performance through the Streamlit app or the provided notebooks.
root
├── app.py # Main Streamlit application for user interaction
├── models
│ └── alz_CNN.pt # Trained PyTorch model for Alzheimer's classification
├── model_arch.py # Defines the architecture of the Alzheimer's classification model
├── notebooks # Jupyter notebooks for development and analysis
│ ├── Alzehmier_CNN.ipynb # Notebook for training the Alzheimer's classification model
│ └── predict_using_alzehmierCNN.ipynb # Notebook for demonstrating model prediction
└── Sample Testing Alzehimer Dataset # Folder containing sample images for testing
└── test # Subfolder containing images for inference/testing
├── Mild Impairment
├── Moderate Impairment
├── No Impairment
└── Very Mild Impairment
└── requirements.txt # File listing required Python libraries