A deep learning system that classifies brain MRI scans into three Alzheimer's disease stages using transfer learning with pre-trained CNN architectures (MobileNet, VGG, InceptionV3).
Overview • Medical Context • Dataset • Approach • Tech Stack • Installation • Usage • Results
A deep learning project that applies transfer learning with pre-trained convolutional neural networks (CNNs) to classify brain MRI scans into three Alzheimer's Disease stages. By leveraging ImageNet-pretrained architectures, the model achieves strong performance even with limited medical imaging data.
This project was developed as a CO324 semester project and explores how well general-purpose pre-trained CNN architectures transfer to specialized medical imaging tasks.
Why this matters: Alzheimer's disease affects over 55 million people worldwide. Early detection from MRI scans can enable timely intervention and significantly improve patient outcomes.
Alzheimer's Disease (AD) is a progressive neurodegenerative disorder that affects memory, thinking, and behavior. It's the most common cause of dementia, affecting millions of people globally.
| Stage | Abbreviation | Description |
|---|---|---|
| Cognitively Normal | CN | Healthy individuals with no cognitive impairment |
| Cognitive Impairment | CI / MCI | Mild cognitive impairment - early warning signs |
| Alzheimer's Disease | AD | Confirmed Alzheimer's with significant cognitive decline |
Magnetic Resonance Imaging (MRI) reveals structural changes in the brain associated with Alzheimer's - particularly hippocampal atrophy and ventricular enlargement. Deep learning models can detect these subtle patterns that may be difficult for the human eye.
The project uses brain MRI images organized into three classes:
diseases/
├── AD/ # Alzheimer's Disease scans
├── CI/ # Cognitive Impairment scans
└── CN/ # Cognitively Normal scans
Each class folder contains MRI images (also provided as ZIP archives: AD.zip, CI.zip, CN.zip for easy distribution).
The dataset follows the standard ADNI (Alzheimer's Disease Neuroimaging Initiative) classification convention, which is widely used in medical AI research.
Rather than training a CNN from scratch (which requires massive datasets), this project uses transfer learning - leveraging models pre-trained on ImageNet as feature extractors.
Why transfer learning works here:
- Pre-trained models already know how to detect generic visual features (edges, textures, shapes)
- Medical imaging datasets are typically small - training from scratch would overfit
- Fine-tuning is dramatically faster than training from scratch
- Achieves higher accuracy with limited data
| Model | Strengths | Trade-offs |
|---|---|---|
| MobileNet | Lightweight, fast inference, mobile-friendly | Slightly lower accuracy than larger models |
| VGG | Simple, deep architecture with strong feature extraction | Large model size, slower training |
| InceptionV3 | Multi-scale feature extraction via inception modules | More complex architecture |
MRI Images (224×224)
│
Data Augmentation (rotation, zoom, flip)
│
Pre-trained CNN (frozen base layers)
│
Custom Classification Head (Dense layers)
│
Softmax Output (3 classes: AD / CI / CN)
| Category | Technology | Purpose |
|---|---|---|
| Language | Python 3.7+ | Core implementation |
| Deep Learning | TensorFlow / Keras | Model architecture and training |
| Transfer Learning | ImageNet pre-trained weights | Feature extraction backbone |
| Image Processing | Keras ImageDataGenerator |
Data loading and augmentation |
| Notebook | Jupyter | Interactive development |
| Visualization | Matplotlib | Training curves and results |
| Parameter | Value |
|---|---|
| Input Image Size | 224 × 224 × 3 |
| Pre-trained Weights | ImageNet |
| Epochs | 20 |
| Number of Classes | 3 (AD, CI, CN) |
| Output Activation | Softmax |
- Python 3.7+
- Jupyter Notebook or JupyterLab
- GPU recommended for training (CPU works but slower)
# Clone the repository
git clone https://github.com/zishnusarker/Alzheimer-Detection.git
cd Alzheimer-Detection
# Create and activate virtual environment
python -m venv venv
# Windows
venv\Scripts\activate
# Linux / macOS
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtcd diseases
unzip AD.zip
unzip CI.zip
unzip CN.zipjupyter notebook pr-final-project.ipynbThe notebook walks through:
- Library imports - TensorFlow, Keras, NumPy, Matplotlib
- Data loading - Loading MRI images with
ImageDataGenerator - Data augmentation - Rotation, flip, zoom for robustness
- Model building - Pre-trained backbone + custom classification head
- Training - 20 epochs with Adam optimizer
- Evaluation - Accuracy, loss curves, model comparison
- Prediction - Classify new MRI scans
The project generates several visualizations (see code ss/ folder):
- Model Architecture - Visual diagram of the transfer learning setup
- Accuracy & Loss Curves - Training and validation metrics across epochs
- Final Evaluation - Test set accuracy and classification metrics
- Prediction Samples - Model predictions on unseen MRI scans
The code ss/ and other ss/ folders contain:
- Code execution screenshots
- Training accuracy graphs
- Model architecture visualizations
- Comparative performance analysis
- Transfer learning concept illustrations
Alzheimer-Detection/
├── README.md # Project documentation
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
├── CO324 Project Report.doc # Full academic project report
├── pr-final-project.ipynb # Main Jupyter notebook
│
├── diseases/ # Dataset (3 classes)
│ ├── AD/ # Alzheimer's Disease MRI images
│ ├── AD.zip # Compressed AD dataset
│ ├── CI/ # Cognitive Impairment MRI images
│ ├── CI.zip # Compressed CI dataset
│ ├── CN/ # Cognitively Normal MRI images
│ └── CN.zip # Compressed CN dataset
│
├── code ss/ # Code execution screenshots
│ ├── architecture of the model.png
│ ├── accuracy graph.png
│ ├── accuracy and loss.png
│ ├── model evaluate.png
│ ├── final result evaluate.png
│ └── s1.png, s2.png, ... s13.png
│
└── other ss/ # Conceptual diagrams & references
├── Transfer Learning with Pre-trained Deep Learning Models.png
└── graph Performance of off-the-shelf pre-trained models.png
What is Transfer Learning?
Transfer learning is a machine learning technique where a model developed for one task is reused as the starting point for a second task. In this project, CNNs pre-trained on ImageNet (1.2 million natural images, 1000 classes) are adapted to classify brain MRI scans - even though MRI images look nothing like the original training data, the low-level visual features (edges, textures, shapes) learned by these models transfer remarkably well.
Why freeze pre-trained layers?
The early layers of a CNN learn generic features (edges, colors, textures). These are useful for any image classification task, so we freeze them to preserve what they've learned. We only train the final classification layers on our specific task (Alzheimer's detection), which prevents overfitting and dramatically reduces training time.
Why 224×224 input size?
This is the standard input size for most ImageNet pre-trained models (VGG, ResNet, MobileNet, InceptionV3). Using this size lets us use the pre-trained weights directly without modification. The original MRI images are resized to match this dimension.
Why is data augmentation important in medical imaging?
Medical imaging datasets are typically small (hundreds to thousands of images, vs millions in ImageNet). Data augmentation - rotating, flipping, zooming, shifting - artificially expands the dataset by creating variations of existing images. This helps the model generalize better and reduces overfitting.
Why Softmax activation in the output layer?
Softmax converts raw model outputs into probabilities that sum to 1.0 across all classes. For multi-class classification (AD vs CI vs CN), it gives us interpretable probabilities like "70% AD, 20% CI, 10% CN" for each scan.
This project was developed as part of CO324 (Machine Learning / Pattern Recognition) coursework. The full academic report is available as CO324 Project Report.doc in the repository, covering:
- Literature review of Alzheimer's detection approaches
- Dataset description and preprocessing
- Model architecture and training methodology
- Experimental results and analysis
- Comparison with existing approaches
- Conclusions and future work
- Use larger, more diverse datasets (ADNI, OASIS)
- Implement ensemble methods combining multiple pre-trained models
- Add explainability with Grad-CAM to show what regions the model focuses on
- Experiment with 3D CNNs for volumetric MRI analysis
- Deploy as a web app using Flask/Streamlit for clinical demonstration
- Add confusion matrix, ROC curves, and detailed classification reports
- Experiment with newer architectures (EfficientNet, Vision Transformer)
- Fine-tune the entire network after initial transfer learning phase
- Cross-validation for more robust accuracy estimation
This project is for educational and research purposes only. It is not a diagnostic tool and must not be used for actual medical diagnosis or treatment decisions. Alzheimer's diagnosis requires comprehensive clinical evaluation by qualified medical professionals, including neurological exams, cognitive testing, and additional imaging studies. Always consult healthcare providers for medical decisions.
This project is available under the MIT License.
Made with ❤️ for healthcare AI education
Applying deep learning to early Alzheimer's detection 🧠