Inspiration

While Alzheimer’s is progressive, it often isn’t caught early, severely limiting treatment options and reducing the time patients and families have to plan care. And with real-world clinics overloaded, the biggest risk is missing a case that should be flagged for follow-up. So I wanted to build an AI model that focuses on safety-first screening. (aka a model that’s optimized to reduce missed positives and stays reliable even when MRI scans vary in quality, contrast, and number)

What it does

MRI Detector is an assistive diagnostic prototype that identifies MRI features and patterns consistent with Alzheimer's and produces an interpretable risk signal for doctors. This includes a probability score in which the doctor can use to decide whether or not to diagnose. This model is:

  • designed to minimize false negatives (missed cases)
  • able to provide probability scores for doctors to choose a threshold on in order to flag

How we built it

Model: Transfer learning with InceptionResNetV2 because it has strong multi-scale feature extraction and deep representation capacity, which is useful for subtle anatomical changes in medical images. Also it came up on google search.

Dataset: I used a public Kaggle dataset with four classes: Moderately Demented, Mildly Demented, Very Mildly Demented, and Non Demented. Dataset: https://www.kaggle.com/datasets/uraninjo/augmented-alzheimer-mri-dataset

Preprocessing + Data Augmentation: Images are resized consistently, converted to 3-channel RGB, and normalized using the backbone’s preprocess_input. Because MRI data can vary widely, I applied data augmentation during training and used shuffling to reduce memorization and improve robustness.

Safety-focused optimization: The classes were heavily imbalanced (for example, the Moderately Demented class had very few images). Initially, the model reached ~94% accuracy but produced 30+ false negatives on validation/test (e.g., Mild/Very Mild predicted as Non Demented). To address this, I used class reweighting and then manually adjusted the class weights to prioritize reducing false negatives rather than optimizing accuracy alone.

Evaluation: Because accuracy can be misleading under class imbalance, I tracked precision and recall and reviewed performance via a confusion matrix, with a particular focus on missed dementia cases.

Challenges we ran into

From the Kaggle dataset, I decided to chose the original dataset over the already augmented dataset to better simulate real-world variation. Also, I wanted to augment the images myself to give myself a better grasp and practice over data augmentation. This posed a massive issue, which was that the number of non demented images far outweighed the rest of the images. Specifically, the moderately demented category only had 10 images to go from. Therefore, I had to learn about reweighting classes and how to nudge those weights to get the outcome I want (a more definite and accurate decision when in comes to splitting between having or not having Alzheimer's).

Accomplishments that we're proud of

  • Achieved ~99% accuracy and reduced false negatives from 30+ down to ~6 in held-out evaluation (prototype results)
  • Learned how to handle severe class imbalance with class weighting and metric-driven tuning

What we learned

  • Data augmentation should make medical sense; strong augmentation helps, but only if it is meaningful and makes sense
  • When it comes to AI models, sometimes accuracy alone isn't a sufficient metric, precision/recall and confusion matrices are better at revealing real failures

What's next for MRI Detector

I would like to add a "heatmap" feature that highlights areas of concern for images where the model is confident (I would also have to set a threshold that potential doctors could edit). Additionally, I would like to add a confidence feature, where based on the probability, it would notify doctors on how detailed they should be when checking the model's accuracy of the flag. For example, a moderately confident case would require less double-checking than a less confident case.

Built With

  • inceptionresenetv2
  • keras
  • python
  • tensorflow
Share this project:

Updates