January 2025 - May 2025
Cardiac MRI Classification (Comparative Study)
Technologies: Deep Learning - MobileNetV2, ResNet152V2, DenseNet201, InceptionV3
Four deep learning models, 63k cardiac MRI images, and an honest look at whether attention helps. It didn't.
Visit source
The question was simple. Take a big cardiac MRI dataset, point four deep learning architectures at the same job of telling normal scans from sick ones, and see how each one behaves.
The work, as usual, wasn't that simple.
The setup
The dataset has roughly 63,000 cardiac MRI images. I compared four transfer-learning architectures on the same task:
- MobileNetV2
- ResNet152V2
- DenseNet201
- InceptionV3
I didn't want to crown a winner before training started. I wanted to see how each model trained, where it struggled, what changed with augmentation and class weighting, and whether attention improved the results or just made the pipeline look fancier.
ML projects get performative fast. Add a block, add a graph, drop in a term from a paper, and the project looks sophisticated without being any better. I wanted mine to hold up when someone looked inside.
Training
I worked through transfer learning, data augmentation, class weighting, a spatial attention block and an attention ensemble, and tracked what each one changed in how the models behaved.
The dataset has about 1.5 normal images for every sick one, so class weighting was essential.
The results
Here is accuracy on the 20% validation split, with and without the spatial attention block:
| Model | Baseline | With attention |
|---|---|---|
| MobileNetV2 | 76.18% | 72.67% |
| ResNet152V2 | 77.44% | 74.09% |
| DenseNet201 | 76.31% | 74.39% |
| InceptionV3 | 70.15% | 70.36% |
Attention cost three of the four models between 1.9 and 3.5 points of accuracy, and moved InceptionV3 by 0.2.
The best single model was the plain ResNet152V2 baseline at 77.44%. MobileNetV2, the smallest of the four, had the best balanced accuracy at 78.15%. Averaging the attention models into an ensemble reached 77.80%, the highest accuracy in the study and 0.36 points above the best single model.
So the honest answer is no. On this dataset, the attention block made the pipeline look fancier and the numbers worse.
There's no separate test set, so read these numbers as a comparison between models.
What I took from it
Accuracy alone doesn't settle anything in medical imaging. A confidently wrong prediction is dangerous in anything health-related, even in research. So the repo has saved checkpoints, evaluation plots, reproducible training flows and the paper, and anyone can check the results themselves.
This project made me more careful with applied ML. Getting a notebook to run is easy. Building a training and evaluation pipeline that someone else can reason about is much harder.
I now trust models less and check more. I check the preprocessing, the evidence, whether a run repeats, and whether the pipeline says what I think it says.