About the Project Inspiration
Early-stage Alzheimer’s disease is one of the hardest conditions to detect reliably. Subtle brain changes are often missed, and many AI systems appear accurate only because they default to predicting “Normal” due to heavily imbalanced medical datasets. This gap between high reported accuracy and poor real clinical usefulness motivated this project. The goal was not to maximize accuracy, but to design a system that does not ignore rare but critical cases and can explain why a prediction is made.
What I Built
I built an ensemble-based deep learning system for classifying Alzheimer’s stages from brain MRI scans. The system uses multiple independently trained ResNet-18 models whose predictions are combined using soft voting. To address medical data imbalance, I implemented a weighted cross-entropy loss that explicitly penalizes missed dementia cases. To improve trust and interpretability, I integrated Grad-CAM, allowing visualization of which brain regions influenced each prediction. The model is wrapped in a Gradio interface for interactive testing.
How I Built It
MRI images were stored as raw bytes in Parquet files and decoded using OpenCV.
Images were standardized to 224×224 resolution with controlled augmentation to avoid overfitting.
Transfer learning was applied using ImageNet-pretrained ResNet-18, with partial layer freezing.
Three models were trained with different random seeds and combined via averaged logits.
Performance was evaluated using confusion matrices, ROC-AUC, and class-wise metrics rather than accuracy alone.
Grad-CAM was applied to the final convolution layer to generate explainable attention maps.
Challenges Faced
Severe class imbalance caused early models to collapse toward “Normal” predictions. This required rethinking loss functions rather than model architecture.
Data handling was non-trivial due to MRI images being embedded in Parquet format rather than standard image folders.
Evaluation pitfalls were a challenge high accuracy initially masked complete failure on rare classes.
Explainability integration required careful gradient handling and layer selection to produce meaningful visual outputs.
What I Learned
This project reinforced that accuracy is a misleading metric in medical AI. Handling imbalance, validating with the right metrics, and providing explainability are not optional they determine whether a model is usable at all. I also learned that simpler architectures, when combined with correct training strategies, can outperform more complex models that ignore data realities.
Built With
- convolutional
- ensemble
- grad-cam-(pytorch-grad-cam)
- matplotlib
- networks
- neural
- numpy
- opencv
- pandas-(parquet)
- python
- pytorch
- resnet-18
- scikit-learn
- seaborn
- torchvision
- torchvision-(resnet-18)